@salsita-ai/sdk 0.50.0-develop.97a772d197 → 0.50.0-develop.98166fe7c3

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 (1046) hide show
  1. package/README.md +14 -13
  2. package/dist/admin/create-admin-pages-from-spec.d.ts +1 -1
  3. package/dist/admin/default-admin-elements.d.ts +9 -0
  4. package/dist/admin/default-admin-elements.js +1 -0
  5. package/dist/admin/default-elements/built-in-entity-element.d.ts +10 -0
  6. package/dist/admin/default-elements/built-in-entity-element.js +1 -0
  7. package/dist/admin/default-elements/built-in-layout-element.d.ts +10 -0
  8. package/dist/admin/default-elements/built-in-layout-element.js +1 -0
  9. package/dist/admin/default-elements/index.d.ts +2 -0
  10. package/dist/admin/default-elements/index.js +1 -0
  11. package/dist/admin/index.d.ts +1 -0
  12. package/dist/admin/index.js +1 -1
  13. package/dist/application-spec/caching/content-diff.js +1 -1
  14. package/dist/application-spec/core/application-file.d.ts +0 -2
  15. package/dist/application-spec/core/application-file.js +1 -1
  16. package/dist/application-spec/core/components/component-filter.d.ts +53 -0
  17. package/dist/application-spec/core/components/component-filter.js +1 -0
  18. package/dist/application-spec/core/components/index.d.ts +2 -0
  19. package/dist/application-spec/core/components/index.js +1 -0
  20. package/dist/application-spec/core/components/sdk-code-ref.d.ts +9 -0
  21. package/dist/application-spec/core/components/sdk-code-ref.js +1 -0
  22. package/dist/application-spec/core/enhanced-json-value.d.ts +0 -68
  23. package/dist/application-spec/core/enhanced-json-value.js +1 -1
  24. package/dist/application-spec/core/expressions/index.d.ts +2 -0
  25. package/dist/application-spec/core/expressions/index.js +1 -0
  26. package/dist/application-spec/core/expressions/relation-expression-params.d.ts +11 -0
  27. package/dist/application-spec/core/expressions/sdk-expression-implementation.d.ts +24 -0
  28. package/dist/application-spec/core/expressions/sdk-expression-implementation.js +1 -0
  29. package/dist/application-spec/core/index.d.ts +2 -0
  30. package/dist/application-spec/core/index.js +1 -1
  31. package/dist/application-spec/core/json-value.d.ts +1 -1
  32. package/dist/application-spec/{core → enhanced-json}/eval-to-constant.d.ts +1 -1
  33. package/dist/application-spec/enhanced-json/index.d.ts +4 -0
  34. package/dist/application-spec/enhanced-json/index.js +1 -0
  35. package/dist/application-spec/enhanced-json/is-enhanced-json-array.d.ts +2 -0
  36. package/dist/application-spec/enhanced-json/is-enhanced-json-array.js +1 -0
  37. package/dist/application-spec/enhanced-json/resolve-enhanced-json-value.d.ts +18 -0
  38. package/dist/application-spec/enhanced-json/resolve-enhanced-json-value.js +1 -0
  39. package/dist/application-spec/enhanced-json/schema-from-value.d.ts +24 -0
  40. package/dist/application-spec/enhanced-json/schema-from-value.js +1 -0
  41. package/dist/application-spec/enhanced-json/stringify-enhanced-json-value.d.ts +14 -0
  42. package/dist/application-spec/enhanced-json/stringify-enhanced-json-value.js +1 -0
  43. package/dist/application-spec/enhanced-json/validate-enhanced-json-value-caps.d.ts +12 -0
  44. package/dist/application-spec/enhanced-json/validate-enhanced-json-value-caps.js +1 -0
  45. package/dist/application-spec/enhanced-json/validate-no-legacy-code-ref.d.ts +13 -0
  46. package/dist/application-spec/enhanced-json/validate-no-legacy-code-ref.js +1 -0
  47. package/dist/application-spec/errors/diagnostic-codes.d.ts +14 -0
  48. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  49. package/dist/application-spec/errors/diagnostic-messages.d.ts +17 -0
  50. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  51. package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
  52. package/dist/application-spec/generate-application/code/generate-application-code.d.ts +3 -2
  53. package/dist/application-spec/generate-application/code/generate-application-code.js +1 -1
  54. package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +19 -9
  55. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  56. package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +2 -2
  57. package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
  58. package/dist/application-spec/generate-application/code/templates/admin-config.js +3 -0
  59. package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -4
  60. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.js +4 -4
  61. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-defaults.d.ts +4 -2
  62. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-defaults.js +1 -1
  63. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +56 -56
  64. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.d.ts +1 -1
  65. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.js +1 -1
  66. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +3 -0
  67. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-relation-expressions.js +1 -1
  68. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.d.ts +6 -8
  69. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +11 -11
  70. package/dist/application-spec/generate-application/code/templates/domain-spec/index.d.ts +1 -1
  71. package/dist/application-spec/generate-application/code/templates/domain-spec/index.js +1 -1
  72. package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
  73. package/dist/application-spec/generate-application/code/templates/domain.js +3 -3
  74. package/dist/application-spec/generate-application/code/templates/eslint-config.d.ts +5 -0
  75. package/dist/application-spec/generate-application/code/templates/eslint-config.js +4 -5
  76. package/dist/application-spec/generate-application/code/templates/frontend-config.js +3 -5
  77. package/dist/application-spec/generate-application/code/templates/gitignore.js +0 -3
  78. package/dist/application-spec/generate-application/code/templates/globals.js +7 -4
  79. package/dist/application-spec/generate-application/code/templates/index.d.ts +3 -8
  80. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  81. package/dist/application-spec/generate-application/code/templates/lingui-rc.d.ts +5 -0
  82. package/dist/application-spec/generate-application/code/templates/lingui-rc.js +4 -4
  83. package/dist/application-spec/generate-application/code/templates/package-json.js +1 -1
  84. package/dist/application-spec/generate-application/code/templates/prettier-config.d.ts +5 -0
  85. package/dist/application-spec/generate-application/code/templates/prettier-config.js +4 -5
  86. package/dist/application-spec/generate-application/code/templates/root-tsconfig.d.ts +6 -0
  87. package/dist/application-spec/generate-application/code/templates/root-tsconfig.js +2 -0
  88. package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
  89. package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +66 -42
  90. package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +9 -3
  91. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
  92. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +24 -18
  93. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +6 -8
  94. package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.d.ts +58 -0
  95. package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.js +1 -0
  96. package/dist/application-spec/generate-application/code/templates/spec-code/index.d.ts +2 -0
  97. package/dist/application-spec/generate-application/code/templates/spec-code/index.js +1 -0
  98. package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.d.ts +18 -0
  99. package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.js +41 -0
  100. package/dist/application-spec/generate-application/code/templates/spec-messages/index.d.ts +1 -0
  101. package/dist/application-spec/generate-application/code/templates/spec-messages/index.js +1 -0
  102. package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.d.ts +20 -0
  103. package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.js +6 -0
  104. package/dist/application-spec/generate-application/code/templates/tsconfig.d.ts +5 -0
  105. package/dist/application-spec/generate-application/code/templates/tsconfig.js +1 -1
  106. package/dist/application-spec/generate-application/code/templates/webhook-builders.js +4 -3
  107. package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +6 -1
  108. package/dist/application-spec/generate-application/code/templates/webhook-index.js +10 -1
  109. package/dist/application-spec/generate-application/code/templates/webhooks-config.js +2 -3
  110. package/dist/application-spec/generate-application/index.d.ts +2 -0
  111. package/dist/application-spec/generate-application/index.js +1 -1
  112. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +4 -3
  113. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +7 -3
  114. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
  115. package/dist/application-spec/generate-application/runtime/admin-runtime/states-runtime.d.ts +2 -2
  116. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +13 -7
  117. package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
  118. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +4 -3
  119. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +6 -4
  120. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
  121. package/dist/application-spec/generate-application/runtime/configurator-runtime/states-runtime.d.ts +2 -2
  122. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.d.ts +43 -0
  123. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.js +1 -0
  124. package/dist/application-spec/generate-application/runtime/factory-data/index.d.ts +3 -0
  125. package/dist/application-spec/generate-application/runtime/factory-data/index.js +1 -0
  126. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.d.ts +13 -0
  127. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.js +1 -0
  128. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts +16 -0
  129. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js +1 -0
  130. package/dist/application-spec/generate-application/runtime/migrations/index.d.ts +1 -0
  131. package/dist/application-spec/generate-application/runtime/migrations/index.js +1 -0
  132. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.d.ts +53 -0
  133. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.js +1 -0
  134. package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +2 -2
  135. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.d.ts +1 -1
  136. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
  137. package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +2 -1
  138. package/dist/application-spec/generate-application/runtime/sections/data-runtime.d.ts +4 -4
  139. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +3 -2
  140. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  141. package/dist/application-spec/generate-application/runtime/sections/theme-runtime.d.ts +2 -2
  142. package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +4 -6
  143. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.d.ts +9 -0
  144. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.js +1 -0
  145. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.d.ts +8 -0
  146. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.js +1 -0
  147. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +27 -0
  148. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.js +1 -0
  149. package/dist/application-spec/generate-application/runtime-spec/index.d.ts +5 -0
  150. package/dist/application-spec/generate-application/runtime-spec/index.js +1 -0
  151. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +68 -0
  152. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -0
  153. package/dist/application-spec/generate-application/runtime-spec/spec-code-id.d.ts +40 -0
  154. package/dist/application-spec/generate-application/runtime-spec/spec-code-id.js +1 -0
  155. package/dist/application-spec/index.d.ts +1 -0
  156. package/dist/application-spec/index.js +1 -1
  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/categorize/module-analysis.d.ts +1 -1
  164. package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
  165. package/dist/application-spec/parse-application-files/raw-spec/parse-yaml-spec-file.js +1 -1
  166. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +16 -3
  167. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
  168. package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
  169. package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
  170. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  171. package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
  172. package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
  173. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.d.ts +3 -0
  174. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.js +1 -0
  175. package/dist/application-spec/parse-application-files/spec/common/value-type/index.d.ts +5 -0
  176. package/dist/application-spec/parse-application-files/spec/common/value-type/index.js +1 -0
  177. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.d.ts +6 -0
  178. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.js +1 -0
  179. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.d.ts +8 -0
  180. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.js +1 -0
  181. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.d.ts +10 -0
  182. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.js +1 -0
  183. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.d.ts +98 -0
  184. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.js +1 -0
  185. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.d.ts +13 -0
  186. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.js +1 -0
  187. package/dist/application-spec/parse-application-files/spec/components/bindings/index.d.ts +2 -0
  188. package/dist/application-spec/parse-application-files/spec/components/bindings/index.js +1 -1
  189. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.d.ts +24 -0
  190. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.js +1 -0
  191. package/dist/application-spec/parse-application-files/spec/components/component-entry.d.ts +1 -9
  192. package/dist/application-spec/parse-application-files/spec/components/component-entry.js +1 -1
  193. package/dist/application-spec/parse-application-files/spec/components/component-filter.d.ts +1 -54
  194. package/dist/application-spec/parse-application-files/spec/components/component-filter.js +1 -1
  195. package/dist/application-spec/parse-application-files/spec/components/component-state-type.d.ts +8 -0
  196. package/dist/application-spec/parse-application-files/spec/components/component-state-type.js +1 -0
  197. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.d.ts +13 -0
  198. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.js +1 -0
  199. package/dist/application-spec/parse-application-files/spec/components/index.d.ts +1 -1
  200. package/dist/application-spec/parse-application-files/spec/components/index.js +1 -1
  201. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.d.ts +14 -0
  202. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.js +1 -0
  203. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.d.ts +6 -0
  204. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.js +1 -1
  205. package/dist/application-spec/parse-application-files/spec/components/user-components.d.ts +7 -4
  206. package/dist/application-spec/parse-application-files/spec/components/user-components.js +1 -1
  207. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.d.ts +24 -0
  208. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.js +1 -0
  209. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.d.ts +13 -0
  210. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.js +1 -0
  211. package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.d.ts +9 -0
  212. package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.js +1 -0
  213. package/dist/application-spec/parse-application-files/spec/expressions/expression.d.ts +1 -28
  214. package/dist/application-spec/parse-application-files/spec/expressions/expression.js +1 -1
  215. package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +7 -3
  216. package/dist/application-spec/parse-application-files/spec/expressions/expressions.js +1 -1
  217. package/dist/application-spec/parse-application-files/spec/expressions/index.d.ts +0 -1
  218. package/dist/application-spec/parse-application-files/spec/expressions/index.js +1 -1
  219. package/dist/application-spec/parse-application-files/spec/expressions/memo-eval-plan.js +1 -1
  220. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.d.ts +3 -1
  221. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.js +1 -1
  222. package/dist/application-spec/parse-application-files/spec/invariants/invariants.d.ts +2 -2
  223. package/dist/application-spec/parse-application-files/spec/invariants/invariants.js +1 -1
  224. package/dist/application-spec/parse-application-files/spec/model/defaults.d.ts +7 -2
  225. package/dist/application-spec/parse-application-files/spec/model/defaults.js +1 -1
  226. package/dist/application-spec/parse-application-files/spec/model/index.d.ts +1 -0
  227. package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
  228. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.d.ts +10 -0
  229. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.js +1 -0
  230. package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.d.ts +25 -0
  231. package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.js +1 -0
  232. package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.d.ts +46 -0
  233. package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.js +1 -0
  234. package/dist/application-spec/parse-application-files/spec/relations/relations.d.ts +4 -3
  235. package/dist/application-spec/parse-application-files/spec/relations/relations.js +1 -1
  236. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
  237. package/dist/application-spec/parse-application-files/spec/sections/infra.d.ts +2 -0
  238. package/dist/application-spec/parse-application-files/spec/sections/infra.js +1 -1
  239. package/dist/client/authorized-client.d.ts +3 -1
  240. package/dist/client/authorized-client.js +1 -1
  241. package/dist/client/contract.d.ts +34 -0
  242. package/dist/client/contract.js +1 -1
  243. package/dist/client/index.d.ts +2 -2
  244. package/dist/client/index.js +1 -1
  245. package/dist/client/local-authorized-client.d.ts +3 -1
  246. package/dist/client/local-authorized-client.js +1 -1
  247. package/dist/client/memory-authorized-client.d.ts +3 -1
  248. package/dist/client/memory-authorized-client.js +1 -1
  249. package/dist/client/phoenix-api.d.ts +797 -121
  250. package/dist/configurator/application-runtime/extensions/create-configurator-extensions.js +1 -1
  251. package/dist/configurator/application-runtime/extensions/selectors.d.ts +3 -1
  252. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  253. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +126 -2
  254. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  255. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +7 -1
  256. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  257. package/dist/configurator/application-runtime/extensions/systems/drag-and-drop-system/drag-and-drop-system.d.ts +3 -3
  258. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +20 -4
  259. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  260. package/dist/configurator/application-runtime/extensions/systems/graphql-system/inject-assistant-lenses.d.ts +11 -0
  261. package/dist/configurator/application-runtime/extensions/systems/graphql-system/inject-assistant-lenses.js +1 -0
  262. package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -1
  263. package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.d.ts +2 -2
  264. package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.js +1 -1
  265. package/dist/configurator/common/configurator-interface.d.ts +26 -1
  266. package/dist/configurator/common/configurator-interface.js +1 -1
  267. package/dist/configurator/common/frontend-analytics.d.ts +2 -0
  268. package/dist/configurator/common/frontend-analytics.js +1 -1
  269. package/dist/configurator/common/index.d.ts +2 -0
  270. package/dist/configurator/common/index.js +1 -1
  271. package/dist/configurator/common/use-finalize-action.d.ts +31 -0
  272. package/dist/configurator/common/use-finalize-action.js +1 -0
  273. package/dist/configurator/common/use-reset-camera.d.ts +6 -0
  274. package/dist/configurator/common/use-reset-camera.js +1 -0
  275. package/dist/configurator/configurator-context/configurator-hooks/layout-hooks.d.ts +1 -1
  276. package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +7 -0
  277. package/dist/configurator/pages/DefaultConfiguratorLayout.js +1 -0
  278. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  279. package/dist/configurator/pages/configurator-layout-name.d.ts +2 -0
  280. package/dist/configurator/pages/configurator-layout-name.js +1 -0
  281. package/dist/configurator/pages/default-configurator-elements.d.ts +8 -0
  282. package/dist/configurator/pages/default-configurator-elements.js +1 -0
  283. package/dist/configurator/pages/default-elements/built-in-entity-element.d.ts +10 -0
  284. package/dist/configurator/pages/default-elements/built-in-entity-element.js +1 -0
  285. package/dist/configurator/pages/default-elements/built-in-layout-element.d.ts +10 -0
  286. package/dist/configurator/pages/default-elements/built-in-layout-element.js +1 -0
  287. package/dist/configurator/pages/default-elements/domain-control-elements.d.ts +6 -0
  288. package/dist/configurator/pages/default-elements/domain-control-elements.js +1 -0
  289. package/dist/configurator/pages/default-elements/index.d.ts +4 -0
  290. package/dist/configurator/pages/default-elements/index.js +1 -0
  291. package/dist/configurator/pages/default-elements/recipe-panel-elements.d.ts +3 -0
  292. package/dist/configurator/pages/default-elements/recipe-panel-elements.js +1 -0
  293. package/dist/configurator/pages/default-elements/sidebar-footer-elements.d.ts +7 -0
  294. package/dist/configurator/pages/default-elements/sidebar-footer-elements.js +1 -0
  295. package/dist/configurator/pages/default-elements/toolbar-elements.d.ts +7 -0
  296. package/dist/configurator/pages/default-elements/toolbar-elements.js +1 -0
  297. package/dist/configurator/pages/index.d.ts +1 -0
  298. package/dist/configurator/pages/index.js +1 -1
  299. package/dist/configurator/scene/scene-controls/hotspot-drag-handle/HotspotDragHandle.d.ts +1 -1
  300. package/dist/configurator/scene/scene-controls/hotspot-drag-handle/HotspotDragSceneHandle.d.ts +1 -1
  301. package/dist/configurator/scene/scene-entity/dimension-indicators/DimensionIndicator.d.ts +1 -1
  302. package/dist/configurator/scene/scene-entity/dimension-indicators/DimensionIndicatorInternal.d.ts +1 -1
  303. package/dist/configurator/scene/scene-entity/drag-and-drop/shared.d.ts +2 -2
  304. package/dist/configurator/scene/scene-entity/drag-and-drop/use-drag-object.d.ts +1 -1
  305. package/dist/configurator/scene/scene-entity/materials/RemoteReplacedMaterial.js +1 -1
  306. package/dist/configurator/scene/scene-entity/objects/SceneEntityObjectTextDecal.d.ts +1 -1
  307. package/dist/configurator/ui/assistant/AssistantChips.d.ts +8 -2
  308. package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
  309. package/dist/configurator/ui/assistant/AssistantComposer.d.ts +2 -1
  310. package/dist/configurator/ui/assistant/AssistantComposer.js +1 -1
  311. package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +7 -2
  312. package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
  313. package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
  314. package/dist/configurator/ui/assistant/AssistantThread.d.ts +6 -2
  315. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  316. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +13 -0
  317. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -0
  318. package/dist/configurator/ui/assistant/entity-link/entity-link-selection.d.ts +22 -0
  319. package/dist/configurator/ui/assistant/entity-link/entity-link-selection.js +1 -0
  320. package/dist/configurator/ui/assistant/entity-link/entity-link-state.d.ts +27 -0
  321. package/dist/configurator/ui/assistant/entity-link/entity-link-state.js +1 -0
  322. package/dist/configurator/ui/assistant/entity-link/index.d.ts +2 -0
  323. package/dist/configurator/ui/assistant/entity-link/index.js +1 -0
  324. package/dist/configurator/ui/assistant/form/AssistantForm.d.ts +19 -0
  325. package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -0
  326. package/dist/configurator/ui/assistant/form/built-in-form-registry.d.ts +10 -0
  327. package/dist/configurator/ui/assistant/form/built-in-form-registry.js +1 -0
  328. package/dist/configurator/ui/assistant/form/compose-answer.d.ts +11 -0
  329. package/dist/configurator/ui/assistant/form/compose-answer.js +1 -0
  330. package/dist/configurator/ui/assistant/form/describe-build-errors.d.ts +6 -0
  331. package/dist/configurator/ui/assistant/form/describe-build-errors.js +1 -0
  332. package/dist/configurator/ui/assistant/form/form-element-definition.d.ts +14 -0
  333. package/dist/configurator/ui/assistant/form/form-element-definition.js +1 -0
  334. package/dist/configurator/ui/assistant/form/form-model.d.ts +38 -0
  335. package/dist/configurator/ui/assistant/form/form-model.js +1 -0
  336. package/dist/configurator/ui/assistant/form/form-registry.d.ts +31 -0
  337. package/dist/configurator/ui/assistant/form/form-registry.js +8 -0
  338. package/dist/configurator/ui/assistant/form/form-state.d.ts +4 -0
  339. package/dist/configurator/ui/assistant/form/form-state.js +1 -0
  340. package/dist/configurator/ui/assistant/form/index.d.ts +2 -0
  341. package/dist/configurator/ui/assistant/form/index.js +1 -0
  342. package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +9 -0
  343. package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -0
  344. package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +13 -0
  345. package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -0
  346. package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +3 -0
  347. package/dist/configurator/ui/assistant/form-elements/FormGroup.js +1 -0
  348. package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +3 -0
  349. package/dist/configurator/ui/assistant/form-elements/FormOptions.js +1 -0
  350. package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +3 -0
  351. package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -0
  352. package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +3 -0
  353. package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -0
  354. package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +34 -0
  355. package/dist/configurator/ui/assistant/form-elements/form-element-props.js +1 -0
  356. package/dist/configurator/ui/assistant/form-elements/index.d.ts +5 -0
  357. package/dist/configurator/ui/assistant/form-elements/index.js +1 -0
  358. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.d.ts +16 -0
  359. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.js +1 -0
  360. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.d.ts +34 -0
  361. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.js +1 -0
  362. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.d.ts +25 -0
  363. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.js +1 -0
  364. package/dist/configurator/ui/assistant/reference-link/index.d.ts +3 -0
  365. package/dist/configurator/ui/assistant/reference-link/index.js +1 -0
  366. package/dist/configurator/ui/assistant/reference-link/reference-styles.d.ts +12 -0
  367. package/dist/configurator/ui/assistant/reference-link/reference-styles.js +1 -0
  368. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.d.ts +8 -0
  369. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.js +1 -0
  370. package/dist/configurator/ui/assistant/streamed-markdown.d.ts +2 -0
  371. package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
  372. package/dist/configurator/ui/assistant/thread-items.d.ts +21 -3
  373. package/dist/configurator/ui/assistant/thread-items.js +1 -1
  374. package/dist/configurator/ui/configurator-layout/sidebar-keys/index.d.ts +1 -0
  375. package/dist/configurator/ui/configurator-layout/sidebar-keys/index.js +1 -0
  376. package/dist/configurator/ui/configurator-layout/sidebar-keys/sidebar-keys.d.ts +11 -0
  377. package/dist/configurator/ui/configurator-layout/sidebar-keys/sidebar-keys.js +1 -0
  378. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/DesktopSidebar.d.ts +101 -0
  379. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/DesktopSidebar.js +16 -0
  380. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/index.d.ts +1 -0
  381. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/index.js +1 -0
  382. package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.d.ts +4 -4
  383. package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.js +1 -1
  384. package/dist/configurator/ui/configurator-layout/slots/services/SideEffects.d.ts +3 -6
  385. package/dist/configurator/ui/configurator-layout/slots/services/SideEffects.js +1 -1
  386. package/dist/configurator/ui/configurator-layout/slots/slots.d.ts +1 -0
  387. package/dist/configurator/ui/configurator-layout/slots/slots.js +1 -1
  388. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.d.ts +0 -74
  389. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.js +5 -20
  390. package/dist/configurator/ui/configurator-layout/universal/DesktopPreview.js +1 -1
  391. package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +4 -4
  392. package/dist/configurator/ui/configurator-layout/universal/MobilePreview.js +1 -1
  393. package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.d.ts +47 -0
  394. package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -0
  395. package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.d.ts +11 -26
  396. package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.js +1 -1
  397. package/dist/configurator/ui/legacy/layout/steps/StepsNavigation.d.ts +2 -2
  398. package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.d.ts +2 -2
  399. package/dist/docs/complex-use-cases/filtered-controls-with-fix-dialog.mdx +16 -19
  400. package/dist/docs/complex-use-cases/sketching.mdx +0 -38
  401. package/dist/docs/controls/select-attribute/cardselect.mdx +9 -13
  402. package/dist/docs/controls/select-child-entity/cardselect.mdx +1 -0
  403. package/dist/docs/dimensions/3d-scene-integration/dimension-indicators.mdx +2 -2
  404. package/dist/docs/dimensions/3d-scene-integration/editable-angle-indicator.mdx +1 -1
  405. package/dist/docs/dimensions/3d-scene-integration/editable-distance-dimension-indicator.mdx +1 -1
  406. package/dist/docs/dimensions/3d-scene-integration/list-selector-dimension-indicator.mdx +1 -1
  407. package/dist/docs/drag-and-drop/drag-handle.mdx +1 -1
  408. package/dist/docs/drag-and-drop/hotspot-handle.mdx +1 -1
  409. package/dist/docs/drag-and-drop/planes.mdx +1 -1
  410. package/dist/docs/drag-and-drop/rotatable.mdx +2 -2
  411. package/dist/docs/fabs/basic.mdx +2 -2
  412. package/dist/docs/index.json +42 -1
  413. package/dist/docs/integrations/woocommerce/local-development.mdx +1 -1
  414. package/dist/docs/layouts/custom-layout.mdx +2434 -0
  415. package/dist/docs/layouts/header/fixed.mdx +2 -2
  416. package/dist/docs/layouts/header/floating.mdx +2 -2
  417. package/dist/docs/layouts/sidebar/in-a-custom-layout.mdx +380 -0
  418. package/dist/docs/layouts/sidebar-footer/basic.mdx +32 -77
  419. package/dist/docs/other-features/client-side-rendering/declarative.mdx +1 -1
  420. package/dist/docs/other-features/side-effects.mdx +8 -11
  421. package/dist/docs/other-features/transformers.mdx +4 -0
  422. package/dist/docs/other-features/violation-messages.mdx +52 -56
  423. package/dist/docs/phoenix/application-states.mdx +9 -7
  424. package/dist/docs/phoenix/components.mdx +6 -0
  425. package/dist/docs/phoenix/configurator-interface.mdx +237 -80
  426. package/dist/docs/phoenix/deployments.mdx +2 -6
  427. package/dist/docs/phoenix/domain-model.mdx +6 -0
  428. package/dist/docs/phoenix/expression-context.mdx +11 -3
  429. package/dist/docs/phoenix/finalization.mdx +1 -1
  430. package/dist/docs/phoenix/getting-started.mdx +3 -2
  431. package/dist/docs/phoenix/layout-slots.mdx +116 -0
  432. package/dist/docs/phoenix/localization.mdx +10 -6
  433. package/dist/docs/phoenix/migration-guide.mdx +21 -8
  434. package/dist/docs/phoenix/phoenix-cli.mdx +73 -37
  435. package/dist/docs/phoenix/project-structure.mdx +46 -20
  436. package/dist/docs/phoenix/quickstart.mdx +2 -2
  437. package/dist/docs/phoenix/sdk-builder-workflow.mdx +3 -3
  438. package/dist/docs/phoenix/testing.mdx +140 -0
  439. package/dist/docs/phoenix/webhook-membership.mdx +10 -9
  440. package/dist/docs/phoenix/webhooks.mdx +23 -6
  441. package/dist/docs/ux-guidelines/choosing-a-control.mdx +11 -0
  442. package/dist/domain/admin-domain/implementation/common-admin-expressions.d.ts +26 -11
  443. package/dist/domain/admin-domain/implementation/common-admin-publish.d.ts +1 -2
  444. package/dist/domain/admin-domain/index.d.ts +7 -2
  445. package/dist/domain/admin-domain/index.js +1 -1
  446. package/dist/domain/application/GetApplicationWrapperHandler.d.ts +2 -2
  447. package/dist/domain/application/GetThemeHandler.d.ts +1 -1
  448. package/dist/domain/application/GetWebComponentOptions.d.ts +1 -1
  449. package/dist/domain/application/admin-page-factories.d.ts +1 -2
  450. package/dist/domain/application/application-config.d.ts +9 -26
  451. package/dist/domain/application/assistant/assistant-fields.d.ts +12 -0
  452. package/dist/domain/application/assistant/assistant-fields.js +1 -0
  453. package/dist/domain/application/assistant/assistant-form-elements.d.ts +28 -0
  454. package/dist/domain/application/assistant/assistant-form-elements.js +1 -0
  455. package/dist/domain/application/assistant/assistant-manifest.d.ts +9 -1
  456. package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +38 -2
  457. package/dist/domain/application/assistant/assistant-resolved-manifest.js +1 -1
  458. package/dist/domain/application/assistant/build-assistant-lenses.d.ts +14 -0
  459. package/dist/domain/application/assistant/build-assistant-lenses.js +5 -0
  460. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
  461. package/dist/domain/application/assistant/create-assistant-execution-schema.d.ts +32 -0
  462. package/dist/domain/application/assistant/create-assistant-execution-schema.js +1 -0
  463. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  464. package/dist/domain/application/assistant/index.d.ts +8 -1
  465. package/dist/domain/application/assistant/index.js +1 -1
  466. package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.d.ts +20 -0
  467. package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.js +1 -0
  468. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.d.ts +10 -0
  469. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -0
  470. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +48 -0
  471. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -0
  472. package/dist/domain/application/assistant/session-setup/create-session-assistant.d.ts +15 -0
  473. package/dist/domain/application/assistant/session-setup/create-session-assistant.js +1 -0
  474. package/dist/domain/application/assistant/session-setup/index.d.ts +4 -0
  475. package/dist/domain/application/assistant/session-setup/index.js +1 -0
  476. package/dist/domain/application/assistant-mutations.d.ts +2 -1
  477. package/dist/domain/application/assistant-recipe-groups.d.ts +4 -2
  478. package/dist/domain/application/configurator-builder.d.ts +5 -2
  479. package/dist/domain/application/configurator-builder.js +1 -1
  480. package/dist/domain/application/create-initial-published-data.d.ts +6 -7
  481. package/dist/domain/application/index.d.ts +1 -5
  482. package/dist/domain/application/index.js +1 -1
  483. package/dist/domain/application/published-data/DataRowValidatorHandler.d.ts +1 -1
  484. package/dist/domain/application/published-data/FilterPublishedChunksHandler.d.ts +1 -1
  485. package/dist/domain/application/published-data/MapPublishedChunkedDataHandler.d.ts +1 -1
  486. package/dist/domain/application/published-data/MapPublishedRevisionDataHandler.d.ts +1 -1
  487. package/dist/domain/application/published-data/SheetValidatorHandler.d.ts +1 -1
  488. package/dist/domain/application/published-data/build-legend-data.d.ts +1 -1
  489. package/dist/domain/application/published-data/format-field-type.d.ts +1 -1
  490. package/dist/domain/application/published-data/map-data-to-sheet.d.ts +1 -1
  491. package/dist/domain/application/published-data/map-published-chunked-data.d.ts +3 -3
  492. package/dist/domain/application/published-data/map-published-data.d.ts +7 -3
  493. package/dist/domain/application/published-data/validate-sheet-data.d.ts +1 -1
  494. package/dist/domain/available-system-components.js +1 -1
  495. package/dist/domain/core/action/action-factory.d.ts +2 -2
  496. package/dist/domain/core/action/action.d.ts +19 -14
  497. package/dist/domain/core/component/domain-component-optic.d.ts +29 -40
  498. package/dist/domain/core/component/domain-component-optic.js +2 -2
  499. package/dist/domain/core/component/legacy-filter.d.ts +2 -17
  500. package/dist/domain/core/component/system-component-filter.d.ts +36 -18
  501. package/dist/domain/core/data-schema/data-cell-value.d.ts +4 -0
  502. package/dist/domain/core/data-schema/data-cell-value.js +1 -0
  503. package/dist/domain/core/data-schema/data-schema-array-field.d.ts +5 -0
  504. package/dist/domain/core/data-schema/data-schema-array-field.js +1 -0
  505. package/dist/domain/core/data-schema/data-schema-field-object.d.ts +4 -0
  506. package/dist/domain/core/data-schema/data-schema-field-object.js +1 -0
  507. package/dist/domain/core/data-schema/data-schema-field.d.ts +2 -0
  508. package/dist/domain/core/data-schema/data-schema-field.js +1 -0
  509. package/dist/domain/core/data-schema/data-schema-localized-field.d.ts +4 -0
  510. package/dist/domain/core/data-schema/data-schema-localized-field.js +1 -0
  511. package/dist/domain/core/data-schema/data-schema-primitive-field.d.ts +5 -0
  512. package/dist/domain/core/data-schema/data-schema-primitive-field.js +1 -0
  513. package/dist/domain/core/data-schema/data-schema.d.ts +2 -0
  514. package/dist/domain/core/data-schema/data-schema.js +1 -0
  515. package/dist/domain/core/data-schema/index.d.ts +7 -0
  516. package/dist/domain/core/data-schema/index.js +1 -0
  517. package/dist/domain/core/domain.d.ts +2 -2
  518. package/dist/domain/core/emission/index.d.ts +8 -0
  519. package/dist/domain/core/emission/index.js +1 -0
  520. package/dist/domain/core/emission/reset-state-emission.d.ts +12 -0
  521. package/dist/domain/core/emission/reset-state-emission.js +1 -0
  522. package/dist/domain/core/emission/state-emission.d.ts +4 -0
  523. package/dist/domain/core/emission/state-emission.js +1 -0
  524. package/dist/domain/core/emission/state-update-emission.d.ts +14 -0
  525. package/dist/domain/core/emission/state-update-emission.js +1 -0
  526. package/dist/domain/core/emission/state-validation-result.d.ts +18 -0
  527. package/dist/domain/core/emission/state-validation-result.js +1 -0
  528. package/dist/domain/core/emission/transformation-log.d.ts +2 -0
  529. package/dist/domain/core/emission/transformation-log.js +1 -0
  530. package/dist/domain/core/emission/transformer-log-entry.d.ts +6 -0
  531. package/dist/domain/core/emission/transformer-log-entry.js +1 -0
  532. package/dist/domain/core/emission/transformer-log.d.ts +11 -0
  533. package/dist/domain/core/emission/transformer-log.js +1 -0
  534. package/dist/domain/core/emission/transformer-phase.d.ts +1 -0
  535. package/dist/domain/core/emission/transformer-phase.js +1 -0
  536. package/dist/domain/core/expression/aliased-expressions.d.ts +2 -2
  537. package/dist/domain/core/expression/constant-expressions.d.ts +16 -8
  538. package/dist/domain/core/expression/constant-expressions.js +1 -1
  539. package/dist/domain/core/expression/custom-expression.d.ts +20 -7
  540. package/dist/domain/core/expression/custom-expression.js +1 -1
  541. package/dist/domain/core/expression/expression.d.ts +15 -17
  542. package/dist/domain/core/index.d.ts +2 -0
  543. package/dist/domain/core/invariant/custom-invariants.d.ts +8 -16
  544. package/dist/domain/core/invariant/index.d.ts +1 -1
  545. package/dist/domain/core/invariant/index.js +1 -1
  546. package/dist/domain/core/invariant/invariants.d.ts +4 -70
  547. package/dist/domain/core/invariant/invariants.js +1 -1
  548. package/dist/domain/core/invariant/violation.d.ts +51 -3
  549. package/dist/domain/core/invariant/violation.js +1 -1
  550. package/dist/domain/core/model/model.d.ts +1 -1
  551. package/dist/domain/core/recipe/recipes.d.ts +18 -50
  552. package/dist/domain/core/recipe/recipes.js +1 -1
  553. package/dist/domain/core/relation/all-of-type-relation.d.ts +8 -21
  554. package/dist/domain/core/relation/all-of-type-relation.js +1 -1
  555. package/dist/domain/core/relation/direct-relation.d.ts +13 -24
  556. package/dist/domain/core/relation/index.d.ts +0 -1
  557. package/dist/domain/core/relation/indirect-relation.d.ts +12 -67
  558. package/dist/domain/core/relation/indirect-relation.js +1 -1
  559. package/dist/domain/core/relation/reference-component.d.ts +2 -2
  560. package/dist/domain/core/relation/relation-factory.d.ts +19 -15
  561. package/dist/domain/core/relation/relation-factory.js +1 -1
  562. package/dist/domain/core/schema/extended-schema-validator.js +1 -1
  563. package/dist/domain/core/state/migrations.d.ts +14 -45
  564. package/dist/domain/core/state/migrations.js +1 -1
  565. package/dist/domain/core/state/state.d.ts +1 -1
  566. package/dist/domain/domain-builder.d.ts +1 -1
  567. package/dist/domain/domain-builder.js +1 -1
  568. package/dist/domain/domain-context/action-system/action-system.d.ts +2 -2
  569. package/dist/domain/domain-context/action-system/action-system.js +1 -1
  570. package/dist/domain/domain-context/action-system/index.d.ts +1 -0
  571. package/dist/domain/domain-context/action-system/index.js +1 -0
  572. package/dist/domain/domain-context/analytics-system/index.d.ts +2 -0
  573. package/dist/domain/domain-context/analytics-system/index.js +1 -0
  574. package/dist/domain/domain-context/create-transformer.d.ts +1 -1
  575. package/dist/domain/domain-context/dimension-system/dimension-system.d.ts +2 -2
  576. package/dist/domain/domain-context/dimension-system/dimension-system.js +1 -1
  577. package/dist/domain/domain-context/dimension-system/index.d.ts +1 -0
  578. package/dist/domain/domain-context/dimension-system/index.js +1 -0
  579. package/dist/domain/domain-context/domain-context-systems.d.ts +7 -7
  580. package/dist/domain/domain-context/index.d.ts +8 -17
  581. package/dist/domain/domain-context/index.js +1 -1
  582. package/dist/domain/domain-context/navigation-system/index.d.ts +3 -0
  583. package/dist/domain/domain-context/navigation-system/index.js +1 -0
  584. package/dist/domain/domain-context/navigation-system/navigation-system.d.ts +2 -3
  585. package/dist/domain/domain-context/navigation-system/navigation-system.js +1 -1
  586. package/dist/domain/domain-context/navigation-system/selection-transformers.d.ts +1 -1
  587. package/dist/domain/domain-context/recipe-system/index.d.ts +1 -0
  588. package/dist/domain/domain-context/recipe-system/index.js +1 -0
  589. package/dist/domain/domain-context/recipe-system/recipe-cooker-system.d.ts +1 -1
  590. package/dist/domain/domain-context/recipe-system/recipe-cooker-system.js +1 -1
  591. package/dist/domain/domain-context/relation-transformers/cascade-deletes.d.ts +2 -2
  592. package/dist/domain/domain-context/relation-transformers/cascade-ref-pruning.d.ts +2 -2
  593. package/dist/domain/domain-context/relation-transformers/create-entity-refs.d.ts +2 -2
  594. package/dist/domain/domain-context/relation-transformers/index.d.ts +4 -0
  595. package/dist/domain/domain-context/relation-transformers/index.js +1 -0
  596. package/dist/domain/domain-context/relation-transformers/replace-refs.d.ts +2 -2
  597. package/dist/domain/domain-context/store-system/index.d.ts +4 -0
  598. package/dist/domain/domain-context/store-system/index.js +1 -0
  599. package/dist/domain/domain-context/store-system/reconcile-projected-entities.js +1 -1
  600. package/dist/domain/domain-context/store-system/store-system.d.ts +2 -35
  601. package/dist/domain/domain-context/store-system/store-system.js +2 -2
  602. package/dist/domain/domain-context/store-system/system-state.d.ts +1 -1
  603. package/dist/domain/domain-context/transformers/actions-builder.js +1 -1
  604. package/dist/domain/domain-context/transformers/auto-snap-transformer.d.ts +5 -7
  605. package/dist/domain/domain-context/transformers/auto-snap-transformer.js +1 -1
  606. package/dist/domain/domain-context/transformers/chain-builder.d.ts +1 -1
  607. package/dist/domain/domain-context/transformers/context.d.ts +2 -3
  608. package/dist/domain/domain-context/transformers/context.js +1 -1
  609. package/dist/domain/domain-context/transformers/entity-builder.js +1 -1
  610. package/dist/domain/domain-context/transformers/index.d.ts +1 -1
  611. package/dist/domain/domain-context/transformers/index.js +1 -1
  612. package/dist/domain/domain-context/transformers/when-builder.d.ts +2 -3
  613. package/dist/domain/domain-context/transformers/when-builder.js +1 -1
  614. package/dist/domain/domain-context/undo-system.d.ts +29 -3
  615. package/dist/domain/domain-context/undo-system.js +1 -1
  616. package/dist/domain/domain-runtime/access/selectors.d.ts +9 -0
  617. package/dist/domain/domain-runtime/access/selectors.js +1 -1
  618. package/dist/domain/domain-runtime/access/types.d.ts +2 -0
  619. package/dist/domain/domain-runtime/access/types.js +1 -1
  620. package/dist/domain/domain-runtime/domain-context/action-context.d.ts +11 -0
  621. package/dist/domain/domain-runtime/domain-context/action-context.js +1 -0
  622. package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
  623. package/dist/domain/domain-runtime/domain-context/expression-context.d.ts +8 -0
  624. package/dist/domain/domain-runtime/domain-context/expression-context.js +1 -0
  625. package/dist/domain/domain-runtime/domain-context/index.d.ts +3 -0
  626. package/dist/domain/domain-runtime/domain-context/runtime-expression-context.d.ts +18 -0
  627. package/dist/domain/domain-runtime/domain-context/runtime-expression-context.js +1 -0
  628. package/dist/domain/domain-runtime/domain-context/selectors.d.ts +18 -22
  629. package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
  630. package/dist/domain/domain-runtime/domain-context/types.d.ts +4 -1
  631. package/dist/domain/domain-runtime/domain-runtime.d.ts +84 -68
  632. package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +19 -0
  633. package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -0
  634. package/dist/domain/domain-runtime/errors/implementation-error.d.ts +46 -0
  635. package/dist/domain/domain-runtime/errors/implementation-error.js +1 -0
  636. package/dist/domain/domain-runtime/errors/implementation-errors.d.ts +13 -0
  637. package/dist/domain/domain-runtime/errors/implementation-errors.js +1 -0
  638. package/dist/domain/domain-runtime/errors/index.d.ts +4 -0
  639. package/dist/domain/domain-runtime/errors/index.js +1 -0
  640. package/dist/domain/domain-runtime/errors/to-implementation-errors.d.ts +10 -0
  641. package/dist/domain/domain-runtime/errors/to-implementation-errors.js +1 -0
  642. package/dist/domain/domain-runtime/index.d.ts +1 -0
  643. package/dist/domain/domain-runtime/index.js +1 -1
  644. package/dist/domain/domain-runtime/spec/create-violation-expressions.d.ts +24 -0
  645. package/dist/domain/domain-runtime/spec/create-violation-expressions.js +1 -0
  646. package/dist/domain/domain-runtime/spec/index.d.ts +2 -0
  647. package/dist/domain/domain-runtime/spec/index.js +1 -1
  648. package/dist/domain/domain-runtime/spec/initialize.d.ts +11 -0
  649. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  650. package/dist/domain/{application → domain-runtime/spec/module-checks}/element-registration.d.ts +2 -2
  651. package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -0
  652. package/dist/domain/{application → domain-runtime/spec/module-checks}/handler-registration.d.ts +1 -1
  653. package/dist/domain/domain-runtime/spec/module-checks/handler-registration.js +1 -0
  654. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +8 -0
  655. package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -0
  656. package/dist/domain/{project-modules → domain-runtime/spec/module-checks}/project-modules.d.ts +8 -17
  657. package/dist/domain/domain-runtime/spec/module-checks/project-modules.js +1 -0
  658. package/dist/domain/domain-runtime/spec/module-checks/resolve-action-modules.d.ts +4 -0
  659. package/dist/domain/domain-runtime/spec/module-checks/resolve-action-modules.js +1 -0
  660. package/dist/domain/domain-runtime/spec/module-checks/resolve-component-optic-modules.d.ts +4 -0
  661. package/dist/domain/domain-runtime/spec/module-checks/resolve-component-optic-modules.js +1 -0
  662. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.d.ts +15 -0
  663. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -0
  664. package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.d.ts +22 -0
  665. package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.js +1 -0
  666. package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.d.ts +6 -0
  667. package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.js +1 -0
  668. package/dist/domain/domain-runtime/spec/selectors.d.ts +5 -6
  669. package/dist/domain/domain-runtime/spec/selectors.js +1 -1
  670. package/dist/domain/domain-runtime/spec/types.d.ts +5 -2
  671. package/dist/domain/{system-components → extensions}/attribute-switch.d.ts +1 -1
  672. package/dist/domain/extensions/attribute-switch.js +1 -0
  673. package/dist/domain/{system-components → extensions}/canvas-config.d.ts +1 -1
  674. package/dist/domain/{system-components → extensions}/child-entity-recipe-hierarchy.d.ts +1 -1
  675. package/dist/domain/extensions/child-entity-recipe-hierarchy.js +1 -0
  676. package/dist/domain/{system-components → extensions}/client-side-image.d.ts +2 -2
  677. package/dist/domain/{system-components → extensions}/client-side-image.js +1 -1
  678. package/dist/domain/{system-components → extensions}/common/angle-indicator-schema.d.ts +3 -3
  679. package/dist/domain/extensions/common/angle-indicator-schema.js +1 -0
  680. package/dist/domain/{system-components → extensions}/common/dimension-indicator-schema.d.ts +2 -2
  681. package/dist/domain/extensions/common/index.d.ts +4 -0
  682. package/dist/domain/extensions/common/index.js +1 -0
  683. package/dist/domain/{system-components → extensions}/custom-header.d.ts +1 -1
  684. package/dist/domain/extensions/custom-header.js +1 -0
  685. package/dist/domain/{system-components → extensions}/custom-price-footer.js +1 -1
  686. package/dist/domain/{system-components → extensions}/custom-sidebar-footer.d.ts +1 -1
  687. package/dist/domain/extensions/custom-sidebar-footer.js +1 -0
  688. package/dist/domain/{system-components → extensions}/editable-angle-indicator.d.ts +3 -2
  689. package/dist/domain/extensions/editable-angle-indicator.js +1 -0
  690. package/dist/domain/{system-components → extensions}/editable-distance-dimension-indicator.d.ts +3 -2
  691. package/dist/domain/extensions/editable-distance-dimension-indicator.js +1 -0
  692. package/dist/domain/{system-components → extensions}/editable-offset-indicator.d.ts +3 -2
  693. package/dist/domain/extensions/editable-offset-indicator.js +1 -0
  694. package/dist/domain/{system-components → extensions}/editable-size-indicator.d.ts +2 -1
  695. package/dist/domain/extensions/editable-size-indicator.js +1 -0
  696. package/dist/domain/{system-components → extensions}/entity-header.d.ts +1 -1
  697. package/dist/domain/extensions/entity-header.js +1 -0
  698. package/dist/domain/{system-components → extensions}/finalize-component.js +1 -1
  699. package/dist/domain/extensions/fit-selection-orthographic-camera-component.js +1 -0
  700. package/dist/domain/{system-components → extensions}/fit-selection-perspective-camera-component.js +1 -1
  701. package/dist/domain/{system-components → extensions}/horizontal-tabs.d.ts +2 -2
  702. package/dist/domain/extensions/index.d.ts +69 -0
  703. package/dist/domain/extensions/index.js +1 -0
  704. package/dist/domain/{system-components → extensions}/list-selector-dimension-indicator.d.ts +3 -2
  705. package/dist/domain/extensions/list-selector-dimension-indicator.js +1 -0
  706. package/dist/domain/{system-components → extensions}/navigation-steps.d.ts +2 -2
  707. package/dist/domain/extensions/offset-indicator.js +1 -0
  708. package/dist/domain/{system-components → extensions}/property-page.d.ts +1 -1
  709. package/dist/domain/extensions/property-page.js +1 -0
  710. package/dist/domain/{system-components → extensions}/replace-entity-recipe-hierarchy.d.ts +1 -1
  711. package/dist/domain/extensions/replace-entity-recipe-hierarchy.js +1 -0
  712. package/dist/domain/{system-components → extensions}/rotation-handle.d.ts +2 -2
  713. package/dist/domain/{system-components → extensions}/save-template-thumbnail.d.ts +2 -2
  714. package/dist/domain/{system-components → extensions}/save-template-thumbnail.js +1 -1
  715. package/dist/domain/{system-components → extensions}/scene-entity-add-fab.d.ts +1 -1
  716. package/dist/domain/extensions/scene-entity-add-fab.js +1 -0
  717. package/dist/domain/{system-components → extensions}/scene-entity-animation.js +1 -1
  718. package/dist/domain/{system-components → extensions}/scene-entity-delete-fab.d.ts +1 -1
  719. package/dist/domain/extensions/scene-entity-delete-fab.js +1 -0
  720. package/dist/domain/{system-components → extensions}/scene-entity-html-hotspot.d.ts +1 -1
  721. package/dist/domain/extensions/scene-entity-html-hotspot.js +1 -0
  722. package/dist/domain/{system-components → extensions}/scene-entity-navigation-hotspot.d.ts +1 -1
  723. package/dist/domain/extensions/scene-entity-navigation-hotspot.js +1 -0
  724. package/dist/domain/{system-components → extensions}/scene-entity-object-html-hotspot.d.ts +1 -1
  725. package/dist/domain/extensions/scene-entity-object-html-hotspot.js +1 -0
  726. package/dist/domain/{system-components → extensions}/scene-entity-select-hotspot.d.ts +1 -1
  727. package/dist/domain/extensions/scene-entity-select-hotspot.js +1 -0
  728. package/dist/domain/{system-components → extensions}/sketching-edit.d.ts +1 -1
  729. package/dist/domain/extensions/sketching-edit.js +1 -0
  730. package/dist/domain/{system-components → extensions}/summary-component.js +1 -1
  731. package/dist/domain/{system-components → extensions}/tool-menu-fab.d.ts +1 -1
  732. package/dist/domain/extensions/tool-menu-fab.js +1 -0
  733. package/dist/domain/{system-components → extensions}/toolbar.d.ts +1 -1
  734. package/dist/domain/extensions/toolbar.js +1 -0
  735. package/dist/domain/index.d.ts +1 -1
  736. package/dist/domain/index.js +1 -1
  737. package/dist/domain/mocks/create-mock-domain-context.d.ts +1 -1
  738. package/dist/domain/mocks/create-mock-domain-runtime-services.d.ts +1 -1
  739. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +28 -19
  740. package/dist/domain/mocks/create-mock-domain-runtime.js +1 -1
  741. package/dist/domain/mocks/create-mock-domain.d.ts +1 -1
  742. package/dist/domain/mocks/create-mock-domain.js +1 -1
  743. package/dist/domain/mocks/create-mock-state.d.ts +2 -2
  744. package/dist/domain/mocks/create-test-application-config.d.ts +59 -0
  745. package/dist/domain/mocks/create-test-application-config.js +1 -0
  746. package/dist/domain/mocks/index.d.ts +1 -0
  747. package/dist/domain/mocks/index.js +1 -1
  748. package/dist/domain/projections/blender-projections/blender-projections.d.ts +1 -2
  749. package/dist/domain/projections/blender-projections/camera.d.ts +2 -2
  750. package/dist/domain/projections/collision-projections.d.ts +1 -1
  751. package/dist/domain/projections/composition-projections.d.ts +1 -1
  752. package/dist/domain/projections/constraint-projections.d.ts +1 -1
  753. package/dist/domain/projections/index.d.ts +1 -1
  754. package/dist/domain/projections/position-projections.d.ts +1 -1
  755. package/dist/domain/projections/projected-entities-projections.d.ts +1 -1
  756. package/dist/domain/projections/snapping-projections.d.ts +1 -1
  757. package/dist/domain/projections/validation-projections.d.ts +3 -19
  758. package/dist/domain/sketching/sketching-projections.d.ts +1 -1
  759. package/dist/domain/system-components/application-config.d.ts +2 -2
  760. package/dist/domain/system-components/child-entity-selection.js +1 -1
  761. package/dist/domain/system-components/collision-box-geometry.d.ts +4 -2
  762. package/dist/domain/system-components/collision-geometry.d.ts +4 -2
  763. package/dist/domain/system-components/collision-point-geometry.d.ts +4 -2
  764. package/dist/domain/system-components/common/index.d.ts +0 -4
  765. package/dist/domain/system-components/common/index.js +1 -1
  766. package/dist/domain/system-components/common/material-override-schema.d.ts +2 -2
  767. package/dist/domain/system-components/common/recipes.d.ts +21 -3
  768. package/dist/domain/system-components/common/recipes.js +1 -1
  769. package/dist/domain/system-components/common/scene-entity-control-schema.d.ts +3 -0
  770. package/dist/domain/system-components/common/scene-entity-control-schema.js +1 -1
  771. package/dist/domain/system-components/constraint.d.ts +10 -23
  772. package/dist/domain/system-components/drag-handle.d.ts +1 -1
  773. package/dist/domain/system-components/drag-handle.js +1 -1
  774. package/dist/domain/system-components/fit-entity-orthographic-camera-component.js +1 -1
  775. package/dist/domain/system-components/fit-entity-perspective-camera-component.js +1 -1
  776. package/dist/domain/system-components/fit-root-orthographic-camera-component.js +1 -1
  777. package/dist/domain/system-components/fit-root-perspective-camera-component.js +1 -1
  778. package/dist/domain/system-components/hotspot-drag-handle.d.ts +1 -1
  779. package/dist/domain/system-components/hotspot-drag-handle.js +1 -1
  780. package/dist/domain/system-components/index.d.ts +0 -68
  781. package/dist/domain/system-components/index.js +1 -1
  782. package/dist/domain/system-components/material-swatch.js +1 -1
  783. package/dist/domain/system-components/phoenix-entity-elements/admin-data-table-sidebar.d.ts +1 -1
  784. package/dist/domain/system-components/phoenix-layout-elements/admin-connected-resource-page.d.ts +1 -1
  785. package/dist/domain/system-components/phoenix-layout-elements/admin-data-table-actions.d.ts +1 -1
  786. package/dist/domain/system-components/phoenix-layout-elements/admin-data-table-page.d.ts +1 -1
  787. package/dist/domain/system-components/scene-entity-material-override.d.ts +1 -1
  788. package/dist/domain/system-components/scene-entity-object-material-override.d.ts +1 -1
  789. package/dist/domain/system-components/scene-entity-object-text-decal.d.ts +1 -1
  790. package/dist/domain/system-components/scene-entity-object-transimissive-material-override.d.ts +1 -1
  791. package/dist/domain/system-components/scene-entity-transimissive-material-override.d.ts +1 -1
  792. package/dist/domain/system-components/static-orthographic-camera-component.js +1 -1
  793. package/dist/domain/system-components/static-perspective-camera-component.js +1 -1
  794. package/dist/domain/utils/eval-cache.d.ts +1 -1
  795. package/dist/domain/utils/map-nested-object.d.ts +1 -1
  796. package/dist/domain/utils/memo-eval.d.ts +2 -2
  797. package/dist/editor/domain-editors/use-implementation-files.d.ts +1 -2
  798. package/dist/editor/mocks/EditorMockContext.js +1 -1
  799. package/dist/globals/index.d.ts +2 -0
  800. package/dist/i18n/locales/cs/messages.js +1 -1
  801. package/dist/i18n/locales/da/messages.js +1 -1
  802. package/dist/i18n/locales/de/messages.js +1 -1
  803. package/dist/i18n/locales/de-AT/messages.js +1 -1
  804. package/dist/i18n/locales/en/messages.js +1 -1
  805. package/dist/i18n/locales/en-AU/messages.js +1 -1
  806. package/dist/i18n/locales/en-GB/messages.js +1 -1
  807. package/dist/i18n/locales/es/messages.js +1 -1
  808. package/dist/i18n/locales/fr/messages.js +1 -1
  809. package/dist/i18n/locales/hu/messages.js +1 -1
  810. package/dist/i18n/locales/it/messages.js +1 -1
  811. package/dist/i18n/locales/nl/messages.js +1 -1
  812. package/dist/i18n/locales/pl/messages.js +1 -1
  813. package/dist/i18n/locales/pt/messages.js +1 -1
  814. package/dist/i18n/locales/ro/messages.js +1 -1
  815. package/dist/i18n/locales/sk/messages.js +1 -1
  816. package/dist/i18n/locales/tr/messages.js +1 -1
  817. package/dist/legacy/domain-cli/gen/configurator-builder.js +13 -12
  818. package/dist/legacy/domain-cli/gen/constant-expressions.js +1 -3
  819. package/dist/legacy/domain-cli/gen/defaults.js +1 -7
  820. package/dist/legacy/domain-cli/gen/implementation.js +7 -11
  821. package/dist/legacy/domain-cli/gen/invariants.js +7 -6
  822. package/dist/legacy/domain-cli/gen/relations.js +1 -1
  823. package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
  824. package/dist/legacy/domain-cli/utils/cache.js +1 -1
  825. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +160 -148
  826. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
  827. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
  828. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
  829. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +7 -0
  830. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/domain-index.js +17 -15
  831. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/env-example.d.ts +1 -1
  832. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/env-example.js +4 -0
  833. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +15 -14
  834. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-configurator.js +14 -12
  835. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +14 -13
  836. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-configurator.js +13 -11
  837. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  838. package/dist/phoenix/application-spec/generate-application-spec-story.js +2 -2
  839. package/dist/phoenix/application-spec/project-files.js +1 -1
  840. package/dist/phoenix/bin.d.ts +2 -0
  841. package/dist/phoenix/bin.js +2 -0
  842. package/dist/phoenix/check-configs/built-in-eslint-config.d.ts +9 -0
  843. package/dist/phoenix/check-configs/built-in-eslint-config.js +1 -0
  844. package/dist/phoenix/check-configs/eslint-config.d.ts +10 -0
  845. package/dist/phoenix/check-configs/eslint-config.js +1 -0
  846. package/dist/phoenix/check-configs/index.d.ts +8 -0
  847. package/dist/phoenix/check-configs/index.js +1 -0
  848. package/dist/phoenix/check-configs/typescript-project.d.ts +5 -0
  849. package/dist/phoenix/check-configs/typescript-project.js +1 -0
  850. package/dist/phoenix/cli.d.ts +0 -1
  851. package/dist/phoenix/cli.js +1 -2
  852. package/dist/phoenix/commands/check.js +1 -1
  853. package/dist/phoenix/commands/deploy.js +1 -1
  854. package/dist/phoenix/commands/deps/deps.d.ts +52 -0
  855. package/dist/phoenix/commands/deps/deps.js +3 -0
  856. package/dist/phoenix/commands/deps/index.d.ts +1 -0
  857. package/dist/phoenix/commands/deps/index.js +1 -0
  858. package/dist/phoenix/commands/deps/sdk-manifest.d.ts +12 -0
  859. package/dist/phoenix/commands/deps/sdk-manifest.js +1 -0
  860. package/dist/phoenix/commands/dev.js +5 -5
  861. package/dist/phoenix/commands/fix.js +1 -1
  862. package/dist/phoenix/commands/index.d.ts +1 -0
  863. package/dist/phoenix/commands/index.js +1 -1
  864. package/dist/phoenix/commands/init.d.ts +4 -4
  865. package/dist/phoenix/commands/init.js +1 -1
  866. package/dist/phoenix/commands/prettier.js +1 -1
  867. package/dist/phoenix/services/application-spec-project-watcher.d.ts +2 -0
  868. package/dist/phoenix/services/application-spec-project-watcher.js +3 -3
  869. package/dist/phoenix/services/lingui.d.ts +8 -0
  870. package/dist/phoenix/services/lingui.js +1 -1
  871. package/dist/phoenix/services/source-archive.d.ts +1 -0
  872. package/dist/phoenix/services/source-archive.js +1 -1
  873. package/dist/phoenix/services/swc.js +1 -1
  874. package/dist/phoenix/services/vite-config.js +1 -1
  875. package/dist/phoenix/utils/git/index.d.ts +1 -0
  876. package/dist/phoenix/utils/git/index.js +1 -0
  877. package/dist/phoenix/utils/git/is-inside-git-repository.d.ts +6 -0
  878. package/dist/phoenix/utils/git/is-inside-git-repository.js +1 -0
  879. package/dist/phoenix/utils/index.d.ts +3 -1
  880. package/dist/phoenix/utils/index.js +1 -1
  881. package/dist/phoenix/utils/node-version/index.d.ts +1 -0
  882. package/dist/phoenix/utils/node-version/index.js +1 -0
  883. package/dist/phoenix/utils/node-version/supported-node-version.d.ts +12 -0
  884. package/dist/phoenix/utils/node-version/supported-node-version.js +4 -0
  885. package/dist/phoenix/utils/run-command.d.ts +11 -0
  886. package/dist/phoenix/utils/run-command.js +1 -1
  887. package/dist/phoenix/utils/sdk-tool/index.d.ts +1 -0
  888. package/dist/phoenix/utils/sdk-tool/index.js +1 -0
  889. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.d.ts +15 -0
  890. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.js +1 -0
  891. package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +2 -0
  892. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
  893. package/dist/react-sdk/application-runtime/routing/access-service.d.ts +1 -0
  894. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +53 -36
  895. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
  896. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.d.ts +30 -0
  897. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.js +1 -0
  898. package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +9 -9
  899. package/dist/react-sdk/domain-context/index.d.ts +2 -1
  900. package/dist/react-sdk/domain-context/index.js +1 -1
  901. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +11 -0
  902. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
  903. package/dist/react-sdk/domain-controls/hooks/use-angle-dimension.d.ts +1 -1
  904. package/dist/ui-sdk/theme/types.d.ts +1 -1
  905. package/dist/webhook/builders/common.d.ts +5 -0
  906. package/dist/webhook/builders/webhook-builder.js +1 -1
  907. package/package.json +46 -35
  908. package/schema/domain-spec.json +1201 -217
  909. package/dist/application-spec/generate-application/code/templates/env-ci.d.ts +0 -1
  910. package/dist/application-spec/generate-application/code/templates/env-ci.js +0 -25
  911. package/dist/application-spec/generate-application/code/templates/env-example.d.ts +0 -1
  912. package/dist/application-spec/generate-application/code/templates/env-example.js +0 -90
  913. package/dist/application-spec/generate-application/code/templates/prettier-ignore.d.ts +0 -1
  914. package/dist/application-spec/generate-application/code/templates/prettier-ignore.js +0 -6
  915. package/dist/application-spec/generate-application/code/templates/private-assets-readme.d.ts +0 -1
  916. package/dist/application-spec/generate-application/code/templates/private-assets-readme.js +0 -24
  917. package/dist/application-spec/generate-application/code/templates/public-assets-readme.d.ts +0 -1
  918. package/dist/application-spec/generate-application/code/templates/public-assets-readme.js +0 -24
  919. package/dist/application-spec/generate-application/code/templates/readme.d.ts +0 -1
  920. package/dist/application-spec/generate-application/code/templates/readme.js +0 -23
  921. package/dist/application-spec/generate-application/code/templates/skills/agents-md.d.ts +0 -1
  922. package/dist/application-spec/generate-application/code/templates/skills/agents-md.js +0 -2
  923. package/dist/application-spec/generate-application/code/templates/webhook-implementation.d.ts +0 -1
  924. package/dist/application-spec/generate-application/code/templates/webhook-implementation.js +0 -7
  925. package/dist/domain/application/element-registration.js +0 -1
  926. package/dist/domain/application/handler-registration.js +0 -1
  927. package/dist/domain/application/resolve-imported-transformers.d.ts +0 -23
  928. package/dist/domain/application/resolve-imported-transformers.js +0 -1
  929. package/dist/domain/application/resource-builder.d.ts +0 -13
  930. package/dist/domain/application/resource-builder.js +0 -1
  931. package/dist/domain/core/relation/relation-implementation.d.ts +0 -7
  932. package/dist/domain/project-modules/index.d.ts +0 -1
  933. package/dist/domain/project-modules/index.js +0 -1
  934. package/dist/domain/project-modules/project-modules.js +0 -1
  935. package/dist/domain/system-components/attribute-switch.js +0 -1
  936. package/dist/domain/system-components/child-entity-recipe-hierarchy.js +0 -1
  937. package/dist/domain/system-components/common/angle-indicator-schema.js +0 -1
  938. package/dist/domain/system-components/custom-header.js +0 -1
  939. package/dist/domain/system-components/custom-sidebar-footer.js +0 -1
  940. package/dist/domain/system-components/editable-angle-indicator.js +0 -1
  941. package/dist/domain/system-components/editable-distance-dimension-indicator.js +0 -1
  942. package/dist/domain/system-components/editable-offset-indicator.js +0 -1
  943. package/dist/domain/system-components/editable-size-indicator.js +0 -1
  944. package/dist/domain/system-components/entity-header.js +0 -1
  945. package/dist/domain/system-components/fit-selection-orthographic-camera-component.js +0 -1
  946. package/dist/domain/system-components/list-selector-dimension-indicator.js +0 -1
  947. package/dist/domain/system-components/offset-indicator.js +0 -1
  948. package/dist/domain/system-components/property-page.js +0 -1
  949. package/dist/domain/system-components/replace-entity-recipe-hierarchy.js +0 -1
  950. package/dist/domain/system-components/scene-entity-add-fab.js +0 -1
  951. package/dist/domain/system-components/scene-entity-delete-fab.js +0 -1
  952. package/dist/domain/system-components/scene-entity-html-hotspot.js +0 -1
  953. package/dist/domain/system-components/scene-entity-navigation-hotspot.js +0 -1
  954. package/dist/domain/system-components/scene-entity-object-html-hotspot.js +0 -1
  955. package/dist/domain/system-components/scene-entity-select-hotspot.js +0 -1
  956. package/dist/domain/system-components/sketching-edit.js +0 -1
  957. package/dist/domain/system-components/tool-menu-fab.js +0 -1
  958. package/dist/domain/system-components/toolbar.js +0 -1
  959. /package/dist/{domain/core/relation/relation-implementation.js → application-spec/core/expressions/relation-expression-params.js} +0 -0
  960. /package/dist/application-spec/{core → enhanced-json}/eval-code-uses-self.d.ts +0 -0
  961. /package/dist/application-spec/{core → enhanced-json}/eval-code-uses-self.js +0 -0
  962. /package/dist/application-spec/{core → enhanced-json}/eval-to-constant.js +0 -0
  963. /package/dist/domain/{system-components → extensions}/angle-indicator.d.ts +0 -0
  964. /package/dist/domain/{system-components → extensions}/angle-indicator.js +0 -0
  965. /package/dist/domain/{system-components → extensions}/autorotate-camera-component.d.ts +0 -0
  966. /package/dist/domain/{system-components → extensions}/autorotate-camera-component.js +0 -0
  967. /package/dist/domain/{system-components → extensions}/basic-sidebar-footer.d.ts +0 -0
  968. /package/dist/domain/{system-components → extensions}/basic-sidebar-footer.js +0 -0
  969. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity-object.d.ts +0 -0
  970. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity-object.js +0 -0
  971. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity.d.ts +0 -0
  972. /package/dist/domain/{system-components → extensions}/camera-based-hidden-entity.js +0 -0
  973. /package/dist/domain/{system-components → extensions}/canvas-config.js +0 -0
  974. /package/dist/domain/{system-components → extensions}/canvas-custom-environment.d.ts +0 -0
  975. /package/dist/domain/{system-components → extensions}/canvas-custom-environment.js +0 -0
  976. /package/dist/domain/{system-components → extensions}/canvas-padding.d.ts +0 -0
  977. /package/dist/domain/{system-components → extensions}/canvas-padding.js +0 -0
  978. /package/dist/domain/{system-components → extensions}/canvas-preset-environment.d.ts +0 -0
  979. /package/dist/domain/{system-components → extensions}/canvas-preset-environment.js +0 -0
  980. /package/dist/domain/{system-components → extensions}/color-value.d.ts +0 -0
  981. /package/dist/domain/{system-components → extensions}/color-value.js +0 -0
  982. /package/dist/domain/{system-components → extensions}/common/dimension-indicator-schema.js +0 -0
  983. /package/dist/domain/{system-components → extensions}/common/dimension-indicators.d.ts +0 -0
  984. /package/dist/domain/{system-components → extensions}/common/dimension-indicators.js +0 -0
  985. /package/dist/domain/{system-components → extensions}/common/editable-indicator-button-variant.d.ts +0 -0
  986. /package/dist/domain/{system-components → extensions}/common/editable-indicator-button-variant.js +0 -0
  987. /package/dist/domain/{system-components → extensions}/custom-price-footer.d.ts +0 -0
  988. /package/dist/domain/{system-components → extensions}/dimension-indicator.d.ts +0 -0
  989. /package/dist/domain/{system-components → extensions}/dimension-indicator.js +0 -0
  990. /package/dist/domain/{system-components → extensions}/exit-tool-mode-fab.d.ts +0 -0
  991. /package/dist/domain/{system-components → extensions}/exit-tool-mode-fab.js +0 -0
  992. /package/dist/domain/{system-components → extensions}/finalize-action.d.ts +0 -0
  993. /package/dist/domain/{system-components → extensions}/finalize-action.js +0 -0
  994. /package/dist/domain/{system-components → extensions}/finalize-component.d.ts +0 -0
  995. /package/dist/domain/{system-components → extensions}/fit-selection-orthographic-camera-component.d.ts +0 -0
  996. /package/dist/domain/{system-components → extensions}/fit-selection-perspective-camera-component.d.ts +0 -0
  997. /package/dist/domain/{system-components → extensions}/fixed-header.d.ts +0 -0
  998. /package/dist/domain/{system-components → extensions}/fixed-header.js +0 -0
  999. /package/dist/domain/{system-components → extensions}/floating-header.d.ts +0 -0
  1000. /package/dist/domain/{system-components → extensions}/floating-header.js +0 -0
  1001. /package/dist/domain/{system-components → extensions}/hidden-header.d.ts +0 -0
  1002. /package/dist/domain/{system-components → extensions}/hidden-header.js +0 -0
  1003. /package/dist/domain/{system-components → extensions}/hidden-sidebar-footer.d.ts +0 -0
  1004. /package/dist/domain/{system-components → extensions}/hidden-sidebar-footer.js +0 -0
  1005. /package/dist/domain/{system-components → extensions}/horizontal-tabs.js +0 -0
  1006. /package/dist/domain/{system-components → extensions}/multilingual-text-value.d.ts +0 -0
  1007. /package/dist/domain/{system-components → extensions}/multilingual-text-value.js +0 -0
  1008. /package/dist/domain/{system-components → extensions}/navigation-steps.js +0 -0
  1009. /package/dist/domain/{system-components → extensions}/offset-anchors.d.ts +0 -0
  1010. /package/dist/domain/{system-components → extensions}/offset-anchors.js +0 -0
  1011. /package/dist/domain/{system-components → extensions}/offset-indicator.d.ts +0 -0
  1012. /package/dist/domain/{system-components → extensions}/offset.d.ts +0 -0
  1013. /package/dist/domain/{system-components → extensions}/offset.js +0 -0
  1014. /package/dist/domain/{system-components → extensions}/other-action.d.ts +0 -0
  1015. /package/dist/domain/{system-components → extensions}/other-action.js +0 -0
  1016. /package/dist/domain/{system-components → extensions}/read-sidebar-footer.d.ts +0 -0
  1017. /package/dist/domain/{system-components → extensions}/read-sidebar-footer.js +0 -0
  1018. /package/dist/domain/{system-components → extensions}/rotatable.d.ts +0 -0
  1019. /package/dist/domain/{system-components → extensions}/rotatable.js +0 -0
  1020. /package/dist/domain/{system-components → extensions}/rotation-handle.js +0 -0
  1021. /package/dist/domain/{system-components → extensions}/scene-entity-animation.d.ts +0 -0
  1022. /package/dist/domain/{system-components → extensions}/scene-entity-control.d.ts +0 -0
  1023. /package/dist/domain/{system-components → extensions}/scene-entity-control.js +0 -0
  1024. /package/dist/domain/{system-components → extensions}/scene-entity-floor-object.d.ts +0 -0
  1025. /package/dist/domain/{system-components → extensions}/scene-entity-floor-object.js +0 -0
  1026. /package/dist/domain/{system-components → extensions}/scene-entity-wall-object.d.ts +0 -0
  1027. /package/dist/domain/{system-components → extensions}/scene-entity-wall-object.js +0 -0
  1028. /package/dist/domain/{system-components → extensions}/selectable-component.d.ts +0 -0
  1029. /package/dist/domain/{system-components → extensions}/selectable-component.js +0 -0
  1030. /package/dist/domain/{system-components → extensions}/sidebar-tabs.d.ts +0 -0
  1031. /package/dist/domain/{system-components → extensions}/sidebar-tabs.js +0 -0
  1032. /package/dist/domain/{system-components → extensions}/simple-summary.d.ts +0 -0
  1033. /package/dist/domain/{system-components → extensions}/simple-summary.js +0 -0
  1034. /package/dist/domain/{system-components → extensions}/size.d.ts +0 -0
  1035. /package/dist/domain/{system-components → extensions}/size.js +0 -0
  1036. /package/dist/domain/{system-components → extensions}/sketching-draw.d.ts +0 -0
  1037. /package/dist/domain/{system-components → extensions}/sketching-draw.js +0 -0
  1038. /package/dist/domain/{system-components → extensions}/summary-component.d.ts +0 -0
  1039. /package/dist/domain/{system-components → extensions}/text-value.d.ts +0 -0
  1040. /package/dist/domain/{system-components → extensions}/text-value.js +0 -0
  1041. /package/dist/domain/{system-components → extensions}/tool-controls.d.ts +0 -0
  1042. /package/dist/domain/{system-components → extensions}/tool-controls.js +0 -0
  1043. /package/dist/domain/{system-components → extensions}/universal-sidebar-footer.d.ts +0 -0
  1044. /package/dist/domain/{system-components → extensions}/universal-sidebar-footer.js +0 -0
  1045. /package/dist/domain/{system-components → extensions}/view-controls.d.ts +0 -0
  1046. /package/dist/domain/{system-components → extensions}/view-controls.js +0 -0
