@salsita-ai/sdk 0.50.0-develop.24077d65e6 → 0.50.0-develop.257ef311fd

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 (542) hide show
  1. package/README.md +19 -14
  2. package/dist/admin/default-admin-elements.d.ts +9 -0
  3. package/dist/admin/default-admin-elements.js +1 -0
  4. package/dist/admin/default-elements/built-in-entity-element.d.ts +10 -0
  5. package/dist/admin/default-elements/built-in-entity-element.js +1 -0
  6. package/dist/admin/default-elements/built-in-layout-element.d.ts +10 -0
  7. package/dist/admin/default-elements/built-in-layout-element.js +1 -0
  8. package/dist/admin/default-elements/index.d.ts +2 -0
  9. package/dist/admin/default-elements/index.js +1 -0
  10. package/dist/admin/index.d.ts +1 -0
  11. package/dist/admin/index.js +1 -1
  12. package/dist/application-spec/caching/content-diff.js +1 -1
  13. package/dist/application-spec/core/application-file.d.ts +0 -2
  14. package/dist/application-spec/core/application-file.js +1 -1
  15. package/dist/application-spec/errors/diagnostic-codes.d.ts +5 -0
  16. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  17. package/dist/application-spec/errors/diagnostic-messages.d.ts +5 -0
  18. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  19. package/dist/application-spec/generate-application/code/common/code-imports.js +1 -1
  20. package/dist/application-spec/generate-application/code/common/env-reader.js +2 -2
  21. package/dist/application-spec/generate-application/code/common/index.d.ts +1 -0
  22. package/dist/application-spec/generate-application/code/common/index.js +1 -1
  23. package/dist/application-spec/generate-application/code/common/single-quoted-string.d.ts +6 -0
  24. package/dist/application-spec/generate-application/code/common/single-quoted-string.js +1 -0
  25. package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
  26. package/dist/application-spec/generate-application/code/generate-application-code.d.ts +3 -2
  27. package/dist/application-spec/generate-application/code/generate-application-code.js +1 -1
  28. package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +15 -14
  29. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  30. package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +2 -2
  31. package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
  32. package/dist/application-spec/generate-application/code/story-files.js +1 -1
  33. package/dist/application-spec/generate-application/code/templates/admin-config.js +3 -0
  34. package/dist/application-spec/generate-application/code/templates/common/format-property-key.d.ts +7 -0
  35. package/dist/application-spec/generate-application/code/templates/common/format-property-key.js +1 -0
  36. package/dist/application-spec/generate-application/code/templates/common/schema-to-type-string.js +3 -3
  37. package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -4
  38. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.d.ts +35 -0
  39. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.js +5 -0
  40. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/index.d.ts +1 -0
  41. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/index.js +1 -0
  42. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.d.ts +1 -1
  43. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.js +6 -6
  44. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +59 -63
  45. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.d.ts +8 -0
  46. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.js +1 -1
  47. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-presets.js +1 -1
  48. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +13 -13
  49. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.d.ts +1 -1
  50. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.js +2 -2
  51. package/dist/application-spec/generate-application/code/templates/domain-spec/index.d.ts +2 -1
  52. package/dist/application-spec/generate-application/code/templates/domain-spec/index.js +1 -1
  53. package/dist/application-spec/generate-application/code/templates/eslint-config.d.ts +5 -0
  54. package/dist/application-spec/generate-application/code/templates/eslint-config.js +4 -5
  55. package/dist/application-spec/generate-application/code/templates/frontend-config.js +3 -5
  56. package/dist/application-spec/generate-application/code/templates/gitignore.js +0 -3
  57. package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.d.ts +43 -0
  58. package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +31 -0
  59. package/dist/application-spec/generate-application/code/templates/global-definition/index.d.ts +1 -0
  60. package/dist/application-spec/generate-application/code/templates/global-definition/index.js +1 -1
  61. package/dist/application-spec/generate-application/code/templates/globals.js +24 -44
  62. package/dist/application-spec/generate-application/code/templates/index.d.ts +3 -3
  63. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  64. package/dist/application-spec/generate-application/code/templates/lingui-rc.d.ts +5 -0
  65. package/dist/application-spec/generate-application/code/templates/lingui-rc.js +4 -4
  66. package/dist/application-spec/generate-application/code/templates/prettier-config.d.ts +5 -0
  67. package/dist/application-spec/generate-application/code/templates/prettier-config.js +4 -5
  68. package/dist/application-spec/generate-application/code/templates/root-tsconfig.d.ts +6 -0
  69. package/dist/application-spec/generate-application/code/templates/root-tsconfig.js +2 -0
  70. package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
  71. package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +1 -1
  72. package/dist/application-spec/generate-application/code/templates/skills/phoenix-feedback-skill.js +5 -5
  73. package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +3 -3
  74. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
  75. package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.js +2 -2
  76. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +24 -7
  77. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
  78. package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.d.ts +58 -0
  79. package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.js +1 -0
  80. package/dist/application-spec/generate-application/code/templates/spec-code/index.d.ts +2 -0
  81. package/dist/application-spec/generate-application/code/templates/spec-code/index.js +1 -0
  82. package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.d.ts +18 -0
  83. package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.js +41 -0
  84. package/dist/application-spec/generate-application/code/templates/spec-messages/index.d.ts +1 -0
  85. package/dist/application-spec/generate-application/code/templates/spec-messages/index.js +1 -0
  86. package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.d.ts +20 -0
  87. package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.js +6 -0
  88. package/dist/application-spec/generate-application/code/templates/story/phx-module.d.ts +8 -2
  89. package/dist/application-spec/generate-application/code/templates/story/phx-module.js +15 -3
  90. package/dist/application-spec/generate-application/code/templates/story/wrapper.d.ts +3 -0
  91. package/dist/application-spec/generate-application/code/templates/story/wrapper.js +2 -1
  92. package/dist/application-spec/generate-application/code/templates/tsconfig.d.ts +5 -0
  93. package/dist/application-spec/generate-application/code/templates/tsconfig.js +1 -1
  94. package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +6 -1
  95. package/dist/application-spec/generate-application/code/templates/webhook-index.js +10 -1
  96. package/dist/application-spec/generate-application/code/templates/webhooks-config.js +2 -3
  97. package/dist/application-spec/generate-application/index.d.ts +2 -0
  98. package/dist/application-spec/generate-application/index.js +1 -1
  99. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +6 -4
  100. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.js +1 -1
  101. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +8 -3
  102. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
  103. package/dist/application-spec/generate-application/runtime/admin-runtime/states-runtime.d.ts +2 -2
  104. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +19 -5
  105. package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
  106. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +6 -4
  107. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.js +1 -1
  108. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +7 -2
  109. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
  110. package/dist/application-spec/generate-application/runtime/configurator-runtime/states-runtime.d.ts +2 -2
  111. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.d.ts +43 -0
  112. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.js +1 -0
  113. package/dist/application-spec/generate-application/runtime/factory-data/index.d.ts +3 -0
  114. package/dist/application-spec/generate-application/runtime/factory-data/index.js +1 -0
  115. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.d.ts +13 -0
  116. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.js +1 -0
  117. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts +16 -0
  118. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js +1 -0
  119. package/dist/application-spec/generate-application/runtime/migrations/index.d.ts +1 -0
  120. package/dist/application-spec/generate-application/runtime/migrations/index.js +1 -0
  121. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.d.ts +53 -0
  122. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.js +1 -0
  123. package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +2 -2
  124. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.d.ts +2 -1
  125. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
  126. package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.d.ts +2 -1
  127. package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.js +1 -1
  128. package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +3 -0
  129. package/dist/application-spec/generate-application/runtime/sections/component-optic.js +1 -1
  130. package/dist/application-spec/generate-application/runtime/sections/data-runtime.d.ts +4 -4
  131. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +7 -4
  132. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  133. package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.d.ts +9 -5
  134. package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.js +1 -1
  135. package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.d.ts +3 -1
  136. package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.js +1 -1
  137. package/dist/application-spec/generate-application/runtime/sections/theme-runtime.d.ts +2 -2
  138. package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +3 -3
  139. package/dist/application-spec/generate-application/runtime/spec-code/index.d.ts +2 -0
  140. package/dist/application-spec/generate-application/runtime/spec-code/index.js +1 -0
  141. package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.d.ts +18 -0
  142. package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.js +1 -0
  143. package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.d.ts +17 -0
  144. package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.js +1 -0
  145. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.d.ts +9 -0
  146. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.js +1 -0
  147. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.d.ts +8 -0
  148. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.js +1 -0
  149. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +27 -0
  150. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.js +1 -0
  151. package/dist/application-spec/generate-application/runtime-spec/index.d.ts +5 -0
  152. package/dist/application-spec/generate-application/runtime-spec/index.js +1 -0
  153. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +68 -0
  154. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -0
  155. package/dist/application-spec/generate-application/runtime-spec/spec-code-id.d.ts +40 -0
  156. package/dist/application-spec/generate-application/runtime-spec/spec-code-id.js +1 -0
  157. package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +34 -0
  158. package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
  159. package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.d.ts +16 -0
  160. package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.js +9 -0
  161. package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.d.ts +9 -0
  162. package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.js +1 -0
  163. package/dist/application-spec/parse-application-files/raw-spec/parse-yaml-spec-file.js +1 -1
  164. package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
  165. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  166. package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
  167. package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
  168. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.d.ts +3 -0
  169. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.js +1 -0
  170. package/dist/application-spec/parse-application-files/spec/common/value-type/index.d.ts +5 -0
  171. package/dist/application-spec/parse-application-files/spec/common/value-type/index.js +1 -0
  172. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.d.ts +6 -0
  173. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.js +1 -0
  174. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.d.ts +8 -0
  175. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.js +1 -0
  176. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.d.ts +10 -0
  177. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.js +1 -0
  178. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.d.ts +98 -0
  179. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.js +1 -0
  180. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.d.ts +13 -0
  181. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.js +1 -0
  182. package/dist/application-spec/parse-application-files/spec/components/bindings/index.d.ts +2 -0
  183. package/dist/application-spec/parse-application-files/spec/components/bindings/index.js +1 -1
  184. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.d.ts +24 -0
  185. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.js +1 -0
  186. package/dist/application-spec/parse-application-files/spec/components/component-state-type.d.ts +8 -0
  187. package/dist/application-spec/parse-application-files/spec/components/component-state-type.js +1 -0
  188. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.d.ts +13 -0
  189. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.js +1 -0
  190. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.d.ts +14 -0
  191. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.js +1 -0
  192. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.d.ts +6 -0
  193. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.js +1 -1
  194. package/dist/application-spec/parse-application-files/spec/components/user-components.d.ts +7 -4
  195. package/dist/application-spec/parse-application-files/spec/components/user-components.js +1 -1
  196. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.d.ts +24 -0
  197. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.js +1 -0
  198. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.d.ts +13 -0
  199. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.js +1 -0
  200. package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.d.ts +9 -0
  201. package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.js +1 -0
  202. package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +6 -2
  203. package/dist/application-spec/parse-application-files/spec/expressions/expressions.js +1 -1
  204. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.d.ts +3 -1
  205. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.js +1 -1
  206. package/dist/application-spec/parse-application-files/spec/invariants/invariants.d.ts +2 -2
  207. package/dist/application-spec/parse-application-files/spec/invariants/invariants.js +1 -1
  208. package/dist/application-spec/parse-application-files/spec/model/index.d.ts +1 -0
  209. package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
  210. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.d.ts +10 -0
  211. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.js +1 -0
  212. package/dist/client/phoenix-api.d.ts +367 -0
  213. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +36 -1
  214. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  215. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +7 -1
  216. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  217. package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.d.ts +12 -0
  218. package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.js +1 -0
  219. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +7 -1
  220. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  221. package/dist/configurator/common/configurator-interface.d.ts +21 -1
  222. package/dist/configurator/common/configurator-interface.js +1 -1
  223. package/dist/configurator/common/index.d.ts +3 -1
  224. package/dist/configurator/common/index.js +1 -1
  225. package/dist/configurator/common/use-finalize-action.d.ts +31 -0
  226. package/dist/configurator/common/use-finalize-action.js +1 -0
  227. package/dist/configurator/common/use-reset-camera.d.ts +6 -0
  228. package/dist/configurator/common/use-reset-camera.js +1 -0
  229. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +12 -0
  230. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -0
  231. package/dist/configurator/configuration-not-found-page/index.d.ts +1 -0
  232. package/dist/configurator/configuration-not-found-page/index.js +1 -0
  233. package/dist/configurator/configurator-context/PresetSelectionProvider.js +1 -1
  234. package/dist/configurator/pages/ConfiguratorNotFoundPage.js +1 -1
  235. package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +3 -2
  236. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  237. package/dist/configurator/pages/RootPage.js +1 -1
  238. package/dist/configurator/pages/configurator-layout-name.d.ts +2 -0
  239. package/dist/configurator/pages/configurator-layout-name.js +1 -0
  240. package/dist/configurator/pages/default-configurator-elements.d.ts +9 -0
  241. package/dist/configurator/pages/default-configurator-elements.js +1 -0
  242. package/dist/configurator/pages/default-elements/built-in-entity-element.d.ts +10 -0
  243. package/dist/configurator/pages/default-elements/built-in-entity-element.js +1 -0
  244. package/dist/configurator/pages/default-elements/built-in-layout-element.d.ts +10 -0
  245. package/dist/configurator/pages/default-elements/built-in-layout-element.js +1 -0
  246. package/dist/configurator/pages/default-elements/domain-control-elements.d.ts +6 -0
  247. package/dist/configurator/pages/default-elements/domain-control-elements.js +1 -0
  248. package/dist/configurator/pages/default-elements/index.d.ts +4 -0
  249. package/dist/configurator/pages/default-elements/index.js +1 -0
  250. package/dist/configurator/pages/default-elements/recipe-panel-elements.d.ts +3 -0
  251. package/dist/configurator/pages/default-elements/recipe-panel-elements.js +1 -0
  252. package/dist/configurator/pages/default-elements/sidebar-footer-elements.d.ts +7 -0
  253. package/dist/configurator/pages/default-elements/sidebar-footer-elements.js +1 -0
  254. package/dist/configurator/pages/default-elements/toolbar-elements.d.ts +7 -0
  255. package/dist/configurator/pages/default-elements/toolbar-elements.js +1 -0
  256. package/dist/configurator/pages/index.d.ts +1 -0
  257. package/dist/configurator/pages/index.js +1 -1
  258. package/dist/configurator/scene/scene-controls/DeleteEntityFab.js +1 -1
  259. package/dist/configurator/scene/scene-controls/SelectionHotspot.js +1 -1
  260. package/dist/configurator/ui/assistant/AssistantChips.d.ts +8 -2
  261. package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
  262. package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +7 -2
  263. package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
  264. package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
  265. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  266. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +1 -1
  267. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -1
  268. package/dist/configurator/ui/assistant/entity-link/entity-link-state.d.ts +1 -1
  269. package/dist/configurator/ui/assistant/entity-link/index.d.ts +0 -1
  270. package/dist/configurator/ui/assistant/entity-link/index.js +1 -1
  271. package/dist/configurator/ui/assistant/form/AssistantForm.d.ts +19 -0
  272. package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -0
  273. package/dist/configurator/ui/assistant/form/built-in-form-registry.d.ts +10 -0
  274. package/dist/configurator/ui/assistant/form/built-in-form-registry.js +1 -0
  275. package/dist/configurator/ui/assistant/form/compose-answer.d.ts +11 -0
  276. package/dist/configurator/ui/assistant/form/compose-answer.js +1 -0
  277. package/dist/configurator/ui/assistant/form/describe-build-errors.d.ts +6 -0
  278. package/dist/configurator/ui/assistant/form/describe-build-errors.js +1 -0
  279. package/dist/configurator/ui/assistant/form/form-element-definition.d.ts +14 -0
  280. package/dist/configurator/ui/assistant/form/form-element-definition.js +1 -0
  281. package/dist/configurator/ui/assistant/form/form-model.d.ts +38 -0
  282. package/dist/configurator/ui/assistant/form/form-model.js +1 -0
  283. package/dist/configurator/ui/assistant/form/form-registry.d.ts +31 -0
  284. package/dist/configurator/ui/assistant/form/form-registry.js +8 -0
  285. package/dist/configurator/ui/assistant/form/form-state.d.ts +4 -0
  286. package/dist/configurator/ui/assistant/form/form-state.js +1 -0
  287. package/dist/configurator/ui/assistant/form/index.d.ts +2 -0
  288. package/dist/configurator/ui/assistant/form/index.js +1 -0
  289. package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +9 -0
  290. package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -0
  291. package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +13 -0
  292. package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -0
  293. package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +3 -0
  294. package/dist/configurator/ui/assistant/form-elements/FormGroup.js +1 -0
  295. package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +3 -0
  296. package/dist/configurator/ui/assistant/form-elements/FormOptions.js +1 -0
  297. package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +3 -0
  298. package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -0
  299. package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +3 -0
  300. package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -0
  301. package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +34 -0
  302. package/dist/configurator/ui/assistant/form-elements/form-element-props.js +1 -0
  303. package/dist/configurator/ui/assistant/form-elements/index.d.ts +5 -0
  304. package/dist/configurator/ui/assistant/form-elements/index.js +1 -0
  305. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.d.ts +16 -0
  306. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.js +1 -0
  307. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.d.ts +34 -0
  308. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.js +1 -0
  309. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.d.ts +25 -0
  310. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.js +1 -0
  311. package/dist/configurator/ui/assistant/reference-link/index.d.ts +3 -0
  312. package/dist/configurator/ui/assistant/reference-link/index.js +1 -0
  313. package/dist/configurator/ui/assistant/reference-link/reference-styles.d.ts +12 -0
  314. package/dist/configurator/ui/assistant/reference-link/reference-styles.js +1 -0
  315. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.d.ts +8 -0
  316. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.js +1 -0
  317. package/dist/configurator/ui/assistant/resource-image/AssistantImage.d.ts +9 -0
  318. package/dist/configurator/ui/assistant/resource-image/AssistantImage.js +1 -0
  319. package/dist/configurator/ui/assistant/resource-image/index.d.ts +3 -0
  320. package/dist/configurator/ui/assistant/resource-image/index.js +1 -0
  321. package/dist/configurator/ui/assistant/resource-image/resource-path.d.ts +11 -0
  322. package/dist/configurator/ui/assistant/resource-image/resource-path.js +1 -0
  323. package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.d.ts +5 -0
  324. package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.js +1 -0
  325. package/dist/configurator/ui/assistant/streamed-markdown.d.ts +2 -0
  326. package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
  327. package/dist/configurator/ui/assistant/thread-items.d.ts +8 -1
  328. package/dist/configurator/ui/assistant/thread-items.js +1 -1
  329. package/dist/configurator/ui/assistant/use-follow-stream.js +1 -1
  330. package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.js +1 -1
  331. package/dist/configurator/ui/configurator-layout/slots/services/Services.js +1 -1
  332. package/dist/configurator/ui/legacy/layout/common/CommonFinalizeButton.js +1 -1
  333. package/dist/configurator/ui/legacy/layout/common/CommonSummaryButton.js +1 -1
  334. package/dist/configurator/ui/legacy/layout/common/CommonTopNavigation.js +1 -1
  335. package/dist/configurator/ui/legacy/layout/common/ResponsiveFinalizeButton.js +1 -1
  336. package/dist/configurator/ui/legacy/layout/common/SummaryReadLayout.js +1 -1
  337. package/dist/configurator/ui/legacy/layout/simple/SimpleOwnerLayout.js +1 -1
  338. package/dist/configurator/ui/legacy/layout/simple/SimpleTopNavigation.js +1 -1
  339. package/dist/configurator/ui/legacy/layout/steps/StepsNavigation.js +1 -1
  340. package/dist/configurator/ui/legacy/layout/steps/StepsOwnerLayout.js +1 -1
  341. package/dist/configurator/ui/legacy/layout/steps/StepsSidebarFooter.js +1 -1
  342. package/dist/configurator/ui/legacy/layout/tabs/TabsOwnerLayout.js +1 -1
  343. package/dist/configurator/ui/legacy/toolbar/common/DimensionUnitSelector.js +1 -1
  344. package/dist/configurator/ui/legacy/toolbar/common/MeasurementsIndicatorsSwitch.js +1 -1
  345. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/FullscreenToolbarAction.js +1 -1
  346. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/HelpToolbarAction.js +1 -1
  347. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/MeasurementsToolbarAction.js +1 -1
  348. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/UndoRedoToolbarGroup.js +1 -1
  349. package/dist/configurator/ui/phoenix-layout-elements/EnterFullscreenToolbarButton.js +1 -1
  350. package/dist/configurator/ui/phoenix-layout-elements/ExitFullscreenToolbarButton.js +1 -1
  351. package/dist/configurator/ui/phoenix-layout-elements/HelpToolbarButton.js +1 -1
  352. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.d.ts +1 -0
  353. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.js +1 -1
  354. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.d.ts +1 -0
  355. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.js +1 -1
  356. package/dist/configurator/ui/phoenix-layout-elements/MeasurementsToolbarButton.js +1 -1
  357. package/dist/configurator/ui/phoenix-layout-elements/RedoToolbarButton.js +1 -1
  358. package/dist/configurator/ui/phoenix-layout-elements/UndoToolbarButton.js +1 -1
  359. package/dist/configurator/ui/phoenix-layout-elements/header/common/back-button/use-go-back-action.js +1 -1
  360. package/dist/configurator/ui/phoenix-layout-elements/header/common/horizontal-tabs/DesktopHorizontalTabs.js +1 -1
  361. package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.js +1 -1
  362. package/dist/configurator/ui/phoenix-layout-elements/measurements/DimensionUnitSelector.js +1 -1
  363. package/dist/configurator/ui/phoenix-layout-elements/measurements/MeasurementsIndicatorsSwitch.js +1 -1
  364. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/basic/BasicFinalizeButton.js +1 -1
  365. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/CustomFinalizeButton.js +1 -1
  366. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/EnterSummaryButton.js +1 -1
  367. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/NextStepButton.js +1 -1
  368. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/PreviousStepButton.js +1 -1
  369. package/dist/configurator/ui/preset-layout/CategoryPresetUi.js +1 -1
  370. package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.d.ts +10 -0
  371. package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -0
  372. package/dist/configurator/ui/save-message-snackbars/index.d.ts +1 -0
  373. package/dist/configurator/ui/save-message-snackbars/index.js +1 -0
  374. package/dist/docs/controls/select-child-entity/cardselect.mdx +1 -0
  375. package/dist/docs/fabs/basic.mdx +2 -2
  376. package/dist/docs/index.json +1 -1
  377. package/dist/docs/layouts/custom-layout.mdx +1471 -200
  378. package/dist/docs/other-features/not-found-404.mdx +1 -1
  379. package/dist/docs/phoenix/clerk-sign-in.mdx +1 -1
  380. package/dist/docs/phoenix/components.mdx +6 -0
  381. package/dist/docs/phoenix/configurator-interface.mdx +99 -21
  382. package/dist/docs/phoenix/deployments.mdx +2 -6
  383. package/dist/docs/phoenix/domain-model.mdx +2 -0
  384. package/dist/docs/phoenix/finalization.mdx +1 -1
  385. package/dist/docs/phoenix/getting-started.mdx +6 -3
  386. package/dist/docs/phoenix/layout-slots.mdx +12 -10
  387. package/dist/docs/phoenix/localization.mdx +10 -6
  388. package/dist/docs/phoenix/migration-guide.mdx +24 -11
  389. package/dist/docs/phoenix/phoenix-cli.mdx +67 -20
  390. package/dist/docs/phoenix/project-structure.mdx +70 -33
  391. package/dist/docs/phoenix/quickstart.mdx +7 -7
  392. package/dist/docs/phoenix/sdk-builder-workflow.mdx +7 -7
  393. package/dist/docs/phoenix/testing.mdx +8 -0
  394. package/dist/docs/phoenix/webhooks.mdx +21 -4
  395. package/dist/domain/application/application-config.d.ts +3 -1
  396. package/dist/domain/application/assistant/assistant-form-elements.d.ts +28 -0
  397. package/dist/domain/application/assistant/assistant-form-elements.js +1 -0
  398. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  399. package/dist/domain/application/assistant/index.d.ts +2 -0
  400. package/dist/domain/application/assistant/index.js +1 -1
  401. package/dist/domain/application/assistant-recipe-groups.d.ts +3 -1
  402. package/dist/domain/application/configurator-builder.d.ts +4 -1
  403. package/dist/domain/application/configurator-builder.js +1 -1
  404. package/dist/domain/core/schema/extended-schema-validator.js +1 -1
  405. package/dist/domain/domain-context/index.d.ts +1 -1
  406. package/dist/domain/domain-context/undo-system.d.ts +28 -1
  407. package/dist/domain/domain-context/undo-system.js +1 -1
  408. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  409. package/dist/domain/domain-runtime/spec/module-checks/element-registration.d.ts +12 -11
  410. package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -1
  411. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -1
  412. package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
  413. package/dist/domain/domain-runtime/spec/selectors.js +1 -1
  414. package/dist/domain/domain-runtime/spec/types.d.ts +2 -0
  415. package/dist/domain/system-components/child-entity-selection.js +1 -1
  416. package/dist/domain/system-components/common/scene-entity-control-schema.d.ts +3 -0
  417. package/dist/domain/system-components/common/scene-entity-control-schema.js +1 -1
  418. package/dist/editor/Editor.d.ts +7 -0
  419. package/dist/editor/Editor.js +1 -1
  420. package/dist/editor/mocks/CreateMockYaml.js +2 -2
  421. package/dist/editor/mocks/EditorMockContext.d.ts +2 -0
  422. package/dist/editor/mocks/EditorMockContext.js +1 -1
  423. package/dist/globals/index.d.ts +2 -0
  424. package/dist/i18n/locales/cs/messages.js +1 -1
  425. package/dist/i18n/locales/da/messages.js +1 -1
  426. package/dist/i18n/locales/de/messages.js +1 -1
  427. package/dist/i18n/locales/de-AT/messages.js +1 -1
  428. package/dist/i18n/locales/en/messages.js +1 -1
  429. package/dist/i18n/locales/en-AU/messages.js +1 -1
  430. package/dist/i18n/locales/en-GB/messages.js +1 -1
  431. package/dist/i18n/locales/es/messages.js +1 -1
  432. package/dist/i18n/locales/fr/messages.js +1 -1
  433. package/dist/i18n/locales/hu/messages.js +1 -1
  434. package/dist/i18n/locales/it/messages.js +1 -1
  435. package/dist/i18n/locales/nl/messages.js +1 -1
  436. package/dist/i18n/locales/pl/messages.js +1 -1
  437. package/dist/i18n/locales/pt/messages.js +1 -1
  438. package/dist/i18n/locales/ro/messages.js +1 -1
  439. package/dist/i18n/locales/sk/messages.js +1 -1
  440. package/dist/i18n/locales/tr/messages.js +1 -1
  441. package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
  442. package/dist/legacy/domain-cli/utils/cache.js +1 -1
  443. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +79 -80
  444. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
  445. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
  446. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
  447. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +7 -2
  448. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +15 -14
  449. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-configurator.js +14 -12
  450. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +14 -13
  451. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-configurator.js +13 -11
  452. package/dist/phoenix/application-spec/application-spec-builder.d.ts +0 -2
  453. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  454. package/dist/phoenix/application-spec/generate-application-spec-project.d.ts +0 -2
  455. package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
  456. package/dist/phoenix/application-spec/generate-application-spec-story.js +2 -2
  457. package/dist/phoenix/application-spec/generate-project-files.d.ts +0 -2
  458. package/dist/phoenix/application-spec/project-files.js +1 -1
  459. package/dist/phoenix/bin.d.ts +2 -0
  460. package/dist/phoenix/bin.js +2 -0
  461. package/dist/phoenix/check-configs/built-in-eslint-config.d.ts +9 -0
  462. package/dist/phoenix/check-configs/built-in-eslint-config.js +1 -0
  463. package/dist/phoenix/check-configs/eslint-config.d.ts +10 -0
  464. package/dist/phoenix/check-configs/eslint-config.js +1 -0
  465. package/dist/phoenix/check-configs/index.d.ts +8 -0
  466. package/dist/phoenix/check-configs/index.js +1 -0
  467. package/dist/phoenix/check-configs/typescript-project.d.ts +5 -0
  468. package/dist/phoenix/check-configs/typescript-project.js +1 -0
  469. package/dist/phoenix/cli.d.ts +0 -1
  470. package/dist/phoenix/cli.js +1 -2
  471. package/dist/phoenix/commands/build.js +1 -1
  472. package/dist/phoenix/commands/check.js +1 -1
  473. package/dist/phoenix/commands/clean.js +1 -1
  474. package/dist/phoenix/commands/deploy.js +2 -2
  475. package/dist/phoenix/commands/deps/deps.d.ts +73 -0
  476. package/dist/phoenix/commands/deps/deps.js +3 -0
  477. package/dist/phoenix/commands/deps/index.d.ts +1 -0
  478. package/dist/phoenix/commands/deps/index.js +1 -0
  479. package/dist/phoenix/commands/deps/sdk-manifest.d.ts +12 -0
  480. package/dist/phoenix/commands/deps/sdk-manifest.js +1 -0
  481. package/dist/phoenix/commands/dev.js +5 -5
  482. package/dist/phoenix/commands/fix.js +1 -1
  483. package/dist/phoenix/commands/index.d.ts +1 -0
  484. package/dist/phoenix/commands/index.js +1 -1
  485. package/dist/phoenix/commands/init.d.ts +17 -5
  486. package/dist/phoenix/commands/init.js +1 -1
  487. package/dist/phoenix/commands/link.js +1 -1
  488. package/dist/phoenix/commands/prettier.js +1 -1
  489. package/dist/phoenix/commands/sync.js +1 -1
  490. package/dist/phoenix/commands/unlink.js +1 -1
  491. package/dist/phoenix/services/application-spec-project-watcher.d.ts +2 -2
  492. package/dist/phoenix/services/application-spec-project-watcher.js +3 -3
  493. package/dist/phoenix/services/lingui.d.ts +8 -0
  494. package/dist/phoenix/services/lingui.js +1 -1
  495. package/dist/phoenix/services/swc.js +1 -1
  496. package/dist/phoenix/services/vite-config.js +1 -1
  497. package/dist/phoenix/utils/index.d.ts +4 -2
  498. package/dist/phoenix/utils/index.js +1 -1
  499. package/dist/phoenix/utils/node-version/index.d.ts +1 -0
  500. package/dist/phoenix/utils/node-version/index.js +1 -0
  501. package/dist/phoenix/utils/node-version/supported-node-version.d.ts +12 -0
  502. package/dist/phoenix/utils/node-version/supported-node-version.js +4 -0
  503. package/dist/phoenix/utils/package-info.d.ts +0 -9
  504. package/dist/phoenix/utils/package-info.js +1 -1
  505. package/dist/phoenix/utils/package-manager/index.d.ts +2 -0
  506. package/dist/phoenix/utils/package-manager/index.js +1 -0
  507. package/dist/phoenix/utils/package-manager/package-manager-commands.d.ts +19 -0
  508. package/dist/phoenix/utils/package-manager/package-manager-commands.js +1 -0
  509. package/dist/phoenix/utils/package-manager/pnpm-project.d.ts +9 -0
  510. package/dist/phoenix/utils/package-manager/pnpm-project.js +1 -0
  511. package/dist/phoenix/utils/run-command.d.ts +11 -0
  512. package/dist/phoenix/utils/run-command.js +1 -1
  513. package/dist/phoenix/utils/sdk-tool/index.d.ts +1 -0
  514. package/dist/phoenix/utils/sdk-tool/index.js +1 -0
  515. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.d.ts +15 -0
  516. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.js +1 -0
  517. package/dist/react-sdk/application-runtime/common-services/analytics/index.d.ts +1 -0
  518. package/dist/react-sdk/application-runtime/common-services/analytics/index.js +1 -1
  519. package/dist/react-sdk/domain-application-context/DomainLifecycleBoundary.js +1 -1
  520. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.d.ts +15 -4
  521. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.js +1 -1
  522. package/dist/react-sdk/domain-context/index.d.ts +2 -1
  523. package/dist/react-sdk/domain-context/index.js +1 -1
  524. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +5 -0
  525. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
  526. package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.d.ts +20 -0
  527. package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.js +1 -0
  528. package/dist/ui-sdk/theme/types.d.ts +1 -1
  529. package/package.json +46 -35
  530. package/schema/domain-spec.json +86 -8
  531. package/dist/application-spec/generate-application/code/templates/nvmrc.d.ts +0 -1
  532. package/dist/application-spec/generate-application/code/templates/nvmrc.js +0 -2
  533. package/dist/application-spec/generate-application/code/templates/package-json.d.ts +0 -10
  534. package/dist/application-spec/generate-application/code/templates/package-json.js +0 -1
  535. package/dist/application-spec/generate-application/code/templates/webhook-implementation.d.ts +0 -1
  536. package/dist/application-spec/generate-application/code/templates/webhook-implementation.js +0 -7
  537. package/dist/configurator/ui/assistant/entity-link/entity-link-target.d.ts +0 -5
  538. package/dist/configurator/ui/assistant/entity-link/entity-link-target.js +0 -1
  539. package/dist/phoenix/commands/generate-project-files.d.ts +0 -6
  540. package/dist/phoenix/commands/generate-project-files.js +0 -1
  541. /package/dist/{configurator/common → react-sdk/application-runtime/common-services/analytics}/frontend-analytics.d.ts +0 -0
  542. /package/dist/{configurator/common → react-sdk/application-runtime/common-services/analytics}/frontend-analytics.js +0 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * What an element of an assistant form collects: a `group` all its children, a `choice` exactly one
