@salsita-ai/sdk 0.50.0-develop.abef6d86a1 → 0.50.0-develop.ae9a830ef0

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 (410) hide show
  1. package/README.md +2 -2
  2. package/dist/application-spec/core/components/component-filter.d.ts +53 -0
  3. package/dist/application-spec/core/components/component-filter.js +1 -0
  4. package/dist/application-spec/core/components/index.d.ts +2 -0
  5. package/dist/application-spec/core/components/index.js +1 -0
  6. package/dist/application-spec/core/components/sdk-code-ref.d.ts +9 -0
  7. package/dist/application-spec/core/components/sdk-code-ref.js +1 -0
  8. package/dist/application-spec/core/enhanced-json-value.d.ts +0 -68
  9. package/dist/application-spec/core/enhanced-json-value.js +1 -1
  10. package/dist/application-spec/core/expressions/index.d.ts +2 -0
  11. package/dist/application-spec/core/expressions/index.js +1 -0
  12. package/dist/application-spec/core/expressions/relation-expression-params.d.ts +11 -0
  13. package/dist/application-spec/core/expressions/sdk-expression-implementation.d.ts +24 -0
  14. package/dist/application-spec/core/expressions/sdk-expression-implementation.js +1 -0
  15. package/dist/application-spec/core/index.d.ts +2 -0
  16. package/dist/application-spec/core/index.js +1 -1
  17. package/dist/application-spec/core/json-value.d.ts +1 -1
  18. package/dist/application-spec/{core → enhanced-json}/eval-to-constant.d.ts +1 -1
  19. package/dist/application-spec/enhanced-json/index.d.ts +4 -0
  20. package/dist/application-spec/enhanced-json/index.js +1 -0
  21. package/dist/application-spec/enhanced-json/is-enhanced-json-array.d.ts +2 -0
  22. package/dist/application-spec/enhanced-json/is-enhanced-json-array.js +1 -0
  23. package/dist/application-spec/enhanced-json/resolve-enhanced-json-value.d.ts +18 -0
  24. package/dist/application-spec/enhanced-json/resolve-enhanced-json-value.js +1 -0
  25. package/dist/application-spec/enhanced-json/schema-from-value.d.ts +24 -0
  26. package/dist/application-spec/enhanced-json/schema-from-value.js +1 -0
  27. package/dist/application-spec/enhanced-json/stringify-enhanced-json-value.d.ts +14 -0
  28. package/dist/application-spec/enhanced-json/stringify-enhanced-json-value.js +1 -0
  29. package/dist/application-spec/enhanced-json/validate-enhanced-json-value-caps.d.ts +12 -0
  30. package/dist/application-spec/enhanced-json/validate-enhanced-json-value-caps.js +1 -0
  31. package/dist/application-spec/enhanced-json/validate-no-legacy-code-ref.d.ts +13 -0
  32. package/dist/application-spec/enhanced-json/validate-no-legacy-code-ref.js +1 -0
  33. package/dist/application-spec/errors/diagnostic-codes.d.ts +9 -0
  34. package/dist/application-spec/errors/diagnostic-codes.js +1 -1
  35. package/dist/application-spec/errors/diagnostic-messages.d.ts +12 -0
  36. package/dist/application-spec/errors/diagnostic-messages.js +1 -1
  37. package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +7 -0
  38. package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
  39. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.js +4 -4
  40. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-defaults.d.ts +4 -2
  41. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-defaults.js +1 -1
  42. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +48 -48
  43. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +3 -0
  44. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-relation-expressions.js +1 -1
  45. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.d.ts +6 -8
  46. package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +11 -11
  47. package/dist/application-spec/generate-application/code/templates/domain-spec/index.d.ts +1 -1
  48. package/dist/application-spec/generate-application/code/templates/domain-spec/index.js +1 -1
  49. package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
  50. package/dist/application-spec/generate-application/code/templates/domain.js +3 -3
  51. package/dist/application-spec/generate-application/code/templates/globals.js +5 -4
  52. package/dist/application-spec/generate-application/code/templates/index.d.ts +0 -1
  53. package/dist/application-spec/generate-application/code/templates/index.js +1 -1
  54. package/dist/application-spec/generate-application/code/templates/package-json.js +1 -1
  55. package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +8 -2
  56. package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
  57. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +5 -2
  58. package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
  59. package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +1 -3
  60. package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +1 -3
  61. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.d.ts +1 -1
  62. package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
  63. package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +2 -1
  64. package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
  65. package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +2 -4
  66. package/dist/application-spec/index.d.ts +1 -0
  67. package/dist/application-spec/index.js +1 -1
  68. package/dist/application-spec/parse-application-files/categorize/module-analysis.d.ts +1 -1
  69. package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
  70. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +16 -3
  71. package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
  72. package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
  73. package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
  74. package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
  75. package/dist/application-spec/parse-application-files/spec/components/component-entry.d.ts +1 -9
  76. package/dist/application-spec/parse-application-files/spec/components/component-entry.js +1 -1
  77. package/dist/application-spec/parse-application-files/spec/components/component-filter.d.ts +1 -54
  78. package/dist/application-spec/parse-application-files/spec/components/component-filter.js +1 -1
  79. package/dist/application-spec/parse-application-files/spec/components/index.d.ts +1 -1
  80. package/dist/application-spec/parse-application-files/spec/components/index.js +1 -1
  81. package/dist/application-spec/parse-application-files/spec/expressions/expression.d.ts +1 -28
  82. package/dist/application-spec/parse-application-files/spec/expressions/expression.js +1 -1
  83. package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +1 -1
  84. package/dist/application-spec/parse-application-files/spec/expressions/expressions.js +1 -1
  85. package/dist/application-spec/parse-application-files/spec/expressions/index.d.ts +0 -1
  86. package/dist/application-spec/parse-application-files/spec/expressions/index.js +1 -1
  87. package/dist/application-spec/parse-application-files/spec/expressions/memo-eval-plan.js +1 -1
  88. package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.js +1 -1
  89. package/dist/application-spec/parse-application-files/spec/model/defaults.d.ts +7 -2
  90. package/dist/application-spec/parse-application-files/spec/model/defaults.js +1 -1
  91. package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.d.ts +25 -0
  92. package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.js +1 -0
  93. package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.d.ts +46 -0
  94. package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.js +1 -0
  95. package/dist/application-spec/parse-application-files/spec/relations/relations.d.ts +4 -3
  96. package/dist/application-spec/parse-application-files/spec/relations/relations.js +1 -1
  97. package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
  98. package/dist/application-spec/parse-application-files/spec/sections/infra.d.ts +2 -0
  99. package/dist/application-spec/parse-application-files/spec/sections/infra.js +1 -1
  100. package/dist/client/phoenix-api.d.ts +96 -0
  101. package/dist/configurator/application-runtime/extensions/create-configurator-extensions.js +1 -1
  102. package/dist/configurator/application-runtime/extensions/selectors.d.ts +3 -1
  103. package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
  104. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +3 -1
  105. package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
  106. package/dist/configurator/application-runtime/extensions/systems/drag-and-drop-system/drag-and-drop-system.d.ts +3 -3
  107. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +14 -4
  108. package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
  109. package/dist/configurator/application-runtime/extensions/systems/graphql-system/inject-assistant-lenses.d.ts +11 -0
  110. package/dist/configurator/application-runtime/extensions/systems/graphql-system/inject-assistant-lenses.js +1 -0
  111. package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.d.ts +2 -2
  112. package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.js +1 -1
  113. package/dist/configurator/common/configurator-interface.d.ts +11 -1
  114. package/dist/configurator/common/configurator-interface.js +1 -1
  115. package/dist/configurator/common/frontend-analytics.d.ts +2 -0
  116. package/dist/configurator/common/frontend-analytics.js +1 -1
  117. package/dist/configurator/configurator-context/configurator-hooks/layout-hooks.d.ts +1 -1
  118. package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +6 -0
  119. package/dist/configurator/pages/DefaultConfiguratorLayout.js +1 -0
  120. package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
  121. package/dist/configurator/scene/scene-controls/hotspot-drag-handle/HotspotDragHandle.d.ts +1 -1
  122. package/dist/configurator/scene/scene-controls/hotspot-drag-handle/HotspotDragSceneHandle.d.ts +1 -1
  123. package/dist/configurator/scene/scene-entity/dimension-indicators/DimensionIndicator.d.ts +1 -1
  124. package/dist/configurator/scene/scene-entity/dimension-indicators/DimensionIndicatorInternal.d.ts +1 -1
  125. package/dist/configurator/scene/scene-entity/drag-and-drop/shared.d.ts +2 -2
  126. package/dist/configurator/scene/scene-entity/drag-and-drop/use-drag-object.d.ts +1 -1
  127. package/dist/configurator/scene/scene-entity/materials/RemoteReplacedMaterial.js +1 -1
  128. package/dist/configurator/scene/scene-entity/objects/SceneEntityObjectTextDecal.d.ts +1 -1
  129. package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +1 -1
  130. package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
  131. package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
  132. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +13 -0
  133. package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -0
  134. package/dist/configurator/ui/assistant/entity-link/entity-link-selection.d.ts +22 -0
  135. package/dist/configurator/ui/assistant/entity-link/entity-link-selection.js +1 -0
  136. package/dist/configurator/ui/assistant/entity-link/entity-link-state.d.ts +27 -0
  137. package/dist/configurator/ui/assistant/entity-link/entity-link-state.js +1 -0
  138. package/dist/configurator/ui/assistant/entity-link/entity-link-target.d.ts +5 -0
  139. package/dist/configurator/ui/assistant/entity-link/entity-link-target.js +1 -0
  140. package/dist/configurator/ui/assistant/entity-link/index.d.ts +3 -0
  141. package/dist/configurator/ui/assistant/entity-link/index.js +1 -0
  142. package/dist/configurator/ui/configurator-layout/sidebar-keys/index.d.ts +1 -0
  143. package/dist/configurator/ui/configurator-layout/sidebar-keys/index.js +1 -0
  144. package/dist/configurator/ui/configurator-layout/sidebar-keys/sidebar-keys.d.ts +11 -0
  145. package/dist/configurator/ui/configurator-layout/sidebar-keys/sidebar-keys.js +1 -0
  146. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/DesktopSidebar.d.ts +101 -0
  147. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/DesktopSidebar.js +16 -0
  148. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/index.d.ts +1 -0
  149. package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/index.js +1 -0
  150. package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.d.ts +4 -4
  151. package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.js +1 -1
  152. package/dist/configurator/ui/configurator-layout/slots/services/SideEffects.d.ts +3 -6
  153. package/dist/configurator/ui/configurator-layout/slots/services/SideEffects.js +1 -1
  154. package/dist/configurator/ui/configurator-layout/slots/slots.d.ts +1 -0
  155. package/dist/configurator/ui/configurator-layout/slots/slots.js +1 -1
  156. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.d.ts +0 -74
  157. package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.js +5 -20
  158. package/dist/configurator/ui/configurator-layout/universal/DesktopPreview.js +1 -1
  159. package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +4 -4
  160. package/dist/configurator/ui/configurator-layout/universal/MobilePreview.js +1 -1
  161. package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.d.ts +47 -0
  162. package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -0
  163. package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.d.ts +11 -26
  164. package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.js +1 -1
  165. package/dist/configurator/ui/legacy/layout/steps/StepsNavigation.d.ts +2 -2
  166. package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.d.ts +2 -2
  167. package/dist/docs/complex-use-cases/filtered-controls-with-fix-dialog.mdx +16 -19
  168. package/dist/docs/complex-use-cases/sketching.mdx +0 -38
  169. package/dist/docs/controls/select-attribute/cardselect.mdx +9 -13
  170. package/dist/docs/dimensions/3d-scene-integration/dimension-indicators.mdx +2 -2
  171. package/dist/docs/dimensions/3d-scene-integration/editable-angle-indicator.mdx +1 -1
  172. package/dist/docs/dimensions/3d-scene-integration/editable-distance-dimension-indicator.mdx +1 -1
  173. package/dist/docs/dimensions/3d-scene-integration/list-selector-dimension-indicator.mdx +1 -1
  174. package/dist/docs/drag-and-drop/drag-handle.mdx +1 -1
  175. package/dist/docs/drag-and-drop/hotspot-handle.mdx +1 -1
  176. package/dist/docs/drag-and-drop/planes.mdx +1 -1
  177. package/dist/docs/drag-and-drop/rotatable.mdx +2 -2
  178. package/dist/docs/index.json +42 -1
  179. package/dist/docs/integrations/woocommerce/local-development.mdx +1 -1
  180. package/dist/docs/layouts/custom-layout.mdx +1164 -0
  181. package/dist/docs/layouts/header/fixed.mdx +2 -2
  182. package/dist/docs/layouts/header/floating.mdx +2 -2
  183. package/dist/docs/layouts/sidebar/in-a-custom-layout.mdx +380 -0
  184. package/dist/docs/layouts/sidebar-footer/basic.mdx +32 -77
  185. package/dist/docs/other-features/client-side-rendering/declarative.mdx +1 -1
  186. package/dist/docs/other-features/side-effects.mdx +8 -11
  187. package/dist/docs/other-features/transformers.mdx +4 -0
  188. package/dist/docs/other-features/violation-messages.mdx +52 -56
  189. package/dist/docs/phoenix/application-states.mdx +9 -7
  190. package/dist/docs/phoenix/configurator-interface.mdx +184 -80
  191. package/dist/docs/phoenix/domain-model.mdx +4 -0
  192. package/dist/docs/phoenix/finalization.mdx +1 -1
  193. package/dist/docs/phoenix/layout-slots.mdx +114 -0
  194. package/dist/docs/phoenix/phoenix-cli.mdx +24 -27
  195. package/dist/docs/phoenix/project-structure.mdx +14 -9
  196. package/dist/docs/phoenix/quickstart.mdx +2 -2
  197. package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
  198. package/dist/docs/phoenix/testing.mdx +140 -0
  199. package/dist/docs/phoenix/webhook-membership.mdx +10 -9
  200. package/dist/docs/phoenix/webhooks.mdx +2 -2
  201. package/dist/domain/admin-domain/implementation/common-admin-expressions.d.ts +26 -11
  202. package/dist/domain/admin-domain/implementation/common-admin-publish.d.ts +1 -2
  203. package/dist/domain/admin-domain/index.js +1 -1
  204. package/dist/domain/application/GetApplicationWrapperHandler.d.ts +1 -1
  205. package/dist/domain/application/application-config.d.ts +4 -2
  206. package/dist/domain/application/assistant/assistant-fields.d.ts +12 -0
  207. package/dist/domain/application/assistant/assistant-fields.js +1 -0
  208. package/dist/domain/application/assistant/assistant-manifest.d.ts +9 -1
  209. package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +38 -2
  210. package/dist/domain/application/assistant/assistant-resolved-manifest.js +1 -1
  211. package/dist/domain/application/assistant/build-assistant-lenses.d.ts +14 -0
  212. package/dist/domain/application/assistant/build-assistant-lenses.js +5 -0
  213. package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
  214. package/dist/domain/application/assistant/create-assistant-execution-schema.d.ts +32 -0
  215. package/dist/domain/application/assistant/create-assistant-execution-schema.js +1 -0
  216. package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
  217. package/dist/domain/application/assistant/index.d.ts +6 -1
  218. package/dist/domain/application/assistant/index.js +1 -1
  219. package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.d.ts +20 -0
  220. package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.js +1 -0
  221. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.d.ts +10 -0
  222. package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -0
  223. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +48 -0
  224. package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -0
  225. package/dist/domain/application/assistant/session-setup/create-session-assistant.d.ts +15 -0
  226. package/dist/domain/application/assistant/session-setup/create-session-assistant.js +1 -0
  227. package/dist/domain/application/assistant/session-setup/index.d.ts +4 -0
  228. package/dist/domain/application/assistant/session-setup/index.js +1 -0
  229. package/dist/domain/application/configurator-builder.d.ts +1 -1
  230. package/dist/domain/application/configurator-builder.js +1 -1
  231. package/dist/domain/application/create-initial-published-data.d.ts +5 -5
  232. package/dist/domain/application/index.d.ts +0 -1
  233. package/dist/domain/application/index.js +1 -1
  234. package/dist/domain/application/published-data/map-published-chunked-data.d.ts +1 -1
  235. package/dist/domain/application/published-data/map-published-data.d.ts +7 -3
  236. package/dist/domain/core/component/domain-component-optic.d.ts +11 -19
  237. package/dist/domain/core/component/domain-component-optic.js +2 -2
  238. package/dist/domain/core/component/legacy-filter.d.ts +2 -17
  239. package/dist/domain/core/component/system-component-filter.d.ts +36 -18
  240. package/dist/domain/core/expression/constant-expressions.d.ts +16 -8
  241. package/dist/domain/core/expression/custom-expression.d.ts +16 -3
  242. package/dist/domain/core/invariant/custom-invariants.d.ts +6 -14
  243. package/dist/domain/core/invariant/invariants.d.ts +1 -4
  244. package/dist/domain/core/invariant/violation.d.ts +50 -2
  245. package/dist/domain/core/invariant/violation.js +1 -1
  246. package/dist/domain/core/model/model.d.ts +1 -1
  247. package/dist/domain/core/recipe/recipes.d.ts +18 -50
  248. package/dist/domain/core/recipe/recipes.js +1 -1
  249. package/dist/domain/core/relation/all-of-type-relation.d.ts +8 -21
  250. package/dist/domain/core/relation/all-of-type-relation.js +1 -1
  251. package/dist/domain/core/relation/direct-relation.d.ts +13 -24
  252. package/dist/domain/core/relation/index.d.ts +0 -1
  253. package/dist/domain/core/relation/indirect-relation.d.ts +12 -67
  254. package/dist/domain/core/relation/indirect-relation.js +1 -1
  255. package/dist/domain/core/relation/relation-factory.d.ts +19 -15
  256. package/dist/domain/core/relation/relation-factory.js +1 -1
  257. package/dist/domain/core/state/migrations.d.ts +14 -45
  258. package/dist/domain/core/state/migrations.js +1 -1
  259. package/dist/domain/core/state/state.d.ts +1 -1
  260. package/dist/domain/domain-builder.js +1 -1
  261. package/dist/domain/domain-runtime/access/selectors.d.ts +9 -0
  262. package/dist/domain/domain-runtime/access/selectors.js +1 -1
  263. package/dist/domain/domain-runtime/access/types.d.ts +2 -0
  264. package/dist/domain/domain-runtime/access/types.js +1 -1
  265. package/dist/domain/domain-runtime/domain-context/selectors.d.ts +14 -13
  266. package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
  267. package/dist/domain/domain-runtime/domain-context/types.d.ts +4 -1
  268. package/dist/domain/domain-runtime/domain-runtime.d.ts +32 -16
  269. package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +19 -0
  270. package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -0
  271. package/dist/domain/domain-runtime/errors/implementation-error.d.ts +46 -0
  272. package/dist/domain/domain-runtime/errors/implementation-error.js +1 -0
  273. package/dist/domain/domain-runtime/errors/implementation-errors.d.ts +13 -0
  274. package/dist/domain/domain-runtime/errors/implementation-errors.js +1 -0
  275. package/dist/domain/domain-runtime/errors/index.d.ts +4 -0
  276. package/dist/domain/domain-runtime/errors/index.js +1 -0
  277. package/dist/domain/domain-runtime/errors/to-implementation-errors.d.ts +10 -0
  278. package/dist/domain/domain-runtime/errors/to-implementation-errors.js +1 -0
  279. package/dist/domain/domain-runtime/index.d.ts +1 -0
  280. package/dist/domain/domain-runtime/index.js +1 -1
  281. package/dist/domain/domain-runtime/spec/create-violation-expressions.d.ts +24 -0
  282. package/dist/domain/domain-runtime/spec/create-violation-expressions.js +1 -0
  283. package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
  284. package/dist/domain/domain-runtime/spec/index.js +1 -1
  285. package/dist/domain/domain-runtime/spec/initialize.d.ts +11 -0
  286. package/dist/domain/domain-runtime/spec/initialize.js +1 -1
  287. package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -1
  288. package/dist/domain/domain-runtime/spec/module-checks/project-modules.d.ts +8 -1
  289. package/dist/domain/domain-runtime/spec/module-checks/project-modules.js +1 -1
  290. package/dist/domain/domain-runtime/spec/module-checks/resolve-action-modules.js +1 -1
  291. package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -1
  292. package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.d.ts +7 -7
  293. package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.js +1 -1
  294. package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.d.ts +2 -2
  295. package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.js +1 -1
  296. package/dist/domain/extensions/attribute-switch.d.ts +1 -1
  297. package/dist/domain/extensions/attribute-switch.js +1 -1
  298. package/dist/domain/extensions/canvas-config.d.ts +1 -1
  299. package/dist/domain/extensions/client-side-image.d.ts +2 -2
  300. package/dist/domain/extensions/client-side-image.js +1 -1
  301. package/dist/domain/extensions/common/angle-indicator-schema.d.ts +2 -2
  302. package/dist/domain/extensions/common/dimension-indicator-schema.d.ts +2 -2
  303. package/dist/domain/extensions/editable-angle-indicator.d.ts +1 -1
  304. package/dist/domain/extensions/editable-distance-dimension-indicator.d.ts +1 -1
  305. package/dist/domain/extensions/editable-offset-indicator.d.ts +1 -1
  306. package/dist/domain/extensions/editable-offset-indicator.js +1 -1
  307. package/dist/domain/extensions/fit-selection-orthographic-camera-component.js +1 -1
  308. package/dist/domain/extensions/fit-selection-perspective-camera-component.js +1 -1
  309. package/dist/domain/extensions/horizontal-tabs.d.ts +2 -2
  310. package/dist/domain/extensions/list-selector-dimension-indicator.d.ts +1 -1
  311. package/dist/domain/extensions/navigation-steps.d.ts +2 -2
  312. package/dist/domain/extensions/offset-indicator.js +1 -1
  313. package/dist/domain/extensions/rotation-handle.d.ts +2 -2
  314. package/dist/domain/extensions/save-template-thumbnail.d.ts +2 -2
  315. package/dist/domain/extensions/save-template-thumbnail.js +1 -1
  316. package/dist/domain/extensions/scene-entity-animation.js +1 -1
  317. package/dist/domain/mocks/create-mock-domain-context.d.ts +1 -1
  318. package/dist/domain/mocks/create-mock-domain-runtime.d.ts +18 -9
  319. package/dist/domain/mocks/create-mock-domain-runtime.js +1 -1
  320. package/dist/domain/mocks/create-mock-domain.d.ts +1 -1
  321. package/dist/domain/mocks/create-mock-domain.js +1 -1
  322. package/dist/domain/mocks/create-mock-state.d.ts +2 -2
  323. package/dist/domain/mocks/create-test-application-config.d.ts +59 -0
  324. package/dist/domain/mocks/create-test-application-config.js +1 -0
  325. package/dist/domain/mocks/index.d.ts +1 -0
  326. package/dist/domain/mocks/index.js +1 -1
  327. package/dist/domain/projections/blender-projections/camera.d.ts +1 -1
  328. package/dist/domain/system-components/application-config.d.ts +2 -2
  329. package/dist/domain/system-components/child-entity-selection.js +1 -1
  330. package/dist/domain/system-components/collision-box-geometry.d.ts +4 -2
  331. package/dist/domain/system-components/collision-geometry.d.ts +4 -2
  332. package/dist/domain/system-components/collision-point-geometry.d.ts +4 -2
  333. package/dist/domain/system-components/common/material-override-schema.d.ts +2 -2
  334. package/dist/domain/system-components/common/recipes.d.ts +21 -3
  335. package/dist/domain/system-components/common/recipes.js +1 -1
  336. package/dist/domain/system-components/constraint.d.ts +10 -23
  337. package/dist/domain/system-components/drag-handle.d.ts +1 -1
  338. package/dist/domain/system-components/drag-handle.js +1 -1
  339. package/dist/domain/system-components/fit-entity-orthographic-camera-component.js +1 -1
  340. package/dist/domain/system-components/fit-entity-perspective-camera-component.js +1 -1
  341. package/dist/domain/system-components/fit-root-orthographic-camera-component.js +1 -1
  342. package/dist/domain/system-components/fit-root-perspective-camera-component.js +1 -1
  343. package/dist/domain/system-components/hotspot-drag-handle.d.ts +1 -1
  344. package/dist/domain/system-components/hotspot-drag-handle.js +1 -1
  345. package/dist/domain/system-components/material-swatch.js +1 -1
  346. package/dist/domain/system-components/scene-entity-material-override.d.ts +1 -1
  347. package/dist/domain/system-components/scene-entity-object-material-override.d.ts +1 -1
  348. package/dist/domain/system-components/scene-entity-object-text-decal.d.ts +1 -1
  349. package/dist/domain/system-components/scene-entity-object-transimissive-material-override.d.ts +1 -1
  350. package/dist/domain/system-components/scene-entity-transimissive-material-override.d.ts +1 -1
  351. package/dist/domain/system-components/static-orthographic-camera-component.js +1 -1
  352. package/dist/domain/system-components/static-perspective-camera-component.js +1 -1
  353. package/dist/domain/utils/eval-cache.d.ts +1 -1
  354. package/dist/domain/utils/map-nested-object.d.ts +1 -1
  355. package/dist/editor/domain-editors/use-implementation-files.d.ts +1 -2
  356. package/dist/editor/mocks/EditorMockContext.js +1 -1
  357. package/dist/legacy/domain-cli/gen/configurator-builder.js +13 -12
  358. package/dist/legacy/domain-cli/gen/constant-expressions.js +1 -1
  359. package/dist/legacy/domain-cli/gen/defaults.js +1 -7
  360. package/dist/legacy/domain-cli/gen/invariants.js +3 -4
  361. package/dist/legacy/domain-cli/gen/relations.js +1 -1
  362. package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
  363. package/dist/legacy/domain-cli/utils/cache.js +1 -1
  364. package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +81 -68
  365. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
  366. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
  367. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
  368. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +2 -0
  369. package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/domain-index.js +17 -15
  370. package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
  371. package/dist/phoenix/commands/deploy.js +1 -1
  372. package/dist/phoenix/commands/init.d.ts +4 -4
  373. package/dist/phoenix/commands/init.js +1 -1
  374. package/dist/phoenix/commands/prettier.js +1 -1
  375. package/dist/phoenix/services/source-archive.d.ts +1 -0
  376. package/dist/phoenix/services/source-archive.js +1 -1
  377. package/dist/phoenix/utils/git/index.d.ts +1 -0
  378. package/dist/phoenix/utils/git/index.js +1 -0
  379. package/dist/phoenix/utils/git/is-inside-git-repository.d.ts +6 -0
  380. package/dist/phoenix/utils/git/is-inside-git-repository.js +1 -0
  381. package/dist/phoenix/utils/index.d.ts +1 -0
  382. package/dist/phoenix/utils/index.js +1 -1
  383. package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +2 -0
  384. package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
  385. package/dist/react-sdk/application-runtime/routing/access-service.d.ts +1 -0
  386. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +33 -16
  387. package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
  388. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.d.ts +30 -0
  389. package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.js +1 -0
  390. package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +4 -4
  391. package/dist/react-sdk/domain-context/index.d.ts +2 -1
  392. package/dist/react-sdk/domain-context/index.js +1 -1
  393. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +6 -0
  394. package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
  395. package/dist/react-sdk/domain-controls/hooks/use-angle-dimension.d.ts +1 -1
  396. package/dist/ui-sdk/theme/types.d.ts +1 -1
  397. package/dist/webhook/builders/webhook-builder.js +1 -1
  398. package/package.json +3 -3
  399. package/schema/domain-spec.json +1115 -209
  400. package/dist/application-spec/generate-application/code/templates/prettier-ignore.d.ts +0 -1
  401. package/dist/application-spec/generate-application/code/templates/prettier-ignore.js +0 -6
  402. package/dist/domain/application/resource-builder.d.ts +0 -13
  403. package/dist/domain/application/resource-builder.js +0 -1
  404. package/dist/domain/core/relation/relation-implementation.d.ts +0 -7
  405. package/dist/domain/domain-runtime/spec/invariant-builder.d.ts +0 -26
  406. package/dist/domain/domain-runtime/spec/invariant-builder.js +0 -1
  407. /package/dist/{domain/core/relation/relation-implementation.js → application-spec/core/expressions/relation-expression-params.js} +0 -0
  408. /package/dist/application-spec/{core → enhanced-json}/eval-code-uses-self.d.ts +0 -0
  409. /package/dist/application-spec/{core → enhanced-json}/eval-code-uses-self.js +0 -0
  410. /package/dist/application-spec/{core → enhanced-json}/eval-to-constant.js +0 -0
