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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (542) hide show
  1. package/README.md +19 -14
  2. package/dist/admin/default-admin-elements.d.ts +9 -0
  3. package/dist/admin/default-admin-elements.js +1 -0
  4. package/dist/admin/default-elements/built-in-entity-element.d.ts +10 -0
  5. package/dist/admin/default-elements/built-in-entity-element.js +1 -0
  6. package/dist/admin/default-elements/built-in-layout-element.d.ts +10 -0
  7. package/dist/admin/default-elements/built-in-layout-element.js +1 -0
  8. package/dist/admin/default-elements/index.d.ts +2 -0
  9. package/dist/admin/default-elements/index.js +1 -0
  10. package/dist/admin/index.d.ts +1 -0
  11. package/dist/admin/index.js +1 -1
  12. package/dist/application-spec/caching/content-diff.js +1 -1
  13. package/dist/application-spec/core/application-file.d.ts +0 -2
  14. package/dist/application-spec/core/application-file.js +1 -1
  15. package/dist/application-spec/errors/diagnostic-codes.d.ts +5 -0
  16. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  17. package/dist/application-spec/errors/diagnostic-messages.d.ts +5 -0
  18. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  19. package/dist/application-spec/generate-application/code/common/code-imports.js +1 -1
  20. package/dist/application-spec/generate-application/code/common/env-reader.js +2 -2
  21. package/dist/application-spec/generate-application/code/common/index.d.ts +1 -0
  22. package/dist/application-spec/generate-application/code/common/index.js +1 -1
  23. package/dist/application-spec/generate-application/code/common/single-quoted-string.d.ts +6 -0
  24. package/dist/application-spec/generate-application/code/common/single-quoted-string.js +1 -0
  25. package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
  26. package/dist/application-spec/generate-application/code/generate-application-code.d.ts +3 -2
  27. package/dist/application-spec/generate-application/code/generate-application-code.js +1 -1
  28. package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +15 -14
  29. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  30. package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +2 -2
  31. package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
  32. package/dist/application-spec/generate-application/code/story-files.js +1 -1
  33. package/dist/application-spec/generate-application/code/templates/admin-config.js +3 -0
  34. package/dist/application-spec/generate-application/code/templates/common/format-property-key.d.ts +7 -0
  35. package/dist/application-spec/generate-application/code/templates/common/format-property-key.js +1 -0
  36. package/dist/application-spec/generate-application/code/templates/common/schema-to-type-string.js +3 -3
  37. package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -4
  38. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.d.ts +35 -0
  39. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.js +5 -0
  40. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/index.d.ts +1 -0
  41. package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/index.js +1 -0
  42. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.d.ts +1 -1
  43. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.js +6 -6
  44. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +59 -63
  45. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.d.ts +8 -0
  46. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.js +1 -1
  47. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-presets.js +1 -1
  48. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +13 -13
  49. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.d.ts +1 -1
  50. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.js +2 -2
  51. package/dist/application-spec/generate-application/code/templates/domain-spec/index.d.ts +2 -1
  52. package/dist/application-spec/generate-application/code/templates/domain-spec/index.js +1 -1
  53. package/dist/application-spec/generate-application/code/templates/eslint-config.d.ts +5 -0
  54. package/dist/application-spec/generate-application/code/templates/eslint-config.js +4 -5
  55. package/dist/application-spec/generate-application/code/templates/frontend-config.js +3 -5
  56. package/dist/application-spec/generate-application/code/templates/gitignore.js +0 -3
  57. package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.d.ts +43 -0
  58. package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +31 -0
  59. package/dist/application-spec/generate-application/code/templates/global-definition/index.d.ts +1 -0
  60. package/dist/application-spec/generate-application/code/templates/global-definition/index.js +1 -1
  61. package/dist/application-spec/generate-application/code/templates/globals.js +24 -44
  62. package/dist/application-spec/generate-application/code/templates/index.d.ts +3 -3
  63. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  64. package/dist/application-spec/generate-application/code/templates/lingui-rc.d.ts +5 -0
  65. package/dist/application-spec/generate-application/code/templates/lingui-rc.js +4 -4
  66. package/dist/application-spec/generate-application/code/templates/prettier-config.d.ts +5 -0
  67. package/dist/application-spec/generate-application/code/templates/prettier-config.js +4 -5
  68. package/dist/application-spec/generate-application/code/templates/root-tsconfig.d.ts +6 -0
  69. package/dist/application-spec/generate-application/code/templates/root-tsconfig.js +2 -0
  70. package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
  71. package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +1 -1
  72. package/dist/application-spec/generate-application/code/templates/skills/phoenix-feedback-skill.js +5 -5
  73. package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +3 -3
  74. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
  75. package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.js +2 -2
  76. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +24 -7
  77. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
  78. package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.d.ts +58 -0
  79. package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.js +1 -0
  80. package/dist/application-spec/generate-application/code/templates/spec-code/index.d.ts +2 -0
  81. package/dist/application-spec/generate-application/code/templates/spec-code/index.js +1 -0
  82. package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.d.ts +18 -0
  83. package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.js +41 -0
  84. package/dist/application-spec/generate-application/code/templates/spec-messages/index.d.ts +1 -0
  85. package/dist/application-spec/generate-application/code/templates/spec-messages/index.js +1 -0
  86. package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.d.ts +20 -0
  87. package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.js +6 -0
  88. package/dist/application-spec/generate-application/code/templates/story/phx-module.d.ts +8 -2
  89. package/dist/application-spec/generate-application/code/templates/story/phx-module.js +15 -3
  90. package/dist/application-spec/generate-application/code/templates/story/wrapper.d.ts +3 -0
  91. package/dist/application-spec/generate-application/code/templates/story/wrapper.js +2 -1
  92. package/dist/application-spec/generate-application/code/templates/tsconfig.d.ts +5 -0
  93. package/dist/application-spec/generate-application/code/templates/tsconfig.js +1 -1
  94. package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +6 -1
  95. package/dist/application-spec/generate-application/code/templates/webhook-index.js +10 -1
  96. package/dist/application-spec/generate-application/code/templates/webhooks-config.js +2 -3
  97. package/dist/application-spec/generate-application/index.d.ts +2 -0
  98. package/dist/application-spec/generate-application/index.js +1 -1
  99. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +6 -4
  100. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.js +1 -1
  101. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +8 -3
  102. package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
  103. package/dist/application-spec/generate-application/runtime/admin-runtime/states-runtime.d.ts +2 -2
  104. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +19 -5
  105. package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
  106. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +6 -4
  107. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.js +1 -1
  108. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +7 -2
  109. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
  110. package/dist/application-spec/generate-application/runtime/configurator-runtime/states-runtime.d.ts +2 -2
  111. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.d.ts +43 -0
  112. package/dist/application-spec/generate-application/runtime/factory-data/factory-data-runtime.js +1 -0
  113. package/dist/application-spec/generate-application/runtime/factory-data/index.d.ts +3 -0
  114. package/dist/application-spec/generate-application/runtime/factory-data/index.js +1 -0
  115. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.d.ts +13 -0
  116. package/dist/application-spec/generate-application/runtime/factory-data/recipe-defaults.js +1 -0
  117. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.d.ts +16 -0
  118. package/dist/application-spec/generate-application/runtime/factory-data/static-violations.js +1 -0
  119. package/dist/application-spec/generate-application/runtime/migrations/index.d.ts +1 -0
  120. package/dist/application-spec/generate-application/runtime/migrations/index.js +1 -0
  121. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.d.ts +53 -0
  122. package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.js +1 -0
  123. package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +2 -2
  124. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.d.ts +2 -1
  125. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
  126. package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.d.ts +2 -1
  127. package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.js +1 -1
  128. package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +3 -0
  129. package/dist/application-spec/generate-application/runtime/sections/component-optic.js +1 -1
  130. package/dist/application-spec/generate-application/runtime/sections/data-runtime.d.ts +4 -4
  131. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +7 -4
  132. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  133. package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.d.ts +9 -5
  134. package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.js +1 -1
  135. package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.d.ts +3 -1
  136. package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.js +1 -1
  137. package/dist/application-spec/generate-application/runtime/sections/theme-runtime.d.ts +2 -2
  138. package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +3 -3
  139. package/dist/application-spec/generate-application/runtime/spec-code/index.d.ts +2 -0
  140. package/dist/application-spec/generate-application/runtime/spec-code/index.js +1 -0
  141. package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.d.ts +18 -0
  142. package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.js +1 -0
  143. package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.d.ts +17 -0
  144. package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.js +1 -0
  145. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.d.ts +9 -0
  146. package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.js +1 -0
  147. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.d.ts +8 -0
  148. package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.js +1 -0
  149. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +27 -0
  150. package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.js +1 -0
  151. package/dist/application-spec/generate-application/runtime-spec/index.d.ts +5 -0
  152. package/dist/application-spec/generate-application/runtime-spec/index.js +1 -0
  153. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +68 -0
  154. package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -0
  155. package/dist/application-spec/generate-application/runtime-spec/spec-code-id.d.ts +40 -0
  156. package/dist/application-spec/generate-application/runtime-spec/spec-code-id.js +1 -0
  157. package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +34 -0
  158. package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
  159. package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.d.ts +16 -0
  160. package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.js +9 -0
  161. package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.d.ts +9 -0
  162. package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.js +1 -0
  163. package/dist/application-spec/parse-application-files/raw-spec/parse-yaml-spec-file.js +1 -1
  164. package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
  165. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  166. package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
  167. package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
  168. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.d.ts +3 -0
  169. package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.js +1 -0
  170. package/dist/application-spec/parse-application-files/spec/common/value-type/index.d.ts +5 -0
  171. package/dist/application-spec/parse-application-files/spec/common/value-type/index.js +1 -0
  172. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.d.ts +6 -0
  173. package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.js +1 -0
  174. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.d.ts +8 -0
  175. package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.js +1 -0
  176. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.d.ts +10 -0
  177. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.js +1 -0
  178. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.d.ts +98 -0
  179. package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.js +1 -0
  180. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.d.ts +13 -0
  181. package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.js +1 -0
  182. package/dist/application-spec/parse-application-files/spec/components/bindings/index.d.ts +2 -0
  183. package/dist/application-spec/parse-application-files/spec/components/bindings/index.js +1 -1
  184. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.d.ts +24 -0
  185. package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.js +1 -0
  186. package/dist/application-spec/parse-application-files/spec/components/component-state-type.d.ts +8 -0
  187. package/dist/application-spec/parse-application-files/spec/components/component-state-type.js +1 -0
  188. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.d.ts +13 -0
  189. package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.js +1 -0
  190. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.d.ts +14 -0
  191. package/dist/application-spec/parse-application-files/spec/components/static-entity-id.js +1 -0
  192. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.d.ts +6 -0
  193. package/dist/application-spec/parse-application-files/spec/components/user-component-entry.js +1 -1
  194. package/dist/application-spec/parse-application-files/spec/components/user-components.d.ts +7 -4
  195. package/dist/application-spec/parse-application-files/spec/components/user-components.js +1 -1
  196. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.d.ts +24 -0
  197. package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.js +1 -0
  198. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.d.ts +13 -0
  199. package/dist/application-spec/parse-application-files/spec/expressions/expression-read.js +1 -0
  200. package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.d.ts +9 -0
  201. package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.js +1 -0
  202. package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +6 -2
  203. package/dist/application-spec/parse-application-files/spec/expressions/expressions.js +1 -1
  204. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.d.ts +3 -1
  205. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.js +1 -1
  206. package/dist/application-spec/parse-application-files/spec/invariants/invariants.d.ts +2 -2
  207. package/dist/application-spec/parse-application-files/spec/invariants/invariants.js +1 -1
  208. package/dist/application-spec/parse-application-files/spec/model/index.d.ts +1 -0
  209. package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
  210. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.d.ts +10 -0
  211. package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.js +1 -0
  212. package/dist/client/phoenix-api.d.ts +367 -0
  213. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +36 -1
  214. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  215. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +7 -1
  216. package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
  217. package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.d.ts +12 -0
  218. package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.js +1 -0
  219. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +7 -1
  220. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  221. package/dist/configurator/common/configurator-interface.d.ts +21 -1
  222. package/dist/configurator/common/configurator-interface.js +1 -1
  223. package/dist/configurator/common/index.d.ts +3 -1
  224. package/dist/configurator/common/index.js +1 -1
  225. package/dist/configurator/common/use-finalize-action.d.ts +31 -0
  226. package/dist/configurator/common/use-finalize-action.js +1 -0
  227. package/dist/configurator/common/use-reset-camera.d.ts +6 -0
  228. package/dist/configurator/common/use-reset-camera.js +1 -0
  229. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +12 -0
  230. package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -0
  231. package/dist/configurator/configuration-not-found-page/index.d.ts +1 -0
  232. package/dist/configurator/configuration-not-found-page/index.js +1 -0
  233. package/dist/configurator/configurator-context/PresetSelectionProvider.js +1 -1
  234. package/dist/configurator/pages/ConfiguratorNotFoundPage.js +1 -1
  235. package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +3 -2
  236. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  237. package/dist/configurator/pages/RootPage.js +1 -1
  238. package/dist/configurator/pages/configurator-layout-name.d.ts +2 -0
  239. package/dist/configurator/pages/configurator-layout-name.js +1 -0
  240. package/dist/configurator/pages/default-configurator-elements.d.ts +9 -0
  241. package/dist/configurator/pages/default-configurator-elements.js +1 -0
  242. package/dist/configurator/pages/default-elements/built-in-entity-element.d.ts +10 -0
  243. package/dist/configurator/pages/default-elements/built-in-entity-element.js +1 -0
  244. package/dist/configurator/pages/default-elements/built-in-layout-element.d.ts +10 -0
  245. package/dist/configurator/pages/default-elements/built-in-layout-element.js +1 -0
  246. package/dist/configurator/pages/default-elements/domain-control-elements.d.ts +6 -0
  247. package/dist/configurator/pages/default-elements/domain-control-elements.js +1 -0
  248. package/dist/configurator/pages/default-elements/index.d.ts +4 -0
  249. package/dist/configurator/pages/default-elements/index.js +1 -0
  250. package/dist/configurator/pages/default-elements/recipe-panel-elements.d.ts +3 -0
  251. package/dist/configurator/pages/default-elements/recipe-panel-elements.js +1 -0
  252. package/dist/configurator/pages/default-elements/sidebar-footer-elements.d.ts +7 -0
  253. package/dist/configurator/pages/default-elements/sidebar-footer-elements.js +1 -0
  254. package/dist/configurator/pages/default-elements/toolbar-elements.d.ts +7 -0
  255. package/dist/configurator/pages/default-elements/toolbar-elements.js +1 -0
  256. package/dist/configurator/pages/index.d.ts +1 -0
  257. package/dist/configurator/pages/index.js +1 -1
  258. package/dist/configurator/scene/scene-controls/DeleteEntityFab.js +1 -1
  259. package/dist/configurator/scene/scene-controls/SelectionHotspot.js +1 -1
  260. package/dist/configurator/ui/assistant/AssistantChips.d.ts +8 -2
  261. package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
  262. package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +7 -2
  263. package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
  264. package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
  265. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  266. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +1 -1
  267. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -1
  268. package/dist/configurator/ui/assistant/entity-link/entity-link-state.d.ts +1 -1
  269. package/dist/configurator/ui/assistant/entity-link/index.d.ts +0 -1
  270. package/dist/configurator/ui/assistant/entity-link/index.js +1 -1
  271. package/dist/configurator/ui/assistant/form/AssistantForm.d.ts +19 -0
  272. package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -0
  273. package/dist/configurator/ui/assistant/form/built-in-form-registry.d.ts +10 -0
  274. package/dist/configurator/ui/assistant/form/built-in-form-registry.js +1 -0
  275. package/dist/configurator/ui/assistant/form/compose-answer.d.ts +11 -0
  276. package/dist/configurator/ui/assistant/form/compose-answer.js +1 -0
  277. package/dist/configurator/ui/assistant/form/describe-build-errors.d.ts +6 -0
  278. package/dist/configurator/ui/assistant/form/describe-build-errors.js +1 -0
  279. package/dist/configurator/ui/assistant/form/form-element-definition.d.ts +14 -0
  280. package/dist/configurator/ui/assistant/form/form-element-definition.js +1 -0
  281. package/dist/configurator/ui/assistant/form/form-model.d.ts +38 -0
  282. package/dist/configurator/ui/assistant/form/form-model.js +1 -0
  283. package/dist/configurator/ui/assistant/form/form-registry.d.ts +31 -0
  284. package/dist/configurator/ui/assistant/form/form-registry.js +8 -0
  285. package/dist/configurator/ui/assistant/form/form-state.d.ts +4 -0
  286. package/dist/configurator/ui/assistant/form/form-state.js +1 -0
  287. package/dist/configurator/ui/assistant/form/index.d.ts +2 -0
  288. package/dist/configurator/ui/assistant/form/index.js +1 -0
  289. package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +9 -0
  290. package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -0
  291. package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +13 -0
  292. package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -0
  293. package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +3 -0
  294. package/dist/configurator/ui/assistant/form-elements/FormGroup.js +1 -0
  295. package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +3 -0
  296. package/dist/configurator/ui/assistant/form-elements/FormOptions.js +1 -0
  297. package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +3 -0
  298. package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -0
  299. package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +3 -0
  300. package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -0
  301. package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +34 -0
  302. package/dist/configurator/ui/assistant/form-elements/form-element-props.js +1 -0
  303. package/dist/configurator/ui/assistant/form-elements/index.d.ts +5 -0
  304. package/dist/configurator/ui/assistant/form-elements/index.js +1 -0
  305. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.d.ts +16 -0
  306. package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.js +1 -0
  307. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.d.ts +34 -0
  308. package/dist/configurator/ui/assistant/reference-link/assistant-link-target.js +1 -0
  309. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.d.ts +25 -0
  310. package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.js +1 -0
  311. package/dist/configurator/ui/assistant/reference-link/index.d.ts +3 -0
  312. package/dist/configurator/ui/assistant/reference-link/index.js +1 -0
  313. package/dist/configurator/ui/assistant/reference-link/reference-styles.d.ts +12 -0
  314. package/dist/configurator/ui/assistant/reference-link/reference-styles.js +1 -0
  315. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.d.ts +8 -0
  316. package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.js +1 -0
  317. package/dist/configurator/ui/assistant/resource-image/AssistantImage.d.ts +9 -0
  318. package/dist/configurator/ui/assistant/resource-image/AssistantImage.js +1 -0
  319. package/dist/configurator/ui/assistant/resource-image/index.d.ts +3 -0
  320. package/dist/configurator/ui/assistant/resource-image/index.js +1 -0
  321. package/dist/configurator/ui/assistant/resource-image/resource-path.d.ts +11 -0
  322. package/dist/configurator/ui/assistant/resource-image/resource-path.js +1 -0
  323. package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.d.ts +5 -0
  324. package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.js +1 -0
  325. package/dist/configurator/ui/assistant/streamed-markdown.d.ts +2 -0
  326. package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
  327. package/dist/configurator/ui/assistant/thread-items.d.ts +8 -1
  328. package/dist/configurator/ui/assistant/thread-items.js +1 -1
  329. package/dist/configurator/ui/assistant/use-follow-stream.js +1 -1
  330. package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.js +1 -1
  331. package/dist/configurator/ui/configurator-layout/slots/services/Services.js +1 -1
  332. package/dist/configurator/ui/legacy/layout/common/CommonFinalizeButton.js +1 -1
  333. package/dist/configurator/ui/legacy/layout/common/CommonSummaryButton.js +1 -1
  334. package/dist/configurator/ui/legacy/layout/common/CommonTopNavigation.js +1 -1
  335. package/dist/configurator/ui/legacy/layout/common/ResponsiveFinalizeButton.js +1 -1
  336. package/dist/configurator/ui/legacy/layout/common/SummaryReadLayout.js +1 -1
  337. package/dist/configurator/ui/legacy/layout/simple/SimpleOwnerLayout.js +1 -1
  338. package/dist/configurator/ui/legacy/layout/simple/SimpleTopNavigation.js +1 -1
  339. package/dist/configurator/ui/legacy/layout/steps/StepsNavigation.js +1 -1
  340. package/dist/configurator/ui/legacy/layout/steps/StepsOwnerLayout.js +1 -1
  341. package/dist/configurator/ui/legacy/layout/steps/StepsSidebarFooter.js +1 -1
  342. package/dist/configurator/ui/legacy/layout/tabs/TabsOwnerLayout.js +1 -1
  343. package/dist/configurator/ui/legacy/toolbar/common/DimensionUnitSelector.js +1 -1
  344. package/dist/configurator/ui/legacy/toolbar/common/MeasurementsIndicatorsSwitch.js +1 -1
  345. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/FullscreenToolbarAction.js +1 -1
  346. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/HelpToolbarAction.js +1 -1
  347. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/MeasurementsToolbarAction.js +1 -1
  348. package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/UndoRedoToolbarGroup.js +1 -1
  349. package/dist/configurator/ui/phoenix-layout-elements/EnterFullscreenToolbarButton.js +1 -1
  350. package/dist/configurator/ui/phoenix-layout-elements/ExitFullscreenToolbarButton.js +1 -1
  351. package/dist/configurator/ui/phoenix-layout-elements/HelpToolbarButton.js +1 -1
  352. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.d.ts +1 -0
  353. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.js +1 -1
  354. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.d.ts +1 -0
  355. package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.js +1 -1
  356. package/dist/configurator/ui/phoenix-layout-elements/MeasurementsToolbarButton.js +1 -1
  357. package/dist/configurator/ui/phoenix-layout-elements/RedoToolbarButton.js +1 -1
  358. package/dist/configurator/ui/phoenix-layout-elements/UndoToolbarButton.js +1 -1
  359. package/dist/configurator/ui/phoenix-layout-elements/header/common/back-button/use-go-back-action.js +1 -1
  360. package/dist/configurator/ui/phoenix-layout-elements/header/common/horizontal-tabs/DesktopHorizontalTabs.js +1 -1
  361. package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.js +1 -1
  362. package/dist/configurator/ui/phoenix-layout-elements/measurements/DimensionUnitSelector.js +1 -1
  363. package/dist/configurator/ui/phoenix-layout-elements/measurements/MeasurementsIndicatorsSwitch.js +1 -1
  364. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/basic/BasicFinalizeButton.js +1 -1
  365. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/CustomFinalizeButton.js +1 -1
  366. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/EnterSummaryButton.js +1 -1
  367. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/NextStepButton.js +1 -1
  368. package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/PreviousStepButton.js +1 -1
  369. package/dist/configurator/ui/preset-layout/CategoryPresetUi.js +1 -1
  370. package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.d.ts +10 -0
  371. package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -0
  372. package/dist/configurator/ui/save-message-snackbars/index.d.ts +1 -0
  373. package/dist/configurator/ui/save-message-snackbars/index.js +1 -0
  374. package/dist/docs/controls/select-child-entity/cardselect.mdx +1 -0
  375. package/dist/docs/fabs/basic.mdx +2 -2
  376. package/dist/docs/index.json +1 -1
  377. package/dist/docs/layouts/custom-layout.mdx +1471 -200
  378. package/dist/docs/other-features/not-found-404.mdx +1 -1
  379. package/dist/docs/phoenix/clerk-sign-in.mdx +1 -1
  380. package/dist/docs/phoenix/components.mdx +6 -0
  381. package/dist/docs/phoenix/configurator-interface.mdx +99 -21
  382. package/dist/docs/phoenix/deployments.mdx +2 -6
  383. package/dist/docs/phoenix/domain-model.mdx +2 -0
  384. package/dist/docs/phoenix/finalization.mdx +1 -1
  385. package/dist/docs/phoenix/getting-started.mdx +6 -3
  386. package/dist/docs/phoenix/layout-slots.mdx +12 -10
  387. package/dist/docs/phoenix/localization.mdx +10 -6
  388. package/dist/docs/phoenix/migration-guide.mdx +24 -11
  389. package/dist/docs/phoenix/phoenix-cli.mdx +67 -20
  390. package/dist/docs/phoenix/project-structure.mdx +70 -33
  391. package/dist/docs/phoenix/quickstart.mdx +7 -7
  392. package/dist/docs/phoenix/sdk-builder-workflow.mdx +7 -7
  393. package/dist/docs/phoenix/testing.mdx +8 -0
  394. package/dist/docs/phoenix/webhooks.mdx +21 -4
  395. package/dist/domain/application/application-config.d.ts +3 -1
  396. package/dist/domain/application/assistant/assistant-form-elements.d.ts +28 -0
  397. package/dist/domain/application/assistant/assistant-form-elements.js +1 -0
  398. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  399. package/dist/domain/application/assistant/index.d.ts +2 -0
  400. package/dist/domain/application/assistant/index.js +1 -1
  401. package/dist/domain/application/assistant-recipe-groups.d.ts +3 -1
  402. package/dist/domain/application/configurator-builder.d.ts +4 -1
  403. package/dist/domain/application/configurator-builder.js +1 -1
  404. package/dist/domain/core/schema/extended-schema-validator.js +1 -1
  405. package/dist/domain/domain-context/index.d.ts +1 -1
  406. package/dist/domain/domain-context/undo-system.d.ts +28 -1
  407. package/dist/domain/domain-context/undo-system.js +1 -1
  408. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  409. package/dist/domain/domain-runtime/spec/module-checks/element-registration.d.ts +12 -11
  410. package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -1
  411. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -1
  412. package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
  413. package/dist/domain/domain-runtime/spec/selectors.js +1 -1
  414. package/dist/domain/domain-runtime/spec/types.d.ts +2 -0
  415. package/dist/domain/system-components/child-entity-selection.js +1 -1
  416. package/dist/domain/system-components/common/scene-entity-control-schema.d.ts +3 -0
  417. package/dist/domain/system-components/common/scene-entity-control-schema.js +1 -1
  418. package/dist/editor/Editor.d.ts +7 -0
  419. package/dist/editor/Editor.js +1 -1
  420. package/dist/editor/mocks/CreateMockYaml.js +2 -2
  421. package/dist/editor/mocks/EditorMockContext.d.ts +2 -0
  422. package/dist/editor/mocks/EditorMockContext.js +1 -1
  423. package/dist/globals/index.d.ts +2 -0
  424. package/dist/i18n/locales/cs/messages.js +1 -1
  425. package/dist/i18n/locales/da/messages.js +1 -1
  426. package/dist/i18n/locales/de/messages.js +1 -1
  427. package/dist/i18n/locales/de-AT/messages.js +1 -1
  428. package/dist/i18n/locales/en/messages.js +1 -1
  429. package/dist/i18n/locales/en-AU/messages.js +1 -1
  430. package/dist/i18n/locales/en-GB/messages.js +1 -1
  431. package/dist/i18n/locales/es/messages.js +1 -1
  432. package/dist/i18n/locales/fr/messages.js +1 -1
  433. package/dist/i18n/locales/hu/messages.js +1 -1
  434. package/dist/i18n/locales/it/messages.js +1 -1
  435. package/dist/i18n/locales/nl/messages.js +1 -1
  436. package/dist/i18n/locales/pl/messages.js +1 -1
  437. package/dist/i18n/locales/pt/messages.js +1 -1
  438. package/dist/i18n/locales/ro/messages.js +1 -1
  439. package/dist/i18n/locales/sk/messages.js +1 -1
  440. package/dist/i18n/locales/tr/messages.js +1 -1
  441. package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
  442. package/dist/legacy/domain-cli/utils/cache.js +1 -1
  443. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +79 -80
  444. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
  445. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
  446. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
  447. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +7 -2
  448. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +15 -14
  449. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-configurator.js +14 -12
  450. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +14 -13
  451. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-configurator.js +13 -11
  452. package/dist/phoenix/application-spec/application-spec-builder.d.ts +0 -2
  453. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  454. package/dist/phoenix/application-spec/generate-application-spec-project.d.ts +0 -2
  455. package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
  456. package/dist/phoenix/application-spec/generate-application-spec-story.js +2 -2
  457. package/dist/phoenix/application-spec/generate-project-files.d.ts +0 -2
  458. package/dist/phoenix/application-spec/project-files.js +1 -1
  459. package/dist/phoenix/bin.d.ts +2 -0
  460. package/dist/phoenix/bin.js +2 -0
  461. package/dist/phoenix/check-configs/built-in-eslint-config.d.ts +9 -0
  462. package/dist/phoenix/check-configs/built-in-eslint-config.js +1 -0
  463. package/dist/phoenix/check-configs/eslint-config.d.ts +10 -0
  464. package/dist/phoenix/check-configs/eslint-config.js +1 -0
  465. package/dist/phoenix/check-configs/index.d.ts +8 -0
  466. package/dist/phoenix/check-configs/index.js +1 -0
  467. package/dist/phoenix/check-configs/typescript-project.d.ts +5 -0
  468. package/dist/phoenix/check-configs/typescript-project.js +1 -0
  469. package/dist/phoenix/cli.d.ts +0 -1
  470. package/dist/phoenix/cli.js +1 -2
  471. package/dist/phoenix/commands/build.js +1 -1
  472. package/dist/phoenix/commands/check.js +1 -1
  473. package/dist/phoenix/commands/clean.js +1 -1
  474. package/dist/phoenix/commands/deploy.js +2 -2
  475. package/dist/phoenix/commands/deps/deps.d.ts +73 -0
  476. package/dist/phoenix/commands/deps/deps.js +3 -0
  477. package/dist/phoenix/commands/deps/index.d.ts +1 -0
  478. package/dist/phoenix/commands/deps/index.js +1 -0
  479. package/dist/phoenix/commands/deps/sdk-manifest.d.ts +12 -0
  480. package/dist/phoenix/commands/deps/sdk-manifest.js +1 -0
  481. package/dist/phoenix/commands/dev.js +5 -5
  482. package/dist/phoenix/commands/fix.js +1 -1
  483. package/dist/phoenix/commands/index.d.ts +1 -0
  484. package/dist/phoenix/commands/index.js +1 -1
  485. package/dist/phoenix/commands/init.d.ts +17 -5
  486. package/dist/phoenix/commands/init.js +1 -1
  487. package/dist/phoenix/commands/link.js +1 -1
  488. package/dist/phoenix/commands/prettier.js +1 -1
  489. package/dist/phoenix/commands/sync.js +1 -1
  490. package/dist/phoenix/commands/unlink.js +1 -1
  491. package/dist/phoenix/services/application-spec-project-watcher.d.ts +2 -2
  492. package/dist/phoenix/services/application-spec-project-watcher.js +3 -3
  493. package/dist/phoenix/services/lingui.d.ts +8 -0
  494. package/dist/phoenix/services/lingui.js +1 -1
  495. package/dist/phoenix/services/swc.js +1 -1
  496. package/dist/phoenix/services/vite-config.js +1 -1
  497. package/dist/phoenix/utils/index.d.ts +4 -2
  498. package/dist/phoenix/utils/index.js +1 -1
  499. package/dist/phoenix/utils/node-version/index.d.ts +1 -0
  500. package/dist/phoenix/utils/node-version/index.js +1 -0
  501. package/dist/phoenix/utils/node-version/supported-node-version.d.ts +12 -0
  502. package/dist/phoenix/utils/node-version/supported-node-version.js +4 -0
  503. package/dist/phoenix/utils/package-info.d.ts +0 -9
  504. package/dist/phoenix/utils/package-info.js +1 -1
  505. package/dist/phoenix/utils/package-manager/index.d.ts +2 -0
  506. package/dist/phoenix/utils/package-manager/index.js +1 -0
  507. package/dist/phoenix/utils/package-manager/package-manager-commands.d.ts +19 -0
  508. package/dist/phoenix/utils/package-manager/package-manager-commands.js +1 -0
  509. package/dist/phoenix/utils/package-manager/pnpm-project.d.ts +9 -0
  510. package/dist/phoenix/utils/package-manager/pnpm-project.js +1 -0
  511. package/dist/phoenix/utils/run-command.d.ts +11 -0
  512. package/dist/phoenix/utils/run-command.js +1 -1
  513. package/dist/phoenix/utils/sdk-tool/index.d.ts +1 -0
  514. package/dist/phoenix/utils/sdk-tool/index.js +1 -0
  515. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.d.ts +15 -0
  516. package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.js +1 -0
  517. package/dist/react-sdk/application-runtime/common-services/analytics/index.d.ts +1 -0
  518. package/dist/react-sdk/application-runtime/common-services/analytics/index.js +1 -1
  519. package/dist/react-sdk/domain-application-context/DomainLifecycleBoundary.js +1 -1
  520. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.d.ts +15 -4
  521. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.js +1 -1
  522. package/dist/react-sdk/domain-context/index.d.ts +2 -1
  523. package/dist/react-sdk/domain-context/index.js +1 -1
  524. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +5 -0
  525. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
  526. package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.d.ts +20 -0
  527. package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.js +1 -0
  528. package/dist/ui-sdk/theme/types.d.ts +1 -1
  529. package/package.json +46 -35
  530. package/schema/domain-spec.json +86 -8
  531. package/dist/application-spec/generate-application/code/templates/nvmrc.d.ts +0 -1
  532. package/dist/application-spec/generate-application/code/templates/nvmrc.js +0 -2
  533. package/dist/application-spec/generate-application/code/templates/package-json.d.ts +0 -10
  534. package/dist/application-spec/generate-application/code/templates/package-json.js +0 -1
  535. package/dist/application-spec/generate-application/code/templates/webhook-implementation.d.ts +0 -1
  536. package/dist/application-spec/generate-application/code/templates/webhook-implementation.js +0 -7
  537. package/dist/configurator/ui/assistant/entity-link/entity-link-target.d.ts +0 -5
  538. package/dist/configurator/ui/assistant/entity-link/entity-link-target.js +0 -1
  539. package/dist/phoenix/commands/generate-project-files.d.ts +0 -6
  540. package/dist/phoenix/commands/generate-project-files.js +0 -1
  541. /package/dist/{configurator/common → react-sdk/application-runtime/common-services/analytics}/frontend-analytics.d.ts +0 -0
  542. /package/dist/{configurator/common → react-sdk/application-runtime/common-services/analytics}/frontend-analytics.js +0 -0
