@salsita-ai/sdk 0.50.0-develop.61e519cfcc → 0.50.0-develop.662fa65a4c
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.
- package/README.md +19 -14
- package/dist/admin/default-admin-elements.d.ts +9 -0
- package/dist/admin/default-admin-elements.js +1 -0
- package/dist/admin/default-elements/built-in-entity-element.d.ts +10 -0
- package/dist/admin/default-elements/built-in-entity-element.js +1 -0
- package/dist/admin/default-elements/built-in-layout-element.d.ts +10 -0
- package/dist/admin/default-elements/built-in-layout-element.js +1 -0
- package/dist/admin/default-elements/index.d.ts +2 -0
- package/dist/admin/default-elements/index.js +1 -0
- package/dist/admin/index.d.ts +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/application-spec/caching/content-diff.js +1 -1
- package/dist/application-spec/core/application-file.d.ts +0 -2
- package/dist/application-spec/core/application-file.js +1 -1
- package/dist/application-spec/errors/diagnostic-codes.d.ts +14 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +15 -1
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/common/code-imports.js +1 -1
- package/dist/application-spec/generate-application/code/common/env-reader.js +2 -2
- package/dist/application-spec/generate-application/code/common/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/common/index.js +1 -1
- package/dist/application-spec/generate-application/code/common/single-quoted-string.d.ts +6 -0
- package/dist/application-spec/generate-application/code/common/single-quoted-string.js +1 -0
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/generate-application-code.d.ts +3 -2
- package/dist/application-spec/generate-application/code/generate-application-code.js +1 -1
- package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +15 -14
- package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
- package/dist/application-spec/generate-application/code/story-files.js +1 -1
- package/dist/application-spec/generate-application/code/templates/admin-config.js +3 -0
- package/dist/application-spec/generate-application/code/templates/application-types.js +6 -6
- package/dist/application-spec/generate-application/code/templates/common/doc-comment.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/common/doc-comment.js +1 -0
- package/dist/application-spec/generate-application/code/templates/common/format-property-key.d.ts +7 -0
- package/dist/application-spec/generate-application/code/templates/common/format-property-key.js +1 -0
- package/dist/application-spec/generate-application/code/templates/common/schema-to-type-string.js +3 -3
- package/dist/application-spec/generate-application/code/templates/configurator-globals.d.ts +2 -1
- package/dist/application-spec/generate-application/code/templates/configurator-globals.js +19 -6
- package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.d.ts +35 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.js +5 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.js +6 -6
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +59 -63
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.d.ts +8 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-invariants.js +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-presets.js +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +13 -13
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.js +2 -2
- package/dist/application-spec/generate-application/code/templates/domain-spec/index.d.ts +2 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/eslint-config.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/eslint-config.js +4 -5
- package/dist/application-spec/generate-application/code/templates/frontend-config.js +3 -5
- package/dist/application-spec/generate-application/code/templates/gitignore.js +0 -3
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.js +7 -7
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.d.ts +12 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.js +7 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.d.ts +43 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +33 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/index.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/global-definition/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/globals.js +24 -44
- package/dist/application-spec/generate-application/code/templates/index.d.ts +3 -2
- package/dist/application-spec/generate-application/code/templates/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/lingui-rc.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/lingui-rc.js +4 -4
- package/dist/application-spec/generate-application/code/templates/prettier-config.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/prettier-config.js +4 -5
- package/dist/application-spec/generate-application/code/templates/root-tsconfig.d.ts +6 -0
- package/dist/application-spec/generate-application/code/templates/root-tsconfig.js +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-feedback-skill.js +5 -5
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +29 -10
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
- package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.d.ts +58 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.js +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/index.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.d.ts +18 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.js +41 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.d.ts +20 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.js +6 -0
- package/dist/application-spec/generate-application/code/templates/story/phx-module.d.ts +8 -2
- package/dist/application-spec/generate-application/code/templates/story/phx-module.js +15 -3
- package/dist/application-spec/generate-application/code/templates/story/wrapper.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/story/wrapper.js +2 -1
- package/dist/application-spec/generate-application/code/templates/tsconfig.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/tsconfig.js +1 -1
- package/dist/application-spec/generate-application/code/templates/webhooks-config.js +2 -3
- package/dist/application-spec/generate-application/implementations/phx-application-types.d.ts +25 -0
- package/dist/application-spec/generate-application/implementations/phx-application-types.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.d.ts +36 -0
- package/dist/application-spec/generate-application/implementations/phx-domain.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx-model.d.ts +24 -0
- package/dist/application-spec/generate-application/implementations/phx-model.js +1 -0
- package/dist/application-spec/generate-application/implementations/phx.d.ts +22 -0
- package/dist/application-spec/generate-application/implementations/phx.js +1 -0
- package/dist/application-spec/generate-application/index.d.ts +1 -0
- package/dist/application-spec/generate-application/index.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +6 -4
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +7 -5
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/admin-runtime/states-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +24 -9
- package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/application-spec-slice.d.ts +70 -0
- package/dist/application-spec/generate-application/runtime/application-spec-slice.js +1 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +7 -5
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +7 -6
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.d.ts +16 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime/configurator-runtime/states-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/index.d.ts +8 -0
- package/dist/application-spec/generate-application/runtime/index.js +1 -0
- package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.d.ts +2 -1
- package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.d.ts +2 -1
- package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +3 -0
- package/dist/application-spec/generate-application/runtime/sections/component-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/data-runtime.d.ts +4 -4
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +15 -6
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.d.ts +9 -5
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.d.ts +3 -1
- package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/theme-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/spec-code/index.d.ts +2 -0
- package/dist/application-spec/generate-application/runtime/spec-code/index.js +1 -0
- package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.d.ts +18 -0
- package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.js +1 -0
- package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.d.ts +17 -0
- package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.js +1 -0
- package/dist/application-spec/generate-application/runtime/spec-runtime.d.ts +21 -0
- package/dist/application-spec/generate-application/runtime/spec-runtime.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.d.ts +9 -0
- package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.d.ts +8 -0
- package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +28 -0
- package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/index.d.ts +5 -0
- package/dist/application-spec/generate-application/runtime-spec/index.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +103 -0
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/spec-code-id.d.ts +40 -0
- package/dist/application-spec/generate-application/runtime-spec/spec-code-id.js +1 -0
- package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +28 -0
- package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.d.ts +16 -0
- package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.js +9 -0
- package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.d.ts +9 -0
- package/dist/application-spec/parse-application-files/categorize/earlier-generated-tsconfig.js +1 -0
- package/dist/application-spec/parse-application-files/raw-spec/parse-yaml-spec-file.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +33 -3
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.d.ts +3 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/index.d.ts +5 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/index.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.d.ts +6 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.d.ts +8 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.d.ts +10 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.d.ts +98 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.d.ts +13 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/index.d.ts +2 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.d.ts +24 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/component-state-type.d.ts +8 -0
- package/dist/application-spec/parse-application-files/spec/components/component-state-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.d.ts +13 -0
- package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/static-entity-id.d.ts +14 -0
- package/dist/application-spec/parse-application-files/spec/components/static-entity-id.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/user-component-entry.d.ts +6 -0
- package/dist/application-spec/parse-application-files/spec/components/user-component-entry.js +1 -1
- package/dist/application-spec/parse-application-files/spec/components/user-components.d.ts +7 -4
- package/dist/application-spec/parse-application-files/spec/components/user-components.js +1 -1
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.d.ts +24 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.js +1 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read.d.ts +13 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read.js +1 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.d.ts +9 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +6 -2
- package/dist/application-spec/parse-application-files/spec/expressions/expressions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.d.ts +3 -1
- package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/invariants/invariants.d.ts +2 -2
- package/dist/application-spec/parse-application-files/spec/invariants/invariants.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.d.ts +10 -0
- package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.js +1 -0
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.d.ts +9 -0
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.js +1 -0
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +4 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
- package/dist/client/phoenix-api.d.ts +367 -0
- package/dist/configurator/ConfiguratorApp.js +1 -1
- package/dist/configurator/app-loader-content/DefaultAppLoaderContent.d.ts +2 -0
- package/dist/configurator/app-loader-content/DefaultAppLoaderContent.js +5 -0
- package/dist/configurator/app-loader-content/index.d.ts +1 -0
- package/dist/configurator/app-loader-content/index.js +1 -0
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +11 -4
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +33 -7
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/camera-control-system/camera-control-system.d.ts +1 -1
- package/dist/configurator/application-runtime/extensions/systems/canvas-system.d.ts +8 -0
- package/dist/configurator/application-runtime/extensions/systems/canvas-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-busy-error.d.ts +8 -0
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-busy-error.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.d.ts +23 -1
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.d.ts +12 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +14 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +46 -5
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.d.ts +14 -5
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/index.d.ts +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +121 -6
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/common/index.d.ts +2 -2
- package/dist/configurator/common/index.js +1 -1
- package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.d.ts +5 -0
- package/dist/configurator/configuration-not-found-page/BuiltInConfigurationNotFoundPage.js +1 -0
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +6 -0
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -0
- package/dist/configurator/configuration-not-found-page/index.d.ts +2 -0
- package/dist/configurator/configuration-not-found-page/index.js +1 -0
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.d.ts +12 -0
- package/dist/configurator/configurator-context/ConfiguratorResponsiveProvider.js +1 -0
- package/dist/configurator/configurator-context/PresetSelectionProvider.js +1 -1
- package/dist/configurator/configurator-context/PreviewContextProvider.js +1 -1
- package/dist/configurator/configurator-context/ViewportStateSync.d.ts +2 -2
- package/dist/configurator/configurator-context/ViewportStateSync.js +1 -1
- package/dist/configurator/configurator-context/configurator-hooks/layout-hooks.d.ts +10 -0
- package/dist/configurator/configurator-context/configurator-routing/ConfiguratorRoutingProvider.js +1 -1
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.d.ts +6 -0
- package/dist/configurator/configurator-error-page/BuiltInConfiguratorErrorPage.js +1 -0
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.d.ts +7 -0
- package/dist/configurator/configurator-error-page/ConfiguratorErrorPageElement.js +1 -0
- package/dist/configurator/configurator-error-page/index.d.ts +2 -0
- package/dist/configurator/configurator-error-page/index.js +1 -0
- package/dist/configurator/index.d.ts +10 -0
- package/dist/configurator/index.js +1 -1
- package/dist/configurator/pages/ConfiguratorErrorPage.d.ts +0 -1
- package/dist/configurator/pages/ConfiguratorErrorPage.js +1 -1
- package/dist/configurator/pages/ConfiguratorNotFoundPage.js +1 -1
- package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +3 -2
- package/dist/configurator/pages/DefaultNotAuthenticatedPage.d.ts +8 -0
- package/dist/configurator/pages/DefaultNotAuthenticatedPage.js +1 -0
- package/dist/configurator/pages/DefaultPresetUi.d.ts +7 -0
- package/dist/configurator/pages/DefaultPresetUi.js +1 -0
- package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
- package/dist/configurator/pages/NewConfiguratorPage.js +1 -1
- package/dist/configurator/pages/PresetCreationErrorPage.d.ts +1 -1
- package/dist/configurator/pages/PresetCreationErrorPage.js +1 -1
- package/dist/configurator/pages/RootPage.js +1 -1
- package/dist/configurator/pages/default-configurator-elements.d.ts +7 -1
- package/dist/configurator/pages/default-configurator-elements.js +1 -1
- package/dist/configurator/pages/default-elements/built-in-entity-element.d.ts +10 -0
- package/dist/configurator/pages/default-elements/built-in-entity-element.js +1 -0
- package/dist/configurator/pages/default-elements/built-in-layout-element.d.ts +10 -0
- package/dist/configurator/pages/default-elements/built-in-layout-element.js +1 -0
- package/dist/configurator/pages/default-elements/domain-control-elements.d.ts +6 -0
- package/dist/configurator/pages/default-elements/domain-control-elements.js +1 -0
- package/dist/configurator/pages/default-elements/index.d.ts +5 -0
- package/dist/configurator/pages/default-elements/index.js +1 -0
- package/dist/configurator/pages/default-elements/recipe-panel-elements.d.ts +3 -0
- package/dist/configurator/pages/default-elements/recipe-panel-elements.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInAddEntityFab.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInAddEntityFab.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInDeleteEntityFab.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInDeleteEntityFab.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInNavigationHotspot.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInNavigationHotspot.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInSelectionHotspot.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInSelectionHotspot.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInToolMenuFab.d.ts +3 -0
- package/dist/configurator/pages/default-elements/scene-controls/BuiltInToolMenuFab.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/index.d.ts +6 -0
- package/dist/configurator/pages/default-elements/scene-controls/index.js +1 -0
- package/dist/configurator/pages/default-elements/scene-controls/scene-control-elements.d.ts +6 -0
- package/dist/configurator/pages/default-elements/scene-controls/scene-control-elements.js +1 -0
- package/dist/configurator/pages/default-elements/sidebar-footer-elements.d.ts +7 -0
- package/dist/configurator/pages/default-elements/sidebar-footer-elements.js +1 -0
- package/dist/configurator/pages/default-elements/toolbar-elements.d.ts +7 -0
- package/dist/configurator/pages/default-elements/toolbar-elements.js +1 -0
- package/dist/configurator/pages/error-boundaries/GeneralErrorBoundary.js +1 -1
- package/dist/configurator/pages/error-boundaries/LoadingErrorBoundary.js +1 -1
- package/dist/configurator/preset-screen-elements/PresetDeviceNotSupportedElement.d.ts +4 -0
- package/dist/configurator/preset-screen-elements/PresetDeviceNotSupportedElement.js +1 -0
- package/dist/configurator/preset-screen-elements/PresetPageActionElement.d.ts +4 -0
- package/dist/configurator/preset-screen-elements/PresetPageActionElement.js +1 -0
- package/dist/configurator/preset-screen-elements/index.d.ts +2 -0
- package/dist/configurator/preset-screen-elements/index.js +1 -0
- package/dist/configurator/scene/index.d.ts +1 -0
- package/dist/configurator/scene/index.js +1 -1
- package/dist/configurator/scene/scene-controls/DeleteEntityFab.js +1 -1
- package/dist/configurator/scene/scene-controls/SelectionHotspot.js +1 -1
- package/dist/configurator/scene/scene-controls/ToolFab.d.ts +4 -0
- package/dist/configurator/scene/scene-controls/ToolFab.js +1 -1
- package/dist/configurator/scene/scene-controls/use-scene-control-tooltip.d.ts +2 -1
- package/dist/configurator/scene/scene-entity/scene-controls/SceneEntityHtmlHotspots.js +1 -1
- package/dist/configurator/toolbar-actions/index.d.ts +3 -0
- package/dist/configurator/toolbar-actions/index.js +1 -0
- package/dist/configurator/toolbar-actions/use-assistant-panel.d.ts +18 -0
- package/dist/configurator/toolbar-actions/use-assistant-panel.js +1 -0
- package/dist/configurator/toolbar-actions/use-measurements.d.ts +35 -0
- package/dist/configurator/toolbar-actions/use-measurements.js +1 -0
- package/dist/configurator/toolbar-actions/use-toolbar-actions.d.ts +100 -0
- package/dist/configurator/toolbar-actions/use-toolbar-actions.js +1 -0
- package/dist/configurator/toolbar-actions/use-toolbar-help.d.ts +7 -0
- package/dist/configurator/toolbar-actions/use-toolbar-help.js +1 -0
- package/dist/configurator/ui/assistant/AssistantChips.d.ts +3 -2
- package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
- package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +7 -2
- package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
- package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
- package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
- package/dist/configurator/ui/assistant/alert/AssistantAlert.d.ts +8 -0
- package/dist/configurator/ui/assistant/alert/AssistantAlert.js +1 -0
- package/dist/configurator/ui/assistant/alert/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/alert/index.js +1 -0
- package/dist/configurator/ui/assistant/alert/remark-alerts.d.ts +10 -0
- package/dist/configurator/ui/assistant/alert/remark-alerts.js +1 -0
- package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +1 -1
- package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -1
- package/dist/configurator/ui/assistant/entity-link/entity-link-state.d.ts +1 -1
- package/dist/configurator/ui/assistant/entity-link/index.d.ts +0 -1
- package/dist/configurator/ui/assistant/entity-link/index.js +1 -1
- package/dist/configurator/ui/assistant/form/AssistantForm.d.ts +19 -0
- package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -0
- package/dist/configurator/ui/assistant/form/compose-answer.d.ts +11 -0
- package/dist/configurator/ui/assistant/form/compose-answer.js +1 -0
- package/dist/configurator/ui/assistant/form/describe-build-errors.d.ts +6 -0
- package/dist/configurator/ui/assistant/form/describe-build-errors.js +1 -0
- package/dist/configurator/ui/assistant/form/form-model.d.ts +37 -0
- package/dist/configurator/ui/assistant/form/form-model.js +1 -0
- package/dist/configurator/ui/assistant/form/form-state.d.ts +4 -0
- package/dist/configurator/ui/assistant/form/form-state.js +1 -0
- package/dist/configurator/ui/assistant/form/index.d.ts +4 -0
- package/dist/configurator/ui/assistant/form/index.js +1 -0
- package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +10 -0
- package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -0
- package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +13 -0
- package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.d.ts +3 -0
- package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.d.ts +31 -0
- package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/form-element-definition.d.ts +16 -0
- package/dist/configurator/ui/assistant/form/registry/form-element-definition.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/form-registry.d.ts +31 -0
- package/dist/configurator/ui/assistant/form/registry/form-registry.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/index.d.ts +6 -0
- package/dist/configurator/ui/assistant/form/registry/index.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/use-form-registry.d.ts +8 -0
- package/dist/configurator/ui/assistant/form/registry/use-form-registry.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormCard.d.ts +9 -0
- package/dist/configurator/ui/assistant/form-elements/FormCard.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormConfirm.d.ts +9 -0
- package/dist/configurator/ui/assistant/form-elements/FormConfirm.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +6 -0
- package/dist/configurator/ui/assistant/form-elements/FormGroup.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormNumber.d.ts +9 -0
- package/dist/configurator/ui/assistant/form-elements/FormNumber.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +6 -0
- package/dist/configurator/ui/assistant/form-elements/FormOptions.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +6 -0
- package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormSwatch.d.ts +10 -0
- package/dist/configurator/ui/assistant/form-elements/FormSwatch.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +6 -0
- package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/clamp-form-number.d.ts +10 -0
- package/dist/configurator/ui/assistant/form-elements/clamp-form-number.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +38 -0
- package/dist/configurator/ui/assistant/form-elements/form-element-props.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/index.d.ts +9 -0
- package/dist/configurator/ui/assistant/form-elements/index.js +1 -0
- package/dist/configurator/ui/assistant/index.d.ts +3 -0
- package/dist/configurator/ui/assistant/index.js +1 -1
- package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.d.ts +16 -0
- package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-link-target.d.ts +34 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-link-target.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.d.ts +25 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/index.d.ts +3 -0
- package/dist/configurator/ui/assistant/reference-link/index.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/reference-styles.d.ts +12 -0
- package/dist/configurator/ui/assistant/reference-link/reference-styles.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.d.ts +8 -0
- package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/AssistantImage.d.ts +9 -0
- package/dist/configurator/ui/assistant/resource-image/AssistantImage.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/index.d.ts +3 -0
- package/dist/configurator/ui/assistant/resource-image/index.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/resource-path.d.ts +2 -0
- package/dist/configurator/ui/assistant/resource-image/resource-path.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.d.ts +5 -0
- package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.js +1 -0
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +9 -0
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -0
- package/dist/configurator/ui/assistant/screenshots/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/screenshots/index.js +1 -0
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +14 -0
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -0
- package/dist/configurator/ui/assistant/streamed-markdown.d.ts +4 -2
- package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
- package/dist/configurator/ui/assistant/thread-items.d.ts +8 -1
- package/dist/configurator/ui/assistant/thread-items.js +1 -1
- package/dist/configurator/ui/assistant/tool-chip.js +1 -1
- package/dist/configurator/ui/assistant/use-follow-stream.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/SharedCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/mobile-tabs/use-mobile-tabs.d.ts +1 -1
- package/dist/configurator/ui/configurator-layout/slots/mobile-tabs/use-mobile-tabs.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/services/Services.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/sidebar-tabs/use-sidebar-tabs.d.ts +1 -1
- package/dist/configurator/ui/configurator-layout/slots/sidebar-tabs/use-sidebar-tabs.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/ExportingOverlay.d.ts +5 -0
- package/dist/configurator/ui/configurator-layout/universal/ExportingOverlay.js +1 -0
- package/dist/configurator/ui/configurator-layout/universal/Layout.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.d.ts +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.d.ts +1 -1
- package/dist/configurator/ui/index.d.ts +1 -0
- package/dist/configurator/ui/index.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/CommonFinalizeButton.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/CommonSummaryButton.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/CommonTopNavigation.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/ReactiveInterfaceLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/ResponsiveFinalizeButton.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/SummaryReadLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/simple/SimpleOwnerLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/simple/SimpleTopNavigation.js +1 -1
- package/dist/configurator/ui/legacy/layout/steps/StepsNavigation.js +1 -1
- package/dist/configurator/ui/legacy/layout/steps/StepsOwnerLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/steps/StepsSidebarFooter.js +1 -1
- package/dist/configurator/ui/legacy/layout/tabs/TabsOwnerLayout.js +1 -1
- package/dist/configurator/ui/legacy/toolbar/common/DimensionUnitSelector.js +1 -1
- package/dist/configurator/ui/legacy/toolbar/common/MeasurementsIndicatorsSwitch.js +1 -1
- package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/FullscreenToolbarAction.js +1 -1
- package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/HelpToolbarAction.js +1 -1
- package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/MeasurementsToolbarAction.js +1 -1
- package/dist/configurator/ui/legacy/toolbar/desktop-toolbar/UndoRedoToolbarGroup.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/AppLoader.d.ts +0 -7
- package/dist/configurator/ui/phoenix-layout-elements/AppLoader.js +2 -6
- package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/EnterFullscreenToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/ExitFullscreenToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/HelpToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LanguageMenuAction.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LanguageToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.d.ts +1 -0
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.d.ts +1 -0
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/MeasurementsMenuAction.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/MeasurementsToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/RedoToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/ShareToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/UndoToolbarButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/back-button/use-go-back-action.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/horizontal-tabs/DesktopHorizontalTabs.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/DesktopNavigationSteps.d.ts +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/DesktopNavigationSteps.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.d.ts +2 -8
- package/dist/configurator/ui/phoenix-layout-elements/header/common/step-navigation/StepsNavigation.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/index.d.ts +8 -1
- package/dist/configurator/ui/phoenix-layout-elements/index.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/measurements/DimensionUnitSelector.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/measurements/MeasurementsIndicatorsSwitch.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/share/ShareModal.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/share/use-share.d.ts +7 -8
- package/dist/configurator/ui/phoenix-layout-elements/share/use-share.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/basic/BasicFinalizeButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/CustomFinalizeButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/EnterSummaryButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/FinalizeActions.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/NextStepButton.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/sidebar-footer/common/PreviousStepButton.js +1 -1
- package/dist/configurator/ui/preset-layout/CategoryPresetUi.js +1 -1
- package/dist/configurator/ui/preset-layout/PresetUi.d.ts +4 -2
- package/dist/configurator/ui/preset-layout/PresetUi.js +1 -1
- package/dist/configurator/ui/preset-layout/index.d.ts +6 -1
- package/dist/configurator/ui/preset-layout/index.js +1 -1
- package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.d.ts +10 -0
- package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -0
- package/dist/configurator/ui/save-message-snackbars/index.d.ts +1 -0
- package/dist/configurator/ui/save-message-snackbars/index.js +1 -0
- package/dist/docs/complex-use-cases/focus-mode.mdx +2 -0
- package/dist/docs/controls/select-child-entity/cardselect.mdx +1 -0
- package/dist/docs/fabs/basic.mdx +6 -2
- package/dist/docs/index.json +95 -1
- package/dist/docs/integrations/webcomponent-api/basics.mdx +2 -0
- package/dist/docs/layouts/custom-layout.mdx +1473 -280
- package/dist/docs/layouts/gallery/ardent-compressor.mdx +3516 -0
- package/dist/docs/layouts/gallery/corvid-drone.mdx +3428 -0
- package/dist/docs/layouts/gallery/fenwick-window.mdx +2803 -0
- package/dist/docs/layouts/gallery/ferrule-bar-station.mdx +6567 -0
- package/dist/docs/layouts/gallery/kestrel-kettle.mdx +1858 -0
- package/dist/docs/layouts/gallery/nightjar-guitar.mdx +3683 -0
- package/dist/docs/layouts/gallery/sunfold-solar.mdx +2683 -0
- package/dist/docs/layouts/gallery/tidepool-aquascape.mdx +5031 -0
- package/dist/docs/other-features/client-side-rendering/declarative.mdx +1 -1
- package/dist/docs/other-features/error-5xx.mdx +1 -1
- package/dist/docs/other-features/navigation-hotspot.mdx +2 -0
- package/dist/docs/other-features/not-found-404.mdx +1 -1
- package/dist/docs/phoenix/clerk-sign-in.mdx +1 -1
- package/dist/docs/phoenix/components.mdx +6 -0
- package/dist/docs/phoenix/configurator-interface.mdx +223 -59
- package/dist/docs/phoenix/deployments.mdx +2 -6
- package/dist/docs/phoenix/domain-model.mdx +2 -0
- package/dist/docs/phoenix/finalization.mdx +1 -1
- package/dist/docs/phoenix/getting-started.mdx +6 -3
- package/dist/docs/phoenix/layout-slots.mdx +23 -23
- package/dist/docs/phoenix/localization.mdx +10 -6
- package/dist/docs/phoenix/migration-guide.mdx +24 -11
- package/dist/docs/phoenix/phoenix-cli.mdx +65 -20
- package/dist/docs/phoenix/project-structure.mdx +66 -32
- package/dist/docs/phoenix/quickstart.mdx +7 -7
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +8 -8
- package/dist/docs/phoenix/sessions-and-access.mdx +2 -0
- package/dist/docs/phoenix/testing.mdx +8 -0
- package/dist/docs/phoenix/webhooks.mdx +4 -4
- package/dist/docs/selection-and-highlight/hotspots.mdx +2 -0
- package/dist/domain/application/assistant/assistant-manifest.d.ts +16 -1
- package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +8 -1
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/form/assistant-form-element-name.d.ts +11 -0
- package/dist/domain/application/assistant/form/assistant-form-element-name.js +8 -0
- package/dist/domain/application/assistant/form/assistant-form-elements.d.ts +174 -0
- package/dist/domain/application/assistant/form/assistant-form-elements.js +1 -0
- package/dist/domain/application/assistant/form/assistant-resource-path.d.ts +10 -0
- package/dist/domain/application/assistant/form/assistant-resource-path.js +1 -0
- package/dist/domain/application/assistant/form/index.d.ts +4 -0
- package/dist/domain/application/assistant/form/index.js +1 -0
- package/dist/domain/application/assistant/generate-assistant-prompt.d.ts +3 -0
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/assistant/index.d.ts +2 -1
- package/dist/domain/application/assistant/index.js +1 -1
- package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -1
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +2 -0
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -1
- package/dist/domain/application/assistant-recipe-groups.d.ts +3 -1
- package/dist/domain/application/standard-properties.js +1 -1
- package/dist/domain/application/web-component-property.d.ts +3 -1
- package/dist/domain/application/web-component-property.js +1 -1
- package/dist/domain/available-system-components.d.ts +1 -1
- package/dist/domain/available-system-components.js +1 -1
- package/dist/domain/core/schema/extended-schema-validator.js +1 -1
- package/dist/domain/domain-builder.d.ts +9 -3
- package/dist/domain/domain-builder.js +1 -1
- package/dist/domain/domain-context/store-system/store-system.d.ts +5 -0
- package/dist/domain/domain-context/store-system/store-system.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-runtime.d.ts +26 -0
- package/dist/domain/domain-runtime/domain-runtime.js +1 -1
- package/dist/domain/domain-runtime/environment/types.d.ts +1 -1
- package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +2 -0
- package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -1
- package/dist/domain/domain-runtime/index.d.ts +1 -1
- package/dist/domain/domain-runtime/index.js +1 -1
- package/dist/domain/domain-runtime/spec/index.d.ts +1 -1
- package/dist/domain/domain-runtime/spec/index.js +1 -1
- package/dist/domain/domain-runtime/spec/initialize.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/element-registration.d.ts +27 -12
- package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/find-assistant-form-element-errors.d.ts +12 -0
- package/dist/domain/domain-runtime/spec/module-checks/find-assistant-form-element-errors.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +3 -1
- package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.d.ts +23 -0
- package/dist/domain/domain-runtime/spec/module-checks/merge-expression-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.d.ts +3 -4
- package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -1
- package/dist/domain/domain-runtime/spec/selectors.d.ts +3 -1
- package/dist/domain/domain-runtime/spec/selectors.js +1 -1
- package/dist/domain/domain-runtime/web-component/actions.d.ts +3 -0
- package/dist/domain/domain-runtime/web-component/actions.js +1 -1
- package/dist/domain/domain-runtime/web-component/initialize.d.ts +1 -0
- package/dist/domain/domain-runtime/web-component/initialize.js +1 -1
- package/dist/domain/domain-runtime/web-component/selectors.d.ts +2 -0
- package/dist/domain/domain-runtime/web-component/selectors.js +1 -1
- package/dist/domain/domain-runtime/web-component/types.d.ts +6 -3
- package/dist/domain/extensions/export-images/agent-screenshot.d.ts +24 -0
- package/dist/domain/extensions/export-images/agent-screenshot.js +1 -0
- package/dist/domain/extensions/{client-side-image.d.ts → export-images/client-side-image.d.ts} +2 -2
- package/dist/domain/extensions/export-images/client-side-image.js +1 -0
- package/dist/domain/extensions/export-images/index.d.ts +3 -0
- package/dist/domain/extensions/export-images/index.js +1 -0
- package/dist/domain/extensions/{save-template-thumbnail.d.ts → export-images/save-template-thumbnail.d.ts} +2 -2
- package/dist/domain/extensions/export-images/save-template-thumbnail.js +1 -0
- package/dist/domain/extensions/index.d.ts +1 -2
- package/dist/domain/extensions/index.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +9 -0
- package/dist/domain/system-components/child-entity-selection.js +1 -1
- package/dist/domain/system-components/common/scene-entity-control-schema.d.ts +3 -0
- package/dist/domain/system-components/common/scene-entity-control-schema.js +1 -1
- package/dist/editor/Editor.d.ts +7 -0
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/apply-spec-update.d.ts +10 -2
- package/dist/editor/domain-editors/apply-spec-update.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +6 -14
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/editor/mocks/CreateMockYaml.js +2 -2
- package/dist/editor/mocks/EditorMockContext.d.ts +2 -0
- package/dist/editor/mocks/EditorMockContext.js +1 -1
- package/dist/editor/screenshot/ScreenshotHandler.js +1 -1
- package/dist/globals/index.d.ts +2 -0
- package/dist/i18n/locales/cs/messages.js +1 -1
- package/dist/i18n/locales/da/messages.js +1 -1
- package/dist/i18n/locales/de/messages.js +1 -1
- package/dist/i18n/locales/de-AT/messages.js +1 -1
- package/dist/i18n/locales/en/messages.js +1 -1
- package/dist/i18n/locales/en-AU/messages.js +1 -1
- package/dist/i18n/locales/en-GB/messages.js +1 -1
- package/dist/i18n/locales/es/messages.js +1 -1
- package/dist/i18n/locales/fr/messages.js +1 -1
- package/dist/i18n/locales/hu/messages.js +1 -1
- package/dist/i18n/locales/it/messages.js +1 -1
- package/dist/i18n/locales/nl/messages.js +1 -1
- package/dist/i18n/locales/pl/messages.js +1 -1
- package/dist/i18n/locales/pt/messages.js +1 -1
- package/dist/i18n/locales/ro/messages.js +1 -1
- package/dist/i18n/locales/sk/messages.js +1 -1
- package/dist/i18n/locales/tr/messages.js +1 -1
- package/dist/legacy/domain-cli/utils/cache.d.ts +1 -1
- package/dist/legacy/domain-cli/utils/cache.js +1 -1
- package/dist/legacy/domain-spec/__generated/domain-schema.d.ts +95 -80
- package/dist/legacy/domain-spec/spec/domain-spec.js +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/claude-md.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/cursor-rules.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.d.ts +1 -1
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/agents/shared-sdk-content.js +11 -5
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +10 -11
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +9 -10
- package/dist/phoenix/application-spec/application-spec-builder.d.ts +0 -2
- package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
- package/dist/phoenix/application-spec/generate-application-spec-project.d.ts +0 -2
- package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
- package/dist/phoenix/application-spec/generate-application-spec-story.js +2 -2
- package/dist/phoenix/application-spec/generate-project-files.d.ts +0 -2
- package/dist/phoenix/application-spec/project-files.js +1 -1
- package/dist/phoenix/bin.d.ts +2 -0
- package/dist/phoenix/bin.js +2 -0
- package/dist/phoenix/check-configs/built-in-eslint-config.d.ts +9 -0
- package/dist/phoenix/check-configs/built-in-eslint-config.js +1 -0
- package/dist/phoenix/check-configs/eslint-config.d.ts +10 -0
- package/dist/phoenix/check-configs/eslint-config.js +1 -0
- package/dist/phoenix/check-configs/index.d.ts +8 -0
- package/dist/phoenix/check-configs/index.js +1 -0
- package/dist/phoenix/check-configs/typescript-project.d.ts +5 -0
- package/dist/phoenix/check-configs/typescript-project.js +1 -0
- package/dist/phoenix/cli.d.ts +0 -1
- package/dist/phoenix/cli.js +1 -2
- package/dist/phoenix/commands/build.js +1 -1
- package/dist/phoenix/commands/check.js +1 -1
- package/dist/phoenix/commands/clean.js +1 -1
- package/dist/phoenix/commands/deploy.js +2 -2
- package/dist/phoenix/commands/deps/deps.d.ts +73 -0
- package/dist/phoenix/commands/deps/deps.js +3 -0
- package/dist/phoenix/commands/deps/index.d.ts +1 -0
- package/dist/phoenix/commands/deps/index.js +1 -0
- package/dist/phoenix/commands/deps/sdk-manifest.d.ts +12 -0
- package/dist/phoenix/commands/deps/sdk-manifest.js +1 -0
- package/dist/phoenix/commands/dev.js +5 -5
- package/dist/phoenix/commands/fix.js +1 -1
- package/dist/phoenix/commands/index.d.ts +1 -0
- package/dist/phoenix/commands/index.js +1 -1
- package/dist/phoenix/commands/init.d.ts +17 -5
- package/dist/phoenix/commands/init.js +1 -1
- package/dist/phoenix/commands/link.js +1 -1
- package/dist/phoenix/commands/prettier.js +1 -1
- package/dist/phoenix/commands/sync.js +1 -1
- package/dist/phoenix/commands/unlink.js +1 -1
- package/dist/phoenix/services/application-spec-project-watcher.d.ts +2 -2
- package/dist/phoenix/services/application-spec-project-watcher.js +2 -2
- package/dist/phoenix/services/lingui.d.ts +8 -0
- package/dist/phoenix/services/lingui.js +1 -1
- package/dist/phoenix/services/swc.js +1 -1
- package/dist/phoenix/services/vite-config.js +1 -1
- package/dist/phoenix/utils/index.d.ts +4 -2
- package/dist/phoenix/utils/index.js +1 -1
- package/dist/phoenix/utils/node-version/index.d.ts +1 -0
- package/dist/phoenix/utils/node-version/index.js +1 -0
- package/dist/phoenix/utils/node-version/supported-node-version.d.ts +12 -0
- package/dist/phoenix/utils/node-version/supported-node-version.js +4 -0
- package/dist/phoenix/utils/package-info.d.ts +0 -9
- package/dist/phoenix/utils/package-info.js +1 -1
- package/dist/phoenix/utils/package-manager/index.d.ts +2 -0
- package/dist/phoenix/utils/package-manager/index.js +1 -0
- package/dist/phoenix/utils/package-manager/package-manager-commands.d.ts +19 -0
- package/dist/phoenix/utils/package-manager/package-manager-commands.js +1 -0
- package/dist/phoenix/utils/package-manager/pnpm-project.d.ts +9 -0
- package/dist/phoenix/utils/package-manager/pnpm-project.js +1 -0
- package/dist/phoenix/utils/run-command.d.ts +11 -0
- package/dist/phoenix/utils/run-command.js +1 -1
- package/dist/phoenix/utils/sdk-tool/index.d.ts +1 -0
- package/dist/phoenix/utils/sdk-tool/index.js +1 -0
- package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.d.ts +15 -0
- package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.js +1 -0
- package/dist/{configurator/common → react-sdk/application-runtime/common-services/analytics}/frontend-analytics.d.ts +4 -0
- package/dist/react-sdk/application-runtime/common-services/analytics/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/common-services/analytics/index.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/index.d.ts +2 -0
- package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/loading/index.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/loading/index.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.d.ts +11 -0
- package/dist/react-sdk/application-runtime/hooks/loading/loader-host-context.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.d.ts +8 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-awaiting-loading-phase.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.d.ts +7 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-is-loader-hosted.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.d.ts +9 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-actions.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.d.ts +24 -0
- package/dist/react-sdk/application-runtime/hooks/loading/use-loading-application.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/index.d.ts +3 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.d.ts +9 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-actions.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.d.ts +26 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.d.ts +10 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-state.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.d.ts +24 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.js +1 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-access-service.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-phoenix-element-slots.d.ts +2 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.d.ts +4 -11
- package/dist/react-sdk/application-runtime/hooks/use-web-component-readonly-sync.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-web-component.d.ts +5 -0
- package/dist/react-sdk/application-runtime/hooks/use-web-component.js +1 -1
- package/dist/react-sdk/application-runtime/host-properties/actions.d.ts +15 -0
- package/dist/react-sdk/application-runtime/host-properties/actions.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.d.ts +30 -0
- package/dist/react-sdk/application-runtime/host-properties/connect-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/domain-host-properties.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.d.ts +21 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-descriptors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.d.ts +42 -0
- package/dist/react-sdk/application-runtime/host-properties/host-property-scopes.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/index.d.ts +8 -0
- package/dist/react-sdk/application-runtime/host-properties/index.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.d.ts +7 -0
- package/dist/react-sdk/application-runtime/host-properties/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +54 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/types.d.ts +18 -0
- package/dist/react-sdk/application-runtime/host-properties/types.js +1 -0
- package/dist/react-sdk/application-runtime/index.d.ts +3 -0
- package/dist/react-sdk/application-runtime/integration/initialize.d.ts +7 -6
- package/dist/react-sdk/application-runtime/integration/initialize.js +1 -1
- package/dist/react-sdk/application-runtime/integration/selectors.d.ts +11 -2
- package/dist/react-sdk/application-runtime/integration/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/integration/types.d.ts +5 -2
- package/dist/react-sdk/application-runtime/loading/actions.d.ts +45 -0
- package/dist/react-sdk/application-runtime/loading/actions.js +1 -0
- package/dist/react-sdk/application-runtime/loading/index.d.ts +4 -0
- package/dist/react-sdk/application-runtime/loading/index.js +1 -0
- package/dist/react-sdk/application-runtime/loading/initialize.d.ts +3 -0
- package/dist/react-sdk/application-runtime/loading/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/loading/selectors.d.ts +18 -0
- package/dist/react-sdk/application-runtime/loading/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/loading/types.d.ts +59 -0
- package/dist/react-sdk/application-runtime/loading/types.js +1 -0
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.d.ts +6 -0
- package/dist/react-sdk/application-runtime/provider/ApplicationRuntime.js +1 -1
- package/dist/react-sdk/application-runtime/provider/ApplicationType.d.ts +7 -0
- package/dist/react-sdk/application-runtime/provider/ApplicationType.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/actions.d.ts +47 -0
- package/dist/react-sdk/application-runtime/responsive/actions.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/index.d.ts +4 -0
- package/dist/react-sdk/application-runtime/responsive/index.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.d.ts +3 -0
- package/dist/react-sdk/application-runtime/responsive/initialize.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.d.ts +20 -0
- package/dist/react-sdk/application-runtime/responsive/selectors.js +1 -0
- package/dist/react-sdk/application-runtime/responsive/types.d.ts +104 -0
- package/dist/react-sdk/application-runtime/responsive/types.js +1 -0
- package/dist/react-sdk/application-runtime/routing/routing-service.d.ts +34 -2
- package/dist/react-sdk/application-runtime/routing/routing-service.js +1 -1
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +296 -4
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/dist/react-sdk/domain-application-context/BackendDataProvider.js +1 -1
- package/dist/react-sdk/domain-application-context/DomainLifecycleBoundary.js +1 -1
- package/dist/react-sdk/domain-application-context/FrontendDataProvider.js +1 -1
- package/dist/react-sdk/domain-application-context/PublishedDataProvider.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/index.d.ts +9 -0
- package/dist/react-sdk/domain-context/common-hooks/index.js +1 -0
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.d.ts +23 -0
- package/dist/react-sdk/domain-context/common-hooks/use-configuration-save-state.js +1 -0
- package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.d.ts +15 -4
- package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +1 -0
- package/dist/react-sdk/domain-context/component-hooks/index.d.ts +1 -0
- package/dist/react-sdk/domain-context/component-hooks/index.js +1 -0
- package/dist/react-sdk/domain-context/component-hooks/use-component.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-domain-entity-state.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-entity-price.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-root-entity-id.js +1 -1
- package/dist/react-sdk/domain-context/entity-hooks/use-root-entity-state.js +1 -1
- package/dist/react-sdk/domain-context/index.d.ts +7 -0
- package/dist/react-sdk/domain-context/index.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/composition-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/dimension-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.d.ts +8 -0
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/hover-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/locale-switch-hooks.d.ts +24 -0
- package/dist/react-sdk/domain-context/system-hooks/locale-switch-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/selection-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/share-links-hooks.d.ts +32 -0
- package/dist/react-sdk/domain-context/system-hooks/share-links-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/step-navigation-hooks.d.ts +57 -0
- package/dist/react-sdk/domain-context/system-hooks/step-navigation-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/tab-navigation-hooks.d.ts +61 -0
- package/dist/react-sdk/domain-context/system-hooks/tab-navigation-hooks.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.d.ts +20 -0
- package/dist/react-sdk/domain-context/system-hooks/undo-redo-hooks.js +1 -0
- package/dist/react-sdk/handlers/FinalizeActionRunner.d.ts +13 -0
- package/dist/react-sdk/handlers/FinalizeActionRunner.js +1 -0
- package/dist/react-sdk/handlers/FinalizeActionsHost.d.ts +10 -0
- package/dist/react-sdk/handlers/FinalizeActionsHost.js +1 -0
- package/dist/react-sdk/handlers/FinalizeActionsProvider.d.ts +11 -0
- package/dist/react-sdk/handlers/FinalizeActionsProvider.js +1 -0
- package/dist/react-sdk/handlers/finalize-actions-context.d.ts +6 -0
- package/dist/react-sdk/handlers/finalize-actions-context.js +1 -0
- package/dist/react-sdk/handlers/finalize-actions-store.d.ts +23 -0
- package/dist/react-sdk/handlers/finalize-actions-store.js +1 -0
- package/dist/react-sdk/handlers/index.d.ts +6 -0
- package/dist/react-sdk/handlers/index.js +1 -1
- package/dist/{configurator/common → react-sdk/handlers}/use-finalize-action.d.ts +3 -2
- package/dist/react-sdk/handlers/use-finalize-action.js +1 -0
- package/dist/react-sdk/handlers/use-finalize-actions.d.ts +53 -0
- package/dist/react-sdk/handlers/use-finalize-actions.js +1 -0
- package/dist/react-sdk/index.d.ts +2 -0
- package/dist/react-sdk/index.js +1 -1
- package/dist/react-sdk/loading-state/LoaderHost.d.ts +20 -0
- package/dist/react-sdk/loading-state/LoaderHost.js +1 -0
- package/dist/react-sdk/loading-state/built-in-loading-phase.d.ts +9 -0
- package/dist/react-sdk/loading-state/built-in-loading-phase.js +1 -0
- package/dist/react-sdk/loading-state/create-app-loader.d.ts +18 -0
- package/dist/react-sdk/loading-state/create-app-loader.js +1 -0
- package/dist/react-sdk/loading-state/index.d.ts +4 -2
- package/dist/react-sdk/loading-state/index.js +1 -1
- package/dist/react-sdk/loading-state/{LoadingStateProvider.d.ts → loading-state-hooks.d.ts} +3 -12
- package/dist/react-sdk/loading-state/loading-state-hooks.js +1 -0
- package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.d.ts +17 -0
- package/dist/react-sdk/page-elements/ConfigurationNotFoundPagePropsProvider.js +1 -0
- package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.d.ts +17 -0
- package/dist/react-sdk/page-elements/ConfiguratorErrorPagePropsProvider.js +1 -0
- package/dist/react-sdk/page-elements/configurator-error-page-props.d.ts +20 -0
- package/dist/react-sdk/page-elements/configurator-error-page-props.js +1 -0
- package/dist/react-sdk/page-elements/create-configuration-not-found-page.d.ts +15 -0
- package/dist/react-sdk/page-elements/create-configuration-not-found-page.js +1 -0
- package/dist/react-sdk/page-elements/create-configurator-error-page.d.ts +14 -0
- package/dist/react-sdk/page-elements/create-configurator-error-page.js +1 -0
- package/dist/react-sdk/page-elements/create-preset-ui.d.ts +9 -0
- package/dist/react-sdk/page-elements/create-preset-ui.js +1 -0
- package/dist/react-sdk/page-elements/index.d.ts +6 -0
- package/dist/react-sdk/page-elements/index.js +1 -0
- package/dist/react-sdk/scene-control-elements/AddEntityFabElement.d.ts +36 -0
- package/dist/react-sdk/scene-control-elements/AddEntityFabElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/DeleteEntityFabElement.d.ts +44 -0
- package/dist/react-sdk/scene-control-elements/DeleteEntityFabElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/NavigationHotspotElement.d.ts +38 -0
- package/dist/react-sdk/scene-control-elements/NavigationHotspotElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/SelectionHotspotElement.d.ts +30 -0
- package/dist/react-sdk/scene-control-elements/SelectionHotspotElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/ToolMenuFabElement.d.ts +30 -0
- package/dist/react-sdk/scene-control-elements/ToolMenuFabElement.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-add-entity-fab.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-add-entity-fab.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-delete-entity-fab.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-delete-entity-fab.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-navigation-hotspot.d.ts +10 -0
- package/dist/react-sdk/scene-control-elements/create-navigation-hotspot.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-selection-hotspot.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-selection-hotspot.js +1 -0
- package/dist/react-sdk/scene-control-elements/create-tool-menu-fab.d.ts +9 -0
- package/dist/react-sdk/scene-control-elements/create-tool-menu-fab.js +1 -0
- package/dist/react-sdk/scene-control-elements/index.d.ts +11 -0
- package/dist/react-sdk/scene-control-elements/index.js +1 -0
- package/dist/react-sdk/scene-control-elements/scene-control-tooltip-visibility.d.ts +5 -0
- package/dist/react-sdk/scene-control-elements/scene-control-tooltip-visibility.js +1 -0
- package/dist/react-sdk/session/NotAuthenticatedPage.d.ts +4 -0
- package/dist/react-sdk/session/NotAuthenticatedPage.js +1 -1
- package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
- package/dist/react-sdk/web-component/create-web-component.js +1 -1
- package/dist/react-sdk/web-component/god-mode/god-mode-registry.d.ts +30 -0
- package/dist/react-sdk/web-component/god-mode/god-mode-registry.js +1 -0
- package/dist/react-sdk/web-component/god-mode/index.d.ts +1 -0
- package/dist/react-sdk/web-component/god-mode/index.js +1 -0
- package/dist/ui-sdk/icons/__generated/Lightbulb.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/Lightbulb.js +1 -0
- package/dist/ui-sdk/icons/__generated/XCircle.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/XCircle.js +1 -0
- package/dist/ui-sdk/icons/__generated/index.d.ts +4 -0
- package/dist/ui-sdk/icons/__generated/index.js +1 -1
- package/dist/ui-sdk/icons/icons-registry.js +1 -1
- package/dist/ui-sdk/responsive-application/ResponsiveApplicationProvider.d.ts +9 -0
- package/dist/ui-sdk/responsive-application/ResponsiveApplicationProvider.js +1 -1
- package/dist/ui-sdk/responsive-application/index.d.ts +1 -0
- package/dist/ui-sdk/responsive-application/responsive-state-store.d.ts +59 -0
- package/dist/ui-sdk/responsive-application/responsive-state-store.js +1 -0
- package/dist/ui-sdk/responsive-application/use-store-responsive-info.d.ts +7 -0
- package/dist/ui-sdk/responsive-application/use-store-responsive-info.js +1 -0
- package/dist/ui-sdk/theme/types.d.ts +5 -1
- package/package.json +58 -36
- package/schema/domain-spec.json +226 -8
- package/dist/application-spec/generate-application/code/templates/nvmrc.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/nvmrc.js +0 -2
- package/dist/application-spec/generate-application/code/templates/package-json.d.ts +0 -10
- package/dist/application-spec/generate-application/code/templates/package-json.js +0 -1
- package/dist/configurator/common/use-finalize-action.js +0 -1
- package/dist/configurator/ui/assistant/entity-link/entity-link-target.d.ts +0 -5
- package/dist/configurator/ui/assistant/entity-link/entity-link-target.js +0 -1
- package/dist/configurator/ui/phoenix-layout-elements/language/use-locale-options.d.ts +0 -4
- package/dist/configurator/ui/phoenix-layout-elements/language/use-locale-options.js +0 -1
- package/dist/configurator/ui/phoenix-layout-elements/measurements/use-measurements-visibility.d.ts +0 -4
- package/dist/configurator/ui/phoenix-layout-elements/measurements/use-measurements-visibility.js +0 -1
- package/dist/domain/extensions/client-side-image.js +0 -1
- package/dist/domain/extensions/save-template-thumbnail.js +0 -1
- package/dist/phoenix/commands/generate-project-files.d.ts +0 -6
- package/dist/phoenix/commands/generate-project-files.js +0 -1
- package/dist/react-sdk/application-runtime/runtime/god-mode.d.ts +0 -19
- package/dist/react-sdk/application-runtime/runtime/god-mode.js +0 -1
- package/dist/react-sdk/loading-state/LoadingStateProvider.js +0 -1
- package/dist/react-sdk/loading-state/loading-state-manager.d.ts +0 -32
- package/dist/react-sdk/loading-state/loading-state-manager.js +0 -1
- /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)
|
|
@@ -8,9 +8,13 @@ Make the configurator look like the brand's own product page. A furniture shop w
|
|
|
8
8
|
- [Read and change the product](#read-and-change-the-product)
|
|
9
9
|
- [Draw the choices](#draw-the-choices)
|
|
10
10
|
- [Offer fullscreen](#offer-fullscreen)
|
|
11
|
+
- [Undo and redo](#undo-and-redo)
|
|
11
12
|
- [Show messages](#show-messages)
|
|
12
13
|
- [Request a quote](#request-a-quote)
|
|
13
14
|
- [Serve read mode](#serve-read-mode)
|
|
15
|
+
- [Fit a phone](#fit-a-phone)
|
|
16
|
+
- [Put a control on the product](#put-a-control-on-the-product)
|
|
17
|
+
- [Control the scene](#control-the-scene)
|
|
14
18
|
- [The spec the layout reads](#the-spec-the-layout-reads)
|
|
15
19
|
- [Try the example](#try-the-example)
|
|
16
20
|
- [Test cases](#test-cases)
|
|
@@ -24,7 +28,7 @@ Write your own layout when the configurator has to follow a design the built-in
|
|
|
24
28
|
|
|
25
29
|
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).
|
|
26
30
|
|
|
27
|
-
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
|
|
31
|
+
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 and the `phx.frontend` hooks that measure the free area, read and change the product's state and record analytics. 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).
|
|
28
32
|
|
|
29
33
|
## Register the layout
|
|
30
34
|
|
|
@@ -32,26 +36,44 @@ Create `src/elements/ConfiguratorLayout.tsx` with a default export made by `phx.
|
|
|
32
36
|
|
|
33
37
|
```tsx
|
|
34
38
|
import { Box } from '@mui/material'
|
|
39
|
+
import { useState } from 'react'
|
|
35
40
|
|
|
36
|
-
import { LayoutSlots
|
|
41
|
+
import { LayoutSlots } from '@salsita-ai/sdk/configurator'
|
|
37
42
|
|
|
38
43
|
import { phx } from '../../.phoenix/phx.js'
|
|
44
|
+
import { BottomSheet } from '../_shared/BottomSheet.js'
|
|
39
45
|
import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
|
|
40
46
|
import { MessageToast } from '../_shared/MessageToast.js'
|
|
41
47
|
import { ProductPanel } from '../_shared/ProductPanel.js'
|
|
48
|
+
import { SceneControls } from '../_shared/SceneControls.js'
|
|
49
|
+
import { UndoRedo } from '../_shared/UndoRedo.js'
|
|
42
50
|
|
|
43
51
|
const GUTTER = 24
|
|
44
52
|
const PANEL_WIDTH = 380
|
|
53
|
+
const PHONE_GUTTER = 16
|
|
54
|
+
const TOUCH_TARGET = 44
|
|
45
55
|
|
|
46
56
|
const ConfiguratorLayout = () => {
|
|
47
|
-
const { containerRef, safeAreaRef } = useSceneSafeArea()
|
|
57
|
+
const { containerRef, safeAreaRef } = phx.frontend.useSceneSafeArea()
|
|
48
58
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
59
|
+
// `null` until the container has been measured; the layout shows only the scene until then
|
|
60
|
+
const viewports = phx.frontend.useActiveViewports()
|
|
61
|
+
const [isSheetOpen, setSheetOpen] = useState(false)
|
|
62
|
+
|
|
63
|
+
const isDesktop = viewports?.includes('desktop') ?? false
|
|
64
|
+
const gutter = isDesktop ? GUTTER : PHONE_GUTTER
|
|
49
65
|
|
|
50
66
|
return (
|
|
51
|
-
<Box
|
|
67
|
+
<Box
|
|
68
|
+
component="div"
|
|
69
|
+
ref={containerRef}
|
|
70
|
+
// `clip`, not `hidden`: what overflows, such as the sheet's fill below its edge, can never be scrolled into view,
|
|
71
|
+
// not even by the browser when the focus moves
|
|
72
|
+
sx={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', overflow: 'clip' }}
|
|
73
|
+
>
|
|
52
74
|
<LayoutSlots.SharedCanvas />
|
|
53
75
|
|
|
54
|
-
{!isFullscreen && (
|
|
76
|
+
{viewports !== null && isDesktop && !isFullscreen && (
|
|
55
77
|
<Box
|
|
56
78
|
component="aside"
|
|
57
79
|
sx={{
|
|
@@ -65,37 +87,80 @@ const ConfiguratorLayout = () => {
|
|
|
65
87
|
borderRadius: 5,
|
|
66
88
|
bgcolor: 'background.paper',
|
|
67
89
|
boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
|
|
68
|
-
|
|
90
|
+
// A very short container, such as a phone held sideways, scrolls the panel instead of clipping its footer
|
|
91
|
+
overflowX: 'hidden',
|
|
92
|
+
overflowY: 'auto',
|
|
93
|
+
overscrollBehavior: 'contain',
|
|
69
94
|
}}
|
|
70
95
|
>
|
|
71
96
|
<ProductPanel />
|
|
72
97
|
</Box>
|
|
73
98
|
)}
|
|
74
99
|
|
|
75
|
-
|
|
76
|
-
component="div"
|
|
77
|
-
ref={safeAreaRef}
|
|
78
|
-
sx={{
|
|
79
|
-
position: 'absolute',
|
|
80
|
-
insetBlock: 0,
|
|
81
|
-
insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
|
|
82
|
-
insetInlineEnd: 0,
|
|
83
|
-
pointerEvents: 'none',
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<Box
|
|
87
|
-
component="div"
|
|
88
|
-
sx={{ position: 'absolute', insetBlockStart: GUTTER, insetInlineEnd: GUTTER, pointerEvents: 'auto' }}
|
|
89
|
-
>
|
|
90
|
-
<FullscreenToggle />
|
|
91
|
-
</Box>
|
|
100
|
+
{viewports !== null && (
|
|
92
101
|
<Box
|
|
93
102
|
component="div"
|
|
94
|
-
|
|
103
|
+
ref={safeAreaRef}
|
|
104
|
+
sx={{
|
|
105
|
+
// Desktop: right of the panel. Phone: above the sheet, whose height the column gives the rest.
|
|
106
|
+
...(isDesktop
|
|
107
|
+
? {
|
|
108
|
+
position: 'absolute',
|
|
109
|
+
insetBlock: 0,
|
|
110
|
+
insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
|
|
111
|
+
insetInlineEnd: 0,
|
|
112
|
+
}
|
|
113
|
+
: { position: 'relative', flex: '1 1 0', minBlockSize: 0 }),
|
|
114
|
+
pointerEvents: 'none',
|
|
115
|
+
}}
|
|
95
116
|
>
|
|
96
|
-
<
|
|
117
|
+
<Box
|
|
118
|
+
component="div"
|
|
119
|
+
sx={{
|
|
120
|
+
position: 'absolute',
|
|
121
|
+
insetBlockStart: gutter,
|
|
122
|
+
insetInlineEnd: gutter,
|
|
123
|
+
display: 'flex',
|
|
124
|
+
gap: 1,
|
|
125
|
+
pointerEvents: 'auto',
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
{!isFullscreen && <UndoRedo />}
|
|
129
|
+
<FullscreenToggle compact={!isDesktop} />
|
|
130
|
+
</Box>
|
|
131
|
+
<Box
|
|
132
|
+
component="div"
|
|
133
|
+
sx={{
|
|
134
|
+
position: 'absolute',
|
|
135
|
+
pointerEvents: 'auto',
|
|
136
|
+
// Desktop: bottom left, above the row of view controls. Phone: at the top below the row of undo, redo and
|
|
137
|
+
// fullscreen, clear of the sheet's handle and the view controls.
|
|
138
|
+
...(isDesktop
|
|
139
|
+
? { insetBlockEnd: 2 * GUTTER + TOUCH_TARGET, insetInlineStart: GUTTER }
|
|
140
|
+
: { insetBlockStart: gutter + TOUCH_TARGET + gutter / 2, insetInline: gutter }),
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<MessageToast />
|
|
144
|
+
</Box>
|
|
145
|
+
{/* A phone in fullscreen keeps only the reset, as the built-in layout does. Below 1024 pixels (`tablet`) the
|
|
146
|
+
free area beside the panel is narrow, so the reset shows only its icon there too. */}
|
|
147
|
+
<Box
|
|
148
|
+
component="div"
|
|
149
|
+
sx={{ position: 'absolute', insetBlockEnd: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
|
|
150
|
+
>
|
|
151
|
+
<SceneControls
|
|
152
|
+
compact={!isDesktop || (viewports?.includes('tablet') ?? false)}
|
|
153
|
+
resetOnly={!isDesktop && isFullscreen}
|
|
154
|
+
/>
|
|
155
|
+
</Box>
|
|
97
156
|
</Box>
|
|
98
|
-
|
|
157
|
+
)}
|
|
158
|
+
|
|
159
|
+
{viewports !== null && !isDesktop && !isFullscreen && (
|
|
160
|
+
<BottomSheet open={isSheetOpen} onOpenChange={setSheetOpen} label="Product details">
|
|
161
|
+
<ProductPanel collapsed={!isSheetOpen} inSheet />
|
|
162
|
+
</BottomSheet>
|
|
163
|
+
)}
|
|
99
164
|
</Box>
|
|
100
165
|
)
|
|
101
166
|
}
|
|
@@ -108,12 +173,13 @@ The components it uses live in `src/_shared/`, which Phoenix does not import by
|
|
|
108
173
|
## What the layout has to do
|
|
109
174
|
|
|
110
175
|
- **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`.
|
|
111
|
-
- **Mount the shared canvas.**
|
|
176
|
+
- **Mount the shared canvas.** It renders the scene, and the app loader stays on screen until the scene has loaded. A layout without a canvas is not held by the loader: it leaves once the configuration is up.
|
|
112
177
|
- **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.
|
|
113
|
-
- **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.
|
|
178
|
+
- **Tell the camera where the free area is.** `phx.frontend.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.
|
|
114
179
|
- **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.
|
|
115
|
-
- **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
|
|
116
|
-
- **
|
|
180
|
+
- **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.
|
|
181
|
+
- **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 `phx.frontend.useActiveViewports()` and renders a desktop or a phone arrangement, see [Fit a phone](#fit-a-phone).
|
|
182
|
+
- **Serve read mode.** The same element renders a configuration shared for viewing, or one the host page opens read-only, and the layout decides what a viewer sees; see [Serve read mode](#serve-read-mode).
|
|
117
183
|
|
|
118
184
|
## Read and change the product
|
|
119
185
|
|
|
@@ -122,8 +188,7 @@ The panel reads everything it shows from hooks and writes the customer's choice
|
|
|
122
188
|
```tsx
|
|
123
189
|
import { Box, Button, Typography } from '@mui/material'
|
|
124
190
|
|
|
125
|
-
import { detailComponent
|
|
126
|
-
import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
|
|
191
|
+
import { detailComponent } from '@salsita-ai/sdk/domain'
|
|
127
192
|
|
|
128
193
|
import { phx } from '../../.phoenix/phx.js'
|
|
129
194
|
import { EdgeFinishCards } from './EdgeFinishCards.js'
|
|
@@ -131,8 +196,15 @@ import { ReviewActions } from './ReviewActions.js'
|
|
|
131
196
|
|
|
132
197
|
const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
|
|
133
198
|
|
|
134
|
-
|
|
135
|
-
|
|
199
|
+
interface ProductPanelProps {
|
|
200
|
+
// Only the name, the price and the action, for a collapsed bottom sheet
|
|
201
|
+
readonly collapsed?: boolean
|
|
202
|
+
// In a bottom sheet the cards region keeps the top of the cards in view, and the sheet scrolls when that does not fit
|
|
203
|
+
readonly inSheet?: boolean
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
|
|
207
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
136
208
|
const detail = phx.frontend.useFirstRootComponent(detailComponent)
|
|
137
209
|
const price = phx.frontend.useRootEntityPrice()
|
|
138
210
|
const tableId = phx.frontend.useRootEntityId()
|
|
@@ -142,12 +214,9 @@ export const ProductPanel = () => {
|
|
|
142
214
|
const pushNavigate = phx.frontend.usePushNavigate()
|
|
143
215
|
const popNavigate = phx.frontend.usePopNavigate()
|
|
144
216
|
const navigate = phx.frontend.useNavigate()
|
|
145
|
-
const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
|
|
146
217
|
|
|
147
218
|
const isReadMode = accessInfo.viewMode
|
|
148
219
|
const isReview = isReadMode || navigationState !== 'configure'
|
|
149
|
-
// The spec's primary finalize action, or its first one
|
|
150
|
-
const quoteAction = finalizeActions.find(action => action.state.variant === 'primary') ?? finalizeActions[0]
|
|
151
220
|
const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
|
|
152
221
|
|
|
153
222
|
return (
|
|
@@ -168,29 +237,44 @@ export const ProductPanel = () => {
|
|
|
168
237
|
<Typography variant="h5" component="h2" fontWeight={700}>
|
|
169
238
|
{resolve(detail?.state.title)}
|
|
170
239
|
</Typography>
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<Box component="div" sx={{ display: 'grid', gap: 1.5, paddingInline: 3, paddingBlockEnd: 3, overflowY: 'auto' }}>
|
|
177
|
-
<Typography variant="subtitle2" component="h3">
|
|
178
|
-
Edge finish
|
|
179
|
-
</Typography>
|
|
180
|
-
{isReview ? (
|
|
181
|
-
<Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
|
|
182
|
-
<Typography variant="body2" fontWeight={600}>
|
|
183
|
-
{resolve(chosenEdge?.title)}
|
|
184
|
-
</Typography>
|
|
185
|
-
<Typography variant="caption" color="text.secondary">
|
|
186
|
-
{resolve(chosenEdge?.description)}
|
|
187
|
-
</Typography>
|
|
188
|
-
</Box>
|
|
189
|
-
) : (
|
|
190
|
-
<EdgeFinishCards selection={edgeFinish} />
|
|
240
|
+
{!collapsed && (
|
|
241
|
+
<Typography variant="body2" color="text.secondary">
|
|
242
|
+
{resolve(detail?.state.description)}
|
|
243
|
+
</Typography>
|
|
191
244
|
)}
|
|
192
245
|
</Box>
|
|
193
246
|
|
|
247
|
+
{!collapsed && (
|
|
248
|
+
<Box
|
|
249
|
+
component="div"
|
|
250
|
+
sx={{
|
|
251
|
+
display: 'grid',
|
|
252
|
+
gap: 1.5,
|
|
253
|
+
paddingInline: 3,
|
|
254
|
+
paddingBlockEnd: 3,
|
|
255
|
+
// In a short container the region shrinks and scrolls; a scroll past its end moves its container on
|
|
256
|
+
minBlockSize: inSheet ? 120 : 0,
|
|
257
|
+
overflowY: 'auto',
|
|
258
|
+
}}
|
|
259
|
+
>
|
|
260
|
+
<Typography variant="subtitle2" component="h3">
|
|
261
|
+
Edge finish
|
|
262
|
+
</Typography>
|
|
263
|
+
{isReview ? (
|
|
264
|
+
<Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
|
|
265
|
+
<Typography variant="body2" fontWeight={600}>
|
|
266
|
+
{resolve(chosenEdge?.title)}
|
|
267
|
+
</Typography>
|
|
268
|
+
<Typography variant="caption" color="text.secondary">
|
|
269
|
+
{resolve(chosenEdge?.description)}
|
|
270
|
+
</Typography>
|
|
271
|
+
</Box>
|
|
272
|
+
) : (
|
|
273
|
+
<EdgeFinishCards selection={edgeFinish} />
|
|
274
|
+
)}
|
|
275
|
+
</Box>
|
|
276
|
+
)}
|
|
277
|
+
|
|
194
278
|
<Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
|
|
195
279
|
<Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
|
|
196
280
|
<Typography variant="body2" color="text.secondary">
|
|
@@ -210,19 +294,7 @@ export const ProductPanel = () => {
|
|
|
210
294
|
<Typography variant="body2" color="text.secondary">
|
|
211
295
|
Your table is ready for a quote. A real shop collects the contact details here.
|
|
212
296
|
</Typography>
|
|
213
|
-
{
|
|
214
|
-
<PhoenixHandlerBoundary name={quoteAction.state.handler}>
|
|
215
|
-
<ReviewActions
|
|
216
|
-
handler={quoteAction.state.handler}
|
|
217
|
-
label={resolve(quoteAction.state.label)}
|
|
218
|
-
onBack={popNavigate}
|
|
219
|
-
/>
|
|
220
|
-
</PhoenixHandlerBoundary>
|
|
221
|
-
) : (
|
|
222
|
-
<Button size="large" variant="outlined" onClick={popNavigate} sx={BUTTON_SX}>
|
|
223
|
-
Back to the configuration
|
|
224
|
-
</Button>
|
|
225
|
-
)}
|
|
297
|
+
<ReviewActions onBack={popNavigate} />
|
|
226
298
|
</>
|
|
227
299
|
)}
|
|
228
300
|
{!isReadMode && navigationState === 'requested' && (
|
|
@@ -241,22 +313,26 @@ export const ProductPanel = () => {
|
|
|
241
313
|
}
|
|
242
314
|
```
|
|
243
315
|
|
|
244
|
-
| Hook | What the layout uses it for
|
|
245
|
-
| ---------------------------------------------------------------------------- |
|
|
246
|
-
| `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.
|
|
247
|
-
| `phx.frontend.useRootEntityId()` | The id of the table, which the control hooks take.
|
|
248
|
-
| `phx.frontend.useAttributeSelection(entityId, instanceName)` | The `attributeSelection` component named `edgeFinish`: the current `value` and the `options`, each with `title`, `description`, `value`, `disabled` and `onSelect`.
|
|
249
|
-
| `phx.frontend.useRootEntityPrice()` | The root entity's `price` component, formatted for the current locale and currency, or `null` without one.
|
|
250
|
-
| `phx.frontend.
|
|
251
|
-
| `phx.frontend.
|
|
252
|
-
| `phx.frontend.
|
|
253
|
-
| `phx.frontend.
|
|
254
|
-
| `phx.frontend.
|
|
255
|
-
| `phx.frontend.
|
|
256
|
-
| `phx.frontend.
|
|
257
|
-
| `phx.frontend.
|
|
258
|
-
| `
|
|
259
|
-
| `
|
|
316
|
+
| Hook | What the layout uses it for |
|
|
317
|
+
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
318
|
+
| `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. |
|
|
319
|
+
| `phx.frontend.useRootEntityId()` | The id of the table, which the control hooks take. |
|
|
320
|
+
| `phx.frontend.useAttributeSelection(entityId, instanceName)` | The `attributeSelection` component named `edgeFinish`: the current `value` and the `options`, each with `title`, `description`, `value`, `disabled` and `onSelect`. |
|
|
321
|
+
| `phx.frontend.useRootEntityPrice()` | The root entity's `price` component, formatted for the current locale and currency, or `null` without one. |
|
|
322
|
+
| `phx.frontend.useResolveLocalizable()` | Turns the localizable texts of the spec into strings in the current language. [Localization](?path=/docs/phoenix-localization--docs) describes it, `phx.frontend.useLocalizable(text)` and `LocalizableMessage`. |
|
|
323
|
+
| `phx.frontend.useAccessService()` | `accessInfo.viewMode` is `true` while a configuration shared for viewing is open, and also while the host sets the `readonly` property; see [Serve read mode](#serve-read-mode). |
|
|
324
|
+
| `phx.frontend.useActiveNavigationState()` | The active navigation state; the panel shows its review step while it is `checkout`. |
|
|
325
|
+
| `phx.frontend.usePushNavigate()` and `phx.frontend.usePopNavigate()` | Enter the review step and leave it again. |
|
|
326
|
+
| `phx.frontend.useNavigate()` | Return from the confirmation to the configuration, forgetting the review step. |
|
|
327
|
+
| `phx.frontend.useFinalizeActions()` | The spec's `finalizeAction` components with what a button needs; the review step offers the `primary` one and runs it, with its pending state, its error and whether finalizing is possible; see [Request a quote](#request-a-quote). |
|
|
328
|
+
| `phx.frontend.useUndoRedo()` | Whether there is a change to undo or redo, and `undo` and `redo`, for the layout's own buttons; see [Undo and redo](#undo-and-redo). |
|
|
329
|
+
| `phx.frontend.useIsFullscreenActive()` and `phx.frontend.useSetFullscreen()` | Read the fullscreen flag, and set it from the layout's own button. |
|
|
330
|
+
| `phx.frontend.useAnalytics()` | Record the fullscreen button's click as the built-in button does; see [Offer fullscreen](#offer-fullscreen). |
|
|
331
|
+
| `phx.frontend.useSceneSafeArea()` | The two refs that tell the camera which part of the canvas the panel or the sheet leaves free; see [What the layout has to do](#what-the-layout-has-to-do). |
|
|
332
|
+
| `phx.frontend.useActiveViewports()` | 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). |
|
|
333
|
+
| `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). |
|
|
334
|
+
| `phx.frontend.useResetCamera()` | Move the camera back to the framing of the active camera, undoing the customer's orbit, pan and zoom. |
|
|
335
|
+
| `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). |
|
|
260
336
|
|
|
261
337
|
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`.
|
|
262
338
|
|
|
@@ -270,7 +346,9 @@ The edge finish is a visual choice, so the panel shows it as cards with a drawin
|
|
|
270
346
|
import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
|
|
271
347
|
import type { KeyboardEvent } from 'react'
|
|
272
348
|
|
|
273
|
-
import {
|
|
349
|
+
import type { UseAttributeSelection } from '@salsita-ai/sdk/react'
|
|
350
|
+
|
|
351
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
274
352
|
|
|
275
353
|
// Cross-sections of the tabletop's edge, keyed by the option values of the spec.
|
|
276
354
|
const EDGE_PROFILES: Readonly<Record<string, string>> = {
|
|
@@ -307,7 +385,7 @@ interface EdgeFinishCardsProps {
|
|
|
307
385
|
}
|
|
308
386
|
|
|
309
387
|
export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
|
|
310
|
-
const resolve = useResolveLocalizable()
|
|
388
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
311
389
|
const { options } = selection
|
|
312
390
|
// The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
|
|
313
391
|
const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
|
|
@@ -403,51 +481,143 @@ The drawings are keyed by the option values of the spec. A spec can carry a pict
|
|
|
403
481
|
|
|
404
482
|
## Offer fullscreen
|
|
405
483
|
|
|
406
|
-
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.
|
|
484
|
+
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. Before it flips the flag, the button records the click with `phx.frontend.useAnalytics().push(FrontendAnalyticsFactory.FullScreenModeToggled())`, the event the built-in fullscreen button records, so the shop's analytics count fullscreen the same way with either layout. `FrontendAnalyticsFactory` comes from `@salsita-ai/sdk/configurator`.
|
|
407
485
|
|
|
408
486
|
```tsx
|
|
409
|
-
import { Button } from '@mui/material'
|
|
487
|
+
import { Button, Tooltip } from '@mui/material'
|
|
488
|
+
|
|
489
|
+
import { FrontendAnalyticsFactory } from '@salsita-ai/sdk/configurator'
|
|
410
490
|
|
|
411
491
|
import { phx } from '../../.phoenix/phx.js'
|
|
412
492
|
|
|
413
493
|
const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
|
|
414
494
|
const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
|
|
415
495
|
|
|
416
|
-
|
|
496
|
+
interface FullscreenToggleProps {
|
|
497
|
+
// Only the icon, with the label as its accessible name and tooltip, where a label would cover the product
|
|
498
|
+
readonly compact?: boolean
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
|
|
417
502
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
418
503
|
const setFullscreen = phx.frontend.useSetFullscreen()
|
|
504
|
+
const analytics = phx.frontend.useAnalytics()
|
|
505
|
+
const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
|
|
506
|
+
const icon = (
|
|
507
|
+
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
508
|
+
<path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
|
|
509
|
+
</svg>
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
// The same event the built-in fullscreen button records, for entering and for leaving
|
|
513
|
+
const toggle = () => {
|
|
514
|
+
analytics.push(FrontendAnalyticsFactory.FullScreenModeToggled())
|
|
515
|
+
setFullscreen(!isFullscreen)
|
|
516
|
+
}
|
|
419
517
|
|
|
420
518
|
return (
|
|
421
|
-
<
|
|
422
|
-
|
|
423
|
-
|
|
519
|
+
<Tooltip title={compact ? label : ''}>
|
|
520
|
+
<Button
|
|
521
|
+
onClick={toggle}
|
|
522
|
+
aria-label={compact ? label : undefined}
|
|
523
|
+
startIcon={compact ? undefined : icon}
|
|
524
|
+
sx={{
|
|
525
|
+
minBlockSize: 44,
|
|
526
|
+
minInlineSize: 44,
|
|
527
|
+
paddingInline: compact ? 0 : 2.5,
|
|
528
|
+
borderRadius: 999,
|
|
529
|
+
bgcolor: 'background.paper',
|
|
530
|
+
color: 'text.primary',
|
|
531
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
532
|
+
textTransform: 'none',
|
|
533
|
+
fontWeight: 600,
|
|
534
|
+
'&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
|
|
535
|
+
}}
|
|
536
|
+
>
|
|
537
|
+
{compact ? icon : label}
|
|
538
|
+
</Button>
|
|
539
|
+
</Tooltip>
|
|
540
|
+
)
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
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.
|
|
545
|
+
|
|
546
|
+
## Undo and redo
|
|
547
|
+
|
|
548
|
+
The customer tries the four finishes against each other, so the layout offers **Undo** and **Redo** at the top right of the free area, beside the fullscreen button. `phx.frontend.useUndoRedo()` returns `canUndo` and `canRedo`, whether the history has a change to undo or to redo, and `undo` and `redo`, which change the configuration back or forward as the built-in toolbar's buttons do and push the same analytics events:
|
|
549
|
+
|
|
550
|
+
```tsx
|
|
551
|
+
import { Box, IconButton, Tooltip } from '@mui/material'
|
|
552
|
+
|
|
553
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
554
|
+
|
|
555
|
+
const UNDO_ICON = 'M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11'
|
|
556
|
+
const REDO_ICON = 'M15 14l5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13'
|
|
557
|
+
|
|
558
|
+
interface HistoryButtonProps {
|
|
559
|
+
readonly label: string
|
|
560
|
+
readonly icon: string
|
|
561
|
+
readonly enabled: boolean
|
|
562
|
+
readonly onClick: () => void
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
const HistoryButton = ({ label, icon, enabled, onClick }: HistoryButtonProps) => (
|
|
566
|
+
<Tooltip title={label}>
|
|
567
|
+
{/* A disabled button fires no pointer events, so the span keeps the tooltip working */}
|
|
568
|
+
<span>
|
|
569
|
+
<IconButton
|
|
570
|
+
aria-label={label}
|
|
571
|
+
disabled={!enabled}
|
|
572
|
+
onClick={onClick}
|
|
573
|
+
sx={{ inlineSize: 44, blockSize: 44, color: 'text.primary' }}
|
|
574
|
+
>
|
|
424
575
|
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
425
|
-
<path d={
|
|
576
|
+
<path d={icon} />
|
|
426
577
|
</svg>
|
|
427
|
-
|
|
578
|
+
</IconButton>
|
|
579
|
+
</span>
|
|
580
|
+
</Tooltip>
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
// Undo and redo for the customer's choices. They change the configuration, so they are offered only where the cards
|
|
584
|
+
// are: not to a viewer, and not in the review step, where the summary and a running request must not change under the
|
|
585
|
+
// customer. `useUndoRedo` pushes the same analytics events as the built-in toolbar's buttons.
|
|
586
|
+
export const UndoRedo = () => {
|
|
587
|
+
const { canUndo, canRedo, undo, redo } = phx.frontend.useUndoRedo()
|
|
588
|
+
const { accessInfo } = phx.frontend.useAccessService()
|
|
589
|
+
const navigationState = phx.frontend.useActiveNavigationState()
|
|
590
|
+
|
|
591
|
+
if (accessInfo.viewMode || navigationState !== 'configure') {
|
|
592
|
+
return null
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return (
|
|
596
|
+
<Box
|
|
597
|
+
component="div"
|
|
598
|
+
role="group"
|
|
599
|
+
aria-label="History"
|
|
428
600
|
sx={{
|
|
429
|
-
|
|
430
|
-
paddingInline: 2.5,
|
|
601
|
+
display: 'flex',
|
|
431
602
|
borderRadius: 999,
|
|
432
603
|
bgcolor: 'background.paper',
|
|
433
|
-
color: 'text.primary',
|
|
434
604
|
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
435
|
-
textTransform: 'none',
|
|
436
|
-
fontWeight: 600,
|
|
437
|
-
'&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
|
|
438
605
|
}}
|
|
439
606
|
>
|
|
440
|
-
|
|
441
|
-
|
|
607
|
+
<HistoryButton label="Undo" icon={UNDO_ICON} enabled={canUndo} onClick={undo} />
|
|
608
|
+
<HistoryButton label="Redo" icon={REDO_ICON} enabled={canRedo} onClick={redo} />
|
|
609
|
+
</Box>
|
|
442
610
|
)
|
|
443
611
|
}
|
|
444
612
|
```
|
|
445
613
|
|
|
446
|
-
|
|
614
|
+
- Each choice of a finish is one step of the history, whether it is made on the cards or on the button on the table's edge; undoing it moves the check mark back, changes the edge back and restores the price.
|
|
615
|
+
- Each button is disabled while there is nothing to undo or redo, and keeps its tooltip and accessible name. A disabled MUI button receives no pointer events, so a `span` around it carries the tooltip.
|
|
616
|
+
- The hook does not look at read mode or at the navigation state. The buttons change the configuration, so the component renders them only while the cards are shown: not to a viewer, not in the review step, where the summary and a running request must not change under the customer, and not in the confirmation. The layout also leaves them out in fullscreen, which gives the canvas to the product and keeps only the controls placed on it or for looking at it. The button on the table's edge stays there and still changes the finish; the history keeps that change, so **Undo** undoes it after fullscreen is left.
|
|
447
617
|
|
|
448
618
|
## Show messages
|
|
449
619
|
|
|
450
|
-
When a change is rejected because it breaks an invariant, when a committed change carries a hint,
|
|
620
|
+
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, below the row of buttons, on a phone:
|
|
451
621
|
|
|
452
622
|
```tsx
|
|
453
623
|
import { Alert } from '@mui/material'
|
|
@@ -466,7 +636,7 @@ const severityOf = (message: ConfiguratorMessage) => {
|
|
|
466
636
|
return VIOLATION_SEVERITY[message.violation.severity]
|
|
467
637
|
}
|
|
468
638
|
|
|
469
|
-
return message.kind === 'error' ? 'error' : 'info'
|
|
639
|
+
return message.kind === 'error' || message.kind === 'saveError' ? 'error' : 'info'
|
|
470
640
|
}
|
|
471
641
|
|
|
472
642
|
export const MessageToast = () => {
|
|
@@ -503,7 +673,7 @@ export const MessageToast = () => {
|
|
|
503
673
|
}
|
|
504
674
|
```
|
|
505
675
|
|
|
506
|
-
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 `'
|
|
676
|
+
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.
|
|
507
677
|
|
|
508
678
|
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:
|
|
509
679
|
|
|
@@ -526,7 +696,7 @@ export default phx.frontend.transformerBuilder.when
|
|
|
526
696
|
.build('tree-trunk-delivery')
|
|
527
697
|
```
|
|
528
698
|
|
|
529
|
-
[Configurator Interface → Loaded Configuration UI](?path=/docs/phoenix-configurator-interface--docs#loaded-configuration-ui) lists the messages the hook does not deliver:
|
|
699
|
+
[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.
|
|
530
700
|
|
|
531
701
|
## Request a quote
|
|
532
702
|
|
|
@@ -564,7 +734,7 @@ export default phx.frontend.createPhoenixHandler('requestQuote', () => {
|
|
|
564
734
|
|
|
565
735
|
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()`.
|
|
566
736
|
|
|
567
|
-
The
|
|
737
|
+
The review step offers the spec's primary finalize action, or the first one when none is primary, with `phx.frontend.useFinalizeActions()`. The hook lists the active `finalizeAction` components with what a button needs, the label and the title resolved to the customer's language, and runs their handlers itself, beside the layout, so the buttons need no handler boundary and the component may be called anywhere and as often as the layout likes. **Back to the configuration** lives in the same component, so it can be disabled while the request is pending.
|
|
568
738
|
|
|
569
739
|
```tsx
|
|
570
740
|
import { Alert, Box, Button, CircularProgress, Typography } from '@mui/material'
|
|
@@ -574,39 +744,40 @@ import { phx } from '../../.phoenix/phx.js'
|
|
|
574
744
|
const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
|
|
575
745
|
|
|
576
746
|
interface ReviewActionsProps {
|
|
577
|
-
readonly handler: string
|
|
578
|
-
readonly label: string
|
|
579
747
|
readonly onBack: () => void
|
|
580
748
|
}
|
|
581
749
|
|
|
582
|
-
// The review step's buttons:
|
|
583
|
-
//
|
|
584
|
-
//
|
|
585
|
-
//
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
const
|
|
750
|
+
// The review step's buttons: the spec's primary finalize action and the way back. `useFinalizeActions` runs the
|
|
751
|
+
// action's handler beside the layout, so its pending state and error outlive this component: when the panel unmounts,
|
|
752
|
+
// as in fullscreen, the request goes on and the remounted buttons still show it. Back is disabled while the request
|
|
753
|
+
// is pending, so the customer cannot change the configuration while it is sent.
|
|
754
|
+
export const ReviewActions = ({ onBack }: ReviewActionsProps) => {
|
|
755
|
+
const { primary, hints } = phx.frontend.useFinalizeActions()
|
|
756
|
+
const isPending = primary?.isPending ?? false
|
|
589
757
|
|
|
590
758
|
return (
|
|
591
759
|
<Box component="div" sx={{ display: 'grid', gap: 2 }}>
|
|
592
|
-
|
|
593
|
-
<
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
760
|
+
{primary && (
|
|
761
|
+
<Box component="div" sx={{ display: 'grid', gap: 1 }}>
|
|
762
|
+
<Button
|
|
763
|
+
size="large"
|
|
764
|
+
variant="contained"
|
|
765
|
+
disabled={primary.disabled || isPending}
|
|
766
|
+
onClick={() => void primary.run()}
|
|
767
|
+
title={primary.title}
|
|
768
|
+
startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
|
|
769
|
+
sx={BUTTON_SX}
|
|
770
|
+
>
|
|
771
|
+
{isPending ? 'Sending the request…' : primary.label}
|
|
772
|
+
</Button>
|
|
773
|
+
{primary.disabled && hints && (
|
|
774
|
+
<Typography variant="caption" color="text.secondary">
|
|
775
|
+
{hints}
|
|
776
|
+
</Typography>
|
|
777
|
+
)}
|
|
778
|
+
{primary.error && <Alert severity="error">The request could not be sent: {primary.error.message}</Alert>}
|
|
779
|
+
</Box>
|
|
780
|
+
)}
|
|
610
781
|
<Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
|
|
611
782
|
Back to the configuration
|
|
612
783
|
</Button>
|
|
@@ -615,20 +786,487 @@ export const ReviewActions = ({ handler, label, onBack }: ReviewActionsProps) =>
|
|
|
615
786
|
}
|
|
616
787
|
```
|
|
617
788
|
|
|
618
|
-
- `
|
|
619
|
-
-
|
|
620
|
-
- `
|
|
621
|
-
- `
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
789
|
+
- `primary` is the first `'primary'` action, or else the first action, or `null` when the spec has none; the component then shows only **Back to the configuration**. `secondary` holds the others, which this product does not have.
|
|
790
|
+
- `run()` records the finalize-button click for analytics and runs the handler; it does nothing while `disabled` or `isPending`, and returns a promise that never rejects.
|
|
791
|
+
- 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. The configurator keeps `isPending` and `error` while the layout's components unmount: entering fullscreen during the request removes the panel, and the panel shown after fullscreen still shows the spinner until the handler settles.
|
|
792
|
+
- `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.
|
|
793
|
+
- `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.
|
|
794
|
+
|
|
795
|
+
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 `phx.frontend.useFinalizeAction(handler)`, which runs one known action inside the layout instead, and [Finalization](?path=/docs/phoenix-finalization--docs) what a real flow does on the server.
|
|
796
|
+
|
|
797
|
+
## Serve read mode
|
|
798
|
+
|
|
799
|
+
A configuration is in read mode by one of two routes, and the layout does not need to know which:
|
|
800
|
+
|
|
801
|
+
- **A configuration shared for viewing.** The configuration is opened with `read-revision` access, as a viewer of a shared link opens it. The `read` mock template sets that access, and the **Read Mode** story below opens it.
|
|
802
|
+
- **The host page sets `readonly`.** The page that embeds the configurator sets the web component's `readonly` property, here on a configuration the user owns. The mock template `mocks/readonly-host.yaml`, **Host sets readonly** in the editor's **Mocks** panel, keeps `access: owner` and sets the property with `webComponentProperties: { readonly: true }`.
|
|
803
|
+
|
|
804
|
+
Both routes set `accessInfo.viewMode` to `true`, and both switch the spec's filter mode to read, so a component filtered with `$filter.modes: [owner]` is left out either way. While `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; neither the finalize action nor undo and redo are offered, since `useFinalizeActions` and `useUndoRedo` do not check read mode themselves. 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).
|
|
805
|
+
|
|
806
|
+
A viewer of a shared configuration has no way here to edit a copy of it; see **Clone to edit in read mode** in [Known gaps](#known-gaps).
|
|
807
|
+
|
|
808
|
+
## Fit a phone
|
|
809
|
+
|
|
810
|
+
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.
|
|
811
|
+
|
|
812
|
+
**The switch.** `phx.frontend.useActiveViewports()` 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.
|
|
813
|
+
|
|
814
|
+
| Value | When it is active |
|
|
815
|
+
| ----------- | ---------------------------------------------------------------------------------- |
|
|
816
|
+
| `phone` | The container is narrower than 480 pixels. |
|
|
817
|
+
| `mobile` | The container is at most 768 pixels wide. |
|
|
818
|
+
| `tablet` | The container is wider than 480 and narrower than 1024 pixels. |
|
|
819
|
+
| `desktop` | The container is wider than 768 pixels; `mobile` and `desktop` exclude each other. |
|
|
820
|
+
| `landscape` | The browser window, not the container, is wider than it is high. |
|
|
821
|
+
| `portrait` | The browser window, not the container, is higher than it is wide. |
|
|
822
|
+
|
|
823
|
+
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.
|
|
824
|
+
|
|
825
|
+
**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.
|
|
826
|
+
|
|
827
|
+
```tsx
|
|
828
|
+
import { Box, ButtonBase } from '@mui/material'
|
|
829
|
+
import { type MouseEvent, type PointerEvent, type ReactNode, useRef } from 'react'
|
|
830
|
+
|
|
831
|
+
// A drag shorter than this is a tap, and the handle's click toggles the sheet
|
|
832
|
+
const TAP_DISTANCE = 6
|
|
833
|
+
// A drag that ends this far from where it started snaps to the other position
|
|
834
|
+
const SNAP_DISTANCE = 48
|
|
835
|
+
// A drag faster than this, in pixels per millisecond, snaps in its direction even when it is short
|
|
836
|
+
const SNAP_VELOCITY = 0.5
|
|
837
|
+
// How far the sheet follows the finger towards the position it is already in
|
|
838
|
+
const OVERDRAG = 0.25
|
|
839
|
+
|
|
840
|
+
interface BottomSheetProps {
|
|
841
|
+
readonly open: boolean
|
|
842
|
+
readonly onOpenChange: (open: boolean) => void
|
|
843
|
+
readonly label: string
|
|
844
|
+
readonly children: ReactNode
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
interface Drag {
|
|
848
|
+
readonly startY: number
|
|
849
|
+
readonly startTime: number
|
|
850
|
+
delta: number
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// A persistent sheet at the bottom of the layout with two positions, open and collapsed. It is not a modal: the scene
|
|
854
|
+
// above it stays interactive. Its height comes from its content, so the layout's safe area ends where the sheet
|
|
855
|
+
// starts and changes only when the sheet snaps. While the handle is dragged the sheet follows the finger with a
|
|
856
|
+
// transform, which the safe area does not see, so the camera refits once per snap and not on every move.
|
|
857
|
+
export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheetProps) => {
|
|
858
|
+
const sheetRef = useRef<HTMLElement>(null)
|
|
859
|
+
const dragRef = useRef<Drag | null>(null)
|
|
860
|
+
const draggedRef = useRef(false)
|
|
861
|
+
|
|
862
|
+
const moveSheet = (offset: number, animate: boolean) => {
|
|
863
|
+
if (sheetRef.current) {
|
|
864
|
+
sheetRef.current.style.transition = animate ? 'transform 200ms ease-out' : 'none'
|
|
865
|
+
sheetRef.current.style.transform = offset === 0 ? '' : `translateY(${offset}px)`
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
const handlePointerDown = (event: PointerEvent<HTMLButtonElement>) => {
|
|
870
|
+
event.currentTarget.setPointerCapture(event.pointerId)
|
|
871
|
+
dragRef.current = { startY: event.clientY, startTime: event.timeStamp, delta: 0 }
|
|
872
|
+
draggedRef.current = false
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
const handlePointerMove = (event: PointerEvent<HTMLButtonElement>) => {
|
|
876
|
+
const drag = dragRef.current
|
|
877
|
+
|
|
878
|
+
if (drag === null) {
|
|
879
|
+
return
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
drag.delta = event.clientY - drag.startY
|
|
883
|
+
// Down closes an open sheet and up opens a collapsed one; the other direction only gives a little
|
|
884
|
+
const towardsOther = open ? drag.delta > 0 : drag.delta < 0
|
|
885
|
+
moveSheet(towardsOther ? drag.delta : drag.delta * OVERDRAG, false)
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
const handlePointerEnd = (event: PointerEvent<HTMLButtonElement>) => {
|
|
889
|
+
const drag = dragRef.current
|
|
890
|
+
dragRef.current = null
|
|
891
|
+
|
|
892
|
+
if (drag === null) {
|
|
893
|
+
return
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
moveSheet(0, true)
|
|
897
|
+
|
|
898
|
+
if (Math.abs(drag.delta) < TAP_DISTANCE) {
|
|
899
|
+
return
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
draggedRef.current = true
|
|
903
|
+
const velocity = drag.delta / Math.max(event.timeStamp - drag.startTime, 1)
|
|
904
|
+
const flicked = Math.abs(drag.delta) >= SNAP_DISTANCE || Math.abs(velocity) >= SNAP_VELOCITY
|
|
905
|
+
|
|
906
|
+
if (flicked && (open ? drag.delta > 0 : drag.delta < 0)) {
|
|
907
|
+
onOpenChange(!open)
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
// A tap, Enter or Space toggles the sheet. The pointer click that ends a drag has already been handled; a keyboard
|
|
912
|
+
// click (`detail` 0) always toggles, also after a touch drag that was followed by no click.
|
|
913
|
+
const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
|
|
914
|
+
const dragged = draggedRef.current
|
|
915
|
+
draggedRef.current = false
|
|
916
|
+
|
|
917
|
+
if (dragged && event.detail !== 0) {
|
|
918
|
+
return
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
onOpenChange(!open)
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
return (
|
|
925
|
+
<Box
|
|
926
|
+
component="section"
|
|
927
|
+
ref={sheetRef}
|
|
928
|
+
aria-label={label}
|
|
929
|
+
sx={{
|
|
930
|
+
position: 'relative',
|
|
931
|
+
flexShrink: 0,
|
|
932
|
+
display: 'flex',
|
|
933
|
+
flexDirection: 'column',
|
|
934
|
+
maxBlockSize: '55%',
|
|
935
|
+
paddingBlockEnd: 'env(safe-area-inset-bottom)',
|
|
936
|
+
borderStartStartRadius: 20,
|
|
937
|
+
borderStartEndRadius: 20,
|
|
938
|
+
bgcolor: 'background.paper',
|
|
939
|
+
boxShadow: '0 -8px 32px rgba(0, 0, 0, 0.12)',
|
|
940
|
+
// Fills the gap below the sheet while it is dragged up
|
|
941
|
+
'&::after': {
|
|
942
|
+
content: '""',
|
|
943
|
+
position: 'absolute',
|
|
944
|
+
insetInline: 0,
|
|
945
|
+
insetBlockStart: '100%',
|
|
946
|
+
blockSize: '100vh',
|
|
947
|
+
bgcolor: 'background.paper',
|
|
948
|
+
},
|
|
949
|
+
}}
|
|
950
|
+
>
|
|
951
|
+
<ButtonBase
|
|
952
|
+
aria-expanded={open}
|
|
953
|
+
disableRipple
|
|
954
|
+
aria-label={open ? `Collapse ${label.toLowerCase()}` : `Expand ${label.toLowerCase()}`}
|
|
955
|
+
onClick={handleClick}
|
|
956
|
+
onPointerDown={handlePointerDown}
|
|
957
|
+
onPointerMove={handlePointerMove}
|
|
958
|
+
onPointerUp={handlePointerEnd}
|
|
959
|
+
onPointerCancel={handlePointerEnd}
|
|
960
|
+
sx={{
|
|
961
|
+
flexShrink: 0,
|
|
962
|
+
blockSize: 36,
|
|
963
|
+
touchAction: 'none',
|
|
964
|
+
'&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: -4, borderRadius: 3 },
|
|
965
|
+
}}
|
|
966
|
+
>
|
|
967
|
+
<Box component="span" sx={{ inlineSize: 40, blockSize: 4, borderRadius: 2, bgcolor: 'text.disabled' }} />
|
|
968
|
+
</ButtonBase>
|
|
969
|
+
{/* A column, so the panel's cards region shrinks first and the price and action stay in view; below the cards
|
|
970
|
+
region's minimum height the content scrolls as a whole, as the review step does on a short phone */}
|
|
971
|
+
<Box
|
|
972
|
+
component="div"
|
|
973
|
+
sx={{
|
|
974
|
+
display: 'flex',
|
|
975
|
+
flexDirection: 'column',
|
|
976
|
+
flex: '1 1 auto',
|
|
977
|
+
minBlockSize: 0,
|
|
978
|
+
overflowY: 'auto',
|
|
979
|
+
overscrollBehavior: 'contain',
|
|
980
|
+
}}
|
|
981
|
+
>
|
|
982
|
+
{children}
|
|
983
|
+
</Box>
|
|
984
|
+
</Box>
|
|
985
|
+
)
|
|
986
|
+
}
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
- 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.
|
|
990
|
+
- 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.
|
|
991
|
+
- While the handle is dragged the sheet follows the finger with a `transform`. `phx.frontend.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.
|
|
992
|
+
- 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.
|
|
993
|
+
|
|
994
|
+
**What else moves.** The toast sits at the top of the free area, below the row of undo, redo and fullscreen buttons, 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. Fullscreen removes the sheet as it removes the panel on a desktop. The sheet keeps its position while fullscreen is on.
|
|
995
|
+
|
|
996
|
+
**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:
|
|
997
|
+
|
|
998
|
+
```yaml
|
|
999
|
+
components:
|
|
1000
|
+
Table:
|
|
1001
|
+
fitRootPerspectiveCamera:
|
|
1002
|
+
main:
|
|
1003
|
+
priority: 2
|
|
1004
|
+
fov: 35
|
|
1005
|
+
near: 100
|
|
1006
|
+
far: 10000
|
|
1007
|
+
minDistance: 1000
|
|
1008
|
+
maxDistance: 9000
|
|
1009
|
+
distance: 5000
|
|
1010
|
+
azimuthAngle: 1.5
|
|
1011
|
+
polarAngle: 1.1
|
|
1012
|
+
fitMeshChanges: true
|
|
1013
|
+
$filter:
|
|
1014
|
+
viewports: [desktop]
|
|
1015
|
+
phone:
|
|
1016
|
+
priority: 1
|
|
1017
|
+
fov: 35
|
|
1018
|
+
near: 100
|
|
1019
|
+
far: 10000
|
|
1020
|
+
minDistance: 1000
|
|
1021
|
+
maxDistance: 12000
|
|
1022
|
+
distance: 8000
|
|
1023
|
+
azimuthAngle: 1.5
|
|
1024
|
+
polarAngle: 1.1
|
|
1025
|
+
fitMeshChanges: true
|
|
1026
|
+
$filter:
|
|
1027
|
+
viewports: [mobile]
|
|
1028
|
+
```
|
|
1029
|
+
|
|
1030
|
+
## Put a control on the product
|
|
1031
|
+
|
|
1032
|
+
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.
|
|
1033
|
+
|
|
1034
|
+
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:
|
|
1035
|
+
|
|
1036
|
+
```yaml
|
|
1037
|
+
components:
|
|
1038
|
+
Table:
|
|
1039
|
+
htmlHotspot:
|
|
1040
|
+
edgeFinish:
|
|
1041
|
+
name: EdgeFinishHotspot
|
|
1042
|
+
offsetX: 500
|
|
1043
|
+
offsetY: 800
|
|
1044
|
+
offsetZ: 0
|
|
1045
|
+
$filter:
|
|
1046
|
+
modes: [owner]
|
|
1047
|
+
navigationStates: [configure]
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
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:
|
|
1051
|
+
|
|
1052
|
+
```tsx
|
|
1053
|
+
import { Box, ButtonBase, Popover, Tooltip } from '@mui/material'
|
|
1054
|
+
import { useState } from 'react'
|
|
1055
|
+
|
|
1056
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
1057
|
+
import { EdgeFinishCards } from '../_shared/EdgeFinishCards.js'
|
|
1058
|
+
|
|
1059
|
+
// The edge profile the button shows, the square edge of the cards' drawings
|
|
1060
|
+
const EDGE_ICON = 'M3 7H17L21 11V13L17 17H3Z'
|
|
1061
|
+
|
|
1062
|
+
// Rendered by the spec's `htmlHotspot` on the table's edge: a button on the product that opens the edge finishes
|
|
1063
|
+
// next to the edge, with the same cards as the panel. The spec's `$filter` decides when it is shown.
|
|
1064
|
+
export default phx.frontend.createCustomPhoenixEntityElement('EdgeFinishHotspot', ({ entityId }) => {
|
|
1065
|
+
const edgeFinish = phx.frontend.useAttributeSelection(entityId, 'edgeFinish')
|
|
1066
|
+
const [anchor, setAnchor] = useState<HTMLElement | null>(null)
|
|
1067
|
+
|
|
1068
|
+
return (
|
|
1069
|
+
<>
|
|
1070
|
+
<Tooltip title="Edge finish">
|
|
1071
|
+
<ButtonBase
|
|
1072
|
+
aria-label="Edge finish"
|
|
1073
|
+
aria-haspopup="dialog"
|
|
1074
|
+
aria-expanded={anchor !== null}
|
|
1075
|
+
onClick={event => setAnchor(event.currentTarget)}
|
|
1076
|
+
sx={{
|
|
1077
|
+
display: 'grid',
|
|
1078
|
+
placeItems: 'center',
|
|
1079
|
+
inlineSize: 44,
|
|
1080
|
+
blockSize: 44,
|
|
1081
|
+
borderRadius: '50%',
|
|
1082
|
+
bgcolor: 'background.paper',
|
|
1083
|
+
color: 'primary.main',
|
|
1084
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
|
|
1085
|
+
'&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
|
|
1086
|
+
}}
|
|
1087
|
+
>
|
|
1088
|
+
<svg viewBox="0 0 24 24" width={22} height={22} aria-hidden>
|
|
1089
|
+
<path d={EDGE_ICON} fill="currentColor" />
|
|
1090
|
+
</svg>
|
|
1091
|
+
</ButtonBase>
|
|
1092
|
+
</Tooltip>
|
|
1093
|
+
<Popover
|
|
1094
|
+
open={anchor !== null}
|
|
1095
|
+
anchorEl={anchor}
|
|
1096
|
+
onClose={() => setAnchor(null)}
|
|
1097
|
+
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
|
|
1098
|
+
transformOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
|
1099
|
+
slotProps={{
|
|
1100
|
+
paper: { role: 'dialog', 'aria-label': 'Edge finish', sx: { borderRadius: 4, marginBlockStart: -1 } },
|
|
1101
|
+
}}
|
|
1102
|
+
>
|
|
1103
|
+
<Box component="div" sx={{ inlineSize: 340, maxInlineSize: 'calc(100vw - 32px)', padding: 2 }}>
|
|
1104
|
+
<EdgeFinishCards selection={edgeFinish} />
|
|
1105
|
+
</Box>
|
|
1106
|
+
</Popover>
|
|
1107
|
+
</>
|
|
1108
|
+
)
|
|
1109
|
+
})
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
- 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.
|
|
1113
|
+
- 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.
|
|
1114
|
+
- 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.
|
|
1115
|
+
- `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.
|
|
1116
|
+
- 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.
|
|
1117
|
+
|
|
1118
|
+
[Html Hotspots](?path=/docs/controls-scene-html-hotspots--docs) describes the component and its other properties.
|
|
1119
|
+
|
|
1120
|
+
The SDK's own controls on the product, such as `sceneEntityAddFab` and `sceneEntitySelectHotspot`, keep the SDK's look in a project layout too. Each is rendered through an entity element of its own name, so a project gives it the brand's look by registering that name, for example with `phx.frontend.createAddEntityFab`; see [Configurator Interface → In-Scene Controls](?path=/docs/phoenix-configurator-interface--docs#in-scene-controls). `htmlHotspot` is for a control the SDK has none of, like this one.
|
|
1121
|
+
|
|
1122
|
+
## Control the scene
|
|
1123
|
+
|
|
1124
|
+
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.
|
|
1125
|
+
|
|
1126
|
+
**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:
|
|
1127
|
+
|
|
1128
|
+
```yaml
|
|
1129
|
+
viewStates:
|
|
1130
|
+
- overview
|
|
1131
|
+
- edge
|
|
1132
|
+
|
|
1133
|
+
components:
|
|
1134
|
+
Table:
|
|
1135
|
+
fitRootPerspectiveCamera:
|
|
1136
|
+
edge:
|
|
1137
|
+
priority: 4
|
|
1138
|
+
fov: 35
|
|
1139
|
+
near: 100
|
|
1140
|
+
far: 10000
|
|
1141
|
+
minDistance: 800
|
|
1142
|
+
maxDistance: 9000
|
|
1143
|
+
distance: 2000
|
|
1144
|
+
azimuthAngle: 0.5
|
|
1145
|
+
polarAngle: 1.15
|
|
1146
|
+
fitMeshChanges: true
|
|
1147
|
+
$filter:
|
|
1148
|
+
viewports: [desktop]
|
|
1149
|
+
viewStates: [edge]
|
|
1150
|
+
edgePhone:
|
|
1151
|
+
priority: 3
|
|
1152
|
+
fov: 35
|
|
1153
|
+
near: 100
|
|
1154
|
+
far: 10000
|
|
1155
|
+
minDistance: 800
|
|
1156
|
+
maxDistance: 12000
|
|
1157
|
+
distance: 3000
|
|
1158
|
+
azimuthAngle: 0.5
|
|
1159
|
+
polarAngle: 1.15
|
|
1160
|
+
fitMeshChanges: true
|
|
1161
|
+
$filter:
|
|
1162
|
+
viewports: [mobile]
|
|
1163
|
+
viewStates: [edge]
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
**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:
|
|
1167
|
+
|
|
1168
|
+
```tsx
|
|
1169
|
+
import { Box, Button, Tooltip } from '@mui/material'
|
|
1170
|
+
|
|
1171
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
1172
|
+
|
|
1173
|
+
// The spec's view states, each with the label of the button that shows it
|
|
1174
|
+
const VIEWS = [
|
|
1175
|
+
{ state: 'overview', label: 'Whole table' },
|
|
1176
|
+
{ state: 'edge', label: 'Edge close-up' },
|
|
1177
|
+
] as const
|
|
1178
|
+
|
|
1179
|
+
const RESET_ICON = 'M4 12a8 8 0 1 0 2.4-5.7M4 4v4h4'
|
|
1180
|
+
|
|
1181
|
+
const SURFACE_SX = {
|
|
1182
|
+
borderRadius: 999,
|
|
1183
|
+
bgcolor: 'background.paper',
|
|
1184
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
1185
|
+
} as const
|
|
1186
|
+
|
|
1187
|
+
const BUTTON_SX = {
|
|
1188
|
+
minBlockSize: 44,
|
|
1189
|
+
minInlineSize: 44,
|
|
1190
|
+
borderRadius: 999,
|
|
1191
|
+
textTransform: 'none',
|
|
1192
|
+
fontWeight: 600,
|
|
1193
|
+
whiteSpace: 'nowrap',
|
|
1194
|
+
} as const
|
|
1195
|
+
|
|
1196
|
+
interface SceneControlsProps {
|
|
1197
|
+
// The reset button shows only its icon, with its label as tooltip and accessible name
|
|
1198
|
+
readonly compact?: boolean
|
|
1199
|
+
// Only the reset button, without the view buttons
|
|
1200
|
+
readonly resetOnly?: boolean
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
// The layout's own camera controls: one button per view state of the spec, and a reset that undoes an orbit
|
|
1204
|
+
export const SceneControls = ({ compact = false, resetOnly = false }: SceneControlsProps) => {
|
|
1205
|
+
const activeView = phx.frontend.useActiveViewState()
|
|
1206
|
+
const setViewState = phx.frontend.useSetViewState()
|
|
1207
|
+
const resetCamera = phx.frontend.useResetCamera()
|
|
1208
|
+
const resetIcon = (
|
|
1209
|
+
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
1210
|
+
<path d={RESET_ICON} />
|
|
1211
|
+
</svg>
|
|
1212
|
+
)
|
|
1213
|
+
|
|
1214
|
+
return (
|
|
1215
|
+
<Box component="div" sx={{ display: 'flex', gap: 1 }}>
|
|
1216
|
+
{!resetOnly && (
|
|
1217
|
+
<Box component="div" role="group" aria-label="View" sx={{ ...SURFACE_SX, display: 'flex' }}>
|
|
1218
|
+
{VIEWS.map(view => {
|
|
1219
|
+
const isActive = activeView === view.state
|
|
1220
|
+
|
|
1221
|
+
return (
|
|
1222
|
+
<Button
|
|
1223
|
+
key={view.state}
|
|
1224
|
+
aria-pressed={isActive}
|
|
1225
|
+
onClick={() => setViewState(view.state)}
|
|
1226
|
+
sx={{
|
|
1227
|
+
...BUTTON_SX,
|
|
1228
|
+
paddingInline: 2,
|
|
1229
|
+
bgcolor: isActive ? 'text.primary' : 'transparent',
|
|
1230
|
+
color: isActive ? 'background.paper' : 'text.primary',
|
|
1231
|
+
'&:hover': { bgcolor: isActive ? 'text.primary' : 'action.hover' },
|
|
1232
|
+
}}
|
|
1233
|
+
>
|
|
1234
|
+
{view.label}
|
|
1235
|
+
</Button>
|
|
1236
|
+
)
|
|
1237
|
+
})}
|
|
1238
|
+
</Box>
|
|
1239
|
+
)}
|
|
1240
|
+
<Tooltip title={compact ? 'Reset view' : ''}>
|
|
1241
|
+
<Button
|
|
1242
|
+
onClick={resetCamera}
|
|
1243
|
+
aria-label={compact ? 'Reset view' : undefined}
|
|
1244
|
+
startIcon={compact ? undefined : resetIcon}
|
|
1245
|
+
sx={{
|
|
1246
|
+
...SURFACE_SX,
|
|
1247
|
+
...BUTTON_SX,
|
|
1248
|
+
paddingInline: compact ? 0 : 2,
|
|
1249
|
+
color: 'text.primary',
|
|
1250
|
+
'&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
|
|
1251
|
+
}}
|
|
1252
|
+
>
|
|
1253
|
+
{compact ? resetIcon : 'Reset view'}
|
|
1254
|
+
</Button>
|
|
1255
|
+
</Tooltip>
|
|
1256
|
+
</Box>
|
|
1257
|
+
)
|
|
1258
|
+
}
|
|
1259
|
+
```
|
|
1260
|
+
|
|
1261
|
+
- 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.
|
|
1262
|
+
- 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.
|
|
1263
|
+
- 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.
|
|
1264
|
+
- 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.
|
|
1265
|
+
- The hooks need no `viewControls` component. That component configures the built-in layout's view controls and has no effect here.
|
|
628
1266
|
|
|
629
1267
|
## The spec the layout reads
|
|
630
1268
|
|
|
631
|
-
The layout reads four components of the root entity and its navigation states; the scene components are in the complete implementation below.
|
|
1269
|
+
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`.
|
|
632
1270
|
|
|
633
1271
|
```yaml
|
|
634
1272
|
navigationStates:
|
|
@@ -636,6 +1274,10 @@ navigationStates:
|
|
|
636
1274
|
- checkout
|
|
637
1275
|
- requested
|
|
638
1276
|
|
|
1277
|
+
viewStates:
|
|
1278
|
+
- overview
|
|
1279
|
+
- edge
|
|
1280
|
+
|
|
639
1281
|
components:
|
|
640
1282
|
Table:
|
|
641
1283
|
detail:
|
|
@@ -680,34 +1322,52 @@ transformers:
|
|
|
680
1322
|
|
|
681
1323
|
## Try the example
|
|
682
1324
|
|
|
683
|
-
|
|
1325
|
+
Each story names the mock template it opens with `args: { mockTemplate }`: **Example** and **Phone** open `default-user`, and **Read Mode** opens `read`. A template applied from the **Mocks** panel lasts until the story is opened again.
|
|
1326
|
+
|
|
1327
|
+
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.
|
|
684
1328
|
|
|
685
1329
|
## Test cases
|
|
686
1330
|
|
|
687
1331
|
- The panel is on the left and the table is centred in the area to the right of it, not in the whole canvas.
|
|
688
1332
|
- 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.
|
|
689
|
-
- 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.
|
|
1333
|
+
- 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.
|
|
690
1334
|
- Tab reaches the selected card, and the arrow keys move the selection to the next or previous card.
|
|
691
1335
|
- Dragging in the area to the right of the panel orbits the camera.
|
|
692
1336
|
- **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.
|
|
693
1337
|
- **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.
|
|
694
1338
|
- **Fullscreen** removes the panel and the table moves to the centre of the canvas; **Exit fullscreen** brings both back.
|
|
695
|
-
-
|
|
1339
|
+
- In the **Read Mode** story the panel says **View only**, shows the chosen finish and the price, and has no button, so no quote can be requested; **Undo**, **Redo** and the button on the table's edge are not shown, and **Fullscreen**, the view buttons and **Reset view** work.
|
|
1340
|
+
- Applying **Host sets readonly** from the **Mocks** panel in the **Example** story shows the same read mode: **View only**, the chosen finish, no button in the panel, no **Undo**, **Redo** or button on the table's edge. Applying **Default User** brings the cards back.
|
|
1341
|
+
- **Undo** and **Redo** are disabled when the story opens. After choosing **Tree trunk**, **Undo** restores **Square** and $1,290.00 and enables **Redo**; **Redo** chooses **Tree trunk** again at $1,630.00.
|
|
1342
|
+
- **Undo** and **Redo** are not shown in the review step, in the confirmation or in fullscreen.
|
|
1343
|
+
- Clicking **Fullscreen** and **Exit fullscreen** each pushes the `fullscreenButton` user-action event, as an `AnalyticsService.push` line in the browser console shows: without a Google Tag Manager id, Storybook's analytics only log their events with `console.debug`, which the console shows only with its Verbose level enabled.
|
|
1344
|
+
- Entering fullscreen while **Request a quote** is pending and leaving it again shows the panel with the spinner still running, until the thank-you message appears.
|
|
1345
|
+
- 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.
|
|
1346
|
+
- Tab reaches the button on the edge, and Enter or Space opens the popover.
|
|
1347
|
+
- The button on the edge is gone in the review step, in the confirmation and in both read routes, and stays in fullscreen.
|
|
1348
|
+
- 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.
|
|
1349
|
+
- 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.
|
|
1350
|
+
- On the phone, the review step, **Request a quote** and the thank-you message work with the sheet collapsed and open.
|
|
1351
|
+
- On the phone, choosing **Tree trunk** shows the hint at the top of the free area, below the undo, redo and fullscreen buttons.
|
|
1352
|
+
- 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.
|
|
1353
|
+
- **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.
|
|
1354
|
+
- 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.
|
|
1355
|
+
- 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.
|
|
1356
|
+
- 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.
|
|
696
1357
|
|
|
697
1358
|
## Known gaps
|
|
698
1359
|
|
|
699
1360
|
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.
|
|
700
1361
|
|
|
701
|
-
- **
|
|
702
|
-
- **
|
|
703
|
-
- **
|
|
704
|
-
- **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.
|
|
1362
|
+
- **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).
|
|
1363
|
+
- **Toolbar actions.** Measurements, sharing and language switching are not offered; undo and redo are the layout's own buttons, see [Undo and redo](#undo-and-redo). A layout can mount `LayoutSlots.DesktopToolbar` for the toolbar the spec configures, or build its own buttons: `phx.frontend.useToolbarActions()` returns the spec's toolbar as runnable entries, and `phx.frontend.useUndoRedo()`, `useMeasurements()`, `useShareLinks()` and `useLocaleSwitch()` serve single actions, pushing the same analytics events as the built-in buttons; see [Configurator Interface → Hooks for a Project Layout](?path=/docs/phoenix-configurator-interface--docs#hooks-for-a-project-layout).
|
|
1364
|
+
- **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.
|
|
705
1365
|
- **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`.
|
|
706
1366
|
- **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.
|
|
707
|
-
- **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 `
|
|
708
|
-
- **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()`
|
|
709
|
-
- **Analytics.** The finalize button records `FinalizeButtonClicked` through `
|
|
710
|
-
- **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.
|
|
1367
|
+
- **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 `phx.frontend.useIsCloningAllowed()` and `LayoutSlots.CloneToEditDialog`. The example leaves it out because Storybook cannot show the result: the dialog creates and opens the copy, but the mock template keeps its `read-revision` access on every configuration it opens, so the copy opens in read mode again.
|
|
1368
|
+
- **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. `phx.frontend.useCloseAction()` returns the host's close action, or `null` when there is none, as in this Storybook example; the hook that chooses among the three is not exported.
|
|
1369
|
+
- **Analytics.** The finalize button records `FinalizeButtonClicked` through `useFinalizeActions`, the cards record the attribute choice through `useAttributeSelection`, undo and redo record their events through `useUndoRedo`, and the fullscreen button records `FullScreenModeToggled` itself. The review step's navigation buttons, the view buttons, **Reset view**, the sheet's handle and the button on the table's edge record nothing. A layout that wants more events pushes them from `FrontendAnalyticsFactory`, from `@salsita-ai/sdk/configurator`, with `phx.frontend.useAnalytics().push(...)`, as [Offer fullscreen](#offer-fullscreen) does.
|
|
1370
|
+
- **Preview start screen.** The built-in layout shows a preview while `phx.frontend.usePreview().isPreview` is set, which `preview: auto` does on phones without the project opting in. This layout ignores it and always renders the interface.
|
|
711
1371
|
- **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.
|
|
712
1372
|
- **"Powered by Salsita" mark.** The built-in layout shows it; a project layout decides whether to mount `LayoutSlots.DesktopPoweredBy`, and this one does not.
|
|
713
1373
|
|
|
@@ -716,7 +1376,7 @@ A project layout has only what it renders. This one leaves out the following, ea
|
|
|
716
1376
|
- [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.
|
|
717
1377
|
- [Universal](?path=/docs/layouts-universal--docs) is the built-in layout this one replaces.
|
|
718
1378
|
- [Header / Custom](?path=/docs/layouts-header-custom--docs) replaces only the header, with the price from `useRootEntityPrice()`.
|
|
719
|
-
- [Canvas Padding](?path=/docs/layouts-canvas-padding--docs) scales the gaps `useSceneSafeArea()` measures.
|
|
1379
|
+
- [Canvas Padding](?path=/docs/layouts-canvas-padding--docs) scales the gaps `phx.frontend.useSceneSafeArea()` measures.
|
|
720
1380
|
- [Presets / Custom](?path=/docs/layouts-presets-custom--docs) replaces the preset screen the same way.
|
|
721
1381
|
|
|
722
1382
|
## Complete Implementation
|
|
@@ -760,6 +1420,10 @@ navigationStates:
|
|
|
760
1420
|
- checkout
|
|
761
1421
|
- requested
|
|
762
1422
|
|
|
1423
|
+
viewStates:
|
|
1424
|
+
- overview
|
|
1425
|
+
- edge
|
|
1426
|
+
|
|
763
1427
|
components:
|
|
764
1428
|
Table:
|
|
765
1429
|
detail:
|
|
@@ -795,9 +1459,18 @@ components:
|
|
|
795
1459
|
title: Send the configuration to the shop for a quote
|
|
796
1460
|
icon: PaperPlaneTilt
|
|
797
1461
|
handler: requestQuote
|
|
1462
|
+
htmlHotspot:
|
|
1463
|
+
edgeFinish:
|
|
1464
|
+
name: EdgeFinishHotspot
|
|
1465
|
+
offsetX: 500
|
|
1466
|
+
offsetY: 800
|
|
1467
|
+
offsetZ: 0
|
|
1468
|
+
$filter:
|
|
1469
|
+
modes: [owner]
|
|
1470
|
+
navigationStates: [configure]
|
|
798
1471
|
fitRootPerspectiveCamera:
|
|
799
1472
|
main:
|
|
800
|
-
priority:
|
|
1473
|
+
priority: 2
|
|
801
1474
|
fov: 35
|
|
802
1475
|
near: 100
|
|
803
1476
|
far: 10000
|
|
@@ -807,6 +1480,49 @@ components:
|
|
|
807
1480
|
azimuthAngle: 1.5
|
|
808
1481
|
polarAngle: 1.1
|
|
809
1482
|
fitMeshChanges: true
|
|
1483
|
+
$filter:
|
|
1484
|
+
viewports: [desktop]
|
|
1485
|
+
phone:
|
|
1486
|
+
priority: 1
|
|
1487
|
+
fov: 35
|
|
1488
|
+
near: 100
|
|
1489
|
+
far: 10000
|
|
1490
|
+
minDistance: 1000
|
|
1491
|
+
maxDistance: 12000
|
|
1492
|
+
distance: 8000
|
|
1493
|
+
azimuthAngle: 1.5
|
|
1494
|
+
polarAngle: 1.1
|
|
1495
|
+
fitMeshChanges: true
|
|
1496
|
+
$filter:
|
|
1497
|
+
viewports: [mobile]
|
|
1498
|
+
edge:
|
|
1499
|
+
priority: 4
|
|
1500
|
+
fov: 35
|
|
1501
|
+
near: 100
|
|
1502
|
+
far: 10000
|
|
1503
|
+
minDistance: 800
|
|
1504
|
+
maxDistance: 9000
|
|
1505
|
+
distance: 2000
|
|
1506
|
+
azimuthAngle: 0.5
|
|
1507
|
+
polarAngle: 1.15
|
|
1508
|
+
fitMeshChanges: true
|
|
1509
|
+
$filter:
|
|
1510
|
+
viewports: [desktop]
|
|
1511
|
+
viewStates: [edge]
|
|
1512
|
+
edgePhone:
|
|
1513
|
+
priority: 3
|
|
1514
|
+
fov: 35
|
|
1515
|
+
near: 100
|
|
1516
|
+
far: 10000
|
|
1517
|
+
minDistance: 800
|
|
1518
|
+
maxDistance: 12000
|
|
1519
|
+
distance: 3000
|
|
1520
|
+
azimuthAngle: 0.5
|
|
1521
|
+
polarAngle: 1.15
|
|
1522
|
+
fitMeshChanges: true
|
|
1523
|
+
$filter:
|
|
1524
|
+
viewports: [mobile]
|
|
1525
|
+
viewStates: [edge]
|
|
810
1526
|
sceneEntityRemoteObject:
|
|
811
1527
|
top:
|
|
812
1528
|
fileUrl: /models/tables.gltf
|
|
@@ -854,13 +1570,179 @@ transformers:
|
|
|
854
1570
|
- name: tree-trunk-delivery
|
|
855
1571
|
```
|
|
856
1572
|
|
|
1573
|
+
### ./src/\_shared/BottomSheet.tsx
|
|
1574
|
+
|
|
1575
|
+
```tsx
|
|
1576
|
+
import { Box, ButtonBase } from '@mui/material'
|
|
1577
|
+
import { type MouseEvent, type PointerEvent, type ReactNode, useRef } from 'react'
|
|
1578
|
+
|
|
1579
|
+
// A drag shorter than this is a tap, and the handle's click toggles the sheet
|
|
1580
|
+
const TAP_DISTANCE = 6
|
|
1581
|
+
// A drag that ends this far from where it started snaps to the other position
|
|
1582
|
+
const SNAP_DISTANCE = 48
|
|
1583
|
+
// A drag faster than this, in pixels per millisecond, snaps in its direction even when it is short
|
|
1584
|
+
const SNAP_VELOCITY = 0.5
|
|
1585
|
+
// How far the sheet follows the finger towards the position it is already in
|
|
1586
|
+
const OVERDRAG = 0.25
|
|
1587
|
+
|
|
1588
|
+
interface BottomSheetProps {
|
|
1589
|
+
readonly open: boolean
|
|
1590
|
+
readonly onOpenChange: (open: boolean) => void
|
|
1591
|
+
readonly label: string
|
|
1592
|
+
readonly children: ReactNode
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
interface Drag {
|
|
1596
|
+
readonly startY: number
|
|
1597
|
+
readonly startTime: number
|
|
1598
|
+
delta: number
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
// A persistent sheet at the bottom of the layout with two positions, open and collapsed. It is not a modal: the scene
|
|
1602
|
+
// above it stays interactive. Its height comes from its content, so the layout's safe area ends where the sheet
|
|
1603
|
+
// starts and changes only when the sheet snaps. While the handle is dragged the sheet follows the finger with a
|
|
1604
|
+
// transform, which the safe area does not see, so the camera refits once per snap and not on every move.
|
|
1605
|
+
export const BottomSheet = ({ open, onOpenChange, label, children }: BottomSheetProps) => {
|
|
1606
|
+
const sheetRef = useRef<HTMLElement>(null)
|
|
1607
|
+
const dragRef = useRef<Drag | null>(null)
|
|
1608
|
+
const draggedRef = useRef(false)
|
|
1609
|
+
|
|
1610
|
+
const moveSheet = (offset: number, animate: boolean) => {
|
|
1611
|
+
if (sheetRef.current) {
|
|
1612
|
+
sheetRef.current.style.transition = animate ? 'transform 200ms ease-out' : 'none'
|
|
1613
|
+
sheetRef.current.style.transform = offset === 0 ? '' : `translateY(${offset}px)`
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
const handlePointerDown = (event: PointerEvent<HTMLButtonElement>) => {
|
|
1618
|
+
event.currentTarget.setPointerCapture(event.pointerId)
|
|
1619
|
+
dragRef.current = { startY: event.clientY, startTime: event.timeStamp, delta: 0 }
|
|
1620
|
+
draggedRef.current = false
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
const handlePointerMove = (event: PointerEvent<HTMLButtonElement>) => {
|
|
1624
|
+
const drag = dragRef.current
|
|
1625
|
+
|
|
1626
|
+
if (drag === null) {
|
|
1627
|
+
return
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
drag.delta = event.clientY - drag.startY
|
|
1631
|
+
// Down closes an open sheet and up opens a collapsed one; the other direction only gives a little
|
|
1632
|
+
const towardsOther = open ? drag.delta > 0 : drag.delta < 0
|
|
1633
|
+
moveSheet(towardsOther ? drag.delta : drag.delta * OVERDRAG, false)
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
const handlePointerEnd = (event: PointerEvent<HTMLButtonElement>) => {
|
|
1637
|
+
const drag = dragRef.current
|
|
1638
|
+
dragRef.current = null
|
|
1639
|
+
|
|
1640
|
+
if (drag === null) {
|
|
1641
|
+
return
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
moveSheet(0, true)
|
|
1645
|
+
|
|
1646
|
+
if (Math.abs(drag.delta) < TAP_DISTANCE) {
|
|
1647
|
+
return
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
draggedRef.current = true
|
|
1651
|
+
const velocity = drag.delta / Math.max(event.timeStamp - drag.startTime, 1)
|
|
1652
|
+
const flicked = Math.abs(drag.delta) >= SNAP_DISTANCE || Math.abs(velocity) >= SNAP_VELOCITY
|
|
1653
|
+
|
|
1654
|
+
if (flicked && (open ? drag.delta > 0 : drag.delta < 0)) {
|
|
1655
|
+
onOpenChange(!open)
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
// A tap, Enter or Space toggles the sheet. The pointer click that ends a drag has already been handled; a keyboard
|
|
1660
|
+
// click (`detail` 0) always toggles, also after a touch drag that was followed by no click.
|
|
1661
|
+
const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
|
|
1662
|
+
const dragged = draggedRef.current
|
|
1663
|
+
draggedRef.current = false
|
|
1664
|
+
|
|
1665
|
+
if (dragged && event.detail !== 0) {
|
|
1666
|
+
return
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
onOpenChange(!open)
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
return (
|
|
1673
|
+
<Box
|
|
1674
|
+
component="section"
|
|
1675
|
+
ref={sheetRef}
|
|
1676
|
+
aria-label={label}
|
|
1677
|
+
sx={{
|
|
1678
|
+
position: 'relative',
|
|
1679
|
+
flexShrink: 0,
|
|
1680
|
+
display: 'flex',
|
|
1681
|
+
flexDirection: 'column',
|
|
1682
|
+
maxBlockSize: '55%',
|
|
1683
|
+
paddingBlockEnd: 'env(safe-area-inset-bottom)',
|
|
1684
|
+
borderStartStartRadius: 20,
|
|
1685
|
+
borderStartEndRadius: 20,
|
|
1686
|
+
bgcolor: 'background.paper',
|
|
1687
|
+
boxShadow: '0 -8px 32px rgba(0, 0, 0, 0.12)',
|
|
1688
|
+
// Fills the gap below the sheet while it is dragged up
|
|
1689
|
+
'&::after': {
|
|
1690
|
+
content: '""',
|
|
1691
|
+
position: 'absolute',
|
|
1692
|
+
insetInline: 0,
|
|
1693
|
+
insetBlockStart: '100%',
|
|
1694
|
+
blockSize: '100vh',
|
|
1695
|
+
bgcolor: 'background.paper',
|
|
1696
|
+
},
|
|
1697
|
+
}}
|
|
1698
|
+
>
|
|
1699
|
+
<ButtonBase
|
|
1700
|
+
aria-expanded={open}
|
|
1701
|
+
disableRipple
|
|
1702
|
+
aria-label={open ? `Collapse ${label.toLowerCase()}` : `Expand ${label.toLowerCase()}`}
|
|
1703
|
+
onClick={handleClick}
|
|
1704
|
+
onPointerDown={handlePointerDown}
|
|
1705
|
+
onPointerMove={handlePointerMove}
|
|
1706
|
+
onPointerUp={handlePointerEnd}
|
|
1707
|
+
onPointerCancel={handlePointerEnd}
|
|
1708
|
+
sx={{
|
|
1709
|
+
flexShrink: 0,
|
|
1710
|
+
blockSize: 36,
|
|
1711
|
+
touchAction: 'none',
|
|
1712
|
+
'&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: -4, borderRadius: 3 },
|
|
1713
|
+
}}
|
|
1714
|
+
>
|
|
1715
|
+
<Box component="span" sx={{ inlineSize: 40, blockSize: 4, borderRadius: 2, bgcolor: 'text.disabled' }} />
|
|
1716
|
+
</ButtonBase>
|
|
1717
|
+
{/* A column, so the panel's cards region shrinks first and the price and action stay in view; below the cards
|
|
1718
|
+
region's minimum height the content scrolls as a whole, as the review step does on a short phone */}
|
|
1719
|
+
<Box
|
|
1720
|
+
component="div"
|
|
1721
|
+
sx={{
|
|
1722
|
+
display: 'flex',
|
|
1723
|
+
flexDirection: 'column',
|
|
1724
|
+
flex: '1 1 auto',
|
|
1725
|
+
minBlockSize: 0,
|
|
1726
|
+
overflowY: 'auto',
|
|
1727
|
+
overscrollBehavior: 'contain',
|
|
1728
|
+
}}
|
|
1729
|
+
>
|
|
1730
|
+
{children}
|
|
1731
|
+
</Box>
|
|
1732
|
+
</Box>
|
|
1733
|
+
)
|
|
1734
|
+
}
|
|
1735
|
+
```
|
|
1736
|
+
|
|
857
1737
|
### ./src/\_shared/EdgeFinishCards.tsx
|
|
858
1738
|
|
|
859
1739
|
```tsx
|
|
860
1740
|
import { Box, ButtonBase, type SxProps, type Theme, Typography } from '@mui/material'
|
|
861
1741
|
import type { KeyboardEvent } from 'react'
|
|
862
1742
|
|
|
863
|
-
import {
|
|
1743
|
+
import type { UseAttributeSelection } from '@salsita-ai/sdk/react'
|
|
1744
|
+
|
|
1745
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
864
1746
|
|
|
865
1747
|
// Cross-sections of the tabletop's edge, keyed by the option values of the spec.
|
|
866
1748
|
const EDGE_PROFILES: Readonly<Record<string, string>> = {
|
|
@@ -897,7 +1779,7 @@ interface EdgeFinishCardsProps {
|
|
|
897
1779
|
}
|
|
898
1780
|
|
|
899
1781
|
export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
|
|
900
|
-
const resolve = useResolveLocalizable()
|
|
1782
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
901
1783
|
const { options } = selection
|
|
902
1784
|
// The card in the tab order: the selected one, or the first enabled one. Disabled cards are never in it.
|
|
903
1785
|
const selectedIndex = options.findIndex(option => option.value === selection.value && !option.disabled)
|
|
@@ -992,39 +1874,59 @@ export const EdgeFinishCards = ({ selection }: EdgeFinishCardsProps) => {
|
|
|
992
1874
|
### ./src/\_shared/FullscreenToggle.tsx
|
|
993
1875
|
|
|
994
1876
|
```tsx
|
|
995
|
-
import { Button } from '@mui/material'
|
|
1877
|
+
import { Button, Tooltip } from '@mui/material'
|
|
1878
|
+
|
|
1879
|
+
import { FrontendAnalyticsFactory } from '@salsita-ai/sdk/configurator'
|
|
996
1880
|
|
|
997
1881
|
import { phx } from '../../.phoenix/phx.js'
|
|
998
1882
|
|
|
999
1883
|
const ENTER_ICON = 'M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'
|
|
1000
1884
|
const EXIT_ICON = 'M9 4v5H4M15 4v5h5M15 20v-5h5M9 20v-5H4'
|
|
1001
1885
|
|
|
1002
|
-
|
|
1886
|
+
interface FullscreenToggleProps {
|
|
1887
|
+
// Only the icon, with the label as its accessible name and tooltip, where a label would cover the product
|
|
1888
|
+
readonly compact?: boolean
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
export const FullscreenToggle = ({ compact = false }: FullscreenToggleProps) => {
|
|
1003
1892
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
1004
1893
|
const setFullscreen = phx.frontend.useSetFullscreen()
|
|
1894
|
+
const analytics = phx.frontend.useAnalytics()
|
|
1895
|
+
const label = isFullscreen ? 'Exit fullscreen' : 'Fullscreen'
|
|
1896
|
+
const icon = (
|
|
1897
|
+
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
1898
|
+
<path d={isFullscreen ? EXIT_ICON : ENTER_ICON} />
|
|
1899
|
+
</svg>
|
|
1900
|
+
)
|
|
1901
|
+
|
|
1902
|
+
// The same event the built-in fullscreen button records, for entering and for leaving
|
|
1903
|
+
const toggle = () => {
|
|
1904
|
+
analytics.push(FrontendAnalyticsFactory.FullScreenModeToggled())
|
|
1905
|
+
setFullscreen(!isFullscreen)
|
|
1906
|
+
}
|
|
1005
1907
|
|
|
1006
1908
|
return (
|
|
1007
|
-
<
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
</
|
|
1909
|
+
<Tooltip title={compact ? label : ''}>
|
|
1910
|
+
<Button
|
|
1911
|
+
onClick={toggle}
|
|
1912
|
+
aria-label={compact ? label : undefined}
|
|
1913
|
+
startIcon={compact ? undefined : icon}
|
|
1914
|
+
sx={{
|
|
1915
|
+
minBlockSize: 44,
|
|
1916
|
+
minInlineSize: 44,
|
|
1917
|
+
paddingInline: compact ? 0 : 2.5,
|
|
1918
|
+
borderRadius: 999,
|
|
1919
|
+
bgcolor: 'background.paper',
|
|
1920
|
+
color: 'text.primary',
|
|
1921
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
1922
|
+
textTransform: 'none',
|
|
1923
|
+
fontWeight: 600,
|
|
1924
|
+
'&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
|
|
1925
|
+
}}
|
|
1926
|
+
>
|
|
1927
|
+
{compact ? icon : label}
|
|
1928
|
+
</Button>
|
|
1929
|
+
</Tooltip>
|
|
1028
1930
|
)
|
|
1029
1931
|
}
|
|
1030
1932
|
```
|
|
@@ -1048,7 +1950,7 @@ const severityOf = (message: ConfiguratorMessage) => {
|
|
|
1048
1950
|
return VIOLATION_SEVERITY[message.violation.severity]
|
|
1049
1951
|
}
|
|
1050
1952
|
|
|
1051
|
-
return message.kind === 'error' ? 'error' : 'info'
|
|
1953
|
+
return message.kind === 'error' || message.kind === 'saveError' ? 'error' : 'info'
|
|
1052
1954
|
}
|
|
1053
1955
|
|
|
1054
1956
|
export const MessageToast = () => {
|
|
@@ -1090,8 +1992,7 @@ export const MessageToast = () => {
|
|
|
1090
1992
|
```tsx
|
|
1091
1993
|
import { Box, Button, Typography } from '@mui/material'
|
|
1092
1994
|
|
|
1093
|
-
import { detailComponent
|
|
1094
|
-
import { PhoenixHandlerBoundary, useResolveLocalizable } from '@salsita-ai/sdk/react'
|
|
1995
|
+
import { detailComponent } from '@salsita-ai/sdk/domain'
|
|
1095
1996
|
|
|
1096
1997
|
import { phx } from '../../.phoenix/phx.js'
|
|
1097
1998
|
import { EdgeFinishCards } from './EdgeFinishCards.js'
|
|
@@ -1099,8 +2000,15 @@ import { ReviewActions } from './ReviewActions.js'
|
|
|
1099
2000
|
|
|
1100
2001
|
const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
|
|
1101
2002
|
|
|
1102
|
-
|
|
1103
|
-
|
|
2003
|
+
interface ProductPanelProps {
|
|
2004
|
+
// Only the name, the price and the action, for a collapsed bottom sheet
|
|
2005
|
+
readonly collapsed?: boolean
|
|
2006
|
+
// In a bottom sheet the cards region keeps the top of the cards in view, and the sheet scrolls when that does not fit
|
|
2007
|
+
readonly inSheet?: boolean
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
export const ProductPanel = ({ collapsed = false, inSheet = false }: ProductPanelProps) => {
|
|
2011
|
+
const resolve = phx.frontend.useResolveLocalizable()
|
|
1104
2012
|
const detail = phx.frontend.useFirstRootComponent(detailComponent)
|
|
1105
2013
|
const price = phx.frontend.useRootEntityPrice()
|
|
1106
2014
|
const tableId = phx.frontend.useRootEntityId()
|
|
@@ -1110,12 +2018,9 @@ export const ProductPanel = () => {
|
|
|
1110
2018
|
const pushNavigate = phx.frontend.usePushNavigate()
|
|
1111
2019
|
const popNavigate = phx.frontend.usePopNavigate()
|
|
1112
2020
|
const navigate = phx.frontend.useNavigate()
|
|
1113
|
-
const finalizeActions = phx.frontend.useComponents({ componentTypes: [finalizeActionComponent] }) ?? []
|
|
1114
2021
|
|
|
1115
2022
|
const isReadMode = accessInfo.viewMode
|
|
1116
2023
|
const isReview = isReadMode || navigationState !== 'configure'
|
|
1117
|
-
// The spec's primary finalize action, or its first one
|
|
1118
|
-
const quoteAction = finalizeActions.find(action => action.state.variant === 'primary') ?? finalizeActions[0]
|
|
1119
2024
|
const chosenEdge = edgeFinish.options.find(option => option.value === edgeFinish.value)
|
|
1120
2025
|
|
|
1121
2026
|
return (
|
|
@@ -1136,29 +2041,44 @@ export const ProductPanel = () => {
|
|
|
1136
2041
|
<Typography variant="h5" component="h2" fontWeight={700}>
|
|
1137
2042
|
{resolve(detail?.state.title)}
|
|
1138
2043
|
</Typography>
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
<Box component="div" sx={{ display: 'grid', gap: 1.5, paddingInline: 3, paddingBlockEnd: 3, overflowY: 'auto' }}>
|
|
1145
|
-
<Typography variant="subtitle2" component="h3">
|
|
1146
|
-
Edge finish
|
|
1147
|
-
</Typography>
|
|
1148
|
-
{isReview ? (
|
|
1149
|
-
<Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
|
|
1150
|
-
<Typography variant="body2" fontWeight={600}>
|
|
1151
|
-
{resolve(chosenEdge?.title)}
|
|
1152
|
-
</Typography>
|
|
1153
|
-
<Typography variant="caption" color="text.secondary">
|
|
1154
|
-
{resolve(chosenEdge?.description)}
|
|
1155
|
-
</Typography>
|
|
1156
|
-
</Box>
|
|
1157
|
-
) : (
|
|
1158
|
-
<EdgeFinishCards selection={edgeFinish} />
|
|
2044
|
+
{!collapsed && (
|
|
2045
|
+
<Typography variant="body2" color="text.secondary">
|
|
2046
|
+
{resolve(detail?.state.description)}
|
|
2047
|
+
</Typography>
|
|
1159
2048
|
)}
|
|
1160
2049
|
</Box>
|
|
1161
2050
|
|
|
2051
|
+
{!collapsed && (
|
|
2052
|
+
<Box
|
|
2053
|
+
component="div"
|
|
2054
|
+
sx={{
|
|
2055
|
+
display: 'grid',
|
|
2056
|
+
gap: 1.5,
|
|
2057
|
+
paddingInline: 3,
|
|
2058
|
+
paddingBlockEnd: 3,
|
|
2059
|
+
// In a short container the region shrinks and scrolls; a scroll past its end moves its container on
|
|
2060
|
+
minBlockSize: inSheet ? 120 : 0,
|
|
2061
|
+
overflowY: 'auto',
|
|
2062
|
+
}}
|
|
2063
|
+
>
|
|
2064
|
+
<Typography variant="subtitle2" component="h3">
|
|
2065
|
+
Edge finish
|
|
2066
|
+
</Typography>
|
|
2067
|
+
{isReview ? (
|
|
2068
|
+
<Box component="div" sx={{ padding: 2, borderRadius: 3, bgcolor: 'action.hover' }}>
|
|
2069
|
+
<Typography variant="body2" fontWeight={600}>
|
|
2070
|
+
{resolve(chosenEdge?.title)}
|
|
2071
|
+
</Typography>
|
|
2072
|
+
<Typography variant="caption" color="text.secondary">
|
|
2073
|
+
{resolve(chosenEdge?.description)}
|
|
2074
|
+
</Typography>
|
|
2075
|
+
</Box>
|
|
2076
|
+
) : (
|
|
2077
|
+
<EdgeFinishCards selection={edgeFinish} />
|
|
2078
|
+
)}
|
|
2079
|
+
</Box>
|
|
2080
|
+
)}
|
|
2081
|
+
|
|
1162
2082
|
<Box component="footer" sx={{ display: 'grid', gap: 2, padding: 3, borderTop: 1, borderColor: 'divider' }}>
|
|
1163
2083
|
<Box component="div" sx={{ display: 'flex', alignItems: 'baseline', justifyContent: 'space-between' }}>
|
|
1164
2084
|
<Typography variant="body2" color="text.secondary">
|
|
@@ -1178,19 +2098,7 @@ export const ProductPanel = () => {
|
|
|
1178
2098
|
<Typography variant="body2" color="text.secondary">
|
|
1179
2099
|
Your table is ready for a quote. A real shop collects the contact details here.
|
|
1180
2100
|
</Typography>
|
|
1181
|
-
{
|
|
1182
|
-
<PhoenixHandlerBoundary name={quoteAction.state.handler}>
|
|
1183
|
-
<ReviewActions
|
|
1184
|
-
handler={quoteAction.state.handler}
|
|
1185
|
-
label={resolve(quoteAction.state.label)}
|
|
1186
|
-
onBack={popNavigate}
|
|
1187
|
-
/>
|
|
1188
|
-
</PhoenixHandlerBoundary>
|
|
1189
|
-
) : (
|
|
1190
|
-
<Button size="large" variant="outlined" onClick={popNavigate} sx={BUTTON_SX}>
|
|
1191
|
-
Back to the configuration
|
|
1192
|
-
</Button>
|
|
1193
|
-
)}
|
|
2101
|
+
<ReviewActions onBack={popNavigate} />
|
|
1194
2102
|
</>
|
|
1195
2103
|
)}
|
|
1196
2104
|
{!isReadMode && navigationState === 'requested' && (
|
|
@@ -1219,39 +2127,40 @@ import { phx } from '../../.phoenix/phx.js'
|
|
|
1219
2127
|
const BUTTON_SX = { minBlockSize: 48, borderRadius: 999, textTransform: 'none', fontWeight: 600 } as const
|
|
1220
2128
|
|
|
1221
2129
|
interface ReviewActionsProps {
|
|
1222
|
-
readonly handler: string
|
|
1223
|
-
readonly label: string
|
|
1224
2130
|
readonly onBack: () => void
|
|
1225
2131
|
}
|
|
1226
2132
|
|
|
1227
|
-
// The review step's buttons:
|
|
1228
|
-
//
|
|
1229
|
-
//
|
|
1230
|
-
//
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
const
|
|
2133
|
+
// The review step's buttons: the spec's primary finalize action and the way back. `useFinalizeActions` runs the
|
|
2134
|
+
// action's handler beside the layout, so its pending state and error outlive this component: when the panel unmounts,
|
|
2135
|
+
// as in fullscreen, the request goes on and the remounted buttons still show it. Back is disabled while the request
|
|
2136
|
+
// is pending, so the customer cannot change the configuration while it is sent.
|
|
2137
|
+
export const ReviewActions = ({ onBack }: ReviewActionsProps) => {
|
|
2138
|
+
const { primary, hints } = phx.frontend.useFinalizeActions()
|
|
2139
|
+
const isPending = primary?.isPending ?? false
|
|
1234
2140
|
|
|
1235
2141
|
return (
|
|
1236
2142
|
<Box component="div" sx={{ display: 'grid', gap: 2 }}>
|
|
1237
|
-
|
|
1238
|
-
<
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
2143
|
+
{primary && (
|
|
2144
|
+
<Box component="div" sx={{ display: 'grid', gap: 1 }}>
|
|
2145
|
+
<Button
|
|
2146
|
+
size="large"
|
|
2147
|
+
variant="contained"
|
|
2148
|
+
disabled={primary.disabled || isPending}
|
|
2149
|
+
onClick={() => void primary.run()}
|
|
2150
|
+
title={primary.title}
|
|
2151
|
+
startIcon={isPending ? <CircularProgress size={18} color="inherit" /> : undefined}
|
|
2152
|
+
sx={BUTTON_SX}
|
|
2153
|
+
>
|
|
2154
|
+
{isPending ? 'Sending the request…' : primary.label}
|
|
2155
|
+
</Button>
|
|
2156
|
+
{primary.disabled && hints && (
|
|
2157
|
+
<Typography variant="caption" color="text.secondary">
|
|
2158
|
+
{hints}
|
|
2159
|
+
</Typography>
|
|
2160
|
+
)}
|
|
2161
|
+
{primary.error && <Alert severity="error">The request could not be sent: {primary.error.message}</Alert>}
|
|
2162
|
+
</Box>
|
|
2163
|
+
)}
|
|
1255
2164
|
<Button size="large" variant="outlined" disabled={isPending} onClick={onBack} sx={BUTTON_SX}>
|
|
1256
2165
|
Back to the configuration
|
|
1257
2166
|
</Button>
|
|
@@ -1260,30 +2169,209 @@ export const ReviewActions = ({ handler, label, onBack }: ReviewActionsProps) =>
|
|
|
1260
2169
|
}
|
|
1261
2170
|
```
|
|
1262
2171
|
|
|
2172
|
+
### ./src/\_shared/SceneControls.tsx
|
|
2173
|
+
|
|
2174
|
+
```tsx
|
|
2175
|
+
import { Box, Button, Tooltip } from '@mui/material'
|
|
2176
|
+
|
|
2177
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
2178
|
+
|
|
2179
|
+
// The spec's view states, each with the label of the button that shows it
|
|
2180
|
+
const VIEWS = [
|
|
2181
|
+
{ state: 'overview', label: 'Whole table' },
|
|
2182
|
+
{ state: 'edge', label: 'Edge close-up' },
|
|
2183
|
+
] as const
|
|
2184
|
+
|
|
2185
|
+
const RESET_ICON = 'M4 12a8 8 0 1 0 2.4-5.7M4 4v4h4'
|
|
2186
|
+
|
|
2187
|
+
const SURFACE_SX = {
|
|
2188
|
+
borderRadius: 999,
|
|
2189
|
+
bgcolor: 'background.paper',
|
|
2190
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
2191
|
+
} as const
|
|
2192
|
+
|
|
2193
|
+
const BUTTON_SX = {
|
|
2194
|
+
minBlockSize: 44,
|
|
2195
|
+
minInlineSize: 44,
|
|
2196
|
+
borderRadius: 999,
|
|
2197
|
+
textTransform: 'none',
|
|
2198
|
+
fontWeight: 600,
|
|
2199
|
+
whiteSpace: 'nowrap',
|
|
2200
|
+
} as const
|
|
2201
|
+
|
|
2202
|
+
interface SceneControlsProps {
|
|
2203
|
+
// The reset button shows only its icon, with its label as tooltip and accessible name
|
|
2204
|
+
readonly compact?: boolean
|
|
2205
|
+
// Only the reset button, without the view buttons
|
|
2206
|
+
readonly resetOnly?: boolean
|
|
2207
|
+
}
|
|
2208
|
+
|
|
2209
|
+
// The layout's own camera controls: one button per view state of the spec, and a reset that undoes an orbit
|
|
2210
|
+
export const SceneControls = ({ compact = false, resetOnly = false }: SceneControlsProps) => {
|
|
2211
|
+
const activeView = phx.frontend.useActiveViewState()
|
|
2212
|
+
const setViewState = phx.frontend.useSetViewState()
|
|
2213
|
+
const resetCamera = phx.frontend.useResetCamera()
|
|
2214
|
+
const resetIcon = (
|
|
2215
|
+
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
2216
|
+
<path d={RESET_ICON} />
|
|
2217
|
+
</svg>
|
|
2218
|
+
)
|
|
2219
|
+
|
|
2220
|
+
return (
|
|
2221
|
+
<Box component="div" sx={{ display: 'flex', gap: 1 }}>
|
|
2222
|
+
{!resetOnly && (
|
|
2223
|
+
<Box component="div" role="group" aria-label="View" sx={{ ...SURFACE_SX, display: 'flex' }}>
|
|
2224
|
+
{VIEWS.map(view => {
|
|
2225
|
+
const isActive = activeView === view.state
|
|
2226
|
+
|
|
2227
|
+
return (
|
|
2228
|
+
<Button
|
|
2229
|
+
key={view.state}
|
|
2230
|
+
aria-pressed={isActive}
|
|
2231
|
+
onClick={() => setViewState(view.state)}
|
|
2232
|
+
sx={{
|
|
2233
|
+
...BUTTON_SX,
|
|
2234
|
+
paddingInline: 2,
|
|
2235
|
+
bgcolor: isActive ? 'text.primary' : 'transparent',
|
|
2236
|
+
color: isActive ? 'background.paper' : 'text.primary',
|
|
2237
|
+
'&:hover': { bgcolor: isActive ? 'text.primary' : 'action.hover' },
|
|
2238
|
+
}}
|
|
2239
|
+
>
|
|
2240
|
+
{view.label}
|
|
2241
|
+
</Button>
|
|
2242
|
+
)
|
|
2243
|
+
})}
|
|
2244
|
+
</Box>
|
|
2245
|
+
)}
|
|
2246
|
+
<Tooltip title={compact ? 'Reset view' : ''}>
|
|
2247
|
+
<Button
|
|
2248
|
+
onClick={resetCamera}
|
|
2249
|
+
aria-label={compact ? 'Reset view' : undefined}
|
|
2250
|
+
startIcon={compact ? undefined : resetIcon}
|
|
2251
|
+
sx={{
|
|
2252
|
+
...SURFACE_SX,
|
|
2253
|
+
...BUTTON_SX,
|
|
2254
|
+
paddingInline: compact ? 0 : 2,
|
|
2255
|
+
color: 'text.primary',
|
|
2256
|
+
'&:hover': { bgcolor: 'background.paper', boxShadow: '0 6px 20px rgba(0, 0, 0, 0.18)' },
|
|
2257
|
+
}}
|
|
2258
|
+
>
|
|
2259
|
+
{compact ? resetIcon : 'Reset view'}
|
|
2260
|
+
</Button>
|
|
2261
|
+
</Tooltip>
|
|
2262
|
+
</Box>
|
|
2263
|
+
)
|
|
2264
|
+
}
|
|
2265
|
+
```
|
|
2266
|
+
|
|
2267
|
+
### ./src/\_shared/UndoRedo.tsx
|
|
2268
|
+
|
|
2269
|
+
```tsx
|
|
2270
|
+
import { Box, IconButton, Tooltip } from '@mui/material'
|
|
2271
|
+
|
|
2272
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
2273
|
+
|
|
2274
|
+
const UNDO_ICON = 'M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11'
|
|
2275
|
+
const REDO_ICON = 'M15 14l5-5-5-5M20 9H9.5a5.5 5.5 0 0 0 0 11H13'
|
|
2276
|
+
|
|
2277
|
+
interface HistoryButtonProps {
|
|
2278
|
+
readonly label: string
|
|
2279
|
+
readonly icon: string
|
|
2280
|
+
readonly enabled: boolean
|
|
2281
|
+
readonly onClick: () => void
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
const HistoryButton = ({ label, icon, enabled, onClick }: HistoryButtonProps) => (
|
|
2285
|
+
<Tooltip title={label}>
|
|
2286
|
+
{/* A disabled button fires no pointer events, so the span keeps the tooltip working */}
|
|
2287
|
+
<span>
|
|
2288
|
+
<IconButton
|
|
2289
|
+
aria-label={label}
|
|
2290
|
+
disabled={!enabled}
|
|
2291
|
+
onClick={onClick}
|
|
2292
|
+
sx={{ inlineSize: 44, blockSize: 44, color: 'text.primary' }}
|
|
2293
|
+
>
|
|
2294
|
+
<svg viewBox="0 0 24 24" width={20} height={20} fill="none" stroke="currentColor" strokeWidth={2}>
|
|
2295
|
+
<path d={icon} />
|
|
2296
|
+
</svg>
|
|
2297
|
+
</IconButton>
|
|
2298
|
+
</span>
|
|
2299
|
+
</Tooltip>
|
|
2300
|
+
)
|
|
2301
|
+
|
|
2302
|
+
// Undo and redo for the customer's choices. They change the configuration, so they are offered only where the cards
|
|
2303
|
+
// are: not to a viewer, and not in the review step, where the summary and a running request must not change under the
|
|
2304
|
+
// customer. `useUndoRedo` pushes the same analytics events as the built-in toolbar's buttons.
|
|
2305
|
+
export const UndoRedo = () => {
|
|
2306
|
+
const { canUndo, canRedo, undo, redo } = phx.frontend.useUndoRedo()
|
|
2307
|
+
const { accessInfo } = phx.frontend.useAccessService()
|
|
2308
|
+
const navigationState = phx.frontend.useActiveNavigationState()
|
|
2309
|
+
|
|
2310
|
+
if (accessInfo.viewMode || navigationState !== 'configure') {
|
|
2311
|
+
return null
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
return (
|
|
2315
|
+
<Box
|
|
2316
|
+
component="div"
|
|
2317
|
+
role="group"
|
|
2318
|
+
aria-label="History"
|
|
2319
|
+
sx={{
|
|
2320
|
+
display: 'flex',
|
|
2321
|
+
borderRadius: 999,
|
|
2322
|
+
bgcolor: 'background.paper',
|
|
2323
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.12)',
|
|
2324
|
+
}}
|
|
2325
|
+
>
|
|
2326
|
+
<HistoryButton label="Undo" icon={UNDO_ICON} enabled={canUndo} onClick={undo} />
|
|
2327
|
+
<HistoryButton label="Redo" icon={REDO_ICON} enabled={canRedo} onClick={redo} />
|
|
2328
|
+
</Box>
|
|
2329
|
+
)
|
|
2330
|
+
}
|
|
2331
|
+
```
|
|
2332
|
+
|
|
1263
2333
|
### ./src/elements/ConfiguratorLayout.tsx
|
|
1264
2334
|
|
|
1265
2335
|
```tsx
|
|
1266
2336
|
import { Box } from '@mui/material'
|
|
2337
|
+
import { useState } from 'react'
|
|
1267
2338
|
|
|
1268
|
-
import { LayoutSlots
|
|
2339
|
+
import { LayoutSlots } from '@salsita-ai/sdk/configurator'
|
|
1269
2340
|
|
|
1270
2341
|
import { phx } from '../../.phoenix/phx.js'
|
|
2342
|
+
import { BottomSheet } from '../_shared/BottomSheet.js'
|
|
1271
2343
|
import { FullscreenToggle } from '../_shared/FullscreenToggle.js'
|
|
1272
2344
|
import { MessageToast } from '../_shared/MessageToast.js'
|
|
1273
2345
|
import { ProductPanel } from '../_shared/ProductPanel.js'
|
|
2346
|
+
import { SceneControls } from '../_shared/SceneControls.js'
|
|
2347
|
+
import { UndoRedo } from '../_shared/UndoRedo.js'
|
|
1274
2348
|
|
|
1275
2349
|
const GUTTER = 24
|
|
1276
2350
|
const PANEL_WIDTH = 380
|
|
2351
|
+
const PHONE_GUTTER = 16
|
|
2352
|
+
const TOUCH_TARGET = 44
|
|
1277
2353
|
|
|
1278
2354
|
const ConfiguratorLayout = () => {
|
|
1279
|
-
const { containerRef, safeAreaRef } = useSceneSafeArea()
|
|
2355
|
+
const { containerRef, safeAreaRef } = phx.frontend.useSceneSafeArea()
|
|
1280
2356
|
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
2357
|
+
// `null` until the container has been measured; the layout shows only the scene until then
|
|
2358
|
+
const viewports = phx.frontend.useActiveViewports()
|
|
2359
|
+
const [isSheetOpen, setSheetOpen] = useState(false)
|
|
2360
|
+
|
|
2361
|
+
const isDesktop = viewports?.includes('desktop') ?? false
|
|
2362
|
+
const gutter = isDesktop ? GUTTER : PHONE_GUTTER
|
|
1281
2363
|
|
|
1282
2364
|
return (
|
|
1283
|
-
<Box
|
|
2365
|
+
<Box
|
|
2366
|
+
component="div"
|
|
2367
|
+
ref={containerRef}
|
|
2368
|
+
// `clip`, not `hidden`: what overflows, such as the sheet's fill below its edge, can never be scrolled into view,
|
|
2369
|
+
// not even by the browser when the focus moves
|
|
2370
|
+
sx={{ position: 'absolute', inset: 0, display: 'flex', flexDirection: 'column', overflow: 'clip' }}
|
|
2371
|
+
>
|
|
1284
2372
|
<LayoutSlots.SharedCanvas />
|
|
1285
2373
|
|
|
1286
|
-
{!isFullscreen && (
|
|
2374
|
+
{viewports !== null && isDesktop && !isFullscreen && (
|
|
1287
2375
|
<Box
|
|
1288
2376
|
component="aside"
|
|
1289
2377
|
sx={{
|
|
@@ -1297,37 +2385,80 @@ const ConfiguratorLayout = () => {
|
|
|
1297
2385
|
borderRadius: 5,
|
|
1298
2386
|
bgcolor: 'background.paper',
|
|
1299
2387
|
boxShadow: '0 12px 40px rgba(0, 0, 0, 0.12)',
|
|
1300
|
-
|
|
2388
|
+
// A very short container, such as a phone held sideways, scrolls the panel instead of clipping its footer
|
|
2389
|
+
overflowX: 'hidden',
|
|
2390
|
+
overflowY: 'auto',
|
|
2391
|
+
overscrollBehavior: 'contain',
|
|
1301
2392
|
}}
|
|
1302
2393
|
>
|
|
1303
2394
|
<ProductPanel />
|
|
1304
2395
|
</Box>
|
|
1305
2396
|
)}
|
|
1306
2397
|
|
|
1307
|
-
|
|
1308
|
-
component="div"
|
|
1309
|
-
ref={safeAreaRef}
|
|
1310
|
-
sx={{
|
|
1311
|
-
position: 'absolute',
|
|
1312
|
-
insetBlock: 0,
|
|
1313
|
-
insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
|
|
1314
|
-
insetInlineEnd: 0,
|
|
1315
|
-
pointerEvents: 'none',
|
|
1316
|
-
}}
|
|
1317
|
-
>
|
|
1318
|
-
<Box
|
|
1319
|
-
component="div"
|
|
1320
|
-
sx={{ position: 'absolute', insetBlockStart: GUTTER, insetInlineEnd: GUTTER, pointerEvents: 'auto' }}
|
|
1321
|
-
>
|
|
1322
|
-
<FullscreenToggle />
|
|
1323
|
-
</Box>
|
|
2398
|
+
{viewports !== null && (
|
|
1324
2399
|
<Box
|
|
1325
2400
|
component="div"
|
|
1326
|
-
|
|
2401
|
+
ref={safeAreaRef}
|
|
2402
|
+
sx={{
|
|
2403
|
+
// Desktop: right of the panel. Phone: above the sheet, whose height the column gives the rest.
|
|
2404
|
+
...(isDesktop
|
|
2405
|
+
? {
|
|
2406
|
+
position: 'absolute',
|
|
2407
|
+
insetBlock: 0,
|
|
2408
|
+
insetInlineStart: isFullscreen ? 0 : PANEL_WIDTH + 2 * GUTTER,
|
|
2409
|
+
insetInlineEnd: 0,
|
|
2410
|
+
}
|
|
2411
|
+
: { position: 'relative', flex: '1 1 0', minBlockSize: 0 }),
|
|
2412
|
+
pointerEvents: 'none',
|
|
2413
|
+
}}
|
|
1327
2414
|
>
|
|
1328
|
-
<
|
|
2415
|
+
<Box
|
|
2416
|
+
component="div"
|
|
2417
|
+
sx={{
|
|
2418
|
+
position: 'absolute',
|
|
2419
|
+
insetBlockStart: gutter,
|
|
2420
|
+
insetInlineEnd: gutter,
|
|
2421
|
+
display: 'flex',
|
|
2422
|
+
gap: 1,
|
|
2423
|
+
pointerEvents: 'auto',
|
|
2424
|
+
}}
|
|
2425
|
+
>
|
|
2426
|
+
{!isFullscreen && <UndoRedo />}
|
|
2427
|
+
<FullscreenToggle compact={!isDesktop} />
|
|
2428
|
+
</Box>
|
|
2429
|
+
<Box
|
|
2430
|
+
component="div"
|
|
2431
|
+
sx={{
|
|
2432
|
+
position: 'absolute',
|
|
2433
|
+
pointerEvents: 'auto',
|
|
2434
|
+
// Desktop: bottom left, above the row of view controls. Phone: at the top below the row of undo, redo and
|
|
2435
|
+
// fullscreen, clear of the sheet's handle and the view controls.
|
|
2436
|
+
...(isDesktop
|
|
2437
|
+
? { insetBlockEnd: 2 * GUTTER + TOUCH_TARGET, insetInlineStart: GUTTER }
|
|
2438
|
+
: { insetBlockStart: gutter + TOUCH_TARGET + gutter / 2, insetInline: gutter }),
|
|
2439
|
+
}}
|
|
2440
|
+
>
|
|
2441
|
+
<MessageToast />
|
|
2442
|
+
</Box>
|
|
2443
|
+
{/* A phone in fullscreen keeps only the reset, as the built-in layout does. Below 1024 pixels (`tablet`) the
|
|
2444
|
+
free area beside the panel is narrow, so the reset shows only its icon there too. */}
|
|
2445
|
+
<Box
|
|
2446
|
+
component="div"
|
|
2447
|
+
sx={{ position: 'absolute', insetBlockEnd: gutter, insetInlineEnd: gutter, pointerEvents: 'auto' }}
|
|
2448
|
+
>
|
|
2449
|
+
<SceneControls
|
|
2450
|
+
compact={!isDesktop || (viewports?.includes('tablet') ?? false)}
|
|
2451
|
+
resetOnly={!isDesktop && isFullscreen}
|
|
2452
|
+
/>
|
|
2453
|
+
</Box>
|
|
1329
2454
|
</Box>
|
|
1330
|
-
|
|
2455
|
+
)}
|
|
2456
|
+
|
|
2457
|
+
{viewports !== null && !isDesktop && !isFullscreen && (
|
|
2458
|
+
<BottomSheet open={isSheetOpen} onOpenChange={setSheetOpen} label="Product details">
|
|
2459
|
+
<ProductPanel collapsed={!isSheetOpen} inSheet />
|
|
2460
|
+
</BottomSheet>
|
|
2461
|
+
)}
|
|
1331
2462
|
</Box>
|
|
1332
2463
|
)
|
|
1333
2464
|
}
|
|
@@ -1335,6 +2466,68 @@ const ConfiguratorLayout = () => {
|
|
|
1335
2466
|
export default phx.frontend.createCustomPhoenixLayoutElement('ConfiguratorLayout', ConfiguratorLayout)
|
|
1336
2467
|
```
|
|
1337
2468
|
|
|
2469
|
+
### ./src/elements/EdgeFinishHotspot.tsx
|
|
2470
|
+
|
|
2471
|
+
```tsx
|
|
2472
|
+
import { Box, ButtonBase, Popover, Tooltip } from '@mui/material'
|
|
2473
|
+
import { useState } from 'react'
|
|
2474
|
+
|
|
2475
|
+
import { phx } from '../../.phoenix/phx.js'
|
|
2476
|
+
import { EdgeFinishCards } from '../_shared/EdgeFinishCards.js'
|
|
2477
|
+
|
|
2478
|
+
// The edge profile the button shows, the square edge of the cards' drawings
|
|
2479
|
+
const EDGE_ICON = 'M3 7H17L21 11V13L17 17H3Z'
|
|
2480
|
+
|
|
2481
|
+
// Rendered by the spec's `htmlHotspot` on the table's edge: a button on the product that opens the edge finishes
|
|
2482
|
+
// next to the edge, with the same cards as the panel. The spec's `$filter` decides when it is shown.
|
|
2483
|
+
export default phx.frontend.createCustomPhoenixEntityElement('EdgeFinishHotspot', ({ entityId }) => {
|
|
2484
|
+
const edgeFinish = phx.frontend.useAttributeSelection(entityId, 'edgeFinish')
|
|
2485
|
+
const [anchor, setAnchor] = useState<HTMLElement | null>(null)
|
|
2486
|
+
|
|
2487
|
+
return (
|
|
2488
|
+
<>
|
|
2489
|
+
<Tooltip title="Edge finish">
|
|
2490
|
+
<ButtonBase
|
|
2491
|
+
aria-label="Edge finish"
|
|
2492
|
+
aria-haspopup="dialog"
|
|
2493
|
+
aria-expanded={anchor !== null}
|
|
2494
|
+
onClick={event => setAnchor(event.currentTarget)}
|
|
2495
|
+
sx={{
|
|
2496
|
+
display: 'grid',
|
|
2497
|
+
placeItems: 'center',
|
|
2498
|
+
inlineSize: 44,
|
|
2499
|
+
blockSize: 44,
|
|
2500
|
+
borderRadius: '50%',
|
|
2501
|
+
bgcolor: 'background.paper',
|
|
2502
|
+
color: 'primary.main',
|
|
2503
|
+
boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
|
|
2504
|
+
'&.Mui-focusVisible': { outline: 2, outlineColor: 'primary.main', outlineOffset: 2 },
|
|
2505
|
+
}}
|
|
2506
|
+
>
|
|
2507
|
+
<svg viewBox="0 0 24 24" width={22} height={22} aria-hidden>
|
|
2508
|
+
<path d={EDGE_ICON} fill="currentColor" />
|
|
2509
|
+
</svg>
|
|
2510
|
+
</ButtonBase>
|
|
2511
|
+
</Tooltip>
|
|
2512
|
+
<Popover
|
|
2513
|
+
open={anchor !== null}
|
|
2514
|
+
anchorEl={anchor}
|
|
2515
|
+
onClose={() => setAnchor(null)}
|
|
2516
|
+
anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
|
|
2517
|
+
transformOrigin={{ vertical: 'bottom', horizontal: 'center' }}
|
|
2518
|
+
slotProps={{
|
|
2519
|
+
paper: { role: 'dialog', 'aria-label': 'Edge finish', sx: { borderRadius: 4, marginBlockStart: -1 } },
|
|
2520
|
+
}}
|
|
2521
|
+
>
|
|
2522
|
+
<Box component="div" sx={{ inlineSize: 340, maxInlineSize: 'calc(100vw - 32px)', padding: 2 }}>
|
|
2523
|
+
<EdgeFinishCards selection={edgeFinish} />
|
|
2524
|
+
</Box>
|
|
2525
|
+
</Popover>
|
|
2526
|
+
</>
|
|
2527
|
+
)
|
|
2528
|
+
})
|
|
2529
|
+
```
|
|
2530
|
+
|
|
1338
2531
|
### ./src/expressions/table.ts
|
|
1339
2532
|
|
|
1340
2533
|
```ts
|