@salsita-ai/sdk 0.50.0-develop.d87b28256e → 0.50.0-develop.d96df76afa

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 (398) hide show
  1. package/dist/application-spec/errors/diagnostic-codes.d.ts +9 -0
  2. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  3. package/dist/application-spec/errors/diagnostic-messages.d.ts +10 -1
  4. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  5. package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
  6. package/dist/application-spec/generate-application/code/templates/application-types.js +6 -6
  7. package/dist/application-spec/generate-application/code/templates/common/doc-comment.d.ts +2 -0
  8. package/dist/application-spec/generate-application/code/templates/common/doc-comment.js +1 -0
  9. package/dist/application-spec/generate-application/code/templates/configurator-globals.d.ts +2 -1
  10. package/dist/application-spec/generate-application/code/templates/configurator-globals.js +19 -6
  11. package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.js +7 -7
  12. package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.d.ts +12 -0
  13. package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.js +7 -0
  14. package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +24 -22
  15. package/dist/application-spec/generate-application/code/templates/global-definition/index.d.ts +1 -0
  16. package/dist/application-spec/generate-application/code/templates/global-definition/index.js +1 -1
  17. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +2 -1
  18. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
  19. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +33 -3
  20. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
  21. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.d.ts +9 -0
  22. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.js +1 -0
  23. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +4 -1
  24. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
  25. package/dist/configurator/app-loader-content/DefaultAppLoaderContent.d.ts +2 -0
  26. package/dist/configurator/app-loader-content/DefaultAppLoaderContent.js +5 -0
  27. package/dist/configurator/app-loader-content/app-loader-content-name.d.ts +5 -0
  28. package/dist/configurator/app-loader-content/app-loader-content-name.js +1 -0
  29. package/dist/configurator/app-loader-content/index.d.ts +2 -0
  30. package/dist/configurator/app-loader-content/index.js +1 -0
  31. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  32. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  33. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +12 -2
  34. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  35. package/dist/configurator/application-runtime/extensions/systems/canvas-system.d.ts +8 -0
  36. package/dist/configurator/application-runtime/extensions/systems/canvas-system.js +1 -1
  37. package/dist/configurator/application-runtime/extensions/systems/export-system/export-busy-error.d.ts +8 -0
  38. package/dist/configurator/application-runtime/extensions/systems/export-system/export-busy-error.js +1 -0
  39. package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.d.ts +23 -1
  40. package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.js +1 -1
  41. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +14 -1
  42. package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
  43. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +45 -4
  44. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  45. package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.d.ts +14 -5
  46. package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.js +1 -1
  47. package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -1
  48. package/dist/configurator/common/configurator-interface.d.ts +90 -4
  49. package/dist/configurator/common/configurator-interface.js +1 -1
  50. package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.d.ts +3 -3
  51. package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.js +1 -1
  52. package/dist/configurator/configurator-context/PreviewContextProvider.js +1 -1
  53. package/dist/configurator/configurator-context/configurator-hooks/layout-hooks.d.ts +4 -0
  54. package/dist/configurator/configurator-context/configurator-routing/ConfiguratorRoutingProvider.js +1 -1
  55. package/dist/configurator/index.d.ts +1 -0
  56. package/dist/configurator/index.js +1 -1
  57. package/dist/configurator/pages/ConfiguratorErrorPage.d.ts +0 -1
  58. package/dist/configurator/pages/ConfiguratorErrorPage.js +1 -1
  59. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  60. package/dist/configurator/pages/default-configurator-elements.d.ts +4 -3
  61. package/dist/configurator/pages/default-configurator-elements.js +1 -1
  62. package/dist/configurator/pages/default-elements/index.d.ts +1 -0
  63. package/dist/configurator/pages/default-elements/index.js +1 -1
  64. package/dist/configurator/pages/default-elements/scene-controls/BuiltInAddEntityFab.d.ts +3 -0
  65. package/dist/configurator/pages/default-elements/scene-controls/BuiltInAddEntityFab.js +1 -0
  66. package/dist/configurator/pages/default-elements/scene-controls/BuiltInDeleteEntityFab.d.ts +3 -0
  67. package/dist/configurator/pages/default-elements/scene-controls/BuiltInDeleteEntityFab.js +1 -0
  68. package/dist/configurator/pages/default-elements/scene-controls/BuiltInNavigationHotspot.d.ts +3 -0
  69. package/dist/configurator/pages/default-elements/scene-controls/BuiltInNavigationHotspot.js +1 -0
  70. package/dist/configurator/pages/default-elements/scene-controls/BuiltInSelectionHotspot.d.ts +3 -0
  71. package/dist/configurator/pages/default-elements/scene-controls/BuiltInSelectionHotspot.js +1 -0
  72. package/dist/configurator/pages/default-elements/scene-controls/BuiltInToolMenuFab.d.ts +3 -0
  73. package/dist/configurator/pages/default-elements/scene-controls/BuiltInToolMenuFab.js +1 -0
  74. package/dist/configurator/pages/default-elements/scene-controls/index.d.ts +6 -0
  75. package/dist/configurator/pages/default-elements/scene-controls/index.js +1 -0
  76. package/dist/configurator/pages/default-elements/scene-controls/scene-control-elements.d.ts +6 -0
  77. package/dist/configurator/pages/default-elements/scene-controls/scene-control-elements.js +1 -0
  78. package/dist/configurator/scene/index.d.ts +1 -0
  79. package/dist/configurator/scene/index.js +1 -1
  80. package/dist/configurator/scene/scene-controls/ToolFab.d.ts +4 -0
  81. package/dist/configurator/scene/scene-controls/ToolFab.js +1 -1
  82. package/dist/configurator/scene/scene-controls/use-scene-control-tooltip.d.ts +2 -1
  83. package/dist/configurator/scene/scene-entity/scene-controls/SceneEntityHtmlHotspots.js +1 -1
  84. package/dist/configurator/toolbar-actions/index.d.ts +3 -0
  85. package/dist/configurator/toolbar-actions/index.js +1 -0
  86. package/dist/configurator/toolbar-actions/use-assistant-panel.d.ts +18 -0
  87. package/dist/configurator/toolbar-actions/use-assistant-panel.js +1 -0
  88. package/dist/configurator/toolbar-actions/use-measurements.d.ts +35 -0
  89. package/dist/configurator/toolbar-actions/use-measurements.js +1 -0
  90. package/dist/configurator/toolbar-actions/use-toolbar-actions.d.ts +100 -0
  91. package/dist/configurator/toolbar-actions/use-toolbar-actions.js +1 -0
  92. package/dist/configurator/toolbar-actions/use-toolbar-help.d.ts +7 -0
  93. package/dist/configurator/toolbar-actions/use-toolbar-help.js +1 -0
  94. package/dist/configurator/ui/assistant/AssistantChips.d.ts +3 -2
  95. package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
  96. package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +1 -1
  97. package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
  98. package/dist/configurator/ui/assistant/alert/AssistantAlert.d.ts +8 -0
  99. package/dist/configurator/ui/assistant/alert/AssistantAlert.js +1 -0
  100. package/dist/configurator/ui/assistant/alert/index.d.ts +2 -0
  101. package/dist/configurator/ui/assistant/alert/index.js +1 -0
  102. package/dist/configurator/ui/assistant/alert/remark-alerts.d.ts +10 -0
  103. package/dist/configurator/ui/assistant/alert/remark-alerts.js +1 -0
  104. package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -1
  105. package/dist/configurator/ui/assistant/form/compose-answer.d.ts +1 -1
  106. package/dist/configurator/ui/assistant/form/compose-answer.js +1 -1
  107. package/dist/configurator/ui/assistant/form/form-model.d.ts +3 -4
  108. package/dist/configurator/ui/assistant/form/form-state.d.ts +1 -1
  109. package/dist/configurator/ui/assistant/form/index.d.ts +2 -0
  110. package/dist/configurator/ui/assistant/form/index.js +1 -1
  111. package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +3 -2
  112. package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -1
  113. package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +1 -1
  114. package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -1
  115. package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.d.ts +3 -0
  116. package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.js +1 -0
  117. package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.d.ts +31 -0
  118. package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.js +1 -0
  119. package/dist/configurator/ui/assistant/form/{form-element-definition.d.ts → registry/form-element-definition.d.ts} +3 -1
  120. package/dist/configurator/ui/assistant/form/registry/form-element-definition.js +1 -0
  121. package/dist/configurator/ui/assistant/form/{form-registry.d.ts → registry/form-registry.d.ts} +2 -2
  122. package/dist/configurator/ui/assistant/form/registry/form-registry.js +1 -0
  123. package/dist/configurator/ui/assistant/form/registry/index.d.ts +6 -0
  124. package/dist/configurator/ui/assistant/form/registry/index.js +1 -0
  125. package/dist/configurator/ui/assistant/form/registry/use-form-registry.d.ts +8 -0
  126. package/dist/configurator/ui/assistant/form/registry/use-form-registry.js +1 -0
  127. package/dist/configurator/ui/assistant/form-elements/FormCard.d.ts +9 -0
  128. package/dist/configurator/ui/assistant/form-elements/FormCard.js +1 -0
  129. package/dist/configurator/ui/assistant/form-elements/FormConfirm.d.ts +9 -0
  130. package/dist/configurator/ui/assistant/form-elements/FormConfirm.js +1 -0
  131. package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +4 -1
  132. package/dist/configurator/ui/assistant/form-elements/FormNumber.d.ts +9 -0
  133. package/dist/configurator/ui/assistant/form-elements/FormNumber.js +1 -0
  134. package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +4 -1
  135. package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +4 -1
  136. package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -1
  137. package/dist/configurator/ui/assistant/form-elements/FormSwatch.d.ts +10 -0
  138. package/dist/configurator/ui/assistant/form-elements/FormSwatch.js +1 -0
  139. package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +4 -1
  140. package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -1
  141. package/dist/configurator/ui/assistant/form-elements/clamp-form-number.d.ts +10 -0
  142. package/dist/configurator/ui/assistant/form-elements/clamp-form-number.js +1 -0
  143. package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +20 -16
  144. package/dist/configurator/ui/assistant/form-elements/index.d.ts +4 -0
  145. package/dist/configurator/ui/assistant/form-elements/index.js +1 -1
  146. package/dist/configurator/ui/assistant/index.d.ts +3 -0
  147. package/dist/configurator/ui/assistant/index.js +1 -1
  148. package/dist/configurator/ui/assistant/resource-image/index.d.ts +1 -1
  149. package/dist/configurator/ui/assistant/resource-image/index.js +1 -1
  150. package/dist/configurator/ui/assistant/resource-image/resource-path.d.ts +0 -9
  151. package/dist/configurator/ui/assistant/resource-image/resource-path.js +1 -1
  152. package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +9 -0
  153. package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -0
  154. package/dist/configurator/ui/assistant/screenshots/index.d.ts +2 -0
  155. package/dist/configurator/ui/assistant/screenshots/index.js +1 -0
  156. package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +14 -0
  157. package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -0
  158. package/dist/configurator/ui/assistant/streamed-markdown.d.ts +2 -2
  159. package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
  160. package/dist/configurator/ui/assistant/tool-chip.js +1 -1
  161. package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
  162. package/dist/configurator/ui/configurator-layout/slots/canvas/SharedCanvas.js +1 -1
  163. package/dist/configurator/ui/configurator-layout/universal/ExportingOverlay.d.ts +5 -0
  164. package/dist/configurator/ui/configurator-layout/universal/ExportingOverlay.js +1 -0
  165. package/dist/configurator/ui/configurator-layout/universal/Layout.js +1 -1
  166. package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -1
  167. package/dist/configurator/ui/index.d.ts +1 -0
  168. package/dist/configurator/ui/index.js +1 -1
  169. package/dist/configurator/ui/legacy/layout/common/ReactiveInterfaceLayout.js +1 -1
  170. package/dist/configurator/ui/phoenix-layout-elements/AppLoader.js +2 -6
  171. package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -1
  172. package/dist/configurator/ui/phoenix-layout-elements/LanguageMenuAction.js +1 -1
  173. package/dist/configurator/ui/phoenix-layout-elements/LanguageToolbarButton.js +1 -1
  174. package/dist/configurator/ui/phoenix-layout-elements/MeasurementsMenuAction.js +1 -1
  175. package/dist/configurator/ui/phoenix-layout-elements/MeasurementsToolbarButton.js +1 -1
  176. package/dist/configurator/ui/phoenix-layout-elements/ShareToolbarButton.js +1 -1
  177. package/dist/configurator/ui/phoenix-layout-elements/measurements/DimensionUnitSelector.js +1 -1
  178. package/dist/configurator/ui/phoenix-layout-elements/measurements/MeasurementsIndicatorsSwitch.js +1 -1
  179. package/dist/configurator/ui/phoenix-layout-elements/share/ShareModal.js +1 -1
  180. package/dist/configurator/ui/phoenix-layout-elements/share/use-share.d.ts +7 -8
  181. package/dist/configurator/ui/phoenix-layout-elements/share/use-share.js +1 -1
  182. package/dist/docs/complex-use-cases/focus-mode.mdx +2 -0
  183. package/dist/docs/fabs/basic.mdx +4 -0
  184. package/dist/docs/index.json +62 -1
  185. package/dist/docs/layouts/custom-layout.mdx +4 -2
  186. package/dist/docs/layouts/gallery/ardent-compressor.mdx +3516 -0
  187. package/dist/docs/layouts/gallery/fenwick-window.mdx +2803 -0
  188. package/dist/docs/layouts/gallery/ferrule-bar-station.mdx +6567 -0
  189. package/dist/docs/layouts/gallery/kestrel-kettle.mdx +1858 -0
  190. package/dist/docs/layouts/gallery/sunfold-solar.mdx +2683 -0
  191. package/dist/docs/other-features/client-side-rendering/declarative.mdx +1 -1
  192. package/dist/docs/other-features/navigation-hotspot.mdx +2 -0
  193. package/dist/docs/phoenix/configurator-interface.mdx +93 -10
  194. package/dist/docs/phoenix/layout-slots.mdx +4 -4
  195. package/dist/docs/phoenix/sdk-builder-workflow.mdx +1 -1
  196. package/dist/docs/phoenix/testing.mdx +2 -2
  197. package/dist/docs/selection-and-highlight/hotspots.mdx +2 -0
  198. package/dist/domain/application/assistant/assistant-manifest.d.ts +16 -1
  199. package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +8 -1
  200. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
  201. package/dist/domain/application/assistant/form/assistant-form-element-name.d.ts +11 -0
  202. package/dist/domain/application/assistant/form/assistant-form-element-name.js +8 -0
  203. package/dist/domain/application/assistant/form/assistant-form-elements.d.ts +174 -0
  204. package/dist/domain/application/assistant/form/assistant-form-elements.js +1 -0
  205. package/dist/domain/application/assistant/form/assistant-resource-path.d.ts +10 -0
  206. package/dist/domain/application/assistant/form/assistant-resource-path.js +1 -0
  207. package/dist/domain/application/assistant/form/index.d.ts +4 -0
  208. package/dist/domain/application/assistant/form/index.js +1 -0
  209. package/dist/domain/application/assistant/generate-assistant-prompt.d.ts +3 -0
  210. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  211. package/dist/domain/application/assistant/index.d.ts +2 -3
  212. package/dist/domain/application/assistant/index.js +1 -1
  213. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -1
  214. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +2 -0
  215. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -1
  216. package/dist/domain/available-system-components.d.ts +1 -1
  217. package/dist/domain/available-system-components.js +1 -1
  218. package/dist/domain/domain-context/store-system/store-system.d.ts +5 -0
  219. package/dist/domain/domain-context/store-system/store-system.js +1 -1
  220. package/dist/domain/domain-runtime/domain-runtime.d.ts +4 -0
  221. package/dist/domain/domain-runtime/environment/types.d.ts +1 -1
  222. package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
  223. package/dist/domain/domain-runtime/spec/index.js +1 -1
  224. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  225. package/dist/domain/domain-runtime/spec/module-checks/element-registration.d.ts +15 -1
  226. package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -1
  227. package/dist/domain/domain-runtime/spec/module-checks/find-assistant-form-element-errors.d.ts +12 -0
  228. package/dist/domain/domain-runtime/spec/module-checks/find-assistant-form-element-errors.js +1 -0
  229. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +2 -1
  230. package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
  231. package/dist/domain/domain-runtime/spec/selectors.d.ts +3 -1
  232. package/dist/domain/domain-runtime/spec/selectors.js +1 -1
  233. package/dist/domain/extensions/export-images/agent-screenshot.d.ts +24 -0
  234. package/dist/domain/extensions/export-images/agent-screenshot.js +1 -0
  235. package/dist/domain/extensions/{client-side-image.d.ts → export-images/client-side-image.d.ts} +2 -2
  236. package/dist/domain/extensions/export-images/client-side-image.js +1 -0
  237. package/dist/domain/extensions/export-images/index.d.ts +3 -0
  238. package/dist/domain/extensions/export-images/index.js +1 -0
  239. package/dist/domain/extensions/{save-template-thumbnail.d.ts → export-images/save-template-thumbnail.d.ts} +2 -2
  240. package/dist/domain/extensions/export-images/save-template-thumbnail.js +1 -0
  241. package/dist/domain/extensions/index.d.ts +1 -2
  242. package/dist/domain/extensions/index.js +1 -1
  243. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +2 -0
  244. package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
  245. package/dist/editor/domain-editors/apply-spec-update.d.ts +8 -1
  246. package/dist/editor/domain-editors/apply-spec-update.js +1 -1
  247. package/dist/editor/domain-editors/use-implementation-files.js +1 -1
  248. package/dist/editor/screenshot/ScreenshotHandler.js +1 -1
  249. package/dist/i18n/locales/cs/messages.js +1 -1
  250. package/dist/i18n/locales/da/messages.js +1 -1
  251. package/dist/i18n/locales/de/messages.js +1 -1
  252. package/dist/i18n/locales/de-AT/messages.js +1 -1
  253. package/dist/i18n/locales/en/messages.js +1 -1
  254. package/dist/i18n/locales/en-AU/messages.js +1 -1
  255. package/dist/i18n/locales/en-GB/messages.js +1 -1
  256. package/dist/i18n/locales/es/messages.js +1 -1
  257. package/dist/i18n/locales/fr/messages.js +1 -1
  258. package/dist/i18n/locales/hu/messages.js +1 -1
  259. package/dist/i18n/locales/it/messages.js +1 -1
  260. package/dist/i18n/locales/nl/messages.js +1 -1
  261. package/dist/i18n/locales/pl/messages.js +1 -1
  262. package/dist/i18n/locales/pt/messages.js +1 -1
  263. package/dist/i18n/locales/ro/messages.js +1 -1
  264. package/dist/i18n/locales/sk/messages.js +1 -1
  265. package/dist/i18n/locales/tr/messages.js +1 -1
  266. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +16 -0
  267. package/dist/legacy/domain-spec/spec/domain-spec.js +1 -1
  268. package/dist/react-sdk/application-runtime/common-services/analytics/frontend-analytics.d.ts +4 -0
  269. package/dist/react-sdk/application-runtime/hooks/index.d.ts +1 -0
  270. package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
  271. package/dist/react-sdk/application-runtime/hooks/responsive/index.d.ts +3 -0
  272. package/dist/react-sdk/application-runtime/hooks/responsive/index.js +1 -0
  273. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.d.ts +9 -0
  274. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.js +1 -0
  275. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.d.ts +26 -0
  276. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.js +1 -0
  277. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.d.ts +10 -0
  278. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.js +1 -0
  279. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.d.ts +24 -0
  280. package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.js +1 -0
  281. package/dist/react-sdk/application-runtime/hooks/use-phoenix-element-slots.d.ts +2 -1
  282. package/dist/react-sdk/application-runtime/index.d.ts +1 -0
  283. package/dist/react-sdk/application-runtime/integration/initialize.d.ts +7 -6
  284. package/dist/react-sdk/application-runtime/integration/initialize.js +1 -1
  285. package/dist/react-sdk/application-runtime/integration/selectors.d.ts +11 -2
  286. package/dist/react-sdk/application-runtime/integration/selectors.js +1 -1
  287. package/dist/react-sdk/application-runtime/integration/types.d.ts +5 -2
  288. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
  289. package/dist/react-sdk/application-runtime/responsive/actions.d.ts +47 -0
  290. package/dist/react-sdk/application-runtime/responsive/actions.js +1 -0
  291. package/dist/react-sdk/application-runtime/responsive/index.d.ts +4 -0
  292. package/dist/react-sdk/application-runtime/responsive/index.js +1 -0
  293. package/dist/react-sdk/application-runtime/responsive/initialize.d.ts +3 -0
  294. package/dist/react-sdk/application-runtime/responsive/initialize.js +1 -0
  295. package/dist/react-sdk/application-runtime/responsive/selectors.d.ts +20 -0
  296. package/dist/react-sdk/application-runtime/responsive/selectors.js +1 -0
  297. package/dist/react-sdk/application-runtime/responsive/types.d.ts +104 -0
  298. package/dist/react-sdk/application-runtime/routing/routing-service.d.ts +34 -2
  299. package/dist/react-sdk/application-runtime/routing/routing-service.js +1 -1
  300. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +91 -2
  301. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
  302. package/dist/react-sdk/domain-context/common-hooks/index.d.ts +9 -0
  303. package/dist/react-sdk/domain-context/common-hooks/index.js +1 -0
  304. package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.d.ts +23 -0
  305. package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.js +1 -0
  306. package/dist/react-sdk/domain-context/component-hooks/index.d.ts +1 -0
  307. package/dist/react-sdk/domain-context/component-hooks/index.js +1 -0
  308. package/dist/react-sdk/domain-context/component-hooks/use-component.js +1 -1
  309. package/dist/react-sdk/domain-context/entity-hooks/use-domain-entity-state.js +1 -1
  310. package/dist/react-sdk/domain-context/entity-hooks/use-entity-price.js +1 -1
  311. package/dist/react-sdk/domain-context/entity-hooks/use-root-entity-id.js +1 -1
  312. package/dist/react-sdk/domain-context/entity-hooks/use-root-entity-state.js +1 -1
  313. package/dist/react-sdk/domain-context/index.d.ts +4 -0
  314. package/dist/react-sdk/domain-context/index.js +1 -1
  315. package/dist/react-sdk/domain-context/system-hooks/composition-hooks.js +1 -1
  316. package/dist/react-sdk/domain-context/system-hooks/dimension-hooks.js +1 -1
  317. package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.d.ts +8 -0
  318. package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.js +1 -0
  319. package/dist/react-sdk/domain-context/system-hooks/hover-hooks.js +1 -1
  320. package/dist/react-sdk/domain-context/system-hooks/locale-switch-hooks.d.ts +24 -0
  321. package/dist/react-sdk/domain-context/system-hooks/locale-switch-hooks.js +1 -0
  322. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
  323. package/dist/react-sdk/domain-context/system-hooks/selection-hooks.js +1 -1
  324. package/dist/react-sdk/domain-context/system-hooks/share-links-hooks.d.ts +32 -0
  325. package/dist/react-sdk/domain-context/system-hooks/share-links-hooks.js +1 -0
  326. package/dist/react-sdk/domain-context/system-hooks/tab-navigation-hooks.js +1 -1
  327. package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.js +1 -1
  328. package/dist/react-sdk/index.d.ts +1 -1
  329. package/dist/react-sdk/index.js +1 -1
  330. package/dist/react-sdk/loading-state/loading-state-manager.d.ts +5 -0
  331. package/dist/react-sdk/loading-state/loading-state-manager.js +1 -1
  332. package/dist/react-sdk/scene-control-elements/AddEntityFabElement.d.ts +36 -0
  333. package/dist/react-sdk/scene-control-elements/AddEntityFabElement.js +1 -0
  334. package/dist/react-sdk/scene-control-elements/DeleteEntityFabElement.d.ts +44 -0
  335. package/dist/react-sdk/scene-control-elements/DeleteEntityFabElement.js +1 -0
  336. package/dist/react-sdk/scene-control-elements/NavigationHotspotElement.d.ts +38 -0
  337. package/dist/react-sdk/scene-control-elements/NavigationHotspotElement.js +1 -0
  338. package/dist/react-sdk/scene-control-elements/SelectionHotspotElement.d.ts +30 -0
  339. package/dist/react-sdk/scene-control-elements/SelectionHotspotElement.js +1 -0
  340. package/dist/react-sdk/scene-control-elements/ToolMenuFabElement.d.ts +30 -0
  341. package/dist/react-sdk/scene-control-elements/ToolMenuFabElement.js +1 -0
  342. package/dist/react-sdk/scene-control-elements/create-add-entity-fab.d.ts +9 -0
  343. package/dist/react-sdk/scene-control-elements/create-add-entity-fab.js +1 -0
  344. package/dist/react-sdk/scene-control-elements/create-delete-entity-fab.d.ts +9 -0
  345. package/dist/react-sdk/scene-control-elements/create-delete-entity-fab.js +1 -0
  346. package/dist/react-sdk/scene-control-elements/create-navigation-hotspot.d.ts +10 -0
  347. package/dist/react-sdk/scene-control-elements/create-navigation-hotspot.js +1 -0
  348. package/dist/react-sdk/scene-control-elements/create-selection-hotspot.d.ts +9 -0
  349. package/dist/react-sdk/scene-control-elements/create-selection-hotspot.js +1 -0
  350. package/dist/react-sdk/scene-control-elements/create-tool-menu-fab.d.ts +9 -0
  351. package/dist/react-sdk/scene-control-elements/create-tool-menu-fab.js +1 -0
  352. package/dist/react-sdk/scene-control-elements/index.d.ts +11 -0
  353. package/dist/react-sdk/scene-control-elements/index.js +1 -0
  354. package/dist/react-sdk/scene-control-elements/scene-control-tooltip-visibility.d.ts +5 -0
  355. package/dist/react-sdk/web-component/create-web-component.js +1 -1
  356. package/dist/react-sdk/web-component/god-mode/god-mode-registry.d.ts +30 -0
  357. package/dist/react-sdk/web-component/god-mode/god-mode-registry.js +1 -0
  358. package/dist/react-sdk/web-component/god-mode/index.d.ts +1 -0
  359. package/dist/react-sdk/web-component/god-mode/index.js +1 -0
  360. package/dist/ui-sdk/icons/__generated/Lightbulb.d.ts +3 -0
  361. package/dist/ui-sdk/icons/__generated/Lightbulb.js +1 -0
  362. package/dist/ui-sdk/icons/__generated/XCircle.d.ts +3 -0
  363. package/dist/ui-sdk/icons/__generated/XCircle.js +1 -0
  364. package/dist/ui-sdk/icons/__generated/index.d.ts +4 -0
  365. package/dist/ui-sdk/icons/__generated/index.js +1 -1
  366. package/dist/ui-sdk/icons/icons-registry.js +1 -1
  367. package/dist/ui-sdk/responsive-application/ResponsiveApplicationProvider.d.ts +2 -2
  368. package/dist/ui-sdk/responsive-application/responsive-state-store.d.ts +11 -9
  369. package/dist/ui-sdk/responsive-application/use-store-responsive-info.js +1 -1
  370. package/dist/ui-sdk/theme/types.d.ts +5 -1
  371. package/package.json +13 -3
  372. package/schema/domain-spec.json +140 -0
  373. package/dist/configurator/ui/assistant/form/built-in-form-registry.d.ts +0 -10
  374. package/dist/configurator/ui/assistant/form/built-in-form-registry.js +0 -1
  375. package/dist/configurator/ui/assistant/form/form-registry.js +0 -8
  376. package/dist/configurator/ui/phoenix-layout-elements/language/use-locale-options.d.ts +0 -4
  377. package/dist/configurator/ui/phoenix-layout-elements/language/use-locale-options.js +0 -1
  378. package/dist/configurator/ui/phoenix-layout-elements/measurements/use-measurements-visibility.d.ts +0 -4
  379. package/dist/configurator/ui/phoenix-layout-elements/measurements/use-measurements-visibility.js +0 -1
  380. package/dist/domain/application/assistant/assistant-form-elements.d.ts +0 -28
  381. package/dist/domain/application/assistant/assistant-form-elements.js +0 -1
  382. package/dist/domain/extensions/client-side-image.js +0 -1
  383. package/dist/domain/extensions/save-template-thumbnail.js +0 -1
  384. package/dist/react-sdk/application-runtime/runtime/god-mode.d.ts +0 -19
  385. package/dist/react-sdk/application-runtime/runtime/god-mode.js +0 -1
  386. package/dist/react-sdk/responsive-state/ResponsiveStateProvider.d.ts +0 -25
  387. package/dist/react-sdk/responsive-state/ResponsiveStateProvider.js +0 -1
  388. package/dist/react-sdk/responsive-state/canvas-padding.d.ts +0 -14
  389. package/dist/react-sdk/responsive-state/index.d.ts +0 -5
  390. package/dist/react-sdk/responsive-state/index.js +0 -1
  391. package/dist/react-sdk/responsive-state/responsive-state-manager.d.ts +0 -111
  392. package/dist/react-sdk/responsive-state/responsive-state-manager.js +0 -1
  393. package/dist/react-sdk/responsive-state/use-responsive-state-manager.d.ts +0 -10
  394. package/dist/react-sdk/responsive-state/use-responsive-state-manager.js +0 -1
  395. package/dist/react-sdk/responsive-state/use-responsive-state.d.ts +0 -11
  396. package/dist/react-sdk/responsive-state/use-responsive-state.js +0 -1
  397. /package/dist/{configurator/ui/assistant/form/form-element-definition.js → react-sdk/application-runtime/responsive/types.js} +0 -0
  398. /package/dist/react-sdk/{responsive-state/canvas-padding.js → scene-control-elements/scene-control-tooltip-visibility.js} +0 -0