@@ -0,0 +1,2434 @@
1
+ # Custom Layout
2
+
3
+ Make the configurator look like the brand's own product page. A furniture shop wants its table configurator to read like the rest of its site: a floating panel on the left with the product's name, the edge finishes as picture cards, the price in large type and one clear call to action, and the table in the space beside it. On a phone the panel becomes a sheet at the bottom, and a button on the table's edge offers the finishes right where they apply, and the layout's own buttons switch between the whole table and a close-up of its edge. The project writes that page as one React component. Phoenix supplies the 3D scene, the product's state and a few hooks; every pixel around the scene is the project's own.
4
+
5
+ - [Choose this approach](#choose-this-approach)
6
+ - [Register the layout](#register-the-layout)
7
+ - [What the layout has to do](#what-the-layout-has-to-do)
8
+ - [Read and change the product](#read-and-change-the-product)
9
+ - [Draw the choices](#draw-the-choices)
10
+ - [Offer fullscreen](#offer-fullscreen)
11
+ - [Show messages](#show-messages)
12
+ - [Request a quote](#request-a-quote)
13
+ - [Serve read mode](#serve-read-mode)
14
+ - [Fit a phone](#fit-a-phone)
15
+ - [Put a control on the product](#put-a-control-on-the-product)
16
+ - [Control the scene](#control-the-scene)
17
+ - [The spec the layout reads](#the-spec-the-layout-reads)
18
+ - [Try the example](#try-the-example)
19
+ - [Test cases](#test-cases)
20
+ - [Known gaps](#known-gaps)
21
+ - [Related pages](#related-pages)
22
+ - [Complete Implementation](#complete-implementation)
23
+
24
+ ## Choose this approach
25
+
26
+ Write your own layout when the configurator has to follow a design the built-in layout cannot take on: the brand's typography, controls and spacing, a panel on the left, a top bar with the price, an area the built-in layout has no place for.
27
+
28
+ Stay with the built-in layout when its structure fits and only its parts change. [Universal](?path=/docs/layouts-universal--docs) demonstrates that layout, and the pages of its parts describe what the spec configures: [Header](?path=/docs/layouts-header-floating--docs), [Sidebar](?path=/docs/layouts-sidebar-general--docs), [Sidebar Footer](?path=/docs/layouts-sidebar-footer-basic--docs), [Toolbar](?path=/docs/layouts-toolbar--docs) and [View Controls](?path=/docs/layouts-view-controls--docs).
29
+
30
+ A project layout replaces all of that. None of the built-in sidebar, footer, toolbar or property pages is rendered for it, so the layout builds every control the user needs. This example uses no SDK component that draws UI: only the scene, the safe-area hook and hooks that read and change the product's state. A layout may also mount the SDK's own pieces where it wants them, see [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui).
31
+
32
+ ## Register the layout
33
+
34
+ Create `src/elements/ConfiguratorLayout.tsx` with a default export made by `phx.frontend.createCustomPhoenixLayoutElement`. The name `ConfiguratorLayout` is what makes it the layout: Phoenix renders the element registered under that name for every loaded configuration, in owner and in read mode, whatever `layout` the spec sets. Nothing in the YAML refers to it.
35
+
36
+ ```tsx
37
+ import { Box } from '@mui/material'
38
+ import { useState } from 'react'
39
+
40
+ import { LayoutSlots, useSceneSafeArea } from '@salsita-ai/sdk/configurator'
41
+ import { useActiveViewports } from '@salsita-ai/sdk/react'
42
+
43
+ import { phx } from '../../.phoenix/phx.js'
44
+ import { BottomSheet } from '../_shared/BottomSheet.js'
45
+ import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
46
+ import { MessageToast } from '../_shared/MessageToast.js'
47
+ import { ProductPanel } from '../_shared/ProductPanel.js'
48
+ import { SceneControls } from '../_shared/SceneControls.js'
49
+
50
+ const GUTTER = 24
51
+ const PANEL_WIDTH = 380
52
+ const PHONE_GUTTER = 16
53
+ const TOUCH_TARGET = 44
54
+
55
+ const ConfiguratorLayout = () => {
56
+ const { containerRef, safeAreaRef } = useSceneSafeArea()
57
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
58
+ // `null` until the container has been measured; the layout shows only the scene until then
59
+ const viewports = useActiveViewports()
60
+ const [isSheetOpen, setSheetOpen] = useState(false)
61
+
62
+ const isDesktop = viewports?.includes('desktop') ?? false
63
+ const gutter = isDesktop ? GUTTER : PHONE_GUTTER
64
+
65
+ return (
66
+ <Box
67
+ component="div"
68
+ ref={containerRef}
69
+ // `clip`, not `hidden`: what overflows, such as the sheet's fill below its edge, can never be scrolled into view,
70
+ // not even by the browser when the focus moves
71
+ sx={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', overflow: 'clip' }}
72
+ >
73
+ <LayoutSlots.SharedCanvas />
74
+
75
+ {viewports !== null && isDesktop && !isFullscreen && (
76
+ <Box
77
+ component="aside"
78
+ sx={{
79
+ position: 'absolute',
80
+ insetBlockStart: GUTTER,
81
+ insetInlineStart: GUTTER,
82
+ inlineSize: PANEL_WIDTH,
83
+ maxBlockSize: `calc(100% - ${2 * GUTTER}px)`,
84
+ display: 'flex',
85
+ flexDirection: 'column',
86
+ borderRadius: 5,
87
+ bgcolor: 'background.paper',
88
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
89
+ // A very short container, such as a phone held sideways, scrolls the panel instead of clipping its footer
90
+ overflowX: 'hidden',
91
+ overflowY: 'auto',
92
+ overscrollBehavior: 'contain',
93
+ }}
94
+ >
95
+ <ProductPanel />
96
+ </Box>
97
+ )}
98
+
99
+ {viewports !== null && (
100
+ <Box
101
+ component="div"
102
+ ref={safeAreaRef}
103
+ sx={{
104
+ // Desktop: right of the panel. Phone: above the sheet, whose height the column gives the rest.
105
+ ...(isDesktop
106
+ ? {
107
+ position: 'absolute',
108
+ insetBlock: 0,
109
+ insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
110
+ insetInlineEnd: 0,
111
+ }
112
+ : { position: 'relative', flex: '1 1 0', minBlockSize: 0 }),
113
+ pointerEvents: 'none',
114
+ }}
115
+ >
116
+ <Box
117
+ component="div"
118
+ sx={{ position: 'absolute', insetBlockStart: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
119
+ >
120
+ <FullscreenToggle compact={!isDesktop} />
121
+ </Box>
122
+ <Box
123
+ component="div"
124
+ sx={{
125
+ position: 'absolute',
126
+ pointerEvents: 'auto',
127
+ // Desktop: bottom left, above the row of view controls. Phone: at the top beside the fullscreen button,
128
+ // clear of the sheet's handle and the view controls.
129
+ ...(isDesktop
130
+ ? { insetBlockEnd: 2 * GUTTER + TOUCH_TARGET, insetInlineStart: GUTTER }
131
+ : { insetBlockStart: gutter, insetInline: `${gutter}px ${2 * gutter + TOUCH_TARGET}px` }),
132
+ }}
133
+ >
134
+ <MessageToast />
135
+ </Box>
136
+ {/* A phone in fullscreen keeps only the reset, as the built-in layout does. Below 1024 pixels (`tablet`) the
137
+ free area beside the panel is narrow, so the reset shows only its icon there too. */}
138
+ <Box
139
+ component="div"
140
+ sx={{ position: 'absolute', insetBlockEnd: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
141
+ >
142
+ <SceneControls
143
+ compact={!isDesktop || (viewports?.includes('tablet') ?? false)}
144
+ resetOnly={!isDesktop && isFullscreen}
145
+ />
146
+ </Box>
147
+ </Box>
148
+ )}
149
+
150
+ {viewports !== null && !isDesktop && !isFullscreen && (
151
+ <BottomSheet open={isSheetOpen} onOpenChange={setSheetOpen} label="Product details">
152
+ <ProductPanel collapsed={!isSheetOpen} inSheet />
153
+ </BottomSheet>
154
+ )}
155
+ </Box>
156
+ )
157
+ }
158
+
159
+ export default phx.frontend.createCustomPhoenixLayoutElement('ConfiguratorLayout', ConfiguratorLayout)
160
+ ```
161
+
162
+ The components it uses live in `src/_shared/`, which Phoenix does not import by convention, so the layout imports them itself. Application projects receive `phx` as a global. Storybook examples cannot rely on that project environment, so these files import it from `../../.phoenix/phx.js`; leave that import out in a project.
163
+
164
+ ## What the layout has to do
165
+
166
+ - **Position the root and cover the page.** `LayoutSlots.SharedCanvas` is absolutely positioned and fills its nearest positioned ancestor. The root here is `position: absolute; inset: 0`.
167
+ - **Mount the shared canvas.** The app loader stays on screen until the scene has loaded. A layout without `LayoutSlots.SharedCanvas` never gets past the loader unless the project sets `appLoader: legacy`.
168
+ - **Put the UI above the canvas.** The canvas is opaque. Content that is positioned and comes after it in the markup is painted above it; unpositioned content is painted under it and cannot be seen.
169
+ - **Tell the camera where the free area is.** `useSceneSafeArea()` returns two refs. `containerRef` goes on the element that covers the whole canvas, `safeAreaRef` on the region the product should stay visible in, here everything right of the panel, or above the sheet on a phone. The camera then frames the product in that region. The hook measures again whenever either of the two elements resizes; for a change no resize reports, such as a `transform` on an ancestor settling at the end of an animation, it also returns `update` to call. Without the two refs the product is centred in the whole canvas and sits against the panel.
170
+ - **Let the pointer through.** The safe-area element lies over the canvas, so it sets `pointerEvents: 'none'`; otherwise the scene cannot be orbited. The fullscreen button inside it switches pointer events back on.
171
+ - **Honour fullscreen.** Fullscreen is a flag in the product's state, not a browser feature. The layout reads it with `phx.frontend.useIsFullscreenActive()`, removes the panel or the sheet and lets the safe area cover the canvas, so the camera frames the product in the whole canvas.
172
+ - **Fit the width it is given.** The configurator can be embedded in a narrow column or opened on a phone. The layout reads the container's width class with `useActiveViewports()` and renders a desktop or a phone arrangement, see [Fit a phone](#fit-a-phone).
173
+ - **Serve read mode.** The same element renders a configuration shared for viewing, and the layout decides what a viewer sees.
174
+
175
+ ## Read and change the product
176
+
177
+ The panel reads everything it shows from hooks and writes the customer's choice back through one of them. The table lists the hooks the whole layout uses:
178
+
179
+ ```tsx
180
+ import { Box, Button, Typography } from '@mui/material'
181
+
182
+ import { detailComponent, finalizeActionComponent } from '@salsita-ai/sdk/domain'
183
+ import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
184
+
185
+ import { phx } from '../../.phoenix/phx.js'
186
+ import { EdgeFinishCards } from './EdgeFinishCards.js'
187
+ import { ReviewActions } from './ReviewActions.js'
188
+
189
+ const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
190
+
191
+ interface ProductPanelProps {
192
+ // Only the name, the price and the action, for a collapsed bottom sheet
193
+ readonly collapsed?: boolean
194
+ // In a bottom sheet the cards region keeps the top of the cards in view, and the sheet scrolls when that does not fit
195
+ readonly inSheet?: boolean
196
+ }
197
+
198
+ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
199
+ const resolve = useResolveLocalizable()
200
+ const detail = phx.frontend.useFirstRootComponent(detailComponent)
201
+ const price = phx.frontend.useRootEntityPrice()
202
+ const tableId = phx.frontend.useRootEntityId()
203
+ const edgeFinish = phx.frontend.useAttributeSelection(tableId, 'edgeFinish')
204
+ const { accessInfo } = phx.frontend.useAccessService()
205
+ const navigationState = phx.frontend.useActiveNavigationState()
206
+ const pushNavigate = phx.frontend.usePushNavigate()
207
+ const popNavigate = phx.frontend.usePopNavigate()
208
+ const navigate = phx.frontend.useNavigate()
209
+ const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
210
+
211
+ const isReadMode = accessInfo.viewMode
212
+ const isReview = isReadMode || navigationState !== 'configure'
213
+ // The spec's primary finalize action, or its first one
214
+ const quoteAction = finalizeActions.find(action => action.state.variant === 'primary') ?? finalizeActions[0]
215
+ const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
216
+
217
+ return (
218
+ <>
219
+ <Box component="header" sx={{ display: 'grid', gap: 1, padding: 3, paddingBlockEnd: 2 }}>
220
+ {isReadMode ? (
221
+ <Typography
222
+ variant="overline"
223
+ sx={{ justifySelf: 'start', paddingInline: 1.5, borderRadius: 999, bgcolor: 'action.selected' }}
224
+ >
225
+ View only
226
+ </Typography>
227
+ ) : (
228
+ <Typography variant="overline" color="text.secondary">
229
+ {resolve(detail?.state.subtitle)}
230
+ </Typography>
231
+ )}
232
+ <Typography variant="h5" component="h2" fontWeight={700}>
233
+ {resolve(detail?.state.title)}
234
+ </Typography>
235
+ {!collapsed && (
236
+ <Typography variant="body2" color="text.secondary">
237
+ {resolve(detail?.state.description)}
238
+ </Typography>
239
+ )}
240
+ </Box>
241
+
242
+ {!collapsed && (
243
+ <Box
244
+ component="div"
245
+ sx={{
246
+ display: 'grid',
247
+ gap: 1.5,
248
+ paddingInline: 3,
249
+ paddingBlockEnd: 3,
250
+ // In a short container the region shrinks and scrolls; a scroll past its end moves its container on
251
+ minBlockSize: inSheet ? 120 : 0,
252
+ overflowY: 'auto',
253
+ }}
254
+ >
255
+ <Typography variant="subtitle2" component="h3">
256
+ Edge finish
257
+ </Typography>
258
+ {isReview ? (
259
+ <Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
260
+ <Typography variant="body2" fontWeight={600}>
261
+ {resolve(chosenEdge?.title)}
262
+ </Typography>
263
+ <Typography variant="caption" color="text.secondary">
264
+ {resolve(chosenEdge?.description)}
265
+ </Typography>
266
+ </Box>
267
+ ) : (
268
+ <EdgeFinishCards selection={edgeFinish} />
269
+ )}
270
+ </Box>
271
+ )}
272
+
273
+ <Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
274
+ <Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
275
+ <Typography variant="body2" color="text.secondary">
276
+ Total price
277
+ </Typography>
278
+ <Typography variant="h5" component="p" fontWeight={700}>
279
+ {price}
280
+ </Typography>
281
+ </Box>
282
+ {!isReadMode && navigationState === 'configure' && (
283
+ <Button size="large" variant="contained" onClick={() => pushNavigate('checkout')} sx={BUTTON_SX}>
284
+ Review and request a quote
285
+ </Button>
286
+ )}
287
+ {!isReadMode && navigationState === 'checkout' && (
288
+ <>
289
+ <Typography variant="body2" color="text.secondary">
290
+ Your table is ready for a quote. A real shop collects the contact details here.
291
+ </Typography>
292
+ {quoteAction ? (
293
+ <PhoenixHandlerBoundary name={quoteAction.state.handler}>
294
+ <ReviewActions
295
+ handler={quoteAction.state.handler}
296
+ label={resolve(quoteAction.state.label)}
297
+ onBack={popNavigate}
298
+ />
299
+ </PhoenixHandlerBoundary>
300
+ ) : (
301
+ <Button size="large" variant="outlined" onClick={popNavigate} sx={BUTTON_SX}>
302
+ Back to the configuration
303
+ </Button>
304
+ )}
305
+ </>
306
+ )}
307
+ {!isReadMode && navigationState === 'requested' && (
308
+ <>
309
+ <Typography variant="body2" role="status">
310
+ Thank you. Your quote request is on its way, and the shop replies within two working days.
311
+ </Typography>
312
+ <Button size="large" variant="outlined" onClick={() => navigate('configure')} sx={BUTTON_SX}>
313
+ Back to the configuration
314
+ </Button>
315
+ </>
316
+ )}
317
+ </Box>
318
+ </>
319
+ )
320
+ }
321
+ ```
322
+
323
+ | Hook | What the layout uses it for |
324
+ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
325
+ | `phx.frontend.useFirstRootComponent(detailComponent)` | The `detail` component of the root entity: name, subtitle and description. `detailComponent` comes from `@salsita-ai/sdk/domain`; the hook returns `null` without one. |
326
+ | `phx.frontend.useRootEntityId()` | The id of the table, which the control hooks take. |
327
+ | `phx.frontend.useAttributeSelection(entityId, instanceName)` | The `attributeSelection` component named `edgeFinish`: the current `value` and the `options`, each with `title`, `description`, `value`, `disabled` and `onSelect`. |
328
+ | `phx.frontend.useRootEntityPrice()` | The root entity's `price` component, formatted for the current locale and currency, or `null` without one. |
329
+ | `phx.frontend.useAccessService()` | `accessInfo.viewMode` is `true` while a configuration shared for viewing is open, and also while the host sets the `readonly` property. |
330
+ | `phx.frontend.useActiveNavigationState()` | The active navigation state; the panel shows its review step while it is `checkout`. |
331
+ | `phx.frontend.usePushNavigate()` and `phx.frontend.usePopNavigate()` | Enter the review step and leave it again. |
332
+ | `phx.frontend.useNavigate()` | Return from the confirmation to the configuration, forgetting the review step. |
333
+ | `phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] })` | The spec's `finalizeAction` components; the panel offers the primary one in its review step. `finalizeActionComponent` comes from `@salsita-ai/sdk/domain`. |
334
+ | `phx.frontend.useFinalizeAction(handler)` | Run the finalize action's handler, with its pending state, its error and whether finalizing is possible; see [Request a quote](#request-a-quote). |
335
+ | `phx.frontend.useIsFullscreenActive()` and `phx.frontend.useSetFullscreen()` | Read the fullscreen flag, and set it from the layout's own button. |
336
+ | `phx.frontend.useActiveViewState()` and `phx.frontend.useSetViewState()` | Read the active view state, one of the spec's `viewStates`, to mark the active view button, and make another one active; see [Control the scene](#control-the-scene). |
337
+ | `phx.frontend.useResetCamera()` | Move the camera back to the framing of the active camera, undoing the customer's orbit, pan and zoom. |
338
+ | `useActiveViewports()` from `@salsita-ai/sdk/react` | The width classes of the configurator's container, or `null` before it is measured; the layout renders its phone arrangement unless it includes `desktop`, see [Fit a phone](#fit-a-phone). |
339
+ | `phx.frontend.useConfiguratorMessages(onMessage)` | Receive violations, side-effect hints and errors one by one, with their text resolved, for the layout's own toast; see [Show messages](#show-messages). |
340
+ | `useResolveLocalizable()` from `@salsita-ai/sdk/react` | Turns the localizable texts of the spec into strings in the current language. [Localization](?path=/docs/phoenix-localization--docs) describes it and `LocalizableMessage`. |
341
+ | `PhoenixHandlerBoundary` from `@salsita-ai/sdk/react` | Wraps the review step's buttons, so an edited handler takes effect without a reload. |
342
+
343
+ Calling an option's `onSelect` is the whole write: it changes `edgeFinish` on the table, the scene morphs the edge and the price expression recalculates. The option fields are named for display: the spec's `label` arrives as `title`, its `img` as `imageSrc`.
344
+
345
+ The review step is the layout's own: the button pushes the `checkout` navigation state, and the panel shows a summary instead of the cards. There **Request a quote** runs the spec's finalize action, whose handler moves the panel on to the `requested` state and its confirmation; see [Request a quote](#request-a-quote). A real shop collects the contact details in the review step before it sends the request.
346
+
347
+ ## Draw the choices
348
+
349
+ The edge finish is a visual choice, so the panel shows it as cards with a drawing of each profile, as [Choosing a Control](?path=/docs/ux-guidelines-choosing-a-control--docs) recommends for shapes. The selected card has a border in the theme's primary colour, a tinted background and a check mark, so the state does not depend on colour alone. The cards form a radio group: the group has `role="radiogroup"` and a label, each card `role="radio"` and `aria-checked`, only the selected card is in the tab order, and the arrow keys move the selection, skipping disabled options, as in a native radio group. Each card is at least 44 pixels high and shows a focus ring for keyboard users.
350
+
351
+ ```tsx
352
+ import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
353
+ import type { KeyboardEvent } from 'react'
354
+
355
+ import { type UseAttributeSelection, useResolveLocalizable } from '@salsita-ai/sdk/react'
356
+
357
+ // Cross-sections of the tabletop's edge, keyed by the option values of the spec.
358
+ const EDGE_PROFILES: Readonly<Record<string, string>> = {
359
+ None: 'M0 4H32V20H0Z',
360
+ Facet: 'M0 4H26L32 10V14L26 20H0Z',
361
+ Round: 'M0 4H24A8 8 0 0 1 24 20H0Z',
362
+ TreeTrunk: 'M0 4H27C33 5 28 9 34 11C29 13 34 17 27 20H0Z',
363
+ }
364
+
365
+ const CHECK_BADGE: SxProps<Theme> = {
366
+ position: 'absolute',
367
+ insetBlockStart: 10,
368
+ insetInlineEnd: 10,
369
+ display: 'grid',
370
+ placeItems: 'center',
371
+ inlineSize: 22,
372
+ blockSize: 22,
373
+ borderRadius: '50%',
374
+ bgcolor: 'primary.main',
375
+ color: 'primary.contrastText',
376
+ fontSize: 13,
377
+ }
378
+
379
+ // Arrow keys move the selection between the cards, as in a native radio group.
380
+ const ARROW_STEPS: Readonly<Record<string, number | undefined>> = {
381
+ ArrowRight: 1,
382
+ ArrowDown: 1,
383
+ ArrowLeft: -1,
384
+ ArrowUp: -1,
385
+ }
386
+
387
+ interface EdgeFinishCardsProps {
388
+ readonly selection: ReturnType<UseAttributeSelection>
389
+ }
390
+
391
+ export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
392
+ const resolve = useResolveLocalizable()
393
+ const { options } = selection
394
+ // The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
395
+ const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
396
+ const focusIndex = selectedIndex >= 0 ? selectedIndex : options.findIndex(option => !option.disabled)
397
+
398
+ const handleKeyDown = (event: KeyboardEvent<HTMLElement>, index: number) => {
399
+ const step = ARROW_STEPS[event.key]
400
+
401
+ if (step === undefined) {
402
+ return
403
+ }
404
+
405
+ event.preventDefault()
406
+ // The next enabled option in the arrow's direction, wrapping around; disabled options are skipped.
407
+ const count = options.length
408
+ const next = Array.from(
409
+ { length: count - 1 },
410
+ (_, offset) => (((index + step * (offset + 1)) % count) + count) % count
411
+ ).find(candidate => !options[candidate]?.disabled)
412
+
413
+ if (next === undefined) {
414
+ return
415
+ }
416
+
417
+ options[next]?.onSelect()
418
+ event.currentTarget.parentElement?.querySelectorAll<HTMLElement>('[role="radio"]')[next]?.focus()
419
+ }
420
+
421
+ return (
422
+ <Box
423
+ component="div"
424
+ role="radiogroup"
425
+ aria-label="Edge finish"
426
+ sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 1.5 }}
427
+ >
428
+ {options.map((option, index) => {
429
+ const isSelected = option.value === selection.value
430
+
431
+ return (
432
+ <ButtonBase
433
+ key={String(option.value)}
434
+ role="radio"
435
+ aria-checked={isSelected}
436
+ tabIndex={index === focusIndex ? 0 : -1}
437
+ disabled={option.disabled}
438
+ onClick={option.onSelect}
439
+ onKeyDown={event => handleKeyDown(event, index)}
440
+ sx={{
441
+ position: 'relative',
442
+ display: 'grid',
443
+ justifyItems: 'start',
444
+ gap: 0.5,
445
+ padding: 2,
446
+ borderRadius: 3,
447
+ border: 2,
448
+ borderColor: isSelected ? 'primary.main' : 'divider',
449
+ bgcolor: isSelected ? 'action.hover' : 'transparent',
450
+ textAlign: 'start',
451
+ transition: 'border-color 150ms, background-color 150ms',
452
+ '&:hover': { borderColor: isSelected ? 'primary.main' : 'text.disabled' },
453
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
454
+ '&.Mui-disabled': { opacity: 0.4 },
455
+ }}
456
+ >
457
+ {isSelected && (
458
+ <Box component="span" aria-hidden sx={CHECK_BADGE}>
459
+ ✓
460
+ </Box>
461
+ )}
462
+ <Box
463
+ component="svg"
464
+ viewBox="0 0 36 24"
465
+ aria-hidden
466
+ sx={{ inlineSize: 60, blockSize: 40, color: '#b98b5e' }}
467
+ >
468
+ <path d={EDGE_PROFILES[String(option.value)]} fill="currentColor" />
469
+ </Box>
470
+ <Typography variant="body2" fontWeight={600}>
471
+ {resolve(option.title)}
472
+ </Typography>
473
+ <Typography variant="caption" color="text.secondary">
474
+ {resolve(option.description)}
475
+ </Typography>
476
+ </ButtonBase>
477
+ )
478
+ })}
479
+ </Box>
480
+ )
481
+ }
482
+ ```
483
+
484
+ The drawings are keyed by the option values of the spec. A spec can carry a picture per option instead, as `img`, which the hook returns as `imageSrc`; [CardSelect](?path=/docs/controls-select-attribute-cardselect--docs) shows the SDK's own card control.
485
+
486
+ ## Offer fullscreen
487
+
488
+ Fullscreen is a flag in the configurator's state, not the browser's fullscreen mode. `phx.frontend.useIsFullscreenActive()` reads it and `phx.frontend.useSetFullscreen()` returns a function that sets it: `setFullscreen(true)` turns it on, `setFullscreen(false)` off. The layout's own button flips it, and the layout decides what to hide.
489
+
490
+ ```tsx
491
+ import { Button, Tooltip } from '@mui/material'
492
+
493
+ import { phx } from '../../.phoenix/phx.js'
494
+
495
+ const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
496
+ const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
497
+
498
+ interface FullscreenToggleProps {
499
+ // Only the icon, with the label as its accessible name and tooltip, where a label would cover the product
500
+ readonly compact?: boolean
501
+ }
502
+
503
+ export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
504
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
505
+ const setFullscreen = phx.frontend.useSetFullscreen()
506
+ const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
507
+ const icon = (
508
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
509
+ <path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
510
+ </svg>
511
+ )
512
+
513
+ return (
514
+ <Tooltip title={compact ? label : ''}>
515
+ <Button
516
+ onClick={() => setFullscreen(!isFullscreen)}
517
+ aria-label={compact ? label : undefined}
518
+ startIcon={compact ? undefined : icon}
519
+ sx={{
520
+ minBlockSize: 44,
521
+ minInlineSize: 44,
522
+ paddingInline: compact ? 0 : 2.5,
523
+ borderRadius: 999,
524
+ bgcolor: 'background.paper',
525
+ color: 'text.primary',
526
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
527
+ textTransform: 'none',
528
+ fontWeight: 600,
529
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
530
+ }}
531
+ >
532
+ {compact ? icon : label}
533
+ </Button>
534
+ </Tooltip>
535
+ )
536
+ }
537
+ ```
538
+
539
+ The button stays in the free area in both states, so the way back is always where the user left it. [Interaction Modes](?path=/docs/ux-guidelines-interaction-modes--docs#full-screen-preview) describes what fullscreen hides.
540
+
541
+ ## Show messages
542
+
543
+ When a change is rejected because it breaks an invariant, when a committed change carries a hint, or when an error is thrown while a change is validated, the configurator has a message for the customer. `phx.frontend.useConfiguratorMessages(onMessage)` calls `onMessage` once for each, with the text already in the customer's language, and the layout shows it its own way. Here a toast shows a message for six seconds, colored by its severity, at the bottom left of the free area above the view controls on a desktop, and at its top on a phone:
544
+
545
+ ```tsx
546
+ import { Alert } from '@mui/material'
547
+ import { useEffect, useState } from 'react'
548
+
549
+ import type { ConfiguratorMessage } from '@salsita-ai/sdk/react'
550
+
551
+ import { phx } from '../../.phoenix/phx.js'
552
+
553
+ const VIOLATION_SEVERITY = { fatal: 'error', fixable: 'error', warning: 'warning', notice: 'info' } as const
554
+ const RANK = { info: 0, warning: 1, error: 2 } as const
555
+ const VISIBLE_MS = 6000
556
+
557
+ const severityOf = (message: ConfiguratorMessage) => {
558
+ if (message.kind === 'violation') {
559
+ return VIOLATION_SEVERITY[message.violation.severity]
560
+ }
561
+
562
+ return message.kind === 'error' ? 'error' : 'info'
563
+ }
564
+
565
+ export const MessageToast = () => {
566
+ const [message, setMessage] = useState<ConfiguratorMessage | null>(null)
567
+
568
+ // A rejected change also reports the notices already present; keep the worst message while it is shown
569
+ phx.frontend.useConfiguratorMessages(next => {
570
+ setMessage(shown => (shown !== null && RANK[severityOf(next)] < RANK[severityOf(shown)] ? shown : next))
571
+ })
572
+
573
+ useEffect(() => {
574
+ if (message === null) {
575
+ return
576
+ }
577
+
578
+ const timeout = setTimeout(() => setMessage(null), VISIBLE_MS)
579
+
580
+ return () => clearTimeout(timeout)
581
+ }, [message])
582
+
583
+ if (message === null) {
584
+ return null
585
+ }
586
+
587
+ return (
588
+ <Alert
589
+ severity={severityOf(message)}
590
+ onClose={() => setMessage(null)}
591
+ sx={{ maxInlineSize: 420, borderRadius: 3, boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)' }}
592
+ >
593
+ {message.text}
594
+ </Alert>
595
+ )
596
+ }
597
+ ```
598
+
599
+ The hook takes a new function on every render without missing a message, so passing the state setter, or an inline function, is fine. `message.kind` is `'violation'`, `'sideEffect'` or `'error'`; a violation also carries `entityId` and the `violation` itself, with its `severity`. A rejected change brings one message for each violation of the rejected state, including notices and warnings that were already present, so the toast keeps the most severe message while it is shown instead of letting a later notice replace the reason for the rejection. The layout mounts the toast in the safe-area element, which sets `pointerEvents: 'none'`, so the toast's wrapper switches pointer events back on for the close button.
600
+
601
+ To give the toast something to show, the spec registers one transformer. Choosing **Tree trunk** keeps the change and adds a hint to it, which arrives as a `sideEffect` message:
602
+
603
+ ```ts
604
+ import { msg } from '@lingui/core/macro'
605
+
606
+ import { phx } from '../../.phoenix/phx.js'
607
+
608
+ // A tree-trunk edge is cut by hand; choosing it carries a hint, which reaches the layout as a side-effect message
609
+ export default phx.frontend.transformerBuilder.when
610
+ .entity(['Table'])
611
+ .modified({ atFields: ['edgeFinish'] })
612
+ .then.overrideMatchingUpdate(({ update }) => {
613
+ if (update.stateDelta.edgeFinish !== 'TreeTrunk') {
614
+ return [update]
615
+ }
616
+
617
+ return [{ ...update, hint: msg`Tree trunk edges are cut by hand, so delivery takes three weeks longer.` }]
618
+ })
619
+ .build('tree-trunk-delivery')
620
+ ```
621
+
622
+ [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui) lists the messages the hook does not deliver: a failure to save, errors of the built-in finalize and other actions, and preset errors stay snackbars.
623
+
624
+ ## Request a quote
625
+
626
+ The spec declares what finalizing means for this product as a `finalizeAction` component, and the project registers the handler it names:
627
+
628
+ ```yaml
629
+ components:
630
+ Table:
631
+ finalizeAction:
632
+ quote:
633
+ variant: primary
634
+ label: Request a quote
635
+ title: Send the configuration to the shop for a quote
636
+ icon: PaperPlaneTilt
637
+ handler: requestQuote
638
+ ```
639
+
640
+ ```ts
641
+ import { useCallback } from 'react'
642
+
643
+ import { phx } from '../../.phoenix/phx.js'
644
+
645
+ // Stands in for the shop's quote service: the request takes a moment, then the panel shows the confirmation
646
+ export default phx.frontend.createPhoenixHandler('requestQuote', () => {
647
+ const navigate = phx.frontend.useNavigate()
648
+
649
+ return {
650
+ handler: useCallback(async () => {
651
+ await new Promise(resolve => setTimeout(resolve, 1500))
652
+ navigate('requested')
653
+ }, [navigate]),
654
+ }
655
+ })
656
+ ```
657
+
658
+ The handler stands in for the shop's quote service: it waits a moment, as a request would, and then enters the `requested` navigation state, in which the panel thanks the customer. A handler is a hook factory, so it can use any hook, here `phx.frontend.useNavigate()`.
659
+
660
+ The panel lists the finalize actions with `phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] })` and offers the primary one, or the first when none is primary, in its review step. It renders the review step's buttons in a component of their own inside `<PhoenixHandlerBoundary name={handler}>`, because `phx.frontend.useFinalizeAction(handler)` runs the project's handler factory: it is called once per component, never in a loop, and the boundary remounts the buttons when the handler is edited. **Back to the configuration** lives in the same component, so it can be disabled while the request is pending.
661
+
662
+ ```tsx
663
+ import { Alert, Box, Button, CircularProgress, Typography } from '@mui/material'
664
+
665
+ import { phx } from '../../.phoenix/phx.js'
666
+
667
+ const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
668
+
669
+ interface ReviewActionsProps {
670
+ readonly handler: string
671
+ readonly label: string
672
+ readonly onBack: () => void
673
+ }
674
+
675
+ // The review step's buttons: one finalize action and the way back. `useFinalizeAction` runs the action's handler,
676
+ // so this component calls it exactly once and is rendered inside a `PhoenixHandlerBoundary` for that handler.
677
+ // Back is disabled while the request is pending, so the customer cannot change the configuration while it is sent.
678
+ // The pending state belongs to this component: when the panel unmounts, as in fullscreen, the request goes on and
679
+ // the remounted buttons are enabled again.
680
+ export const ReviewActions = ({ handler, label, onBack }: ReviewActionsProps) => {
681
+ const { run, isPending, error, disabled, hints } = phx.frontend.useFinalizeAction(handler)
682
+
683
+ return (
684
+ <Box component="div" sx={{ display: 'grid', gap: 2 }}>
685
+ <Box component="div" sx={{ display: 'grid', gap: 1 }}>
686
+ <Button
687
+ size="large"
688
+ variant="contained"
689
+ disabled={disabled || isPending}
690
+ onClick={run}
691
+ startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
692
+ sx={BUTTON_SX}
693
+ >
694
+ {isPending ? 'Sending the request…' : label}
695
+ </Button>
696
+ {disabled && hints && (
697
+ <Typography variant="caption" color="text.secondary">
698
+ {hints}
699
+ </Typography>
700
+ )}
701
+ {error && <Alert severity="error">The request could not be sent: {error.message}</Alert>}
702
+ </Box>
703
+ <Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
704
+ Back to the configuration
705
+ </Button>
706
+ </Box>
707
+ )
708
+ }
709
+ ```
710
+
711
+ - `run()` records the finalize-button click for analytics and runs the handler; it does nothing while `disabled` or `isPending`.
712
+ - While `isPending` the button shows a spinner and cannot be clicked again, and **Back to the configuration** is disabled, so the customer cannot change the configuration while it is sent. `isPending` and `error` belong to the mounted component: entering fullscreen unmounts the panel, the request goes on, and the panel shown after fullscreen starts with both buttons enabled. A layout that must rule that out keeps the review step mounted, or hides its fullscreen button while a request runs.
713
+ - `error` is what the handler rejected with. The layout shows it under the button; no snackbar is raised. It is cleared when the customer tries again.
714
+ - `disabled` and `hints` come from the configuration's violations: while a `warning` or worse holds, or the configuration failed to save, finalizing is not possible and `hints` says why.
715
+
716
+ The review step stays: a quote request is a commitment, so the customer sees the summary first, and a real shop collects the contact details there. A product that finalizes without a review offers the button in place of **Review and request a quote**. [Configurator Interface → Hooks for a Project Layout](?path=/docs/phoenix-configurator-interface--docs#hooks-for-a-project-layout) describes the hook, and [Finalization](?path=/docs/phoenix-finalization--docs) what a real flow does on the server.
717
+
718
+ ## Serve read mode
719
+
720
+ While `accessInfo.viewMode` is `true` the panel marks the view as view only, replaces the cards with the chosen finish and shows the price without an action; the finalize action is not offered, since `useFinalizeAction` does not check read mode itself. The hooks do not hide or disable anything in read mode: what a viewer can change is decided by what the layout renders. Rotating and zooming the scene, and fullscreen, stay available, as [Interaction Modes](?path=/docs/ux-guidelines-interaction-modes--docs#view-only-mode) recommends. The button on the table's edge is hidden for viewers by the spec, see [Put a control on the product](#put-a-control-on-the-product).
721
+
722
+ ## Fit a phone
723
+
724
+ A panel 380 pixels wide beside the scene leaves nothing of the table on a phone. Below a desktop width the layout puts the panel into a sheet at the bottom and lets the camera frame the table in the area above it. The layout above shows both arrangements.
725
+
726
+ **The switch.** `useActiveViewports()` from `@salsita-ai/sdk/react` returns the width classes the configurator's container satisfies. The container decides, not the window, so a configurator embedded in a narrow column of a wide page gets the phone arrangement too. The built-in layout switches on `desktop` as well.
727
+
728
+ | Value | When it is active |
729
+ | ----------- | ---------------------------------------------------------------------------------- |
730
+ | `phone` | The container is narrower than 480 pixels. |
731
+ | `mobile` | The container is at most 768 pixels wide. |
732
+ | `tablet` | The container is wider than 480 and narrower than 1024 pixels. |
733
+ | `desktop` | The container is wider than 768 pixels; `mobile` and `desktop` exclude each other. |
734
+ | `landscape` | The browser window, not the container, is wider than it is high. |
735
+ | `portrait` | The browser window, not the container, is higher than it is wide. |
736
+
737
+ The hook returns `null` until the container has been measured, and the layout renders only the scene until then, so a phone never shows the desktop panel for a frame.
738
+
739
+ **The sheet.** On a phone the layout is a column: the safe-area element takes the height the sheet leaves, and the sheet sits below it. The sheet has two positions. Collapsed, it shows the name, the price and the action; open, it shows the description and the cards too. The `collapsed` prop of the panel hides the description and the cards, and nothing else, and `inSheet` keeps the top of the cards in view. The sheet scrolls what does not fit, so the price, the review step, **Request a quote** and the thank-you message are reachable in both positions.
740
+
741
+ ```tsx
742
+ import { Box, ButtonBase } from '@mui/material'
743
+ import { type MouseEvent, type PointerEvent, type ReactNode, useRef } from 'react'
744
+
745
+ // A drag shorter than this is a tap, and the handle's click toggles the sheet
746
+ const TAP_DISTANCE = 6
747
+ // A drag that ends this far from where it started snaps to the other position
748
+ const SNAP_DISTANCE = 48
749
+ // A drag faster than this, in pixels per millisecond, snaps in its direction even when it is short
750
+ const SNAP_VELOCITY = 0.5
751
+ // How far the sheet follows the finger towards the position it is already in
752
+ const OVERDRAG = 0.25
753
+
754
+ interface BottomSheetProps {
755
+ readonly open: boolean
756
+ readonly onOpenChange: (open: boolean) => void
757
+ readonly label: string
758
+ readonly children: ReactNode
759
+ }
760
+
761
+ interface Drag {
762
+ readonly startY: number
763
+ readonly startTime: number
764
+ delta: number
765
+ }
766
+
767
+ // A persistent sheet at the bottom of the layout with two positions, open and collapsed. It is not a modal: the scene
768
+ // above it stays interactive. Its height comes from its content, so the layout's safe area ends where the sheet
769
+ // starts and changes only when the sheet snaps. While the handle is dragged the sheet follows the finger with a
770
+ // transform, which the safe area does not see, so the camera refits once per snap and not on every move.
771
+ export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheetProps) => {
772
+ const sheetRef = useRef<HTMLElement>(null)
773
+ const dragRef = useRef<Drag | null>(null)
774
+ const draggedRef = useRef(false)
775
+
776
+ const moveSheet = (offset: number, animate: boolean) => {
777
+ if (sheetRef.current) {
778
+ sheetRef.current.style.transition = animate ? 'transform 200ms ease-out' : 'none'
779
+ sheetRef.current.style.transform = offset === 0 ? '' : `translateY(${offset}px)`
780
+ }
781
+ }
782
+
783
+ const handlePointerDown = (event: PointerEvent<HTMLButtonElement>) => {
784
+ event.currentTarget.setPointerCapture(event.pointerId)
785
+ dragRef.current = { startY: event.clientY, startTime: event.timeStamp, delta: 0 }
786
+ draggedRef.current = false
787
+ }
788
+
789
+ const handlePointerMove = (event: PointerEvent<HTMLButtonElement>) => {
790
+ const drag = dragRef.current
791
+
792
+ if (drag === null) {
793
+ return
794
+ }
795
+
796
+ drag.delta = event.clientY - drag.startY
797
+ // Down closes an open sheet and up opens a collapsed one; the other direction only gives a little
798
+ const towardsOther = open ? drag.delta > 0 : drag.delta < 0
799
+ moveSheet(towardsOther ? drag.delta : drag.delta * OVERDRAG, false)
800
+ }
801
+
802
+ const handlePointerEnd = (event: PointerEvent<HTMLButtonElement>) => {
803
+ const drag = dragRef.current
804
+ dragRef.current = null
805
+
806
+ if (drag === null) {
807
+ return
808
+ }
809
+
810
+ moveSheet(0, true)
811
+
812
+ if (Math.abs(drag.delta) < TAP_DISTANCE) {
813
+ return
814
+ }
815
+
816
+ draggedRef.current = true
817
+ const velocity = drag.delta / Math.max(event.timeStamp - drag.startTime, 1)
818
+ const flicked = Math.abs(drag.delta) >= SNAP_DISTANCE || Math.abs(velocity) >= SNAP_VELOCITY
819
+
820
+ if (flicked && (open ? drag.delta > 0 : drag.delta < 0)) {
821
+ onOpenChange(!open)
822
+ }
823
+ }
824
+
825
+ // A tap, Enter or Space toggles the sheet. The pointer click that ends a drag has already been handled; a keyboard
826
+ // click (`detail` 0) always toggles, also after a touch drag that was followed by no click.
827
+ const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
828
+ const dragged = draggedRef.current
829
+ draggedRef.current = false
830
+
831
+ if (dragged && event.detail !== 0) {
832
+ return
833
+ }
834
+
835
+ onOpenChange(!open)
836
+ }
837
+
838
+ return (
839
+ <Box
840
+ component="section"
841
+ ref={sheetRef}
842
+ aria-label={label}
843
+ sx={{
844
+ position: 'relative',
845
+ flexShrink: 0,
846
+ display: 'flex',
847
+ flexDirection: 'column',
848
+ maxBlockSize: '55%',
849
+ paddingBlockEnd: 'env(safe-area-inset-bottom)',
850
+ borderStartStartRadius: 20,
851
+ borderStartEndRadius: 20,
852
+ bgcolor: 'background.paper',
853
+ boxShadow: '0 -8px 32px rgba(0, 0, 0, 0.12)',
854
+ // Fills the gap below the sheet while it is dragged up
855
+ '&::after': {
856
+ content: '""',
857
+ position: 'absolute',
858
+ insetInline: 0,
859
+ insetBlockStart: '100%',
860
+ blockSize: '100vh',
861
+ bgcolor: 'background.paper',
862
+ },
863
+ }}
864
+ >
865
+ <ButtonBase
866
+ aria-expanded={open}
867
+ disableRipple
868
+ aria-label={open ? `Collapse ${label.toLowerCase()}` : `Expand ${label.toLowerCase()}`}
869
+ onClick={handleClick}
870
+ onPointerDown={handlePointerDown}
871
+ onPointerMove={handlePointerMove}
872
+ onPointerUp={handlePointerEnd}
873
+ onPointerCancel={handlePointerEnd}
874
+ sx={{
875
+ flexShrink: 0,
876
+ blockSize: 36,
877
+ touchAction: 'none',
878
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: -4, borderRadius: 3 },
879
+ }}
880
+ >
881
+ <Box component="span" sx={{ inlineSize: 40, blockSize: 4, borderRadius: 2, bgcolor: 'text.disabled' }} />
882
+ </ButtonBase>
883
+ {/* A column, so the panel's cards region shrinks first and the price and action stay in view; below the cards
884
+ region's minimum height the content scrolls as a whole, as the review step does on a short phone */}
885
+ <Box
886
+ component="div"
887
+ sx={{
888
+ display: 'flex',
889
+ flexDirection: 'column',
890
+ flex: '1 1 auto',
891
+ minBlockSize: 0,
892
+ overflowY: 'auto',
893
+ overscrollBehavior: 'contain',
894
+ }}
895
+ >
896
+ {children}
897
+ </Box>
898
+ </Box>
899
+ )
900
+ }
901
+ ```
902
+
903
+ - The handle is a real button with `aria-expanded`. A tap, Enter or Space toggles the sheet, and dragging it up or down snaps the sheet to the other position when the drag is long or fast enough. `touchAction: 'none'` is set on the handle only, so the cards still scroll by touch.
904
+ - The sheet's height comes from its content and is at most 55% of the configurator; when the content does not fit, the cards region shrinks until only the top of the cards shows and scrolls, and below that the sheet's content scrolls as a whole. On a phone with room for the header, the top of the cards and the footer, the price and the action stay in view with the sheet open; on a shorter one the customer scrolls the sheet to them, and the review step's buttons are reached the same way in both positions. A scroll on the cards that reaches their end moves the sheet on. Because the safe-area element is its neighbour in the column, the free area ends where the sheet starts without anything being measured by the layout.
905
+ - While the handle is dragged the sheet follows the finger with a `transform`. `useSceneSafeArea()` does not see a transform, so the free area changes once, when the sheet snaps, and the camera refits once. A safe area that followed the finger would refit the camera on every move and reset an orbit the customer made.
906
+ - The sheet is not a modal: no backdrop covers the scene, so the table can be orbited with one finger and zoomed with two while the sheet is open. MUI's temporary `Drawer` and `SwipeableDrawer` are modals and would block the scene; their persistent and permanent variants have no backdrop, but no drag handle with two positions either.
907
+
908
+ **What else moves.** The toast sits at the top of the free area, so it does not cover the sheet's handle, and the fullscreen button shows only its icon, with its label as tooltip and accessible name, so the toast has room beside it. Fullscreen removes the sheet as it removes the panel on a desktop. The sheet keeps its position while fullscreen is on.
909
+
910
+ **A camera for the phone.** The desktop camera is close enough to fill a wide free area, and on a narrow one it cuts off the ends of the table. So each camera has a filter on the viewport: the desktop camera `main` applies while `desktop` is active, and a second camera, `phone`, with a larger distance frames the whole table while `mobile` is. The filters exclude each other once the container is measured. Before that, for example when an image of the configuration is rendered, no viewport is known and a viewport filter matches, so both cameras apply and the higher priority of `main` decides:
911
+
912
+ ```yaml
913
+ components:
914
+ Table:
915
+ fitRootPerspectiveCamera:
916
+ main:
917
+ priority: 2
918
+ fov: 35
919
+ near: 100
920
+ far: 10000
921
+ minDistance: 1000
922
+ maxDistance: 9000
923
+ distance: 5000
924
+ azimuthAngle: 1.5
925
+ polarAngle: 1.1
926
+ fitMeshChanges: true
927
+ $filter:
928
+ viewports: [desktop]
929
+ phone:
930
+ priority: 1
931
+ fov: 35
932
+ near: 100
933
+ far: 10000
934
+ minDistance: 1000
935
+ maxDistance: 12000
936
+ distance: 8000
937
+ azimuthAngle: 1.5
938
+ polarAngle: 1.1
939
+ fitMeshChanges: true
940
+ $filter:
941
+ viewports: [mobile]
942
+ ```
943
+
944
+ ## Put a control on the product
945
+
946
+ The edge finish is a detail of the tabletop, so the layout also offers it on the table itself: a round button on the middle of the long edge opens the four finishes next to the edge. On a phone it is a way to change the edge without opening the sheet.
947
+
948
+ A control in the scene is a spec component that names an element of the project. `htmlHotspot` places an HTML element at an offset from the entity's origin, in the model's units, here millimetres: half the table's depth towards the camera and just below the top's surface. Its `$filter` shows it only to the owner and only while the `configure` navigation state is active, so a viewer and the review step do not get it, and the element does not check either itself:
949
+
950
+ ```yaml
951
+ components:
952
+ Table:
953
+ htmlHotspot:
954
+ edgeFinish:
955
+ name: EdgeFinishHotspot
956
+ offsetX: 500
957
+ offsetY: 800
958
+ offsetZ: 0
959
+ $filter:
960
+ modes: [owner]
961
+ navigationStates: [configure]
962
+ ```
963
+
964
+ The element is registered with `phx.frontend.createCustomPhoenixEntityElement` under the name the spec gives. It receives the id of the entity the hotspot belongs to, and reads the same `attributeSelection` the panel reads:
965
+
966
+ ```tsx
967
+ import { Box, ButtonBase, Popover, Tooltip } from '@mui/material'
968
+ import { useState } from 'react'
969
+
970
+ import { phx } from '../../.phoenix/phx.js'
971
+ import { EdgeFinishCards } from '../_shared/EdgeFinishCards.js'
972
+
973
+ // The edge profile the button shows, the square edge of the cards' drawings
974
+ const EDGE_ICON = 'M3 7H17L21 11V13L17 17H3Z'
975
+
976
+ // Rendered by the spec's `htmlHotspot` on the table's edge: a button on the product that opens the edge finishes
977
+ // next to the edge, with the same cards as the panel. The spec's `$filter` decides when it is shown.
978
+ export default phx.frontend.createCustomPhoenixEntityElement('EdgeFinishHotspot', ({ entityId }) => {
979
+ const edgeFinish = phx.frontend.useAttributeSelection(entityId, 'edgeFinish')
980
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null)
981
+
982
+ return (
983
+ <>
984
+ <Tooltip title="Edge finish">
985
+ <ButtonBase
986
+ aria-label="Edge finish"
987
+ aria-haspopup="dialog"
988
+ aria-expanded={anchor !== null}
989
+ onClick={event => setAnchor(event.currentTarget)}
990
+ sx={{
991
+ display: 'grid',
992
+ placeItems: 'center',
993
+ inlineSize: 44,
994
+ blockSize: 44,
995
+ borderRadius: '50%',
996
+ bgcolor: 'background.paper',
997
+ color: 'primary.main',
998
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
999
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
1000
+ }}
1001
+ >
1002
+ <svg viewBox="0 0 24 24" width={22} height={22} aria-hidden>
1003
+ <path d={EDGE_ICON} fill="currentColor" />
1004
+ </svg>
1005
+ </ButtonBase>
1006
+ </Tooltip>
1007
+ <Popover
1008
+ open={anchor !== null}
1009
+ anchorEl={anchor}
1010
+ onClose={() => setAnchor(null)}
1011
+ anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
1012
+ transformOrigin={{ vertical: 'bottom', horizontal: 'center' }}
1013
+ slotProps={{
1014
+ paper: { role: 'dialog', 'aria-label': 'Edge finish', sx: { borderRadius: 4, marginBlockStart: -1 } },
1015
+ }}
1016
+ >
1017
+ <Box component="div" sx={{ inlineSize: 340, maxInlineSize: 'calc(100vw - 32px)', padding: 2 }}>
1018
+ <EdgeFinishCards selection={edgeFinish} />
1019
+ </Box>
1020
+ </Popover>
1021
+ </>
1022
+ )
1023
+ })
1024
+ ```
1025
+
1026
+ - The hotspot is rendered inside the scene, but it has the theme and every `phx.frontend` hook, like the layout. MUI's `Popover` and `Tooltip` render into the configurator's own modal root, so they are styled and work inside its shadow root.
1027
+ - The cards in the popover are the panel's `EdgeFinishCards`, used a second time. A choice changes the edge, the price and the panel's cards at once, and the popover stays open so the customer can compare the finishes on the table.
1028
+ - Keyboard: the button is in the tab order, Enter and Space open the popover and move the focus into it, the arrow keys change the finish, and Escape closes it and returns the focus to the button.
1029
+ - `controlHotspot: true` would hide the hotspot while a change is being applied, which would also unmount the open popover on every choice, so this hotspot does not set it.
1030
+ - The scene's HTML is painted inside the canvas's stacking context, under the layout's panel and sheet. A hotspot that a panel covers cannot be clicked there.
1031
+
1032
+ [Html Hotspots](?path=/docs/controls-scene-html-hotspots--docs) describes the component and its other properties.
1033
+
1034
+ ## Control the scene
1035
+
1036
+ The four finishes differ by a few millimetres on a table two metres long, so from the default distance the difference is hard to judge. The layout offers two views, **Whole table** and **Edge close-up**, a close and low look at a corner of the top, and a **Reset view** button that brings back the framing after the customer has orbited, panned or zoomed.
1037
+
1038
+ **Views are view states.** The spec lists them, and each camera says by its `$filter` in which view states and at which widths it applies. The two close-up cameras have the highest priorities and apply only in the `edge` view state, the desktop one with `desktop` and the phone one with `mobile`, a little farther away. In the `overview` view state, the first in the list and so the initial one, only the two whole-table cameras of [Fit a phone](#fit-a-phone) apply. A camera always looks at the middle of the table, so the close-up shows the near corner, where the edge profile is seen on both sides:
1039
+
1040
+ ```yaml
1041
+ viewStates:
1042
+ - overview
1043
+ - edge
1044
+
1045
+ components:
1046
+ Table:
1047
+ fitRootPerspectiveCamera:
1048
+ edge:
1049
+ priority: 4
1050
+ fov: 35
1051
+ near: 100
1052
+ far: 10000
1053
+ minDistance: 800
1054
+ maxDistance: 9000
1055
+ distance: 2000
1056
+ azimuthAngle: 0.5
1057
+ polarAngle: 1.15
1058
+ fitMeshChanges: true
1059
+ $filter:
1060
+ viewports: [desktop]
1061
+ viewStates: [edge]
1062
+ edgePhone:
1063
+ priority: 3
1064
+ fov: 35
1065
+ near: 100
1066
+ far: 10000
1067
+ minDistance: 800
1068
+ maxDistance: 12000
1069
+ distance: 3000
1070
+ azimuthAngle: 0.5
1071
+ polarAngle: 1.15
1072
+ fitMeshChanges: true
1073
+ $filter:
1074
+ viewports: [mobile]
1075
+ viewStates: [edge]
1076
+ ```
1077
+
1078
+ **The buttons.** `phx.frontend.useActiveViewState()` returns the active view state and `phx.frontend.useSetViewState()` a function that makes another one active; the camera then moves to the camera of that view state. `phx.frontend.useResetCamera()` returns a function that moves the camera back to the framing of the active camera, the whole table or the close-up:
1079
+
1080
+ ```tsx
1081
+ import { Box, Button, Tooltip } from '@mui/material'
1082
+
1083
+ import { phx } from '../../.phoenix/phx.js'
1084
+
1085
+ // The spec's view states, each with the label of the button that shows it
1086
+ const VIEWS = [
1087
+ { state: 'overview', label: 'Whole table' },
1088
+ { state: 'edge', label: 'Edge close-up' },
1089
+ ] as const
1090
+
1091
+ const RESET_ICON = 'M4 12a8 8 0 1 0 2.4-5.7M4 4v4h4'
1092
+
1093
+ const SURFACE_SX = {
1094
+ borderRadius: 999,
1095
+ bgcolor: 'background.paper',
1096
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
1097
+ } as const
1098
+
1099
+ const BUTTON_SX = {
1100
+ minBlockSize: 44,
1101
+ minInlineSize: 44,
1102
+ borderRadius: 999,
1103
+ textTransform: 'none',
1104
+ fontWeight: 600,
1105
+ whiteSpace: 'nowrap',
1106
+ } as const
1107
+
1108
+ interface SceneControlsProps {
1109
+ // The reset button shows only its icon, with its label as tooltip and accessible name
1110
+ readonly compact?: boolean
1111
+ // Only the reset button, without the view buttons
1112
+ readonly resetOnly?: boolean
1113
+ }
1114
+
1115
+ // The layout's own camera controls: one button per view state of the spec, and a reset that undoes an orbit
1116
+ export const SceneControls = ({ compact = false, resetOnly = false }: SceneControlsProps) => {
1117
+ const activeView = phx.frontend.useActiveViewState()
1118
+ const setViewState = phx.frontend.useSetViewState()
1119
+ const resetCamera = phx.frontend.useResetCamera()
1120
+ const resetIcon = (
1121
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
1122
+ <path d={RESET_ICON} />
1123
+ </svg>
1124
+ )
1125
+
1126
+ return (
1127
+ <Box component="div" sx={{ display: 'flex', gap: 1 }}>
1128
+ {!resetOnly && (
1129
+ <Box component="div" role="group" aria-label="View" sx={{ ...SURFACE_SX, display: 'flex' }}>
1130
+ {VIEWS.map(view => {
1131
+ const isActive = activeView === view.state
1132
+
1133
+ return (
1134
+ <Button
1135
+ key={view.state}
1136
+ aria-pressed={isActive}
1137
+ onClick={() => setViewState(view.state)}
1138
+ sx={{
1139
+ ...BUTTON_SX,
1140
+ paddingInline: 2,
1141
+ bgcolor: isActive ? 'text.primary' : 'transparent',
1142
+ color: isActive ? 'background.paper' : 'text.primary',
1143
+ '&:hover': { bgcolor: isActive ? 'text.primary' : 'action.hover' },
1144
+ }}
1145
+ >
1146
+ {view.label}
1147
+ </Button>
1148
+ )
1149
+ })}
1150
+ </Box>
1151
+ )}
1152
+ <Tooltip title={compact ? 'Reset view' : ''}>
1153
+ <Button
1154
+ onClick={resetCamera}
1155
+ aria-label={compact ? 'Reset view' : undefined}
1156
+ startIcon={compact ? undefined : resetIcon}
1157
+ sx={{
1158
+ ...SURFACE_SX,
1159
+ ...BUTTON_SX,
1160
+ paddingInline: compact ? 0 : 2,
1161
+ color: 'text.primary',
1162
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
1163
+ }}
1164
+ >
1165
+ {compact ? resetIcon : 'Reset view'}
1166
+ </Button>
1167
+ </Tooltip>
1168
+ </Box>
1169
+ )
1170
+ }
1171
+ ```
1172
+
1173
+ - The view buttons are a group with `aria-pressed`, so a screen reader announces which view is active, and the active one is drawn dark, not only in another colour.
1174
+ - On a desktop the controls sit at the bottom right of the free area and the toast above its bottom left; on a phone they sit at the bottom of the free area, just above the sheet. On a phone, and on a desktop arrangement below 1024 pixels, where `tablet` is also active and the free area beside the panel is narrow, **Reset view** shows only its icon, with its label as tooltip and accessible name.
1175
+ - In fullscreen the controls stay on a desktop. On a phone the view buttons are hidden and **Reset view** stays, as [Interaction Modes](?path=/docs/ux-guidelines-interaction-modes--docs#full-screen-preview) describes for the built-in layout: on a phone the canvas is small and the product comes first, and the way back to the framed product is still needed after an orbit.
1176
+ - The controls stay in the review step and in read mode: changing the view changes nothing in the configuration, and a viewer may look at the product as closely as the customer.
1177
+ - The hooks need no `viewControls` component. That component configures the built-in layout's view controls and has no effect here.
1178
+
1179
+ ## The spec the layout reads
1180
+
1181
+ The layout reads four components of the root entity and its navigation and view states; the scene components are in the complete implementation below. `SceneControls` names the view states `overview` and `edge` in its code, so they must match the spec's `viewStates`.
1182
+
1183
+ ```yaml
1184
+ navigationStates:
1185
+ - configure
1186
+ - checkout
1187
+ - requested
1188
+
1189
+ viewStates:
1190
+ - overview
1191
+ - edge
1192
+
1193
+ components:
1194
+ Table:
1195
+ detail:
1196
+ main:
1197
+ title: Linden dining table
1198
+ subtitle: Solid oak, seats six
1199
+ description: A solid oak top on slender steel legs, finished with the edge profile of your choice.
1200
+ price:
1201
+ main:
1202
+ price:
1203
+ $read: $price
1204
+ attributeSelection:
1205
+ edgeFinish:
1206
+ value:
1207
+ $bind: edgeFinish
1208
+ options:
1209
+ - label: Square
1210
+ description: Crisp and modern
1211
+ value: None
1212
+ - label: Facet
1213
+ description: A light bevel
1214
+ value: Facet
1215
+ - label: Round
1216
+ description: Soft to the touch
1217
+ value: Round
1218
+ - label: Tree trunk
1219
+ description: The natural edge
1220
+ value: TreeTrunk
1221
+ finalizeAction:
1222
+ quote:
1223
+ variant: primary
1224
+ label: Request a quote
1225
+ title: Send the configuration to the shop for a quote
1226
+ icon: PaperPlaneTilt
1227
+ handler: requestQuote
1228
+
1229
+ transformers:
1230
+ - name: tree-trunk-delivery
1231
+ ```
1232
+
1233
+ `$price` is a custom expression in `src/expressions/table.ts` that adds a surcharge per finish, and `tree-trunk-delivery` is the transformer in `src/transformers/tree-trunk-delivery.ts` that adds the hint shown in [Show messages](#show-messages), and `requestQuote` is the handler in `src/handlers/request-quote.ts`. The example sets no `applicationConfig` and no layout components: `layout`, the header, the sidebar footer, the toolbar, `viewControls` and property pages configure the built-in layout and have no effect on this one. The `finalizeAction` is not one of them: it describes the product's own finalizing, which this layout offers itself.
1234
+
1235
+ ## Try the example
1236
+
1237
+ To see read mode, open **Mocks** in the editor rail on the left and apply the **Read User** template.
1238
+
1239
+ The same layout in a frame 390 pixels wide, as on a phone. Opened on its own from the sidebar, the **Phone** story sets Storybook's viewport to 390 × 844.
1240
+
1241
+ ## Test cases
1242
+
1243
+ - The panel is on the left and the table is centred in the area to the right of it, not in the whole canvas.
1244
+ - Choosing **Tree trunk** moves the check mark to that card, changes the edge of the tabletop and raises the price from $1,290.00 to $1,630.00.
1245
+ - Choosing **Tree trunk** also shows "Tree trunk edges are cut by hand, so delivery takes three weeks longer." at the bottom left of the free area, above the view controls, until its close button is clicked or six seconds pass. Choosing another finish shows nothing.
1246
+ - Tab reaches the selected card, and the arrow keys move the selection to the next or previous card.
1247
+ - Dragging in the area to the right of the panel orbits the camera.
1248
+ - **Review and request a quote** replaces the cards with the chosen finish and offers **Request a quote**; **Back to the configuration** brings the cards back.
1249
+ - **Request a quote** shows a spinner and "Sending the request…" for about a second and a half, with **Back to the configuration** disabled, then "Thank you. Your quote request is on its way, and the shop replies within two working days."; **Back to the configuration** then returns to the cards.
1250
+ - **Fullscreen** removes the panel and the table moves to the centre of the canvas; **Exit fullscreen** brings both back.
1251
+ - With the **Read User** mock the panel says **View only**, shows the chosen finish and the price, and has no button, so no quote can be requested.
1252
+ - A round button sits on the middle of the table's long edge. Clicking it opens the four finishes next to it; choosing **Round** there moves the check mark in the popover and in the panel, rounds the edge and raises the price to $1,410.00. Escape closes the popover.
1253
+ - Tab reaches the button on the edge, and Enter or Space opens the popover.
1254
+ - The button on the edge is gone in the review step, in the confirmation and with the **Read User** mock, and stays in fullscreen.
1255
+ - In the **Phone** story the panel is a sheet at the bottom showing the name, the price and **Review and request a quote**, and the whole table is visible above it.
1256
+ - Tapping the sheet's handle, or dragging it up, opens the sheet with the cards; the table moves up once the sheet has snapped and stays fully visible. Dragging the handle down, or tapping it again, collapses the sheet.
1257
+ - On the phone, the review step, **Request a quote** and the thank-you message work with the sheet collapsed and open.
1258
+ - On the phone, choosing **Tree trunk** shows the hint at the top of the free area, beside the fullscreen button.
1259
+ - On the phone, the fullscreen button removes the sheet and the table moves to the centre of the canvas; pressing it again brings the sheet back in the position it had.
1260
+ - **Edge close-up** moves the camera close to the near corner of the top, where the edge profile shows; the button is drawn dark and the other light. **Whole table** returns to the whole table.
1261
+ - After dragging in the free area to orbit the table, **Reset view** returns to the framing of the active view, the whole table or the close-up.
1262
+ - The view buttons and **Reset view** sit at the bottom right of the free area on a desktop and just above the sheet on a phone, and overlap neither the panel, the sheet, the button on the edge nor the toast.
1263
+ - In fullscreen the view controls stay on a desktop. On a phone the view buttons are hidden and **Reset view** stays; after an orbit it restores the framing.
1264
+
1265
+ ## Known gaps
1266
+
1267
+ A project layout has only what it renders. This one leaves out the following, each of which a product may need. [Layout Slots](?path=/docs/phoenix-layout-slots--docs) describes every `LayoutSlots` member named here.
1268
+
1269
+ - **Messages that stay snackbars.** The toast shows violations, side effects and errors, and the finalize button shows its own error. A failure to save the configuration is still raised as a snackbar, which renders into `LayoutSlots.DesktopSnackbarsRoot`; this layout mounts no snackbar root, so it appears outside the configurator. A layout that wants it inside mounts the root.
1270
+ - **Toolbar actions.** Undo and redo, measurements, sharing and language switching are not offered. A layout can mount `LayoutSlots.DesktopToolbar` for the toolbar the spec configures, or build its own buttons.
1271
+ - **The spec's view controls, tool controls and leaving a tool mode.** A spec can configure view controls and tool controls, and a tool mode has a button that leaves it. The built-in layout places them with `LayoutSlots.DesktopViewControls`, `LayoutSlots.DesktopToolControls` and `LayoutSlots.DesktopCallToAction`; this layout mounts none of them, so the spec's `viewControls` and `toolControls` do not appear. Its views come from its own buttons instead, see [Control the scene](#control-the-scene), and it has no tool modes.
1272
+ - **A project's layout dialog.** A dialog the project registers with `phx.frontend.createLayoutDialog` is shown by `LayoutDialog`, which the built-in layout mounts. This layout does not; a layout that needs the dialog mounts `LayoutDialog` from `@salsita-ai/sdk/configurator`.
1273
+ - **Selection.** The table has no parts to select. A product with selectable parts reads `phx.frontend.useSelectedDomainEntityId()` and shows the controls of the selected part.
1274
+ - **Clone to edit in read mode.** With `shareCloneToEdit` set, the built-in layout's `LayoutSlots.DesktopReadonlyBanner` offers **Edit configuration** to a viewer; this layout's "View only" label offers nothing. A layout mounts the banner, or builds its own action with `LayoutSlots.useIsCloningAllowed()` and `LayoutSlots.CloneToEditDialog`.
1275
+ - **Back and close.** The built-in header's back button returns to the product choice, runs the host's close action or leaves the expanded view, whichever applies. This layout has none of them. `useCloseAction()` from `@salsita-ai/sdk/configurator` returns the host's close action, or `null` when there is none; the hook that chooses among the three is not exported.
1276
+ - **Analytics.** The finalize button records `FinalizeButtonClicked` through `useFinalizeAction`. The built-in fullscreen button records `FullScreenModeToggled`; this layout's fullscreen and other buttons record nothing. A layout that wants the events pushes `FrontendAnalyticsFactory.FullScreenModeToggled()` and the like, from `@salsita-ai/sdk/configurator`, with `phx.frontend.useAnalytics().push(...)`.
1277
+ - **Preview start screen.** The built-in layout shows a preview while `usePreview().isPreview` is set, which `preview: auto` does on phones without the project opting in. This layout ignores it and always renders the interface.
1278
+ - **Assistant panel.** A project layout gets it only with `LayoutSlots.DesktopSidebar`, the built-in sidebar as one piece, see [Sidebar in a Custom Layout](?path=/docs/layouts-sidebar-in-a-custom-layout--docs); this layout does not use it.
1279
+ - **"Powered by Salsita" mark.** The built-in layout shows it; a project layout decides whether to mount `LayoutSlots.DesktopPoweredBy`, and this one does not.
1280
+
1281
+ ## Related pages
1282
+
1283
+ - [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui) is the reference for the element name, the minimal layout, the SDK pieces a layout can mount and the hooks it reads.
1284
+ - [Universal](?path=/docs/layouts-universal--docs) is the built-in layout this one replaces.
1285
+ - [Header / Custom](?path=/docs/layouts-header-custom--docs) replaces only the header, with the price from `useRootEntityPrice()`.
1286
+ - [Canvas Padding](?path=/docs/layouts-canvas-padding--docs) scales the gaps `useSceneSafeArea()` measures.
1287
+ - [Presets / Custom](?path=/docs/layouts-presets-custom--docs) replaces the preset screen the same way.
1288
+
1289
+ ## Complete Implementation
1290
+
1291
+ {/* AUTO-GENERATED SECTION: This section is automatically updated by 'phoenix story build' */}
1292
+
1293
+ <details>
1294
+ <summary>Click to view the complete implementation files</summary>
1295
+
1296
+ ### ./spec/domain.yaml
1297
+
1298
+ ```yaml
1299
+ model:
1300
+ latest:
1301
+ entityTypes:
1302
+ - Table
1303
+ aliases:
1304
+ RootEntity:
1305
+ - Table
1306
+ commonTypes:
1307
+ EdgeFinish:
1308
+ enum:
1309
+ - None
1310
+ - Facet
1311
+ - Round
1312
+ - TreeTrunk
1313
+ shapes:
1314
+ Table:
1315
+ edgeFinish:
1316
+ $ref: '#/model/latest/commonTypes/EdgeFinish'
1317
+
1318
+ presets:
1319
+ - rootEntityType: Table
1320
+ initialDomainEntities:
1321
+ - id: Table-1
1322
+ type: Table
1323
+ edgeFinish: None
1324
+
1325
+ navigationStates:
1326
+ - configure
1327
+ - checkout
1328
+ - requested
1329
+
1330
+ viewStates:
1331
+ - overview
1332
+ - edge
1333
+
1334
+ components:
1335
+ Table:
1336
+ detail:
1337
+ main:
1338
+ title: Linden dining table
1339
+ subtitle: Solid oak, seats six
1340
+ description: A solid oak top on slender steel legs, finished with the edge profile of your choice.
1341
+ price:
1342
+ main:
1343
+ price:
1344
+ $read: $price
1345
+ attributeSelection:
1346
+ edgeFinish:
1347
+ value:
1348
+ $bind: edgeFinish
1349
+ options:
1350
+ - label: Square
1351
+ description: Crisp and modern
1352
+ value: None
1353
+ - label: Facet
1354
+ description: A light bevel
1355
+ value: Facet
1356
+ - label: Round
1357
+ description: Soft to the touch
1358
+ value: Round
1359
+ - label: Tree trunk
1360
+ description: The natural edge
1361
+ value: TreeTrunk
1362
+ finalizeAction:
1363
+ quote:
1364
+ variant: primary
1365
+ label: Request a quote
1366
+ title: Send the configuration to the shop for a quote
1367
+ icon: PaperPlaneTilt
1368
+ handler: requestQuote
1369
+ htmlHotspot:
1370
+ edgeFinish:
1371
+ name: EdgeFinishHotspot
1372
+ offsetX: 500
1373
+ offsetY: 800
1374
+ offsetZ: 0
1375
+ $filter:
1376
+ modes: [owner]
1377
+ navigationStates: [configure]
1378
+ fitRootPerspectiveCamera:
1379
+ main:
1380
+ priority: 2
1381
+ fov: 35
1382
+ near: 100
1383
+ far: 10000
1384
+ minDistance: 1000
1385
+ maxDistance: 9000
1386
+ distance: 5000
1387
+ azimuthAngle: 1.5
1388
+ polarAngle: 1.1
1389
+ fitMeshChanges: true
1390
+ $filter:
1391
+ viewports: [desktop]
1392
+ phone:
1393
+ priority: 1
1394
+ fov: 35
1395
+ near: 100
1396
+ far: 10000
1397
+ minDistance: 1000
1398
+ maxDistance: 12000
1399
+ distance: 8000
1400
+ azimuthAngle: 1.5
1401
+ polarAngle: 1.1
1402
+ fitMeshChanges: true
1403
+ $filter:
1404
+ viewports: [mobile]
1405
+ edge:
1406
+ priority: 4
1407
+ fov: 35
1408
+ near: 100
1409
+ far: 10000
1410
+ minDistance: 800
1411
+ maxDistance: 9000
1412
+ distance: 2000
1413
+ azimuthAngle: 0.5
1414
+ polarAngle: 1.15
1415
+ fitMeshChanges: true
1416
+ $filter:
1417
+ viewports: [desktop]
1418
+ viewStates: [edge]
1419
+ edgePhone:
1420
+ priority: 3
1421
+ fov: 35
1422
+ near: 100
1423
+ far: 10000
1424
+ minDistance: 800
1425
+ maxDistance: 12000
1426
+ distance: 3000
1427
+ azimuthAngle: 0.5
1428
+ polarAngle: 1.15
1429
+ fitMeshChanges: true
1430
+ $filter:
1431
+ viewports: [mobile]
1432
+ viewStates: [edge]
1433
+ sceneEntityRemoteObject:
1434
+ top:
1435
+ fileUrl: /models/tables.gltf
1436
+ objectName: RECHTHOEK_RECTANGLE
1437
+ dimensionUnit: m
1438
+ leg:
1439
+ fileUrl: /models/tables.gltf
1440
+ objectName: AXL_LEG
1441
+ dimensionUnit: m
1442
+ sceneEntityObjectProperties:
1443
+ top:
1444
+ offsetY: 820
1445
+ morphTargetInfluences:
1446
+ Facet:
1447
+ value:
1448
+ $read: $edgeFinishFacet
1449
+ scaleOne: 1
1450
+ scaleZero: 0
1451
+ Bol:
1452
+ value:
1453
+ $read: $edgeFinishRound
1454
+ scaleOne: 1
1455
+ scaleZero: 0
1456
+ Boomstamrand:
1457
+ value:
1458
+ $read: $edgeFinishTreeTrunk
1459
+ scaleOne: 1
1460
+ scaleZero: 0
1461
+ leg:
1462
+ morphTargetInfluences:
1463
+ Length:
1464
+ value: 1000
1465
+ scaleOne: 3000
1466
+ scaleZero: 1400
1467
+ Width:
1468
+ value: 700
1469
+ scaleOne: 1300
1470
+ scaleZero: 600
1471
+ Height:
1472
+ value: 780
1473
+ scaleOne: 780
1474
+ scaleZero: 740
1475
+
1476
+ transformers:
1477
+ - name: tree-trunk-delivery
1478
+ ```
1479
+
1480
+ ### ./src/\_shared/BottomSheet.tsx
1481
+
1482
+ ```tsx
1483
+ import { Box, ButtonBase } from '@mui/material'
1484
+ import { type MouseEvent, type PointerEvent, type ReactNode, useRef } from 'react'
1485
+
1486
+ // A drag shorter than this is a tap, and the handle's click toggles the sheet
1487
+ const TAP_DISTANCE = 6
1488
+ // A drag that ends this far from where it started snaps to the other position
1489
+ const SNAP_DISTANCE = 48
1490
+ // A drag faster than this, in pixels per millisecond, snaps in its direction even when it is short
1491
+ const SNAP_VELOCITY = 0.5
1492
+ // How far the sheet follows the finger towards the position it is already in
1493
+ const OVERDRAG = 0.25
1494
+
1495
+ interface BottomSheetProps {
1496
+ readonly open: boolean
1497
+ readonly onOpenChange: (open: boolean) => void
1498
+ readonly label: string
1499
+ readonly children: ReactNode
1500
+ }
1501
+
1502
+ interface Drag {
1503
+ readonly startY: number
1504
+ readonly startTime: number
1505
+ delta: number
1506
+ }
1507
+
1508
+ // A persistent sheet at the bottom of the layout with two positions, open and collapsed. It is not a modal: the scene
1509
+ // above it stays interactive. Its height comes from its content, so the layout's safe area ends where the sheet
1510
+ // starts and changes only when the sheet snaps. While the handle is dragged the sheet follows the finger with a
1511
+ // transform, which the safe area does not see, so the camera refits once per snap and not on every move.
1512
+ export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheetProps) => {
1513
+ const sheetRef = useRef<HTMLElement>(null)
1514
+ const dragRef = useRef<Drag | null>(null)
1515
+ const draggedRef = useRef(false)
1516
+
1517
+ const moveSheet = (offset: number, animate: boolean) => {
1518
+ if (sheetRef.current) {
1519
+ sheetRef.current.style.transition = animate ? 'transform 200ms ease-out' : 'none'
1520
+ sheetRef.current.style.transform = offset === 0 ? '' : `translateY(${offset}px)`
1521
+ }
1522
+ }
1523
+
1524
+ const handlePointerDown = (event: PointerEvent<HTMLButtonElement>) => {
1525
+ event.currentTarget.setPointerCapture(event.pointerId)
1526
+ dragRef.current = { startY: event.clientY, startTime: event.timeStamp, delta: 0 }
1527
+ draggedRef.current = false
1528
+ }
1529
+
1530
+ const handlePointerMove = (event: PointerEvent<HTMLButtonElement>) => {
1531
+ const drag = dragRef.current
1532
+
1533
+ if (drag === null) {
1534
+ return
1535
+ }
1536
+
1537
+ drag.delta = event.clientY - drag.startY
1538
+ // Down closes an open sheet and up opens a collapsed one; the other direction only gives a little
1539
+ const towardsOther = open ? drag.delta > 0 : drag.delta < 0
1540
+ moveSheet(towardsOther ? drag.delta : drag.delta * OVERDRAG, false)
1541
+ }
1542
+
1543
+ const handlePointerEnd = (event: PointerEvent<HTMLButtonElement>) => {
1544
+ const drag = dragRef.current
1545
+ dragRef.current = null
1546
+
1547
+ if (drag === null) {
1548
+ return
1549
+ }
1550
+
1551
+ moveSheet(0, true)
1552
+
1553
+ if (Math.abs(drag.delta) < TAP_DISTANCE) {
1554
+ return
1555
+ }
1556
+
1557
+ draggedRef.current = true
1558
+ const velocity = drag.delta / Math.max(event.timeStamp - drag.startTime, 1)
1559
+ const flicked = Math.abs(drag.delta) >= SNAP_DISTANCE || Math.abs(velocity) >= SNAP_VELOCITY
1560
+
1561
+ if (flicked && (open ? drag.delta > 0 : drag.delta < 0)) {
1562
+ onOpenChange(!open)
1563
+ }
1564
+ }
1565
+
1566
+ // A tap, Enter or Space toggles the sheet. The pointer click that ends a drag has already been handled; a keyboard
1567
+ // click (`detail` 0) always toggles, also after a touch drag that was followed by no click.
1568
+ const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
1569
+ const dragged = draggedRef.current
1570
+ draggedRef.current = false
1571
+
1572
+ if (dragged && event.detail !== 0) {
1573
+ return
1574
+ }
1575
+
1576
+ onOpenChange(!open)
1577
+ }
1578
+
1579
+ return (
1580
+ <Box
1581
+ component="section"
1582
+ ref={sheetRef}
1583
+ aria-label={label}
1584
+ sx={{
1585
+ position: 'relative',
1586
+ flexShrink: 0,
1587
+ display: 'flex',
1588
+ flexDirection: 'column',
1589
+ maxBlockSize: '55%',
1590
+ paddingBlockEnd: 'env(safe-area-inset-bottom)',
1591
+ borderStartStartRadius: 20,
1592
+ borderStartEndRadius: 20,
1593
+ bgcolor: 'background.paper',
1594
+ boxShadow: '0 -8px 32px rgba(0, 0, 0, 0.12)',
1595
+ // Fills the gap below the sheet while it is dragged up
1596
+ '&::after': {
1597
+ content: '""',
1598
+ position: 'absolute',
1599
+ insetInline: 0,
1600
+ insetBlockStart: '100%',
1601
+ blockSize: '100vh',
1602
+ bgcolor: 'background.paper',
1603
+ },
1604
+ }}
1605
+ >
1606
+ <ButtonBase
1607
+ aria-expanded={open}
1608
+ disableRipple
1609
+ aria-label={open ? `Collapse ${label.toLowerCase()}` : `Expand ${label.toLowerCase()}`}
1610
+ onClick={handleClick}
1611
+ onPointerDown={handlePointerDown}
1612
+ onPointerMove={handlePointerMove}
1613
+ onPointerUp={handlePointerEnd}
1614
+ onPointerCancel={handlePointerEnd}
1615
+ sx={{
1616
+ flexShrink: 0,
1617
+ blockSize: 36,
1618
+ touchAction: 'none',
1619
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: -4, borderRadius: 3 },
1620
+ }}
1621
+ >
1622
+ <Box component="span" sx={{ inlineSize: 40, blockSize: 4, borderRadius: 2, bgcolor: 'text.disabled' }} />
1623
+ </ButtonBase>
1624
+ {/* A column, so the panel's cards region shrinks first and the price and action stay in view; below the cards
1625
+ region's minimum height the content scrolls as a whole, as the review step does on a short phone */}
1626
+ <Box
1627
+ component="div"
1628
+ sx={{
1629
+ display: 'flex',
1630
+ flexDirection: 'column',
1631
+ flex: '1 1 auto',
1632
+ minBlockSize: 0,
1633
+ overflowY: 'auto',
1634
+ overscrollBehavior: 'contain',
1635
+ }}
1636
+ >
1637
+ {children}
1638
+ </Box>
1639
+ </Box>
1640
+ )
1641
+ }
1642
+ ```
1643
+
1644
+ ### ./src/\_shared/EdgeFinishCards.tsx
1645
+
1646
+ ```tsx
1647
+ import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
1648
+ import type { KeyboardEvent } from 'react'
1649
+
1650
+ import { type UseAttributeSelection, useResolveLocalizable } from '@salsita-ai/sdk/react'
1651
+
1652
+ // Cross-sections of the tabletop's edge, keyed by the option values of the spec.
1653
+ const EDGE_PROFILES: Readonly<Record<string, string>> = {
1654
+ None: 'M0 4H32V20H0Z',
1655
+ Facet: 'M0 4H26L32 10V14L26 20H0Z',
1656
+ Round: 'M0 4H24A8 8 0 0 1 24 20H0Z',
1657
+ TreeTrunk: 'M0 4H27C33 5 28 9 34 11C29 13 34 17 27 20H0Z',
1658
+ }
1659
+
1660
+ const CHECK_BADGE: SxProps<Theme> = {
1661
+ position: 'absolute',
1662
+ insetBlockStart: 10,
1663
+ insetInlineEnd: 10,
1664
+ display: 'grid',
1665
+ placeItems: 'center',
1666
+ inlineSize: 22,
1667
+ blockSize: 22,
1668
+ borderRadius: '50%',
1669
+ bgcolor: 'primary.main',
1670
+ color: 'primary.contrastText',
1671
+ fontSize: 13,
1672
+ }
1673
+
1674
+ // Arrow keys move the selection between the cards, as in a native radio group.
1675
+ const ARROW_STEPS: Readonly<Record<string, number | undefined>> = {
1676
+ ArrowRight: 1,
1677
+ ArrowDown: 1,
1678
+ ArrowLeft: -1,
1679
+ ArrowUp: -1,
1680
+ }
1681
+
1682
+ interface EdgeFinishCardsProps {
1683
+ readonly selection: ReturnType<UseAttributeSelection>
1684
+ }
1685
+
1686
+ export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
1687
+ const resolve = useResolveLocalizable()
1688
+ const { options } = selection
1689
+ // The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
1690
+ const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
1691
+ const focusIndex = selectedIndex >= 0 ? selectedIndex : options.findIndex(option => !option.disabled)
1692
+
1693
+ const handleKeyDown = (event: KeyboardEvent<HTMLElement>, index: number) => {
1694
+ const step = ARROW_STEPS[event.key]
1695
+
1696
+ if (step === undefined) {
1697
+ return
1698
+ }
1699
+
1700
+ event.preventDefault()
1701
+ // The next enabled option in the arrow's direction, wrapping around; disabled options are skipped.
1702
+ const count = options.length
1703
+ const next = Array.from(
1704
+ { length: count - 1 },
1705
+ (_, offset) => (((index + step * (offset + 1)) % count) + count) % count
1706
+ ).find(candidate => !options[candidate]?.disabled)
1707
+
1708
+ if (next === undefined) {
1709
+ return
1710
+ }
1711
+
1712
+ options[next]?.onSelect()
1713
+ event.currentTarget.parentElement?.querySelectorAll<HTMLElement>('[role="radio"]')[next]?.focus()
1714
+ }
1715
+
1716
+ return (
1717
+ <Box
1718
+ component="div"
1719
+ role="radiogroup"
1720
+ aria-label="Edge finish"
1721
+ sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 1.5 }}
1722
+ >
1723
+ {options.map((option, index) => {
1724
+ const isSelected = option.value === selection.value
1725
+
1726
+ return (
1727
+ <ButtonBase
1728
+ key={String(option.value)}
1729
+ role="radio"
1730
+ aria-checked={isSelected}
1731
+ tabIndex={index === focusIndex ? 0 : -1}
1732
+ disabled={option.disabled}
1733
+ onClick={option.onSelect}
1734
+ onKeyDown={event => handleKeyDown(event, index)}
1735
+ sx={{
1736
+ position: 'relative',
1737
+ display: 'grid',
1738
+ justifyItems: 'start',
1739
+ gap: 0.5,
1740
+ padding: 2,
1741
+ borderRadius: 3,
1742
+ border: 2,
1743
+ borderColor: isSelected ? 'primary.main' : 'divider',
1744
+ bgcolor: isSelected ? 'action.hover' : 'transparent',
1745
+ textAlign: 'start',
1746
+ transition: 'border-color 150ms, background-color 150ms',
1747
+ '&:hover': { borderColor: isSelected ? 'primary.main' : 'text.disabled' },
1748
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
1749
+ '&.Mui-disabled': { opacity: 0.4 },
1750
+ }}
1751
+ >
1752
+ {isSelected && (
1753
+ <Box component="span" aria-hidden sx={CHECK_BADGE}>
1754
+ ✓
1755
+ </Box>
1756
+ )}
1757
+ <Box
1758
+ component="svg"
1759
+ viewBox="0 0 36 24"
1760
+ aria-hidden
1761
+ sx={{ inlineSize: 60, blockSize: 40, color: '#b98b5e' }}
1762
+ >
1763
+ <path d={EDGE_PROFILES[String(option.value)]} fill="currentColor" />
1764
+ </Box>
1765
+ <Typography variant="body2" fontWeight={600}>
1766
+ {resolve(option.title)}
1767
+ </Typography>
1768
+ <Typography variant="caption" color="text.secondary">
1769
+ {resolve(option.description)}
1770
+ </Typography>
1771
+ </ButtonBase>
1772
+ )
1773
+ })}
1774
+ </Box>
1775
+ )
1776
+ }
1777
+ ```
1778
+
1779
+ ### ./src/\_shared/FullscreenToggle.tsx
1780
+
1781
+ ```tsx
1782
+ import { Button, Tooltip } from '@mui/material'
1783
+
1784
+ import { phx } from '../../.phoenix/phx.js'
1785
+
1786
+ const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
1787
+ const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
1788
+
1789
+ interface FullscreenToggleProps {
1790
+ // Only the icon, with the label as its accessible name and tooltip, where a label would cover the product
1791
+ readonly compact?: boolean
1792
+ }
1793
+
1794
+ export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
1795
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
1796
+ const setFullscreen = phx.frontend.useSetFullscreen()
1797
+ const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
1798
+ const icon = (
1799
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
1800
+ <path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
1801
+ </svg>
1802
+ )
1803
+
1804
+ return (
1805
+ <Tooltip title={compact ? label : ''}>
1806
+ <Button
1807
+ onClick={() => setFullscreen(!isFullscreen)}
1808
+ aria-label={compact ? label : undefined}
1809
+ startIcon={compact ? undefined : icon}
1810
+ sx={{
1811
+ minBlockSize: 44,
1812
+ minInlineSize: 44,
1813
+ paddingInline: compact ? 0 : 2.5,
1814
+ borderRadius: 999,
1815
+ bgcolor: 'background.paper',
1816
+ color: 'text.primary',
1817
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
1818
+ textTransform: 'none',
1819
+ fontWeight: 600,
1820
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
1821
+ }}
1822
+ >
1823
+ {compact ? icon : label}
1824
+ </Button>
1825
+ </Tooltip>
1826
+ )
1827
+ }
1828
+ ```
1829
+
1830
+ ### ./src/\_shared/MessageToast.tsx
1831
+
1832
+ ```tsx
1833
+ import { Alert } from '@mui/material'
1834
+ import { useEffect, useState } from 'react'
1835
+
1836
+ import type { ConfiguratorMessage } from '@salsita-ai/sdk/react'
1837
+
1838
+ import { phx } from '../../.phoenix/phx.js'
1839
+
1840
+ const VIOLATION_SEVERITY = { fatal: 'error', fixable: 'error', warning: 'warning', notice: 'info' } as const
1841
+ const RANK = { info: 0, warning: 1, error: 2 } as const
1842
+ const VISIBLE_MS = 6000
1843
+
1844
+ const severityOf = (message: ConfiguratorMessage) => {
1845
+ if (message.kind === 'violation') {
1846
+ return VIOLATION_SEVERITY[message.violation.severity]
1847
+ }
1848
+
1849
+ return message.kind === 'error' ? 'error' : 'info'
1850
+ }
1851
+
1852
+ export const MessageToast = () => {
1853
+ const [message, setMessage] = useState<ConfiguratorMessage | null>(null)
1854
+
1855
+ // A rejected change also reports the notices already present; keep the worst message while it is shown
1856
+ phx.frontend.useConfiguratorMessages(next => {
1857
+ setMessage(shown => (shown !== null && RANK[severityOf(next)] < RANK[severityOf(shown)] ? shown : next))
1858
+ })
1859
+
1860
+ useEffect(() => {
1861
+ if (message === null) {
1862
+ return
1863
+ }
1864
+
1865
+ const timeout = setTimeout(() => setMessage(null), VISIBLE_MS)
1866
+
1867
+ return () => clearTimeout(timeout)
1868
+ }, [message])
1869
+
1870
+ if (message === null) {
1871
+ return null
1872
+ }
1873
+
1874
+ return (
1875
+ <Alert
1876
+ severity={severityOf(message)}
1877
+ onClose={() => setMessage(null)}
1878
+ sx={{ maxInlineSize: 420, borderRadius: 3, boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)' }}
1879
+ >
1880
+ {message.text}
1881
+ </Alert>
1882
+ )
1883
+ }
1884
+ ```
1885
+
1886
+ ### ./src/\_shared/ProductPanel.tsx
1887
+
1888
+ ```tsx
1889
+ import { Box, Button, Typography } from '@mui/material'
1890
+
1891
+ import { detailComponent, finalizeActionComponent } from '@salsita-ai/sdk/domain'
1892
+ import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
1893
+
1894
+ import { phx } from '../../.phoenix/phx.js'
1895
+ import { EdgeFinishCards } from './EdgeFinishCards.js'
1896
+ import { ReviewActions } from './ReviewActions.js'
1897
+
1898
+ const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
1899
+
1900
+ interface ProductPanelProps {
1901
+ // Only the name, the price and the action, for a collapsed bottom sheet
1902
+ readonly collapsed?: boolean
1903
+ // In a bottom sheet the cards region keeps the top of the cards in view, and the sheet scrolls when that does not fit
1904
+ readonly inSheet?: boolean
1905
+ }
1906
+
1907
+ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
1908
+ const resolve = useResolveLocalizable()
1909
+ const detail = phx.frontend.useFirstRootComponent(detailComponent)
1910
+ const price = phx.frontend.useRootEntityPrice()
1911
+ const tableId = phx.frontend.useRootEntityId()
1912
+ const edgeFinish = phx.frontend.useAttributeSelection(tableId, 'edgeFinish')
1913
+ const { accessInfo } = phx.frontend.useAccessService()
1914
+ const navigationState = phx.frontend.useActiveNavigationState()
1915
+ const pushNavigate = phx.frontend.usePushNavigate()
1916
+ const popNavigate = phx.frontend.usePopNavigate()
1917
+ const navigate = phx.frontend.useNavigate()
1918
+ const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
1919
+
1920
+ const isReadMode = accessInfo.viewMode
1921
+ const isReview = isReadMode || navigationState !== 'configure'
1922
+ // The spec's primary finalize action, or its first one
1923
+ const quoteAction = finalizeActions.find(action => action.state.variant === 'primary') ?? finalizeActions[0]
1924
+ const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
1925
+
1926
+ return (
1927
+ <>
1928
+ <Box component="header" sx={{ display: 'grid', gap: 1, padding: 3, paddingBlockEnd: 2 }}>
1929
+ {isReadMode ? (
1930
+ <Typography
1931
+ variant="overline"
1932
+ sx={{ justifySelf: 'start', paddingInline: 1.5, borderRadius: 999, bgcolor: 'action.selected' }}
1933
+ >
1934
+ View only
1935
+ </Typography>
1936
+ ) : (
1937
+ <Typography variant="overline" color="text.secondary">
1938
+ {resolve(detail?.state.subtitle)}
1939
+ </Typography>
1940
+ )}
1941
+ <Typography variant="h5" component="h2" fontWeight={700}>
1942
+ {resolve(detail?.state.title)}
1943
+ </Typography>
1944
+ {!collapsed && (
1945
+ <Typography variant="body2" color="text.secondary">
1946
+ {resolve(detail?.state.description)}
1947
+ </Typography>
1948
+ )}
1949
+ </Box>
1950
+
1951
+ {!collapsed && (
1952
+ <Box
1953
+ component="div"
1954
+ sx={{
1955
+ display: 'grid',
1956
+ gap: 1.5,
1957
+ paddingInline: 3,
1958
+ paddingBlockEnd: 3,
1959
+ // In a short container the region shrinks and scrolls; a scroll past its end moves its container on
1960
+ minBlockSize: inSheet ? 120 : 0,
1961
+ overflowY: 'auto',
1962
+ }}
1963
+ >
1964
+ <Typography variant="subtitle2" component="h3">
1965
+ Edge finish
1966
+ </Typography>
1967
+ {isReview ? (
1968
+ <Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
1969
+ <Typography variant="body2" fontWeight={600}>
1970
+ {resolve(chosenEdge?.title)}
1971
+ </Typography>
1972
+ <Typography variant="caption" color="text.secondary">
1973
+ {resolve(chosenEdge?.description)}
1974
+ </Typography>
1975
+ </Box>
1976
+ ) : (
1977
+ <EdgeFinishCards selection={edgeFinish} />
1978
+ )}
1979
+ </Box>
1980
+ )}
1981
+
1982
+ <Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
1983
+ <Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
1984
+ <Typography variant="body2" color="text.secondary">
1985
+ Total price
1986
+ </Typography>
1987
+ <Typography variant="h5" component="p" fontWeight={700}>
1988
+ {price}
1989
+ </Typography>
1990
+ </Box>
1991
+ {!isReadMode && navigationState === 'configure' && (
1992
+ <Button size="large" variant="contained" onClick={() => pushNavigate('checkout')} sx={BUTTON_SX}>
1993
+ Review and request a quote
1994
+ </Button>
1995
+ )}
1996
+ {!isReadMode && navigationState === 'checkout' && (
1997
+ <>
1998
+ <Typography variant="body2" color="text.secondary">
1999
+ Your table is ready for a quote. A real shop collects the contact details here.
2000
+ </Typography>
2001
+ {quoteAction ? (
2002
+ <PhoenixHandlerBoundary name={quoteAction.state.handler}>
2003
+ <ReviewActions
2004
+ handler={quoteAction.state.handler}
2005
+ label={resolve(quoteAction.state.label)}
2006
+ onBack={popNavigate}
2007
+ />
2008
+ </PhoenixHandlerBoundary>
2009
+ ) : (
2010
+ <Button size="large" variant="outlined" onClick={popNavigate} sx={BUTTON_SX}>
2011
+ Back to the configuration
2012
+ </Button>
2013
+ )}
2014
+ </>
2015
+ )}
2016
+ {!isReadMode && navigationState === 'requested' && (
2017
+ <>
2018
+ <Typography variant="body2" role="status">
2019
+ Thank you. Your quote request is on its way, and the shop replies within two working days.
2020
+ </Typography>
2021
+ <Button size="large" variant="outlined" onClick={() => navigate('configure')} sx={BUTTON_SX}>
2022
+ Back to the configuration
2023
+ </Button>
2024
+ </>
2025
+ )}
2026
+ </Box>
2027
+ </>
2028
+ )
2029
+ }
2030
+ ```
2031
+
2032
+ ### ./src/\_shared/ReviewActions.tsx
2033
+
2034
+ ```tsx
2035
+ import { Alert, Box, Button, CircularProgress, Typography } from '@mui/material'
2036
+
2037
+ import { phx } from '../../.phoenix/phx.js'
2038
+
2039
+ const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
2040
+
2041
+ interface ReviewActionsProps {
2042
+ readonly handler: string
2043
+ readonly label: string
2044
+ readonly onBack: () => void
2045
+ }
2046
+
2047
+ // The review step's buttons: one finalize action and the way back. `useFinalizeAction` runs the action's handler,
2048
+ // so this component calls it exactly once and is rendered inside a `PhoenixHandlerBoundary` for that handler.
2049
+ // Back is disabled while the request is pending, so the customer cannot change the configuration while it is sent.
2050
+ // The pending state belongs to this component: when the panel unmounts, as in fullscreen, the request goes on and
2051
+ // the remounted buttons are enabled again.
2052
+ export const ReviewActions = ({ handler, label, onBack }: ReviewActionsProps) => {
2053
+ const { run, isPending, error, disabled, hints } = phx.frontend.useFinalizeAction(handler)
2054
+
2055
+ return (
2056
+ <Box component="div" sx={{ display: 'grid', gap: 2 }}>
2057
+ <Box component="div" sx={{ display: 'grid', gap: 1 }}>
2058
+ <Button
2059
+ size="large"
2060
+ variant="contained"
2061
+ disabled={disabled || isPending}
2062
+ onClick={run}
2063
+ startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
2064
+ sx={BUTTON_SX}
2065
+ >
2066
+ {isPending ? 'Sending the request…' : label}
2067
+ </Button>
2068
+ {disabled && hints && (
2069
+ <Typography variant="caption" color="text.secondary">
2070
+ {hints}
2071
+ </Typography>
2072
+ )}
2073
+ {error && <Alert severity="error">The request could not be sent: {error.message}</Alert>}
2074
+ </Box>
2075
+ <Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
2076
+ Back to the configuration
2077
+ </Button>
2078
+ </Box>
2079
+ )
2080
+ }
2081
+ ```
2082
+
2083
+ ### ./src/\_shared/SceneControls.tsx
2084
+
2085
+ ```tsx
2086
+ import { Box, Button, Tooltip } from '@mui/material'
2087
+
2088
+ import { phx } from '../../.phoenix/phx.js'
2089
+
2090
+ // The spec's view states, each with the label of the button that shows it
2091
+ const VIEWS = [
2092
+ { state: 'overview', label: 'Whole table' },
2093
+ { state: 'edge', label: 'Edge close-up' },
2094
+ ] as const
2095
+
2096
+ const RESET_ICON = 'M4 12a8 8 0 1 0 2.4-5.7M4 4v4h4'
2097
+
2098
+ const SURFACE_SX = {
2099
+ borderRadius: 999,
2100
+ bgcolor: 'background.paper',
2101
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
2102
+ } as const
2103
+
2104
+ const BUTTON_SX = {
2105
+ minBlockSize: 44,
2106
+ minInlineSize: 44,
2107
+ borderRadius: 999,
2108
+ textTransform: 'none',
2109
+ fontWeight: 600,
2110
+ whiteSpace: 'nowrap',
2111
+ } as const
2112
+
2113
+ interface SceneControlsProps {
2114
+ // The reset button shows only its icon, with its label as tooltip and accessible name
2115
+ readonly compact?: boolean
2116
+ // Only the reset button, without the view buttons
2117
+ readonly resetOnly?: boolean
2118
+ }
2119
+
2120
+ // The layout's own camera controls: one button per view state of the spec, and a reset that undoes an orbit
2121
+ export const SceneControls = ({ compact = false, resetOnly = false }: SceneControlsProps) => {
2122
+ const activeView = phx.frontend.useActiveViewState()
2123
+ const setViewState = phx.frontend.useSetViewState()
2124
+ const resetCamera = phx.frontend.useResetCamera()
2125
+ const resetIcon = (
2126
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
2127
+ <path d={RESET_ICON} />
2128
+ </svg>
2129
+ )
2130
+
2131
+ return (
2132
+ <Box component="div" sx={{ display: 'flex', gap: 1 }}>
2133
+ {!resetOnly && (
2134
+ <Box component="div" role="group" aria-label="View" sx={{ ...SURFACE_SX, display: 'flex' }}>
2135
+ {VIEWS.map(view => {
2136
+ const isActive = activeView === view.state
2137
+
2138
+ return (
2139
+ <Button
2140
+ key={view.state}
2141
+ aria-pressed={isActive}
2142
+ onClick={() => setViewState(view.state)}
2143
+ sx={{
2144
+ ...BUTTON_SX,
2145
+ paddingInline: 2,
2146
+ bgcolor: isActive ? 'text.primary' : 'transparent',
2147
+ color: isActive ? 'background.paper' : 'text.primary',
2148
+ '&:hover': { bgcolor: isActive ? 'text.primary' : 'action.hover' },
2149
+ }}
2150
+ >
2151
+ {view.label}
2152
+ </Button>
2153
+ )
2154
+ })}
2155
+ </Box>
2156
+ )}
2157
+ <Tooltip title={compact ? 'Reset view' : ''}>
2158
+ <Button
2159
+ onClick={resetCamera}
2160
+ aria-label={compact ? 'Reset view' : undefined}
2161
+ startIcon={compact ? undefined : resetIcon}
2162
+ sx={{
2163
+ ...SURFACE_SX,
2164
+ ...BUTTON_SX,
2165
+ paddingInline: compact ? 0 : 2,
2166
+ color: 'text.primary',
2167
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
2168
+ }}
2169
+ >
2170
+ {compact ? resetIcon : 'Reset view'}
2171
+ </Button>
2172
+ </Tooltip>
2173
+ </Box>
2174
+ )
2175
+ }
2176
+ ```
2177
+
2178
+ ### ./src/elements/ConfiguratorLayout.tsx
2179
+
2180
+ ```tsx
2181
+ import { Box } from '@mui/material'
2182
+ import { useState } from 'react'
2183
+
2184
+ import { LayoutSlots, useSceneSafeArea } from '@salsita-ai/sdk/configurator'
2185
+ import { useActiveViewports } from '@salsita-ai/sdk/react'
2186
+
2187
+ import { phx } from '../../.phoenix/phx.js'
2188
+ import { BottomSheet } from '../_shared/BottomSheet.js'
2189
+ import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
2190
+ import { MessageToast } from '../_shared/MessageToast.js'
2191
+ import { ProductPanel } from '../_shared/ProductPanel.js'
2192
+ import { SceneControls } from '../_shared/SceneControls.js'
2193
+
2194
+ const GUTTER = 24
2195
+ const PANEL_WIDTH = 380
2196
+ const PHONE_GUTTER = 16
2197
+ const TOUCH_TARGET = 44
2198
+
2199
+ const ConfiguratorLayout = () => {
2200
+ const { containerRef, safeAreaRef } = useSceneSafeArea()
2201
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
2202
+ // `null` until the container has been measured; the layout shows only the scene until then
2203
+ const viewports = useActiveViewports()
2204
+ const [isSheetOpen, setSheetOpen] = useState(false)
2205
+
2206
+ const isDesktop = viewports?.includes('desktop') ?? false
2207
+ const gutter = isDesktop ? GUTTER : PHONE_GUTTER
2208
+
2209
+ return (
2210
+ <Box
2211
+ component="div"
2212
+ ref={containerRef}
2213
+ // `clip`, not `hidden`: what overflows, such as the sheet's fill below its edge, can never be scrolled into view,
2214
+ // not even by the browser when the focus moves
2215
+ sx={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', overflow: 'clip' }}
2216
+ >
2217
+ <LayoutSlots.SharedCanvas />
2218
+
2219
+ {viewports !== null && isDesktop && !isFullscreen && (
2220
+ <Box
2221
+ component="aside"
2222
+ sx={{
2223
+ position: 'absolute',
2224
+ insetBlockStart: GUTTER,
2225
+ insetInlineStart: GUTTER,
2226
+ inlineSize: PANEL_WIDTH,
2227
+ maxBlockSize: `calc(100% - ${2 * GUTTER}px)`,
2228
+ display: 'flex',
2229
+ flexDirection: 'column',
2230
+ borderRadius: 5,
2231
+ bgcolor: 'background.paper',
2232
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
2233
+ // A very short container, such as a phone held sideways, scrolls the panel instead of clipping its footer
2234
+ overflowX: 'hidden',
2235
+ overflowY: 'auto',
2236
+ overscrollBehavior: 'contain',
2237
+ }}
2238
+ >
2239
+ <ProductPanel />
2240
+ </Box>
2241
+ )}
2242
+
2243
+ {viewports !== null && (
2244
+ <Box
2245
+ component="div"
2246
+ ref={safeAreaRef}
2247
+ sx={{
2248
+ // Desktop: right of the panel. Phone: above the sheet, whose height the column gives the rest.
2249
+ ...(isDesktop
2250
+ ? {
2251
+ position: 'absolute',
2252
+ insetBlock: 0,
2253
+ insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
2254
+ insetInlineEnd: 0,
2255
+ }
2256
+ : { position: 'relative', flex: '1 1 0', minBlockSize: 0 }),
2257
+ pointerEvents: 'none',
2258
+ }}
2259
+ >
2260
+ <Box
2261
+ component="div"
2262
+ sx={{ position: 'absolute', insetBlockStart: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
2263
+ >
2264
+ <FullscreenToggle compact={!isDesktop} />
2265
+ </Box>
2266
+ <Box
2267
+ component="div"
2268
+ sx={{
2269
+ position: 'absolute',
2270
+ pointerEvents: 'auto',
2271
+ // Desktop: bottom left, above the row of view controls. Phone: at the top beside the fullscreen button,
2272
+ // clear of the sheet's handle and the view controls.
2273
+ ...(isDesktop
2274
+ ? { insetBlockEnd: 2 * GUTTER + TOUCH_TARGET, insetInlineStart: GUTTER }
2275
+ : { insetBlockStart: gutter, insetInline: `${gutter}px ${2 * gutter + TOUCH_TARGET}px` }),
2276
+ }}
2277
+ >
2278
+ <MessageToast />
2279
+ </Box>
2280
+ {/* A phone in fullscreen keeps only the reset, as the built-in layout does. Below 1024 pixels (`tablet`) the
2281
+ free area beside the panel is narrow, so the reset shows only its icon there too. */}
2282
+ <Box
2283
+ component="div"
2284
+ sx={{ position: 'absolute', insetBlockEnd: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
2285
+ >
2286
+ <SceneControls
2287
+ compact={!isDesktop || (viewports?.includes('tablet') ?? false)}
2288
+ resetOnly={!isDesktop && isFullscreen}
2289
+ />
2290
+ </Box>
2291
+ </Box>
2292
+ )}
2293
+
2294
+ {viewports !== null && !isDesktop && !isFullscreen && (
2295
+ <BottomSheet open={isSheetOpen} onOpenChange={setSheetOpen} label="Product details">
2296
+ <ProductPanel collapsed={!isSheetOpen} inSheet />
2297
+ </BottomSheet>
2298
+ )}
2299
+ </Box>
2300
+ )
2301
+ }
2302
+
2303
+ export default phx.frontend.createCustomPhoenixLayoutElement('ConfiguratorLayout', ConfiguratorLayout)
2304
+ ```
2305
+
2306
+ ### ./src/elements/EdgeFinishHotspot.tsx
2307
+
2308
+ ```tsx
2309
+ import { Box, ButtonBase, Popover, Tooltip } from '@mui/material'
2310
+ import { useState } from 'react'
2311
+
2312
+ import { phx } from '../../.phoenix/phx.js'
2313
+ import { EdgeFinishCards } from '../_shared/EdgeFinishCards.js'
2314
+
2315
+ // The edge profile the button shows, the square edge of the cards' drawings
2316
+ const EDGE_ICON = 'M3 7H17L21 11V13L17 17H3Z'
2317
+
2318
+ // Rendered by the spec's `htmlHotspot` on the table's edge: a button on the product that opens the edge finishes
2319
+ // next to the edge, with the same cards as the panel. The spec's `$filter` decides when it is shown.
2320
+ export default phx.frontend.createCustomPhoenixEntityElement('EdgeFinishHotspot', ({ entityId }) => {
2321
+ const edgeFinish = phx.frontend.useAttributeSelection(entityId, 'edgeFinish')
2322
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null)
2323
+
2324
+ return (
2325
+ <>
2326
+ <Tooltip title="Edge finish">
2327
+ <ButtonBase
2328
+ aria-label="Edge finish"
2329
+ aria-haspopup="dialog"
2330
+ aria-expanded={anchor !== null}
2331
+ onClick={event => setAnchor(event.currentTarget)}
2332
+ sx={{
2333
+ display: 'grid',
2334
+ placeItems: 'center',
2335
+ inlineSize: 44,
2336
+ blockSize: 44,
2337
+ borderRadius: '50%',
2338
+ bgcolor: 'background.paper',
2339
+ color: 'primary.main',
2340
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
2341
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
2342
+ }}
2343
+ >
2344
+ <svg viewBox="0 0 24 24" width={22} height={22} aria-hidden>
2345
+ <path d={EDGE_ICON} fill="currentColor" />
2346
+ </svg>
2347
+ </ButtonBase>
2348
+ </Tooltip>
2349
+ <Popover
2350
+ open={anchor !== null}
2351
+ anchorEl={anchor}
2352
+ onClose={() => setAnchor(null)}
2353
+ anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
2354
+ transformOrigin={{ vertical: 'bottom', horizontal: 'center' }}
2355
+ slotProps={{
2356
+ paper: { role: 'dialog', 'aria-label': 'Edge finish', sx: { borderRadius: 4, marginBlockStart: -1 } },
2357
+ }}
2358
+ >
2359
+ <Box component="div" sx={{ inlineSize: 340, maxInlineSize: 'calc(100vw - 32px)', padding: 2 }}>
2360
+ <EdgeFinishCards selection={edgeFinish} />
2361
+ </Box>
2362
+ </Popover>
2363
+ </>
2364
+ )
2365
+ })
2366
+ ```
2367
+
2368
+ ### ./src/expressions/table.ts
2369
+
2370
+ ```ts
2371
+ import { phx } from '../../.phoenix/phx.js'
2372
+
2373
+ const EDGE_FINISH_SURCHARGE = { None: 0, Facet: 90, Round: 120, TreeTrunk: 340 }
2374
+
2375
+ export default phx.domain.implementCustomExpressions({
2376
+ Table: {
2377
+ $price: s => {
2378
+ return 1290 + EDGE_FINISH_SURCHARGE[s.edgeFinish]
2379
+ },
2380
+ $edgeFinishFacet: s => {
2381
+ return s.edgeFinish === 'Facet' ? 1 : 0
2382
+ },
2383
+ $edgeFinishRound: s => {
2384
+ return s.edgeFinish === 'Round' ? 1 : 0
2385
+ },
2386
+ $edgeFinishTreeTrunk: s => {
2387
+ return s.edgeFinish === 'TreeTrunk' ? 1 : 0
2388
+ },
2389
+ },
2390
+ })
2391
+ ```
2392
+
2393
+ ### ./src/handlers/request-quote.ts
2394
+
2395
+ ```ts
2396
+ import { useCallback } from 'react'
2397
+
2398
+ import { phx } from '../../.phoenix/phx.js'
2399
+
2400
+ // Stands in for the shop's quote service: the request takes a moment, then the panel shows the confirmation
2401
+ export default phx.frontend.createPhoenixHandler('requestQuote', () => {
2402
+ const navigate = phx.frontend.useNavigate()
2403
+
2404
+ return {
2405
+ handler: useCallback(async () => {
2406
+ await new Promise(resolve => setTimeout(resolve, 1500))
2407
+ navigate('requested')
2408
+ }, [navigate]),
2409
+ }
2410
+ })
2411
+ ```
2412
+
2413
+ ### ./src/transformers/tree-trunk-delivery.ts
2414
+
2415
+ ```ts
2416
+ import { msg } from '@lingui/core/macro'
2417
+
2418
+ import { phx } from '../../.phoenix/phx.js'
2419
+
2420
+ // A tree-trunk edge is cut by hand; choosing it carries a hint, which reaches the layout as a side-effect message
2421
+ export default phx.frontend.transformerBuilder.when
2422
+ .entity(['Table'])
2423
+ .modified({ atFields: ['edgeFinish'] })
2424
+ .then.overrideMatchingUpdate(({ update }) => {
2425
+ if (update.stateDelta.edgeFinish !== 'TreeTrunk') {
2426
+ return [update]
2427
+ }
2428
+
2429
+ return [{ ...update, hint: msg`Tree trunk edges are cut by hand, so delivery takes three weeks longer.` }]
2430
+ })
2431
+ .build('tree-trunk-delivery')
2432
+ ```
2433
+
2434
+ </details>