@salsita-ai/sdk 0.50.0-develop.8f6deac646 → 0.50.0-develop.9267bdc12e
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 +2 -2
- package/dist/application-spec/errors/diagnostic-codes.d.ts +5 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +5 -0
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +8 -1
- package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-defaults.d.ts +4 -2
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +48 -48
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +3 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-relation-expressions.js +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.d.ts +6 -8
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +11 -11
- package/dist/application-spec/generate-application/code/templates/domain-spec/index.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
- package/dist/application-spec/generate-application/code/templates/domain.js +3 -3
- package/dist/application-spec/generate-application/code/templates/globals.js +5 -4
- package/dist/application-spec/generate-application/code/templates/index.d.ts +0 -7
- package/dist/application-spec/generate-application/code/templates/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/package-json.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +8 -2
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +9 -10
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -4
- package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +1 -3
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +1 -3
- package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +2 -1
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +2 -4
- package/dist/application-spec/parse-application-files/categorize/module-analysis.d.ts +1 -1
- package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +1 -1
- 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/model/defaults.d.ts +7 -2
- package/dist/application-spec/parse-application-files/spec/model/defaults.js +1 -1
- package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.d.ts +25 -0
- package/dist/application-spec/parse-application-files/spec/relations/reference-field-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.d.ts +46 -0
- package/dist/application-spec/parse-application-files/spec/relations/relation-field-mismatch.js +1 -0
- package/dist/application-spec/parse-application-files/spec/relations/relations.d.ts +4 -3
- package/dist/application-spec/parse-application-files/spec/relations/relations.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/infra.d.ts +2 -0
- package/dist/application-spec/parse-application-files/spec/sections/infra.js +1 -1
- package/dist/configurator/application-runtime/extensions/create-configurator-extensions.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.d.ts +3 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +3 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +3 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.js +1 -1
- package/dist/configurator/common/configurator-interface.d.ts +5 -1
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +6 -0
- package/dist/configurator/pages/DefaultConfiguratorLayout.js +1 -0
- package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.d.ts +1 -75
- package/dist/configurator/ui/configurator-layout/universal/DesktopLayout.js +5 -20
- package/dist/configurator/ui/configurator-layout/universal/DesktopPreview.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/DesktopSidebar.d.ts +92 -0
- package/dist/configurator/ui/configurator-layout/universal/DesktopSidebar.js +16 -0
- package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +4 -4
- package/dist/configurator/ui/configurator-layout/universal/MobilePreview.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.d.ts +47 -0
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -0
- package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.d.ts +11 -26
- package/dist/configurator/ui/configurator-layout/universal/use-scene-safe-area.js +1 -1
- package/dist/docs/complex-use-cases/filtered-controls-with-fix-dialog.mdx +16 -19
- package/dist/docs/complex-use-cases/sketching.mdx +0 -38
- package/dist/docs/controls/select-attribute/cardselect.mdx +9 -13
- package/dist/docs/index.json +11 -1
- package/dist/docs/integrations/woocommerce/local-development.mdx +1 -1
- package/dist/docs/layouts/custom-layout.mdx +981 -0
- package/dist/docs/other-features/side-effects.mdx +8 -11
- package/dist/docs/other-features/violation-messages.mdx +52 -56
- package/dist/docs/phoenix/configurator-interface.mdx +105 -65
- package/dist/docs/phoenix/domain-model.mdx +4 -0
- package/dist/docs/phoenix/getting-started.mdx +1 -1
- package/dist/docs/phoenix/phoenix-cli.mdx +19 -26
- package/dist/docs/phoenix/project-structure.mdx +16 -10
- package/dist/docs/phoenix/quickstart.mdx +2 -2
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +2 -2
- package/dist/docs/phoenix/webhook-membership.mdx +10 -9
- package/dist/docs/phoenix/webhooks.mdx +2 -2
- package/dist/domain/admin-domain/implementation/common-admin-expressions.d.ts +26 -11
- package/dist/domain/admin-domain/implementation/common-admin-publish.d.ts +1 -2
- package/dist/domain/admin-domain/index.js +1 -1
- package/dist/domain/application/GetApplicationWrapperHandler.d.ts +2 -2
- package/dist/domain/application/GetThemeHandler.d.ts +1 -1
- package/dist/domain/application/GetWebComponentOptions.d.ts +1 -1
- package/dist/domain/application/application-config.d.ts +5 -3
- package/dist/domain/application/assistant/assistant-fields.d.ts +5 -0
- package/dist/domain/application/assistant/assistant-fields.js +1 -0
- package/dist/domain/application/assistant/assistant-resolved-manifest.d.ts +27 -1
- package/dist/domain/application/assistant/assistant-resolved-manifest.js +1 -1
- package/dist/domain/application/assistant/index.d.ts +4 -1
- package/dist/domain/application/assistant/index.js +1 -1
- package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.d.ts +20 -0
- package/dist/domain/application/assistant/session-setup/AssistantSetupHandler.js +1 -0
- package/dist/domain/application/assistant/session-setup/apply-assistant-setup.d.ts +10 -0
- package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -0
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +48 -0
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -0
- package/dist/domain/application/assistant/session-setup/create-session-assistant.d.ts +15 -0
- package/dist/domain/application/assistant/session-setup/create-session-assistant.js +1 -0
- package/dist/domain/application/assistant/session-setup/index.d.ts +4 -0
- package/dist/domain/application/assistant/session-setup/index.js +1 -0
- package/dist/domain/application/configurator-builder.d.ts +2 -2
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/create-initial-published-data.d.ts +6 -7
- package/dist/domain/application/index.d.ts +0 -4
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/published-data/DataRowValidatorHandler.d.ts +1 -1
- package/dist/domain/application/published-data/FilterPublishedChunksHandler.d.ts +1 -1
- package/dist/domain/application/published-data/MapPublishedChunkedDataHandler.d.ts +1 -1
- package/dist/domain/application/published-data/MapPublishedRevisionDataHandler.d.ts +1 -1
- package/dist/domain/application/published-data/SheetValidatorHandler.d.ts +1 -1
- package/dist/domain/application/published-data/map-published-chunked-data.d.ts +1 -1
- package/dist/domain/application/published-data/map-published-data.d.ts +7 -3
- package/dist/domain/core/component/domain-component-optic.d.ts +11 -19
- package/dist/domain/core/component/domain-component-optic.js +2 -2
- package/dist/domain/core/component/legacy-filter.d.ts +2 -17
- package/dist/domain/core/component/system-component-filter.d.ts +36 -18
- package/dist/domain/core/expression/constant-expressions.d.ts +16 -8
- package/dist/domain/core/expression/constant-expressions.js +1 -1
- package/dist/domain/core/expression/custom-expression.d.ts +17 -4
- package/dist/domain/core/expression/custom-expression.js +1 -1
- package/dist/domain/core/expression/expression.d.ts +1 -2
- package/dist/domain/core/invariant/custom-invariants.d.ts +6 -14
- package/dist/domain/core/invariant/invariants.d.ts +1 -4
- package/dist/domain/core/recipe/recipes.d.ts +18 -50
- package/dist/domain/core/recipe/recipes.js +1 -1
- package/dist/domain/core/relation/all-of-type-relation.d.ts +8 -21
- package/dist/domain/core/relation/all-of-type-relation.js +1 -1
- package/dist/domain/core/relation/direct-relation.d.ts +13 -24
- package/dist/domain/core/relation/index.d.ts +0 -1
- package/dist/domain/core/relation/indirect-relation.d.ts +12 -67
- package/dist/domain/core/relation/indirect-relation.js +1 -1
- package/dist/domain/core/relation/relation-factory.d.ts +19 -15
- package/dist/domain/core/relation/relation-factory.js +1 -1
- package/dist/domain/core/state/migrations.d.ts +14 -45
- package/dist/domain/core/state/migrations.js +1 -1
- package/dist/domain/core/state/state.d.ts +1 -1
- package/dist/domain/domain-builder.d.ts +1 -1
- package/dist/domain/domain-builder.js +1 -1
- package/dist/domain/domain-runtime/access/selectors.d.ts +9 -0
- package/dist/domain/domain-runtime/access/selectors.js +1 -1
- package/dist/domain/domain-runtime/access/types.d.ts +2 -0
- package/dist/domain/domain-runtime/access/types.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +14 -13
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-context/types.d.ts +4 -1
- package/dist/domain/domain-runtime/domain-runtime.d.ts +56 -40
- package/dist/domain/domain-runtime/errors/implementation-error-collector.d.ts +19 -0
- package/dist/domain/domain-runtime/errors/implementation-error-collector.js +1 -0
- package/dist/domain/domain-runtime/errors/implementation-error.d.ts +46 -0
- package/dist/domain/domain-runtime/errors/implementation-error.js +1 -0
- package/dist/domain/domain-runtime/errors/implementation-errors.d.ts +13 -0
- package/dist/domain/domain-runtime/errors/implementation-errors.js +1 -0
- package/dist/domain/domain-runtime/errors/index.d.ts +4 -0
- package/dist/domain/domain-runtime/errors/index.js +1 -0
- package/dist/domain/domain-runtime/errors/to-implementation-errors.d.ts +10 -0
- package/dist/domain/domain-runtime/errors/to-implementation-errors.js +1 -0
- package/dist/domain/domain-runtime/index.d.ts +1 -0
- package/dist/domain/domain-runtime/index.js +1 -1
- package/dist/domain/domain-runtime/spec/create-violation-expressions.d.ts +24 -0
- package/dist/domain/domain-runtime/spec/create-violation-expressions.js +1 -0
- package/dist/domain/domain-runtime/spec/index.d.ts +2 -5
- package/dist/domain/domain-runtime/spec/index.js +1 -1
- package/dist/domain/domain-runtime/spec/initialize.js +1 -1
- package/dist/domain/{application → domain-runtime/spec/module-checks}/element-registration.d.ts +2 -2
- package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -0
- package/dist/domain/{application → domain-runtime/spec/module-checks}/handler-registration.d.ts +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/handler-registration.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +8 -0
- package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -0
- package/dist/domain/{project-modules → domain-runtime/spec/module-checks}/project-modules.d.ts +8 -1
- package/dist/domain/domain-runtime/spec/module-checks/project-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/{resolve-action-modules.d.ts → module-checks/resolve-action-modules.d.ts} +2 -2
- package/dist/domain/domain-runtime/spec/module-checks/resolve-action-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/{resolve-component-optic-modules.d.ts → module-checks/resolve-component-optic-modules.d.ts} +2 -2
- package/dist/domain/domain-runtime/spec/module-checks/resolve-component-optic-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/{resolve-expression-modules.d.ts → module-checks/resolve-expression-modules.d.ts} +2 -2
- package/dist/domain/domain-runtime/spec/module-checks/resolve-expression-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.d.ts +22 -0
- package/dist/domain/domain-runtime/spec/module-checks/resolve-imported-transformers.js +1 -0
- package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.d.ts +6 -0
- package/dist/domain/domain-runtime/spec/module-checks/resolve-invariant-modules.js +1 -0
- package/dist/domain/domain-runtime/spec/selectors.d.ts +5 -6
- package/dist/domain/domain-runtime/spec/selectors.js +1 -1
- package/dist/domain/domain-runtime/spec/types.d.ts +2 -1
- package/dist/domain/index.d.ts +0 -1
- package/dist/domain/mocks/create-mock-domain-context.d.ts +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +18 -9
- package/dist/domain/mocks/create-mock-domain-runtime.js +1 -1
- package/dist/domain/mocks/create-mock-domain.d.ts +1 -1
- package/dist/domain/mocks/create-mock-domain.js +1 -1
- package/dist/domain/mocks/create-mock-state.d.ts +2 -2
- package/dist/domain/projections/blender-projections/camera.d.ts +1 -1
- package/dist/domain/utils/eval-cache.d.ts +1 -1
- package/dist/domain/utils/map-nested-object.d.ts +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +1 -2
- package/dist/editor/mocks/EditorMockContext.js +1 -1
- package/dist/legacy/domain-cli/gen/configurator-builder.js +13 -12
- package/dist/legacy/domain-cli/gen/constant-expressions.js +1 -3
- package/dist/legacy/domain-cli/gen/defaults.js +1 -7
- package/dist/legacy/domain-cli/gen/implementation.js +7 -11
- package/dist/legacy/domain-cli/gen/invariants.js +3 -4
- package/dist/legacy/domain-cli/gen/relations.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/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 +1 -0
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/domain-index.js +17 -15
- package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
- package/dist/phoenix/commands/init.d.ts +4 -4
- package/dist/phoenix/commands/init.js +1 -1
- package/dist/phoenix/commands/prettier.js +1 -1
- package/dist/phoenix/utils/git/index.d.ts +1 -0
- package/dist/phoenix/utils/git/index.js +1 -0
- package/dist/phoenix/utils/git/is-inside-git-repository.d.ts +6 -0
- package/dist/phoenix/utils/git/is-inside-git-repository.js +1 -0
- package/dist/phoenix/utils/index.d.ts +1 -0
- package/dist/phoenix/utils/index.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-access-service.d.ts +2 -0
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/routing/access-service.d.ts +1 -0
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +33 -16
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +4 -4
- package/dist/react-sdk/domain-context/index.d.ts +1 -1
- package/dist/react-sdk/domain-context/index.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +6 -0
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
- package/dist/webhook/builders/webhook-builder.js +1 -1
- package/package.json +3 -3
- package/dist/application-spec/generate-application/code/templates/env-ci.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/env-ci.js +0 -25
- package/dist/application-spec/generate-application/code/templates/env-example.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/env-example.js +0 -94
- package/dist/application-spec/generate-application/code/templates/prettier-ignore.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/prettier-ignore.js +0 -6
- package/dist/application-spec/generate-application/code/templates/private-assets-readme.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/private-assets-readme.js +0 -24
- package/dist/application-spec/generate-application/code/templates/public-assets-readme.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/public-assets-readme.js +0 -24
- package/dist/application-spec/generate-application/code/templates/readme.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/readme.js +0 -23
- package/dist/application-spec/generate-application/code/templates/skills/agents-md.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/skills/agents-md.js +0 -2
- package/dist/domain/application/element-registration.js +0 -1
- package/dist/domain/application/handler-registration.js +0 -1
- package/dist/domain/application/resolve-imported-transformers.d.ts +0 -22
- package/dist/domain/application/resolve-imported-transformers.js +0 -1
- package/dist/domain/application/resource-builder.d.ts +0 -13
- package/dist/domain/application/resource-builder.js +0 -1
- package/dist/domain/core/relation/relation-implementation.d.ts +0 -7
- package/dist/domain/core/relation/relation-implementation.js +0 -1
- package/dist/domain/domain-runtime/spec/invariant-builder.d.ts +0 -26
- package/dist/domain/domain-runtime/spec/invariant-builder.js +0 -1
- package/dist/domain/domain-runtime/spec/resolve-action-modules.js +0 -1
- package/dist/domain/domain-runtime/spec/resolve-component-optic-modules.js +0 -1
- package/dist/domain/domain-runtime/spec/resolve-expression-modules.js +0 -1
- package/dist/domain/domain-runtime/spec/resolve-invariant-modules.d.ts +0 -6
- package/dist/domain/domain-runtime/spec/resolve-invariant-modules.js +0 -1
- package/dist/domain/project-modules/index.d.ts +0 -1
- package/dist/domain/project-modules/index.js +0 -1
- package/dist/domain/project-modules/project-modules.js +0 -1
|
@@ -32,17 +32,14 @@ finishNotAvailable:
|
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
```ts
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
)
|
|
45
|
-
.buildViolationExpressions()
|
|
35
|
+
// src/invariants/invariants.ts
|
|
36
|
+
export default phx.domain.implementCustomInvariants({
|
|
37
|
+
Plate: {
|
|
38
|
+
finishNotAvailable: s => {
|
|
39
|
+
return availableMaterials.some(state => state.material === s.material && state.finish === s.finish)
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
})
|
|
46
43
|
```
|
|
47
44
|
|
|
48
45
|
With following control structure. The top input selects the material, the bottom one selects the finish.
|
|
@@ -153,10 +153,10 @@ The `formatControlViolationMessage` function is where the magic happens. It rece
|
|
|
153
153
|
3. **Actionable guidance**: Tell users exactly what values are valid or how to fix the problem
|
|
154
154
|
4. **Consistent terminology**: Use the same terms and units throughout your application
|
|
155
155
|
|
|
156
|
-
Implement violations with custom message formatting in
|
|
156
|
+
Implement violations with custom message formatting in a file of `src/invariants/`:
|
|
157
157
|
|
|
158
158
|
```typescript
|
|
159
|
-
//
|
|
159
|
+
// src/invariants/invariants.ts
|
|
160
160
|
|
|
161
161
|
// Pre-define translatable labels for nested localization
|
|
162
162
|
const colorLabels = {
|
|
@@ -166,60 +166,56 @@ const colorLabels = {
|
|
|
166
166
|
yellow: msg`yellow`,
|
|
167
167
|
} as const
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
})
|
|
221
|
-
)
|
|
222
|
-
.buildViolationExpressions()
|
|
169
|
+
export default phx.domain.implementCustomInvariants({
|
|
170
|
+
Buckyball: {
|
|
171
|
+
itIsNotZero: s => {
|
|
172
|
+
if (s.x !== 0) {
|
|
173
|
+
return [
|
|
174
|
+
{
|
|
175
|
+
type: 'itIsNotZero',
|
|
176
|
+
severity: 'fatal',
|
|
177
|
+
message: 'Scene is not zero',
|
|
178
|
+
controlViolationPriority: 1,
|
|
179
|
+
formatControlViolationMessage: () => {
|
|
180
|
+
return msg({
|
|
181
|
+
message: `Scene is not zero: The position would be ${s.x} which is not equal to 0`,
|
|
182
|
+
})
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
return []
|
|
188
|
+
},
|
|
189
|
+
// ... tooMuchRight omitted for brevity ...
|
|
190
|
+
|
|
191
|
+
// Static violation: severity, message and controlViolationPriority
|
|
192
|
+
// are declared in YAML. Implementation only returns a boolean.
|
|
193
|
+
wayTooFarRight: s => s.x < 200,
|
|
194
|
+
|
|
195
|
+
colorPositionIncompatible: s => {
|
|
196
|
+
const compatibleColors = ['red', 'blue', 'green'] as const
|
|
197
|
+
if (s.x >= 200 && !compatibleColors.includes(s.color)) {
|
|
198
|
+
return [
|
|
199
|
+
{
|
|
200
|
+
type: 'colorPositionIncompatible',
|
|
201
|
+
severity: 'fatal',
|
|
202
|
+
message: 'Color is not compatible with far right position',
|
|
203
|
+
controlViolationPriority: 3,
|
|
204
|
+
formatControlViolationMessage: (_emission, { i18n }) => {
|
|
205
|
+
const labels = new Intl.ListFormat(i18n.locale, {
|
|
206
|
+
style: 'long',
|
|
207
|
+
type: 'disjunction',
|
|
208
|
+
}).format(compatibleColors.map(c => i18n.t(colorLabels[c])))
|
|
209
|
+
|
|
210
|
+
return msg({ message: `Far right position is only available for ${labels}` })
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
return []
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
})
|
|
223
219
|
```
|
|
224
220
|
|
|
225
221
|
### Internationalization with Dynamic Content
|
|
@@ -25,8 +25,9 @@ The configurator interface is generated in `.phoenix/configurator-interface.ts`:
|
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
27
27
|
// .phoenix/configurator-interface.ts (AUTO-GENERATED - DO NOT EDIT)
|
|
28
|
-
import {
|
|
29
|
-
|
|
28
|
+
import { createConfiguratorInterface } from '@salsita-ai/sdk/configurator'
|
|
29
|
+
|
|
30
|
+
import { configuratorBuilder } from './domain.js'
|
|
30
31
|
|
|
31
32
|
export const configuratorInterface = createConfiguratorInterface(configuratorBuilder)
|
|
32
33
|
|
|
@@ -64,9 +65,9 @@ type CustomMaterial = Phx['AdminModel']['CustomMaterial']
|
|
|
64
65
|
Access the configurator interface via `phx.frontend`:
|
|
65
66
|
|
|
66
67
|
```typescript
|
|
67
|
-
export const CustomComponent = () => {
|
|
68
|
+
export const CustomComponent = () => {
|
|
68
69
|
// Access domain systems
|
|
69
|
-
const {
|
|
70
|
+
const { navigationSystem, storeSystem } = phx.frontend.useDomain()
|
|
70
71
|
|
|
71
72
|
// Entity state hooks
|
|
72
73
|
const rootEntity = phx.frontend.useRootEntityState()
|
|
@@ -76,11 +77,11 @@ export const CustomComponent = () => {'{'}
|
|
|
76
77
|
const selectEntity = phx.frontend.useSelectEntity()
|
|
77
78
|
|
|
78
79
|
// Type-safe entity access
|
|
79
|
-
if (selectedEntity && Cabinet.is(selectedEntity)) {
|
|
80
|
+
if (selectedEntity && Cabinet.is(selectedEntity)) {
|
|
80
81
|
// selectedEntity is now typed as $Cabinet
|
|
81
82
|
console.log(selectedEntity.width, selectedEntity.$area)
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
}
|
|
84
|
+
}
|
|
84
85
|
```
|
|
85
86
|
|
|
86
87
|
## Core Hooks
|
|
@@ -90,16 +91,16 @@ The configurator interface provides 100+ hooks organized by category. Use TypeSc
|
|
|
90
91
|
### Domain & Application Context
|
|
91
92
|
|
|
92
93
|
```typescript
|
|
93
|
-
const ExampleComponent = () => {
|
|
94
|
+
const ExampleComponent = () => {
|
|
94
95
|
// Core domain systems
|
|
95
|
-
const {
|
|
96
|
+
const { navigationSystem, storeSystem, entitySystem } = phx.frontend.useDomain()
|
|
96
97
|
|
|
97
98
|
// Domain application context
|
|
98
|
-
const {
|
|
99
|
+
const { configurationPersistSystem } = phx.frontend.useDomainApplication()
|
|
99
100
|
|
|
100
101
|
// Full configurator context
|
|
101
|
-
const {
|
|
102
|
-
|
|
102
|
+
const { imageRenderingSystem } = phx.frontend.useConfigurator()
|
|
103
|
+
}
|
|
103
104
|
```
|
|
104
105
|
|
|
105
106
|
### State Subscriptions
|
|
@@ -160,6 +161,10 @@ const toolState = phx.frontend.useActiveToolState()
|
|
|
160
161
|
const navigate = phx.frontend.useNavigate()
|
|
161
162
|
const pushNavigate = phx.frontend.usePushNavigate()
|
|
162
163
|
const popNavigate = phx.frontend.usePopNavigate()
|
|
164
|
+
|
|
165
|
+
// Fullscreen: a flag in the configurator's state that the layout honours; it does not put the browser into fullscreen
|
|
166
|
+
const isFullscreen = phx.frontend.useIsFullscreenActive()
|
|
167
|
+
const setFullscreen = phx.frontend.useSetFullscreen() // setFullscreen(true) or setFullscreen(false)
|
|
163
168
|
```
|
|
164
169
|
|
|
165
170
|
### Controls
|
|
@@ -209,7 +214,7 @@ const validity = phx.frontend.useStateValidity()
|
|
|
209
214
|
const controlViolations = phx.frontend.useControlViolations(entityId, controlId)
|
|
210
215
|
|
|
211
216
|
// Finalize violations
|
|
212
|
-
const {
|
|
217
|
+
const { disabled, hints } = phx.frontend.useFinalizeViolations()
|
|
213
218
|
|
|
214
219
|
// Map violations to hints
|
|
215
220
|
const mapViolationHints = phx.frontend.useMapViolationHints()
|
|
@@ -284,89 +289,89 @@ The interface provides factory functions for creating handlers and providers:
|
|
|
284
289
|
|
|
285
290
|
```typescript
|
|
286
291
|
// Runs early in app startup, before session auth
|
|
287
|
-
const OnApplicationStart = phx.frontend.createOnApplicationStartProvider(({
|
|
288
|
-
return <YourProvider>{
|
|
289
|
-
|
|
292
|
+
const OnApplicationStart = phx.frontend.createOnApplicationStartProvider(({ children }) => {
|
|
293
|
+
return <YourProvider>{children}</YourProvider>
|
|
294
|
+
})
|
|
290
295
|
|
|
291
296
|
// Runs after session auth, before domain data loading
|
|
292
|
-
const OnSessionReady = phx.frontend.createOnSessionReadyProvider(({
|
|
293
|
-
return <YourProvider>{
|
|
294
|
-
|
|
297
|
+
const OnSessionReady = phx.frontend.createOnSessionReadyProvider(({ children }) => {
|
|
298
|
+
return <YourProvider>{children}</YourProvider>
|
|
299
|
+
})
|
|
295
300
|
|
|
296
301
|
// Runs after published data is parsed, before frontend/backend loading
|
|
297
|
-
const OnPublishedDataReady = phx.frontend.createOnPublishedDataReadyProvider(({
|
|
298
|
-
return <YourProvider>{
|
|
299
|
-
|
|
302
|
+
const OnPublishedDataReady = phx.frontend.createOnPublishedDataReadyProvider(({ children }) => {
|
|
303
|
+
return <YourProvider>{children}</YourProvider>
|
|
304
|
+
})
|
|
300
305
|
|
|
301
306
|
// Runs after frontend collection and parsing, before backend loading
|
|
302
|
-
const OnFrontendDataReady = phx.frontend.createOnFrontendDataReadyProvider(({
|
|
303
|
-
return <YourProvider>{
|
|
304
|
-
|
|
307
|
+
const OnFrontendDataReady = phx.frontend.createOnFrontendDataReadyProvider(({ children }) => {
|
|
308
|
+
return <YourProvider>{children}</YourProvider>
|
|
309
|
+
})
|
|
305
310
|
|
|
306
311
|
// Runs after backend loading, before preset selection and configurator initialization
|
|
307
|
-
const OnBackendDataReady = phx.frontend.createOnBackendDataReadyProvider(({
|
|
308
|
-
return <YourProvider>{
|
|
309
|
-
|
|
312
|
+
const OnBackendDataReady = phx.frontend.createOnBackendDataReadyProvider(({ children }) => {
|
|
313
|
+
return <YourProvider>{children}</YourProvider>
|
|
314
|
+
})
|
|
310
315
|
|
|
311
316
|
// Runs after routing and preset selection are ready
|
|
312
|
-
const OnRoutingReady = phx.frontend.createOnRoutingReadyProvider(({
|
|
313
|
-
return <YourProvider>{
|
|
314
|
-
|
|
317
|
+
const OnRoutingReady = phx.frontend.createOnRoutingReadyProvider(({ children }) => {
|
|
318
|
+
return <YourProvider>{children}</YourProvider>
|
|
319
|
+
})
|
|
315
320
|
|
|
316
321
|
// Wraps OwnerUi and ReadUi pages
|
|
317
|
-
const OnConfiguratorReady = phx.frontend.createOnConfiguratorReadyProvider(({
|
|
318
|
-
return <YourProvider>{
|
|
319
|
-
|
|
322
|
+
const OnConfiguratorReady = phx.frontend.createOnConfiguratorReadyProvider(({ children }) => {
|
|
323
|
+
return <YourProvider>{children}</YourProvider>
|
|
324
|
+
})
|
|
320
325
|
```
|
|
321
326
|
|
|
322
327
|
### Data Handlers
|
|
323
328
|
|
|
324
329
|
```typescript
|
|
325
330
|
// Collect frontend data during initialization
|
|
326
|
-
const collectFrontendData = phx.frontend.createCollectFrontendDataHandler(async
|
|
327
|
-
return {
|
|
328
|
-
|
|
331
|
+
const collectFrontendData = phx.frontend.createCollectFrontendDataHandler(async context => {
|
|
332
|
+
return { customData: await fetchCustomData() }
|
|
333
|
+
})
|
|
329
334
|
|
|
330
335
|
// Override which published chunks are fetched by the frontend.
|
|
331
336
|
// See Publishing page for full documentation.
|
|
332
|
-
const filterPublishedChunks = phx.frontend.createFilterPublishedChunksHandler(() => {
|
|
337
|
+
const filterPublishedChunks = phx.frontend.createFilterPublishedChunksHandler(() => {
|
|
333
338
|
const session = phx.frontend.useSession()
|
|
334
339
|
|
|
335
|
-
return useMemo(() => {
|
|
340
|
+
return useMemo(() => {
|
|
336
341
|
if (session.sessionPayload?.role === 'admin') return ['styling', 'catalog-na']
|
|
337
342
|
return ['styling']
|
|
338
|
-
|
|
339
|
-
|
|
343
|
+
}, [session.sessionPayload?.role])
|
|
344
|
+
})
|
|
340
345
|
|
|
341
346
|
// Runs after preset data is loaded
|
|
342
|
-
const onPresetLoaded = phx.frontend.createOnPresetLoadedHandler((entities, presetData) => {
|
|
347
|
+
const onPresetLoaded = phx.frontend.createOnPresetLoadedHandler((entities, presetData) => {
|
|
343
348
|
// Can modify preset entities before rendering
|
|
344
349
|
return entities
|
|
345
|
-
|
|
350
|
+
})
|
|
346
351
|
|
|
347
352
|
// Intercept navigation to index/presets page
|
|
348
|
-
const onGoToIndex = phx.frontend.createOnGoToIndexHandler(() => {
|
|
353
|
+
const onGoToIndex = phx.frontend.createOnGoToIndexHandler(() => {
|
|
349
354
|
// Custom logic before navigating
|
|
350
|
-
|
|
355
|
+
})
|
|
351
356
|
```
|
|
352
357
|
|
|
353
358
|
### UI Components
|
|
354
359
|
|
|
355
360
|
```typescript
|
|
356
361
|
// Custom Phoenix layout element
|
|
357
|
-
const MyLayoutElement = phx.frontend.createCustomPhoenixLayoutElement(() => {
|
|
362
|
+
const MyLayoutElement = phx.frontend.createCustomPhoenixLayoutElement('MyLayoutElement', () => {
|
|
358
363
|
return <div>Custom Layout</div>
|
|
359
|
-
|
|
364
|
+
})
|
|
360
365
|
|
|
361
366
|
// Custom Phoenix entity element
|
|
362
|
-
const MyEntityElement = phx.frontend.createCustomPhoenixEntityElement(() => {
|
|
367
|
+
const MyEntityElement = phx.frontend.createCustomPhoenixEntityElement('MyEntityElement', () => {
|
|
363
368
|
return <mesh>...</mesh>
|
|
364
|
-
|
|
369
|
+
})
|
|
365
370
|
|
|
366
371
|
// Custom page when auth fails
|
|
367
|
-
const NotAuthenticatedPage = phx.frontend.createNotAuthenticatedPage(() => {
|
|
372
|
+
const NotAuthenticatedPage = phx.frontend.createNotAuthenticatedPage(() => {
|
|
368
373
|
return <div>Please log in</div>
|
|
369
|
-
|
|
374
|
+
})
|
|
370
375
|
```
|
|
371
376
|
|
|
372
377
|
### Preset UI
|
|
@@ -383,21 +388,56 @@ const PresetAction = phx.frontend.createPresetPageAction(PresetHelpAction)
|
|
|
383
388
|
const PresetOverlay = phx.frontend.createPresetDeviceNotSupported(SmallScreenNotice)
|
|
384
389
|
```
|
|
385
390
|
|
|
391
|
+
### Loaded Configuration UI
|
|
392
|
+
|
|
393
|
+
A layout element registered under the name `ConfiguratorLayout` replaces the whole UI of a loaded configuration, in owner and in read mode, whatever `layout` the spec sets. Without it, Phoenix renders the layout the spec selects. [Custom Layout](?path=/docs/layouts-custom-layout--docs) is a worked example: a fully custom product page with its panel on the left, built from the scene, the safe-area hook and state hooks.
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
// src/elements/ConfiguratorLayout.tsx
|
|
397
|
+
import { LayoutSlots, useSceneSafeArea } from '@salsita-ai/sdk/configurator'
|
|
398
|
+
|
|
399
|
+
const SIDEBAR_WIDTH = 320
|
|
400
|
+
|
|
401
|
+
export default phx.frontend.createCustomPhoenixLayoutElement('ConfiguratorLayout', () => {
|
|
402
|
+
const { containerRef, safeAreaRef } = useSceneSafeArea()
|
|
403
|
+
|
|
404
|
+
return (
|
|
405
|
+
<div ref={containerRef} style={{ position: 'absolute', inset: 0 }}>
|
|
406
|
+
<LayoutSlots.Services />
|
|
407
|
+
<LayoutSlots.SharedCanvas />
|
|
408
|
+
<aside style={{ position: 'absolute', insetBlock: 0, insetInlineStart: 0, inlineSize: SIDEBAR_WIDTH }}>
|
|
409
|
+
Project sidebar
|
|
410
|
+
</aside>
|
|
411
|
+
<div
|
|
412
|
+
ref={safeAreaRef}
|
|
413
|
+
style={{ position: 'absolute', insetBlock: 0, insetInlineStart: SIDEBAR_WIDTH, insetInlineEnd: 0, pointerEvents: 'none' }}
|
|
414
|
+
/>
|
|
415
|
+
</div>
|
|
416
|
+
)
|
|
417
|
+
})
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
- `LayoutSlots.SharedCanvas` renders the scene. It is absolutely positioned and fills its nearest positioned ancestor, so the layout's root is positioned and covers the page. The layout positions its own UI above the canvas and after it in the markup, as the `aside` does; unpositioned content is painted under the canvas.
|
|
421
|
+
- `useSceneSafeArea()`, called without arguments, tells the camera which part of the canvas the UI leaves free. Attach `containerRef` to the element that covers the whole canvas and `safeAreaRef` to the region the scene should stay visible in: the hook measures the gap between the two and the camera frames the scene inside the safe area. Without it the scene is framed in the whole canvas. The safe-area element lies over the canvas, so it sets `pointerEvents: 'none'` to leave orbiting and clicking to the scene. A `canvasPadding` component in the spec scales the measured gaps, see [Canvas Padding](?path=/docs/layouts-canvas-padding--docs).
|
|
422
|
+
- The layout has to mount `LayoutSlots.SharedCanvas`, or the project sets `appLoader: legacy`. Otherwise the app loader stays on screen.
|
|
423
|
+
- The layout composes the rest from what `@salsita-ai/sdk/configurator` exports: `LayoutSlots.Services` and the other members of `LayoutSlots`.
|
|
424
|
+
- Nothing of the built-in layouts is rendered for it. `Legacy.CommonFinalizePage` shows the page of the `finalizePage` component in a dialog while one of its finalize navigation states is active, so a layout that shows a finalize button mounts it; without it the button changes the navigation state and nothing appears. It is marked deprecated and is the only exported piece that does this. `LayoutDialog` renders only what the project registers with `createLayoutDialog` and is not part of the finalize flow. The preview start screen is `DesktopPreview` or `MobilePreview`, which the layout shows while `usePreview().isPreview` is set. Both previews frame the scene themselves, so the layout renders the component that calls `useSceneSafeArea()` only while `isPreview` is not set; it then measures when it mounts after the preview. The assistant panel is not available to a project layout.
|
|
425
|
+
- The layout reads the state it has to react to from hooks. Read mode: `phx.frontend.useAccessService().accessInfo.viewMode`. Fullscreen: `phx.frontend.useIsFullscreenActive()` reads it and `phx.frontend.useSetFullscreen()` sets it; the layout decides what to hide. Preview: `usePreview()` from `@salsita-ai/sdk/configurator`.
|
|
426
|
+
- Any project layout element named `ConfiguratorLayout` takes over the page.
|
|
427
|
+
|
|
386
428
|
## TransformerBuilder
|
|
387
429
|
|
|
388
430
|
Use `transformerBuilder` to create entity transformers:
|
|
389
431
|
|
|
390
432
|
```typescript
|
|
391
433
|
// Create a transformer that runs when specific conditions are met
|
|
392
|
-
const cabinetTransformer = phx.frontend.transformerBuilder
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
{'}'}
|
|
400
|
-
{'}'})
|
|
434
|
+
const cabinetTransformer = phx.frontend.transformerBuilder.when(Cabinet.is).do((cabinet, context) => {
|
|
435
|
+
// Transform cabinet data
|
|
436
|
+
return {
|
|
437
|
+
...cabinet,
|
|
438
|
+
$computedField: calculateSomething(cabinet),
|
|
439
|
+
}
|
|
440
|
+
})
|
|
401
441
|
```
|
|
402
442
|
|
|
403
443
|
**Note**: The deprecated `createTransformer` function should not be used for new implementations.
|
|
@@ -407,19 +447,19 @@ const cabinetTransformer = phx.frontend.transformerBuilder
|
|
|
407
447
|
The `updates` factory creates type-safe entity updates:
|
|
408
448
|
|
|
409
449
|
```typescript
|
|
410
|
-
const {
|
|
450
|
+
const { storeSystem } = phx.frontend.useDomain()
|
|
411
451
|
|
|
412
452
|
// Create new entity
|
|
413
|
-
const createUpdates = phx.frontend.updates.create({
|
|
453
|
+
const createUpdates = phx.frontend.updates.create({
|
|
414
454
|
type: 'Cabinet',
|
|
415
455
|
width: 800,
|
|
416
456
|
height: 2000,
|
|
417
|
-
|
|
457
|
+
})
|
|
418
458
|
|
|
419
459
|
// Modify existing entity
|
|
420
|
-
const modifyUpdates = phx.frontend.updates.modify(cabinetId, {
|
|
460
|
+
const modifyUpdates = phx.frontend.updates.modify(cabinetId, {
|
|
421
461
|
width: 1000,
|
|
422
|
-
|
|
462
|
+
})
|
|
423
463
|
|
|
424
464
|
// Delete entity
|
|
425
465
|
const deleteUpdates = phx.frontend.updates.delete(cabinetId)
|
|
@@ -565,9 +565,13 @@ A relation pair can have at most one composition owner. For an ownership relatio
|
|
|
565
565
|
Relations are validated when the application spec is parsed:
|
|
566
566
|
|
|
567
567
|
- **Every relation must be declared from both sides.** A relation on `A` targeting `B` needs a counterpart declared on `B` (or on an alias containing `B`) pointing back at `A` — with the opposite kind (`direct` ↔ `indirect`, `allOfType` ↔ `allOfType`) and the same `field`. A missing or mismatched counterpart fails parsing with `RELATION_MISSING_COUNTERPART`. Self‑referencing relations (target is the declaring type) act as their own counterpart and are exempt.
|
|
568
|
+
- **The field of a relation must hold references to the entities the relation relates to.** A `direct` relation reads a field of the entity it is declared on, and the field must reference exactly the entity types of the target. An `indirect` relation reads a field of the target, and the field must reference exactly the entity types the relation is declared on. A field that is not a `DomainEntityId` with `references` fails parsing with `RELATION_FIELD_NOT_REFERENCE`, and one that references other entity types with `RELATION_FIELD_REFERENCES_OTHER_TYPES`.
|
|
569
|
+
- **The field of a `direct` relation must hold its references the way the cardinality needs.** `1-1` needs one reference that is never `null`, `0-1` one reference or `null`, and `0-N` or `1-N` an array of references. Anything else fails parsing with `RELATION_FIELD_CARDINALITY_MISMATCH`. An `indirect` relation takes any of the three, because its cardinality counts the entities that point back.
|
|
568
570
|
- **At most one side may carry `composedOf: true`.** A pair may have one owner or no owner. Two owning sides fail parsing with `RELATION_COUNTERPART_COMPOSED_OF_MISMATCH` because the pair would define ownership in both directions.
|
|
569
571
|
- **Every entity type must be reachable from the root** through `composedOf` edges, otherwise parsing fails with `RELATION_ENTITY_NOT_IN_COMPOSITION_TREE`.
|
|
570
572
|
|
|
573
|
+
**What the field checks leave out.** A field whose schema states its type as text (`tsType`) or combines schemas with `allOf` is not checked, because the parser cannot tell what it holds. With a wrong field of that kind a `direct` relation fails when it is read, and an `indirect` relation finds no related entities and fails only if its cardinality requires one. When an alias holds the field, the relation is accepted if the field fits in at least one entity type of the alias.
|
|
574
|
+
|
|
571
575
|
**Why both sides?** The two declarations feed two different runtime systems. The `direct` side owns the id field and generates the reference bookkeeping: dangling ids are pruned when the referenced entity is deleted, and ids are written on create and replace. The `composedOf: true` side generates the composition edge: cascade deletes, the scene hierarchy, and the reachability check. Because these can be different entities — a parent may collect children by reverse lookup (`indirect` + `composedOf: true`) while each child stores the id — dropping either declaration silently disables one of the systems: without the parent side, deleting the parent leaves its children orphaned; without the child side, deleted entities leave dangling ids behind. The missing side also cannot be generated automatically, because the stored id field is compatible with many different relations: the reverse accessor's name is public API, and its cardinality (`0-N`, `1-N`, or a `0-1` slot) changes the generated types, state validation, and UI affordances without changing the stored data at all. Requiring both declarations turns these mistakes into parse errors instead of runtime surprises, and the redundancy lets the parser cross‑check the pair — a typo in `field` or a doubled owner is caught immediately.
|
|
572
576
|
|
|
573
577
|
### Picking a relation kind
|
|
@@ -86,7 +86,7 @@ For inspiration and real-world implementation patterns, examine deployed Salsita
|
|
|
86
86
|
|
|
87
87
|
When you encounter challenges or need to implement specific features, use these resources in order:
|
|
88
88
|
|
|
89
|
-
**AI-Powered Assistance**: Every Phoenix project ships
|
|
89
|
+
**AI-Powered Assistance**: Every Phoenix project ships Phoenix agent skills, so coding agents in your project already know the SDK conventions and CLI. Start by using AI coding assistants in the `configurator-phoenix` project. While they may not solve complex problems directly, they can point you toward relevant examples or search terms that will help you find the right solution.
|
|
90
90
|
|
|
91
91
|
**Storybook Documentation**: Search the Phoenix Storybook for functionality similar to what you need. When you find relevant examples, examine the corresponding code in the configurator-phoenix stories to understand the implementation details.
|
|
92
92
|
|
|
@@ -29,10 +29,11 @@ pnpm phoenix dev
|
|
|
29
29
|
|
|
30
30
|
1. Refuses to run when a `spec/` folder already exists, so it never touches an existing project.
|
|
31
31
|
2. Writes a `package.json` that depends on the CLI's SDK version when the folder has none. An existing `package.json` is kept, as long as it depends on the SDK.
|
|
32
|
-
3.
|
|
33
|
-
4. Writes `
|
|
32
|
+
3. Adds the `dev`, `build`, `deploy`, `check` and `fix` scripts to `package.json` (see [Project Scripts](#project-scripts)). A script the project already has under one of those names keeps its command.
|
|
33
|
+
4. Writes a starter spec (`spec/application.yaml`, `spec/configurator.yaml`) with one resizable, recolorable box, and switches `package.json` to the application-spec pipeline.
|
|
34
|
+
5. Writes `pnpm-workspace.yaml` with the pnpm settings the first install needs: the build scripts of the SDK's dependencies are allowed or denied, and `@salsita-ai/*` packages are exempt from pnpm's minimum release age. A project inside a pnpm monorepo gets no file; the workspace root holds these settings.
|
|
34
35
|
|
|
35
|
-
It asks nothing, writes no `.env` and contacts no server. `phoenix sync` then generates every other project file, including
|
|
36
|
+
It asks nothing, writes no `.env` and contacts no server. `phoenix sync` then generates every other project file, including the agent skills described in [Project Structure](?path=/docs/phoenix-project-structure--docs). The `.gitignore` is among them only when the folder is inside a git repository, so run `git init` before the first sync, or sync again after it.
|
|
36
37
|
|
|
37
38
|
### Which project `phoenix dev` develops in
|
|
38
39
|
|
|
@@ -114,8 +115,6 @@ For quick local development without a server, use:
|
|
|
114
115
|
|
|
115
116
|
```bash
|
|
116
117
|
phoenix dev --persistence local-storage
|
|
117
|
-
# or use the shortcut script:
|
|
118
|
-
pnpm dev:local
|
|
119
118
|
```
|
|
120
119
|
|
|
121
120
|
**Important:** The server must be running before `deployment:prepare-local` when using `server` persistence mode.
|
|
@@ -158,27 +157,19 @@ spec/application.yaml → Server prepares environment → CLI writes .env.genera
|
|
|
158
157
|
|
|
159
158
|
### Project Scripts
|
|
160
159
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
| Script
|
|
164
|
-
|
|
|
165
|
-
| `dev`
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
| `prettify:fix` | `prettier --write .` | Prettier fix only |
|
|
175
|
-
| `verify:fix` | `phoenix build && phoenix fix && phoenix check --types` | Build, fix, then type-check |
|
|
176
|
-
| `test` | `vitest --passWithNoTests run` | Run tests |
|
|
177
|
-
| `test:watch` | `vitest` | Tests in watch mode |
|
|
178
|
-
| `prepare:ci` | `phoenix prepare:ci` | CI environment setup |
|
|
179
|
-
| `deployment:prepare-local` | `phoenix deployment:prepare-local` | Prepare local environment |
|
|
180
|
-
|
|
181
|
-
Custom scripts you add to `package.json` are preserved during sync. Deprecated scripts (like `environment:create`, `deployment:register`) are automatically removed.
|
|
160
|
+
`phoenix init` writes five scripts into `package.json`, each a shortcut for the CLI command of the same name:
|
|
161
|
+
|
|
162
|
+
| Script | Command | Purpose |
|
|
163
|
+
| -------- | ---------------- | --------------------------------------------- |
|
|
164
|
+
| `dev` | `phoenix dev` | Dev server with hot reload |
|
|
165
|
+
| `build` | `phoenix build` | Production build |
|
|
166
|
+
| `deploy` | `phoenix deploy` | Build and publish the project |
|
|
167
|
+
| `check` | `phoenix check` | Run all checks (TypeScript, ESLint, Prettier) |
|
|
168
|
+
| `fix` | `phoenix fix` | Auto-fix lint and formatting issues |
|
|
169
|
+
|
|
170
|
+
The scripts are yours: change, rename or delete them, and add your own. `phoenix sync` and `phoenix clean` leave the `scripts` section of `package.json` as it is, so they add no script, restore none you removed and remove none. Every CLI command also runs without a script, as `pnpm phoenix <command>`.
|
|
171
|
+
|
|
172
|
+
A project may have other scripts than these five, such as `sync`, `test` or `verify:fix`; they are its own and stay as they are. All of this holds for a project on the application-spec pipeline, which `phoenix init` selects. In a project on the legacy pipeline (see [Current and legacy project tooling](#current-and-legacy-project-tooling)), `phoenix sync` and `phoenix clean` write their own set of scripts into `package.json` on every run, over scripts of the same name.
|
|
182
173
|
|
|
183
174
|
### Server-Generated Variables
|
|
184
175
|
|
|
@@ -399,6 +390,8 @@ Removes all build artifacts (`.phoenix/`, `node_modules/`), reinstalls dependenc
|
|
|
399
390
|
|
|
400
391
|
Syncs project dependencies and regenerates all project files without building Vite bundles or webhooks. Faster than `clean` — use this for routine updates after changing spec files or upgrading dependencies. Before installing, it adds the pnpm settings `phoenix init` writes to a standalone project's `pnpm-workspace.yaml` when they are missing; values you set there are kept.
|
|
401
392
|
|
|
393
|
+
With the application-spec pipeline (see [Current and legacy project tooling](#current-and-legacy-project-tooling)), `.gitignore` is written only when the project is inside a git repository: the project folder or one of its parent folders holds a `.git` entry. Outside a repository, sync neither creates the file nor changes one that is already there, and the same holds for `dev`, `build` and `clean`. Run `git init` before the first sync, or sync again after it, to get the file. The legacy pipeline writes `.gitignore` in every project.
|
|
394
|
+
|
|
402
395
|
| Flag | Env Variable | Default | Description |
|
|
403
396
|
| ---------------- | --------------- | ------- | ------------------------------ |
|
|
404
397
|
| `--force` / `-f` | `FORCE_REBUILD` | `false` | Force full rebuild, skip cache |
|
|
@@ -178,25 +178,29 @@ type CustomMaterial = Phx['AdminModel']['CustomMaterial']
|
|
|
178
178
|
|
|
179
179
|
| File | Auto-Generated? | Notes |
|
|
180
180
|
| ------------------------------------------------------ | --------------- | -------------------------------------- |
|
|
181
|
-
| `package.json` | Partially | Dependencies merged, scripts
|
|
181
|
+
| `package.json` | Partially | Dependencies merged, scripts untouched |
|
|
182
182
|
| `tsconfig.json` | Yes | Managed by Phoenix |
|
|
183
183
|
| `eslint.config.js` | Yes | Managed by Phoenix |
|
|
184
184
|
| `prettier.config.js` | Yes | Managed by Phoenix |
|
|
185
|
-
| `.prettierignore` |
|
|
185
|
+
| `.prettierignore` | No | Optional and your own; see below |
|
|
186
186
|
| `.linguirc` | Yes | Managed by Phoenix |
|
|
187
187
|
| `.nvmrc` | Yes | Managed by Phoenix |
|
|
188
|
-
| `.gitignore` | Partially |
|
|
188
|
+
| `.gitignore` | Partially | Only in a git repository; see Markers |
|
|
189
189
|
| `.env` | No | Git-ignored, local config |
|
|
190
190
|
| `.env.example` | No | Template for env vars |
|
|
191
191
|
| `.env.generated` | Yes | Auto-generated IDs, git-ignored |
|
|
192
192
|
| `README.md` | No | Project documentation |
|
|
193
|
-
| `AGENTS.md` |
|
|
193
|
+
| `AGENTS.md` | No | Your own coding-agent instructions |
|
|
194
194
|
| `.claude/skills/phoenix*/`, `.agents/skills/phoenix*/` | Yes | Phoenix agent skills |
|
|
195
195
|
|
|
196
|
+
Sync does not write `README.md`, `AGENTS.md`, `.env.example`, `.env.ci` or the `README.md` files in `assets/public/` and `assets/private/`. Earlier SDK versions wrote them once; a project that has them keeps them, and they are yours to edit.
|
|
197
|
+
|
|
198
|
+
With the application-spec pipeline (see [Current and legacy project tooling](?path=/docs/phoenix-phoenix-cli--docs#current-and-legacy-project-tooling)), Phoenix does not write a `.prettierignore`, and a fresh clone or CI checkout of a project has none. `phoenix check` and `phoenix fix` do not read one: they skip `.phoenix/`, `dist/`, the compiled catalogs in `src/locales/`, `pnpm-lock.yaml` and `.linguirc` on their own. A project that runs Prettier directly, as `prettier --check .` or from an editor, can add its own `.prettierignore`. To commit it, add a `!.prettierignore` line after the Phoenix block of `.gitignore`, because that block lists the file. The legacy pipeline writes `.prettierignore` on every sync.
|
|
199
|
+
|
|
196
200
|
### DO NOT EDIT (Fully Auto-Generated)
|
|
197
201
|
|
|
198
202
|
- **Everything in `.phoenix/`** - Completely regenerated on each build. The one exception is `.phoenix/variants/`, where a coding agent writes the option files for `phoenix variants`; a rebuild keeps it
|
|
199
|
-
- `tsconfig.json`, `eslint.config.js`, `prettier.config.js
|
|
203
|
+
- `tsconfig.json`, `eslint.config.js`, `prettier.config.js`
|
|
200
204
|
- `.linguirc`, `.nvmrc`
|
|
201
205
|
- `src/locales/**/*.ts` - Compiled from `.po` catalogs
|
|
202
206
|
- `.env.generated`
|
|
@@ -204,23 +208,25 @@ type CustomMaterial = Phx['AdminModel']['CustomMaterial']
|
|
|
204
208
|
|
|
205
209
|
### Agent Guidance
|
|
206
210
|
|
|
207
|
-
Coding agents (Claude Code, Codex, Cursor) read
|
|
211
|
+
Coding agents (Claude Code, Codex, Cursor) read the Phoenix agent skills. An `AGENTS.md` is yours to add for your own instructions; sync does not write one. The `phoenix`, `phoenix-cli`, `phoenix-feedback` and `phoenix-review` skills carry the SDK conventions, CLI tooling and review checklist, and the `phoenix-create-configurator` skill walks the agent from your product documents and assets to a reviewed configurator in five stages. The `phoenix-variants` skill has the agent show you several options over the dev preview when a decision is a matter of taste, and build the one you pick. Phoenix keeps them in step with the installed SDK, including the reference files inside a skill folder. During the internal beta, a project created from a canary build of the SDK gets one more section in the `phoenix` skill: once per conversation the agent checks for a newer canary and, after telling you, updates the project's SDK and runs `phoenix sync`. Other skill folders are never touched.
|
|
208
212
|
|
|
209
213
|
Projects created by earlier SDK versions had this guidance in `CLAUDE.md`, `.cursor/rules/phoenix.mdc` and `commands/review.md`. Sync removes the SDK block from the first two, keeps your own text around it, deletes a file that held nothing else, and deletes the review commands; use the `phoenix-review` skill instead of `/review`.
|
|
210
214
|
|
|
211
215
|
### Markers for Partial Auto-Generation
|
|
212
216
|
|
|
213
|
-
`.gitignore`
|
|
217
|
+
`.gitignore` holds the Phoenix entries between two marker lines. Sync rewrites that block and keeps everything outside it:
|
|
214
218
|
|
|
215
219
|
```gitignore
|
|
216
|
-
#
|
|
220
|
+
# ===== BEGIN PHOENIX AUTO-GENERATED =====
|
|
217
221
|
# ... Phoenix-managed ignores ...
|
|
218
|
-
#
|
|
222
|
+
# ===== END PHOENIX AUTO-GENERATED =====
|
|
219
223
|
|
|
220
|
-
# Your custom ignores
|
|
224
|
+
# Your custom ignores (preserved)
|
|
221
225
|
my-custom-folder/
|
|
222
226
|
```
|
|
223
227
|
|
|
228
|
+
With the application-spec pipeline (see [Current and legacy project tooling](?path=/docs/phoenix-phoenix-cli--docs#current-and-legacy-project-tooling)), sync writes `.gitignore` only when the project is inside a git repository: the project folder or one of its parent folders holds a `.git` entry. Outside a repository it neither creates the file nor changes one that is already there. Run `git init` before the first sync, or sync again after it, to get the file. The legacy pipeline writes the file in every project.
|
|
229
|
+
|
|
224
230
|
### Safe to Edit
|
|
225
231
|
|
|
226
232
|
- `src/` (except compiled `src/locales/**/*.ts` files)
|