@@ -1,4 +1,5 @@
1
1
  import type { Scene } from 'three';
2
+ import { type ObservableWithLastValue } from '@salsita-ai/common/utils';
2
3
  import type { $DomainEntity, DomainContextSelectors, DomainEntity, DomainEntityId, DomainServicesSelectors, DomainState } from '#package/domain';
3
4
  import type { ConfiguratorExtensionSelectors } from '../../selectors.js';
4
5
  import type { R3FHandle } from '../canvas-system.js';
@@ -29,12 +30,26 @@ export interface ExportJob<EXPORT_STATES extends string, ENTITIES extends Domain
29
30
  selectedEntityId?: ENTITIES['id'];
30
31
  execute: (props: ExportJobArguments<ENTITIES, any, any>) => Promise<R>;
31
32
  }
33
+ /** How one export run starts. */
34
+ export interface ExportRunOptions {
35
+ /**
36
+ * Waits for the user to finish a change they are making, such as a drag, before the first job, for
37
+ * up to {@link SETTLE_TIMEOUT_MS}, and rejects with an {@link ExportBusyError} when they do not. A run
38
+ * the user did not start themselves, such as the assistant's screenshot, must not export over it. A
39
+ * hover is no such change: the run's restore drops it, as it always did.
40
+ */
41
+ readonly awaitSettledState?: boolean;
42
+ }
32
43
  /** ExportSystem with its entity types erased — how the runtime selectors expose the instance. */