3
+ * of its options, a `choices` any number of them; an `option` is something to pick and an `input` a
4
+ * free value.
5
+ */
6
+ export type AssistantFormRole = 'group' | 'choice' | 'choices' | 'option' | 'input';
7
+ /** The type an attribute of a form element is validated and coerced to; the model writes every attribute as a string. */
8
+ export interface AssistantFormAttribute {
9
+ readonly type: 'string' | 'number' | 'integer' | 'boolean';
10
+ readonly enum?: readonly string[];
11
+ }
12
+ /**
13
+ * An element the assistant can write inside a ```` ```form ```` fence of its reply to ask the user
14
+ * something. The panel renders it, and the SDK prompt lists it, so the model and the panel agree on
15
+ * one set of elements.
16
+ */
17
+ export interface AssistantFormElementDescriptor {
18
+ /** The tag: lowercase, and never the name of an HTML element. */
19
+ readonly name: string;
20
+ readonly role: AssistantFormRole;
21
+ /** What the element is for, printed in the prompt after its signature. */
22
+ readonly description: string;
23
+ /** Attributes beyond the built-in `label` and, on an option or an input, `value`. */
24
+ readonly attributes: Readonly<Record<string, AssistantFormAttribute>>;
25
+ readonly required?: readonly string[];
26
+ }
27
+ /** The elements every assistant form understands, in the order the prompt lists them. */
28
+ export declare const ASSISTANT_BUILT_IN_FORM_ELEMENTS: readonly AssistantFormElementDescriptor[];
@@ -0,0 +1 @@
1
+ export const ASSISTANT_BUILT_IN_FORM_ELEMENTS=[{name:"group",role:"group",description:"Puts related questions together under its label.",attributes:{}},{name:"choice",role:"choice",description:"The user picks exactly one of its options.",attributes:{}},{name:"choices",role:"choices",description:"The user picks any number of its options.",attributes:{}},{name:"reply",role:"option",description:"A short answer shown as a button.",attributes:{}},{name:"text",role:"input",description:"A single line the user types.",attributes:{placeholder:{type:"string"}}}];
@@ -1 +1 @@
1
- export const generateAssistantPrompt=e=>{let t=Object.values(e.childRecipes??{}).some(e=>e.length>0),a=Object.values(e.replaceRecipes??{}).some(e=>e.length>0),n=Object.values(e.fieldOptions??{}).some(e=>e.length>0),s=Object.keys(e.actions??{}).length>0,i=(e.deletableTypes?.length??0)>0||Object.values(e.writableFields??{}).some(e=>Object.keys(e).length>0)||t||a||s,o=t||a||n,r=[...t?["`childRecipes` is what can be added to it"]:[],...a?["`replaceRecipes` what it can be replaced with"]:[],...n?["`<field>Options` the values a field accepts"]:[]],h=["`selected`",...(e.navigationFields??[]).map(e=>`\`${e}\``)].join(", ");return[["Tools","- Put related operations in one call and select only the fields you need.",...i?[`- Use a mutation inside \`query\` to answer a what-if about a change ${o?"the lists under `meta` do not show":"before making it"}.`,"- Use `apply` only for what the user asked for."]:["- Nothing in this configurator can be changed through you. Say so when the user asks for a change."],"- When an operation fails, its `errors` say why and what to send instead."],...i?[["After a change","- A change is made only when the `apply` result has `committed: true`. Otherwise `errors` or `message` says what happened; without either, nothing changed. Never say a change was made when it was not.","- `sideEffects` names the major or unexpected things the configurator changed along with your change. Tell the user about them when committed; otherwise they describe what would happen. Smaller adjustments are not listed.","- A mutation returns the state after the change: use the ids and values it returned, not the ones you sent.",...s?["- When one mutation does the whole of what the user asked, use it instead of building the same change from several others."]:[]]]:[],...o?[["What can be done to an entity",`- \`meta\` lists what is possible right now: ${r.join(", ")}. Read the list before such a change and before telling the user what is available.`,`- You can select \`dryRun\` on ${[...t||a?["recipes"]:[],...n?["options"]:[]].join(" or ")} to look ahead and pick one that meets what the user asked for. It is optional before a change.`,"- Read the lists again after a change, unless their descriptions say they stay the same."]]:[],["The `[changes]` block","- Every user message starts with it: a glimpse of what the user did in the configurator since your last turn.",`- \`[changes: none]\`, or only ${h} lines: what you know still holds. Do not query it again.`,"- Other lines are a hint at what to read again: `A` added, `D` deleted, `M` modified with the fields. Text after `#` says what caused the line; `reset: undo/redo` says the user undid or redid changes.","- Read computed fields again when a listed change may affect them.","- `[changes: unavailable]` and `[changes: too many (n)]`: read again before relying on anything you read earlier.",...i?["- Your applied changes are not listed, except those waiting for user approval: they appear once approved."]:[]],["Reading the schema","- Take ids from results.",...(e.deletableTypes?.length??0)>0||a?["- The id of a deleted or replaced entity is gone and may later be given to another entity."]:[],`- A field whose name starts with \`_\` is computed: read it${i?", never write it":""}.`,"- Numbers are in the unit the field description names. Convert when the user uses another unit."],["Entity links","- When you name an entity the user may want to find, write it as a Markdown link whose target is `entity:` and its id: `[the corner cabinet](entity:<id>)`. The user sees only the text; the id is never shown.","- Link only entities that exist in the configuration now, never one created only inside `query`."],...e.lenses?.declarations?[["Built-in fragments","- These fragments are already defined for every operation. Spread one by name on a field of its type, as in `field { ...FragmentName }`, instead of listing its fields.","- A fragment is a starting selection: add the other fields you need next to the spread, by name from the schema.","- Never define a fragment with one of these names.","",e.lenses.declarations]]:[]].map(e=>e.join("\n")).join("\n\n")};
1
+ import{ASSISTANT_BUILT_IN_FORM_ELEMENTS as e}from"./assistant-form-elements.js";let t=[["Containers",["group","choice","choices"]],["Options",["option"]],["Inputs",["input"]]];export const generateAssistantPrompt=a=>{let n=Object.values(a.childRecipes??{}).some(e=>e.length>0),s=Object.values(a.replaceRecipes??{}).some(e=>e.length>0),i=Object.values(a.fieldOptions??{}).some(e=>e.length>0),o=Object.keys(a.actions??{}).length>0,r=(a.deletableTypes?.length??0)>0||Object.values(a.writableFields??{}).some(e=>Object.keys(e).length>0)||n||s||o,h=n||s||i,l=[...n?["`childRecipes` is what can be added to it"]:[],...s?["`replaceRecipes` what it can be replaced with"]:[],...i?["`<field>Options` the values a field accepts"]:[]],d=["`selected`",...(a.navigationFields??[]).map(e=>`\`${e}\``)].join(", ");return[["Tools","- Put related operations in one call and select only the fields you need.",...r?[`- Use a mutation inside \`query\` to answer a what-if about a change ${h?"the lists under `meta` do not show":"before making it"}.`,"- Use `apply` only for what the user asked for."]:["- Nothing in this configurator can be changed through you. Say so when the user asks for a change."],"- When an operation fails, its `errors` say why and what to send instead."],...r?[["After a change","- A change is made only when the `apply` result has `committed: true`. Otherwise `errors` or `message` says what happened; without either, nothing changed. Never say a change was made when it was not.","- `sideEffects` names the major or unexpected things the configurator changed along with your change. Tell the user about them when committed; otherwise they describe what would happen. Smaller adjustments are not listed.","- A mutation returns the state after the change: use the ids and values it returned, not the ones you sent.",...o?["- When one mutation does the whole of what the user asked, use it instead of building the same change from several others."]:[]]]:[],...h?[["What can be done to an entity",`- \`meta\` lists what is possible right now: ${l.join(", ")}. Read the list before such a change and before telling the user what is available.`,`- You can select \`dryRun\` on ${[...n||s?["recipes"]:[],...i?["options"]:[]].join(" or ")} to look ahead and pick one that meets what the user asked for. It is optional before a change.`,"- Read the lists again after a change, unless their descriptions say they stay the same."]]:[],["The `[changes]` block","- Every user message starts with it: a glimpse of what the user did in the configurator since your last turn.",`- \`[changes: none]\`, or only ${d} lines: what you know still holds. Do not query it again.`,"- Other lines are a hint at what to read again: `A` added, `D` deleted, `M` modified with the fields. Text after `#` says what caused the line; `reset: undo/redo` says the user undid or redid changes.","- Read computed fields again when a listed change may affect them.","- `[changes: unavailable]` and `[changes: too many (n)]`: read again before relying on anything you read earlier.",...r?["- Your applied changes are not listed, except those waiting for user approval: they appear once approved."]:[]],["Reading the schema","- Take ids from results.",...(a.deletableTypes?.length??0)>0||s?["- The id of a deleted or replaced entity is gone and may later be given to another entity."]:[],`- A field whose name starts with \`_\` is computed: read it${r?", never write it":""}.`,"- Numbers are in the unit the field description names. Convert when the user uses another unit."],["Links","- You may link an entity of the current configuration when you speak about that very entity: `[the left burner](entity:CookingTop-1)`. It helps the user find it in the configurator.",...h?["- Whenever you name recipes or options you read from `meta`, in a list, a table or a sentence, link each one: `[Single gas burner](recipe:KitchenRange-1/top/gas_single)` or `[Oak](option:Cabinet-2/finishOptions/oak)`. The link shows the user its picture or color and its description, so never draw previews yourself. The target is the entity id, the recipe group id or the options field you read, and the key or value, each encoded as in a URL."]:[]],["Replies","- Write Markdown only, never HTML: the panel does not render it.","- An image, `![alt](path)`, is shown only when its path is relative."],["Forms","- To ask the user something they answer by picking or typing, end your reply with a form: a fenced code block with the language `form`. It holds only elements, written as lowercase tags with string attributes, without Markdown or text.","- Every element takes `label`, the text the user sees; on a container or an input it also names the answer. Options and inputs take `value`: an option sends it instead of its label, and an input starts with it.","- Options can also stand on their own, outside a `choice` or `choices`.","- An element or attribute not listed here, or an element other than an option inside a `choice` or `choices`, makes the whole form fail.","- The answer is the user's next message. Each container or input gives a line `Label: value`, or the bare value without a label; the lines of a labelled container are indented by two spaces under it, a `choices` lists each picked option on its own line, and `—` marks what was left unanswered.",'- Example: `<choice label="Plinth"><reply label="Black" /><reply label="Oak" /></choice>` is answered with `Plinth: Oak`.',"- The chat shows the answer as the user's own message, so a `value` reads as natural words, never as an id, key or code. Give `value` only when the label alone would be unclear as an answer, and map the answer's labels back to ids yourself.",...t.flatMap(([t,a])=>{let n=e.filter(({role:e})=>a.includes(e));return 0===n.length?[]:[`- ${t}:`,...n.map(e=>` - \`${(({name:e,role:t,attributes:a})=>{let n=["label",..."option"===t||"input"===t?["value"]:[],...Object.keys(a)];return"option"===t||"input"===t?`<${e} ${n.join(" ")} />`:`<${e} ${n.join(" ")}>…</${e}>`})(e)}\`: ${e.description}`)]})],...a.lenses?.declarations?[["Built-in fragments","- These fragments are already defined for every operation. Spread one by name on a field of its type, as in `field { ...FragmentName }`, instead of listing its fields.","- A fragment is a starting selection: add the other fields you need next to the spread, by name from the schema.","- Never define a fragment with one of these names.","",a.lenses.declarations]]:[]].map(e=>e.join("\n")).join("\n\n")};
@@ -7,3 +7,5 @@ export type { AssistantFieldSource, AssistantRecipeGroup, AssistantFieldOptions,
7
7
  export { generateAssistantPrompt } from './generate-assistant-prompt.js';
8
8
  export * from './session-setup/index.js';
9
9
  export { describeAssistantValues, mergeAssistantFields, resolveAssistantField } from './assistant-fields.js';
10
+ export { ASSISTANT_BUILT_IN_FORM_ELEMENTS } from './assistant-form-elements.js';
11
+ export type { AssistantFormAttribute, AssistantFormElementDescriptor, AssistantFormRole, } from './assistant-form-elements.js';
@@ -1 +1 @@
1
- export{ASSISTANT_HINTS}from"./assistant-resolved-manifest.js";export{buildAssistantManifest}from"./build-assistant-manifest.js";export{AssistantFieldClashError,createAssistantExecutionSchema}from"./create-assistant-execution-schema.js";export{generateAssistantPrompt}from"./generate-assistant-prompt.js";export*from"./session-setup/index.js";export{describeAssistantValues,mergeAssistantFields,resolveAssistantField}from"./assistant-fields.js";
1
+ export{ASSISTANT_HINTS}from"./assistant-resolved-manifest.js";export{buildAssistantManifest}from"./build-assistant-manifest.js";export{AssistantFieldClashError,createAssistantExecutionSchema}from"./create-assistant-execution-schema.js";export{generateAssistantPrompt}from"./generate-assistant-prompt.js";export*from"./session-setup/index.js";export{describeAssistantValues,mergeAssistantFields,resolveAssistantField}from"./assistant-fields.js";export{ASSISTANT_BUILT_IN_FORM_ELEMENTS}from"./assistant-form-elements.js";
@@ -41,6 +41,8 @@ export interface AssistantRecipeContext {
41
41
  /** Resolves a title in the current language, for the key of a recipe that declares none. */
42
42
  readonly resolveLocalizable: (message: Localizable) => string;
43
43
  }
44
+ /** What reading a recipe group needs: listing never cooks, so the panel can read a group without a cooker. */
45
+ type AssistantRecipeReadContext = Pick<AssistantRecipeContext, 'componentReader' | 'resolveLocalizable'>;
44
46
  /** One recipe of a group as the assistant addresses it: the list item and its key, unique within the group. */
45
47
  export interface AssistantRecipe {
46
48
  readonly key: string;
@@ -73,7 +75,7 @@ export declare const findAssistantRecipeGroups: (manifest: AssistantManifest, ki
73
75
  * assistant sees the groups the configurator's own controls would offer. A list item without recipes
74
76
  * adds nothing and is left out.
75
77
  */
76
- export declare const readAssistantRecipeGroup: (kind: AssistantRecipeKind, group: AssistantRecipeGroup, entityId: DomainEntityId<string>, state: AnyDomainState, context: AssistantRecipeContext) => AssistantRecipeGroupSnapshot | null;
78
+ export declare const readAssistantRecipeGroup: (kind: AssistantRecipeKind, group: AssistantRecipeGroup, entityId: DomainEntityId<string>, state: AnyDomainState, context: AssistantRecipeReadContext) => AssistantRecipeGroupSnapshot | null;
77
79
  /**
78
80
  * The updates of one recipe of a group for the entity `entityId`, computed from `state`: the same
79
81
  * updates, with the same tag, the configurator's own controls make. A recipe of a child group is
@@ -3,7 +3,7 @@ import type { ThemeOptions } from '@mui/material';
3
3
  import type { z } from 'zod';
4
4
  import type { FinalizeTaskResource } from '@salsita-ai/contracts/webhook';
5
5
  import { type $DomainEntity, type DomainEntity, type DomainFactory, type EnumLike, type ProductPreset, type SchemaOfObject } from '../core/index.js';
6
- import { type ProjectModule } from '../domain-runtime/index.js';
6
+ import { type ElementRegistration, type ProjectModule } from '../domain-runtime/index.js';
7
7
  import type { AclConfig, ApplicationConfig, DataSpec, DefaultEnvs, ResourcesConfig, SpecTransformer, TransformersConfig, UserInterfaceConfig } from './application-config.js';
8
8
  import { type AssistantResolvedManifest } from './assistant/index.js';
9
9
  interface ConfiguratorBuilderContext<ENTITIES extends DomainEntity<string> = never, ALLOWED_ROOT_ENTITIES extends ENTITIES = never, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>> = never, NAVIGATION_STATES extends string = never, VIEW_STATES extends string = never, TOOL_STATES extends string = never, EXPORT_STATES extends string = never, PUBLISHED_DATA extends Record<string, unknown> = never, SESSION_DATA extends Record<string, unknown> = never, FRONTEND_DATA extends Record<string, unknown> = never, ADMIN_ENTITIES extends DomainEntity<string> = never, ADMIN_ALLOWED_ROOT_ENTITIES extends ADMIN_ENTITIES = never, ADMIN_$MAP extends Record<ADMIN_ENTITIES['type'], $DomainEntity<ADMIN_ENTITIES>> = never, ADMIN_NAVIGATION_STATES extends string = never, ADMIN_VIEW_STATES extends string = never, FINALIZE_DATA extends Record<string, unknown> = never, PREFETCHED_FINALIZE_DATA extends Record<string, unknown> = never, FINALIZE_RESULT extends Record<string, unknown> = never, CALLBACK_DATA extends Record<string, unknown> = never, RESOURCE extends string = never> {
@@ -44,6 +44,7 @@ interface ConfiguratorBuilderContext<ENTITIES extends DomainEntity<string> = nev
44
44
  tagName?: string;
45
45
  handlers?: readonly ProjectModule[];
46
46
  elements?: readonly ProjectModule[];
47
+ defaultElements?: readonly ElementRegistration[];
47
48
  }
48
49
  export declare class ConfiguratorBuilder<ENTITIES extends DomainEntity<string> = never, ALLOWED_ROOT_ENTITIES extends ENTITIES = never, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>> = never, NAVIGATION_STATES extends string = never, VIEW_STATES extends string = never, TOOL_STATES extends string = never, EXPORT_STATES extends string = never, PUBLISHED_DATA extends Record<string, unknown> = never, SESSION_DATA extends Record<string, unknown> = never, FRONTEND_DATA extends Record<string, unknown> = never, ADMIN_ENTITIES extends DomainEntity<string> = never, ADMIN_ALLOWED_ROOT_ENTITIES extends ADMIN_ENTITIES = never, ADMIN_$MAP extends Record<ADMIN_ENTITIES['type'], $DomainEntity<ADMIN_ENTITIES>> = never, ADMIN_NAVIGATION_STATES extends string = never, ADMIN_VIEW_STATES extends string = never, FINALIZE_DATA extends Record<string, unknown> = never, PREFETCHED_FINALIZE_DATA extends Record<string, unknown> = never, FINALIZE_RESULT extends Record<string, unknown> = never, CALLBACK_DATA extends Record<string, unknown> = never, RESOURCE extends string = never> {
49
50
  private readonly _context;
@@ -87,6 +88,8 @@ export declare class ConfiguratorBuilder<ENTITIES extends DomainEntity<string> =
87
88
  withHandlers(handlers: readonly ProjectModule[]): ConfiguratorBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES, FINALIZE_DATA, PREFETCHED_FINALIZE_DATA, FINALIZE_RESULT, CALLBACK_DATA, RESOURCE>;
88
89
  /** Sets the elements as project modules, one per `src/elements/` file, for the runtime spec to validate. */
89
90
  withElements(elements: readonly ProjectModule[]): ConfiguratorBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES, FINALIZE_DATA, PREFETCHED_FINALIZE_DATA, FINALIZE_RESULT, CALLBACK_DATA, RESOURCE>;
91
+ /** Sets the SDK's default element registrations; a project element with the same name replaces one. */
92
+ withDefaultElements(defaultElements: readonly ElementRegistration[]): ConfiguratorBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES, FINALIZE_DATA, PREFETCHED_FINALIZE_DATA, FINALIZE_RESULT, CALLBACK_DATA, RESOURCE>;
90
93
  withResources<NEW_RESOURCE extends string>(resources: ReadonlyArray<FinalizeTaskResource<NEW_RESOURCE>>): ConfiguratorBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES, FINALIZE_DATA, PREFETCHED_FINALIZE_DATA, FINALIZE_RESULT, CALLBACK_DATA, NEW_RESOURCE>;
91
94
  withWebComponentTag(tagName: string): ConfiguratorBuilder<ENTITIES, ALLOWED_ROOT_ENTITIES, $MAP, NAVIGATION_STATES, VIEW_STATES, TOOL_STATES, EXPORT_STATES, PUBLISHED_DATA, SESSION_DATA, FRONTEND_DATA, ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP, ADMIN_NAVIGATION_STATES, ADMIN_VIEW_STATES, FINALIZE_DATA, PREFETCHED_FINALIZE_DATA, FINALIZE_RESULT, CALLBACK_DATA, RESOURCE>;
92
95
  /**
@@ -1 +1 @@
1
- import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{defaultI18n as e}from"#package/i18n";import{extendedSchemaValidator as i}from"../core/index.js";import{NoopAnalyticsSystem as r}from"../domain-context/index.js";import{createDomainRuntime as n}from"../domain-runtime/index.js";import{isGetApplicationWrapperHandler as o}from"./GetApplicationWrapperHandler.js";import{isGetWebComponentOptionsHandler as a}from"./GetWebComponentOptions.js";import{isAssistantSetupHandler as s}from"./assistant/index.js";import{createInitialPublishedData as l}from"./create-initial-published-data.js";import{isDataRowValidatorHandler as h}from"./published-data/DataRowValidatorHandler.js";import{isFilterPublishedChunksHandler as u}from"./published-data/FilterPublishedChunksHandler.js";import{isMapPublishedChunkedDataHandler as d}from"./published-data/MapPublishedChunkedDataHandler.js";import{isMapPublishedRevisionDataHandler as c}from"./published-data/MapPublishedRevisionDataHandler.js";import{isSheetValidatorHandler as f}from"./published-data/SheetValidatorHandler.js";export class ConfiguratorBuilder{_context;constructor(t){this._context=t}withDefaultEnvs(t){return new ConfiguratorBuilder({...this._context,defaultEnvs:t})}withVersion(t){return new ConfiguratorBuilder({...this._context,version:t})}withTextLanguages(t){return new ConfiguratorBuilder({...this._context,textLanguages:t})}withAcl(t){return new ConfiguratorBuilder({...this._context,acl:t})}withAdminRelease(t){return new ConfiguratorBuilder({...this._context,enableAdminRelease:t})}withUi(t){return new ConfiguratorBuilder({...this._context,ui:t})}withResourcesConfig(t){return new ConfiguratorBuilder({...this._context,resourcesConfig:t})}withChunks(t){return new ConfiguratorBuilder({...this._context,chunks:t})}withPublishedDataHash(t){return new ConfiguratorBuilder({...this._context,publishedDataHash:t})}withAssistant(t){return new ConfiguratorBuilder({...this._context,assistant:t})}withTheme(t){return new ConfiguratorBuilder({...this._context,theme:t})}withDomainFactory(t){return new ConfiguratorBuilder({...this._context,domainFactory:t})}withAdminDomainFactory(t){return new ConfiguratorBuilder({...this._context,adminDomainFactory:t})}withI18n=t=>new ConfiguratorBuilder({...this._context,i18n:t});withPrefetchedFinalizeData(t){return new ConfiguratorBuilder({...this._context,prefetchedFinalizeData:t})}withFinalizeData(t){return new ConfiguratorBuilder({...this._context,finalizeData:t})}withFinalizeResult(t){return new ConfiguratorBuilder({...this._context,finalizeResult:t})}withCallbackData(t){return new ConfiguratorBuilder({...this._context,callbackData:t})}withNavigationState(t){return new ConfiguratorBuilder({...this._context,navigationState:t})}withViewState(t){return new ConfiguratorBuilder({...this._context,viewState:t})}withToolState(t){return new ConfiguratorBuilder({...this._context,toolState:t})}withExportState(t){return new ConfiguratorBuilder({...this._context,exportState:t})}withAdminNavigationState(t){return new ConfiguratorBuilder({...this._context,adminNavigationState:t})}withAdminViewState(t){return new ConfiguratorBuilder({...this._context,adminViewState:t})}withPresets(t){return new ConfiguratorBuilder({...this._context,presets:t})}withAdminPresets(t){return new ConfiguratorBuilder({...this._context,adminPresets:t})}withComponentOptics(t){return new ConfiguratorBuilder({...this._context,componentOptics:[...this._context.componentOptics,...t]})}withAdminComponentOptics(t){return new ConfiguratorBuilder({...this._context,adminComponentOptics:[...this._context.adminComponentOptics??[],...t]})}withHandlers(t){return new ConfiguratorBuilder({...this._context,handlers:t})}withElements(t){return new ConfiguratorBuilder({...this._context,elements:t})}withResources(t){return new ConfiguratorBuilder({...this._context,resources:t})}withWebComponentTag(t){return new ConfiguratorBuilder({...this._context,tagName:t})}withTransformers(t,e){return new ConfiguratorBuilder({...this._context,transformers:{importedTransformers:t,specTransformers:e}})}withInterface(t){return this}withDataSpec=t=>new ConfiguratorBuilder({...this._context,dataSpec:t});_computeInitialPublishedData(t,e,i){if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");return l({adminDomainFactory:this._context.adminDomainFactory,domainRuntime:e,adminPresets:this._context.adminPresets??[],handlers:i,dataSpec:this._context.dataSpec,chunks:this._context.chunks,logger:t})}buildConfig(){return this._buildConfigWithHandlers().config}_buildConfigWithHandlers(){if(!this._context.domainFactory)throw Error("Can not create application config, domainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.presets)throw Error("Can not create application config, presets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminDomainFactory)throw Error("Can not create application config, adminDomainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminPresets)throw Error("Can not create application config, adminPresets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.version)throw Error("Can not create application config, version is required!");let i=this._context.tagName??"salsita-configurator",l={defaultEnvs:this._context.defaultEnvs,services:{i18n:this._context.i18n},version:this._context.version,initialPublishedData:{},domain:{textLanguages:this._context.textLanguages,componentOptics:this._context.componentOptics,presets:this._context.presets,domainFactory:this._context.domainFactory},navigation:{navigationStates:this._context.navigationState?.values(),viewStates:this._context.viewState?.values(),toolStates:this._context.toolState?.values(),exportStates:this._context.exportState?.values()},adminNavigation:{navigationStates:this._context.adminNavigationState?.values(),viewStates:this._context.adminViewState?.values()},adminDomain:{textLanguages:this._context.textLanguages,componentOptics:this._context.adminComponentOptics??[],presets:this._context.adminPresets,domainFactory:this._context.adminDomainFactory},mount:{tag:i,options:{}},handlers:this._context.handlers??[],elements:this._context.elements??[],transformers:this._context.transformers,features:{acl:this._context.acl,enableAdminRelease:this._context.enableAdminRelease},ui:{preview:this._context.ui?.preview,alwaysExpand:this._context.ui?.alwaysExpand,theme:this._context.theme},resources:this._context.resourcesConfig,chunks:this._context.chunks,publishedDataHash:this._context.publishedDataHash,assistant:this._context.assistant,dataSpec:this._context.dataSpec},d=t(),c=n({config:l,services:{analyticsService:new r,i18n:e,logger:d}}),m=c.getState().spec.configurator.handlers;if(m.filter(s).length>1)throw Error("Multiple createAssistantSetupHandler handlers found. Only one handler is allowed.");if(m.filter(t=>u(t)).length>1)throw Error("Multiple createFilterPublishedChunksHandler handlers found. Only one handler is allowed.");if(m.filter(t=>h(t)).length>1)throw Error("Multiple createDataRowValidatorHandler handlers found. Only one handler is allowed.");if(m.filter(t=>f(t)).length>1)throw Error("Multiple createSheetValidatorHandler handlers found. Only one handler is allowed.");let w=m.find(o)?.handler().handler,x=m.find(a)?.handler().handler(void 0),p=this._computeInitialPublishedData(d,c,m);return{config:{...l,mount:{tag:i,options:x??{},Application:w},initialPublishedData:p},handlers:m}}buildWebhookContext(){if(!this._context.domainFactory)throw Error("domainFactory is required!");if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");if(!this._context.adminPresets)throw Error("adminPresets are required!");let{config:t,handlers:e}=this._buildConfigWithHandlers(),r=t=>{if(null==this._context.finalizeData)return{};let e=i.compile(this._context.finalizeData);if(!e(t))throw console.error("Finalize data validation errors:",e.errors),Error("Invalid finalize data!");return t},n=t=>{if(null==this._context.finalizeResult)return{};let e=i.compile(this._context.finalizeResult);if(!e(t))throw console.error("Finalize result validation errors:",e.errors),Error("Invalid finalize result!");return t},o=t=>{if(null==this._context.callbackData)return{};let e=i.compile(this._context.callbackData);if(!e(t))throw console.error("Callback data validation errors:",e.errors),Error("Invalid callback data!");return t},a=e.find(c)?.handler().handler,s=e.find(d)?.handler().handler,l=e.find(h)?.handler().handler,u=e.find(f)?.handler().handler;return{config:t,parseFinalizeData:r,parseFinalizeResult:n,resources:this._context.resources??[],parseCallbackData:o,mapPublishedRevisionData:a,mapPublishedChunkedData:s,dataRowValidator:l,sheetValidator:u}}}
1
+ import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{defaultI18n as e}from"#package/i18n";import{extendedSchemaValidator as i}from"../core/index.js";import{NoopAnalyticsSystem as r}from"../domain-context/index.js";import{createDomainRuntime as n}from"../domain-runtime/index.js";import{isGetApplicationWrapperHandler as o}from"./GetApplicationWrapperHandler.js";import{isGetWebComponentOptionsHandler as a}from"./GetWebComponentOptions.js";import{isAssistantSetupHandler as s}from"./assistant/index.js";import{createInitialPublishedData as l}from"./create-initial-published-data.js";import{isDataRowValidatorHandler as h}from"./published-data/DataRowValidatorHandler.js";import{isFilterPublishedChunksHandler as u}from"./published-data/FilterPublishedChunksHandler.js";import{isMapPublishedChunkedDataHandler as d}from"./published-data/MapPublishedChunkedDataHandler.js";import{isMapPublishedRevisionDataHandler as c}from"./published-data/MapPublishedRevisionDataHandler.js";import{isSheetValidatorHandler as f}from"./published-data/SheetValidatorHandler.js";export class ConfiguratorBuilder{_context;constructor(t){this._context=t}withDefaultEnvs(t){return new ConfiguratorBuilder({...this._context,defaultEnvs:t})}withVersion(t){return new ConfiguratorBuilder({...this._context,version:t})}withTextLanguages(t){return new ConfiguratorBuilder({...this._context,textLanguages:t})}withAcl(t){return new ConfiguratorBuilder({...this._context,acl:t})}withAdminRelease(t){return new ConfiguratorBuilder({...this._context,enableAdminRelease:t})}withUi(t){return new ConfiguratorBuilder({...this._context,ui:t})}withResourcesConfig(t){return new ConfiguratorBuilder({...this._context,resourcesConfig:t})}withChunks(t){return new ConfiguratorBuilder({...this._context,chunks:t})}withPublishedDataHash(t){return new ConfiguratorBuilder({...this._context,publishedDataHash:t})}withAssistant(t){return new ConfiguratorBuilder({...this._context,assistant:t})}withTheme(t){return new ConfiguratorBuilder({...this._context,theme:t})}withDomainFactory(t){return new ConfiguratorBuilder({...this._context,domainFactory:t})}withAdminDomainFactory(t){return new ConfiguratorBuilder({...this._context,adminDomainFactory:t})}withI18n=t=>new ConfiguratorBuilder({...this._context,i18n:t});withPrefetchedFinalizeData(t){return new ConfiguratorBuilder({...this._context,prefetchedFinalizeData:t})}withFinalizeData(t){return new ConfiguratorBuilder({...this._context,finalizeData:t})}withFinalizeResult(t){return new ConfiguratorBuilder({...this._context,finalizeResult:t})}withCallbackData(t){return new ConfiguratorBuilder({...this._context,callbackData:t})}withNavigationState(t){return new ConfiguratorBuilder({...this._context,navigationState:t})}withViewState(t){return new ConfiguratorBuilder({...this._context,viewState:t})}withToolState(t){return new ConfiguratorBuilder({...this._context,toolState:t})}withExportState(t){return new ConfiguratorBuilder({...this._context,exportState:t})}withAdminNavigationState(t){return new ConfiguratorBuilder({...this._context,adminNavigationState:t})}withAdminViewState(t){return new ConfiguratorBuilder({...this._context,adminViewState:t})}withPresets(t){return new ConfiguratorBuilder({...this._context,presets:t})}withAdminPresets(t){return new ConfiguratorBuilder({...this._context,adminPresets:t})}withComponentOptics(t){return new ConfiguratorBuilder({...this._context,componentOptics:[...this._context.componentOptics,...t]})}withAdminComponentOptics(t){return new ConfiguratorBuilder({...this._context,adminComponentOptics:[...this._context.adminComponentOptics??[],...t]})}withHandlers(t){return new ConfiguratorBuilder({...this._context,handlers:t})}withElements(t){return new ConfiguratorBuilder({...this._context,elements:t})}withDefaultElements(t){return new ConfiguratorBuilder({...this._context,defaultElements:t})}withResources(t){return new ConfiguratorBuilder({...this._context,resources:t})}withWebComponentTag(t){return new ConfiguratorBuilder({...this._context,tagName:t})}withTransformers(t,e){return new ConfiguratorBuilder({...this._context,transformers:{importedTransformers:t,specTransformers:e}})}withInterface(t){return this}withDataSpec=t=>new ConfiguratorBuilder({...this._context,dataSpec:t});_computeInitialPublishedData(t,e,i){if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");return l({adminDomainFactory:this._context.adminDomainFactory,domainRuntime:e,adminPresets:this._context.adminPresets??[],handlers:i,dataSpec:this._context.dataSpec,chunks:this._context.chunks,logger:t})}buildConfig(){return this._buildConfigWithHandlers().config}_buildConfigWithHandlers(){if(!this._context.domainFactory)throw Error("Can not create application config, domainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.presets)throw Error("Can not create application config, presets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminDomainFactory)throw Error("Can not create application config, adminDomainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminPresets)throw Error("Can not create application config, adminPresets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.version)throw Error("Can not create application config, version is required!");let i=this._context.tagName??"salsita-configurator",l={defaultEnvs:this._context.defaultEnvs,services:{i18n:this._context.i18n},version:this._context.version,initialPublishedData:{},domain:{textLanguages:this._context.textLanguages,componentOptics:this._context.componentOptics,presets:this._context.presets,domainFactory:this._context.domainFactory},navigation:{navigationStates:this._context.navigationState?.values(),viewStates:this._context.viewState?.values(),toolStates:this._context.toolState?.values(),exportStates:this._context.exportState?.values()},adminNavigation:{navigationStates:this._context.adminNavigationState?.values(),viewStates:this._context.adminViewState?.values()},adminDomain:{textLanguages:this._context.textLanguages,componentOptics:this._context.adminComponentOptics??[],presets:this._context.adminPresets,domainFactory:this._context.adminDomainFactory},mount:{tag:i,options:{}},handlers:this._context.handlers??[],elements:this._context.elements??[],defaultElements:this._context.defaultElements??[],transformers:this._context.transformers,features:{acl:this._context.acl,enableAdminRelease:this._context.enableAdminRelease},ui:{preview:this._context.ui?.preview,alwaysExpand:this._context.ui?.alwaysExpand,theme:this._context.theme},resources:this._context.resourcesConfig,chunks:this._context.chunks,publishedDataHash:this._context.publishedDataHash,assistant:this._context.assistant,dataSpec:this._context.dataSpec},d=t(),c=n({config:l,services:{analyticsService:new r,i18n:e,logger:d}}),m=c.getState().spec.configurator.handlers;if(m.filter(s).length>1)throw Error("Multiple createAssistantSetupHandler handlers found. Only one handler is allowed.");if(m.filter(t=>u(t)).length>1)throw Error("Multiple createFilterPublishedChunksHandler handlers found. Only one handler is allowed.");if(m.filter(t=>h(t)).length>1)throw Error("Multiple createDataRowValidatorHandler handlers found. Only one handler is allowed.");if(m.filter(t=>f(t)).length>1)throw Error("Multiple createSheetValidatorHandler handlers found. Only one handler is allowed.");let w=m.find(o)?.handler().handler,x=m.find(a)?.handler().handler(void 0),_=this._computeInitialPublishedData(d,c,m);return{config:{...l,mount:{tag:i,options:x??{},Application:w},initialPublishedData:_},handlers:m}}buildWebhookContext(){if(!this._context.domainFactory)throw Error("domainFactory is required!");if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");if(!this._context.adminPresets)throw Error("adminPresets are required!");let{config:t,handlers:e}=this._buildConfigWithHandlers(),r=t=>{if(null==this._context.finalizeData)return{};let e=i.compile(this._context.finalizeData);if(!e(t))throw console.error("Finalize data validation errors:",e.errors),Error("Invalid finalize data!");return t},n=t=>{if(null==this._context.finalizeResult)return{};let e=i.compile(this._context.finalizeResult);if(!e(t))throw console.error("Finalize result validation errors:",e.errors),Error("Invalid finalize result!");return t},o=t=>{if(null==this._context.callbackData)return{};let e=i.compile(this._context.callbackData);if(!e(t))throw console.error("Callback data validation errors:",e.errors),Error("Invalid callback data!");return t},a=e.find(c)?.handler().handler,s=e.find(d)?.handler().handler,l=e.find(h)?.handler().handler,u=e.find(f)?.handler().handler;return{config:t,parseFinalizeData:r,parseFinalizeResult:n,resources:this._context.resources??[],parseCallbackData:o,mapPublishedRevisionData:a,mapPublishedChunkedData:s,dataRowValidator:l,sheetValidator:u}}}
@@ -1 +1 @@
1
- import{createAjvSchemaValidator as e}from"./create-ajv-schema-validator.js";import{createCspSchemaValidator as a}from"./create-csp-schema-validator.js";let t="csp-compatible"===globalThis.PHX_SCHEMA_VALIDATOR?a:e;export const getExtendedSchemaValidator=()=>{let e=t();return e.addKeyword("tsType"),e.addKeyword("import"),e.addKeyword("declared"),e};export const extendedSchemaValidator=getExtendedSchemaValidator();
1
+ import{createAjvSchemaValidator as e}from"./create-ajv-schema-validator.js";import{createCspSchemaValidator as a}from"./create-csp-schema-validator.js";export const getExtendedSchemaValidator=()=>{let t="csp-compatible"===globalThis.PHX_SCHEMA_VALIDATOR?a():e();return t.addKeyword("tsType"),t.addKeyword("import"),t.addKeyword("declared"),t};export const extendedSchemaValidator=getExtendedSchemaValidator();
@@ -2,7 +2,7 @@ export { type AnalyticsSystem, NoopAnalyticsSystem, type AnalyticsEvent, Analyti
2
2
  export { NavigationUpdateTag, isInitialNavigationUpdate, isNavigationUpdate, isInitialViewUpdate, isViewUpdate, isInitialSelectionUpdate, isSelectUpdate, isDeselectUpdate, isInitialFullscreenUpdate, isToggleFullscreenUpdate, isInitialDebugUpdate, isInitialViewportUpdate, isSetViewportUpdate, isInitialDragUpdate, isDragStartUpdate, isDragEndUpdate, isInitialToolUpdate, isToolUpdate, isExportUpdate, createAutoSelectionTransformer, NavigationSystem, type NavigationSystemContext, createResetSelectionOnNavigationTransformer, createNavigationOnSelectionTransformer, createNavigationOnDeselectTransformer, createSelectParentOnDeselectionTransformer, createNavigationOnSelectionChangeTransformer, type AnyNavigationSystem, } from './navigation-system/index.js';
3
3
  export { StoreSystem, type TransformerRegistration, type UpdateTransformer, type TransformerLogFunction, type Transformers, type StateSliceName, type StateEmissionKind, type CommitPreparedOutcome, nextDomainEntityId, getIdSequence, applyUpdates, SystemState, SystemStateInitialUpdateTag, SystemStateUpdateTag, type SystemStateContext, type AnyCreateTransformersFactory, type AnyStoreSystem, type Unregister, } from './store-system/index.js';
4
4
  export { createRefReplaceTransformer, createCascadeDeletesTransformer, createCascadeRefPruningTransformer, createCreateEntityRefsTransformer, } from './relation-transformers/index.js';
5
- export { type CanBeUndonePredicate, type CanBeUndoneContext, type UndoCapabilities, UndoSystem, UNDO_REDO_RESET_TAG, isUndoRedoReset, type AnyUndoSystem, } from './undo-system.js';
5
+ export { type CanBeUndonePredicate, type CanBeUndoneContext, type UndoCapabilities, type UndoStep, UndoSystem, UNDO_REDO_RESET_TAG, isUndoRedoReset, type AnyUndoSystem, } from './undo-system.js';
6
6
  export { DimensionSystem, type AnyDimensionSystem, type DimensionSystemContext, type AngleDimensionViolation, type DistanceDimensionViolation, type GenericDimensionViolation, } from './dimension-system/index.js';
7
7
  export { ActionSystem, type AnyActionSystem, type ActionSystemContext } from './action-system/index.js';
8
8
  export { RecipeCookerSystem, type AnyRecipeCookerSystem, type RecipeCookerSystemContext, ReplaceRecipeUpdateTag, isReplaceEntityUpdate, type IsReplaceRecipeUpdate, CreateRecipeUpdateTag, isCreateEntityUpdate, type IsCreateRecipeUpdate, } from './recipe-system/index.js';
@@ -1,10 +1,31 @@
1
1
  import type { ObservableWithLastValue } from '@salsita-ai/common/utils';
2
- import type { $DomainEntity, DomainEntity, ResetStateEmission, StateEmission } from '../core/index.js';
2
+ import type { $DomainEntity, DomainEntity, DomainState, ResetStateEmission, StateEmission } from '../core/index.js';
3
3
  import type { DomainContextSelectors } from '../domain-runtime/index.js';
4
4
  export interface UndoCapabilities {
5
5
  readonly canUndo: boolean;
6
6
  readonly canRedo: boolean;
7
7
  }
8
+ /**
9
+ * One step of the undo history: a state that undo and redo return to.
10
+ *
11
+ * A step is made by an undoable change. The non-undoable commits made on top of it afterwards, such
12
+ * as a selection or a navigation, do not make steps of their own; returning to the step keeps them,
13
+ * so undoing a later change does not also take back what the user selected since. A step therefore
14
+ * holds two states: the one that identifies it and the one it returns to.
15
+ */
16
+ export interface UndoStep<ENTITIES extends DomainEntity<string>> {
17
+ /**
18
+ * The state the undoable change committed. It identifies the step and never changes, so a caller
19
+ * that knows which state its own change committed can tell whether that change is the step the
20
+ * configuration is at.
21
+ */
22
+ readonly committedState: DomainState<ENTITIES>;
23
+ /**
24
+ * What undo or redo resets the store to: `committedState` plus the non-undoable commits made on
25
+ * top of it before the next undoable change.
26
+ */
27
+ readonly restoreState: DomainState<ENTITIES>;
28
+ }
8
29
  export interface CanBeUndoneContext<ENTITIES extends DomainEntity<string>, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>>> {
9
30
  oldEmission: StateEmission<ENTITIES, $MAP>;
10
31
  newEmission: StateEmission<ENTITIES, $MAP>;
@@ -39,6 +60,12 @@ export declare class UndoSystem<ENTITIES extends DomainEntity<string>, $MAP exte
39
60
  private _activeIsUndoable;
40
61
  private readonly _canSubject;
41
62
  readonly can$: ObservableWithLastValue<UndoCapabilities>;
63
+ private readonly _tipSubject;
64
+ /**
65
+ * The step the configuration is at: the top of the stack, or the step an undo or redo returned to.
66
+ * Nothing while the stack is empty, before the first undoable change and after a reset.
67
+ */
68
+ readonly tip$: ObservableWithLastValue<UndoStep<ENTITIES> | undefined>;
42
69
  constructor(_context: UndoSystemContext);
43
70
  initialize: () => void;
44
71
  /**
@@ -1 +1 @@
1
- import{BehaviorSubject as t,pairwise as e}from"rxjs";let s=t=>t.oldEmission.state.entities!==t.newEmission.state.entities;export const UNDO_REDO_RESET_TAG={};export const isUndoRedoReset=t=>"reset"===t.kind&&t.tag===UNDO_REDO_RESET_TAG;export class UndoSystem{_context;_stack=[];_currentIndex=-1;_activeIsUndoable;_canSubject=new t({canUndo:!1,canRedo:!1});can$=this._canSubject;constructor(t){this._context=t,this._context.selectors.getStoreSystem().stateSlices.committed.pipe(e()).subscribe(([t,e])=>{if("reset"===e.kind&&e.tag!==UNDO_REDO_RESET_TAG)return void this.resetStack();let n=this._activeIsUndoable?.handler??s;("reset"!==e.kind||e.tag!==UNDO_REDO_RESET_TAG)&&n({oldEmission:t,newEmission:e})&&(this._stack=[...this._stack.slice(0,this._currentIndex),t.state,e.state],this._currentIndex=this._stack.length-1,this._refresh())})}initialize=()=>{this.resetStack()};registerIsUndoable(t){let e={handler:t};return this._activeIsUndoable=e,()=>{this._activeIsUndoable===e&&(this._activeIsUndoable=void 0)}}resetStack(){this._stack=[],this._currentIndex=-1,this._refresh()}_refresh(){this._canSubject.next({canUndo:this.canUndo(),canRedo:this.canRedo()})}canUndo(){return this._currentIndex>0}canRedo(){return this._currentIndex<this._stack.length-1}undo(){let t=this._stack[this._currentIndex-1];void 0!==t&&(this._currentIndex--,this._context.selectors.getStoreSystem().reset(t,UNDO_REDO_RESET_TAG),this._refresh())}redo(){let t=this._stack[this._currentIndex+1];void 0!==t&&(this._currentIndex++,this._context.selectors.getStoreSystem().reset(t,UNDO_REDO_RESET_TAG),this._refresh())}}
1
+ import{BehaviorSubject as t,pairwise as e}from"rxjs";let s=t=>t.oldEmission.state.entities!==t.newEmission.state.entities;export const UNDO_REDO_RESET_TAG={};export const isUndoRedoReset=t=>"reset"===t.kind&&t.tag===UNDO_REDO_RESET_TAG;export class UndoSystem{_context;_stack=[];_currentIndex=-1;_activeIsUndoable;_canSubject=new t({canUndo:!1,canRedo:!1});can$=this._canSubject;_tipSubject=new t(void 0);tip$=this._tipSubject;constructor(t){this._context=t,this._context.selectors.getStoreSystem().stateSlices.committed.pipe(e()).subscribe(([t,e])=>{if("reset"===e.kind&&e.tag!==UNDO_REDO_RESET_TAG)return void this.resetStack();let i=this._activeIsUndoable?.handler??s;if("reset"===e.kind&&e.tag===UNDO_REDO_RESET_TAG||!i({oldEmission:t,newEmission:e}))return;let r=this._stack[this._currentIndex],n={committedState:r?.committedState??t.state,restoreState:t.state},c={committedState:e.state,restoreState:e.state};this._stack=[...this._stack.slice(0,this._currentIndex),n,c],this._currentIndex=this._stack.length-1,this._refresh()})}initialize=()=>{this.resetStack()};registerIsUndoable(t){let e={handler:t};return this._activeIsUndoable=e,()=>{this._activeIsUndoable===e&&(this._activeIsUndoable=void 0)}}resetStack(){this._stack=[],this._currentIndex=-1,this._refresh()}_refresh(){this._canSubject.next({canUndo:this.canUndo(),canRedo:this.canRedo()}),this._tipSubject.next(this._stack[this._currentIndex])}canUndo(){return this._currentIndex>0}canRedo(){return this._currentIndex<this._stack.length-1}undo(){let t=this._stack[this._currentIndex-1];void 0!==t&&(this._currentIndex--,this._context.selectors.getStoreSystem().reset(t.restoreState,UNDO_REDO_RESET_TAG),this._refresh())}redo(){let t=this._stack[this._currentIndex+1];void 0!==t&&(this._currentIndex++,this._context.selectors.getStoreSystem().reset(t.restoreState,UNDO_REDO_RESET_TAG),this._refresh())}}
@@ -1 +1 @@
1
- import{SessionRole as e}from"@salsita-ai/contracts/api";import{createImplementationErrorCollector as t}from"../errors/index.js";import{resolveComponentOpticModules as a,resolveElementModule as n,resolveHandlerModule as o,resolveImportedTransformers as i,resolveTransformerModule as s}from"./module-checks/index.js";let r=(e,t,a)=>e.flatMap(e=>a.attempt(()=>t(e),[]));export const initializeSpec=m=>{let c=m.adminDomain.presets[0];if(!c)throw Error("Cannot register application spec because admin preset is required.");let d=t(),l=r(m.handlers,o,d),p=r(m.elements,n,d),y=r(m.transformers?.importedTransformers??[],e=>[s(e)],d),u=r(m.domain.componentOptics,e=>a([e]),d),f=r(m.adminDomain.componentOptics,e=>a([e]),d);d.throwIfAny();let x=(e=>{let t={};for(let a of e)t[a.name]=(void 0)??a.name;return t})(l),g=(e=>{let t={},a=0;for(let n of e)if("entity"===n.type||"layout"===n.type)t[n.name]=(void 0)??n.name;else{let e=`icon:${a}`;t[e]=(void 0)??`${e}:${n.elements.length}`,a+=1}return t})(p),v=m.transformers?.specTransformers??[];return{version:m.version,dataConfig:m.dataSpec??null,chunks:m.chunks,publishedDataHash:m.publishedDataHash,initialPublishedData:m.initialPublishedData,canCreate:m.features?.acl?.canCreate??Object.values(e),enableAdminRelease:m.features?.enableAdminRelease??!1,textLanguages:m.domain.textLanguages??m.adminDomain.textLanguages??["en"],baseResourcesUrl:m.resources?.baseResourcesUrl??m.defaultEnvs?.resourcesUrl??"",configurator:{factory:m.domain.domainFactory,presets:m.domain.presets,aliasMap:m.domain.domainFactory.context.aliasMap,entityReflections:m.domain.domainFactory.context.entityReflections,$entityReflections:m.domain.domainFactory.context.$entityReflections,expressions:m.domain.domainFactory.context.expressions,actions:m.domain.domainFactory.context.actions,actionImplementations:m.domain.domainFactory.context.actionImplementations,allowedRootEntityTypes:m.domain.domainFactory.context.allowedRootEntityTypes,migrate:m.domain.domainFactory.context.migrate,componentOptics:u,createTransformers:e=>i(y,v,e),navigationStates:m.navigation?.navigationStates??[],viewStates:m.navigation?.viewStates??[],toolStates:m.navigation?.toolStates??[],exportStates:m.navigation?.exportStates??[],handlers:l,handlerHashes:x,elements:p,elementHashes:g,appLoader:m.ui?.appLoader??"universal",preview:m.ui?.preview??"auto",alwaysExpand:m.ui?.alwaysExpand??!1,theme:m.ui?.theme??{},assistant:m.assistant??null,deploymentQueryDisabled:m.resources?.deploymentQueryDisabled??!1,prefetchTextureUrls:m.resources?.prefetchTextureUrls??[],modelVersion:m.domain.domainFactory.modelVersion},admin:{factory:m.adminDomain.domainFactory,modelVersion:m.adminDomain.domainFactory.modelVersion,aliasMap:m.adminDomain.domainFactory.context.aliasMap,entityReflections:m.adminDomain.domainFactory.context.entityReflections,$entityReflections:m.adminDomain.domainFactory.context.$entityReflections,expressions:m.adminDomain.domainFactory.context.expressions,actions:m.adminDomain.domainFactory.context.actions,actionImplementations:m.adminDomain.domainFactory.context.actionImplementations,allowedRootEntityTypes:m.adminDomain.domainFactory.context.allowedRootEntityTypes,migrate:m.adminDomain.domainFactory.context.migrate,preset:c,componentOptics:f,navigationStates:m.adminNavigation?.navigationStates??[],viewStates:m.adminNavigation?.viewStates??[],handlers:l,handlerHashes:x,elements:p,elementHashes:g}}};
1
+ import{SessionRole as e}from"@salsita-ai/contracts/api";import{createImplementationErrorCollector as t}from"../errors/index.js";import{resolveComponentOpticModules as a,resolveElementModule as n,resolveHandlerModule as o,resolveImportedTransformers as i,resolveTransformerModule as s}from"./module-checks/index.js";let r=(e,t,a)=>e.flatMap(e=>a.attempt(()=>t(e),[]));export const initializeSpec=m=>{let c=m.adminDomain.presets[0];if(!c)throw Error("Cannot register application spec because admin preset is required.");let d=t(),l=r(m.handlers,o,d),p=r(m.elements,n,d),y=r(m.transformers?.importedTransformers??[],e=>[s(e)],d),u=r(m.domain.componentOptics,e=>a([e]),d),f=r(m.adminDomain.componentOptics,e=>a([e]),d);d.throwIfAny();let x=(e=>{let t={};for(let a of e)t[a.name]=(void 0)??a.name;return t})(l),g=(e=>{let t={},a=0;for(let n of e)if("entity"===n.type||"layout"===n.type)t[n.name]=(void 0)??n.name;else{let e=`icon:${a}`;t[e]=(void 0)??`${e}:${n.elements.length}`,a+=1}return t})(p),v=m.transformers?.specTransformers??[];return{version:m.version,dataConfig:m.dataSpec??null,chunks:m.chunks,publishedDataHash:m.publishedDataHash,initialPublishedData:m.initialPublishedData,canCreate:m.features?.acl?.canCreate??Object.values(e),enableAdminRelease:m.features?.enableAdminRelease??!1,textLanguages:m.domain.textLanguages??m.adminDomain.textLanguages??["en"],baseResourcesUrl:m.resources?.baseResourcesUrl??m.defaultEnvs?.resourcesUrl??"",configurator:{factory:m.domain.domainFactory,presets:m.domain.presets,aliasMap:m.domain.domainFactory.context.aliasMap,entityReflections:m.domain.domainFactory.context.entityReflections,$entityReflections:m.domain.domainFactory.context.$entityReflections,expressions:m.domain.domainFactory.context.expressions,actions:m.domain.domainFactory.context.actions,actionImplementations:m.domain.domainFactory.context.actionImplementations,allowedRootEntityTypes:m.domain.domainFactory.context.allowedRootEntityTypes,migrate:m.domain.domainFactory.context.migrate,componentOptics:u,createTransformers:e=>i(y,v,e),navigationStates:m.navigation?.navigationStates??[],viewStates:m.navigation?.viewStates??[],toolStates:m.navigation?.toolStates??[],exportStates:m.navigation?.exportStates??[],handlers:l,handlerHashes:x,elements:p,defaultElements:m.defaultElements??[],elementHashes:g,appLoader:m.ui?.appLoader??"universal",preview:m.ui?.preview??"auto",alwaysExpand:m.ui?.alwaysExpand??!1,theme:m.ui?.theme??{},assistant:m.assistant??null,deploymentQueryDisabled:m.resources?.deploymentQueryDisabled??!1,prefetchTextureUrls:m.resources?.prefetchTextureUrls??[],modelVersion:m.domain.domainFactory.modelVersion},admin:{factory:m.adminDomain.domainFactory,modelVersion:m.adminDomain.domainFactory.modelVersion,aliasMap:m.adminDomain.domainFactory.context.aliasMap,entityReflections:m.adminDomain.domainFactory.context.entityReflections,$entityReflections:m.adminDomain.domainFactory.context.$entityReflections,expressions:m.adminDomain.domainFactory.context.expressions,actions:m.adminDomain.domainFactory.context.actions,actionImplementations:m.adminDomain.domainFactory.context.actionImplementations,allowedRootEntityTypes:m.adminDomain.domainFactory.context.allowedRootEntityTypes,migrate:m.adminDomain.domainFactory.context.migrate,preset:c,componentOptics:f,navigationStates:m.adminNavigation?.navigationStates??[],viewStates:m.adminNavigation?.viewStates??[],handlers:l,handlerHashes:x,elements:p,elementHashes:g}}};
@@ -26,15 +26,6 @@ export interface CustomPhoenixEntityElementProps {
26
26
  entityId: DomainEntityId<string>;
27
27
  children?: ReactNode;
28
28
  }
29
- export interface SystemElementRegistry {
30
- layoutElements: Record<string, (props: PropsWithChildren) => JSX.Element>;
31
- entityElements: Record<string, (props: CustomPhoenixEntityElementProps) => JSX.Element>;
32
- }
33
- /**
34
- * Internal registry for system-level elements registered at import time
35
- * via createPhoenixLayoutElement / createPhoenixEntityElement.
36
- */
37
- export declare const systemElementRegistry: SystemElementRegistry;
38
29
  type SchemaOfPhoenixLayoutElement<SCHEMA extends {
39
30
  kind: string;
40
31
  props?: Record<string, unknown>;
@@ -61,7 +52,12 @@ export interface PhoenixLayoutElementDefinition<SCHEMA extends {
61
52
  }>;
62
53
  }
63
54
  /**
64
- * For internal use in PHX only.
55
+ * Returns the component of a built-in layout element definition; it registers nothing. A layout
56
+ * element reaches the runtime only through a registration in `elements` or `defaultElements`.
57
+ *
58
+ * @deprecated Register a layout element with `createCustomPhoenixLayoutElement(name, component)`;
59
+ * the built-in ones are in `defaultConfiguratorElements` and `defaultAdminElements`. This API will
60
+ * be removed in a future version.
65
61
  */
66
62
  export declare const createPhoenixLayoutElement: <SCHEMA extends {
67
63
  kind: string;
@@ -95,7 +91,12 @@ export interface PhoenixEntityElementDefinition<SCHEMA extends {
95
91
  component: React.FunctionComponent<SCHEMA['props'] & CustomPhoenixEntityElementProps>;
96
92
  }
97
93
  /**
98
- * For internal use in PHX only.
94
+ * Returns the component of a built-in entity element definition; it registers nothing. An entity
95
+ * element reaches the runtime only through a registration in `elements` or `defaultElements`.
96
+ *
97
+ * @deprecated Register an entity element with `createCustomPhoenixEntityElement(name, component)`;
98
+ * the built-in ones are in `defaultConfiguratorElements` and `defaultAdminElements`. This API will
99
+ * be removed in a future version.
99
100
  */
100
101
  export declare const createPhoenixEntityElement: <SCHEMA extends {
101
102
  kind: string;
@@ -1 +1 @@
1
- import{SHARED_FOLDER_HINT as e,isRecord as t,resolveListModule as n}from"./project-modules.js";export const systemElementRegistry={layoutElements:{},entityElements:{}};export const createPhoenixLayoutElement=e=>(systemElementRegistry.layoutElements[e.schema.properties.kind.enum[0]]=e.component,e.component);export const createCustomPhoenixLayoutElement=(e,t)=>({type:"layout",name:e,element:t});export const createPhoenixEntityElement=e=>(systemElementRegistry.entityElements[e.schema.properties.kind.enum[0]]=e.component,e.component);export const createCustomPhoenixEntityElement=(e,t)=>({type:"entity",name:e,element:t});let o={expected:"an element registration, or an array of them",fix:`Create it with phx.frontend.createCustomPhoenixLayoutElement(...) or phx.frontend.createCustomPhoenixEntityElement(...), ${e}.`},r=e=>!!t(e)&&("icon"===e.type?Array.isArray(e.elements):("entity"===e.type||"layout"===e.type)&&"string"==typeof e.name&&"function"==typeof e.element);export const resolveElementModule=e=>n(e,o,r);export const resolveElementModules=e=>e.flatMap(resolveElementModule);
1
+ import{SHARED_FOLDER_HINT as e,isRecord as t,resolveListModule as o}from"./project-modules.js";export const createPhoenixLayoutElement=e=>e.component;export const createCustomPhoenixLayoutElement=(e,t)=>({type:"layout",name:e,element:t});export const createPhoenixEntityElement=e=>e.component;export const createCustomPhoenixEntityElement=(e,t)=>({type:"entity",name:e,element:t});let n={expected:"an element registration, or an array of them",fix:`Create it with phx.frontend.createCustomPhoenixLayoutElement(...) or phx.frontend.createCustomPhoenixEntityElement(...), ${e}.`},r=e=>!!t(e)&&("icon"===e.type?Array.isArray(e.elements):("entity"===e.type||"layout"===e.type)&&"string"==typeof e.name&&"function"==typeof e.element);export const resolveElementModule=e=>o(e,n,r);export const resolveElementModules=e=>e.flatMap(resolveElementModule);
@@ -1,4 +1,4 @@
1
- export { type PhoenixEntityElementProps, type PhoenixEntityElementRegistration, type PhoenixLayoutElementRegistration, type PhoenixIconRegistration, type ElementRegistration, type CustomPhoenixEntityElementProps, type PhoenixLayoutElementDefinition, type PhoenixEntityElementDefinition, type CreateCustomPhoenixLayoutElement, type CreateCustomPhoenixEntityElement, createPhoenixLayoutElement, createPhoenixEntityElement, createCustomPhoenixLayoutElement, createCustomPhoenixEntityElement, resolveElementModule, resolveElementModules, systemElementRegistry, } from './element-registration.js';
1
+ export { type PhoenixEntityElementProps, type PhoenixEntityElementRegistration, type PhoenixLayoutElementRegistration, type PhoenixIconRegistration, type ElementRegistration, type CustomPhoenixEntityElementProps, type PhoenixLayoutElementDefinition, type PhoenixEntityElementDefinition, type CreateCustomPhoenixLayoutElement, type CreateCustomPhoenixEntityElement, createPhoenixLayoutElement, createPhoenixEntityElement, createCustomPhoenixLayoutElement, createCustomPhoenixEntityElement, resolveElementModule, resolveElementModules, } from './element-registration.js';
2
2
  export { type PhoenixHandlerDefinition, type SystemPhoenixHandlerDefinition, type PhoenixHandlerRegistration, type SystemPhoenixHandlerRegistration, type SystemPhoenixAsyncHandlerDefinition, type SystemPhoenixAsyncHandlerRegistration, type HandlerRegistration, type CreatePhoenixHandler, createPhoenixHandler, createSystemPhoenixHandler, createSystemPhoenixAsyncHandler, resolveHandlerModule, resolveHandlerModules, } from './handler-registration.js';
3
3
  export { type ProjectModule } from './project-modules.js';
4
4
  export { resolveActionModules } from './resolve-action-modules.js';
@@ -1 +1 @@
1
- export{createPhoenixLayoutElement,createPhoenixEntityElement,createCustomPhoenixLayoutElement,createCustomPhoenixEntityElement,resolveElementModule,resolveElementModules,systemElementRegistry}from"./element-registration.js";export{createPhoenixHandler,createSystemPhoenixHandler,createSystemPhoenixAsyncHandler,resolveHandlerModule,resolveHandlerModules}from"./handler-registration.js";export{resolveActionModules}from"./resolve-action-modules.js";export{resolveComponentOpticModules}from"./resolve-component-optic-modules.js";export{resolveExpressionModules}from"./resolve-expression-modules.js";export{resolveImportedTransformers,resolveTransformerModule,resolveTransformerModules}from"./resolve-imported-transformers.js";export{resolveInvariantModules}from"./resolve-invariant-modules.js";
1
+ export{createPhoenixLayoutElement,createPhoenixEntityElement,createCustomPhoenixLayoutElement,createCustomPhoenixEntityElement,resolveElementModule,resolveElementModules}from"./element-registration.js";export{createPhoenixHandler,createSystemPhoenixHandler,createSystemPhoenixAsyncHandler,resolveHandlerModule,resolveHandlerModules}from"./handler-registration.js";export{resolveActionModules}from"./resolve-action-modules.js";export{resolveComponentOpticModules}from"./resolve-component-optic-modules.js";export{resolveExpressionModules}from"./resolve-expression-modules.js";export{resolveImportedTransformers,resolveTransformerModule,resolveTransformerModules}from"./resolve-imported-transformers.js";export{resolveInvariantModules}from"./resolve-invariant-modules.js";
@@ -1 +1 @@
1
- import{createSelector as e}from"@salsita-ai/common/utils";import{buildAssistantManifest as t}from"../../application/assistant/index.js";import{systemElementRegistry as n}from"./module-checks/index.js";export const createSpecSelectors=a=>{let{getState:s}=a,r=e.withTypes(),o=r([r.leaf(e=>e.spec)],e=>e),l=r([o],e=>e.version),i=r([o],e=>e.baseResourcesUrl),m=r([o],e=>e.configurator),g=r([o],e=>e.dataConfig),p=r([o],e=>e.chunks),d=r([o],e=>e.publishedDataHash),c=r([o],e=>e.initialPublishedData),u=r([o],e=>e.canCreate),h=r([o],e=>e.enableAdminRelease),y=r([o],e=>e.textLanguages),f=r([m],e=>e.modelVersion),C=r([o],e=>e.admin),x=r([C],e=>e.preset),A=r([C],e=>e.modelVersion),E=r([m],e=>e.theme),b=r([m],e=>e.assistant),H=r([b],e=>e?t(e):null),D=r([m],e=>e.factory),P=r([C],e=>e.factory),S=r([m],e=>e.componentOptics),w=r([C],e=>e.componentOptics),O=r([m],e=>e.appLoader),T=r([m],e=>e.preview),V=r([m],e=>e.alwaysExpand),L=r([m],e=>e.presets),R=r([m],e=>e.deploymentQueryDisabled),U=r([m],e=>e.prefetchTextureUrls),k=r([m],e=>e.handlerHashes),v=r([m],e=>e.handlers),j=r([v,k],(e,t)=>({...(e=>{let t={},n={},a={};for(let s of e)"phoenix"===s.type&&(t[s.name]=s.handler),"system"===s.type&&(n[s.name]=s.handler),"system-async"===s.type&&(a[s.name]=s.handler);return{handlers:t,systemHandlers:n,systemAsyncHandlers:a}})(e),hashes:t})),F=r([m],e=>e.elementHashes),M=r([m],e=>e.elements),Q=r([M,F],(e,t)=>({...(e=>{let t={},a={};for(let n of e)"layout"===n.type&&(t[n.name]=n.element),"entity"===n.type&&(a[n.name]=n.element);return{entityElements:{...n.entityElements,...a},layoutElements:{...n.layoutElements,...t}}})(e),hashes:t}));return{selectSpec:o,selectVersion:l,selectBaseResourcesUrl:i,selectConfiguratorSpec:m,selectConfiguratorModelVersion:f,selectAdminSpec:C,selectAdminPreset:x,selectAdminModelVersion:A,selectThemeOptions:E,selectAssistant:H,selectConfiguratorFactory:D,selectAdminFactory:P,selectConfiguratorComponentOptics:S,selectAdminComponentOptics:w,selectAppLoader:O,selectPreview:T,selectAlwaysExpand:V,selectPresetSeed:L,selectDeploymentQueryDisabled:R,selectPrefetchTextureUrls:U,selectTextLanguages:y,selectHandlerHashes:k,selectHandlers:v,selectHandlerSlots:j,selectElementHashes:F,selectElements:M,selectElementSlots:Q,selectDataConfig:g,selectChunks:p,selectPublishedDataHash:d,selectInitialPublishedData:c,selectCanCreate:u,selectEnableAdminRelease:h,getVersion:()=>l(s()),getBaseResourcesUrl:()=>i(s()),getConfiguratorSpec:()=>m(s()),getConfiguratorModelVersion:()=>f(s()),getAdminSpec:()=>C(s()),getAdminPreset:()=>x(s()),getAdminModelVersion:()=>A(s()),getThemeOptions:()=>E(s()),getAssistant:()=>H(s()),getConfiguratorFactory:()=>D(s()),getAdminFactory:()=>P(s()),getConfiguratorComponentOptics:()=>S(s()),getAdminComponentOptics:()=>w(s()),getAppLoader:()=>O(s()),getPreview:()=>T(s()),getAlwaysExpand:()=>V(s()),getPresetSeed:()=>L(s()),getDeploymentQueryDisabled:()=>R(s()),getPrefetchTextureUrls:()=>U(s()),getTextLanguages:()=>y(s()),getHandlerHashes:()=>k(s()),getHandlers:()=>v(s()),getHandlerSlots:()=>j(s()),getElementHashes:()=>F(s()),getElements:()=>M(s()),getElementSlots:()=>Q(s()),getDataConfig:()=>g(s()),getChunks:()=>p(s()),getPublishedDataHash:()=>d(s()),getInitialPublishedData:()=>c(s()),getCanCreate:()=>u(s()),getEnableAdminRelease:()=>h(s())}};
1
+ import{createSelector as e}from"@salsita-ai/common/utils";import{buildAssistantManifest as t}from"../../application/assistant/index.js";export const createSpecSelectors=a=>{let{getState:n}=a,s=e.withTypes(),r=s([s.leaf(e=>e.spec)],e=>e),l=s([r],e=>e.version),o=s([r],e=>e.baseResourcesUrl),i=s([r],e=>e.configurator),g=s([r],e=>e.dataConfig),m=s([r],e=>e.chunks),p=s([r],e=>e.publishedDataHash),d=s([r],e=>e.initialPublishedData),c=s([r],e=>e.canCreate),u=s([r],e=>e.enableAdminRelease),h=s([r],e=>e.textLanguages),y=s([i],e=>e.modelVersion),f=s([r],e=>e.admin),C=s([f],e=>e.preset),A=s([f],e=>e.modelVersion),b=s([i],e=>e.theme),x=s([i],e=>e.assistant),E=s([x],e=>e?t(e):null),H=s([i],e=>e.factory),D=s([f],e=>e.factory),P=s([i],e=>e.componentOptics),S=s([f],e=>e.componentOptics),w=s([i],e=>e.appLoader),O=s([i],e=>e.preview),T=s([i],e=>e.alwaysExpand),V=s([i],e=>e.presets),L=s([i],e=>e.deploymentQueryDisabled),R=s([i],e=>e.prefetchTextureUrls),U=s([i],e=>e.handlerHashes),v=s([i],e=>e.handlers),k=s([v,U],(e,t)=>({...(e=>{let t={},a={},n={};for(let s of e)"phoenix"===s.type&&(t[s.name]=s.handler),"system"===s.type&&(a[s.name]=s.handler),"system-async"===s.type&&(n[s.name]=s.handler);return{handlers:t,systemHandlers:a,systemAsyncHandlers:n}})(e),hashes:t})),F=s([i],e=>e.elementHashes),M=s([i],e=>e.elements),Q=s([i],e=>e.defaultElements),j=s([Q,M,F],(e,t,a)=>({...(e=>{let t={},a={};for(let n of e)"layout"===n.type&&(t[n.name]=n.element),"entity"===n.type&&(a[n.name]=n.element);return{entityElements:a,layoutElements:t}})([...e,...t]),hashes:a}));return{selectSpec:r,selectVersion:l,selectBaseResourcesUrl:o,selectConfiguratorSpec:i,selectConfiguratorModelVersion:y,selectAdminSpec:f,selectAdminPreset:C,selectAdminModelVersion:A,selectThemeOptions:b,selectAssistant:E,selectConfiguratorFactory:H,selectAdminFactory:D,selectConfiguratorComponentOptics:P,selectAdminComponentOptics:S,selectAppLoader:w,selectPreview:O,selectAlwaysExpand:T,selectPresetSeed:V,selectDeploymentQueryDisabled:L,selectPrefetchTextureUrls:R,selectTextLanguages:h,selectHandlerHashes:U,selectHandlers:v,selectHandlerSlots:k,selectElementHashes:F,selectElements:M,selectElementSlots:j,selectDataConfig:g,selectChunks:m,selectPublishedDataHash:p,selectInitialPublishedData:d,selectCanCreate:c,selectEnableAdminRelease:u,getVersion:()=>l(n()),getBaseResourcesUrl:()=>o(n()),getConfiguratorSpec:()=>i(n()),getConfiguratorModelVersion:()=>y(n()),getAdminSpec:()=>f(n()),getAdminPreset:()=>C(n()),getAdminModelVersion:()=>A(n()),getThemeOptions:()=>b(n()),getAssistant:()=>E(n()),getConfiguratorFactory:()=>H(n()),getAdminFactory:()=>D(n()),getConfiguratorComponentOptics:()=>P(n()),getAdminComponentOptics:()=>S(n()),getAppLoader:()=>w(n()),getPreview:()=>O(n()),getAlwaysExpand:()=>T(n()),getPresetSeed:()=>V(n()),getDeploymentQueryDisabled:()=>L(n()),getPrefetchTextureUrls:()=>R(n()),getTextLanguages:()=>h(n()),getHandlerHashes:()=>U(n()),getHandlers:()=>v(n()),getHandlerSlots:()=>k(n()),getElementHashes:()=>F(n()),getElements:()=>M(n()),getElementSlots:()=>j(n()),getDataConfig:()=>g(n()),getChunks:()=>m(n()),getPublishedDataHash:()=>p(n()),getInitialPublishedData:()=>d(n()),getCanCreate:()=>c(n()),getEnableAdminRelease:()=>u(n())}};
@@ -35,6 +35,8 @@ export interface ApplicationConfiguratorSpec {
35
35
  */
36
36
  readonly handlerHashes: Record<string, string>;
37
37
  readonly elements: readonly ElementRegistration[];
38
+ /** The SDK's default element registrations; an entry of `elements` with the same name replaces one. */
39
+ readonly defaultElements: readonly ElementRegistration[];
38
40
  /**
39
41
  * Per-element content hash. Used as remount key so only the specific element
40
42
  * whose source changed remounts. Unchanged elements keep their hash and stay mounted.
@@ -1 +1 @@
1
- import{EnhancedLocalizableSchema as e}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as t,SystemComponentBuilder as i}from"../core/index.js";import{recipeSchema as o}from"./common/recipes.js";export const childEntitySelectionComponent=i.component("childEntitySelection").withState({type:"object",tsType:"ChildEntitySelectionComponentState",import:[{module:"@salsita-ai/sdk/domain",member:"ChildEntitySelectionComponentState"}],properties:{value:t,options:{type:"array",items:{type:"object",properties:{label:e,description:e,img:e,recipes:{type:"array",items:o},keepChildren:{type:"boolean"}},required:["recipes","label"],additionalProperties:!0}}},required:["value","options"],additionalProperties:!1}).build();
1
+ import{EnhancedLocalizableSchema as e}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as t,SystemComponentBuilder as i}from"../core/index.js";import{recipeSchema as o}from"./common/recipes.js";export const childEntitySelectionComponent=i.component("childEntitySelection").withState({type:"object",tsType:"ChildEntitySelectionComponentState",import:[{module:"@salsita-ai/sdk/domain",member:"ChildEntitySelectionComponentState"}],properties:{value:t,options:{type:"array",items:{type:"object",properties:{label:e,description:e,img:e,recipes:{type:"array",items:o}},required:["recipes","label"],additionalProperties:!1}},keepChildren:{type:"boolean"}},required:["value","options"],additionalProperties:!1}).build();
@@ -115,6 +115,7 @@ declare const SceneHtmlOpacityPropertiesTmp: {
115
115
  readonly type: 'number';
116
116
  };
117
117
  };
118
+ readonly required: readonly ['min', 'max'];
118
119
  readonly additionalProperties: false;
119
120
  };
120
121
  readonly polarAngleLimits: {
@@ -138,6 +139,7 @@ declare const SceneHtmlOpacityPropertiesTmp: {
138
139
  readonly type: 'number';
139
140
  };
140
141
  };
142
+ readonly required: readonly ['min', 'max'];
141
143
  readonly additionalProperties: false;
142
144
  };
143
145
  readonly distanceLimits: {
@@ -161,6 +163,7 @@ declare const SceneHtmlOpacityPropertiesTmp: {
161
163
  readonly type: 'number';
162
164
  };
163
165
  };
166
+ readonly required: readonly ['min', 'max'];
164
167
  readonly additionalProperties: false;
165
168
  };
166
169
  readonly minInteractiveOpacity: {
@@ -1 +1 @@
1
- import{EnhancedLocalizableSchema as e}from"@salsita-ai/common/utils";let t={type:"object",tsType:"SceneEntityHtmlOpacityLimits",import:[{module:"@salsita-ai/sdk/domain",member:"SceneEntityHtmlOpacityLimits"}],properties:{min:{type:"number"},max:{type:"number"},smoothZone:{type:"number"},minOpacity:{type:"number"}},additionalProperties:!1};export const SceneHtmlOpacityProperties={azimuthAngleLimits:t,polarAngleLimits:t,distanceLimits:t,minInteractiveOpacity:{type:"number"}};export const SceneHtmlPositionProperties={offsetX:{type:"number"},offsetY:{type:"number"},offsetZ:{type:"number"},screenOffsetHorizontal:{type:"number"},screenOffsetVertical:{type:"number"}};export const SceneHtmlVisibilityProperties={hideWhileDragging:{type:"boolean"},occlude:{type:"boolean"},showWhen:{type:"array",items:{type:"string",enum:["selected","unselected"]}}};export const SceneHtmlTooltipProperties={title:e,tooltipVisibility:{type:["string"],enum:["on-hover","forced","forced-when-still","hidden"]}};
1
+ import{EnhancedLocalizableSchema as e}from"@salsita-ai/common/utils";let t={type:"object",tsType:"SceneEntityHtmlOpacityLimits",import:[{module:"@salsita-ai/sdk/domain",member:"SceneEntityHtmlOpacityLimits"}],properties:{min:{type:"number"},max:{type:"number"},smoothZone:{type:"number"},minOpacity:{type:"number"}},required:["min","max"],additionalProperties:!1};export const SceneHtmlOpacityProperties={azimuthAngleLimits:t,polarAngleLimits:t,distanceLimits:t,minInteractiveOpacity:{type:"number"}};export const SceneHtmlPositionProperties={offsetX:{type:"number"},offsetY:{type:"number"},offsetZ:{type:"number"},screenOffsetHorizontal:{type:"number"},screenOffsetVertical:{type:"number"}};export const SceneHtmlVisibilityProperties={hideWhileDragging:{type:"boolean"},occlude:{type:"boolean"},showWhen:{type:"array",items:{type:"string",enum:["selected","unselected"]}}};export const SceneHtmlTooltipProperties={title:e,tooltipVisibility:{type:["string"],enum:["on-hover","forced","forced-when-still","hidden"]}};
@@ -32,6 +32,13 @@ export interface EditorProps {
32
32
  readonly mockTemplates?: MockTemplateDefinition[];
33
33
  /** If true, automatically apply the first template when templates are initialized */
34
34
  readonly autoApplyTemplate?: boolean;
35
+ /**
36
+ * Key of the mock template to apply on mount, in place of the template stored for this page.
37
+ * Applying it does not store it, so it never changes what an editor without this prop opens.
38
+ * An unknown key logs a warning and falls back to the stored template, or to the first template
39
+ * when `autoApplyTemplate` is set.
40
+ */
41
+ readonly initialTemplateKey?: string;
35
42
  /** Key used to scope localStorage template persistence (e.g. environment slug) */
36
43
  readonly environmentKey?: string;
37
44
  /** Web component tag name for creating and discovering reflection systems. */
@@ -1 +1 @@
1
- import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{Box as o,Chip as n,CssBaseline as r,IconButton as s,ThemeProvider as a,Tooltip as l,Typography as d,createTheme as c,useMediaQuery as m,useTheme as p}from"@mui/material";import{ModalProvider as f}from"mui-modal-provider";import{memo as h,useCallback as u,useEffect as g,useState as w}from"react";import{match as k}from"ts-pattern";import{useLocalStorage as y}from"usehooks-ts";import{PhxIcon as x,SnackbarProvider as b,createThemeWithPhoenixIcons as v}from"#package/ui-sdk";import{EditorMode as S}from"./EditorMode.js";import{EditorRuntimeProvider as P}from"./EditorRuntimeProvider.js";import{EditorAdminContextProvider as j}from"./admin/EditorAdminContext.js";import{EditorAdminMainContent as V}from"./admin/EditorAdminMainContent.js";import{EditorAdminSidebar as E}from"./admin/EditorAdminSidebar.js";import{useEditorAdminState as D}from"./admin/use-editor-admin-state.js";import{Analytics as T}from"./analytics/Analytics.js";import{AnalyticsProvider as A}from"./analytics/AnalyticsContext.js";import{Logotype as C}from"./common/Logotype.js";import{PanelIconButton as L}from"./common/PanelIconButton.js";import{BrowserConsoleReporter as M}from"./console-reporter/BrowserConsoleReporter.js";import{DataHandler as W}from"./data/DataHandler.js";import{DebugFlags as R}from"./debug-flags/DebugFlags.js";import{DiagnosticsPanel as I}from"./diagnostics/DiagnosticsPanel.js";import{DomainEditors as F}from"./domain-editors/DomainEditors.js";import{DomainSpecProvider as G,useDomainSpecContext as z}from"./domain-editors/DomainSpecContext.js";import{DomainReflection as B}from"./domain-reflection/DomainReflection.js";import{GraphQLPanel as Q}from"./graphql/GraphQLPanel.js";import{LogsPanel as H}from"./logs/LogsPanel.js";import{EditorMockProvider as U}from"./mocks/EditorMockContext.js";import{Mocks as q}from"./mocks/Mocks.js";import{ProfilerPanel as O}from"./profiler/ProfilerPanel.js";import{RemoteFilesList as K}from"./remote-files/RemoteFilesList.js";import{SceneHandler as N}from"./scene/SceneHandler.js";import{ScreenshotHandler as X}from"./screenshot/ScreenshotHandler.js";import{EditorConnectionProvider as Y}from"./services/EditorConnectionContext.js";import{EditorActionButtons as $}from"./sidebar/EditorActionButtons.js";import{StateInspector as J}from"./state-inspector/index.js";import{StateHandler as Z}from"./state/StateHandler.js";import{SpaTemplate as _}from"./templates/SpaTemplate.js";import{Templates as ee}from"./templates/Templates.js";import{TemplatesList as ei}from"./templates/TemplatesList.js";import{TunnelProvider as et,useTunnel as eo}from"./tunnel/TunnelContext.js";import{TunnelPanel as en}from"./tunnel/TunnelPanel.js";import{hasTunnelProblem as er}from"./tunnel/tunnel-view-model.js";import{HTML_VARIANT_FRAME_ATTRIBUTE as es,VariantPreviewHandler as ea,useConfiguratorContainerRef as el}from"./variants/VariantPreviewHandler.js";import{VideoStudio as ed}from"./video-studio/VideoStudio.js";import{WebSocketStatus as ec}from"./websocket-status/WebSocketStatus.js";let em=h(()=>e("div",{ref:el(),style:{width:"100%",height:"100%"}})),ep=v(c());export const EditorPanelView={Files:"Files",Reflections:"Reflections",Domain:"Domain",Templates:"Templates",Mocks:"Mocks",Inspector:"Inspector",Debug:"Debug",Profiler:"Profiler",GraphQL:"GraphQL",VideoStudio:"VideoStudio",Analytics:"Analytics",Diagnostics:"Diagnostics",Logs:"Logs",Tunnel:"Tunnel",WebSocketStatus:"WebSocketStatus",Admin:"Admin"};let ef=[{key:EditorPanelView.Templates,icon:"GridFour",title:"Templates"},{key:EditorPanelView.Reflections,icon:"House",title:"Reflections"},{key:EditorPanelView.Files,icon:"List",title:"Files"},{key:EditorPanelView.Domain,icon:"Gear",title:"Domain"},{key:EditorPanelView.Mocks,icon:"TagBold",title:"Mocks"},{key:EditorPanelView.Inspector,icon:"CurrencyDollar",title:"Inspector"},{key:EditorPanelView.Debug,icon:"EyeBold",title:"Debug"},{key:EditorPanelView.Profiler,icon:"Alarm",title:"Profiler"},{key:EditorPanelView.GraphQL,icon:"MagnifyingGlassBold",title:"GraphQL"},{key:EditorPanelView.VideoStudio,icon:"CameraRotate",title:"Video Studio"},{key:EditorPanelView.Analytics,icon:"Flame",title:"Analytics"},{key:EditorPanelView.Diagnostics,icon:"WarningCircle",title:"Diagnostics"},{key:EditorPanelView.Logs,icon:"BracketsCurly",title:"Logs"},{key:EditorPanelView.Tunnel,icon:"ArrowsHorizontal",title:"Webhook Tunnel"}],eh=h(r=>{let{panelView:a,setPanelView:c,width:m,setWidth:p,selectedTemplate:f,setSelectedTemplate:h,isResizing:y,setIsResizing:b,onExit:v,enableAdmin:S}=r,P=D(S),{unreadDiagnosticCount:j,markDiagnosticsRead:A}=z(),{state:M}=eo(),W=a?Math.max(m,240):38,[G,U]=w(0),N=u(()=>U(e=>e+1),[]);return g(()=>{a===EditorPanelView.Diagnostics&&A()},[A,a]),i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:`${W}px min-content auto`,gridTemplateRows:"minmax(0, 1fr)",width:"100vw",height:"100vh",backgroundColor:"#ffffff",overflow:"hidden"},onMouseMove:e=>{y&&p(e.clientX)},onMouseUp:()=>{b(!1)},children:[i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:"36px auto",backgroundColor:"#f8f9fa",borderRight:"1px solid #dee2e6",boxShadow:"2px 0 8px rgba(0, 0, 0, 0.06)",overflow:"hidden",height:"100%"},children:[i("div",{style:{backgroundColor:"#f8f9fa",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 0"},children:[e("div",{style:{marginBottom:"8px"},children:e(C,{variant:"icon-only"})}),i("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"2px"},children:[S&&i(t,{children:[e(L,{icon:"SlidersHorizontal",title:"Admin",active:a===EditorPanelView.Admin,onClick:()=>{a===EditorPanelView.Admin?c(null):c(EditorPanelView.Admin)}}),e("div",{style:{borderBottom:"1px solid #dee2e6",margin:"2px 0"}})]}),ef.map(i=>e(L,{icon:i.icon,title:i.title,active:a===i.key,badgeCount:i.key===EditorPanelView.Tunnel?+!!er(M):i.key===EditorPanelView.Diagnostics?j:0,onClick:()=>{a===i.key?c(null):c(i.key)}},i.key))]}),e($,{reload:N}),e("div",{style:{padding:"0 2px",paddingBottom:"4px"},children:e(L,{icon:"CloudArrowUp",title:"WebSocket Status",active:a===EditorPanelView.WebSocketStatus,onClick:()=>{a===EditorPanelView.WebSocketStatus?c(null):c(EditorPanelView.WebSocketStatus)}})}),v&&e("div",{style:{padding:"0 2px",paddingBottom:"8px"},children:e(L,{icon:"SignOut",title:"Exit Editor",variant:"danger",onClick:v})})]}),a&&i(o,{component:"div",sx:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",backgroundColor:"#ffffff"},children:[e(o,{component:"div",sx:{p:1.5,borderBottom:"1px solid #e9ecef",backgroundColor:"#ffffff"},children:i(o,{component:"div",sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i(o,{component:"div",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e(d,{variant:"h6",sx:{fontSize:16,fontWeight:600,color:"#212529"},children:k(a).with("Files",()=>"Files").with("Reflections",()=>"Reflections").with("Domain",()=>"Domain").with("Templates",()=>"Templates").with("Mocks",()=>"Mocks").with("Inspector",()=>"State Inspector").with("Debug",()=>"Debug").with("Profiler",()=>"Profiler").with("GraphQL",()=>"GraphQL").with("VideoStudio",()=>"Video Studio").with("Analytics",()=>"Analytics").with("Diagnostics",()=>"Diagnostics").with("Logs",()=>"Dev Server Logs").with("Tunnel",()=>"Webhook Tunnel").with("WebSocketStatus",()=>"WebSocket Status").with("Admin",()=>"Admin").otherwise(e=>e)}),e(l,{title:k(a).with("Files",()=>"Browse and inspect loaded GLTF files and their contents").with("Reflections",()=>"Inspect internal Phoenix systems state and configuration").with("Domain",()=>"Edit YAML domain specifications and component configurations").with("Templates",()=>"Select different layout templates for the configurator interface").with("Mocks",()=>"Create and manage mock data for testing session and access configurations").with("Inspector",()=>"Walk the entity tree: fields, expressions, and children").with("Debug",()=>"Toggle scene debug visuals like offset anchors, snapping, and collision meshes").with("Profiler",()=>"Make domain expressions show up as named frames in browser CPU profiles").with("GraphQL",()=>"Run GraphQL queries against the schema generated from the assistant manifest").with("VideoStudio",()=>"Create video sequences by capturing keyframes and exporting as video").with("Analytics",()=>"View parse pipeline metrics, domain stats, and diagnostics").with("Diagnostics",()=>"View latest editor warnings and errors").with("Logs",()=>"View dev server logs: spec builds, webhooks, vite, and browser console").with("Tunnel",()=>"View webhook tunnel status and the requests routed through it").with("WebSocketStatus",()=>"View WebSocket connection status and editor mode information").with("Admin",()=>"Manage admin panel, publish data, and configure settings").otherwise(()=>"Panel information"),placement:"left",arrow:!0,children:e(s,{size:"small",sx:{ml:1,color:"#6c757d",fontSize:14,p:.25,"&:hover":{backgroundColor:"#f8f9fa",color:"#495057"}},children:e(x,{name:"Info",style:{fontSize:14}})})})]}),e(o,{component:"div",sx:{display:"flex",alignItems:"center",gap:1},children:"Templates"===a&&e(n,{label:f.charAt(0).toUpperCase()+f.slice(1),variant:"outlined",size:"small",sx:{backgroundColor:"#f8f9fa",borderColor:"#dee2e6",color:"#495057",fontWeight:500,fontSize:"0.75rem"}})})]})}),i(o,{component:"div",sx:{flex:1,backgroundColor:"#ffffff",overflow:"auto"},children:["Files"===a&&e(K,{}),"Reflections"===a&&e(B,{}),"Domain"===a&&e(F,{}),"Templates"===a&&e(ei,{selectedTemplate:f,onTemplateSelect:h}),"Mocks"===a&&e(q,{}),"Inspector"===a&&e(J,{}),"Debug"===a&&e(R,{}),"Profiler"===a&&e(O,{}),"GraphQL"===a&&e(Q,{}),"VideoStudio"===a&&e(ed,{}),"Analytics"===a&&e(T,{}),"Diagnostics"===a&&e(I,{}),"Logs"===a&&e(H,{}),"Tunnel"===a&&e(en,{}),"WebSocketStatus"===a&&e(ec,{}),S&&"Admin"===a&&e(E,{...P})]})]})]}),e("div",{style:{width:"2px",backgroundColor:"#dee2e6",cursor:"ew-resize",boxShadow:"1px 0 3px rgba(0, 0, 0, 0.05)"},onMouseDown:()=>{b(!0)}}),i("div",{style:{position:"relative",overflow:"hidden"},children:[e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"!==a)},children:e(ee,{selectedTemplate:f,children:e(em,{},G)})}),S&&e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"===a)},children:e(V,{})})]})]})}),eu=h(()=>e(_,{children:e(em,{})})),eg=h(o=>{let{wsUrl:n="ws://localhost:3020",localMode:r=!1,domainSpec:s,initialRawProjectFiles:a,onExit:l,mockTemplates:d,autoApplyTemplate:c,environmentKey:h,tagName:u,enableAdmin:k=!0}=o,x=m(p().breakpoints.up("md")),[v,V]=y("editor-width",350),[E,D]=y("editor-view",null),[T,C]=y("editor-template","spa"),[L,R]=w(!1);return g(()=>{null===E||Object.values(EditorPanelView).some(e=>e===E)&&(k||E!==EditorPanelView.Admin)||D(null)},[k,E,D]),e(f,{children:e(b,{maxSnack:5,children:e(j,{children:e(P,{tagName:u,children:e(Y,{initialWsUrl:n,localMode:r,children:e(et,{children:e(S,{children:e(A,{children:e(G,{domainSpec:s,initialRawProjectFiles:a,children:i(U,{mockTemplates:d,autoApplyTemplate:c,environmentKey:h,children:[!r&&i(t,{children:[e(X,{}),e(Z,{}),e(W,{}),e(N,{}),e(M,{})]}),e(ea,{children:x?e(eh,{panelView:E,setPanelView:D,width:v,setWidth:V,selectedTemplate:T,setSelectedTemplate:C,isResizing:L,setIsResizing:R,onExit:l,enableAdmin:k}):e(eu,{})})]})})})})})})})})})})});export const Editor=h(t=>{try{if(window.frameElement?.hasAttribute(es))return e("div",{role:"alert","data-testid":"variant-page-unavailable",style:{padding:24,fontFamily:"sans-serif"},children:"This preview page is unavailable. Ask the agent to recreate it or close the comparison."})}catch{}return i(a,{theme:ep,children:[e(r,{}),e(eg,{...t})]})});
1
+ import{jsx as e,jsxs as i,Fragment as t}from"react/jsx-runtime";import{Box as o,Chip as n,CssBaseline as r,IconButton as s,ThemeProvider as a,Tooltip as l,Typography as d,createTheme as m,useMediaQuery as c,useTheme as p}from"@mui/material";import{ModalProvider as f}from"mui-modal-provider";import{memo as h,useCallback as u,useEffect as g,useState as w}from"react";import{match as k}from"ts-pattern";import{useLocalStorage as y}from"usehooks-ts";import{PhxIcon as x,SnackbarProvider as b,createThemeWithPhoenixIcons as v}from"#package/ui-sdk";import{EditorMode as S}from"./EditorMode.js";import{EditorRuntimeProvider as P}from"./EditorRuntimeProvider.js";import{EditorAdminContextProvider as j}from"./admin/EditorAdminContext.js";import{EditorAdminMainContent as V}from"./admin/EditorAdminMainContent.js";import{EditorAdminSidebar as E}from"./admin/EditorAdminSidebar.js";import{useEditorAdminState as D}from"./admin/use-editor-admin-state.js";import{Analytics as T}from"./analytics/Analytics.js";import{AnalyticsProvider as A}from"./analytics/AnalyticsContext.js";import{Logotype as C}from"./common/Logotype.js";import{PanelIconButton as L}from"./common/PanelIconButton.js";import{BrowserConsoleReporter as M}from"./console-reporter/BrowserConsoleReporter.js";import{DataHandler as W}from"./data/DataHandler.js";import{DebugFlags as R}from"./debug-flags/DebugFlags.js";import{DiagnosticsPanel as I}from"./diagnostics/DiagnosticsPanel.js";import{DomainEditors as F}from"./domain-editors/DomainEditors.js";import{DomainSpecProvider as G,useDomainSpecContext as z}from"./domain-editors/DomainSpecContext.js";import{DomainReflection as B}from"./domain-reflection/DomainReflection.js";import{GraphQLPanel as Q}from"./graphql/GraphQLPanel.js";import{LogsPanel as H}from"./logs/LogsPanel.js";import{EditorMockProvider as U}from"./mocks/EditorMockContext.js";import{Mocks as q}from"./mocks/Mocks.js";import{ProfilerPanel as K}from"./profiler/ProfilerPanel.js";import{RemoteFilesList as O}from"./remote-files/RemoteFilesList.js";import{SceneHandler as N}from"./scene/SceneHandler.js";import{ScreenshotHandler as X}from"./screenshot/ScreenshotHandler.js";import{EditorConnectionProvider as Y}from"./services/EditorConnectionContext.js";import{EditorActionButtons as $}from"./sidebar/EditorActionButtons.js";import{StateInspector as J}from"./state-inspector/index.js";import{StateHandler as Z}from"./state/StateHandler.js";import{SpaTemplate as _}from"./templates/SpaTemplate.js";import{Templates as ee}from"./templates/Templates.js";import{TemplatesList as ei}from"./templates/TemplatesList.js";import{TunnelProvider as et,useTunnel as eo}from"./tunnel/TunnelContext.js";import{TunnelPanel as en}from"./tunnel/TunnelPanel.js";import{hasTunnelProblem as er}from"./tunnel/tunnel-view-model.js";import{HTML_VARIANT_FRAME_ATTRIBUTE as es,VariantPreviewHandler as ea,useConfiguratorContainerRef as el}from"./variants/VariantPreviewHandler.js";import{VideoStudio as ed}from"./video-studio/VideoStudio.js";import{WebSocketStatus as em}from"./websocket-status/WebSocketStatus.js";let ec=h(()=>e("div",{ref:el(),style:{width:"100%",height:"100%"}})),ep=v(m());export const EditorPanelView={Files:"Files",Reflections:"Reflections",Domain:"Domain",Templates:"Templates",Mocks:"Mocks",Inspector:"Inspector",Debug:"Debug",Profiler:"Profiler",GraphQL:"GraphQL",VideoStudio:"VideoStudio",Analytics:"Analytics",Diagnostics:"Diagnostics",Logs:"Logs",Tunnel:"Tunnel",WebSocketStatus:"WebSocketStatus",Admin:"Admin"};let ef=[{key:EditorPanelView.Templates,icon:"GridFour",title:"Templates"},{key:EditorPanelView.Reflections,icon:"House",title:"Reflections"},{key:EditorPanelView.Files,icon:"List",title:"Files"},{key:EditorPanelView.Domain,icon:"Gear",title:"Domain"},{key:EditorPanelView.Mocks,icon:"TagBold",title:"Mocks"},{key:EditorPanelView.Inspector,icon:"CurrencyDollar",title:"Inspector"},{key:EditorPanelView.Debug,icon:"EyeBold",title:"Debug"},{key:EditorPanelView.Profiler,icon:"Alarm",title:"Profiler"},{key:EditorPanelView.GraphQL,icon:"MagnifyingGlassBold",title:"GraphQL"},{key:EditorPanelView.VideoStudio,icon:"CameraRotate",title:"Video Studio"},{key:EditorPanelView.Analytics,icon:"Flame",title:"Analytics"},{key:EditorPanelView.Diagnostics,icon:"WarningCircle",title:"Diagnostics"},{key:EditorPanelView.Logs,icon:"BracketsCurly",title:"Logs"},{key:EditorPanelView.Tunnel,icon:"ArrowsHorizontal",title:"Webhook Tunnel"}],eh=h(r=>{let{panelView:a,setPanelView:m,width:c,setWidth:p,selectedTemplate:f,setSelectedTemplate:h,isResizing:y,setIsResizing:b,onExit:v,enableAdmin:S}=r,P=D(S),{unreadDiagnosticCount:j,markDiagnosticsRead:A}=z(),{state:M}=eo(),W=a?Math.max(c,240):38,[G,U]=w(0),N=u(()=>U(e=>e+1),[]);return g(()=>{a===EditorPanelView.Diagnostics&&A()},[A,a]),i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:`${W}px min-content auto`,gridTemplateRows:"minmax(0, 1fr)",width:"100vw",height:"100vh",backgroundColor:"#ffffff",overflow:"hidden"},onMouseMove:e=>{y&&p(e.clientX)},onMouseUp:()=>{b(!1)},children:[i(o,{component:"div",sx:{display:"grid",gridTemplateColumns:"36px auto",backgroundColor:"#f8f9fa",borderRight:"1px solid #dee2e6",boxShadow:"2px 0 8px rgba(0, 0, 0, 0.06)",overflow:"hidden",height:"100%"},children:[i("div",{style:{backgroundColor:"#f8f9fa",height:"100%",display:"flex",flexDirection:"column",alignItems:"center",padding:"4px 0"},children:[e("div",{style:{marginBottom:"8px"},children:e(C,{variant:"icon-only"})}),i("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:"2px"},children:[S&&i(t,{children:[e(L,{icon:"SlidersHorizontal",title:"Admin",active:a===EditorPanelView.Admin,onClick:()=>{a===EditorPanelView.Admin?m(null):m(EditorPanelView.Admin)}}),e("div",{style:{borderBottom:"1px solid #dee2e6",margin:"2px 0"}})]}),ef.map(i=>e(L,{icon:i.icon,title:i.title,active:a===i.key,badgeCount:i.key===EditorPanelView.Tunnel?+!!er(M):i.key===EditorPanelView.Diagnostics?j:0,onClick:()=>{a===i.key?m(null):m(i.key)}},i.key))]}),e($,{reload:N}),e("div",{style:{padding:"0 2px",paddingBottom:"4px"},children:e(L,{icon:"CloudArrowUp",title:"WebSocket Status",active:a===EditorPanelView.WebSocketStatus,onClick:()=>{a===EditorPanelView.WebSocketStatus?m(null):m(EditorPanelView.WebSocketStatus)}})}),v&&e("div",{style:{padding:"0 2px",paddingBottom:"8px"},children:e(L,{icon:"SignOut",title:"Exit Editor",variant:"danger",onClick:v})})]}),a&&i(o,{component:"div",sx:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",backgroundColor:"#ffffff"},children:[e(o,{component:"div",sx:{p:1.5,borderBottom:"1px solid #e9ecef",backgroundColor:"#ffffff"},children:i(o,{component:"div",sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[i(o,{component:"div",sx:{display:"flex",flexDirection:"row",alignItems:"center"},children:[e(d,{variant:"h6",sx:{fontSize:16,fontWeight:600,color:"#212529"},children:k(a).with("Files",()=>"Files").with("Reflections",()=>"Reflections").with("Domain",()=>"Domain").with("Templates",()=>"Templates").with("Mocks",()=>"Mocks").with("Inspector",()=>"State Inspector").with("Debug",()=>"Debug").with("Profiler",()=>"Profiler").with("GraphQL",()=>"GraphQL").with("VideoStudio",()=>"Video Studio").with("Analytics",()=>"Analytics").with("Diagnostics",()=>"Diagnostics").with("Logs",()=>"Dev Server Logs").with("Tunnel",()=>"Webhook Tunnel").with("WebSocketStatus",()=>"WebSocket Status").with("Admin",()=>"Admin").otherwise(e=>e)}),e(l,{title:k(a).with("Files",()=>"Browse and inspect loaded GLTF files and their contents").with("Reflections",()=>"Inspect internal Phoenix systems state and configuration").with("Domain",()=>"Edit YAML domain specifications and component configurations").with("Templates",()=>"Select different layout templates for the configurator interface").with("Mocks",()=>"Create and manage mock data for testing session and access configurations").with("Inspector",()=>"Walk the entity tree: fields, expressions, and children").with("Debug",()=>"Toggle scene debug visuals like offset anchors, snapping, and collision meshes").with("Profiler",()=>"Make domain expressions show up as named frames in browser CPU profiles").with("GraphQL",()=>"Run GraphQL queries against the schema generated from the assistant manifest").with("VideoStudio",()=>"Create video sequences by capturing keyframes and exporting as video").with("Analytics",()=>"View parse pipeline metrics, domain stats, and diagnostics").with("Diagnostics",()=>"View latest editor warnings and errors").with("Logs",()=>"View dev server logs: spec builds, webhooks, vite, and browser console").with("Tunnel",()=>"View webhook tunnel status and the requests routed through it").with("WebSocketStatus",()=>"View WebSocket connection status and editor mode information").with("Admin",()=>"Manage admin panel, publish data, and configure settings").otherwise(()=>"Panel information"),placement:"left",arrow:!0,children:e(s,{size:"small",sx:{ml:1,color:"#6c757d",fontSize:14,p:.25,"&:hover":{backgroundColor:"#f8f9fa",color:"#495057"}},children:e(x,{name:"Info",style:{fontSize:14}})})})]}),e(o,{component:"div",sx:{display:"flex",alignItems:"center",gap:1},children:"Templates"===a&&e(n,{label:f.charAt(0).toUpperCase()+f.slice(1),variant:"outlined",size:"small",sx:{backgroundColor:"#f8f9fa",borderColor:"#dee2e6",color:"#495057",fontWeight:500,fontSize:"0.75rem"}})})]})}),i(o,{component:"div",sx:{flex:1,backgroundColor:"#ffffff",overflow:"auto"},children:["Files"===a&&e(O,{}),"Reflections"===a&&e(B,{}),"Domain"===a&&e(F,{}),"Templates"===a&&e(ei,{selectedTemplate:f,onTemplateSelect:h}),"Mocks"===a&&e(q,{}),"Inspector"===a&&e(J,{}),"Debug"===a&&e(R,{}),"Profiler"===a&&e(K,{}),"GraphQL"===a&&e(Q,{}),"VideoStudio"===a&&e(ed,{}),"Analytics"===a&&e(T,{}),"Diagnostics"===a&&e(I,{}),"Logs"===a&&e(H,{}),"Tunnel"===a&&e(en,{}),"WebSocketStatus"===a&&e(em,{}),S&&"Admin"===a&&e(E,{...P})]})]})]}),e("div",{style:{width:"2px",backgroundColor:"#dee2e6",cursor:"ew-resize",boxShadow:"1px 0 3px rgba(0, 0, 0, 0.05)"},onMouseDown:()=>{b(!0)}}),i("div",{style:{position:"relative",overflow:"hidden"},children:[e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"!==a)},children:e(ee,{selectedTemplate:f,children:e(ec,{},G)})}),S&&e("div",{style:{position:"absolute",inset:0,zIndex:+("Admin"===a)},children:e(V,{})})]})]})}),eu=h(()=>e(_,{children:e(ec,{})})),eg=h(o=>{let{wsUrl:n="ws://localhost:3020",localMode:r=!1,domainSpec:s,initialRawProjectFiles:a,onExit:l,mockTemplates:d,autoApplyTemplate:m,initialTemplateKey:h,environmentKey:u,tagName:k,enableAdmin:x=!0}=o,v=c(p().breakpoints.up("md")),[V,E]=y("editor-width",350),[D,T]=y("editor-view",null),[C,L]=y("editor-template","spa"),[R,I]=w(!1);return g(()=>{null===D||Object.values(EditorPanelView).some(e=>e===D)&&(x||D!==EditorPanelView.Admin)||T(null)},[x,D,T]),e(f,{children:e(b,{maxSnack:5,children:e(j,{children:e(P,{tagName:k,children:e(Y,{initialWsUrl:n,localMode:r,children:e(et,{children:e(S,{children:e(A,{children:e(G,{domainSpec:s,initialRawProjectFiles:a,children:i(U,{mockTemplates:d,autoApplyTemplate:m,initialTemplateKey:h,environmentKey:u,children:[!r&&i(t,{children:[e(X,{}),e(Z,{}),e(W,{}),e(N,{}),e(M,{})]}),e(ea,{children:v?e(eh,{panelView:D,setPanelView:T,width:V,setWidth:E,selectedTemplate:C,setSelectedTemplate:L,isResizing:R,setIsResizing:I,onExit:l,enableAdmin:x}):e(eu,{})})]})})})})})})})})})})});export const Editor=h(t=>{try{if(window.frameElement?.hasAttribute(es))return e("div",{role:"alert","data-testid":"variant-page-unavailable",style:{padding:24,fontFamily:"sans-serif"},children:"This preview page is unavailable. Ask the agent to recreate it or close the comparison."})}catch{}return i(a,{theme:ep,children:[e(r,{}),e(eg,{...t})]})});
@@ -1,7 +1,7 @@
1
- import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{Box as a,Checkbox as n,Dialog as i,DialogActions as r,DialogContent as l,DialogTitle as s,Divider as c,FormControlLabel as d,Stack as p,TextField as f,Tooltip as u,Typography as m}from"@mui/material";import{jwtDecode as h}from"jwt-decode";import{useSnackbar as g}from"notistack";import{useEffect as b,useState as v}from"react";import{stringify as x}from"yaml";import{validateMockTemplateContent as k}from"#package/application-spec";import{useAccessServiceOverride as y,useBackendDataOverride as C,useConfiguratorModelVersion as D,useConfiguratorRawAccessInfo as w,useConfiguratorRawBackendData as S,useConfiguratorRawFrontendData as j,useConfiguratorRawPublishedData as M,useFrontendDataOverride as W,usePublishedDataOverride as z,useSessionContextOverride as E,useSessionService as I}from"#package/react-sdk";import{CollapsibleSection as A}from"../common/CollapsibleSection.js";import{EditorButton as F}from"../common/EditorButton.js";import{useOptionalDomain as P}from"../hooks/use-optional-runtime.js";import{useEditorConnection as T}from"../services/EditorConnectionContext.js";import{trpc as $}from"../services/trpc.js";import{useEditorMockContext as B}from"./EditorMockContext.js";import{ValidationErrorModal as O}from"./ValidationErrorModal.js";let R=({title:o,value:n,setValue:i,placeholder:r})=>t(a,{component:"div",sx:{display:"flex",alignItems:"center",gap:1},children:[e(m,{variant:"subtitle2",sx:{fontSize:"11px",fontWeight:600,color:"#495057",minWidth:"80px"},children:o}),e(f,{value:n,onChange:e=>{i(e.target.value)},fullWidth:!0,size:"small",placeholder:r,InputProps:{sx:{fontSize:"12px",fontFamily:"monospace",backgroundColor:"#fff",height:"32px","& input":{padding:"6px 12px"}}},sx:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"#90caf9"},"&.Mui-focused fieldset":{borderColor:"#1976d2"}}}})]}),V={fontFamily:"monospace",fontSize:"12px",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0,padding:1,backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:"4px"},N={fontSize:"10px",py:.25,px:1,fontWeight:600,minWidth:"auto"},U=({onClick:t})=>e(F,{variant:"secondary",sx:N,onClick:e=>{e.stopPropagation(),t()},children:"Copy"}),q=({label:t,checked:o,onChange:a})=>e(d,{control:e(n,{size:"small",checked:o,onChange:e=>{a(e.target.checked)},sx:{p:.5}}),label:t,sx:{ml:-.5,mr:0,"& .MuiFormControlLabel-label":{fontSize:"12px",color:"#212529"}}}),H=({title:t,original:o,edited:n,onChange:i,onCopy:r})=>{let[l,s]=v(!1),c=n??o;return e(A,{title:t,subtitle:void 0!==n?"edited":void 0,defaultExpanded:!0,actions:[e(F,{variant:"secondary",sx:N,onClick:e=>{e.stopPropagation(),s(!l)},children:l?"Done":"Edit"},"edit"),e(F,{variant:"secondary",sx:N,disabled:void 0===n,onClick:e=>{e.stopPropagation(),i(void 0)},children:"Reset"},"reset"),e(U,{onClick:()=>r(c)},"copy")],children:l?e(f,{value:c,onChange:e=>{i(e.target.value)},fullWidth:!0,multiline:!0,minRows:4,InputProps:{sx:{fontSize:"12px",fontFamily:"monospace",backgroundColor:"#fff",padding:1}},inputProps:{spellCheck:!1},sx:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"#90caf9"},"&.Mui-focused fieldset":{borderColor:"#1976d2"}}}}):e(a,{component:"pre",sx:V,children:c})})},K=({yaml:o,open:n,onClose:d})=>{let{enqueueSnackbar:f}=g(),{effectiveMockTemplates:u}=B(),{localMode:h,connectionStatus:x}=T(),y=$.saveMock.useMutation(),[C,D]=v(""),[w,S]=v(""),[j,M]=v(""),[W,z]=v(!0),[E,I]=v(!0),[A,P]=v(!0),[V,N]=v(""!==o.frontendData),[U,K]=v(""!==o.backendData),[L,Y]=v({}),[G,J]=v(null);b(()=>{Y({})},[o]);let Q=e=>t=>{Y(o=>{let a={...o};return void 0===t?delete a[e]:a[e]=t,a})},X={sessionAccess:L.sessionAccess??o.session+"\n"+o.access,configuration:L.configuration??o.configuration,publishedData:L.publishedData??o.publishedData,frontendData:L.frontendData??o.frontendData,backendData:L.backendData??o.backendData},Z=async e=>{try{await navigator.clipboard.writeText(e),f("Copied to clipboard!",{variant:"success"})}catch(e){f("Failed to copy to clipboard",{variant:"error"})}},_=()=>{let e,t=(e=`key: '${C}'
1
+ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{Box as a,Checkbox as n,Dialog as i,DialogActions as r,DialogContent as l,DialogTitle as s,Divider as c,FormControlLabel as d,Stack as p,TextField as f,Tooltip as u,Typography as m}from"@mui/material";import{useSnackbar as h}from"notistack";import{useEffect as g,useMemo as b,useState as v}from"react";import{stringify as x}from"yaml";import{validateMockTemplateContent as k}from"#package/application-spec";import{useAccessServiceOverride as C,useBackendDataOverride as y,useConfiguratorModelVersion as D,useConfiguratorRawAccessInfo as w,useConfiguratorRawBackendData as S,useConfiguratorRawFrontendData as j,useConfiguratorRawPublishedData as M,useFrontendDataOverride as W,usePublishedDataOverride as z,useRawSession as E,useSessionContextOverride as I}from"#package/react-sdk";import{CollapsibleSection as A}from"../common/CollapsibleSection.js";import{EditorButton as F}from"../common/EditorButton.js";import{useOptionalDomain as P}from"../hooks/use-optional-runtime.js";import{useEditorConnection as $}from"../services/EditorConnectionContext.js";import{trpc as B}from"../services/trpc.js";import{useEditorMockContext as O}from"./EditorMockContext.js";import{ValidationErrorModal as T}from"./ValidationErrorModal.js";let R=({title:o,value:n,setValue:i,placeholder:r})=>t(a,{component:"div",sx:{display:"flex",alignItems:"center",gap:1},children:[e(m,{variant:"subtitle2",sx:{fontSize:"11px",fontWeight:600,color:"#495057",minWidth:"80px"},children:o}),e(f,{value:n,onChange:e=>{i(e.target.value)},fullWidth:!0,size:"small",placeholder:r,InputProps:{sx:{fontSize:"12px",fontFamily:"monospace",backgroundColor:"#fff",height:"32px","& input":{padding:"6px 12px"}}},sx:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"#90caf9"},"&.Mui-focused fieldset":{borderColor:"#1976d2"}}}})]}),V={fontFamily:"monospace",fontSize:"12px",whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0,padding:1,backgroundColor:"#f8f9fa",border:"1px solid #e9ecef",borderRadius:"4px"},N={fontSize:"10px",py:.25,px:1,fontWeight:600,minWidth:"auto"},U=({onClick:t})=>e(F,{variant:"secondary",sx:N,onClick:e=>{e.stopPropagation(),t()},children:"Copy"}),H=({label:t,checked:o,onChange:a})=>e(d,{control:e(n,{size:"small",checked:o,onChange:e=>{a(e.target.checked)},sx:{p:.5}}),label:t,sx:{ml:-.5,mr:0,"& .MuiFormControlLabel-label":{fontSize:"12px",color:"#212529"}}}),K=({title:t,original:o,edited:n,onChange:i,onCopy:r})=>{let[l,s]=v(!1),c=n??o;return e(A,{title:t,subtitle:void 0!==n?"edited":void 0,defaultExpanded:!0,actions:[e(F,{variant:"secondary",sx:N,onClick:e=>{e.stopPropagation(),s(!l)},children:l?"Done":"Edit"},"edit"),e(F,{variant:"secondary",sx:N,disabled:void 0===n,onClick:e=>{e.stopPropagation(),i(void 0)},children:"Reset"},"reset"),e(U,{onClick:()=>r(c)},"copy")],children:l?e(f,{value:c,onChange:e=>{i(e.target.value)},fullWidth:!0,multiline:!0,minRows:4,InputProps:{sx:{fontSize:"12px",fontFamily:"monospace",backgroundColor:"#fff",padding:1}},inputProps:{spellCheck:!1},sx:{"& .MuiOutlinedInput-root":{"&:hover fieldset":{borderColor:"#90caf9"},"&.Mui-focused fieldset":{borderColor:"#1976d2"}}}}):e(a,{component:"pre",sx:V,children:c})})},L=({yaml:o,open:n,onClose:d})=>{let{enqueueSnackbar:f}=h(),{effectiveMockTemplates:u}=O(),{localMode:b,connectionStatus:x}=$(),C=B.saveMock.useMutation(),[y,D]=v(""),[w,S]=v(""),[j,M]=v(""),[W,z]=v(!0),[E,I]=v(!0),[A,P]=v(!0),[V,N]=v(""!==o.frontendData),[U,L]=v(""!==o.backendData),[Y,q]=v({}),[G,J]=v(null);g(()=>{q({})},[o]);let Q=e=>t=>{q(o=>{let a={...o};return void 0===t?delete a[e]:a[e]=t,a})},X={sessionAccess:Y.sessionAccess??o.session+"\n"+o.access,configuration:Y.configuration??o.configuration,publishedData:Y.publishedData??o.publishedData,frontendData:Y.frontendData??o.frontendData,backendData:Y.backendData??o.backendData},Z=async e=>{try{await navigator.clipboard.writeText(e),f("Copied to clipboard!",{variant:"success"})}catch(e){f("Failed to copy to clipboard",{variant:"error"})}},_=()=>{let e,t=(e=`key: '${y}'
2
2
  title: '${w}'
3
3
  description: '${j}'
4
4
  order: ${o.order.toString()}
5
5
  `,W&&(e+="\n"+X.sessionAccess+"\n"),E&&(e+="\n"+X.configuration),A&&(e+="\n"+X.publishedData),V&&(e+="\n"+X.frontendData),U&&(e+="\n"+X.backendData),e),a=k(t);return a.valid?t:(J(`The assembled mock template is not valid:
6
6
 
7
- ${a.errors.join("\n")}`),null)},ee=async()=>{let e=_();null!==e&&await Z(e)},et=async()=>{if(""===C)return void f("Enter a key for the mock file",{variant:"error"});let e=C+".yaml";if(u.find(e=>e.key===C))return void f(`A mock template '${e}' already exists`,{variant:"error"});if(h)return void f("Cannot save files in local mode",{variant:"error"});if("connected"!==x)return void f("Not connected to server. Cannot save file.",{variant:"error"});let t=_();if(null!==t)try{await y.mutateAsync({fileName:e,content:t}),f(`Mock file ${e} saved successfully!`,{variant:"success"})}catch(e){f(e instanceof Error?e.message:"Failed to save mock file",{variant:"error"})}};return t(i,{open:n,onClose:d,maxWidth:"md",fullWidth:!0,children:[e(s,{sx:{fontSize:"14px",fontWeight:600,py:1.5,px:2,borderBottom:"1px solid #e9ecef"},children:"Created Mock Data"}),e(l,{sx:{p:2},children:t(a,{component:"div",sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[t(a,{component:"div",sx:{display:"flex",flexDirection:"column",gap:1},children:[e(R,{title:"Key",value:C,setValue:D,placeholder:"e.g. 'regularUser', also in the filename"}),e(R,{title:"Title",value:w,setValue:S,placeholder:"e.g. 'Regular User'"}),e(R,{title:"Description",value:j,setValue:M,placeholder:"Human readable description of the mock data"}),t(a,{component:"div",sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[e(m,{variant:"subtitle2",sx:{fontSize:"11px",fontWeight:600,color:"#495057",minWidth:"80px"},children:"Include"}),e(q,{label:"Session & Access",checked:W,onChange:z}),e(q,{label:"Configuration",checked:E,onChange:I}),e(q,{label:"Published data",checked:A,onChange:P}),e(q,{label:"Frontend data",checked:V,onChange:N}),e(q,{label:"Backend data",checked:U,onChange:K})]})]}),e(c,{}),t(p,{direction:"column",spacing:1,children:[e(H,{title:"Session & Access",original:o.session+"\n"+o.access,edited:L.sessionAccess,onChange:Q("sessionAccess"),onCopy:e=>void Z(e)}),e(H,{title:"Configuration (entities)",original:o.configuration,edited:L.configuration,onChange:Q("configuration"),onCopy:e=>void Z(e)}),e(H,{title:"Published Data",original:o.publishedData,edited:L.publishedData,onChange:Q("publishedData"),onCopy:e=>void Z(e)}),""!==o.frontendData&&e(H,{title:"Frontend Data",original:o.frontendData,edited:L.frontendData,onChange:Q("frontendData"),onCopy:e=>void Z(e)}),""!==o.backendData&&e(H,{title:"Backend Data",original:o.backendData,edited:L.backendData,onChange:Q("backendData"),onCopy:e=>void Z(e)})]})]})}),t(r,{sx:{p:2,borderTop:"1px solid #e9ecef"},children:[e(F,{onClick:et,children:"Save to file"}),e(F,{onClick:ee,children:"Copy to clipboard"}),e(F,{onClick:d,children:"Close"})]}),e(O,{open:null!==G,error:G,onClose:()=>{J(null)}})]})};export const CreateMockYaml=()=>{let n=P(),i=D(),{effectiveMockTemplates:r}=B(),l=I(),s=w(),c=z(),d=W(),p=C(),f=M(),g=j(),k=S(),A=c??f,T=d??g,$=p??k,[O,R]=v([]),V=n?i:-1,[U,q]=v(""),[H,L]=v(),[Y,G]=v(),[J,Q]=v();b(()=>{(async()=>{var e;let t;G(((e=h(await l.requestSessionToken())).data&&"object"==typeof e.data&&("object"==typeof e.data.tags&&0===Object.keys(e.data.tags).length&&delete e.data.tags,t=e.data),{role:e.role,data:t}))})()},[l]);let X=E();b(()=>{Q(X??void 0)},[X]);let[Z,_]=v(),[ee,et]=v();b(()=>{_(s?.viewMode?"read-revision":"owner")},[s]);let eo=y();b(()=>{eo?et(eo.accessInfo.viewMode?"read-revision":"owner"):et(void 0)},[eo,eo?.accessInfo.viewMode]),b(()=>{if(!n)return void R([]);let e=n.storeSystem.stateSlices.committed.value.state;R([...e.entities]),q(e.rootEntityType);let t=n.storeSystem.stateSlices.committed.subscribe(e=>{R([...e.state.entities]),q(e.state.rootEntityType)});return()=>{t.unsubscribe()}},[n]);let[ea,en]=v(!1);return t(o,{children:[e(a,{component:"div",sx:{borderBottom:"1px solid #e9ecef",backgroundColor:"#f8f9fa",px:1.5,py:1,display:"flex",flexDirection:"column",gap:1.5,mb:0},children:t(a,{component:"div",sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e(m,{variant:"subtitle2",sx:{fontWeight:600,color:"#495057",fontSize:"12px"},children:"Create mock yaml from current state"}),e(u,{title:-1===V?"No configuration is loaded yet — load a configuration to capture its state":"Capture the current session, access, configuration and data as a mock template",placement:"left",arrow:!0,enterDelay:300,children:e("span",{children:e(F,{variant:"secondary",onClick:e=>{let t,o,a,n,i,l;e.stopPropagation(),t=x({session:{role:(J??Y)?.role??"anonymous",data:(J??Y)?.data??{}}}),o=x({access:{access:ee??Z??"owner"}}),a=x({configuration:{entities:O,modelVersion:V,rootEntityType:U}}),n=A&&Object.keys(A).length>=1?x({publishedData:{data:A}}):"",i=T&&Object.keys(T).length>=1?x({frontendData:{data:T}}):"",l=$&&Object.keys($).length>=1?x({backendData:{data:$}}):"",L({order:(r.length??0)+1,configuration:a,session:t,access:o,publishedData:n,frontendData:i,backendData:l}),en(!0)},sx:N,disabled:-1===V,children:"Create Mock"})})})]})}),H&&e(K,{yaml:H,open:ea,onClose:()=>{en(!1)}})]})};
7
+ ${a.errors.join("\n")}`),null)},ee=async()=>{let e=_();null!==e&&await Z(e)},et=async()=>{if(""===y)return void f("Enter a key for the mock file",{variant:"error"});let e=y+".yaml";if(u.find(e=>e.key===y))return void f(`A mock template '${e}' already exists`,{variant:"error"});if(b)return void f("Cannot save files in local mode",{variant:"error"});if("connected"!==x)return void f("Not connected to server. Cannot save file.",{variant:"error"});let t=_();if(null!==t)try{await C.mutateAsync({fileName:e,content:t}),f(`Mock file ${e} saved successfully!`,{variant:"success"})}catch(e){f(e instanceof Error?e.message:"Failed to save mock file",{variant:"error"})}};return t(i,{open:n,onClose:d,maxWidth:"md",fullWidth:!0,children:[e(s,{sx:{fontSize:"14px",fontWeight:600,py:1.5,px:2,borderBottom:"1px solid #e9ecef"},children:"Created Mock Data"}),e(l,{sx:{p:2},children:t(a,{component:"div",sx:{display:"flex",flexDirection:"column",gap:2,pt:1},children:[t(a,{component:"div",sx:{display:"flex",flexDirection:"column",gap:1},children:[e(R,{title:"Key",value:y,setValue:D,placeholder:"e.g. 'regularUser', also in the filename"}),e(R,{title:"Title",value:w,setValue:S,placeholder:"e.g. 'Regular User'"}),e(R,{title:"Description",value:j,setValue:M,placeholder:"Human readable description of the mock data"}),t(a,{component:"div",sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[e(m,{variant:"subtitle2",sx:{fontSize:"11px",fontWeight:600,color:"#495057",minWidth:"80px"},children:"Include"}),e(H,{label:"Session & Access",checked:W,onChange:z}),e(H,{label:"Configuration",checked:E,onChange:I}),e(H,{label:"Published data",checked:A,onChange:P}),e(H,{label:"Frontend data",checked:V,onChange:N}),e(H,{label:"Backend data",checked:U,onChange:L})]})]}),e(c,{}),t(p,{direction:"column",spacing:1,children:[e(K,{title:"Session & Access",original:o.session+"\n"+o.access,edited:Y.sessionAccess,onChange:Q("sessionAccess"),onCopy:e=>void Z(e)}),e(K,{title:"Configuration (entities)",original:o.configuration,edited:Y.configuration,onChange:Q("configuration"),onCopy:e=>void Z(e)}),e(K,{title:"Published Data",original:o.publishedData,edited:Y.publishedData,onChange:Q("publishedData"),onCopy:e=>void Z(e)}),""!==o.frontendData&&e(K,{title:"Frontend Data",original:o.frontendData,edited:Y.frontendData,onChange:Q("frontendData"),onCopy:e=>void Z(e)}),""!==o.backendData&&e(K,{title:"Backend Data",original:o.backendData,edited:Y.backendData,onChange:Q("backendData"),onCopy:e=>void Z(e)})]})]})}),t(r,{sx:{p:2,borderTop:"1px solid #e9ecef"},children:[e(F,{onClick:et,children:"Save to file"}),e(F,{onClick:ee,children:"Copy to clipboard"}),e(F,{onClick:d,children:"Close"})]}),e(T,{open:null!==G,error:G,onClose:()=>{J(null)}})]})};export const CreateMockYaml=()=>{let n=P(),i=D(),{effectiveMockTemplates:r}=O(),{sessionPayload:l}=E(),s=w(),c=z(),d=W(),p=y(),f=M(),h=j(),k=S(),A=c??f,$=d??h,B=p??k,[T,R]=v([]),V=n?i:-1,[U,H]=v(""),[K,Y]=v(),q=b(()=>null===l?void 0:(e=>{let{tags:t,...o}=e.data,a="object"==typeof t&&null!==t&&0===Object.keys(t).length;return{role:e.role,data:a?o:e.data}})(l),[l]),[G,J]=v(),Q=I();g(()=>{J(Q??void 0)},[Q]);let[X,Z]=v(),[_,ee]=v();g(()=>{Z(s?.viewMode?"read-revision":"owner")},[s]);let et=C();g(()=>{et?ee(et.accessInfo.viewMode?"read-revision":"owner"):ee(void 0)},[et,et?.accessInfo.viewMode]),g(()=>{if(!n)return void R([]);let e=n.storeSystem.stateSlices.committed.value.state;R([...e.entities]),H(e.rootEntityType);let t=n.storeSystem.stateSlices.committed.subscribe(e=>{R([...e.state.entities]),H(e.state.rootEntityType)});return()=>{t.unsubscribe()}},[n]);let[eo,ea]=v(!1);return t(o,{children:[e(a,{component:"div",sx:{borderBottom:"1px solid #e9ecef",backgroundColor:"#f8f9fa",px:1.5,py:1,display:"flex",flexDirection:"column",gap:1.5,mb:0},children:t(a,{component:"div",sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[e(m,{variant:"subtitle2",sx:{fontWeight:600,color:"#495057",fontSize:"12px"},children:"Create mock yaml from current state"}),e(u,{title:-1===V?"No configuration is loaded yet — load a configuration to capture its state":"Capture the current session, access, configuration and data as a mock template",placement:"left",arrow:!0,enterDelay:300,children:e("span",{children:e(F,{variant:"secondary",onClick:e=>{let t,o,a,n,i,l;e.stopPropagation(),t=x({session:{role:(G??q)?.role??"anonymous",data:(G??q)?.data??{}}}),o=x({access:{access:_??X??"owner"}}),a=x({configuration:{entities:T,modelVersion:V,rootEntityType:U}}),n=A&&Object.keys(A).length>=1?x({publishedData:{data:A}}):"",i=$&&Object.keys($).length>=1?x({frontendData:{data:$}}):"",l=B&&Object.keys(B).length>=1?x({backendData:{data:B}}):"",Y({order:(r.length??0)+1,configuration:a,session:t,access:o,publishedData:n,frontendData:i,backendData:l}),ea(!0)},sx:N,disabled:-1===V,children:"Create Mock"})})})]})}),K&&e(L,{yaml:K,open:eo,onClose:()=>{ea(!1)}})]})};
@@ -18,6 +18,8 @@ export interface EditorMockProviderProps {
18
18
  readonly children: React.ReactNode;
19
19
  readonly mockTemplates?: MockTemplateDefinition[];
20
20
  readonly autoApplyTemplate?: boolean;
21
+ /** Applied on mount in place of the stored template, without being stored. */
22
+ readonly initialTemplateKey?: string;
21
23
  readonly environmentKey?: string;
22
24
  }
23
25
  export declare const EditorMockProvider: (props: EditorMockProviderProps) => import("react/jsx-runtime").JSX.Element;