@@ -1,6 +1,6 @@
1
1
  # Custom Layout
2
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. 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.
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
4
 
5
5
  - [Choose this approach](#choose-this-approach)
6
6
  - [Register the layout](#register-the-layout)
@@ -9,7 +9,11 @@ Make the configurator look like the brand's own product page. A furniture shop w
9
9
  - [Draw the choices](#draw-the-choices)
10
10
  - [Offer fullscreen](#offer-fullscreen)
11
11
  - [Show messages](#show-messages)
12
+ - [Request a quote](#request-a-quote)
12
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)
13
17
  - [The spec the layout reads](#the-spec-the-layout-reads)
14
18
  - [Try the example](#try-the-example)
15
19
  - [Test cases](#test-cases)
@@ -31,26 +35,44 @@ Create `src/elements/ConfiguratorLayout.tsx` with a default export made by `phx.
31
35
 
32
36
  ```tsx
33
37
  import { Box } from '@mui/material'
38
+ import { useState } from 'react'
34
39
 
35
40
  import { LayoutSlots, useSceneSafeArea } from '@salsita-ai/sdk/configurator'
41
+ import { useActiveViewports } from '@salsita-ai/sdk/react'
36
42
 
37
43
  import { phx } from '../../.phoenix/phx.js'
44
+ import { BottomSheet } from '../_shared/BottomSheet.js'
38
45
  import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
39
46
  import { MessageToast } from '../_shared/MessageToast.js'
40
47
  import { ProductPanel } from '../_shared/ProductPanel.js'
48
+ import { SceneControls } from '../_shared/SceneControls.js'
41
49
 
42
50
  const GUTTER = 24
43
51
  const PANEL_WIDTH = 380
52
+ const PHONE_GUTTER = 16
53
+ const TOUCH_TARGET = 44
44
54
 
45
55
  const ConfiguratorLayout = () => {
46
56
  const { containerRef, safeAreaRef } = useSceneSafeArea()
47
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
48
64
 
49
65
  return (
50
- <Box component="div" ref={containerRef} sx={{ position: 'absolute', inset: 0 }}>
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
+ >
51
73
  <LayoutSlots.SharedCanvas />
52
74
 
53
- {!isFullscreen && (
75
+ {viewports !== null && isDesktop && !isFullscreen && (
54
76
  <Box
55
77
  component="aside"
56
78
  sx={{
@@ -64,37 +86,72 @@ const ConfiguratorLayout = () => {
64
86
  borderRadius: 5,
65
87
  bgcolor: 'background.paper',
66
88
  boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
67
- overflow: 'hidden',
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',
68
93
  }}
69
94
  >
70
95
  <ProductPanel />
71
96
  </Box>
72
97
  )}
73
98
 
74
- <Box
75
- component="div"
76
- ref={safeAreaRef}
77
- sx={{
78
- position: 'absolute',
79
- insetBlock: 0,
80
- insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
81
- insetInlineEnd: 0,
82
- pointerEvents: 'none',
83
- }}
84
- >
85
- <Box
86
- component="div"
87
- sx={{ position: 'absolute', insetBlockStart: GUTTER, insetInlineEnd: GUTTER, pointerEvents: 'auto' }}
88
- >
89
- <FullscreenToggle />
90
- </Box>
99
+ {viewports !== null && (
91
100
  <Box
92
101
  component="div"
93
- sx={{ position: 'absolute', insetBlockEnd: GUTTER, insetInlineStart: GUTTER, pointerEvents: 'auto' }}
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
+ }}
94
115
  >
95
- <MessageToast />
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>
96
147
  </Box>
97
- </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
+ )}
98
155
  </Box>
99
156
  )
100
157
  }
@@ -109,9 +166,10 @@ The components it uses live in `src/_shared/`, which Phoenix does not import by
109
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`.
110
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`.
111
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.
112
- - **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. 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.
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.
113
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.
114
- - **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 and lets the safe area start at the left edge, so the camera frames the product in the whole canvas.
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).
115
173
  - **Serve read mode.** The same element renders a configuration shared for viewing, and the layout decides what a viewer sees.
116
174
 
117
175
  ## Read and change the product
@@ -121,13 +179,23 @@ The panel reads everything it shows from hooks and writes the customer's choice
121
179
  ```tsx
122
180
  import { Box, Button, Typography } from '@mui/material'
123
181
 
124
- import { detailComponent } from '@salsita-ai/sdk/domain'
125
- import { useResolveLocalizable } from '@salsita-ai/sdk/react'
182
+ import { detailComponent, finalizeActionComponent } from '@salsita-ai/sdk/domain'
183
+ import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
126
184
 
127
185
  import { phx } from '../../.phoenix/phx.js'
128
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
+ }
129
197
 
130
- export const ProductPanel = () => {
198
+ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
131
199
  const resolve = useResolveLocalizable()
132
200
  const detail = phx.frontend.useFirstRootComponent(detailComponent)
133
201
  const price = phx.frontend.useRootEntityPrice()
@@ -137,9 +205,13 @@ export const ProductPanel = () => {
137
205
  const navigationState = phx.frontend.useActiveNavigationState()
138
206
  const pushNavigate = phx.frontend.usePushNavigate()
139
207
  const popNavigate = phx.frontend.usePopNavigate()
208
+ const navigate = phx.frontend.useNavigate()
209
+ const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
140
210
 
141
211
  const isReadMode = accessInfo.viewMode
142
- const isReview = isReadMode || navigationState === 'checkout'
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]
143
215
  const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
144
216
 
145
217
  return (
@@ -160,29 +232,44 @@ export const ProductPanel = () => {
160
232
  <Typography variant="h5" component="h2" fontWeight={700}>
161
233
  {resolve(detail?.state.title)}
162
234
  </Typography>
163
- <Typography variant="body2" color="text.secondary">
164
- {resolve(detail?.state.description)}
165
- </Typography>
166
- </Box>
167
-
168
- <Box component="div" sx={{ display: 'grid', gap: 1.5, paddingInline: 3, paddingBlockEnd: 3, overflowY: 'auto' }}>
169
- <Typography variant="subtitle2" component="h3">
170
- Edge finish
171
- </Typography>
172
- {isReview ? (
173
- <Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
174
- <Typography variant="body2" fontWeight={600}>
175
- {resolve(chosenEdge?.title)}
176
- </Typography>
177
- <Typography variant="caption" color="text.secondary">
178
- {resolve(chosenEdge?.description)}
179
- </Typography>
180
- </Box>
181
- ) : (
182
- <EdgeFinishCards selection={edgeFinish} />
235
+ {!collapsed && (
236
+ <Typography variant="body2" color="text.secondary">
237
+ {resolve(detail?.state.description)}
238
+ </Typography>
183
239
  )}
184
240
  </Box>
185
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
+
186
273
  <Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
187
274
  <Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
188
275
  <Typography variant="body2" color="text.secondary">
@@ -192,43 +279,71 @@ export const ProductPanel = () => {
192
279
  {price}
193
280
  </Typography>
194
281
  </Box>
195
- {isReview && !isReadMode && (
196
- <Typography variant="body2" color="text.secondary">
197
- Your table is ready for a quote. A real shop collects the contact details here.
198
- </Typography>
199
- )}
200
- {!isReadMode && (
201
- <Button
202
- size="large"
203
- variant={isReview ? 'outlined' : 'contained'}
204
- onClick={isReview ? popNavigate : () => pushNavigate('checkout')}
205
- sx={{ minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 }}
206
- >
207
- {isReview ? 'Back to the configuration' : 'Review and request a quote'}
282
+ {!isReadMode && navigationState === 'configure' && (
283
+ <Button size="large" variant="contained" onClick={() => pushNavigate('checkout')} sx={BUTTON_SX}>
284
+ Review and request a quote
208
285
  </Button>
209
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
+ )}
210
317
  </Box>
211
318
  </>
212
319
  )
213
320
  }
214
321
  ```
215
322
 
216
- | Hook | What the layout uses it for |
217
- | ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
218
- | `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. |
219
- | `phx.frontend.useRootEntityId()` | The id of the table, which the control hooks take. |
220
- | `phx.frontend.useAttributeSelection(entityId, instanceName)` | The `attributeSelection` component named `edgeFinish`: the current `value` and the `options`, each with `title`, `description`, `value`, `disabled` and `onSelect`. |
221
- | `phx.frontend.useRootEntityPrice()` | The root entity's `price` component, formatted for the current locale and currency, or `null` without one. |
222
- | `phx.frontend.useAccessService()` | `accessInfo.viewMode` is `true` while a configuration shared for viewing is open, and also while the host sets the `readonly` property. |
223
- | `phx.frontend.useActiveNavigationState()` | The active navigation state; the panel shows its review step while it is `checkout`. |
224
- | `phx.frontend.usePushNavigate()` and `phx.frontend.usePopNavigate()` | Enter the review step and leave it again. |
225
- | `phx.frontend.useIsFullscreenActive()` and `phx.frontend.useSetFullscreen()` | Read the fullscreen flag, and set it from the layout's own button. |
226
- | `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). |
227
- | `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`. |
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
+ | `phx.frontend.useUndoRedo()` | Not used here: whether there is a change to undo or redo, and `undo` and `redo`, for a layout's own undo and redo buttons; see [Known gaps](#known-gaps). |
339
+ | `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). |
340
+ | `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). |
341
+ | `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`. |
342
+ | `PhoenixHandlerBoundary` from `@salsita-ai/sdk/react` | Wraps the review step's buttons, so an edited handler takes effect without a reload. |
228
343
 
229
344
  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`.
230
345
 
231
- 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. A real shop collects the contact details there and sends the request.
346
+ 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.
232
347
 
233
348
  ## Draw the choices
234
349
 
@@ -374,39 +489,50 @@ The drawings are keyed by the option values of the spec. A spec can carry a pict
374
489
  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.
375
490
 
376
491
  ```tsx
377
- import { Button } from '@mui/material'
492
+ import { Button, Tooltip } from '@mui/material'
378
493
 
379
494
  import { phx } from '../../.phoenix/phx.js'
380
495
 
381
496
  const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
382
497
  const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
383
498
 
384
- export const FullscreenToggle = () => {
499
+ interface FullscreenToggleProps {
500
+ // Only the icon, with the label as its accessible name and tooltip, where a label would cover the product
501
+ readonly compact?: boolean
502
+ }
503
+
504
+ export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
385
505
  const isFullscreen = phx.frontend.useIsFullscreenActive()
386
506
  const setFullscreen = phx.frontend.useSetFullscreen()
507
+ const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
508
+ const icon = (
509
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
510
+ <path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
511
+ </svg>
512
+ )
387
513
 
388
514
  return (
389
- <Button
390
- onClick={() => setFullscreen(!isFullscreen)}
391
- startIcon={
392
- <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
393
- <path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
394
- </svg>
395
- }
396
- sx={{
397
- minBlockSize: 44,
398
- paddingInline: 2.5,
399
- borderRadius: 999,
400
- bgcolor: 'background.paper',
401
- color: 'text.primary',
402
- boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
403
- textTransform: 'none',
404
- fontWeight: 600,
405
- '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
406
- }}
407
- >
408
- {isFullscreen ? 'Exit fullscreen' : 'Fullscreen'}
409
- </Button>
515
+ <Tooltip title={compact ? label : ''}>
516
+ <Button
517
+ onClick={() => setFullscreen(!isFullscreen)}
518
+ aria-label={compact ? label : undefined}
519
+ startIcon={compact ? undefined : icon}
520
+ sx={{
521
+ minBlockSize: 44,
522
+ minInlineSize: 44,
523
+ paddingInline: compact ? 0 : 2.5,
524
+ borderRadius: 999,
525
+ bgcolor: 'background.paper',
526
+ color: 'text.primary',
527
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
528
+ textTransform: 'none',
529
+ fontWeight: 600,
530
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
531
+ }}
532
+ >
533
+ {compact ? icon : label}
534
+ </Button>
535
+ </Tooltip>
410
536
  )
411
537
  }
412
538
  ```
@@ -415,7 +541,7 @@ The button stays in the free area in both states, so the way back is always wher
415
541
 
416
542
  ## Show messages
417
543
 
418
- 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 at the bottom of the free area shows a message for six seconds, colored by its severity:
544
+ When a change is rejected because it breaks an invariant, when a committed change carries a hint, when an error is thrown while a change is validated, or when saving the configuration fails and later succeeds again, 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:
419
545
 
420
546
  ```tsx
421
547
  import { Alert } from '@mui/material'
@@ -434,7 +560,7 @@ const severityOf = (message: ConfiguratorMessage) => {
434
560
  return VIOLATION_SEVERITY[message.violation.severity]
435
561
  }
436
562
 
437
- return message.kind === 'error' ? 'error' : 'info'
563
+ return message.kind === 'error' || message.kind === 'saveError' ? 'error' : 'info'
438
564
  }
439
565
 
440
566
  export const MessageToast = () => {
@@ -471,7 +597,7 @@ export const MessageToast = () => {
471
597
  }
472
598
  ```
473
599
 
474
- 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
+ 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'`, `'error'`, `'saveError'` or `'saveRecovery'`; the toast shows an error and a failed save as errors, a hint and the save that succeeded again as information. 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.
475
601
 
476
602
  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:
477
603
 
@@ -494,20 +620,576 @@ export default phx.frontend.transformerBuilder.when
494
620
  .build('tree-trunk-delivery')
495
621
  ```
496
622
 
497
- [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
+ [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui) lists the messages the hook does not deliver: errors of the built-in finalize and other actions stay snackbars, and a failure to start from a preset is raised on the preset screen.
624
+
625
+ ## Request a quote
626
+
627
+ The spec declares what finalizing means for this product as a `finalizeAction` component, and the project registers the handler it names:
628
+
629
+ ```yaml
630
+ components:
631
+ Table:
632
+ finalizeAction:
633
+ quote:
634
+ variant: primary
635
+ label: Request a quote
636
+ title: Send the configuration to the shop for a quote
637
+ icon: PaperPlaneTilt
638
+ handler: requestQuote
639
+ ```
640
+
641
+ ```ts
642
+ import { useCallback } from 'react'
643
+
644
+ import { phx } from '../../.phoenix/phx.js'
645
+
646
+ // Stands in for the shop's quote service: the request takes a moment, then the panel shows the confirmation
647
+ export default phx.frontend.createPhoenixHandler('requestQuote', () => {
648
+ const navigate = phx.frontend.useNavigate()
649
+
650
+ return {
651
+ handler: useCallback(async () => {
652
+ await new Promise(resolve => setTimeout(resolve, 1500))
653
+ navigate('requested')
654
+ }, [navigate]),
655
+ }
656
+ })
657
+ ```
658
+
659
+ 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()`.
660
+
661
+ 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.
662
+
663
+ ```tsx
664
+ import { Alert, Box, Button, CircularProgress, Typography } from '@mui/material'
665
+
666
+ import { phx } from '../../.phoenix/phx.js'
667
+
668
+ const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
669
+
670
+ interface ReviewActionsProps {
671
+ readonly handler: string
672
+ readonly label: string
673
+ readonly onBack: () => void
674
+ }
675
+
676
+ // The review step's buttons: one finalize action and the way back. `useFinalizeAction` runs the action's handler,
677
+ // so this component calls it exactly once and is rendered inside a `PhoenixHandlerBoundary` for that handler.
678
+ // Back is disabled while the request is pending, so the customer cannot change the configuration while it is sent.
679
+ // The pending state belongs to this component: when the panel unmounts, as in fullscreen, the request goes on and
680
+ // the remounted buttons are enabled again.
681
+ export const ReviewActions = ({ handler, label, onBack }: ReviewActionsProps) => {
682
+ const { run, isPending, error, disabled, hints } = phx.frontend.useFinalizeAction(handler)
683
+
684
+ return (
685
+ <Box component="div" sx={{ display: 'grid', gap: 2 }}>
686
+ <Box component="div" sx={{ display: 'grid', gap: 1 }}>
687
+ <Button
688
+ size="large"
689
+ variant="contained"
690
+ disabled={disabled || isPending}
691
+ onClick={run}
692
+ startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
693
+ sx={BUTTON_SX}
694
+ >
695
+ {isPending ? 'Sending the request…' : label}
696
+ </Button>
697
+ {disabled && hints && (
698
+ <Typography variant="caption" color="text.secondary">
699
+ {hints}
700
+ </Typography>
701
+ )}
702
+ {error && <Alert severity="error">The request could not be sent: {error.message}</Alert>}
703
+ </Box>
704
+ <Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
705
+ Back to the configuration
706
+ </Button>
707
+ </Box>
708
+ )
709
+ }
710
+ ```
711
+
712
+ - `run()` records the finalize-button click for analytics and runs the handler; it does nothing while `disabled` or `isPending`.
713
+ - 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.
714
+ - `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.
715
+ - `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.
716
+
717
+ 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.
498
718
 
499
719
  ## Serve read mode
500
720
 
501
- 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 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.
721
+ 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).
722
+
723
+ ## Fit a phone
724
+
725
+ 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.
726
+
727
+ **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.
728
+
729
+ | Value | When it is active |
730
+ | ----------- | ---------------------------------------------------------------------------------- |
731
+ | `phone` | The container is narrower than 480 pixels. |
732
+ | `mobile` | The container is at most 768 pixels wide. |
733
+ | `tablet` | The container is wider than 480 and narrower than 1024 pixels. |
734
+ | `desktop` | The container is wider than 768 pixels; `mobile` and `desktop` exclude each other. |
735
+ | `landscape` | The browser window, not the container, is wider than it is high. |
736
+ | `portrait` | The browser window, not the container, is higher than it is wide. |
737
+
738
+ 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.
739
+
740
+ **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.
741
+
742
+ ```tsx
743
+ import { Box, ButtonBase } from '@mui/material'
744
+ import { type MouseEvent, type PointerEvent, type ReactNode, useRef } from 'react'
745
+
746
+ // A drag shorter than this is a tap, and the handle's click toggles the sheet
747
+ const TAP_DISTANCE = 6
748
+ // A drag that ends this far from where it started snaps to the other position
749
+ const SNAP_DISTANCE = 48
750
+ // A drag faster than this, in pixels per millisecond, snaps in its direction even when it is short
751
+ const SNAP_VELOCITY = 0.5
752
+ // How far the sheet follows the finger towards the position it is already in
753
+ const OVERDRAG = 0.25
754
+
755
+ interface BottomSheetProps {
756
+ readonly open: boolean
757
+ readonly onOpenChange: (open: boolean) => void
758
+ readonly label: string
759
+ readonly children: ReactNode
760
+ }
761
+
762
+ interface Drag {
763
+ readonly startY: number
764
+ readonly startTime: number
765
+ delta: number
766
+ }
767
+
768
+ // A persistent sheet at the bottom of the layout with two positions, open and collapsed. It is not a modal: the scene
769
+ // above it stays interactive. Its height comes from its content, so the layout's safe area ends where the sheet
770
+ // starts and changes only when the sheet snaps. While the handle is dragged the sheet follows the finger with a
771
+ // transform, which the safe area does not see, so the camera refits once per snap and not on every move.
772
+ export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheetProps) => {
773
+ const sheetRef = useRef<HTMLElement>(null)
774
+ const dragRef = useRef<Drag | null>(null)
775
+ const draggedRef = useRef(false)
776
+
777
+ const moveSheet = (offset: number, animate: boolean) => {
778
+ if (sheetRef.current) {
779
+ sheetRef.current.style.transition = animate ? 'transform 200ms ease-out' : 'none'
780
+ sheetRef.current.style.transform = offset === 0 ? '' : `translateY(${offset}px)`
781
+ }
782
+ }
783
+
784
+ const handlePointerDown = (event: PointerEvent<HTMLButtonElement>) => {
785
+ event.currentTarget.setPointerCapture(event.pointerId)
786
+ dragRef.current = { startY: event.clientY, startTime: event.timeStamp, delta: 0 }
787
+ draggedRef.current = false
788
+ }
789
+
790
+ const handlePointerMove = (event: PointerEvent<HTMLButtonElement>) => {
791
+ const drag = dragRef.current
792
+
793
+ if (drag === null) {
794
+ return
795
+ }
796
+
797
+ drag.delta = event.clientY - drag.startY
798
+ // Down closes an open sheet and up opens a collapsed one; the other direction only gives a little
799
+ const towardsOther = open ? drag.delta > 0 : drag.delta < 0
800
+ moveSheet(towardsOther ? drag.delta : drag.delta * OVERDRAG, false)
801
+ }
802
+
803
+ const handlePointerEnd = (event: PointerEvent<HTMLButtonElement>) => {
804
+ const drag = dragRef.current
805
+ dragRef.current = null
806
+
807
+ if (drag === null) {
808
+ return
809
+ }
810
+
811
+ moveSheet(0, true)
812
+
813
+ if (Math.abs(drag.delta) < TAP_DISTANCE) {
814
+ return
815
+ }
816
+
817
+ draggedRef.current = true
818
+ const velocity = drag.delta / Math.max(event.timeStamp - drag.startTime, 1)
819
+ const flicked = Math.abs(drag.delta) >= SNAP_DISTANCE || Math.abs(velocity) >= SNAP_VELOCITY
820
+
821
+ if (flicked && (open ? drag.delta > 0 : drag.delta < 0)) {
822
+ onOpenChange(!open)
823
+ }
824
+ }
825
+
826
+ // A tap, Enter or Space toggles the sheet. The pointer click that ends a drag has already been handled; a keyboard
827
+ // click (`detail` 0) always toggles, also after a touch drag that was followed by no click.
828
+ const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
829
+ const dragged = draggedRef.current
830
+ draggedRef.current = false
831
+
832
+ if (dragged && event.detail !== 0) {
833
+ return
834
+ }
835
+
836
+ onOpenChange(!open)
837
+ }
838
+
839
+ return (
840
+ <Box
841
+ component="section"
842
+ ref={sheetRef}
843
+ aria-label={label}
844
+ sx={{
845
+ position: 'relative',
846
+ flexShrink: 0,
847
+ display: 'flex',
848
+ flexDirection: 'column',
849
+ maxBlockSize: '55%',
850
+ paddingBlockEnd: 'env(safe-area-inset-bottom)',
851
+ borderStartStartRadius: 20,
852
+ borderStartEndRadius: 20,
853
+ bgcolor: 'background.paper',
854
+ boxShadow: '0 -8px 32px rgba(0, 0, 0, 0.12)',
855
+ // Fills the gap below the sheet while it is dragged up
856
+ '&::after': {
857
+ content: '""',
858
+ position: 'absolute',
859
+ insetInline: 0,
860
+ insetBlockStart: '100%',
861
+ blockSize: '100vh',
862
+ bgcolor: 'background.paper',
863
+ },
864
+ }}
865
+ >
866
+ <ButtonBase
867
+ aria-expanded={open}
868
+ disableRipple
869
+ aria-label={open ? `Collapse ${label.toLowerCase()}` : `Expand ${label.toLowerCase()}`}
870
+ onClick={handleClick}
871
+ onPointerDown={handlePointerDown}
872
+ onPointerMove={handlePointerMove}
873
+ onPointerUp={handlePointerEnd}
874
+ onPointerCancel={handlePointerEnd}
875
+ sx={{
876
+ flexShrink: 0,
877
+ blockSize: 36,
878
+ touchAction: 'none',
879
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: -4, borderRadius: 3 },
880
+ }}
881
+ >
882
+ <Box component="span" sx={{ inlineSize: 40, blockSize: 4, borderRadius: 2, bgcolor: 'text.disabled' }} />
883
+ </ButtonBase>
884
+ {/* A column, so the panel's cards region shrinks first and the price and action stay in view; below the cards
885
+ region's minimum height the content scrolls as a whole, as the review step does on a short phone */}
886
+ <Box
887
+ component="div"
888
+ sx={{
889
+ display: 'flex',
890
+ flexDirection: 'column',
891
+ flex: '1 1 auto',
892
+ minBlockSize: 0,
893
+ overflowY: 'auto',
894
+ overscrollBehavior: 'contain',
895
+ }}
896
+ >
897
+ {children}
898
+ </Box>
899
+ </Box>
900
+ )
901
+ }
902
+ ```
903
+
904
+ - 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.
905
+ - 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.
906
+ - 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.
907
+ - 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.
908
+
909
+ **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.
910
+
911
+ **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:
912
+
913
+ ```yaml
914
+ components:
915
+ Table:
916
+ fitRootPerspectiveCamera:
917
+ main:
918
+ priority: 2
919
+ fov: 35
920
+ near: 100
921
+ far: 10000
922
+ minDistance: 1000
923
+ maxDistance: 9000
924
+ distance: 5000
925
+ azimuthAngle: 1.5
926
+ polarAngle: 1.1
927
+ fitMeshChanges: true
928
+ $filter:
929
+ viewports: [desktop]
930
+ phone:
931
+ priority: 1
932
+ fov: 35
933
+ near: 100
934
+ far: 10000
935
+ minDistance: 1000
936
+ maxDistance: 12000
937
+ distance: 8000
938
+ azimuthAngle: 1.5
939
+ polarAngle: 1.1
940
+ fitMeshChanges: true
941
+ $filter:
942
+ viewports: [mobile]
943
+ ```
944
+
945
+ ## Put a control on the product
946
+
947
+ 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.
948
+
949
+ 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:
950
+
951
+ ```yaml
952
+ components:
953
+ Table:
954
+ htmlHotspot:
955
+ edgeFinish:
956
+ name: EdgeFinishHotspot
957
+ offsetX: 500
958
+ offsetY: 800
959
+ offsetZ: 0
960
+ $filter:
961
+ modes: [owner]
962
+ navigationStates: [configure]
963
+ ```
964
+
965
+ 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:
966
+
967
+ ```tsx
968
+ import { Box, ButtonBase, Popover, Tooltip } from '@mui/material'
969
+ import { useState } from 'react'
970
+
971
+ import { phx } from '../../.phoenix/phx.js'
972
+ import { EdgeFinishCards } from '../_shared/EdgeFinishCards.js'
973
+
974
+ // The edge profile the button shows, the square edge of the cards' drawings
975
+ const EDGE_ICON = 'M3 7H17L21 11V13L17 17H3Z'
976
+
977
+ // Rendered by the spec's `htmlHotspot` on the table's edge: a button on the product that opens the edge finishes
978
+ // next to the edge, with the same cards as the panel. The spec's `$filter` decides when it is shown.
979
+ export default phx.frontend.createCustomPhoenixEntityElement('EdgeFinishHotspot', ({ entityId }) => {
980
+ const edgeFinish = phx.frontend.useAttributeSelection(entityId, 'edgeFinish')
981
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null)
982
+
983
+ return (
984
+ <>
985
+ <Tooltip title="Edge finish">
986
+ <ButtonBase
987
+ aria-label="Edge finish"
988
+ aria-haspopup="dialog"
989
+ aria-expanded={anchor !== null}
990
+ onClick={event => setAnchor(event.currentTarget)}
991
+ sx={{
992
+ display: 'grid',
993
+ placeItems: 'center',
994
+ inlineSize: 44,
995
+ blockSize: 44,
996
+ borderRadius: '50%',
997
+ bgcolor: 'background.paper',
998
+ color: 'primary.main',
999
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
1000
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
1001
+ }}
1002
+ >
1003
+ <svg viewBox="0 0 24 24" width={22} height={22} aria-hidden>
1004
+ <path d={EDGE_ICON} fill="currentColor" />
1005
+ </svg>
1006
+ </ButtonBase>
1007
+ </Tooltip>
1008
+ <Popover
1009
+ open={anchor !== null}
1010
+ anchorEl={anchor}
1011
+ onClose={() => setAnchor(null)}
1012
+ anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
1013
+ transformOrigin={{ vertical: 'bottom', horizontal: 'center' }}
1014
+ slotProps={{
1015
+ paper: { role: 'dialog', 'aria-label': 'Edge finish', sx: { borderRadius: 4, marginBlockStart: -1 } },
1016
+ }}
1017
+ >
1018
+ <Box component="div" sx={{ inlineSize: 340, maxInlineSize: 'calc(100vw - 32px)', padding: 2 }}>
1019
+ <EdgeFinishCards selection={edgeFinish} />
1020
+ </Box>
1021
+ </Popover>
1022
+ </>
1023
+ )
1024
+ })
1025
+ ```
1026
+
1027
+ - 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.
1028
+ - 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.
1029
+ - 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.
1030
+ - `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.
1031
+ - 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.
1032
+
1033
+ [Html Hotspots](?path=/docs/controls-scene-html-hotspots--docs) describes the component and its other properties.
1034
+
1035
+ ## Control the scene
1036
+
1037
+ 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.
1038
+
1039
+ **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:
1040
+
1041
+ ```yaml
1042
+ viewStates:
1043
+ - overview
1044
+ - edge
1045
+
1046
+ components:
1047
+ Table:
1048
+ fitRootPerspectiveCamera:
1049
+ edge:
1050
+ priority: 4
1051
+ fov: 35
1052
+ near: 100
1053
+ far: 10000
1054
+ minDistance: 800
1055
+ maxDistance: 9000
1056
+ distance: 2000
1057
+ azimuthAngle: 0.5
1058
+ polarAngle: 1.15
1059
+ fitMeshChanges: true
1060
+ $filter:
1061
+ viewports: [desktop]
1062
+ viewStates: [edge]
1063
+ edgePhone:
1064
+ priority: 3
1065
+ fov: 35
1066
+ near: 100
1067
+ far: 10000
1068
+ minDistance: 800
1069
+ maxDistance: 12000
1070
+ distance: 3000
1071
+ azimuthAngle: 0.5
1072
+ polarAngle: 1.15
1073
+ fitMeshChanges: true
1074
+ $filter:
1075
+ viewports: [mobile]
1076
+ viewStates: [edge]
1077
+ ```
1078
+
1079
+ **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:
1080
+
1081
+ ```tsx
1082
+ import { Box, Button, Tooltip } from '@mui/material'
1083
+
1084
+ import { phx } from '../../.phoenix/phx.js'
1085
+
1086
+ // The spec's view states, each with the label of the button that shows it
1087
+ const VIEWS = [
1088
+ { state: 'overview', label: 'Whole table' },
1089
+ { state: 'edge', label: 'Edge close-up' },
1090
+ ] as const
1091
+
1092
+ const RESET_ICON = 'M4 12a8 8 0 1 0 2.4-5.7M4 4v4h4'
1093
+
1094
+ const SURFACE_SX = {
1095
+ borderRadius: 999,
1096
+ bgcolor: 'background.paper',
1097
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
1098
+ } as const
1099
+
1100
+ const BUTTON_SX = {
1101
+ minBlockSize: 44,
1102
+ minInlineSize: 44,
1103
+ borderRadius: 999,
1104
+ textTransform: 'none',
1105
+ fontWeight: 600,
1106
+ whiteSpace: 'nowrap',
1107
+ } as const
1108
+
1109
+ interface SceneControlsProps {
1110
+ // The reset button shows only its icon, with its label as tooltip and accessible name
1111
+ readonly compact?: boolean
1112
+ // Only the reset button, without the view buttons
1113
+ readonly resetOnly?: boolean
1114
+ }
1115
+
1116
+ // The layout's own camera controls: one button per view state of the spec, and a reset that undoes an orbit
1117
+ export const SceneControls = ({ compact = false, resetOnly = false }: SceneControlsProps) => {
1118
+ const activeView = phx.frontend.useActiveViewState()
1119
+ const setViewState = phx.frontend.useSetViewState()
1120
+ const resetCamera = phx.frontend.useResetCamera()
1121
+ const resetIcon = (
1122
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
1123
+ <path d={RESET_ICON} />
1124
+ </svg>
1125
+ )
1126
+
1127
+ return (
1128
+ <Box component="div" sx={{ display: 'flex', gap: 1 }}>
1129
+ {!resetOnly && (
1130
+ <Box component="div" role="group" aria-label="View" sx={{ ...SURFACE_SX, display: 'flex' }}>
1131
+ {VIEWS.map(view => {
1132
+ const isActive = activeView === view.state
1133
+
1134
+ return (
1135
+ <Button
1136
+ key={view.state}
1137
+ aria-pressed={isActive}
1138
+ onClick={() => setViewState(view.state)}
1139
+ sx={{
1140
+ ...BUTTON_SX,
1141
+ paddingInline: 2,
1142
+ bgcolor: isActive ? 'text.primary' : 'transparent',
1143
+ color: isActive ? 'background.paper' : 'text.primary',
1144
+ '&:hover': { bgcolor: isActive ? 'text.primary' : 'action.hover' },
1145
+ }}
1146
+ >
1147
+ {view.label}
1148
+ </Button>
1149
+ )
1150
+ })}
1151
+ </Box>
1152
+ )}
1153
+ <Tooltip title={compact ? 'Reset view' : ''}>
1154
+ <Button
1155
+ onClick={resetCamera}
1156
+ aria-label={compact ? 'Reset view' : undefined}
1157
+ startIcon={compact ? undefined : resetIcon}
1158
+ sx={{
1159
+ ...SURFACE_SX,
1160
+ ...BUTTON_SX,
1161
+ paddingInline: compact ? 0 : 2,
1162
+ color: 'text.primary',
1163
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
1164
+ }}
1165
+ >
1166
+ {compact ? resetIcon : 'Reset view'}
1167
+ </Button>
1168
+ </Tooltip>
1169
+ </Box>
1170
+ )
1171
+ }
1172
+ ```
1173
+
1174
+ - 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.
1175
+ - 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.
1176
+ - 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.
1177
+ - 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.
1178
+ - The hooks need no `viewControls` component. That component configures the built-in layout's view controls and has no effect here.
502
1179
 
503
1180
  ## The spec the layout reads
504
1181
 
505
- The layout reads three components of the root entity and one navigation state; the scene components are in the complete implementation below.
1182
+ 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`.
506
1183
 
507
1184
  ```yaml
508
1185
  navigationStates:
509
1186
  - configure
510
1187
  - checkout
1188
+ - requested
1189
+
1190
+ viewStates:
1191
+ - overview
1192
+ - edge
511
1193
 
512
1194
  components:
513
1195
  Table:
@@ -537,42 +1219,62 @@ components:
537
1219
  - label: Tree trunk
538
1220
  description: The natural edge
539
1221
  value: TreeTrunk
1222
+ finalizeAction:
1223
+ quote:
1224
+ variant: primary
1225
+ label: Request a quote
1226
+ title: Send the configuration to the shop for a quote
1227
+ icon: PaperPlaneTilt
1228
+ handler: requestQuote
540
1229
 
541
1230
  transformers:
542
1231
  - name: tree-trunk-delivery
543
1232
  ```
544
1233
 
545
- `$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). 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.
1234
+ `$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.
546
1235
 
547
1236
  ## Try the example
548
1237
 
549
1238
  To see read mode, open **Mocks** in the editor rail on the left and apply the **Read User** template.
550
1239
 
1240
+ 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.
1241
+
551
1242
  ## Test cases
552
1243
 
553
1244
  - The panel is on the left and the table is centred in the area to the right of it, not in the whole canvas.
554
1245
  - 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.
555
- - Choosing **Tree trunk** also shows "Tree trunk edges are cut by hand, so delivery takes three weeks longer." at the bottom of the free area, until its close button is clicked or six seconds pass. Choosing another finish shows nothing.
1246
+ - 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.
556
1247
  - Tab reaches the selected card, and the arrow keys move the selection to the next or previous card.
557
1248
  - Dragging in the area to the right of the panel orbits the camera.
558
- - **Review and request a quote** replaces the cards with the chosen finish; **Back to the configuration** brings them back.
1249
+ - **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.
1250
+ - **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.
559
1251
  - **Fullscreen** removes the panel and the table moves to the centre of the canvas; **Exit fullscreen** brings both back.
560
- - With the **Read User** mock the panel says **View only**, shows the chosen finish and the price, and has no button.
1252
+ - 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.
1253
+ - 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.
1254
+ - Tab reaches the button on the edge, and Enter or Space opens the popover.
1255
+ - The button on the edge is gone in the review step, in the confirmation and with the **Read User** mock, and stays in fullscreen.
1256
+ - 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.
1257
+ - 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.
1258
+ - On the phone, the review step, **Request a quote** and the thank-you message work with the sheet collapsed and open.
1259
+ - On the phone, choosing **Tree trunk** shows the hint at the top of the free area, beside the fullscreen button.
1260
+ - 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.
1261
+ - **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.
1262
+ - 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.
1263
+ - 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.
1264
+ - 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.
561
1265
 
562
1266
  ## Known gaps
563
1267
 
564
1268
  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.
565
1269
 
566
- - **Phone width.** The panel is written for desktop: on a narrow screen it covers the scene. A phone layout puts the panel in a bottom sheet and moves the safe area above it.
567
- - **Messages that stay snackbars.** The toast shows violations, side effects and errors. 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.
568
- - **Finalize actions from the spec.** The review step here is the layout's own and submits nothing. It does not offer the spec's `finalizeAction` components and does not check `phx.frontend.useFinalizeViolations()`; [Configurator Interface → Hooks for a Project Layout](?path=/docs/phoenix-configurator-interface--docs#hooks-for-a-project-layout) describes both, and [Finalization](?path=/docs/phoenix-finalization--docs) covers what a real flow does.
569
- - **Toolbar actions.** Undo and redo, camera reset, 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.
570
- - **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 they do not appear.
1270
+ - **Messages that stay snackbars.** The toast shows violations, side effects, errors and failed saves, and the finalize button shows its own error. Two kinds of message stay snackbars. An error of a built-in action, such as one from `LayoutSlots.DesktopToolbar`, renders into `LayoutSlots.DesktopSnackbarsRoot`; this layout mounts neither, and a layout that mounts such an action mounts the root too, or the snackbar appears outside the configurator. A failure to start from a preset appears on the preset screen, before this layout mounts; a project replaces that screen with `phx.frontend.createPresetUi`, see [Configurator Interface → Preset UI](?path=/docs/phoenix-configurator-interface--docs#preset-ui).
1271
+ - **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; for undo and redo, `phx.frontend.useUndoRedo()` gives `canUndo`, `canRedo`, `undo` and `redo`, and pushes the same analytics events as the built-in buttons.
1272
+ - **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.
571
1273
  - **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`.
572
1274
  - **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.
573
1275
  - **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`.
574
1276
  - **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.
575
- - **Analytics.** The built-in fullscreen and finalize buttons record `FullScreenModeToggled` and `FinalizeButtonClicked`; this layout's 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
+ - **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(...)`.
576
1278
  - **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.
577
1279
  - **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.
578
1280
  - **"Powered by Salsita" mark.** The built-in layout shows it; a project layout decides whether to mount `LayoutSlots.DesktopPoweredBy`, and this one does not.
@@ -624,6 +1326,11 @@ presets:
624
1326
  navigationStates:
625
1327
  - configure
626
1328
  - checkout
1329
+ - requested
1330
+
1331
+ viewStates:
1332
+ - overview
1333
+ - edge
627
1334
 
628
1335
  components:
629
1336
  Table:
@@ -653,9 +1360,25 @@ components:
653
1360
  - label: Tree trunk
654
1361
  description: The natural edge
655
1362
  value: TreeTrunk
1363
+ finalizeAction:
1364
+ quote:
1365
+ variant: primary
1366
+ label: Request a quote
1367
+ title: Send the configuration to the shop for a quote
1368
+ icon: PaperPlaneTilt
1369
+ handler: requestQuote
1370
+ htmlHotspot:
1371
+ edgeFinish:
1372
+ name: EdgeFinishHotspot
1373
+ offsetX: 500
1374
+ offsetY: 800
1375
+ offsetZ: 0
1376
+ $filter:
1377
+ modes: [owner]
1378
+ navigationStates: [configure]
656
1379
  fitRootPerspectiveCamera:
657
1380
  main:
658
- priority: 1
1381
+ priority: 2
659
1382
  fov: 35
660
1383
  near: 100
661
1384
  far: 10000
@@ -665,6 +1388,49 @@ components:
665
1388
  azimuthAngle: 1.5
666
1389
  polarAngle: 1.1
667
1390
  fitMeshChanges: true
1391
+ $filter:
1392
+ viewports: [desktop]
1393
+ phone:
1394
+ priority: 1
1395
+ fov: 35
1396
+ near: 100
1397
+ far: 10000
1398
+ minDistance: 1000
1399
+ maxDistance: 12000
1400
+ distance: 8000
1401
+ azimuthAngle: 1.5
1402
+ polarAngle: 1.1
1403
+ fitMeshChanges: true
1404
+ $filter:
1405
+ viewports: [mobile]
1406
+ edge:
1407
+ priority: 4
1408
+ fov: 35
1409
+ near: 100
1410
+ far: 10000
1411
+ minDistance: 800
1412
+ maxDistance: 9000
1413
+ distance: 2000
1414
+ azimuthAngle: 0.5
1415
+ polarAngle: 1.15
1416
+ fitMeshChanges: true
1417
+ $filter:
1418
+ viewports: [desktop]
1419
+ viewStates: [edge]
1420
+ edgePhone:
1421
+ priority: 3
1422
+ fov: 35
1423
+ near: 100
1424
+ far: 10000
1425
+ minDistance: 800
1426
+ maxDistance: 12000
1427
+ distance: 3000
1428
+ azimuthAngle: 0.5
1429
+ polarAngle: 1.15
1430
+ fitMeshChanges: true
1431
+ $filter:
1432
+ viewports: [mobile]
1433
+ viewStates: [edge]
668
1434
  sceneEntityRemoteObject:
669
1435
  top:
670
1436
  fileUrl: /models/tables.gltf
@@ -712,6 +1478,170 @@ transformers:
712
1478
  - name: tree-trunk-delivery
713
1479
  ```
714
1480
 
1481
+ ### ./src/\_shared/BottomSheet.tsx
1482
+
1483
+ ```tsx
1484
+ import { Box, ButtonBase } from '@mui/material'
1485
+ import { type MouseEvent, type PointerEvent, type ReactNode, useRef } from 'react'
1486
+
1487
+ // A drag shorter than this is a tap, and the handle's click toggles the sheet
1488
+ const TAP_DISTANCE = 6
1489
+ // A drag that ends this far from where it started snaps to the other position
1490
+ const SNAP_DISTANCE = 48
1491
+ // A drag faster than this, in pixels per millisecond, snaps in its direction even when it is short
1492
+ const SNAP_VELOCITY = 0.5
1493
+ // How far the sheet follows the finger towards the position it is already in
1494
+ const OVERDRAG = 0.25
1495
+
1496
+ interface BottomSheetProps {
1497
+ readonly open: boolean
1498
+ readonly onOpenChange: (open: boolean) => void
1499
+ readonly label: string
1500
+ readonly children: ReactNode
1501
+ }
1502
+
1503
+ interface Drag {
1504
+ readonly startY: number
1505
+ readonly startTime: number
1506
+ delta: number
1507
+ }
1508
+
1509
+ // A persistent sheet at the bottom of the layout with two positions, open and collapsed. It is not a modal: the scene
1510
+ // above it stays interactive. Its height comes from its content, so the layout's safe area ends where the sheet
1511
+ // starts and changes only when the sheet snaps. While the handle is dragged the sheet follows the finger with a
1512
+ // transform, which the safe area does not see, so the camera refits once per snap and not on every move.
1513
+ export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheetProps) => {
1514
+ const sheetRef = useRef<HTMLElement>(null)
1515
+ const dragRef = useRef<Drag | null>(null)
1516
+ const draggedRef = useRef(false)
1517
+
1518
+ const moveSheet = (offset: number, animate: boolean) => {
1519
+ if (sheetRef.current) {
1520
+ sheetRef.current.style.transition = animate ? 'transform 200ms ease-out' : 'none'
1521
+ sheetRef.current.style.transform = offset === 0 ? '' : `translateY(${offset}px)`
1522
+ }
1523
+ }
1524
+
1525
+ const handlePointerDown = (event: PointerEvent<HTMLButtonElement>) => {
1526
+ event.currentTarget.setPointerCapture(event.pointerId)
1527
+ dragRef.current = { startY: event.clientY, startTime: event.timeStamp, delta: 0 }
1528
+ draggedRef.current = false
1529
+ }
1530
+
1531
+ const handlePointerMove = (event: PointerEvent<HTMLButtonElement>) => {
1532
+ const drag = dragRef.current
1533
+
1534
+ if (drag === null) {
1535
+ return
1536
+ }
1537
+
1538
+ drag.delta = event.clientY - drag.startY
1539
+ // Down closes an open sheet and up opens a collapsed one; the other direction only gives a little
1540
+ const towardsOther = open ? drag.delta > 0 : drag.delta < 0
1541
+ moveSheet(towardsOther ? drag.delta : drag.delta * OVERDRAG, false)
1542
+ }
1543
+
1544
+ const handlePointerEnd = (event: PointerEvent<HTMLButtonElement>) => {
1545
+ const drag = dragRef.current
1546
+ dragRef.current = null
1547
+
1548
+ if (drag === null) {
1549
+ return
1550
+ }
1551
+
1552
+ moveSheet(0, true)
1553
+
1554
+ if (Math.abs(drag.delta) < TAP_DISTANCE) {
1555
+ return
1556
+ }
1557
+
1558
+ draggedRef.current = true
1559
+ const velocity = drag.delta / Math.max(event.timeStamp - drag.startTime, 1)
1560
+ const flicked = Math.abs(drag.delta) >= SNAP_DISTANCE || Math.abs(velocity) >= SNAP_VELOCITY
1561
+
1562
+ if (flicked && (open ? drag.delta > 0 : drag.delta < 0)) {
1563
+ onOpenChange(!open)
1564
+ }
1565
+ }
1566
+
1567
+ // A tap, Enter or Space toggles the sheet. The pointer click that ends a drag has already been handled; a keyboard
1568
+ // click (`detail` 0) always toggles, also after a touch drag that was followed by no click.
1569
+ const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
1570
+ const dragged = draggedRef.current
1571
+ draggedRef.current = false
1572
+
1573
+ if (dragged && event.detail !== 0) {
1574
+ return
1575
+ }
1576
+
1577
+ onOpenChange(!open)
1578
+ }
1579
+
1580
+ return (
1581
+ <Box
1582
+ component="section"
1583
+ ref={sheetRef}
1584
+ aria-label={label}
1585
+ sx={{
1586
+ position: 'relative',
1587
+ flexShrink: 0,
1588
+ display: 'flex',
1589
+ flexDirection: 'column',
1590
+ maxBlockSize: '55%',
1591
+ paddingBlockEnd: 'env(safe-area-inset-bottom)',
1592
+ borderStartStartRadius: 20,
1593
+ borderStartEndRadius: 20,
1594
+ bgcolor: 'background.paper',
1595
+ boxShadow: '0 -8px 32px rgba(0, 0, 0, 0.12)',
1596
+ // Fills the gap below the sheet while it is dragged up
1597
+ '&::after': {
1598
+ content: '""',
1599
+ position: 'absolute',
1600
+ insetInline: 0,
1601
+ insetBlockStart: '100%',
1602
+ blockSize: '100vh',
1603
+ bgcolor: 'background.paper',
1604
+ },
1605
+ }}
1606
+ >
1607
+ <ButtonBase
1608
+ aria-expanded={open}
1609
+ disableRipple
1610
+ aria-label={open ? `Collapse ${label.toLowerCase()}` : `Expand ${label.toLowerCase()}`}
1611
+ onClick={handleClick}
1612
+ onPointerDown={handlePointerDown}
1613
+ onPointerMove={handlePointerMove}
1614
+ onPointerUp={handlePointerEnd}
1615
+ onPointerCancel={handlePointerEnd}
1616
+ sx={{
1617
+ flexShrink: 0,
1618
+ blockSize: 36,
1619
+ touchAction: 'none',
1620
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: -4, borderRadius: 3 },
1621
+ }}
1622
+ >
1623
+ <Box component="span" sx={{ inlineSize: 40, blockSize: 4, borderRadius: 2, bgcolor: 'text.disabled' }} />
1624
+ </ButtonBase>
1625
+ {/* A column, so the panel's cards region shrinks first and the price and action stay in view; below the cards
1626
+ region's minimum height the content scrolls as a whole, as the review step does on a short phone */}
1627
+ <Box
1628
+ component="div"
1629
+ sx={{
1630
+ display: 'flex',
1631
+ flexDirection: 'column',
1632
+ flex: '1 1 auto',
1633
+ minBlockSize: 0,
1634
+ overflowY: 'auto',
1635
+ overscrollBehavior: 'contain',
1636
+ }}
1637
+ >
1638
+ {children}
1639
+ </Box>
1640
+ </Box>
1641
+ )
1642
+ }
1643
+ ```
1644
+
715
1645
  ### ./src/\_shared/EdgeFinishCards.tsx
716
1646
 
717
1647
  ```tsx
@@ -850,39 +1780,50 @@ export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
850
1780
  ### ./src/\_shared/FullscreenToggle.tsx
851
1781
 
852
1782
  ```tsx
853
- import { Button } from '@mui/material'
1783
+ import { Button, Tooltip } from '@mui/material'
854
1784
 
855
1785
  import { phx } from '../../.phoenix/phx.js'
856
1786
 
857
1787
  const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
858
1788
  const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
859
1789
 
860
- export const FullscreenToggle = () => {
1790
+ interface FullscreenToggleProps {
1791
+ // Only the icon, with the label as its accessible name and tooltip, where a label would cover the product
1792
+ readonly compact?: boolean
1793
+ }
1794
+
1795
+ export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
861
1796
  const isFullscreen = phx.frontend.useIsFullscreenActive()
862
1797
  const setFullscreen = phx.frontend.useSetFullscreen()
1798
+ const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
1799
+ const icon = (
1800
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
1801
+ <path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
1802
+ </svg>
1803
+ )
863
1804
 
864
1805
  return (
865
- <Button
866
- onClick={() => setFullscreen(!isFullscreen)}
867
- startIcon={
868
- <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
869
- <path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
870
- </svg>
871
- }
872
- sx={{
873
- minBlockSize: 44,
874
- paddingInline: 2.5,
875
- borderRadius: 999,
876
- bgcolor: 'background.paper',
877
- color: 'text.primary',
878
- boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
879
- textTransform: 'none',
880
- fontWeight: 600,
881
- '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
882
- }}
883
- >
884
- {isFullscreen ? 'Exit fullscreen' : 'Fullscreen'}
885
- </Button>
1806
+ <Tooltip title={compact ? label : ''}>
1807
+ <Button
1808
+ onClick={() => setFullscreen(!isFullscreen)}
1809
+ aria-label={compact ? label : undefined}
1810
+ startIcon={compact ? undefined : icon}
1811
+ sx={{
1812
+ minBlockSize: 44,
1813
+ minInlineSize: 44,
1814
+ paddingInline: compact ? 0 : 2.5,
1815
+ borderRadius: 999,
1816
+ bgcolor: 'background.paper',
1817
+ color: 'text.primary',
1818
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
1819
+ textTransform: 'none',
1820
+ fontWeight: 600,
1821
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
1822
+ }}
1823
+ >
1824
+ {compact ? icon : label}
1825
+ </Button>
1826
+ </Tooltip>
886
1827
  )
887
1828
  }
888
1829
  ```
@@ -906,7 +1847,7 @@ const severityOf = (message: ConfiguratorMessage) => {
906
1847
  return VIOLATION_SEVERITY[message.violation.severity]
907
1848
  }
908
1849
 
909
- return message.kind === 'error' ? 'error' : 'info'
1850
+ return message.kind === 'error' || message.kind === 'saveError' ? 'error' : 'info'
910
1851
  }
911
1852
 
912
1853
  export const MessageToast = () => {
@@ -948,13 +1889,23 @@ export const MessageToast = () => {
948
1889
  ```tsx
949
1890
  import { Box, Button, Typography } from '@mui/material'
950
1891
 
951
- import { detailComponent } from '@salsita-ai/sdk/domain'
952
- import { useResolveLocalizable } from '@salsita-ai/sdk/react'
1892
+ import { detailComponent, finalizeActionComponent } from '@salsita-ai/sdk/domain'
1893
+ import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
953
1894
 
954
1895
  import { phx } from '../../.phoenix/phx.js'
955
1896
  import { EdgeFinishCards } from './EdgeFinishCards.js'
1897
+ import { ReviewActions } from './ReviewActions.js'
956
1898
 
957
- export const ProductPanel = () => {
1899
+ const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
1900
+
1901
+ interface ProductPanelProps {
1902
+ // Only the name, the price and the action, for a collapsed bottom sheet
1903
+ readonly collapsed?: boolean
1904
+ // In a bottom sheet the cards region keeps the top of the cards in view, and the sheet scrolls when that does not fit
1905
+ readonly inSheet?: boolean
1906
+ }
1907
+
1908
+ export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
958
1909
  const resolve = useResolveLocalizable()
959
1910
  const detail = phx.frontend.useFirstRootComponent(detailComponent)
960
1911
  const price = phx.frontend.useRootEntityPrice()
@@ -964,9 +1915,13 @@ export const ProductPanel = () => {
964
1915
  const navigationState = phx.frontend.useActiveNavigationState()
965
1916
  const pushNavigate = phx.frontend.usePushNavigate()
966
1917
  const popNavigate = phx.frontend.usePopNavigate()
1918
+ const navigate = phx.frontend.useNavigate()
1919
+ const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
967
1920
 
968
1921
  const isReadMode = accessInfo.viewMode
969
- const isReview = isReadMode || navigationState === 'checkout'
1922
+ const isReview = isReadMode || navigationState !== 'configure'
1923
+ // The spec's primary finalize action, or its first one
1924
+ const quoteAction = finalizeActions.find(action => action.state.variant === 'primary') ?? finalizeActions[0]
970
1925
  const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
971
1926
 
972
1927
  return (
@@ -987,29 +1942,44 @@ export const ProductPanel = () => {
987
1942
  <Typography variant="h5" component="h2" fontWeight={700}>
988
1943
  {resolve(detail?.state.title)}
989
1944
  </Typography>
990
- <Typography variant="body2" color="text.secondary">
991
- {resolve(detail?.state.description)}
992
- </Typography>
993
- </Box>
994
-
995
- <Box component="div" sx={{ display: 'grid', gap: 1.5, paddingInline: 3, paddingBlockEnd: 3, overflowY: 'auto' }}>
996
- <Typography variant="subtitle2" component="h3">
997
- Edge finish
998
- </Typography>
999
- {isReview ? (
1000
- <Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
1001
- <Typography variant="body2" fontWeight={600}>
1002
- {resolve(chosenEdge?.title)}
1003
- </Typography>
1004
- <Typography variant="caption" color="text.secondary">
1005
- {resolve(chosenEdge?.description)}
1006
- </Typography>
1007
- </Box>
1008
- ) : (
1009
- <EdgeFinishCards selection={edgeFinish} />
1945
+ {!collapsed && (
1946
+ <Typography variant="body2" color="text.secondary">
1947
+ {resolve(detail?.state.description)}
1948
+ </Typography>
1010
1949
  )}
1011
1950
  </Box>
1012
1951
 
1952
+ {!collapsed && (
1953
+ <Box
1954
+ component="div"
1955
+ sx={{
1956
+ display: 'grid',
1957
+ gap: 1.5,
1958
+ paddingInline: 3,
1959
+ paddingBlockEnd: 3,
1960
+ // In a short container the region shrinks and scrolls; a scroll past its end moves its container on
1961
+ minBlockSize: inSheet ? 120 : 0,
1962
+ overflowY: 'auto',
1963
+ }}
1964
+ >
1965
+ <Typography variant="subtitle2" component="h3">
1966
+ Edge finish
1967
+ </Typography>
1968
+ {isReview ? (
1969
+ <Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
1970
+ <Typography variant="body2" fontWeight={600}>
1971
+ {resolve(chosenEdge?.title)}
1972
+ </Typography>
1973
+ <Typography variant="caption" color="text.secondary">
1974
+ {resolve(chosenEdge?.description)}
1975
+ </Typography>
1976
+ </Box>
1977
+ ) : (
1978
+ <EdgeFinishCards selection={edgeFinish} />
1979
+ )}
1980
+ </Box>
1981
+ )}
1982
+
1013
1983
  <Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
1014
1984
  <Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
1015
1985
  <Typography variant="body2" color="text.secondary">
@@ -1019,51 +1989,235 @@ export const ProductPanel = () => {
1019
1989
  {price}
1020
1990
  </Typography>
1021
1991
  </Box>
1022
- {isReview && !isReadMode && (
1023
- <Typography variant="body2" color="text.secondary">
1024
- Your table is ready for a quote. A real shop collects the contact details here.
1025
- </Typography>
1026
- )}
1027
- {!isReadMode && (
1028
- <Button
1029
- size="large"
1030
- variant={isReview ? 'outlined' : 'contained'}
1031
- onClick={isReview ? popNavigate : () => pushNavigate('checkout')}
1032
- sx={{ minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 }}
1033
- >
1034
- {isReview ? 'Back to the configuration' : 'Review and request a quote'}
1992
+ {!isReadMode && navigationState === 'configure' && (
1993
+ <Button size="large" variant="contained" onClick={() => pushNavigate('checkout')} sx={BUTTON_SX}>
1994
+ Review and request a quote
1035
1995
  </Button>
1036
1996
  )}
1997
+ {!isReadMode && navigationState === 'checkout' && (
1998
+ <>
1999
+ <Typography variant="body2" color="text.secondary">
2000
+ Your table is ready for a quote. A real shop collects the contact details here.
2001
+ </Typography>
2002
+ {quoteAction ? (
2003
+ <PhoenixHandlerBoundary name={quoteAction.state.handler}>
2004
+ <ReviewActions
2005
+ handler={quoteAction.state.handler}
2006
+ label={resolve(quoteAction.state.label)}
2007
+ onBack={popNavigate}
2008
+ />
2009
+ </PhoenixHandlerBoundary>
2010
+ ) : (
2011
+ <Button size="large" variant="outlined" onClick={popNavigate} sx={BUTTON_SX}>
2012
+ Back to the configuration
2013
+ </Button>
2014
+ )}
2015
+ </>
2016
+ )}
2017
+ {!isReadMode && navigationState === 'requested' && (
2018
+ <>
2019
+ <Typography variant="body2" role="status">
2020
+ Thank you. Your quote request is on its way, and the shop replies within two working days.
2021
+ </Typography>
2022
+ <Button size="large" variant="outlined" onClick={() => navigate('configure')} sx={BUTTON_SX}>
2023
+ Back to the configuration
2024
+ </Button>
2025
+ </>
2026
+ )}
1037
2027
  </Box>
1038
2028
  </>
1039
2029
  )
1040
2030
  }
1041
2031
  ```
1042
2032
 
2033
+ ### ./src/\_shared/ReviewActions.tsx
2034
+
2035
+ ```tsx
2036
+ import { Alert, Box, Button, CircularProgress, Typography } from '@mui/material'
2037
+
2038
+ import { phx } from '../../.phoenix/phx.js'
2039
+
2040
+ const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
2041
+
2042
+ interface ReviewActionsProps {
2043
+ readonly handler: string
2044
+ readonly label: string
2045
+ readonly onBack: () => void
2046
+ }
2047
+
2048
+ // The review step's buttons: one finalize action and the way back. `useFinalizeAction` runs the action's handler,
2049
+ // so this component calls it exactly once and is rendered inside a `PhoenixHandlerBoundary` for that handler.
2050
+ // Back is disabled while the request is pending, so the customer cannot change the configuration while it is sent.
2051
+ // The pending state belongs to this component: when the panel unmounts, as in fullscreen, the request goes on and
2052
+ // the remounted buttons are enabled again.
2053
+ export const ReviewActions = ({ handler, label, onBack }: ReviewActionsProps) => {
2054
+ const { run, isPending, error, disabled, hints } = phx.frontend.useFinalizeAction(handler)
2055
+
2056
+ return (
2057
+ <Box component="div" sx={{ display: 'grid', gap: 2 }}>
2058
+ <Box component="div" sx={{ display: 'grid', gap: 1 }}>
2059
+ <Button
2060
+ size="large"
2061
+ variant="contained"
2062
+ disabled={disabled || isPending}
2063
+ onClick={run}
2064
+ startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
2065
+ sx={BUTTON_SX}
2066
+ >
2067
+ {isPending ? 'Sending the request…' : label}
2068
+ </Button>
2069
+ {disabled && hints && (
2070
+ <Typography variant="caption" color="text.secondary">
2071
+ {hints}
2072
+ </Typography>
2073
+ )}
2074
+ {error && <Alert severity="error">The request could not be sent: {error.message}</Alert>}
2075
+ </Box>
2076
+ <Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
2077
+ Back to the configuration
2078
+ </Button>
2079
+ </Box>
2080
+ )
2081
+ }
2082
+ ```
2083
+
2084
+ ### ./src/\_shared/SceneControls.tsx
2085
+
2086
+ ```tsx
2087
+ import { Box, Button, Tooltip } from '@mui/material'
2088
+
2089
+ import { phx } from '../../.phoenix/phx.js'
2090
+
2091
+ // The spec's view states, each with the label of the button that shows it
2092
+ const VIEWS = [
2093
+ { state: 'overview', label: 'Whole table' },
2094
+ { state: 'edge', label: 'Edge close-up' },
2095
+ ] as const
2096
+
2097
+ const RESET_ICON = 'M4 12a8 8 0 1 0 2.4-5.7M4 4v4h4'
2098
+
2099
+ const SURFACE_SX = {
2100
+ borderRadius: 999,
2101
+ bgcolor: 'background.paper',
2102
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
2103
+ } as const
2104
+
2105
+ const BUTTON_SX = {
2106
+ minBlockSize: 44,
2107
+ minInlineSize: 44,
2108
+ borderRadius: 999,
2109
+ textTransform: 'none',
2110
+ fontWeight: 600,
2111
+ whiteSpace: 'nowrap',
2112
+ } as const
2113
+
2114
+ interface SceneControlsProps {
2115
+ // The reset button shows only its icon, with its label as tooltip and accessible name
2116
+ readonly compact?: boolean
2117
+ // Only the reset button, without the view buttons
2118
+ readonly resetOnly?: boolean
2119
+ }
2120
+
2121
+ // The layout's own camera controls: one button per view state of the spec, and a reset that undoes an orbit
2122
+ export const SceneControls = ({ compact = false, resetOnly = false }: SceneControlsProps) => {
2123
+ const activeView = phx.frontend.useActiveViewState()
2124
+ const setViewState = phx.frontend.useSetViewState()
2125
+ const resetCamera = phx.frontend.useResetCamera()
2126
+ const resetIcon = (
2127
+ <svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
2128
+ <path d={RESET_ICON} />
2129
+ </svg>
2130
+ )
2131
+
2132
+ return (
2133
+ <Box component="div" sx={{ display: 'flex', gap: 1 }}>
2134
+ {!resetOnly && (
2135
+ <Box component="div" role="group" aria-label="View" sx={{ ...SURFACE_SX, display: 'flex' }}>
2136
+ {VIEWS.map(view => {
2137
+ const isActive = activeView === view.state
2138
+
2139
+ return (
2140
+ <Button
2141
+ key={view.state}
2142
+ aria-pressed={isActive}
2143
+ onClick={() => setViewState(view.state)}
2144
+ sx={{
2145
+ ...BUTTON_SX,
2146
+ paddingInline: 2,
2147
+ bgcolor: isActive ? 'text.primary' : 'transparent',
2148
+ color: isActive ? 'background.paper' : 'text.primary',
2149
+ '&:hover': { bgcolor: isActive ? 'text.primary' : 'action.hover' },
2150
+ }}
2151
+ >
2152
+ {view.label}
2153
+ </Button>
2154
+ )
2155
+ })}
2156
+ </Box>
2157
+ )}
2158
+ <Tooltip title={compact ? 'Reset view' : ''}>
2159
+ <Button
2160
+ onClick={resetCamera}
2161
+ aria-label={compact ? 'Reset view' : undefined}
2162
+ startIcon={compact ? undefined : resetIcon}
2163
+ sx={{
2164
+ ...SURFACE_SX,
2165
+ ...BUTTON_SX,
2166
+ paddingInline: compact ? 0 : 2,
2167
+ color: 'text.primary',
2168
+ '&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
2169
+ }}
2170
+ >
2171
+ {compact ? resetIcon : 'Reset view'}
2172
+ </Button>
2173
+ </Tooltip>
2174
+ </Box>
2175
+ )
2176
+ }
2177
+ ```
2178
+
1043
2179
  ### ./src/elements/ConfiguratorLayout.tsx
1044
2180
 
1045
2181
  ```tsx
1046
2182
  import { Box } from '@mui/material'
2183
+ import { useState } from 'react'
1047
2184
 
1048
2185
  import { LayoutSlots, useSceneSafeArea } from '@salsita-ai/sdk/configurator'
2186
+ import { useActiveViewports } from '@salsita-ai/sdk/react'
1049
2187
 
1050
2188
  import { phx } from '../../.phoenix/phx.js'
2189
+ import { BottomSheet } from '../_shared/BottomSheet.js'
1051
2190
  import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
1052
2191
  import { MessageToast } from '../_shared/MessageToast.js'
1053
2192
  import { ProductPanel } from '../_shared/ProductPanel.js'
2193
+ import { SceneControls } from '../_shared/SceneControls.js'
1054
2194
 
1055
2195
  const GUTTER = 24
1056
2196
  const PANEL_WIDTH = 380
2197
+ const PHONE_GUTTER = 16
2198
+ const TOUCH_TARGET = 44
1057
2199
 
1058
2200
  const ConfiguratorLayout = () => {
1059
2201
  const { containerRef, safeAreaRef } = useSceneSafeArea()
1060
2202
  const isFullscreen = phx.frontend.useIsFullscreenActive()
2203
+ // `null` until the container has been measured; the layout shows only the scene until then
2204
+ const viewports = useActiveViewports()
2205
+ const [isSheetOpen, setSheetOpen] = useState(false)
2206
+
2207
+ const isDesktop = viewports?.includes('desktop') ?? false
2208
+ const gutter = isDesktop ? GUTTER : PHONE_GUTTER
1061
2209
 
1062
2210
  return (
1063
- <Box component="div" ref={containerRef} sx={{ position: 'absolute', inset: 0 }}>
2211
+ <Box
2212
+ component="div"
2213
+ ref={containerRef}
2214
+ // `clip`, not `hidden`: what overflows, such as the sheet's fill below its edge, can never be scrolled into view,
2215
+ // not even by the browser when the focus moves
2216
+ sx={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', overflow: 'clip' }}
2217
+ >
1064
2218
  <LayoutSlots.SharedCanvas />
1065
2219
 
1066
- {!isFullscreen && (
2220
+ {viewports !== null && isDesktop && !isFullscreen && (
1067
2221
  <Box
1068
2222
  component="aside"
1069
2223
  sx={{
@@ -1077,37 +2231,72 @@ const ConfiguratorLayout = () => {
1077
2231
  borderRadius: 5,
1078
2232
  bgcolor: 'background.paper',
1079
2233
  boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
1080
- overflow: 'hidden',
2234
+ // A very short container, such as a phone held sideways, scrolls the panel instead of clipping its footer
2235
+ overflowX: 'hidden',
2236
+ overflowY: 'auto',
2237
+ overscrollBehavior: 'contain',
1081
2238
  }}
1082
2239
  >
1083
2240
  <ProductPanel />
1084
2241
  </Box>
1085
2242
  )}
1086
2243
 
1087
- <Box
1088
- component="div"
1089
- ref={safeAreaRef}
1090
- sx={{
1091
- position: 'absolute',
1092
- insetBlock: 0,
1093
- insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
1094
- insetInlineEnd: 0,
1095
- pointerEvents: 'none',
1096
- }}
1097
- >
1098
- <Box
1099
- component="div"
1100
- sx={{ position: 'absolute', insetBlockStart: GUTTER, insetInlineEnd: GUTTER, pointerEvents: 'auto' }}
1101
- >
1102
- <FullscreenToggle />
1103
- </Box>
2244
+ {viewports !== null && (
1104
2245
  <Box
1105
2246
  component="div"
1106
- sx={{ position: 'absolute', insetBlockEnd: GUTTER, insetInlineStart: GUTTER, pointerEvents: 'auto' }}
2247
+ ref={safeAreaRef}
2248
+ sx={{
2249
+ // Desktop: right of the panel. Phone: above the sheet, whose height the column gives the rest.
2250
+ ...(isDesktop
2251
+ ? {
2252
+ position: 'absolute',
2253
+ insetBlock: 0,
2254
+ insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
2255
+ insetInlineEnd: 0,
2256
+ }
2257
+ : { position: 'relative', flex: '1 1 0', minBlockSize: 0 }),
2258
+ pointerEvents: 'none',
2259
+ }}
1107
2260
  >
1108
- <MessageToast />
2261
+ <Box
2262
+ component="div"
2263
+ sx={{ position: 'absolute', insetBlockStart: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
2264
+ >
2265
+ <FullscreenToggle compact={!isDesktop} />
2266
+ </Box>
2267
+ <Box
2268
+ component="div"
2269
+ sx={{
2270
+ position: 'absolute',
2271
+ pointerEvents: 'auto',
2272
+ // Desktop: bottom left, above the row of view controls. Phone: at the top beside the fullscreen button,
2273
+ // clear of the sheet's handle and the view controls.
2274
+ ...(isDesktop
2275
+ ? { insetBlockEnd: 2 * GUTTER + TOUCH_TARGET, insetInlineStart: GUTTER }
2276
+ : { insetBlockStart: gutter, insetInline: `${gutter}px ${2 * gutter + TOUCH_TARGET}px` }),
2277
+ }}
2278
+ >
2279
+ <MessageToast />
2280
+ </Box>
2281
+ {/* A phone in fullscreen keeps only the reset, as the built-in layout does. Below 1024 pixels (`tablet`) the
2282
+ free area beside the panel is narrow, so the reset shows only its icon there too. */}
2283
+ <Box
2284
+ component="div"
2285
+ sx={{ position: 'absolute', insetBlockEnd: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
2286
+ >
2287
+ <SceneControls
2288
+ compact={!isDesktop || (viewports?.includes('tablet') ?? false)}
2289
+ resetOnly={!isDesktop && isFullscreen}
2290
+ />
2291
+ </Box>
1109
2292
  </Box>
1110
- </Box>
2293
+ )}
2294
+
2295
+ {viewports !== null && !isDesktop && !isFullscreen && (
2296
+ <BottomSheet open={isSheetOpen} onOpenChange={setSheetOpen} label="Product details">
2297
+ <ProductPanel collapsed={!isSheetOpen} inSheet />
2298
+ </BottomSheet>
2299
+ )}
1111
2300
  </Box>
1112
2301
  )
1113
2302
  }
@@ -1115,6 +2304,68 @@ const ConfiguratorLayout = () => {
1115
2304
  export default phx.frontend.createCustomPhoenixLayoutElement('ConfiguratorLayout', ConfiguratorLayout)
1116
2305
  ```
1117
2306
 
2307
+ ### ./src/elements/EdgeFinishHotspot.tsx
2308
+
2309
+ ```tsx
2310
+ import { Box, ButtonBase, Popover, Tooltip } from '@mui/material'
2311
+ import { useState } from 'react'
2312
+
2313
+ import { phx } from '../../.phoenix/phx.js'
2314
+ import { EdgeFinishCards } from '../_shared/EdgeFinishCards.js'
2315
+
2316
+ // The edge profile the button shows, the square edge of the cards' drawings
2317
+ const EDGE_ICON = 'M3 7H17L21 11V13L17 17H3Z'
2318
+
2319
+ // Rendered by the spec's `htmlHotspot` on the table's edge: a button on the product that opens the edge finishes
2320
+ // next to the edge, with the same cards as the panel. The spec's `$filter` decides when it is shown.
2321
+ export default phx.frontend.createCustomPhoenixEntityElement('EdgeFinishHotspot', ({ entityId }) => {
2322
+ const edgeFinish = phx.frontend.useAttributeSelection(entityId, 'edgeFinish')
2323
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null)
2324
+
2325
+ return (
2326
+ <>
2327
+ <Tooltip title="Edge finish">
2328
+ <ButtonBase
2329
+ aria-label="Edge finish"
2330
+ aria-haspopup="dialog"
2331
+ aria-expanded={anchor !== null}
2332
+ onClick={event => setAnchor(event.currentTarget)}
2333
+ sx={{
2334
+ display: 'grid',
2335
+ placeItems: 'center',
2336
+ inlineSize: 44,
2337
+ blockSize: 44,
2338
+ borderRadius: '50%',
2339
+ bgcolor: 'background.paper',
2340
+ color: 'primary.main',
2341
+ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
2342
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
2343
+ }}
2344
+ >
2345
+ <svg viewBox="0 0 24 24" width={22} height={22} aria-hidden>
2346
+ <path d={EDGE_ICON} fill="currentColor" />
2347
+ </svg>
2348
+ </ButtonBase>
2349
+ </Tooltip>
2350
+ <Popover
2351
+ open={anchor !== null}
2352
+ anchorEl={anchor}
2353
+ onClose={() => setAnchor(null)}
2354
+ anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
2355
+ transformOrigin={{ vertical: 'bottom', horizontal: 'center' }}
2356
+ slotProps={{
2357
+ paper: { role: 'dialog', 'aria-label': 'Edge finish', sx: { borderRadius: 4, marginBlockStart: -1 } },
2358
+ }}
2359
+ >
2360
+ <Box component="div" sx={{ inlineSize: 340, maxInlineSize: 'calc(100vw - 32px)', padding: 2 }}>
2361
+ <EdgeFinishCards selection={edgeFinish} />
2362
+ </Box>
2363
+ </Popover>
2364
+ </>
2365
+ )
2366
+ })
2367
+ ```
2368
+
1118
2369
  ### ./src/expressions/table.ts
1119
2370
 
1120
2371
  ```ts
@@ -1140,6 +2391,26 @@ export default phx.domain.implementCustomExpressions({
1140
2391
  })
1141
2392
  ```
1142
2393
 
2394
+ ### ./src/handlers/request-quote.ts
2395
+
2396
+ ```ts
2397
+ import { useCallback } from 'react'
2398
+
2399
+ import { phx } from '../../.phoenix/phx.js'
2400
+
2401
+ // Stands in for the shop's quote service: the request takes a moment, then the panel shows the confirmation
2402
+ export default phx.frontend.createPhoenixHandler('requestQuote', () => {
2403
+ const navigate = phx.frontend.useNavigate()
2404
+
2405
+ return {
2406
+ handler: useCallback(async () => {
2407
+ await new Promise(resolve => setTimeout(resolve, 1500))
2408
+ navigate('requested')
2409
+ }, [navigate]),
2410
+ }
2411
+ })
2412
+ ```
2413
+
1143
2414
  ### ./src/transformers/tree-trunk-delivery.ts
1144
2415
 
1145
2416
  ```ts