@@ -0,0 +1,1164 @@
1
+ # Custom Layout
2
+
3
+ Make the configurator look like the brand's own product page. A furniture shop wants its table configurator to read like the rest of its site: a floating panel on the left with the product's name, the edge finishes as picture cards, the price in large type and one clear call to action, and the table in the space beside it. The project writes that page as one React component. Phoenix supplies the 3D scene, the product's state and a few hooks; every pixel around the scene is the project's own.
4
+
5
+ - [Choose this approach](#choose-this-approach)
6
+ - [Register the layout](#register-the-layout)
7
+ - [What the layout has to do](#what-the-layout-has-to-do)
8
+ - [Read and change the product](#read-and-change-the-product)
9
+ - [Draw the choices](#draw-the-choices)
10
+ - [Offer fullscreen](#offer-fullscreen)
11
+ - [Show messages](#show-messages)
12
+ - [Serve read mode](#serve-read-mode)
13
+ - [The spec the layout reads](#the-spec-the-layout-reads)
14
+ - [Try the example](#try-the-example)
15
+ - [Test cases](#test-cases)
16
+ - [Known gaps](#known-gaps)
17
+ - [Related pages](#related-pages)
18
+ - [Complete Implementation](#complete-implementation)
19
+
20
+ ## Choose this approach
21
+
22
+ Write your own layout when the configurator has to follow a design the built-in layout cannot take on: the brand's typography, controls and spacing, a panel on the left, a top bar with the price, an area the built-in layout has no place for.
23
+
24
+ Stay with the built-in layout when its structure fits and only its parts change. [Universal](?path=/docs/layouts-universal--docs) demonstrates that layout, and the pages of its parts describe what the spec configures: [Header](?path=/docs/layouts-header-floating--docs), [Sidebar](?path=/docs/layouts-sidebar-general--docs), [Sidebar Footer](?path=/docs/layouts-sidebar-footer-basic--docs), [Toolbar](?path=/docs/layouts-toolbar--docs) and [View Controls](?path=/docs/layouts-view-controls--docs).
25
+
26
+ A project layout replaces all of that. None of the built-in sidebar, footer, toolbar or property pages is rendered for it, so the layout builds every control the user needs. This example uses no SDK component that draws UI: only the scene, the safe-area hook and hooks that read and change the product's state. A layout may also mount the SDK's own pieces where it wants them, see [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui).
27
+
28
+ ## Register the layout
29
+
30
+ Create `src/elements/ConfiguratorLayout.tsx` with a default export made by `phx.frontend.createCustomPhoenixLayoutElement`. The name `ConfiguratorLayout` is what makes it the layout: Phoenix renders the element registered under that name for every loaded configuration, in owner and in read mode, whatever `layout` the spec sets. Nothing in the YAML refers to it.
31
+
32
+ ```tsx
33
+ import { Box } from '@mui/material'
34
+
35
+ import { LayoutSlots, useSceneSafeArea } from '@salsita-ai/sdk/configurator'
36
+
37
+ import { phx } from '../../.phoenix/phx.js'
38
+ import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
39
+ import { MessageToast } from '../_shared/MessageToast.js'
40
+ import { ProductPanel } from '../_shared/ProductPanel.js'
41
+
42
+ const GUTTER = 24
43
+ const PANEL_WIDTH = 380
44
+
45
+ const ConfiguratorLayout = () => {
46
+ const { containerRef, safeAreaRef } = useSceneSafeArea()
47
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
48
+
49
+ return (
50
+ <Box component="div" ref={containerRef} sx={{ position: 'absolute', inset: 0 }}>
51
+ <LayoutSlots.SharedCanvas />
52
+
53
+ {!isFullscreen && (
54
+ <Box
55
+ component="aside"
56
+ sx={{
57
+ position: 'absolute',
58
+ insetBlockStart: GUTTER,
59
+ insetInlineStart: GUTTER,
60
+ inlineSize: PANEL_WIDTH,
61
+ maxBlockSize: `calc(100% - ${2 * GUTTER}px)`,
62
+ display: 'flex',
63
+ flexDirection: 'column',
64
+ borderRadius: 5,
65
+ bgcolor: 'background.paper',
66
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
67
+ overflow: 'hidden',
68
+ }}
69
+ >
70
+ <ProductPanel />
71
+ </Box>
72
+ )}
73
+
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>
91
+ <Box
92
+ component="div"
93
+ sx={{ position: 'absolute', insetBlockEnd: GUTTER, insetInlineStart: GUTTER, pointerEvents: 'auto' }}
94
+ >
95
+ <MessageToast />
96
+ </Box>
97
+ </Box>
98
+ </Box>
99
+ )
100
+ }
101
+
102
+ export default phx.frontend.createCustomPhoenixLayoutElement('ConfiguratorLayout', ConfiguratorLayout)
103
+ ```
104
+
105
+ The components it uses live in `src/_shared/`, which Phoenix does not import by convention, so the layout imports them itself. Application projects receive `phx` as a global. Storybook examples cannot rely on that project environment, so these files import it from `../../.phoenix/phx.js`; leave that import out in a project.
106
+
107
+ ## What the layout has to do
108
+
109
+ - **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
+ - **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
+ - **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.
113
+ - **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.
115
+ - **Serve read mode.** The same element renders a configuration shared for viewing, and the layout decides what a viewer sees.
116
+
117
+ ## Read and change the product
118
+
119
+ The panel reads everything it shows from hooks and writes the customer's choice back through one of them. The table lists the hooks the whole layout uses:
120
+
121
+ ```tsx
122
+ import { Box, Button, Typography } from '@mui/material'
123
+
124
+ import { detailComponent } from '@salsita-ai/sdk/domain'
125
+ import { useResolveLocalizable } from '@salsita-ai/sdk/react'
126
+
127
+ import { phx } from '../../.phoenix/phx.js'
128
+ import { EdgeFinishCards } from './EdgeFinishCards.js'
129
+
130
+ export const ProductPanel = () => {
131
+ const resolve = useResolveLocalizable()
132
+ const detail = phx.frontend.useFirstRootComponent(detailComponent)
133
+ const price = phx.frontend.useRootEntityPrice()
134
+ const tableId = phx.frontend.useRootEntityId()
135
+ const edgeFinish = phx.frontend.useAttributeSelection(tableId, 'edgeFinish')
136
+ const { accessInfo } = phx.frontend.useAccessService()
137
+ const navigationState = phx.frontend.useActiveNavigationState()
138
+ const pushNavigate = phx.frontend.usePushNavigate()
139
+ const popNavigate = phx.frontend.usePopNavigate()
140
+
141
+ const isReadMode = accessInfo.viewMode
142
+ const isReview = isReadMode || navigationState === 'checkout'
143
+ const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
144
+
145
+ return (
146
+ <>
147
+ <Box component="header" sx={{ display: 'grid', gap: 1, padding: 3, paddingBlockEnd: 2 }}>
148
+ {isReadMode ? (
149
+ <Typography
150
+ variant="overline"
151
+ sx={{ justifySelf: 'start', paddingInline: 1.5, borderRadius: 999, bgcolor: 'action.selected' }}
152
+ >
153
+ View only
154
+ </Typography>
155
+ ) : (
156
+ <Typography variant="overline" color="text.secondary">
157
+ {resolve(detail?.state.subtitle)}
158
+ </Typography>
159
+ )}
160
+ <Typography variant="h5" component="h2" fontWeight={700}>
161
+ {resolve(detail?.state.title)}
162
+ </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} />
183
+ )}
184
+ </Box>
185
+
186
+ <Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
187
+ <Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
188
+ <Typography variant="body2" color="text.secondary">
189
+ Total price
190
+ </Typography>
191
+ <Typography variant="h5" component="p" fontWeight={700}>
192
+ {price}
193
+ </Typography>
194
+ </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'}
208
+ </Button>
209
+ )}
210
+ </Box>
211
+ </>
212
+ )
213
+ }
214
+ ```
215
+
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`. |
228
+
229
+ 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
+
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.
232
+
233
+ ## Draw the choices
234
+
235
+ The edge finish is a visual choice, so the panel shows it as cards with a drawing of each profile, as [Choosing a Control](?path=/docs/ux-guidelines-choosing-a-control--docs) recommends for shapes. The selected card has a border in the theme's primary colour, a tinted background and a check mark, so the state does not depend on colour alone. The cards form a radio group: the group has `role="radiogroup"` and a label, each card `role="radio"` and `aria-checked`, only the selected card is in the tab order, and the arrow keys move the selection, skipping disabled options, as in a native radio group. Each card is at least 44 pixels high and shows a focus ring for keyboard users.
236
+
237
+ ```tsx
238
+ import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
239
+ import type { KeyboardEvent } from 'react'
240
+
241
+ import { type UseAttributeSelection, useResolveLocalizable } from '@salsita-ai/sdk/react'
242
+
243
+ // Cross-sections of the tabletop's edge, keyed by the option values of the spec.
244
+ const EDGE_PROFILES: Readonly<Record<string, string>> = {
245
+ None: 'M0 4H32V20H0Z',
246
+ Facet: 'M0 4H26L32 10V14L26 20H0Z',
247
+ Round: 'M0 4H24A8 8 0 0 1 24 20H0Z',
248
+ TreeTrunk: 'M0 4H27C33 5 28 9 34 11C29 13 34 17 27 20H0Z',
249
+ }
250
+
251
+ const CHECK_BADGE: SxProps<Theme> = {
252
+ position: 'absolute',
253
+ insetBlockStart: 10,
254
+ insetInlineEnd: 10,
255
+ display: 'grid',
256
+ placeItems: 'center',
257
+ inlineSize: 22,
258
+ blockSize: 22,
259
+ borderRadius: '50%',
260
+ bgcolor: 'primary.main',
261
+ color: 'primary.contrastText',
262
+ fontSize: 13,
263
+ }
264
+
265
+ // Arrow keys move the selection between the cards, as in a native radio group.
266
+ const ARROW_STEPS: Readonly<Record<string, number | undefined>> = {
267
+ ArrowRight: 1,
268
+ ArrowDown: 1,
269
+ ArrowLeft: -1,
270
+ ArrowUp: -1,
271
+ }
272
+
273
+ interface EdgeFinishCardsProps {
274
+ readonly selection: ReturnType<UseAttributeSelection>
275
+ }
276
+
277
+ export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
278
+ const resolve = useResolveLocalizable()
279
+ const { options } = selection
280
+ // The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
281
+ const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
282
+ const focusIndex = selectedIndex >= 0 ? selectedIndex : options.findIndex(option => !option.disabled)
283
+
284
+ const handleKeyDown = (event: KeyboardEvent<HTMLElement>, index: number) => {
285
+ const step = ARROW_STEPS[event.key]
286
+
287
+ if (step === undefined) {
288
+ return
289
+ }
290
+
291
+ event.preventDefault()
292
+ // The next enabled option in the arrow's direction, wrapping around; disabled options are skipped.
293
+ const count = options.length
294
+ const next = Array.from(
295
+ { length: count - 1 },
296
+ (_, offset) => (((index + step * (offset + 1)) % count) + count) % count
297
+ ).find(candidate => !options[candidate]?.disabled)
298
+
299
+ if (next === undefined) {
300
+ return
301
+ }
302
+
303
+ options[next]?.onSelect()
304
+ event.currentTarget.parentElement?.querySelectorAll<HTMLElement>('[role="radio"]')[next]?.focus()
305
+ }
306
+
307
+ return (
308
+ <Box
309
+ component="div"
310
+ role="radiogroup"
311
+ aria-label="Edge finish"
312
+ sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 1.5 }}
313
+ >
314
+ {options.map((option, index) => {
315
+ const isSelected = option.value === selection.value
316
+
317
+ return (
318
+ <ButtonBase
319
+ key={String(option.value)}
320
+ role="radio"
321
+ aria-checked={isSelected}
322
+ tabIndex={index === focusIndex ? 0 : -1}
323
+ disabled={option.disabled}
324
+ onClick={option.onSelect}
325
+ onKeyDown={event => handleKeyDown(event, index)}
326
+ sx={{
327
+ position: 'relative',
328
+ display: 'grid',
329
+ justifyItems: 'start',
330
+ gap: 0.5,
331
+ padding: 2,
332
+ borderRadius: 3,
333
+ border: 2,
334
+ borderColor: isSelected ? 'primary.main' : 'divider',
335
+ bgcolor: isSelected ? 'action.hover' : 'transparent',
336
+ textAlign: 'start',
337
+ transition: 'border-color 150ms, background-color 150ms',
338
+ '&:hover': { borderColor: isSelected ? 'primary.main' : 'text.disabled' },
339
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
340
+ '&.Mui-disabled': { opacity: 0.4 },
341
+ }}
342
+ >
343
+ {isSelected && (
344
+ <Box component="span" aria-hidden sx={CHECK_BADGE}>
345
+ ✓
346
+ </Box>
347
+ )}
348
+ <Box
349
+ component="svg"
350
+ viewBox="0 0 36 24"
351
+ aria-hidden
352
+ sx={{ inlineSize: 60, blockSize: 40, color: '#b98b5e' }}
353
+ >
354
+ <path d={EDGE_PROFILES[String(option.value)]} fill="currentColor" />
355
+ </Box>
356
+ <Typography variant="body2" fontWeight={600}>
357
+ {resolve(option.title)}
358
+ </Typography>
359
+ <Typography variant="caption" color="text.secondary">
360
+ {resolve(option.description)}
361
+ </Typography>
362
+ </ButtonBase>
363
+ )
364
+ })}
365
+ </Box>
366
+ )
367
+ }
368
+ ```
369
+
370
+ The drawings are keyed by the option values of the spec. A spec can carry a picture per option instead, as `img`, which the hook returns as `imageSrc`; [CardSelect](?path=/docs/controls-select-attribute-cardselect--docs) shows the SDK's own card control.
371
+
372
+ ## Offer fullscreen
373
+
374
+ 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
+
376
+ ```tsx
377
+ import { Button } from '@mui/material'
378
+
379
+ import { phx } from '../../.phoenix/phx.js'
380
+
381
+ const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
382
+ const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
383
+
384
+ export const FullscreenToggle = () => {
385
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
386
+ const setFullscreen = phx.frontend.useSetFullscreen()
387
+
388
+ 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>
410
+ )
411
+ }
412
+ ```
413
+
414
+ The button stays in the free area in both states, so the way back is always where the user left it. [Interaction Modes](?path=/docs/ux-guidelines-interaction-modes--docs#full-screen-preview) describes what fullscreen hides.
415
+
416
+ ## Show messages
417
+
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:
419
+
420
+ ```tsx
421
+ import { Alert } from '@mui/material'
422
+ import { useEffect, useState } from 'react'
423
+
424
+ import type { ConfiguratorMessage } from '@salsita-ai/sdk/react'
425
+
426
+ import { phx } from '../../.phoenix/phx.js'
427
+
428
+ const VIOLATION_SEVERITY = { fatal: 'error', fixable: 'error', warning: 'warning', notice: 'info' } as const
429
+ const RANK = { info: 0, warning: 1, error: 2 } as const
430
+ const VISIBLE_MS = 6000
431
+
432
+ const severityOf = (message: ConfiguratorMessage) => {
433
+ if (message.kind === 'violation') {
434
+ return VIOLATION_SEVERITY[message.violation.severity]
435
+ }
436
+
437
+ return message.kind === 'error' ? 'error' : 'info'
438
+ }
439
+
440
+ export const MessageToast = () => {
441
+ const [message, setMessage] = useState<ConfiguratorMessage | null>(null)
442
+
443
+ // A rejected change also reports the notices already present; keep the worst message while it is shown
444
+ phx.frontend.useConfiguratorMessages(next => {
445
+ setMessage(shown => (shown !== null && RANK[severityOf(next)] < RANK[severityOf(shown)] ? shown : next))
446
+ })
447
+
448
+ useEffect(() => {
449
+ if (message === null) {
450
+ return
451
+ }
452
+
453
+ const timeout = setTimeout(() => setMessage(null), VISIBLE_MS)
454
+
455
+ return () => clearTimeout(timeout)
456
+ }, [message])
457
+
458
+ if (message === null) {
459
+ return null
460
+ }
461
+
462
+ return (
463
+ <Alert
464
+ severity={severityOf(message)}
465
+ onClose={() => setMessage(null)}
466
+ sx={{ maxInlineSize: 420, borderRadius: 3, boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)' }}
467
+ >
468
+ {message.text}
469
+ </Alert>
470
+ )
471
+ }
472
+ ```
473
+
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.
475
+
476
+ 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
+
478
+ ```ts
479
+ import { msg } from '@lingui/core/macro'
480
+
481
+ import { phx } from '../../.phoenix/phx.js'
482
+
483
+ // A tree-trunk edge is cut by hand; choosing it carries a hint, which reaches the layout as a side-effect message
484
+ export default phx.frontend.transformerBuilder.when
485
+ .entity(['Table'])
486
+ .modified({ atFields: ['edgeFinish'] })
487
+ .then.overrideMatchingUpdate(({ update }) => {
488
+ if (update.stateDelta.edgeFinish !== 'TreeTrunk') {
489
+ return [update]
490
+ }
491
+
492
+ return [{ ...update, hint: msg`Tree trunk edges are cut by hand, so delivery takes three weeks longer.` }]
493
+ })
494
+ .build('tree-trunk-delivery')
495
+ ```
496
+
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.
498
+
499
+ ## Serve read mode
500
+
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.
502
+
503
+ ## The spec the layout reads
504
+
505
+ The layout reads three components of the root entity and one navigation state; the scene components are in the complete implementation below.
506
+
507
+ ```yaml
508
+ navigationStates:
509
+ - configure
510
+ - checkout
511
+
512
+ components:
513
+ Table:
514
+ detail:
515
+ main:
516
+ title: Linden dining table
517
+ subtitle: Solid oak, seats six
518
+ description: A solid oak top on slender steel legs, finished with the edge profile of your choice.
519
+ price:
520
+ main:
521
+ price:
522
+ $read: $price
523
+ attributeSelection:
524
+ edgeFinish:
525
+ value:
526
+ $bind: edgeFinish
527
+ options:
528
+ - label: Square
529
+ description: Crisp and modern
530
+ value: None
531
+ - label: Facet
532
+ description: A light bevel
533
+ value: Facet
534
+ - label: Round
535
+ description: Soft to the touch
536
+ value: Round
537
+ - label: Tree trunk
538
+ description: The natural edge
539
+ value: TreeTrunk
540
+
541
+ transformers:
542
+ - name: tree-trunk-delivery
543
+ ```
544
+
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.
546
+
547
+ ## Try the example
548
+
549
+ To see read mode, open **Mocks** in the editor rail on the left and apply the **Read User** template.
550
+
551
+ ## Test cases
552
+
553
+ - 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
+ - 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.
556
+ - Tab reaches the selected card, and the arrow keys move the selection to the next or previous card.
557
+ - 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.
559
+ - **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.
561
+
562
+ ## Known gaps
563
+
564
+ 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
+
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.
571
+ - **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
+ - **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
+ - **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
+ - **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(...)`.
576
+ - **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
+ - **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
+ - **"Powered by Salsita" mark.** The built-in layout shows it; a project layout decides whether to mount `LayoutSlots.DesktopPoweredBy`, and this one does not.
579
+
580
+ ## Related pages
581
+
582
+ - [Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui) is the reference for the element name, the minimal layout, the SDK pieces a layout can mount and the hooks it reads.
583
+ - [Universal](?path=/docs/layouts-universal--docs) is the built-in layout this one replaces.
584
+ - [Header / Custom](?path=/docs/layouts-header-custom--docs) replaces only the header, with the price from `useRootEntityPrice()`.
585
+ - [Canvas Padding](?path=/docs/layouts-canvas-padding--docs) scales the gaps `useSceneSafeArea()` measures.
586
+ - [Presets / Custom](?path=/docs/layouts-presets-custom--docs) replaces the preset screen the same way.
587
+
588
+ ## Complete Implementation
589
+
590
+ {/* AUTO-GENERATED SECTION: This section is automatically updated by 'phoenix story build' */}
591
+
592
+ <details>
593
+ <summary>Click to view the complete implementation files</summary>
594
+
595
+ ### ./spec/domain.yaml
596
+
597
+ ```yaml
598
+ model:
599
+ latest:
600
+ entityTypes:
601
+ - Table
602
+ aliases:
603
+ RootEntity:
604
+ - Table
605
+ commonTypes:
606
+ EdgeFinish:
607
+ enum:
608
+ - None
609
+ - Facet
610
+ - Round
611
+ - TreeTrunk
612
+ shapes:
613
+ Table:
614
+ edgeFinish:
615
+ $ref: '#/model/latest/commonTypes/EdgeFinish'
616
+
617
+ presets:
618
+ - rootEntityType: Table
619
+ initialDomainEntities:
620
+ - id: Table-1
621
+ type: Table
622
+ edgeFinish: None
623
+
624
+ navigationStates:
625
+ - configure
626
+ - checkout
627
+
628
+ components:
629
+ Table:
630
+ detail:
631
+ main:
632
+ title: Linden dining table
633
+ subtitle: Solid oak, seats six
634
+ description: A solid oak top on slender steel legs, finished with the edge profile of your choice.
635
+ price:
636
+ main:
637
+ price:
638
+ $read: $price
639
+ attributeSelection:
640
+ edgeFinish:
641
+ value:
642
+ $bind: edgeFinish
643
+ options:
644
+ - label: Square
645
+ description: Crisp and modern
646
+ value: None
647
+ - label: Facet
648
+ description: A light bevel
649
+ value: Facet
650
+ - label: Round
651
+ description: Soft to the touch
652
+ value: Round
653
+ - label: Tree trunk
654
+ description: The natural edge
655
+ value: TreeTrunk
656
+ fitRootPerspectiveCamera:
657
+ main:
658
+ priority: 1
659
+ fov: 35
660
+ near: 100
661
+ far: 10000
662
+ minDistance: 1000
663
+ maxDistance: 9000
664
+ distance: 5000
665
+ azimuthAngle: 1.5
666
+ polarAngle: 1.1
667
+ fitMeshChanges: true
668
+ sceneEntityRemoteObject:
669
+ top:
670
+ fileUrl: /models/tables.gltf
671
+ objectName: RECHTHOEK_RECTANGLE
672
+ dimensionUnit: m
673
+ leg:
674
+ fileUrl: /models/tables.gltf
675
+ objectName: AXL_LEG
676
+ dimensionUnit: m
677
+ sceneEntityObjectProperties:
678
+ top:
679
+ offsetY: 820
680
+ morphTargetInfluences:
681
+ Facet:
682
+ value:
683
+ $read: $edgeFinishFacet
684
+ scaleOne: 1
685
+ scaleZero: 0
686
+ Bol:
687
+ value:
688
+ $read: $edgeFinishRound
689
+ scaleOne: 1
690
+ scaleZero: 0
691
+ Boomstamrand:
692
+ value:
693
+ $read: $edgeFinishTreeTrunk
694
+ scaleOne: 1
695
+ scaleZero: 0
696
+ leg:
697
+ morphTargetInfluences:
698
+ Length:
699
+ value: 1000
700
+ scaleOne: 3000
701
+ scaleZero: 1400
702
+ Width:
703
+ value: 700
704
+ scaleOne: 1300
705
+ scaleZero: 600
706
+ Height:
707
+ value: 780
708
+ scaleOne: 780
709
+ scaleZero: 740
710
+
711
+ transformers:
712
+ - name: tree-trunk-delivery
713
+ ```
714
+
715
+ ### ./src/\_shared/EdgeFinishCards.tsx
716
+
717
+ ```tsx
718
+ import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
719
+ import type { KeyboardEvent } from 'react'
720
+
721
+ import { type UseAttributeSelection, useResolveLocalizable } from '@salsita-ai/sdk/react'
722
+
723
+ // Cross-sections of the tabletop's edge, keyed by the option values of the spec.
724
+ const EDGE_PROFILES: Readonly<Record<string, string>> = {
725
+ None: 'M0 4H32V20H0Z',
726
+ Facet: 'M0 4H26L32 10V14L26 20H0Z',
727
+ Round: 'M0 4H24A8 8 0 0 1 24 20H0Z',
728
+ TreeTrunk: 'M0 4H27C33 5 28 9 34 11C29 13 34 17 27 20H0Z',
729
+ }
730
+
731
+ const CHECK_BADGE: SxProps<Theme> = {
732
+ position: 'absolute',
733
+ insetBlockStart: 10,
734
+ insetInlineEnd: 10,
735
+ display: 'grid',
736
+ placeItems: 'center',
737
+ inlineSize: 22,
738
+ blockSize: 22,
739
+ borderRadius: '50%',
740
+ bgcolor: 'primary.main',
741
+ color: 'primary.contrastText',
742
+ fontSize: 13,
743
+ }
744
+
745
+ // Arrow keys move the selection between the cards, as in a native radio group.
746
+ const ARROW_STEPS: Readonly<Record<string, number | undefined>> = {
747
+ ArrowRight: 1,
748
+ ArrowDown: 1,
749
+ ArrowLeft: -1,
750
+ ArrowUp: -1,
751
+ }
752
+
753
+ interface EdgeFinishCardsProps {
754
+ readonly selection: ReturnType<UseAttributeSelection>
755
+ }
756
+
757
+ export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
758
+ const resolve = useResolveLocalizable()
759
+ const { options } = selection
760
+ // The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
761
+ const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
762
+ const focusIndex = selectedIndex >= 0 ? selectedIndex : options.findIndex(option => !option.disabled)
763
+
764
+ const handleKeyDown = (event: KeyboardEvent<HTMLElement>, index: number) => {
765
+ const step = ARROW_STEPS[event.key]
766
+
767
+ if (step === undefined) {
768
+ return
769
+ }
770
+
771
+ event.preventDefault()
772
+ // The next enabled option in the arrow's direction, wrapping around; disabled options are skipped.
773
+ const count = options.length
774
+ const next = Array.from(
775
+ { length: count - 1 },
776
+ (_, offset) => (((index + step * (offset + 1)) % count) + count) % count
777
+ ).find(candidate => !options[candidate]?.disabled)
778
+
779
+ if (next === undefined) {
780
+ return
781
+ }
782
+
783
+ options[next]?.onSelect()
784
+ event.currentTarget.parentElement?.querySelectorAll<HTMLElement>('[role="radio"]')[next]?.focus()
785
+ }
786
+
787
+ return (
788
+ <Box
789
+ component="div"
790
+ role="radiogroup"
791
+ aria-label="Edge finish"
792
+ sx={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 1.5 }}
793
+ >
794
+ {options.map((option, index) => {
795
+ const isSelected = option.value === selection.value
796
+
797
+ return (
798
+ <ButtonBase
799
+ key={String(option.value)}
800
+ role="radio"
801
+ aria-checked={isSelected}
802
+ tabIndex={index === focusIndex ? 0 : -1}
803
+ disabled={option.disabled}
804
+ onClick={option.onSelect}
805
+ onKeyDown={event => handleKeyDown(event, index)}
806
+ sx={{
807
+ position: 'relative',
808
+ display: 'grid',
809
+ justifyItems: 'start',
810
+ gap: 0.5,
811
+ padding: 2,
812
+ borderRadius: 3,
813
+ border: 2,
814
+ borderColor: isSelected ? 'primary.main' : 'divider',
815
+ bgcolor: isSelected ? 'action.hover' : 'transparent',
816
+ textAlign: 'start',
817
+ transition: 'border-color 150ms, background-color 150ms',
818
+ '&:hover': { borderColor: isSelected ? 'primary.main' : 'text.disabled' },
819
+ '&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
820
+ '&.Mui-disabled': { opacity: 0.4 },
821
+ }}
822
+ >
823
+ {isSelected && (
824
+ <Box component="span" aria-hidden sx={CHECK_BADGE}>
825
+ ✓
826
+ </Box>
827
+ )}
828
+ <Box
829
+ component="svg"
830
+ viewBox="0 0 36 24"
831
+ aria-hidden
832
+ sx={{ inlineSize: 60, blockSize: 40, color: '#b98b5e' }}
833
+ >
834
+ <path d={EDGE_PROFILES[String(option.value)]} fill="currentColor" />
835
+ </Box>
836
+ <Typography variant="body2" fontWeight={600}>
837
+ {resolve(option.title)}
838
+ </Typography>
839
+ <Typography variant="caption" color="text.secondary">
840
+ {resolve(option.description)}
841
+ </Typography>
842
+ </ButtonBase>
843
+ )
844
+ })}
845
+ </Box>
846
+ )
847
+ }
848
+ ```
849
+
850
+ ### ./src/\_shared/FullscreenToggle.tsx
851
+
852
+ ```tsx
853
+ import { Button } from '@mui/material'
854
+
855
+ import { phx } from '../../.phoenix/phx.js'
856
+
857
+ const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
858
+ const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
859
+
860
+ export const FullscreenToggle = () => {
861
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
862
+ const setFullscreen = phx.frontend.useSetFullscreen()
863
+
864
+ 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>
886
+ )
887
+ }
888
+ ```
889
+
890
+ ### ./src/\_shared/MessageToast.tsx
891
+
892
+ ```tsx
893
+ import { Alert } from '@mui/material'
894
+ import { useEffect, useState } from 'react'
895
+
896
+ import type { ConfiguratorMessage } from '@salsita-ai/sdk/react'
897
+
898
+ import { phx } from '../../.phoenix/phx.js'
899
+
900
+ const VIOLATION_SEVERITY = { fatal: 'error', fixable: 'error', warning: 'warning', notice: 'info' } as const
901
+ const RANK = { info: 0, warning: 1, error: 2 } as const
902
+ const VISIBLE_MS = 6000
903
+
904
+ const severityOf = (message: ConfiguratorMessage) => {
905
+ if (message.kind === 'violation') {
906
+ return VIOLATION_SEVERITY[message.violation.severity]
907
+ }
908
+
909
+ return message.kind === 'error' ? 'error' : 'info'
910
+ }
911
+
912
+ export const MessageToast = () => {
913
+ const [message, setMessage] = useState<ConfiguratorMessage | null>(null)
914
+
915
+ // A rejected change also reports the notices already present; keep the worst message while it is shown
916
+ phx.frontend.useConfiguratorMessages(next => {
917
+ setMessage(shown => (shown !== null && RANK[severityOf(next)] < RANK[severityOf(shown)] ? shown : next))
918
+ })
919
+
920
+ useEffect(() => {
921
+ if (message === null) {
922
+ return
923
+ }
924
+
925
+ const timeout = setTimeout(() => setMessage(null), VISIBLE_MS)
926
+
927
+ return () => clearTimeout(timeout)
928
+ }, [message])
929
+
930
+ if (message === null) {
931
+ return null
932
+ }
933
+
934
+ return (
935
+ <Alert
936
+ severity={severityOf(message)}
937
+ onClose={() => setMessage(null)}
938
+ sx={{ maxInlineSize: 420, borderRadius: 3, boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)' }}
939
+ >
940
+ {message.text}
941
+ </Alert>
942
+ )
943
+ }
944
+ ```
945
+
946
+ ### ./src/\_shared/ProductPanel.tsx
947
+
948
+ ```tsx
949
+ import { Box, Button, Typography } from '@mui/material'
950
+
951
+ import { detailComponent } from '@salsita-ai/sdk/domain'
952
+ import { useResolveLocalizable } from '@salsita-ai/sdk/react'
953
+
954
+ import { phx } from '../../.phoenix/phx.js'
955
+ import { EdgeFinishCards } from './EdgeFinishCards.js'
956
+
957
+ export const ProductPanel = () => {
958
+ const resolve = useResolveLocalizable()
959
+ const detail = phx.frontend.useFirstRootComponent(detailComponent)
960
+ const price = phx.frontend.useRootEntityPrice()
961
+ const tableId = phx.frontend.useRootEntityId()
962
+ const edgeFinish = phx.frontend.useAttributeSelection(tableId, 'edgeFinish')
963
+ const { accessInfo } = phx.frontend.useAccessService()
964
+ const navigationState = phx.frontend.useActiveNavigationState()
965
+ const pushNavigate = phx.frontend.usePushNavigate()
966
+ const popNavigate = phx.frontend.usePopNavigate()
967
+
968
+ const isReadMode = accessInfo.viewMode
969
+ const isReview = isReadMode || navigationState === 'checkout'
970
+ const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
971
+
972
+ return (
973
+ <>
974
+ <Box component="header" sx={{ display: 'grid', gap: 1, padding: 3, paddingBlockEnd: 2 }}>
975
+ {isReadMode ? (
976
+ <Typography
977
+ variant="overline"
978
+ sx={{ justifySelf: 'start', paddingInline: 1.5, borderRadius: 999, bgcolor: 'action.selected' }}
979
+ >
980
+ View only
981
+ </Typography>
982
+ ) : (
983
+ <Typography variant="overline" color="text.secondary">
984
+ {resolve(detail?.state.subtitle)}
985
+ </Typography>
986
+ )}
987
+ <Typography variant="h5" component="h2" fontWeight={700}>
988
+ {resolve(detail?.state.title)}
989
+ </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} />
1010
+ )}
1011
+ </Box>
1012
+
1013
+ <Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
1014
+ <Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
1015
+ <Typography variant="body2" color="text.secondary">
1016
+ Total price
1017
+ </Typography>
1018
+ <Typography variant="h5" component="p" fontWeight={700}>
1019
+ {price}
1020
+ </Typography>
1021
+ </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'}
1035
+ </Button>
1036
+ )}
1037
+ </Box>
1038
+ </>
1039
+ )
1040
+ }
1041
+ ```
1042
+
1043
+ ### ./src/elements/ConfiguratorLayout.tsx
1044
+
1045
+ ```tsx
1046
+ import { Box } from '@mui/material'
1047
+
1048
+ import { LayoutSlots, useSceneSafeArea } from '@salsita-ai/sdk/configurator'
1049
+
1050
+ import { phx } from '../../.phoenix/phx.js'
1051
+ import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
1052
+ import { MessageToast } from '../_shared/MessageToast.js'
1053
+ import { ProductPanel } from '../_shared/ProductPanel.js'
1054
+
1055
+ const GUTTER = 24
1056
+ const PANEL_WIDTH = 380
1057
+
1058
+ const ConfiguratorLayout = () => {
1059
+ const { containerRef, safeAreaRef } = useSceneSafeArea()
1060
+ const isFullscreen = phx.frontend.useIsFullscreenActive()
1061
+
1062
+ return (
1063
+ <Box component="div" ref={containerRef} sx={{ position: 'absolute', inset: 0 }}>
1064
+ <LayoutSlots.SharedCanvas />
1065
+
1066
+ {!isFullscreen && (
1067
+ <Box
1068
+ component="aside"
1069
+ sx={{
1070
+ position: 'absolute',
1071
+ insetBlockStart: GUTTER,
1072
+ insetInlineStart: GUTTER,
1073
+ inlineSize: PANEL_WIDTH,
1074
+ maxBlockSize: `calc(100% - ${2 * GUTTER}px)`,
1075
+ display: 'flex',
1076
+ flexDirection: 'column',
1077
+ borderRadius: 5,
1078
+ bgcolor: 'background.paper',
1079
+ boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
1080
+ overflow: 'hidden',
1081
+ }}
1082
+ >
1083
+ <ProductPanel />
1084
+ </Box>
1085
+ )}
1086
+
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>
1104
+ <Box
1105
+ component="div"
1106
+ sx={{ position: 'absolute', insetBlockEnd: GUTTER, insetInlineStart: GUTTER, pointerEvents: 'auto' }}
1107
+ >
1108
+ <MessageToast />
1109
+ </Box>
1110
+ </Box>
1111
+ </Box>
1112
+ )
1113
+ }
1114
+
1115
+ export default phx.frontend.createCustomPhoenixLayoutElement('ConfiguratorLayout', ConfiguratorLayout)
1116
+ ```
1117
+
1118
+ ### ./src/expressions/table.ts
1119
+
1120
+ ```ts
1121
+ import { phx } from '../../.phoenix/phx.js'
1122
+
1123
+ const EDGE_FINISH_SURCHARGE = { None: 0, Facet: 90, Round: 120, TreeTrunk: 340 }
1124
+
1125
+ export default phx.domain.implementCustomExpressions({
1126
+ Table: {
1127
+ $price: s => {
1128
+ return 1290 + EDGE_FINISH_SURCHARGE[s.edgeFinish]
1129
+ },
1130
+ $edgeFinishFacet: s => {
1131
+ return s.edgeFinish === 'Facet' ? 1 : 0
1132
+ },
1133
+ $edgeFinishRound: s => {
1134
+ return s.edgeFinish === 'Round' ? 1 : 0
1135
+ },
1136
+ $edgeFinishTreeTrunk: s => {
1137
+ return s.edgeFinish === 'TreeTrunk' ? 1 : 0
1138
+ },
1139
+ },
1140
+ })
1141
+ ```
1142
+
1143
+ ### ./src/transformers/tree-trunk-delivery.ts
1144
+
1145
+ ```ts
1146
+ import { msg } from '@lingui/core/macro'
1147
+
1148
+ import { phx } from '../../.phoenix/phx.js'
1149
+
1150
+ // A tree-trunk edge is cut by hand; choosing it carries a hint, which reaches the layout as a side-effect message
1151
+ export default phx.frontend.transformerBuilder.when
1152
+ .entity(['Table'])
1153
+ .modified({ atFields: ['edgeFinish'] })
1154
+ .then.overrideMatchingUpdate(({ update }) => {
1155
+ if (update.stateDelta.edgeFinish !== 'TreeTrunk') {
1156
+ return [update]
1157
+ }
1158
+
1159
+ return [{ ...update, hint: msg`Tree trunk edges are cut by hand, so delivery takes three weeks longer.` }]
1160
+ })
1161
+ .build('tree-trunk-delivery')
1162
+ ```
1163
+
1164
+ </details>