33
44
  export type AnyExportSystem = ExportSystem<any, any, any, any, any, any, any>;
34
45
  export declare class ExportSystem<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, NAVIGATION_STATES extends string, VIEW_STATES extends string, TOOL_STATES extends string, EXPORT_STATES extends string> {
35
46
  private readonly _context;
36
47
  private _generation;
37
48
  private _frameloopPause;
49
+ private _queue;
50
+ private readonly _exporting;
51
+ /** True while an export run is queued or running; the configurator UI is inert meanwhile. */
52
+ readonly exporting$: ObservableWithLastValue<boolean>;
38
53
  constructor(_context: ExportSystemContext);
39
54
  /**
40
55
  * Pauses the frameloop of the given canvas mount until the returned release has been called as
@@ -55,6 +70,13 @@ export declare class ExportSystem<ENTITIES extends DomainEntity<string>, ALLOWED
55
70
  navigationState?: NAVIGATION_STATES;
56
71
  selectedEntityId?: DomainEntityId<ENTITY_TYPE>;
57
72
  }, job: (props: ExportJobArguments<ENTITIES, $MAP[ENTITY_TYPE], $MAP[ALLOWED_ROOT_ENTITIES['type']]>) => Promise<R>) => ExportJob<EXPORT_STATES, ENTITIES, TOOL_STATES, VIEW_STATES, NAVIGATION_STATES, R>;
58
- runExportJobs: <R>(jobs: ReadonlyArray<ExportJob<EXPORT_STATES, ENTITIES, TOOL_STATES, VIEW_STATES, NAVIGATION_STATES, R>>) => Promise<R[]>;
73
+ /**
74
+ * Queues the jobs as one export run behind every run already queued and resolves with their
75
+ * results in order. While the run is queued or running, `exporting$` is true. Afterwards the store
76
+ * shows the committed state current at that moment, not the one the run started from.
77
+ */
78
+ runExportJobs: <R>(jobs: ReadonlyArray<ExportJob<EXPORT_STATES, ENTITIES, TOOL_STATES, VIEW_STATES, NAVIGATION_STATES, R>>, options?: ExportRunOptions) => Promise<R[]>;
79
+ private readonly _awaitSettledState;
80
+ private readonly _runExportJobs;
59
81
  initialize: () => void;
60
82
  }
@@ -1 +1 @@
1
- import{isNonNullish as t}from"@salsita-ai/common/utils";export class ExportSystem{_context;_generation=null;_frameloopPause=null;constructor(t){this._context=t}pauseFrameloop=t=>{if(this._frameloopPause?.handle===t)this._frameloopPause.holders+=1;else{let{frameloop:e,internal:o}=t.get();this._frameloopPause={handle:t,frameloop:e,priority:o.priority,holders:1},t.set(t=>({...t,frameloop:"never",internal:{...t.internal,priority:1/0}}))}let e=this._frameloopPause,o=!1;return()=>{o||(o=!0,e.holders-=1,e.holders>0||this._frameloopPause!==e||(this._frameloopPause=null,this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value===t&&t.set(t=>({...t,frameloop:e.frameloop,internal:{...t.internal,priority:e.priority}}))))}};createExportJob=(t,e,o)=>({sourceState:t,exportState:e.exportState,exportedEntityId:e.exportedEntityId,execute:o,toolState:e.toolState,viewState:e.viewState,navigationState:e.navigationState,selectedEntityId:e.selectedEntityId});runExportJobs=async e=>{let o=this._generation,i=()=>{if(!o?.active)throw Error("Export generation ended while jobs were running! The configurator context was reinitialized mid-export, so the remaining jobs would drive a state that is no longer theirs. Await the export before leaving the configuration, or discard the rejection.")};i();let a=this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value;if(!a)throw Error("Canvas is not ready");let n=this._context.domainContextSelectors.getStoreSystem().stateSlices.committed.value,r=this.pauseFrameloop(a);try{let o=[];for(let n of e){i();let e=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission([this._context.domainContextSelectors.getNavigationSystem().getExportUpdate(n.exportState,n.exportedEntityId),null!=n.toolState?this._context.domainContextSelectors.getNavigationSystem().getToolUpdate(n.toolState):void 0,null!=n.viewState?this._context.domainContextSelectors.getNavigationSystem().getViewUpdate(n.viewState):void 0,null!=n.navigationState?this._context.domainContextSelectors.getNavigationSystem().getNavigationUpdate(n.navigationState):void 0,null!=n.selectedEntityId?this._context.domainContextSelectors.getNavigationSystem().getSelectUpdate(n.selectedEntityId):void 0,this._context.domainContextSelectors.getNavigationSystem().getHoverOutUpdate()].filter(t),n.sourceState,"staged");if(this._context.domainContextSelectors.getStoreSystem().emit(e),await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush(),i(),!e.validity.valid)throw this._context.domainServicesSelectors.getLogger().error(`Setting an export state to ${n.exportState} for entity ${n.exportedEntityId} resulted in an invalid state! Check if there isn't a transformer corrupting the state as a reaction to setting the export state.`,e),Error("Exported state is invalid!");let r=e.state,s=this._context.domainContextSelectors.getDomain().get$Entity(n.exportedEntityId,r),l=this._context.domainContextSelectors.getDomain().getRoot$Entity(r),c=await n.execute({$entity:s,$root:l,state:r,scene:a.get().scene});i(),o.push(c)}return o}finally{o?.active&&this._context.domainContextSelectors.getStoreSystem().emit(n),r()}};initialize=()=>{null!==this._generation&&(this._generation.active=!1),this._generation={active:!0}}}
1
+ import{BehaviorSubject as t}from"rxjs";import{isNonNullish as e}from"@salsita-ai/common/utils";import{ExportBusyError as o}from"./export-busy-error.js";export class ExportSystem{_context;_generation=null;_frameloopPause=null;_queue=null;_exporting=new t(!1);exporting$=this._exporting;constructor(t){this._context=t}pauseFrameloop=t=>{if(this._frameloopPause?.handle===t)this._frameloopPause.holders+=1;else{let{frameloop:e,internal:o}=t.get();this._frameloopPause={handle:t,frameloop:e,priority:o.priority,holders:1},t.set(t=>({...t,frameloop:"never",internal:{...t.internal,priority:1/0}}))}let e=this._frameloopPause,o=!1;return()=>{o||(o=!0,e.holders-=1,e.holders>0||this._frameloopPause!==e||(this._frameloopPause=null,this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value===t&&t.set(t=>({...t,frameloop:e.frameloop,internal:{...t.internal,priority:e.priority}}))))}};createExportJob=(t,e,o)=>({sourceState:t,exportState:e.exportState,exportedEntityId:e.exportedEntityId,execute:o,toolState:e.toolState,viewState:e.viewState,navigationState:e.navigationState,selectedEntityId:e.selectedEntityId});runExportJobs=(t,e={})=>{let o=this._generation,i=(this._queue??Promise.resolve()).then(()=>this._runExportJobs(t,e,o)),a=i.catch(()=>void 0);return this._queue=a,this._exporting.value||this._exporting.next(!0),a.then(()=>{this._queue===a&&(this._queue=null,this._exporting.next(!1))}),i};_awaitSettledState=async t=>{let e=this._context.domainContextSelectors.getStoreSystem(),i=Date.now()+2e3;for(;e.hasStagedUpdates;){if(Date.now()>=i)throw new o;await new Promise(t=>setTimeout(t,200)),t()}};_runExportJobs=async(t,{awaitSettledState:o=!1},i)=>{let a=()=>{if(!i?.active)throw Error("Export generation ended while jobs were running! The configurator context was reinitialized mid-export, so the remaining jobs would drive a state that is no longer theirs. Await the export before leaving the configuration, or discard the rejection.")};a(),o&&await this._awaitSettledState(a);let n=this._context.configuratorExtensionSelectors.getCanvasSystem(),r=n.r3fHandle$.value??await n.waitForCanvas().catch(t=>{throw a(),t});a();let s=this.pauseFrameloop(r);try{let o=[];for(let i of t){a();let t=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission([this._context.domainContextSelectors.getNavigationSystem().getExportUpdate(i.exportState,i.exportedEntityId),null!=i.toolState?this._context.domainContextSelectors.getNavigationSystem().getToolUpdate(i.toolState):void 0,null!=i.viewState?this._context.domainContextSelectors.getNavigationSystem().getViewUpdate(i.viewState):void 0,null!=i.navigationState?this._context.domainContextSelectors.getNavigationSystem().getNavigationUpdate(i.navigationState):void 0,null!=i.selectedEntityId?this._context.domainContextSelectors.getNavigationSystem().getSelectUpdate(i.selectedEntityId):void 0,this._context.domainContextSelectors.getNavigationSystem().getHoverOutUpdate()].filter(e),i.sourceState,"staged");if(this._context.domainContextSelectors.getStoreSystem().emit(t),await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush(),a(),!t.validity.valid)throw this._context.domainServicesSelectors.getLogger().error(`Setting an export state to ${i.exportState} for entity ${i.exportedEntityId} resulted in an invalid state! Check if there isn't a transformer corrupting the state as a reaction to setting the export state.`,t),Error("Exported state is invalid!");let n=t.state,s=this._context.domainContextSelectors.getDomain().get$Entity(i.exportedEntityId,n),l=this._context.domainContextSelectors.getDomain().getRoot$Entity(n),c=await i.execute({$entity:s,$root:l,state:n,scene:r.get().scene});a(),o.push(c)}return o}finally{if(i?.active){let t=this._context.domainContextSelectors.getStoreSystem();t.emit(t.stateSlices.committed.value)}s()}};initialize=()=>{null!==this._generation&&(this._generation.active=!1),this._generation={active:!0},this._queue=null,this._exporting.value&&this._exporting.next(!1)}}
@@ -20,6 +20,13 @@ export interface EntityMetaContext {
20
20
  readonly success: false;
21
21
  readonly errors: readonly string[];
22
22
  };
23
+ /**
24
+ * Takes a screenshot of the entity from one of its views on the state it was read on and returns
25
+ * the label of the image; `null` when the view does not apply to the entity there.
26
+ */
27
+ readonly takeScreenshot: (source: EntityMetaSource, view: string) => Promise<{
28
+ readonly image: string;
29
+ } | null>;
23
30
  }
24
31
  /** One reason a dry-run reports for a change that cannot be made; a violation can sit on a virtual entity. */
25
32
  interface DryRunError {
@@ -30,7 +37,8 @@ interface DryRunError {
30
37
  /**
31
38
  * The value of an entity's `meta` field: its built-ins, resolved lazily against the state the entity
32
39
  * was read on. `childRecipes` and `replaceRecipes` list the manifest's recipe groups of their kind
33
- * that are active on the entity there; each options edge lists the choices of its field there, or `null` when its component is not active.
40
+ * that are active on the entity there; each options edge lists the choices of its field there, or `null` when its component is not active;
41
+ * `screenshot` renders the entity there.
34
42
  */
35
43
  export declare const createEntityMeta: (source: EntityMetaSource, context: EntityMetaContext) => {
36
44
  childRecipes: () => {
@@ -85,5 +93,10 @@ export declare const createEntityMeta: (source: EntityMetaSource, context: Entit
85
93
  } | null;
86
94
  }[];
87
95
  }[];
96
+ screenshot: ({ view }: {
97
+ readonly view: string;
98
+ }) => Promise<{
99
+ readonly image: string;
100
+ } | null>;
88
101
  };
89
102
  export {};
@@ -1 +1 @@
1
- import{findAssistantFieldOptions as e,findAssistantRecipeGroups as t,modifyEntityUpdateTag as i,prepareAssistantRecipeUpdates as r,readAssistantFieldOptions as n,readAssistantRecipeGroup as o,systemUpdateFactory as s}from"#package/domain";import{readSideEffects as a}from"./side-effects.js";let d=e=>({ok:!1,root:null,changedEntities:[],deletedEntityIds:[],sideEffects:[],errors:e}),l=(e,{state:t},{recipes:i,prepareStateEmission:r,find$Entity:n})=>{let{validity:o,state:s,updates:l}=r(e,t,"committed");if(o.valid){let e=new Map(t.entities.map(e=>[e.id,e])),r=new Set(s.entities.map(e=>e.id));return{ok:!0,root:n(s.rootEntityId,s),changedEntities:s.entities.filter(t=>e.get(t.id)!==t).flatMap(e=>n(e.id,s)??[]),deletedEntityIds:t.entities.map(e=>e.id).filter(e=>!r.has(e)),sideEffects:a(l,i.resolveLocalizable),errors:[]}}return d("uncaught"===o.severity?[{type:"uncaught",entityId:null,message:o.error.message}]:o.entityViolations.filter(({violation:e})=>e.severity===o.severity).map(({entityId:e,violation:t})=>({type:t.type,entityId:e,message:void 0===t.message?null:i.resolveLocalizable(t.message)})))};export const createEntityMeta=(a,u)=>{let c=e=>()=>t(u.manifest,e,a.entity.type).flatMap(t=>{let i=o(e,t,a.entity.id,a.state,u.recipes);return i?[((e,t,i)=>{let{group:n,label:o,description:s,recipes:a}=e,{resolveLocalizable:u}=i.recipes;return{groupId:n.groupId,name:void 0===o?n.instanceName:u(o),description:n.description??(void 0===s?null:u(s)),recipes:a.map(n=>((e,t,i,n)=>{let{key:o,item:s}=e,{resolveLocalizable:a}=n.recipes;return{key:o,name:a(s.title),description:void 0===s.description?null:a(s.description),imageUrl:void 0===s.thumbnailUrl?null:a(s.thumbnailUrl),dryRun:()=>t.group.dryRuns?((e,t,i,n)=>{let{updates:o,error:s}=((e,t,{entity:i,state:n},{recipes:o})=>{try{return{updates:r(e,t,i.id,n,o),error:void 0}}catch(e){if("child"===t.target.kind)throw e;return{updates:void 0,error:e instanceof Error?e.message:String(e)}}})(e,t,i,n);return void 0===o?d([{type:"uncaught",entityId:null,message:s}]):l(o,i,n)})(e,t,i,n):null}})(n,e,t,i))}})(i,a,u)]:[]});return{...Object.fromEntries(e(u.manifest,a.entity.type).map(e=>[e.edgeName,()=>n(e,a.entity.id,a.state,u.recipes)?.map(t=>({...t,dryRun:()=>e.dryRuns?(({field:e},{value:t},r,n)=>{let{entity:o}=r,a=Object.entries(Object.entries(n.manifest.writableFields??{}).find(([e])=>e===o.type)?.[1]??{}).find(([t])=>t===e)?.[1];if(void 0===a)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: the schema lists them, but the configurator has no writable field "${e}" on ${o.type}. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let u=r.state.entities.find(e=>e.id===o.id);if(!u)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: entity "${o.id}" does not exist. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);let c={[a]:t},p=n.validateEntity({...u,...c});return p.success?l([s.DomainEntityModification({entityId:o.id,stateDelta:c,updateTag:i})],r,n):d([{type:"uncaught",entityId:o.id,message:`Writing ${JSON.stringify(t)} to "${e}" would make "${o.id}" an invalid ${o.type}: ${p.errors.join("; ")}. The option comes from the configurator and cannot be corrected from here, so do not write it.`}])})(e,t,a,u):null}))??null])),childRecipes:c("child"),replaceRecipes:c("replace")}};
1
+ import{findAssistantFieldOptions as e,findAssistantRecipeGroups as t,modifyEntityUpdateTag as i,prepareAssistantRecipeUpdates as r,readAssistantFieldOptions as n,readAssistantRecipeGroup as o,systemUpdateFactory as s}from"#package/domain";import{readSideEffects as a}from"./side-effects.js";let d=e=>({ok:!1,root:null,changedEntities:[],deletedEntityIds:[],sideEffects:[],errors:e}),l=(e,{state:t},{recipes:i,prepareStateEmission:r,find$Entity:n})=>{let{validity:o,state:s,updates:l}=r(e,t,"committed");if(o.valid){let e=new Map(t.entities.map(e=>[e.id,e])),r=new Set(s.entities.map(e=>e.id));return{ok:!0,root:n(s.rootEntityId,s),changedEntities:s.entities.filter(t=>e.get(t.id)!==t).flatMap(e=>n(e.id,s)??[]),deletedEntityIds:t.entities.map(e=>e.id).filter(e=>!r.has(e)),sideEffects:a(l,i.resolveLocalizable),errors:[]}}return d("uncaught"===o.severity?[{type:"uncaught",entityId:null,message:o.error.message}]:o.entityViolations.filter(({violation:e})=>e.severity===o.severity).map(({entityId:e,violation:t})=>({type:t.type,entityId:e,message:void 0===t.message?null:i.resolveLocalizable(t.message)})))};export const createEntityMeta=(a,u)=>{let c=e=>()=>t(u.manifest,e,a.entity.type).flatMap(t=>{let i=o(e,t,a.entity.id,a.state,u.recipes);return i?[((e,t,i)=>{let{group:n,label:o,description:s,recipes:a}=e,{resolveLocalizable:u}=i.recipes;return{groupId:n.groupId,name:void 0===o?n.instanceName:u(o),description:n.description??(void 0===s?null:u(s)),recipes:a.map(n=>((e,t,i,n)=>{let{key:o,item:s}=e,{resolveLocalizable:a}=n.recipes;return{key:o,name:a(s.title),description:void 0===s.description?null:a(s.description),imageUrl:void 0===s.thumbnailUrl?null:a(s.thumbnailUrl),dryRun:()=>t.group.dryRuns?((e,t,i,n)=>{let{updates:o,error:s}=((e,t,{entity:i,state:n},{recipes:o})=>{try{return{updates:r(e,t,i.id,n,o),error:void 0}}catch(e){if("child"===t.target.kind)throw e;return{updates:void 0,error:e instanceof Error?e.message:String(e)}}})(e,t,i,n);return void 0===o?d([{type:"uncaught",entityId:null,message:s}]):l(o,i,n)})(e,t,i,n):null}})(n,e,t,i))}})(i,a,u)]:[]});return{...Object.fromEntries(e(u.manifest,a.entity.type).map(e=>[e.edgeName,()=>n(e,a.entity.id,a.state,u.recipes)?.map(t=>({...t,dryRun:()=>e.dryRuns?(({field:e},{value:t},r,n)=>{let{entity:o}=r,a=Object.entries(Object.entries(n.manifest.writableFields??{}).find(([e])=>e===o.type)?.[1]??{}).find(([t])=>t===e)?.[1];if(void 0===a)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: the schema lists them, but the configurator has no writable field "${e}" on ${o.type}. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let u=r.state.entities.find(e=>e.id===o.id);if(!u)throw Error(`The options of "${e}" on "${o.id}" cannot be dry-run: entity "${o.id}" does not exist. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);let c={[a]:t},p=n.validateEntity({...u,...c});return p.success?l([s.DomainEntityModification({entityId:o.id,stateDelta:c,updateTag:i})],r,n):d([{type:"uncaught",entityId:o.id,message:`Writing ${JSON.stringify(t)} to "${e}" would make "${o.id}" an invalid ${o.type}: ${p.errors.join("; ")}. The option comes from the configurator and cannot be corrected from here, so do not write it.`}])})(e,t,a,u):null}))??null])),childRecipes:c("child"),replaceRecipes:c("replace"),screenshot:({view:e})=>u.takeScreenshot(a,e)}};
@@ -1,15 +1,29 @@
1
1
  import { type ExecutionResult } from 'graphql';
2
2
  import { type Localizable } from '@salsita-ai/common/utils';
3
- import { type $DomainEntity, type DomainContextSelectors, type DomainEntity, type DomainServicesSelectors, type DomainState, type SessionAssistantSetup, type SpecSelectors, type StateUpdateEmission } from '#package/domain';
3
+ import { type $DomainEntity, type AgentScreenshotComponent, type ComponentSnapshot, type DomainContextSelectors, type DomainEntity, type DomainServicesSelectors, type DomainState, type InitializationGeneration, type SessionAssistantSetup, type SpecSelectors, type StateUpdateEmission } from '#package/domain';
4
4
  /** One single-operation GraphQL document with its own variables, as executed by {@link GraphQLSystem}. */
5
5
  export interface GraphQLOperation {
6
6
  readonly document: string;
7
7
  readonly variables?: Readonly<Record<string, unknown>>;
8
8
  readonly operationName?: string;
9
9
  }
10
+ /** A screenshot an operation took, under the label its `image` field returned. */
11
+ export interface GraphQLScreenshot {
12
+ readonly entityId: string;
13
+ readonly view: string;
14
+ /** The picture as base64 data. */
15
+ readonly data: string;
16
+ readonly mimeType: 'image/jpeg' | 'image/png';
17
+ }
10
18
  export interface GraphQLSystemContext {
11
19
  /** The assistant the initialized session runs: the operations are validated and executed against its schema. */
12
20
  readonly getAssistantSetup: () => SessionAssistantSetup;
21
+ /**
22
+ * Renders the picture an `agentScreenshot` component of a state declares, behind every export
23
+ * already queued; `null` from an executor that renders no pictures. The only async step of an
24
+ * execution, and the only one that needs a canvas.
25
+ */
26
+ readonly renderScreenshot: (component: ComponentSnapshot<AgentScreenshotComponent>, state: AnyDomainState) => Promise<Blob | null>;
13
27
  readonly specSelectors: SpecSelectors;
14
28
  readonly domainContextSelectors: DomainContextSelectors;
15
29
  readonly domainServicesSelectors: DomainServicesSelectors;
@@ -25,6 +39,8 @@ type AnyStateUpdateEmission = StateUpdateEmission<DomainEntity<string>, Record<s
25
39
  export interface PreparedOperation {
26
40
  readonly result: ExecutionResult;
27
41
  readonly emissions: readonly AnyStateUpdateEmission[];
42
+ /** The screenshots the operation took, by label, in the order they were taken. */
43
+ readonly screenshots: ReadonlyMap<string, GraphQLScreenshot>;
28
44
  }
29
45
  /**
30
46
  * What {@link GraphQLSystem.execute} returns: the results of the operations as prepared from the
@@ -45,6 +61,8 @@ export interface GraphQLExecution {
45
61
  * the undo history by it. It stays in the browser: nothing that leaves it may carry the state.
46
62
  */
47
63
  readonly preparedState?: AnyDomainState;
64
+ /** The screenshots the operations took, by the label their `image` field returned, in the order they were taken. */
65
+ readonly screenshots: ReadonlyMap<string, GraphQLScreenshot>;
48
66
  }
49
67
  /**
50
68
  * Resolves a localizable value, or each item of a list of them, to a string in the current locale.
@@ -77,6 +95,17 @@ export declare class GraphQLSystem {
77
95
  /** Root field resolvers, called by the executor with the field arguments and the operation context. */
78
96
  private readonly _rootValue;
79
97
  private readonly _resolveType;
98
+ private _generation;
99
+ /**
100
+ * The picture of an entity of a state from one `agentScreenshot` view, as base64 of the view's
101
+ * file format; `null` when the view is not attached to the entity there or nothing renders it.
102
+ */
103
+ private readonly _renderScreenshot;
104
+ /**
105
+ * Starts a new generation for a new configuration load. Screenshots wait on renders that take
106
+ * seconds, so an execution can outlive its configuration: one started under the ended generation
107
+ * renders no more screenshots and commits nothing, not even on a conflict retry.
108
+ */
80
109
  initialize: () => void;
81
110
  /**
82
111
  * Runs one mutation field against the working state: its implementation computes updates from the
@@ -87,6 +116,13 @@ export declare class GraphQLSystem {
87
116
  */
88
117
  private readonly _resolveMutation;
89
118
  private readonly _runMutation;
119
+ /**
120
+ * Takes a screenshot once every one asked for before it in the execution has been taken, so they
121
+ * render and spend the budget in document order. A failure nulls only its own field and fails
122
+ * nothing else: the user kept changing the configuration, the image did not fit the budget, or
123
+ * rendering failed. Once the budget is spent, no later screenshot renders.
124
+ */
125
+ private readonly _takeScreenshot;
90
126
  private readonly _setup;
91
127
  /**
92
128
  * Parses, validates and executes one operation document. Validation adds the rule against
@@ -98,21 +134,26 @@ export declare class GraphQLSystem {
98
134
  * Runs the operations in order through one working state that starts at `originalState`: a query
99
135
  * reads the current working state, and each mutation field advances it with its own emission.
100
136
  * The closing braces an operation's document left off are added, then the lenses it spreads are injected into it. Nothing is committed. The first operation that fails stops the list; every later one gets a
101
- * "not run" error instead.
137
+ * "not run" error instead. Screenshots render only while `generation`, the current one by
138
+ * default, is active.
102
139
  */
103
- prepare: (originalState: AnyDomainState, operations: readonly GraphQLOperation[]) => Promise<readonly PreparedOperation[]>;
140
+ prepare: (originalState: AnyDomainState, operations: readonly GraphQLOperation[], generation?: InitializationGeneration) => Promise<readonly PreparedOperation[]>;
104
141
  /**
105
142
  * The side effects of prepared operations: the hints of every update of their emissions, as the
106
143
  * agent is told them, in applied order.
107
144
  */
108
145
  readSideEffects: (prepared: readonly PreparedOperation[]) => readonly string[];
146
+ /** The screenshots of prepared operations, by label, in the order they were taken. */
147
+ readScreenshots: (prepared: readonly PreparedOperation[]) => ReadonlyMap<string, GraphQLScreenshot>;
109
148
  private readonly _prepareAndCommit;
110
149
  /**
111
150
  * Prepares the operations from the committed state and commits their changes as one emission,
112
151
  * synthesized from every field emission of the list: one undo step, `onBeforeCommit` hooks run once. Nothing is committed when an operation fails or
113
152
  * none changes anything. When the committed state changed meanwhile, the operations are prepared
114
153
  * once more from the new committed state; their earlier updates are never replayed, since they
115
- * were computed from a state that is gone.
154
+ * were computed from a state that is gone. When another configuration was loaded meanwhile,
155
+ * nothing is committed or prepared again: the operations were written for the configuration
156
+ * that was left.
116
157
  */
117
158
  execute: (operations: readonly GraphQLOperation[]) => Promise<GraphQLExecution>;
118
159
  }
@@ -1 +1 @@
1
- import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as o,getNamedType as n,parse as r,specifiedRules as a,validate as s,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as d,isMessageDescriptor as h,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as m,createAssistantExecutionSchema as f,findAssistantMutation as p}from"#package/domain";import{closeUnclosedBraces as g}from"./close-unclosed-braces.js";import{createEntityMeta as y}from"./entity-meta.js";import{injectAssistantLenses as v}from"./inject-assistant-lenses.js";import{readSideEffects as S}from"./side-effects.js";let _={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},x={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},w=new RegExp(m.pattern),E=[...a,t],$=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,b=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,T=e=>e instanceof Error?e.message:String(e),C=e=>/[.!?]$/.test(e)?e:`${e}.`,R=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,j=(e,t)=>{let i=R(e)?e._raw:void 0;if($(i))return i;if(!Array.isArray(e)&&!R(e))return e;if(t.has(e))throw Error("The value contains itself.");let o=new Set([...t,e]);return Array.isArray(e)?e.map(e=>j(e,o)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,j(t,o)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||h(e)||u(e)?t(e):e;let A=t=>new e(`The configurator cannot handle this request: ${C(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`),M=e=>(e.errors?.length??0)>0,z=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]});export class GraphQLSystem{_context;_selectSchema=d([d.leaf(e=>e)],e=>{try{let t=f(e),i=l(t);return i.length>0?A(i.map(e=>e.message).join(" ")):t}catch(e){return A(T(e))}});_selectLenses=d([d.leaf(e=>e)],e=>r(e));_selectFieldResolver=d([d.leaf(e=>e)],t=>(o,r,a,s)=>{if(s.parentType===s.schema.getQueryType())return i(o,r,a,s);if(s.parentType===s.schema.getMutationType())return this._resolveMutation(s.fieldName,String(s.path.key),r,a);if(!$(o))return i(o,r,a,s);if("meta"===s.fieldName){let e;return y({entity:o,state:("object"==typeof(e=b(o,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??a.state},{manifest:a.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i),find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e)})}let{source:l,localized:c}=t[s.parentType.name]?.[s.fieldName]??{source:s.fieldName},d=((t,i)=>{try{return b(t,i)}catch(o){throw new e(`Expression "${i}" failed on ${$(t)?t.id:"an entity"}: ${C(T(o))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:o instanceof Error?o:void 0})}})(o,l);return c?localize(d,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===n(s.returnType).name?((t,i,o)=>{try{return j(o,new Set)}catch(o){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${$(t)?t.id:"an entity"}: ${C(T(o))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:o instanceof Error?o:void 0})}})(o,l,d):d});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var o=i.rootEntityId;let n=t.filter(e=>!w.test(e));if(n.length>0)throw new e(`${n.map(e=>`"${e}"`).join(", ")} ${1===n.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${o}". Use ids as returned by the "id" field.`);return t.map(e=>w.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t})=>{let i=this._context.domainContextSelectors.getNavigationSystem();return{navigationState:i.getActiveNavigationState(t),viewState:i.getActiveViewState(t),toolState:i.getActiveToolState(t)}}};_resolveType=e=>$(e)?e.type:void 0;initialize=()=>{};_resolveMutation=(t,i,o,n)=>{if(void 0!==n.failedMutationField)throw new e(`Not run: the earlier field "${n.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,o,n)}catch(e){throw n.failedMutationField=i,e}};_runMutation=(t,i,o)=>{let n=p(t,o.manifest);if(!n)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let r=o.state,a=n.implementation(i,r,{manifest:o.manifest,action:this._context.domainContextSelectors.getActionSystem().createContext(r),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});if(a.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(a.updates,r,"committed");if(!i.validity.valid)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: ${(e=>{if("uncaught"===e.severity)return`validating it threw: ${C(T(e.error))}`;let t=[...new Set(e.entityViolations.filter(({violation:t})=>t.severity===e.severity).map(({entityId:e})=>e))];return`it has ${e.severity} violations on ${t.join(", ")}.`})(i.validity)} Change the request so the configuration stays valid.`);o.emissions.push(i),o.state=i.state}return a.readResult({previousState:r,state:o.state})};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:_};let o=this._selectSchema(t.sdl);return o instanceof e?{ready:!1,result:{errors:[o]}}:{ready:!0,assistant:t,schema:o,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=(t,i,n,a)=>{let l;try{l=r(t)}catch(t){return{errors:[t instanceof e?t:new e(T(t))]}}let c=s(n.schema,l,E);return c.length>0?{errors:c}:o({schema:n.schema,document:l,rootValue:this._rootValue,contextValue:a,variableValues:i.variables,operationName:i.operationName,fieldResolver:n.fieldResolver,typeResolver:this._resolveType})};prepare=async(t,i)=>{let o,n=this._setup();if(!n.ready)return i.map(()=>({result:n.result,emissions:[]}));let r={manifest:n.assistant,state:t,emissions:[],failedMutationField:void 0},a=[];for(let[t,s]of i.entries())if(void 0===o){let i=r.emissions.length;r.failedMutationField=void 0;let l=g(s.document),c=n.lenses?v(l,n.lenses):l,d=c instanceof e?{errors:[c]}:await this._run(c,s,n,r);a.push({result:d,emissions:r.emissions.slice(i)}),M(d)&&(o=t)}else a.push({result:z(o),emissions:[]});return a};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>S(e.updates,t)))};_prepareAndCommit=async e=>{let t,i,o,n=this._context.domainContextSelectors.getStoreSystem(),r=await this.prepare(n.stateSlices.committed.value.state,e),a=r.map(({result:e})=>e),s=this.readSideEffects(r),l=r.flatMap(e=>e.emissions);if(a.some(M)||0===l.length)return{results:a,sideEffects:s,outcome:"none"};let d=(t=c(l[0]),i=c(l[l.length-1]),o=l.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:t.previousState,state:i.state,updates:l.flatMap(e=>e.updates),validity:i.validity,transformationLog:o?l.flatMap(e=>e.transformationLog??[]):void 0});return{results:a,sideEffects:s,outcome:n.commitPrepared(d),preparedState:d.state}};execute=async e=>{if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>x),committed:!1,sideEffects:[]};let t=await this._prepareAndCommit(e),{results:i,sideEffects:o,outcome:n,preparedState:r}="conflict"===t.outcome?await this._prepareAndCommit(e):t;return"committed"===n?{results:i,committed:!0,sideEffects:o,preparedState:r}:"held"===n?{results:i,committed:!1,message:"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:o,preparedState:r}:"conflict"===n?{results:i,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:o}:{results:i,committed:!1,sideEffects:o}}}
1
+ import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as n,getNamedType as r,parse as o,specifiedRules as s,validate as a,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as h,isMessageDescriptor as d,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as f,agentScreenshotComponent as m,createAssistantExecutionSchema as p,findAssistantMutation as g}from"#package/domain";import{ExportBusyError as y}from"../export-system/export-busy-error.js";import{closeUnclosedBraces as v}from"./close-unclosed-braces.js";import{createEntityMeta as S}from"./entity-meta.js";import{injectAssistantLenses as w}from"./inject-assistant-lenses.js";import{readSideEffects as _}from"./side-effects.js";let x={errors:[new e("The configurator does not provide this request. This is a fault in the configurator, not in your request. Tell the user this is not available.")]},$={errors:[new e("The configuration is not loaded yet, so there is no state to query. Run the query again once the configurator has finished loading.")]},b="Not taken: another configuration was loaded while this request ran. Query the current configuration before asking for screenshots again.",E="Not taken: the screenshots of this tool call have used up its image size budget. Ask for this screenshot in another call, and for fewer in one call.",T=async e=>{let t=new Uint8Array(await e.arrayBuffer()),i="";for(let e=0;e<t.length;e+=32768)i+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(i)},C=new RegExp(f.pattern),M=[...s,t],k=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,j=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,R=e=>e instanceof Error?e.message:String(e),A=e=>/[.!?]$/.test(e)?e:`${e}.`,N=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,z=(e,t)=>{let i=N(e)?e._raw:void 0;if(k(i))return i;if(!Array.isArray(e)&&!N(e))return e;if(t.has(e))throw Error("The value contains itself.");let n=new Set([...t,e]);return Array.isArray(e)?e.map(e=>z(e,n)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,z(t,n)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||d(e)||u(e)?t(e):e;let q=t=>new e(`The configurator cannot handle this request: ${A(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`),L="SCREENSHOT_NOT_TAKEN",F=(t,i)=>new e(t,{originalError:i,extensions:{code:L}}),O=e=>(e.errors??[]).some(e=>e.extensions.code!==L),V=t=>({errors:[new e(`Not run: operation ${t+1} failed, so the operations after it were skipped and no change of the list takes effect. Fix the failing operation and send the whole list again.`)]});export class GraphQLSystem{_context;_selectSchema=h([h.leaf(e=>e)],e=>{try{let t=p(e),i=l(t);return i.length>0?q(i.map(e=>e.message).join(" ")):t}catch(e){return q(R(e))}});_selectLenses=h([h.leaf(e=>e)],e=>o(e));_selectFieldResolver=h([h.leaf(e=>e)],t=>(n,o,s,a)=>{if(a.parentType===a.schema.getQueryType())return i(n,o,s,a);if(a.parentType===a.schema.getMutationType())return this._resolveMutation(a.fieldName,String(a.path.key),o,s);if(!k(n))return i(n,o,s,a);if("meta"===a.fieldName){let e;return S({entity:n,state:("object"==typeof(e=j(n,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??s.state},{manifest:s.manifest,recipes:this._recipeContext(),prepareStateEmission:(e,t,i)=>this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(e,t,i),find$Entity:(e,t)=>this._find$Entity(e,t),validateEntity:e=>this._context.domainContextSelectors.getDomain().validateEntity(e),takeScreenshot:(e,t)=>this._takeScreenshot(e,t,s)})}let{source:l,localized:c}=t[a.parentType.name]?.[a.fieldName]??{source:a.fieldName},h=((t,i)=>{try{return j(t,i)}catch(n){throw new e(`Expression "${i}" failed on ${k(t)?t.id:"an entity"}: ${A(R(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l);return c?localize(h,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===r(a.returnType).name?((t,i,n)=>{try{return z(n,new Set)}catch(n){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${k(t)?t.id:"an entity"}: ${A(R(n))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:n instanceof Error?n:void 0})}})(n,l,h):h});constructor(e){this._context=e}_get$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().get$Entity(e,t);_find$Entity=(e,t)=>this._context.domainContextSelectors.getDomain().getEntity(e,t)?this._get$Entity(e,t):null;_recipeContext=()=>({componentReader:this._context.domainContextSelectors.getComponentReader(),recipeCooker:this._context.domainContextSelectors.getRecipeCookerSystem(),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});_rootValue={root:(e,{state:t})=>this._get$Entity(t.rootEntityId,t),entities:({ids:t},{state:i})=>{if(null==t)return i.entities.map(e=>this._get$Entity(e.id,i));var n=i.rootEntityId;let r=t.filter(e=>!C.test(e));if(r.length>0)throw new e(`${r.map(e=>`"${e}"`).join(", ")} ${1===r.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${n}". Use ids as returned by the "id" field.`);return t.map(e=>C.test(e)?this._find$Entity(e,i):null)},selectedEntity:(e,{state:t})=>this._find$Entity(this._context.domainContextSelectors.getNavigationSystem().getActiveSelectionState(t),t),navigation:(e,{state:t})=>{let i=this._context.domainContextSelectors.getNavigationSystem();return{navigationState:i.getActiveNavigationState(t),viewState:i.getActiveViewState(t),toolState:i.getActiveToolState(t)}}};_resolveType=e=>k(e)?e.type:void 0;_generation={active:!0};_renderScreenshot=async(e,t,i)=>{let n=this._context.domainContextSelectors.getComponentReader().readOneComponent({entityId:e,componentType:m,instanceName:t},i);if(!n)return null;let r=await this._context.renderScreenshot(n,i);return null===r?null:{data:await T(r),mimeType:"JPEG"===n.state.fileFormat?"image/jpeg":"image/png"}};initialize=()=>{this._generation.active=!1,this._generation={active:!0}};_resolveMutation=(t,i,n,r)=>{if(void 0!==r.failedMutationField)throw new e(`Not run: the earlier field "${r.failedMutationField}" of this operation failed, so "${i}" was skipped and no change of the operation takes effect. Fix the failing field and send the operation again.`);try{return this._runMutation(t,n,r)}catch(e){throw r.failedMutationField=i,e}};_runMutation=(t,i,n)=>{let r=g(t,n.manifest);if(!r)throw new e(`The schema declares the mutation "${t}", but the configurator has no implementation for it. This is a fault in the configurator, not in your request. Tell the user this is not available.`);let o=n.state,s=r.implementation(i,o,{manifest:n.manifest,action:this._context.domainContextSelectors.getActionSystem().createContext(o),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});if(s.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(s.updates,o,"committed");if(!i.validity.valid)throw new e(`The changes of "${t}" were not applied, because the resulting configuration is invalid: ${(e=>{if("uncaught"===e.severity)return`validating it threw: ${A(R(e.error))}`;let t=[...new Set(e.entityViolations.filter(({violation:t})=>t.severity===e.severity).map(({entityId:e})=>e))];return`it has ${e.severity} violations on ${t.join(", ")}.`})(i.validity)} Change the request so the configuration stays valid.`);n.emissions.push(i),n.state=i.state}return s.readResult({previousState:o,state:n.state})};_takeScreenshot=({entity:t,state:i},n,r)=>{let o=r.manifest.screenshots?.[t.type]?.find(e=>e.view===n);if(!o)return Promise.reject(new e(`The schema declares the screenshot view "${n}" on ${t.type}, but the configurator has no view of that name. This is a fault in the configurator, not in your request. Tell the user this is not available.`));let s=r.lastScreenshot.then(async()=>{if(!r.generation.active)throw F(b);if(r.screenshotBudget<=0)throw F(E);let e=await this._renderScreenshot(t.id,o.instanceName,i).catch(e=>{throw F(e instanceof y?"User made concurrent actions that prevented the screenshot from being taken, try again":`The screenshot of ${t.id} from "${n}" could not be taken: ${A(R(e))} Try again; if it fails again, tell the user the screenshot is not available.`,e instanceof Error?e:void 0)});if(!r.generation.active)throw F(b);if(null===e)return null;if(e.data.length>r.screenshotBudget)throw r.screenshotBudget=0,F(E);r.screenshotBudget-=e.data.length;let s=`${t.id}/${n}`,a=[...r.screenshots.values()].filter(e=>e.entityId===t.id&&e.view===n).length,l=0===a?s:`${s}#${a+1}`;return r.screenshots.set(l,{entityId:t.id,view:n,...e}),{image:l}});return r.lastScreenshot=s.catch(()=>void 0),s};_setup=()=>{let{manifest:t,error:i}=this._context.getAssistantSetup();if(i)return{ready:!1,result:{errors:[new e(i.message,{originalError:i})]}};if(!t)return{ready:!1,result:x};let n=this._selectSchema(t.sdl);return n instanceof e?{ready:!1,result:{errors:[n]}}:{ready:!0,assistant:t,schema:n,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=(t,i,r,s)=>{let l;try{l=o(t)}catch(t){return{errors:[t instanceof e?t:new e(R(t))]}}let c=a(r.schema,l,M);return c.length>0?{errors:c}:n({schema:r.schema,document:l,rootValue:this._rootValue,contextValue:s,variableValues:i.variables,operationName:i.operationName,fieldResolver:r.fieldResolver,typeResolver:this._resolveType})};prepare=async(t,i,n=this._generation)=>{let r,o=this._setup();if(!o.ready)return i.map(()=>({result:o.result,emissions:[],screenshots:new Map}));let s={manifest:o.assistant,state:t,emissions:[],failedMutationField:void 0,screenshots:new Map,screenshotBudget:14e5,lastScreenshot:Promise.resolve(),generation:n},a=[];for(let[t,n]of i.entries())if(void 0===r){let i=s.emissions.length,l=s.screenshots.size;s.failedMutationField=void 0;let c=v(n.document),h=o.lenses?w(c,o.lenses):c,d=h instanceof e?{errors:[h]}:await this._run(h,n,o,s);await s.lastScreenshot,a.push({result:d,emissions:s.emissions.slice(i),screenshots:new Map([...s.screenshots].slice(l))}),O(d)&&(r=t)}else a.push({result:V(r),emissions:[],screenshots:new Map});return a};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>_(e.updates,t)))};readScreenshots=e=>new Map(e.flatMap(({screenshots:e})=>[...e]));_prepareAndCommit=async(e,t)=>{let i,n,r,o=this._context.domainContextSelectors.getStoreSystem(),s=await this.prepare(o.stateSlices.committed.value.state,e,t),a=s.map(({result:e})=>e),l=this.readSideEffects(s),h=this.readScreenshots(s),d=s.flatMap(e=>e.emissions);if(!t.active)return{results:a,sideEffects:l,screenshots:h,outcome:"conflict"};if(a.some(O)||0===d.length)return{results:a,sideEffects:l,screenshots:h,outcome:"none"};let u=(i=c(d[0]),n=c(d[d.length-1]),r=d.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:i.previousState,state:n.state,updates:d.flatMap(e=>e.updates),validity:n.validity,transformationLog:r?d.flatMap(e=>e.transformationLog??[]):void 0});return{results:a,sideEffects:l,screenshots:h,outcome:o.commitPrepared(u),preparedState:u.state}};execute=async e=>{let t=this._generation;if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>$),committed:!1,sideEffects:[],screenshots:new Map};let i=await this._prepareAndCommit(e,t),{results:n,sideEffects:r,screenshots:o,outcome:s,preparedState:a}="conflict"===i.outcome&&t.active?await this._prepareAndCommit(e,t):i;return"committed"===s?{results:n,committed:!0,sideEffects:r,screenshots:o,preparedState:a}:"held"===s?{results:n,committed:!1,message:"The changes wait for the user's approval and are not applied yet. Do not send them again; the next `[changes]` block lists them once approved.",sideEffects:r,screenshots:o,preparedState:a}:"conflict"===s?{results:n,committed:!1,message:"The changes were not committed, because the configuration changed while they were being applied. The results describe a state that was discarded. Query the current configuration and send the operations again if they still make sense.",sideEffects:r,screenshots:o}:{results:n,committed:!1,sideEffects:r,screenshots:o}}}
@@ -1,8 +1,9 @@
1
1
  import type { EffectComposer } from 'postprocessing';
2
2
  import { Color, OrthographicCamera, PerspectiveCamera } from 'three';
3
3
  import type { AuthorizedPhoenixApiClient } from '#package/client';
4
- import type { ClientSideImageComponent, ComponentSnapshot, DomainContextSelectors, DomainEntity, DomainServicesSelectors, DomainState, SaveTemplateThumbnailComponent } from '#package/domain';
4
+ import type { AgentScreenshotComponent, ClientSideImageComponent, ComponentSnapshot, DomainContextSelectors, DomainEntity, DomainServicesSelectors, DomainState, SaveTemplateThumbnailComponent } from '#package/domain';
5
5
  import type { ConfiguratorExtensionSelectors } from '../../selectors.js';
6
+ import type { ExportRunOptions } from '../export-system/export-system.js';
6
7
  import type { ImageRenderConfig, ImageRenderer, RenderConfig } from './image-renderer.js';
7
8
  /**
8
9
  * Constructor context of an `ImageRenderingSystem`. Same-layer configurator peers are reached
@@ -20,6 +21,8 @@ export interface ClientSideImageRenderingOptions {
20
21
  /** Opens rendered images in new browser tabs instead of uploading them. */
21
22
  readonly debug?: boolean;
22
23
  }
24
+ /** A component that declares an image the export renders: its state says how, its entity what. */
25
+ type ImageComponentSnapshot = ComponentSnapshot<ClientSideImageComponent> | ComponentSnapshot<SaveTemplateThumbnailComponent> | ComponentSnapshot<AgentScreenshotComponent>;
23
26
  /** ImageRenderingSystem with its entity types erased — how the runtime selectors expose the instance. */
24
27
  export type AnyImageRenderingSystem = ImageRenderingSystem<any>;
25
28
  export declare class ImageRenderingSystem<ENTITIES extends DomainEntity<string>> {
@@ -94,7 +97,7 @@ export declare class ImageRenderingSystem<ENTITIES extends DomainEntity<string>>
94
97
  generateAndUploadDeclaredClientSideImages(state: DomainState<ENTITIES>, finalizationUuid: string, options?: ClientSideImageRenderingOptions): Promise<readonly {
95
98
  name: string;
96
99
  blob: Blob;
97
- imageComponent: ComponentSnapshot<ClientSideImageComponent> | ComponentSnapshot<SaveTemplateThumbnailComponent>;
100
+ imageComponent: ImageComponentSnapshot;
98
101
  }[]>;
99
102
  /**
100
103
  * Generates client side images from declarative clientSideImage components without uploading them.
@@ -102,12 +105,18 @@ export declare class ImageRenderingSystem<ENTITIES extends DomainEntity<string>>
102
105
  generateDeclaredClientSideImages(state: DomainState<ENTITIES>, options?: ClientSideImageRenderingOptions): Promise<readonly {
103
106
  name: string;
104
107
  blob: Blob;
105
- imageComponent: ComponentSnapshot<ClientSideImageComponent> | ComponentSnapshot<SaveTemplateThumbnailComponent>;
108
+ imageComponent: ImageComponentSnapshot;
106
109
  }[]>;
107
- generateImagesFromComponents(imageComponents: ReadonlyArray<ComponentSnapshot<ClientSideImageComponent> | ComponentSnapshot<SaveTemplateThumbnailComponent>>, sourceState: DomainState<ENTITIES>, options?: ClientSideImageRenderingOptions): Promise<ReadonlyArray<{
110
+ /**
111
+ * Renders the image components from the given state in one export run. With `awaitSettledState`,
112
+ * the run waits until the user is not in the middle of a change, as the assistant's screenshots do.
113
+ */
114
+ generateImagesFromComponents(imageComponents: ReadonlyArray<ImageComponentSnapshot>, sourceState: DomainState<ENTITIES>, options?: ClientSideImageRenderingOptions, runOptions?: ExportRunOptions): Promise<ReadonlyArray<{
108
115
  name: string;
109
116
  blob: Blob;
110
- imageComponent: ComponentSnapshot<ClientSideImageComponent> | ComponentSnapshot<SaveTemplateThumbnailComponent>;
117
+ imageComponent: ImageComponentSnapshot;
111
118
  }>>;
119
+ private _generateImagesFromComponents;
112
120
  initialize: () => void;
113
121
  }
122
+ export {};
@@ -1 +1 @@
1
- import{Color as e,HalfFloatType as t,NoToneMapping as r,OrthographicCamera as a,PerspectiveCamera as n,WebGLRenderTarget as o}from"three";import{preloadFont as i}from"troika-three-text";import{match as s}from"ts-pattern";import{clientSideImageComponent as l,dimensionIndicatorComponent as c,domainEntityTypeFromId as m,editableDistanceDimensionIndicatorComponent as g,isDomainEntityId as d,isVirtualEntityId as h,sketchingEditComponent as u}from"#package/domain";import{createCameraControls as f}from"../camera-control-system/create-camera-controls.js";import{createCanvasFreezeFrame as p}from"./canvas-freeze-frame.js";import{ExportCapturePass as w,readTargetToBlob as C,resolveExportBackground as _}from"./export-image-capture.js";export class ImageRenderingSystem{_context;_renderer=null;_effectComposer=null;_generation=null;_debugObjectUrls=new Set;_canvasFreeze=null;constructor(e){this._context=e}_captureGenerationAssertion=()=>{let e=this._generation,t=()=>{if(!e?.active)throw Error("Image rendering generation ended while images were being rendered! The configurator context was reinitialized before the renderer finished, so the results belong to a configuration that is no longer active. Await the render before leaving the configuration, or discard the rejection.")};return t(),t};_captureGenerationGuard=()=>{let e=this._captureGenerationAssertion();return{assertActive:e,waitFor:async t=>{let r=await t;return e(),r},runEffect:t=>(e(),t())}};register(e){return this._renderer=e,()=>{this._renderer===e&&(this._renderer=null)}}registerEffectComposer(e){return this._effectComposer=e,()=>{this._effectComposer===e&&(this._effectComposer=null)}}_openDebugImage=e=>{let t=URL.createObjectURL(e);this._debugObjectUrls.add(t),window.open(t,"_blank")};_getRenderer=async()=>{let e=this._generation,t=Date.now(),r=()=>{if(!e?.active)throw Error("Image rendering generation ended while waiting for the renderer! The configurator context was reinitialized before the renderer arrived, so the render would target a scene that is gone. Await the render before leaving the configuration, or discard the rejection.")};r();let a=this._renderer;for(;null===a;){if(await new Promise(e=>setTimeout(e,50)),r(),Date.now()-t>1e4)throw Error("Renderer could not be retrieved! Reached timeout.");a=this._renderer}return a};generateImageUsingOriginalCanvas=async(e,t,r=!1)=>{let a=this._captureGenerationGuard(),n=await a.waitFor(this._getRenderer());if(r){let{blob:e}=await a.waitFor(a.runEffect(()=>n.renderUsingOriginalCanvas(t)));a.runEffect(()=>this._openDebugImage(e));return}let o=await Promise.all([t].map(async e=>{let{blob:t}=await a.waitFor(a.runEffect(()=>n.renderUsingOriginalCanvas(e)));return{blob:t,name:e.name}})),i=await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,[t.name])));await Promise.all(i.map(async e=>{let t=o.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(i.map(async e=>{await a.waitFor(a.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))};async generateImagesUsingOriginalCanvas(e,t,r=!1){let a=this._captureGenerationGuard(),n=await a.waitFor(this._getRenderer()),o=Array.isArray(t)?t:[t],i=await o.reduce(async(e,t)=>[...await e,await a.waitFor(a.runEffect(()=>n.renderUsingOriginalCanvas(t)))],Promise.resolve([]));if(r){for(let e of i)a.runEffect(()=>this._openDebugImage(e.blob)),await a.waitFor(new Promise(e=>setTimeout(e,100)));return}let s=o.map(e=>e.name),l=await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,s)));await Promise.all(l.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(l.map(async e=>{await a.waitFor(a.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async generateImages(e,t,r=!1){let a=this._captureGenerationGuard(),n=await a.waitFor(this._getRenderer()),o=t.map(e=>e.name);if(r)return void await Promise.all(t.map(async e=>{let t=await a.waitFor(a.runEffect(()=>n.renderImage(e)));a.runEffect(()=>this._openDebugImage(t))}));let i=await Promise.all(t.map(async e=>({blob:await a.waitFor(a.runEffect(()=>n.renderImage(e))),name:e.name}))),s=await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,o)));await Promise.all(s.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(s.map(async e=>{await a.waitFor(a.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async getGeneratedImages(e,t=!1){let r=this._captureGenerationAssertion(),a=await this._getRenderer();return(r(),t)?(await Promise.all(e.map(async e=>{let t=await a.renderImage(e);r(),this._openDebugImage(t)})),[]):Promise.all(e.map(async e=>{let t=await a.renderImage(e);return r(),{blob:t,name:e.name}}))}_renderCurrentView=e=>{let{gl:t,scene:r,camera:a}=e.get();null!==this._effectComposer?this._effectComposer.render():t.render(r,a)};_freezeCanvas=e=>{this._canvasFreeze?.handle===e?this._canvasFreeze.holders+=1:(this._canvasFreeze?.remove(),this._canvasFreeze={handle:e,remove:p(e.get().gl.domElement,()=>this._renderCurrentView(e)),resumeFrameloop:this._context.configuratorExtensionSelectors.getExportSystem().pauseFrameloop(e),holders:1});let t=this._canvasFreeze,r=!1;return async()=>{if(!r&&(r=!0,t.holders-=1,!(t.holders>0)))try{let r=this._context.configuratorExtensionSelectors.getCanvasSystem();r.r3fHandle$.value===e&&await r.waitForFlush(),r.r3fHandle$.value===e&&0===t.holders&&this._renderCurrentView(e)}catch{}finally{0===t.holders&&(t.remove(),t.resumeFrameloop(),this._canvasFreeze===t&&(this._canvasFreeze=null))}}};async renderImage(a){let n=this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value;if(null===n)throw Error("R3F state not ready");let{gl:i,scene:s,camera:l,size:c,advance:m}=n.get(),g=i.getRenderTarget(),d=i.getClearColor(new e),h=i.getClearAlpha(),u=i.autoClearColor,f=e=>new w(a.width,a.height,e,i.outputColorSpace),p={composer:null,pass:null},y=null,b=null,x=e=>{let t=p.pass??f(r);return p.pass=t,p.composer===e&&e.passes.at(-1)===t||(p.composer?.removePass(t),e.addPass(t),p.composer=e),t},v=async()=>{if(await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value!==n)throw Error("Canvas was remounted while an image was being rendered! The export borrowed a canvas that is gone, so it cannot capture the image. Retry the export once the configurator has settled.")},E=this._freezeCanvas(n);try{n.set({size:{height:a.height,width:a.width,top:0,left:0,updateStyle:!1}}),n.set({camera:a.camera}),await v(),null!==this._effectComposer&&x(this._effectComposer),m(void 0),await v();let r="JPEG"===a.fileFormat?"image/jpeg":"image/png",l=_({sceneBackground:s.background,backgroundColor:a.backgroundColor,fileFormat:a.fileFormat,outputColorSpace:i.outputColorSpace});if(null!==this._effectComposer){i.setRenderTarget(null),"JPEG"===a.fileFormat?i.setClearColor(a.backgroundColor??0xffffff):a.backgroundColor?i.setClearColor(a.backgroundColor):i.setClearAlpha(0),i.autoClearColor=!0;let e=x(this._effectComposer);return this._effectComposer.render(),await C(i,e.renderTarget,l,r)}y=f(i.toneMapping),b=new o(a.width,a.height,{samples:4,type:t,stencilBuffer:i.getContextAttributes().stencil??!1});let c=s.background;c instanceof e&&(s.background=null);try{i.setClearColor(0,0),i.setRenderTarget(b),i.clear(),i.render(s,a.camera)}finally{s.background=c}return y.render(i,b),await C(i,y.renderTarget,l,r)}finally{null!==p.pass&&(p.composer?.removePass(p.pass),p.pass.dispose()),y?.dispose(),b?.dispose(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value===n&&(i.setClearColor(d,h),i.autoClearColor=u,i.setRenderTarget(g),n.set({camera:l,size:{...c,updateStyle:!1}})),await E()}}async generateAndUploadDeclaredClientSideImages(e,t,r={}){let a=this._captureGenerationGuard(),n=await a.waitFor(this.generateDeclaredClientSideImages(e,r));if(r.debug)return n;let o=new Map((await a.waitFor(a.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),t,n.map(e=>e.name))))).map(e=>[e.name,e.url]));return await Promise.all(n.map(async e=>{let t=o.get(e.name);if(!t)throw Error(`Presigned link for image ${e.name} not found!`);await a.waitFor(a.runEffect(()=>fetch(t,{method:"PUT",body:e.blob})))})),n}generateDeclaredClientSideImages(e,t={}){let r=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[l]},e);return this.generateImagesFromComponents(r,e,t)}async generateImagesFromComponents(t,r,o={}){let l=this._captureGenerationGuard(),p=this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value;if(null===p)throw Error("R3F state not ready");let w=!1,C=this._context.domainContextSelectors.getExportStates(),_=t.map(t=>{if(!C.includes(t.state.exportState)){let e=d(t.componentInstance.entityId)?m(t.componentInstance.entityId):"unknown entity",r=t.componentInstance.componentType.name,a=t.componentInstance.instanceName;throw Error(`Export state ${t.state.exportState} declared in component ${r}/${a} on ${e} is not a valid export state. Expected one of: ${C.join(", ")}`)}let p=t.componentInstance.entityId;if(h(p))throw Error("Virtual entities cannot be used for export");return this._context.configuratorExtensionSelectors.getExportSystem().createExportJob(r,{exportState:t.state.exportState,exportedEntityId:p,toolState:t.state.toolState,viewState:t.state.viewState,navigationState:t.state.navigationState,selectedEntityId:r.rootEntityId},async r=>{let m=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[c,g,u]},r.state);!w&&m.length>0&&(await new Promise(e=>{i({font:void 0,characters:void 0},e)}),w=!0,await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush());let d=this._context.configuratorExtensionSelectors.getCameraSystem().getActiveCameraConfig(r.state);if(null==d)throw Error(`No camera config is attached for export state ${t.state.exportState} and exported entity ${p}. Whenever using a client-side image component, you need to attach a camera configuration to the export state defined on that componentin the domain spec. This camera will be used to render the image.`);let h=s(d.typeSpecificConfig.cameraType).with("perspective",()=>new n(45,t.state.width/t.state.height,1,1e4)).with("orthographic",()=>new a(0,0,1e4,0,1,1e4)).exhaustive(),C=f(h);await this._context.configuratorExtensionSelectors.getCameraSystem().applyConfig(d,C,!1,{width:t.state.width,height:t.state.height,padding:{top:0,right:0,bottom:0,left:0}}),C.update(1e6),await new Promise(e=>setTimeout(e,100));let _=await l.waitFor(l.runEffect(()=>this.renderImage({width:t.state.width,height:t.state.height,fileFormat:t.state.fileFormat,backgroundColor:t.state.backgroundColor?new e(t.state.backgroundColor):void 0,camera:h})));return o.debug&&l.runEffect(()=>this._openDebugImage(_)),{blob:_,imageComponent:t,name:`${t.componentInstance.componentType.name}-${t.componentInstance.entityId}-${t.componentInstance.instanceName}`}})});if(0===_.length)return this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(_);let y=this._freezeCanvas(p);try{return await this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(_)}finally{await y()}}initialize=()=>{for(let e of(null!==this._generation&&(this._generation.active=!1),this._debugObjectUrls))URL.revokeObjectURL(e);this._debugObjectUrls.clear(),this._generation={active:!0}}}
1
+ import{Color as e,HalfFloatType as t,NoToneMapping as a,OrthographicCamera as r,PerspectiveCamera as n,WebGLRenderTarget as o}from"three";import{preloadFont as i}from"troika-three-text";import{match as s}from"ts-pattern";import{clientSideImageComponent as l,dimensionIndicatorComponent as c,domainEntityTypeFromId as m,editableDistanceDimensionIndicatorComponent as g,isDomainEntityId as d,isVirtualEntityId as h,sketchingEditComponent as u}from"#package/domain";import{createCameraControls as f}from"../camera-control-system/create-camera-controls.js";import{createCanvasFreezeFrame as p}from"./canvas-freeze-frame.js";import{ExportCapturePass as w,readTargetToBlob as C,resolveExportBackground as _}from"./export-image-capture.js";export class ImageRenderingSystem{_context;_renderer=null;_effectComposer=null;_generation=null;_debugObjectUrls=new Set;_canvasFreeze=null;constructor(e){this._context=e}_captureGenerationAssertion=()=>{let e=this._generation,t=()=>{if(!e?.active)throw Error("Image rendering generation ended while images were being rendered! The configurator context was reinitialized before the renderer finished, so the results belong to a configuration that is no longer active. Await the render before leaving the configuration, or discard the rejection.")};return t(),t};_captureGenerationGuard=()=>{let e=this._captureGenerationAssertion();return{assertActive:e,waitFor:async t=>{let a=await t;return e(),a},runEffect:t=>(e(),t())}};register(e){return this._renderer=e,()=>{this._renderer===e&&(this._renderer=null)}}registerEffectComposer(e){return this._effectComposer=e,()=>{this._effectComposer===e&&(this._effectComposer=null)}}_openDebugImage=e=>{let t=URL.createObjectURL(e);this._debugObjectUrls.add(t),window.open(t,"_blank")};_getRenderer=async()=>{let e=this._generation,t=Date.now(),a=()=>{if(!e?.active)throw Error("Image rendering generation ended while waiting for the renderer! The configurator context was reinitialized before the renderer arrived, so the render would target a scene that is gone. Await the render before leaving the configuration, or discard the rejection.")};a();let r=this._renderer;for(;null===r;){if(await new Promise(e=>setTimeout(e,50)),a(),Date.now()-t>1e4)throw Error("Renderer could not be retrieved! Reached timeout.");r=this._renderer}return r};generateImageUsingOriginalCanvas=async(e,t,a=!1)=>{let r=this._captureGenerationGuard(),n=await r.waitFor(this._getRenderer());if(a){let{blob:e}=await r.waitFor(r.runEffect(()=>n.renderUsingOriginalCanvas(t)));r.runEffect(()=>this._openDebugImage(e));return}let o=await Promise.all([t].map(async e=>{let{blob:t}=await r.waitFor(r.runEffect(()=>n.renderUsingOriginalCanvas(e)));return{blob:t,name:e.name}})),i=await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,[t.name])));await Promise.all(i.map(async e=>{let t=o.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(i.map(async e=>{await r.waitFor(r.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))};async generateImagesUsingOriginalCanvas(e,t,a=!1){let r=this._captureGenerationGuard(),n=await r.waitFor(this._getRenderer()),o=Array.isArray(t)?t:[t],i=await o.reduce(async(e,t)=>[...await e,await r.waitFor(r.runEffect(()=>n.renderUsingOriginalCanvas(t)))],Promise.resolve([]));if(a){for(let e of i)r.runEffect(()=>this._openDebugImage(e.blob)),await r.waitFor(new Promise(e=>setTimeout(e,100)));return}let s=o.map(e=>e.name),l=await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,s)));await Promise.all(l.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(l.map(async e=>{await r.waitFor(r.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async generateImages(e,t,a=!1){let r=this._captureGenerationGuard(),n=await r.waitFor(this._getRenderer()),o=t.map(e=>e.name);if(a)return void await Promise.all(t.map(async e=>{let t=await r.waitFor(r.runEffect(()=>n.renderImage(e)));r.runEffect(()=>this._openDebugImage(t))}));let i=await Promise.all(t.map(async e=>({blob:await r.waitFor(r.runEffect(()=>n.renderImage(e))),name:e.name}))),s=await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),e,o)));await Promise.all(s.map(async e=>{let t=i.find(t=>t.name===e.name);if(null==t)throw Error("Blob not found!");await Promise.all(s.map(async e=>{await r.waitFor(r.runEffect(()=>fetch(e.url,{method:"PUT",body:t.blob,headers:{"Content-Type":"image/png","Content-Length":t.blob.size.toString()}})))}))}))}async getGeneratedImages(e,t=!1){let a=this._captureGenerationAssertion(),r=await this._getRenderer();return(a(),t)?(await Promise.all(e.map(async e=>{let t=await r.renderImage(e);a(),this._openDebugImage(t)})),[]):Promise.all(e.map(async e=>{let t=await r.renderImage(e);return a(),{blob:t,name:e.name}}))}_renderCurrentView=e=>{let{gl:t,scene:a,camera:r}=e.get();null!==this._effectComposer?this._effectComposer.render():t.render(a,r)};_freezeCanvas=e=>{this._canvasFreeze?.handle===e?this._canvasFreeze.holders+=1:(this._canvasFreeze?.remove(),this._canvasFreeze={handle:e,remove:p(e.get().gl.domElement,()=>this._renderCurrentView(e)),resumeFrameloop:this._context.configuratorExtensionSelectors.getExportSystem().pauseFrameloop(e),holders:1});let t=this._canvasFreeze,a=!1;return async()=>{if(!a&&(a=!0,t.holders-=1,!(t.holders>0)))try{let a=this._context.configuratorExtensionSelectors.getCanvasSystem();a.r3fHandle$.value===e&&await a.waitForFlush(),a.r3fHandle$.value===e&&0===t.holders&&this._renderCurrentView(e)}catch{}finally{0===t.holders&&(t.remove(),t.resumeFrameloop(),this._canvasFreeze===t&&(this._canvasFreeze=null))}}};async renderImage(r){let n=this._context.configuratorExtensionSelectors.getCanvasSystem(),i=n.r3fHandle$.value??await n.waitForCanvas(),{gl:s,scene:l,camera:c,size:m,advance:g}=i.get(),d=s.getRenderTarget(),h=s.getClearColor(new e),u=s.getClearAlpha(),f=s.autoClearColor,p=e=>new w(r.width,r.height,e,s.outputColorSpace),y={composer:null,pass:null},b=null,x=null,v=e=>{let t=y.pass??p(a);return y.pass=t,y.composer===e&&e.passes.at(-1)===t||(y.composer?.removePass(t),e.addPass(t),y.composer=e),t},E=async()=>{if(await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value!==i)throw Error("Canvas was remounted while an image was being rendered! The export borrowed a canvas that is gone, so it cannot capture the image. Retry the export once the configurator has settled.")},S=this._freezeCanvas(i);try{i.set({size:{height:r.height,width:r.width,top:0,left:0,updateStyle:!1}}),i.set({camera:r.camera}),await E(),null!==this._effectComposer&&v(this._effectComposer),g(void 0),await E();let a="JPEG"===r.fileFormat?"image/jpeg":"image/png",n=_({sceneBackground:l.background,backgroundColor:r.backgroundColor,fileFormat:r.fileFormat,outputColorSpace:s.outputColorSpace});if(null!==this._effectComposer){s.setRenderTarget(null),"JPEG"===r.fileFormat?s.setClearColor(r.backgroundColor??0xffffff):r.backgroundColor?s.setClearColor(r.backgroundColor):s.setClearAlpha(0),s.autoClearColor=!0;let e=v(this._effectComposer);return this._effectComposer.render(),await C(s,e.renderTarget,n,a)}b=p(s.toneMapping),x=new o(r.width,r.height,{samples:4,type:t,stencilBuffer:s.getContextAttributes().stencil??!1});let c=l.background;c instanceof e&&(l.background=null);try{s.setClearColor(0,0),s.setRenderTarget(x),s.clear(),s.render(l,r.camera)}finally{l.background=c}return b.render(s,x),await C(s,b.renderTarget,n,a)}finally{null!==y.pass&&(y.composer?.removePass(y.pass),y.pass.dispose()),b?.dispose(),x?.dispose(),this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value===i&&(s.setClearColor(h,u),s.autoClearColor=f,s.setRenderTarget(d),i.set({camera:c,size:{...m,updateStyle:!1}})),await S()}}async generateAndUploadDeclaredClientSideImages(e,t,a={}){let r=this._captureGenerationGuard(),n=await r.waitFor(this.generateDeclaredClientSideImages(e,a));if(a.debug)return n;let o=new Map((await r.waitFor(r.runEffect(()=>this._context.getAuthorizedClient().generateUploadLinks(this._context.getConfigurationId(),t,n.map(e=>e.name))))).map(e=>[e.name,e.url]));return await Promise.all(n.map(async e=>{let t=o.get(e.name);if(!t)throw Error(`Presigned link for image ${e.name} not found!`);await r.waitFor(r.runEffect(()=>fetch(t,{method:"PUT",body:e.blob})))})),n}generateDeclaredClientSideImages(e,t={}){let a=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[l]},e);return this.generateImagesFromComponents(a,e,t)}generateImagesFromComponents(e,t,a={},r={}){return this._generateImagesFromComponents(e,t,a,r)}async _generateImagesFromComponents(t,a,o,l){let p=this._captureGenerationGuard(),w=!1,C=this._context.domainContextSelectors.getExportStates(),_=t.map(t=>{if(!C.includes(t.state.exportState)){let e=d(t.componentInstance.entityId)?m(t.componentInstance.entityId):"unknown entity",a=t.componentInstance.componentType.name,r=t.componentInstance.instanceName;throw Error(`Export state ${t.state.exportState} declared in component ${a}/${r} on ${e} is not a valid export state. Expected one of: ${C.join(", ")}`)}let l=t.componentInstance.entityId;if(h(l))throw Error("Virtual entities cannot be used for export");return this._context.configuratorExtensionSelectors.getExportSystem().createExportJob(a,{exportState:t.state.exportState,exportedEntityId:l,toolState:t.state.toolState,viewState:t.state.viewState,navigationState:t.state.navigationState,selectedEntityId:a.rootEntityId},async a=>{let m=this._context.domainContextSelectors.getComponentReader().readManyComponents({componentTypes:[c,g,u]},a.state);!w&&m.length>0&&(await new Promise(e=>{i({font:void 0,characters:void 0},e)}),w=!0,await this._context.configuratorExtensionSelectors.getCanvasSystem().waitForFlush());let d=this._context.configuratorExtensionSelectors.getCameraSystem().getActiveCameraConfig(a.state);if(null==d)throw Error(`No camera config is attached for export state ${t.state.exportState} and exported entity ${l}. Whenever using a client-side image component, you need to attach a camera configuration to the export state defined on that componentin the domain spec. This camera will be used to render the image.`);let h=s(d.typeSpecificConfig.cameraType).with("perspective",()=>new n(45,t.state.width/t.state.height,1,1e4)).with("orthographic",()=>new r(0,0,1e4,0,1,1e4)).exhaustive(),C=f(h);await this._context.configuratorExtensionSelectors.getCameraSystem().applyConfig(d,C,!1,{width:t.state.width,height:t.state.height,padding:{top:0,right:0,bottom:0,left:0}}),C.update(1e6),await new Promise(e=>setTimeout(e,100));let _=await p.waitFor(p.runEffect(()=>this.renderImage({width:t.state.width,height:t.state.height,fileFormat:t.state.fileFormat,backgroundColor:t.state.backgroundColor?new e(t.state.backgroundColor):void 0,camera:h})));return o.debug&&p.runEffect(()=>this._openDebugImage(_)),{blob:_,imageComponent:t,name:`${t.componentInstance.componentType.name}-${t.componentInstance.entityId}-${t.componentInstance.instanceName}`}})});if(0===_.length)return this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(_,l);let y=this._context.configuratorExtensionSelectors.getCanvasSystem(),b=y.r3fHandle$.value??await p.waitFor(y.waitForCanvas().catch(e=>{throw p.assertActive(),e})),x=this._freezeCanvas(b);try{return await this._context.configuratorExtensionSelectors.getExportSystem().runExportJobs(_,l)}finally{await x()}}initialize=()=>{for(let e of(null!==this._generation&&(this._generation.active=!1),this._debugObjectUrls))URL.revokeObjectURL(e);this._debugObjectUrls.clear(),this._generation={active:!0}}}
@@ -6,7 +6,7 @@ export { createCameraControls } from './camera-control-system/create-camera-cont
6
6
  export { type AnyCanvasSystem, CanvasSystem, type EntityObjectFilter, type FlushToken } from './canvas-system.js';
7
7
  export { type AnyDragAndDropSystem, DragAndDropSystem, type DragAndDropSystemContext, type DraggableState, type DraggingState, type RotationDraggingState, } from './drag-and-drop-system/drag-and-drop-system.js';
8
8
  export { type AnyExportSystem, ExportSystem, type ExportSystemContext } from './export-system/export-system.js';
9
- export { type GraphQLExecution, type GraphQLOperation, GraphQLSystem, type GraphQLSystemContext, type PreparedOperation, } from './graphql-system/graphql-system.js';
9
+ export { type GraphQLExecution, type GraphQLScreenshot, type GraphQLOperation, GraphQLSystem, type GraphQLSystemContext, type PreparedOperation, } from './graphql-system/graphql-system.js';
10
10
  export type * from './image-rendering-system/image-renderer.js';
11
11
  export { type AnyImageRenderingSystem, ImageRenderingSystem, type ImageRenderingSystemContext, } from './image-rendering-system/image-rendering-system.js';
12
12
  export { type AnyLayoutSystem, LayoutSystem, type LayoutSystemContext } from './layout-system/layout-system.js';
@@ -1,14 +1,15 @@
1
1
  import { type $DomainEntity, type ConfiguratorBuilder, type CreateCustomPhoenixEntityElement, type CreateCustomPhoenixLayoutElement, type CreateGetThemeHandler, type CreateGetWebComponentOptionsHandler, type CreatePhoenixHandler, type DomainEntity, type IsCreateRecipeUpdate, type IsReplaceRecipeUpdate, type TransformerBuilder, type TransformerFactory, type UpdateFactory, getIdSequence } from '#package/domain';
2
- import { type CreateCollectFrontendDataHandler, type CreateFilterPublishedChunksHandler, type CreateNotAuthenticatedPage, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfiguratorMessages, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useLoadingStateValue } from '#package/react-sdk';
2
+ import { type CreateAddEntityFab, type CreateCollectFrontendDataHandler, type CreateDeleteEntityFab, type CreateFilterPublishedChunksHandler, type CreateNavigationHotspot, type CreateNotAuthenticatedPage, type CreateSelectionHotspot, type CreateToolMenuFab, type IsAngleDimensionUpdate, type IsAttributeSelectionUpdate, type IsAttributeSwitchUpdate, type IsDeleteEntityUpdate, type IsDistanceDimensionUpdate, type IsGenericDimensionUpdate, type IsSwatchSelectionUpdate, type IsTextValueUpdate, type UseAccessService, type UseActiveNavigationState, type UseActiveToolState, type UseActiveViewState, type UseActiveViewports, type UseAnalyticsService, type UseAngleDimension, type UseAttributeSelection, type UseAttributeSwitch, type UseAuthenticatedClient, type UseAuthorizedClient, type UseBackendData, type UseChildEntitySelection, type UseComponent, type UseComponents, type UseComposition, type UseConfigurationId, type UseConfigurationSaveState, type UseConfiguratorMessages, type UseControlViolations, type UseCookRecipes, type UseCookReplaceRecipes, type UseCookedRecipes, type UseCookedReplaceRecipes, type UseCreateAuthorizedClient, type UseDeleteEntity, type UseDeletedEntity, type UseDeselect, type UseDistanceDimension, type UseDistanceDimensionSelection, type UseDomainApplicationContext, type UseDomainApplicationProps, type UseDomainContext, type UseDomainEntityState, type UseEntityPrice, type UseEntitySelector, type UseFinalizeAction, type UseFinalizeActions, type UseFinalizeViolations, type UseFirstComponent, type UseFirstRootComponent, type UseFrontendData, type UseGenericDimension, type UseGroupedRecipeOptions, type UseHoveredDomainEntityId, type UseHoveredEntity, type UseHoveredEntityId, type UseIntegrationService, type UseIntegrationState, type UseIsFullscreenActive, type UseLoadedData, type UseLoadingState, type UseLocaleSwitch, type UseMapViolationHints, type UseNavigate, type UsePopNavigate, type UsePresetEmbeddedState, type UsePublishedData, type UsePushNavigate, type UseRecipeEmbeddedState, type UseReplaceEntityRecipeOptions, type UseRootComponents, type UseRootEntityId, type UseRootEntityPrice, type UseRootEntitySelector, type UseRootEntityState, type UseSelectEntity, type UseSelectParent, type UseSelectedDomainEntityId, type UseSelectedEntity, type UseSelectedEntityId, type UseSession, type UseSessionRole, type UseSessionService, type UseSetFullscreen, type UseSetViewState, type UseShareLinks, type UseSlice, type UseState, type UseStateValidity, type UseStepNavigation, type UseSwatchSelection, type UseSynchronizedSelector, type UseSynchronizedSelector$, type UseTabNavigation, type UseTextValue, type UseUndoRedo, type UseUpdateControl, type UseUpdatedControl, useGenerateShareLink, useLoadingStateValue, useLocalizable, useResolveLocalizable } from '#package/react-sdk';
3
3
  import { type CreatePhoenixIconSet } from '#package/ui-sdk';
4
4
  import { type UseConfiguratorExtensions } from '../application-runtime/index.js';
5
5
  import { type CreateConfigurationNotFoundPage } from '../configuration-not-found-page/index.js';
6
- import { type CreateOnApplicationStartProvider, type CreateOnBackendDataReadyProvider, type CreateOnConfiguratorReadyProvider, type CreateOnFrontendDataReadyProvider, type CreateOnGoToIndexHandler, type CreateOnPresetLoadedHandler, type CreateOnPublishedDataReadyProvider, type CreateOnRoutingReadyProvider, type CreateOnSessionReadyProvider, type UseConfiguratorRouting, type UsePresetSelection, usePropertyPageStack, usePropertyPageState } from '../configurator-context/index.js';
6
+ import { type CreateOnApplicationStartProvider, type CreateOnBackendDataReadyProvider, type CreateOnConfiguratorReadyProvider, type CreateOnFrontendDataReadyProvider, type CreateOnGoToIndexHandler, type CreateOnPresetLoadedHandler, type CreateOnPublishedDataReadyProvider, type CreateOnRoutingReadyProvider, type CreateOnSessionReadyProvider, type UseConfiguratorRouting, type UsePresetSelection, usePreview, usePropertyPageStack, usePropertyPageState } from '../configurator-context/index.js';
7
7
  import { type CreateConfiguratorErrorPage } from '../configurator-error-page/index.js';
8
+ import { useCloseAction } from '../integration/index.js';
8
9
  import { type CreateGetTextureProcessingMapHandler } from '../scene/index.js';
9
10
  import type { UseUpdateEntityObjectSelection } from '../scene/scene-entity/drag-and-drop/use-updated-selection.js';
10
- import { type CreateAppLoader, type CreateCanvasLoader, type CreateLayoutAdminUi, type CreateLayoutCustomOwnerUi, type CreateLayoutCustomReadUi, type CreateLayoutDialog, type CreateLayoutFooter, type CreateLayoutToolbarDesktop, type CreateLayoutToolbarDesktopFullScreen, type CreateLayoutToolbarReadDesktop, type CreateLayoutToolbarReadDesktopFullScreen, type CreateLayoutUserUi, type CreateToolbarHelp } from '../ui/index.js';
11
- import { useGenerateShareLink } from '../ui/phoenix-layout-elements/share/use-share.js';
11
+ import { type UseAssistantPanel, type UseMeasurements, type UseToolbarActions } from '../toolbar-actions/index.js';
12
+ import { type CreateAppLoader, type CreateCanvasLoader, type CreateLayoutAdminUi, type CreateLayoutCustomOwnerUi, type CreateLayoutCustomReadUi, type CreateLayoutDialog, type CreateLayoutFooter, type CreateLayoutToolbarDesktop, type CreateLayoutToolbarDesktopFullScreen, type CreateLayoutToolbarReadDesktop, type CreateLayoutToolbarReadDesktopFullScreen, type CreateLayoutUserUi, type CreateToolbarHelp, LayoutSlots, useSceneSafeArea } from '../ui/index.js';
12
13
  import { type CreatePresetDeviceNotSupported, type CreatePresetPageAction, type CreatePresetUi } from '../ui/preset-layout/PresetUi.js';
13
14
  import { type UseResetCamera } from './use-reset-camera.js';
14
15
  export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, ALLOWED_ROOT_ENTITIES extends ENTITIES, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>, PUBLISHED_DATA extends Record<string, unknown>, SESSION_DATA extends Record<string, unknown>, FRONTEND_DATA extends Record<string, unknown>, NAVIGATION_STATES extends string, VIEW_STATES extends string, TOOL_STATES extends string, EXPORT_STATES extends string, FINALIZE_DATA extends Record<string, unknown>, FINALIZE_RESULT extends Record<string, unknown>> {
@@ -192,6 +193,32 @@ export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, AL
192
193
  * `ConfiguratorErrorPage`.
193
194
  */
194
195
  createConfiguratorErrorPage: CreateConfiguratorErrorPage;
196
+ /**
197
+ * Creates the in-scene FAB that adds child entities (`sceneEntityAddFab`), replacing the built-in
198
+ * `AddEntityFab` element. It receives the component's settings and reads the recipes it offers
199
+ * with `useGroupedRecipeOptions(entityId, instanceNames, fixableViolations)`.
200
+ */
201
+ createAddEntityFab: CreateAddEntityFab;
202
+ /**
203
+ * Creates the in-scene FAB that deletes an entity (`sceneEntityDeleteFab`), replacing the built-in
204
+ * `DeleteEntityFab` element. It receives `onDelete`, `disabled` and `disabledHint`.
205
+ */
206
+ createDeleteEntityFab: CreateDeleteEntityFab;
207
+ /**
208
+ * Creates the in-scene hotspot that selects an entity (`sceneEntitySelectHotspot`), replacing the
209
+ * built-in `SelectionHotspot` element. It receives `onSelect`.
210
+ */
211
+ createSelectionHotspot: CreateSelectionHotspot;
212
+ /**
213
+ * Creates the in-scene hotspot that goes to a navigation state (`sceneEntityNavigationHotspot`),
214
+ * replacing the built-in `NavigationHotspot` element. It receives `onNavigate`.
215
+ */
216
+ createNavigationHotspot: CreateNavigationHotspot;
217
+ /**
218
+ * Creates the in-scene FAB that switches tools (`toolMenuFab`), replacing the built-in `ToolMenuFab`
219
+ * element. It receives the tool `options` and `onSelectTool`.
220
+ */
221
+ createToolMenuFab: CreateToolMenuFab;
195
222
  /**
196
223
  * Factory for creating transformers for entities.
197
224
  * @deprecated Use {@link #transformerBuilder} instead.
@@ -360,6 +387,11 @@ export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, AL
360
387
  * text resolved
361
388
  */
362
389
  useConfiguratorMessages: UseConfiguratorMessages<ENTITIES, $MAP>;
390
+ /**
391
+ * The save status of the configuration: `{ revisionId, isSaving, failure }`, where `failure` is the latest save's
392
+ * `{ error, timestamp }` until a later save succeeds
393
+ */
394
+ useConfigurationSaveState: UseConfigurationSaveState;
363
395
  /**
364
396
  * Runs the project handler a `finalizeAction` component names, with its pending state, its error and the
365
397
  * finalize violations; call it once per component, wrapped in `PhoenixHandlerBoundary`
@@ -522,6 +554,60 @@ export interface ConfiguratorInterface<ENTITIES extends DomainEntity<string>, AL
522
554
  * and the header's stepper do
523
555
  */
524
556
  useStepNavigation: UseStepNavigation<NAVIGATION_STATES>;
557
+ /**
558
+ * Tell the camera which part of the canvas a project layout leaves free for the scene. Attach `containerRef` to the
559
+ * element that covers the whole canvas and `safeAreaRef` to the region the scene should stay visible in
560
+ */
561
+ useSceneSafeArea: typeof useSceneSafeArea;
562
+ /**
563
+ * Get the responsive breakpoints the configurator's container satisfies, or `null` before it is measured
564
+ */
565
+ useActiveViewports: UseActiveViewports;
566
+ /**
567
+ * Get the preview state: whether the layout shows a preview start screen, and functions that enter and leave it
568
+ */
569
+ usePreview: typeof usePreview;
570
+ /**
571
+ * Get the host's close action, or `null` when the integration mode offers none
572
+ */
573
+ useCloseAction: typeof useCloseAction;
574
+ /**
575
+ * Whether a viewer of a configuration shared for viewing may clone it to edit: the application config sets
576
+ * `shareCloneToEdit` and the session's role may create configurations
577
+ */
578
+ useIsCloningAllowed: typeof LayoutSlots.useIsCloningAllowed;
579
+ /**
580
+ * Returns a function that turns a localizable text of the spec into a string in the current language
581
+ */
582
+ useResolveLocalizable: typeof useResolveLocalizable;
583
+ /**
584
+ * Turn one localizable text of the spec into a string in the current language
585
+ */
586
+ useLocalizable: typeof useLocalizable;
587
+ /**
588
+ * The spec's toolbar for a placement as runnable entries, grouped as the spec groups them, for a layout's own
589
+ * toolbar
590
+ */
591
+ useToolbarActions: UseToolbarActions;
592
+ /**
593
+ * The unit of dimensions and the dimension indicators, with functions that change them, as the toolbar's
594
+ * measurements button does
595
+ */
596
+ useMeasurements: UseMeasurements;
597
+ /**
598
+ * The languages the configurator offers and the active one, with a function that switches it, as the toolbar's
599
+ * language button does
600
+ */
601
+ useLocaleSwitch: UseLocaleSwitch;
602
+ /**
603
+ * Links that share the configuration for editing and for viewing, as the toolbar's share dialog generates them
604
+ */
605
+ useShareLinks: UseShareLinks;
606
+ /**
607
+ * Whether the assistant panel is open, with a function that opens or closes it, as the toolbar's assistant button
608
+ * does
609
+ */
610
+ useAssistantPanel: UseAssistantPanel;
525
611
  /**
526
612
  * Returns composition tree of the domain
527
613
  */