@cratis/pi 8.4.1 → 8.6.0
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/package/corpus/harnesses/copilot/instructions/ai-distribution.instructions.md +2 -1
- package/package/corpus/harnesses/copilot/instructions/exit-codes-and-wrappers.instructions.md +1 -1
- package/package/corpus/harnesses/copilot/instructions/glossary.instructions.md +5 -3
- package/package/corpus/harnesses/copilot/instructions/react.instructions.md +3 -1
- package/package/corpus/harnesses/copilot/instructions/reactors.instructions.md +3 -1
- package/package/corpus/harnesses/copilot/instructions/scripting.instructions.md +2 -1
- package/package/corpus/harnesses/copilot/instructions/specs.csharp.instructions.md +6 -3
- package/package/corpus/harnesses/copilot/instructions/vertical-slices.instructions.md +5 -2
- package/package/corpus/hooks/scripts/cratis-guard-secrets.sh +131 -9
- package/package/corpus/rules/ai-distribution.md +2 -1
- package/package/corpus/rules/exit-codes-and-wrappers.md +1 -1
- package/package/corpus/rules/glossary.md +5 -3
- package/package/corpus/rules/react.md +3 -1
- package/package/corpus/rules/reactors.md +3 -1
- package/package/corpus/rules/scripting.md +2 -1
- package/package/corpus/rules/specs.csharp.md +6 -3
- package/package/corpus/rules/vertical-slices.md +5 -2
- package/package/corpus/skills/cratis-application-growth/SKILL.md +1 -2
- package/package/corpus/skills/cratis-application-growth/references/csharp.md +1 -3
- package/package/corpus/skills/cratis-application-growth/references/move-and-untangle.md +1 -2
- package/package/corpus/skills/cratis-application-growth/references/rename-window.md +1 -3
- package/package/corpus/skills/cratis-application-growth/references/service-and-delivery.md +3 -2
- package/package/corpus/skills/cratis-application-growth/references/stages.md +2 -2
- package/package/corpus/skills/cratis-arc-authorize-request/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/authproxy.md +47 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp-query-security.md +18 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/csharp.md +12 -3
- package/package/corpus/skills/cratis-arc-authorize-request/references/typescript.md +2 -0
- package/package/corpus/skills/cratis-arc-connect-storage/references/csharp.md +1 -0
- package/package/corpus/skills/cratis-arc-connect-storage/references/elixir.md +9 -2
- package/package/corpus/skills/cratis-arc-declare-command/SKILL.md +2 -0
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-chronicle.md +47 -8
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-controller.md +3 -1
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp-history.md +6 -3
- package/package/corpus/skills/cratis-arc-declare-command/references/csharp.md +38 -11
- package/package/corpus/skills/cratis-arc-declare-command/references/go.md +1 -1
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-abilities.md +2 -2
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp-recovery.md +6 -4
- package/package/corpus/skills/cratis-arc-declare-operation/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-arc-diagnose-live-query/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/csharp.md +29 -7
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/java.md +1 -1
- package/package/corpus/skills/cratis-arc-diagnose-live-query/references/kotlin.md +1 -1
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp-diagnose-tool-call.md +9 -7
- package/package/corpus/skills/cratis-arc-expose-mcp-operation/references/csharp.md +52 -1
- package/package/corpus/skills/cratis-arc-expose-query/SKILL.md +4 -2
- package/package/corpus/skills/cratis-arc-expose-query/references/csharp.md +36 -10
- package/package/corpus/skills/cratis-arc-expose-query/references/go.md +2 -2
- package/package/corpus/skills/cratis-arc-expose-query/references/typescript.md +6 -3
- package/package/corpus/skills/cratis-arc-generate-proxies/SKILL.md +1 -0
- package/package/corpus/skills/cratis-arc-generate-proxies/references/csharp.md +55 -6
- package/package/corpus/skills/cratis-arc-generate-proxies/references/typescript.md +9 -0
- package/package/corpus/skills/cratis-arc-host-application/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-configuration.md +54 -0
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-deployment.md +98 -0
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-http.md +9 -1
- package/package/corpus/skills/cratis-arc-host-application/references/csharp-identity.md +87 -4
- package/package/corpus/skills/cratis-arc-host-application/references/csharp.md +9 -0
- package/package/corpus/skills/cratis-arc-invoke-command/references/csharp-extensions.md +4 -0
- package/package/corpus/skills/cratis-arc-invoke-command/references/csharp.md +2 -1
- package/package/corpus/skills/cratis-arc-isolate-tenant/SKILL.md +19 -2
- package/package/corpus/skills/cratis-arc-isolate-tenant/references/csharp.md +4 -2
- package/package/corpus/skills/cratis-arc-page-query/references/csharp.md +2 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/SKILL.md +33 -36
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-commands.md +18 -3
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-host.md +94 -19
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-identity.md +29 -5
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-instant-feedback.md +81 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-localization.md +80 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-navigation.md +103 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-queries.md +41 -2
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript-structure.md +117 -0
- package/package/corpus/skills/cratis-arc-react-bind-slice/references/typescript.md +8 -4
- package/package/corpus/skills/cratis-arc-react-separate-view-model/SKILL.md +3 -3
- package/package/corpus/skills/cratis-arc-react-separate-view-model/references/typescript.md +27 -6
- package/package/corpus/skills/cratis-arc-testing-typescript/references/typescript.md +2 -2
- package/package/corpus/skills/cratis-arc-validate-command/references/csharp-rules.md +23 -2
- package/package/corpus/skills/cratis-arc-validate-command/references/csharp.md +28 -2
- package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +1 -0
- package/package/corpus/skills/cratis-authproxy-configure/SKILL.md +136 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/admission.md +125 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/aspire.md +154 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/operations.md +122 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/services-and-routing.md +114 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/sessions-and-logout.md +126 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/sign-in-providers.md +116 -0
- package/package/corpus/skills/cratis-authproxy-configure/references/tenant-resolution.md +135 -0
- package/package/corpus/skills/cratis-choreography-run-workflow/SKILL.md +117 -0
- package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp-chronicle.md +164 -0
- package/package/corpus/skills/cratis-choreography-run-workflow/references/csharp.md +354 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +6 -6
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/inspection.md +11 -3
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/project-tooling.md +50 -0
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/recovery-and-comparison.md +17 -3
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/setup-and-target.md +8 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp-services.md +13 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/csharp.md +12 -0
- package/package/corpus/skills/cratis-chronicle-connect-application/references/kotlin.md +2 -0
- package/package/corpus/skills/cratis-chronicle-connect-application/references/python.md +2 -2
- package/package/corpus/skills/cratis-chronicle-connect-application/references/typescript.md +10 -1
- package/package/corpus/skills/cratis-chronicle-constrain-append/SKILL.md +9 -2
- package/package/corpus/skills/cratis-chronicle-constrain-append/references/csharp.md +35 -3
- package/package/corpus/skills/cratis-chronicle-constrain-append/references/go.md +1 -1
- package/package/corpus/skills/cratis-chronicle-constrain-append/references/operations.md +70 -0
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/SKILL.md +6 -3
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/configuration.md +113 -16
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/container-and-kubernetes.md +293 -0
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/kernel-options.md +16 -9
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/network-and-tls.md +60 -7
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/storage.md +124 -2
- package/package/corpus/skills/cratis-chronicle-deploy-kernel/references/upgrade-and-recovery.md +36 -1
- package/package/corpus/skills/cratis-chronicle-evolve-event/SKILL.md +12 -0
- package/package/corpus/skills/cratis-chronicle-evolve-event/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-chronicle-inspect-observer/SKILL.md +15 -5
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/csharp.md +9 -8
- package/package/corpus/skills/cratis-chronicle-inspect-observer/references/go.md +2 -2
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +1 -1
- package/package/corpus/skills/cratis-chronicle-project-view/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-fluent.md +15 -4
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-model-bound.md +4 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp-reading.md +5 -2
- package/package/corpus/skills/cratis-chronicle-project-view/references/csharp.md +23 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/elixir.md +1 -0
- package/package/corpus/skills/cratis-chronicle-project-view/references/go.md +2 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/java.md +3 -1
- package/package/corpus/skills/cratis-chronicle-project-view/references/kotlin.md +4 -3
- package/package/corpus/skills/cratis-chronicle-project-view/references/typescript.md +3 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/SKILL.md +3 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp-scopes.md +41 -4
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/csharp.md +22 -4
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/elixir.md +7 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/go.md +9 -1
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/java.md +8 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/kotlin.md +9 -0
- package/package/corpus/skills/cratis-chronicle-protect-decision/references/typescript.md +7 -0
- package/package/corpus/skills/cratis-chronicle-protect-personal-data/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-protect-personal-data/references/csharp.md +28 -3
- package/package/corpus/skills/cratis-chronicle-publish-contract/SKILL.md +7 -6
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/csharp.md +41 -0
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/elixir-integrations.md +3 -3
- package/package/corpus/skills/cratis-chronicle-publish-contract/references/webhook-signature-wire-format.md +82 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/SKILL.md +19 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-outputs.md +3 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp-pages.md +1 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/csharp.md +37 -4
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/elixir.md +11 -0
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/java.md +2 -1
- package/package/corpus/skills/cratis-chronicle-react-to-fact/references/kotlin.md +1 -0
- package/package/corpus/skills/cratis-chronicle-record-event/SKILL.md +3 -3
- package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-coordination.md +31 -2
- package/package/corpus/skills/cratis-chronicle-record-event/references/csharp-history.md +21 -4
- package/package/corpus/skills/cratis-chronicle-record-event/references/csharp.md +20 -2
- package/package/corpus/skills/cratis-chronicle-record-event/references/go.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/java.md +1 -1
- package/package/corpus/skills/cratis-chronicle-record-event/references/kotlin.md +3 -0
- package/package/corpus/skills/cratis-chronicle-reduce-state/SKILL.md +2 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/csharp.md +3 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/java.md +10 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/kotlin.md +10 -1
- package/package/corpus/skills/cratis-chronicle-reduce-state/references/typescript.md +27 -5
- package/package/corpus/skills/cratis-chronicle-select-client/SKILL.md +18 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/elixir.md +21 -1
- package/package/corpus/skills/cratis-chronicle-select-client/references/go.md +13 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/java.md +15 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/kotlin.md +15 -0
- package/package/corpus/skills/cratis-chronicle-select-client/references/typescript.md +16 -0
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +1 -1
- package/package/corpus/skills/cratis-ci-pipeline-performance/SKILL.md +4 -3
- package/package/corpus/skills/cratis-ci-pipeline-performance/references/publish-pipelines.md +19 -4
- package/package/corpus/skills/cratis-code-review/SKILL.md +6 -2
- package/package/corpus/skills/cratis-code-review/references/csharp-diagnostics.md +28 -2
- package/package/corpus/skills/cratis-code-review/references/csharp.md +4 -4
- package/package/corpus/skills/cratis-commits-and-pull-requests/SKILL.md +6 -38
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-description.md +2 -0
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/pr-labels-and-release.md +5 -4
- package/package/corpus/skills/cratis-commits-and-pull-requests/references/workflow-inputs.md +39 -0
- package/package/corpus/skills/cratis-components-accessibility/SKILL.md +6 -8
- package/package/corpus/skills/cratis-components-accessibility/references/typescript.md +32 -14
- package/package/corpus/skills/cratis-components-build-canvas/SKILL.md +4 -3
- package/package/corpus/skills/cratis-components-build-canvas/references/typescript-props.md +1 -1
- package/package/corpus/skills/cratis-components-build-canvas/references/typescript.md +4 -2
- package/package/corpus/skills/cratis-components-choose-control/SKILL.md +13 -7
- package/package/corpus/skills/cratis-components-choose-control/references/from-primereact.md +116 -0
- package/package/corpus/skills/cratis-components-choose-control/references/menu.md +90 -0
- package/package/corpus/skills/cratis-components-choose-control/references/typescript-composition.md +48 -0
- package/package/corpus/skills/cratis-components-choose-control/references/typescript.md +2 -2
- package/package/corpus/skills/cratis-components-compose-toolbar/SKILL.md +2 -1
- package/package/corpus/skills/cratis-components-compose-toolbar/references/floating-toolbar.md +146 -0
- package/package/corpus/skills/cratis-components-diagnose-screen/SKILL.md +102 -0
- package/package/corpus/skills/cratis-components-display-list/SKILL.md +10 -10
- package/package/corpus/skills/cratis-components-display-list/references/typescript-custom-panel.md +74 -0
- package/package/corpus/skills/cratis-components-display-list/references/typescript-datatables.md +2 -7
- package/package/corpus/skills/cratis-components-display-list/references/typescript.md +3 -2
- package/package/corpus/skills/cratis-components-submit-form/SKILL.md +6 -6
- package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md +21 -1
- package/package/corpus/skills/cratis-components-submit-form/references/typescript-commandform.md +72 -2
- package/package/corpus/skills/cratis-components-submit-form/references/typescript.md +7 -5
- package/package/corpus/skills/cratis-components-theme-application/SKILL.md +17 -15
- package/package/corpus/skills/cratis-components-theme-application/references/localization.md +166 -0
- package/package/corpus/skills/cratis-components-theme-application/references/typescript.md +18 -14
- package/package/corpus/skills/cratis-components-theme-application/references/upgrade-from-previous-major.md +141 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +2 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-domain-philosophy.md +31 -3
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp-fundamentals-helpers.md +119 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/csharp.md +4 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/csharp-serialization.md +72 -1
- package/package/corpus/skills/cratis-fundamentals-concept/references/csharp.md +9 -0
- package/package/corpus/skills/cratis-fundamentals-concept/references/go.md +2 -1
- package/package/corpus/skills/cratis-fundamentals-concept/references/java-json.md +3 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/kotlin-json.md +3 -2
- package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-serialization.md +41 -2
- package/package/corpus/skills/cratis-fundamentals-name-value/SKILL.md +8 -7
- package/package/corpus/skills/cratis-fundamentals-name-value/references/csharp.md +2 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +3 -3
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp-diagnostics.md +8 -0
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/csharp.md +2 -2
- package/package/corpus/skills/cratis-fundamentals-type-discovery/references/go-dependency-injection.md +3 -0
- package/package/corpus/skills/cratis-modeling-design-event-model/SKILL.md +6 -4
- package/package/corpus/skills/cratis-modeling-design-event-model/references/command-inventory.md +7 -1
- package/package/corpus/skills/cratis-modeling-design-event-model/references/model-first.md +13 -1
- package/package/corpus/skills/cratis-modeling-design-event-model/references/review-one-slice.md +6 -0
- package/package/corpus/skills/cratis-multi-service-local-orchestration/SKILL.md +6 -6
- package/package/corpus/skills/cratis-multi-service-local-orchestration/references/csharp-aspire.md +116 -28
- package/package/corpus/skills/cratis-multi-service-local-orchestration/references/docker-compose.md +2 -2
- package/package/corpus/skills/cratis-observability/references/chronicle-kernel-export.md +46 -0
- package/package/corpus/skills/cratis-orleans-jobs/SKILL.md +4 -2
- package/package/corpus/skills/cratis-platform-build-application/SKILL.md +8 -0
- package/package/corpus/skills/cratis-platform-build-application/references/cratis-identity.md +71 -0
- package/package/corpus/skills/cratis-platform-build-application/references/studio-repository.md +96 -0
- package/package/corpus/skills/cratis-platform-deliver-slice/SKILL.md +14 -8
- package/package/corpus/skills/cratis-platform-deliver-slice/references/csharp.md +167 -3
- package/package/corpus/skills/cratis-platform-deliver-slice/references/eventual-consistency.md +150 -0
- package/package/corpus/skills/cratis-platform-deliver-slice/references/typescript.md +14 -1
- package/package/corpus/skills/cratis-platform-diagnose-slice/SKILL.md +1 -1
- package/package/corpus/skills/cratis-platform-prepare-release-pr/SKILL.md +8 -8
- package/package/corpus/skills/cratis-platform-prepare-release-pr/references/product-release-checks.md +16 -2
- package/package/corpus/skills/cratis-platform-start-application/SKILL.md +21 -0
- package/package/corpus/skills/cratis-platform-start-application/references/csharp.md +77 -3
- package/package/corpus/skills/cratis-platform-upgrade-application/SKILL.md +118 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/csharp.md +117 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/java.md +53 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/kotlin.md +53 -0
- package/package/corpus/skills/cratis-platform-upgrade-application/references/typescript.md +71 -0
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/references/publish-repair.md +6 -3
- package/package/corpus/skills/cratis-screenplay-accept-model/references/csharp.md +34 -3
- package/package/corpus/skills/cratis-screenplay-accept-model/references/read-the-evidence.md +84 -3
- package/package/corpus/skills/cratis-screenplay-declare-slice/SKILL.md +7 -11
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/commands.md +8 -4
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/projections.md +2 -0
- package/package/corpus/skills/cratis-screenplay-declare-slice/references/structure-and-imports.md +29 -1
- package/package/corpus/skills/cratis-screenplay-edit-workspace/SKILL.md +2 -1
- package/package/corpus/skills/cratis-screenplay-edit-workspace/references/mcp-tools.md +1 -1
- package/package/corpus/skills/cratis-screenplay-handoff-slice/references/csharp.md +13 -1
- package/package/corpus/skills/cratis-screenplay-model-translation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-translation/references/boundary-diagnostics.md +1 -1
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/SKILL.md +30 -51
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/cli.md +19 -2
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/smallest-model.md +87 -0
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/studio.md +5 -0
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/typescript.md +13 -0
- package/package/corpus/skills/cratis-screenplay-onboard-workspace/references/workspace-mcp.md +5 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/SKILL.md +8 -12
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/running-mcp.md +12 -0
- package/package/corpus/skills/cratis-screenplay-specify-outcome/references/scenarios.md +2 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/SKILL.md +2 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-colocated.md +101 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-command-results.md +4 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-decision-reads.md +1 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-events.md +7 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-integration.md +7 -4
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-reactors.md +18 -5
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp-read-models.md +4 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/csharp.md +35 -2
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/elixir.md +2 -0
- package/package/corpus/skills/cratis-specifications-exercise-backend/references/typescript.md +4 -2
- package/package/corpus/skills/cratis-specifications-isolate-behavior/SKILL.md +1 -1
- package/package/corpus/skills/cratis-specifications-isolate-behavior/references/csharp-running.md +10 -3
- package/package/corpus/skills/cratis-specifications-test-application-ui/references/typescript.md +22 -4
- package/package/corpus/skills/cratis-specifications-test-typescript-behavior/SKILL.md +2 -1
- package/package/corpus/skills/cratis-specifications-test-typescript-behavior/references/typescript.md +40 -0
- package/package/corpus/skills/cratis-stage-render-slice/SKILL.md +6 -0
- package/package/corpus/skills/cratis-stage-render-slice/references/semantic-conformance.md +64 -0
- package/package/profile-catalog.json +15 -0
- package/package.json +1 -1
|
@@ -56,15 +56,15 @@ Choose `CommandForm` instead when the input stays on the page: put the same fiel
|
|
|
56
56
|
**Submission in the Components containers.** Confirm (or Submit) starts a busy state: the primary button shows a spinner and dialog dismissal is blocked. `CommandDialog` makes fields inert; steppers keep fields editable unless `confirmBeforeExecute` is set and disable Next and Submit (`StepperCommandDialog` also Previous and Cancel). Then, in order:
|
|
57
57
|
|
|
58
58
|
1. `onBeforeExecute` — sync or async, must return the values; a missing return keeps the current values with a warning; a throw stops everything.
|
|
59
|
-
2. `confirmBeforeExecute` — executes only on literal `true
|
|
59
|
+
2. `confirmBeforeExecute` — executes only on literal `true`. Any other answer, or values changed while it was pending, skips execution with no result callback; a throw or rejection also skips it and goes to `onException` (logged when absent).
|
|
60
60
|
3. The command runs; busy ends; result callbacks are awaited.
|
|
61
61
|
4. Success: `onSuccess(response)`, then the close decision. Failure: `onFailed`, then as they apply `onException`, `onUnauthorized`, `onValidationFailure`; the result is applied to the fields and the container stays open. In `CommandDialog` only, a validation refusal is announced (`validationAnnouncement`) and focus moves to the first invalid field; steppers just show the messages.
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
On `CommandDialog` and `StepperCommandDialog`, `formRef`'s `execute()` runs this same submission (transform, confirmation, result callbacks, close on success). On a standalone `CommandStepper` it reaches the inner form and skips the stepper's transform and confirmation; use the stepper's Submit. Prefer the containers' own buttons, relabelled.
|
|
64
64
|
|
|
65
65
|
A callback that throws or rejects stops the chain: no later callback, no field messages, no close; the command outcome stands.
|
|
66
66
|
|
|
67
|
-
**Inline `CommandForm`.** It renders a native form: a submit button inside it runs it, as does `execute()` on `formRef` (see Inline CommandForm in your language reference). There is no validity gate: only a custom field error blocks before the transform; the command's own client validation then refuses invalid values without a request. `onBeforeExecute` is synchronous and there is no `confirmBeforeExecute`. The result is published to the form first, then callbacks fire unawaited. `execute()` resolves with the result, including refusals and server exceptions; a throw (for example in the transform) rejects it and shows nothing, so catch it.
|
|
67
|
+
**Inline `CommandForm`.** It renders a native form: a submit button inside it runs it, as does `execute()` on `formRef` (see Inline CommandForm in your language reference). There is no validity gate: only a custom field error blocks before the transform; the command's own client validation then refuses invalid values without a request. `onBeforeExecute` is synchronous and there is no `confirmBeforeExecute`. The result is published to the form first, then callbacks fire unawaited. `execute()` resolves with the result, including refusals and server exceptions; a throw (for example in the transform) rejects it and shows nothing, so catch it. An `onFieldValidate` message blocks execution and reports through `onFailed` and `onValidationFailure`. Nothing closes or resets. Field errors, a summary of results no field claims, and the safe `exceptionMessage` render inside the form unless `showErrors` is false — never raw exception text.
|
|
68
68
|
|
|
69
69
|
**Closing.** `CommandDialog` closes through the surrounding `useDialog` context:
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ A callback that throws or rejects stops the chain: no later callback, no field m
|
|
|
74
74
|
- Failure or a refused confirmation never closes. A close veto does not undo a successful command.
|
|
75
75
|
- Without `useDialog` nothing closes itself: render the dialog conditionally and hide it from `onSuccess` and `onCancel`.
|
|
76
76
|
|
|
77
|
-
**Steps.** Each element child of a stepper is one step: one `StepperPanel` per step
|
|
77
|
+
**Steps.** Each element child of a stepper is one step: use one `StepperPanel` per step with a distinct `header`, and put each bound property on exactly one step. Next is refused while the current step shows field errors; moving back is always allowed. `StepperCommandDialog` closes like `CommandDialog`; `CommandStepper` stays in place after success, so navigate or reset from `onSuccess`. Both use the same transform, confirmation and callback sequence. Keep the built-in navigation and relabel it. Step rules, Submit visibility and styling attributes: see Several steps in your language reference.
|
|
78
78
|
|
|
79
79
|
**Binding.** Fields bind wherever they render inside the form, including inside layout elements and custom components. A field binds one top-level property: a nested accessor binds its first member, and `fieldName` is a literal property name for a computed accessor. Edit an object-valued property with one custom field (see Nested data in your language reference). Server validation results map to fields by member name; results no field claims go to the summary.
|
|
80
80
|
|
|
@@ -94,9 +94,9 @@ Fields and generation come from Components' form entry point, containers from it
|
|
|
94
94
|
| `onFieldChange` | Notified per change with old and new value and that field's validity. |
|
|
95
95
|
| `onBeforeExecute` | Transform values just before execution and return them; never for required values (validation already ran). |
|
|
96
96
|
| `onSuccess` | Receives the command response. |
|
|
97
|
-
| `onFailed`, `onException`, `onUnauthorized`, `onValidationFailure` | Failure callbacks
|
|
97
|
+
| `onFailed`, `onException`, `onUnauthorized`, `onValidationFailure` | Failure callbacks; for a failed command result the applicable ones run in that order. A declined `confirmBeforeExecute` calls none; one that throws calls only `onException`, with no command result. Signatures: `onFailed(result)` (the whole result, including `correlationId`), `onException(messages, stackTrace)` (no result), `onUnauthorized()`, `onValidationFailure(validationResults)`. Log exception diagnostics; never show them. |
|
|
98
98
|
| `formRef` | Handle with `execute()` and live `isExecuting`, `isValid`, `isAuthorized`, `validation`; run the form from outside it. |
|
|
99
|
-
| `onStateChange` | Called when execution, validity or
|
|
99
|
+
| `onStateChange` | Called when execution, validity, authorization or the validation snapshot changes. |
|
|
100
100
|
| `showTitles`, `showErrors` | Field titles; errors, summary and exception panel (both default on). |
|
|
101
101
|
| `exceptionMessage` | Safe, localized text shown when the command throws. |
|
|
102
102
|
| `validationSummaryComponent`, `exceptionDisplayComponent` | Replace the summary (a visible one needs an alert role) or the exception panel. |
|
package/package/corpus/skills/cratis-components-submit-form/references/typescript-commanddialog.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- Transform before executing
|
|
6
6
|
- Confirm before executing
|
|
7
|
+
- Submit from outside the dialog
|
|
7
8
|
- Yes and No buttons
|
|
8
9
|
- Several steps
|
|
9
10
|
- Stepper layout and styling
|
|
@@ -46,6 +47,16 @@ export const SiteDialogs = () => (
|
|
|
46
47
|
|
|
47
48
|
In an app that opens dialogs with `useDialog`, render the `useDialog` wrapper inside `DialogComponents`, usually registered once at the app root.
|
|
48
49
|
|
|
50
|
+
Any answer other than `true` skips execution without calling a result callback. A throw or rejection also skips it and is reported through `onException`, or logged when there is none.
|
|
51
|
+
|
|
52
|
+
## Submit from outside the dialog
|
|
53
|
+
|
|
54
|
+
On `CommandDialog` and `StepperCommandDialog`, `formRef.current?.execute()` runs the dialog's own submission, the one its confirm button runs: `onBeforeExecute`, `confirmBeforeExecute`, the command, the result callbacks, and the close on success. Do not close the dialog again afterwards.
|
|
55
|
+
|
|
56
|
+
The promise resolves with the command result when the command ran. When it did not run (a declined or failed confirmation, values changed while pending, a submission already running, or a close being decided) it resolves with a result whose `isSuccess` is `false` and that carries no errors. Always check `isSuccess`.
|
|
57
|
+
|
|
58
|
+
On a standalone `CommandStepper`, `formRef` reaches the inner `CommandForm`, so `execute()` skips the stepper's `onBeforeExecute` and `confirmBeforeExecute`. Use the stepper's Submit button instead.
|
|
59
|
+
|
|
49
60
|
## Yes and No buttons
|
|
50
61
|
|
|
51
62
|
Use `buttons={DialogButtons.YesNo}` when the dialog asks a question and has no fields to review; keep the default OK and Cancel for a form.
|
|
@@ -85,7 +96,16 @@ Use `StepperCommandDialog` in a dialog and `CommandStepper` on a page. Give each
|
|
|
85
96
|
</CommandStepper>
|
|
86
97
|
```
|
|
87
98
|
|
|
88
|
-
A conditional step is `{needsBilling && <StepperPanel header="Billing">…</StepperPanel>}`; hiding it keeps its values and the command's rules for them.
|
|
99
|
+
A conditional step is `{needsBilling && <StepperPanel header="Billing">…</StepperPanel>}`; hiding it keeps its values and the command's rules for them.
|
|
100
|
+
|
|
101
|
+
Step rules:
|
|
102
|
+
|
|
103
|
+
- Each element child is one step; a fragment around several panels is one step.
|
|
104
|
+
- A step's fields are found in its panel's element tree; a field that a custom component renders internally does not count for that step.
|
|
105
|
+
- Next (or a header, with `linear` off) is refused while the current step shows field errors. These are displayed errors, not missing values: under blur validation an untouched blank field does not block it, unless `validateOnInit` is set.
|
|
106
|
+
- Moving back is always allowed. With `linear` (the default) headers are not clickable. `onChangeStep` reports an accepted move.
|
|
107
|
+
- `StepperCommandDialog` hides Submit until the last step and a valid form, and offers no footer Cancel unless `showCancel` is set.
|
|
108
|
+
- `CommandStepper` shows Submit on the last step, disabled while the form is invalid or busy, or while any step shows field errors. On `CommandStepper`, `showNavigation={false}` hides the whole built-in footer, Submit included, and `showSubmit={false}` hides only Submit; labels fall back to the provider's stepper messages.
|
|
89
109
|
|
|
90
110
|
## Stepper layout and styling
|
|
91
111
|
|
package/package/corpus/skills/cratis-components-submit-form/references/typescript-commandform.md
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
- The execute() result
|
|
8
8
|
- Inside the form
|
|
9
9
|
- Context operations
|
|
10
|
+
- Extend the form
|
|
11
|
+
- Autosave (edge case)
|
|
10
12
|
- Validation state
|
|
11
13
|
- Presentation and shared defaults
|
|
12
14
|
|
|
@@ -14,7 +16,7 @@
|
|
|
14
16
|
|
|
15
17
|
## Edit form on a page
|
|
16
18
|
|
|
17
|
-
Populate from a **single-item** query whose properties match the command by name; a collection query throws
|
|
19
|
+
Populate from a **single-item** query whose properties match the command by name; a collection query throws `QueryReturnsMultipleInstances`. Nothing closes or resets after success, so decide the follow-up in `onSuccess`.
|
|
18
20
|
|
|
19
21
|
```tsx
|
|
20
22
|
<CommandForm<UpdateSite> command={UpdateSite} populateFromQuery={SiteById}
|
|
@@ -50,7 +52,7 @@ The handle also exposes `isExecuting`, `isValid`, `isAuthorized` and `validation
|
|
|
50
52
|
|
|
51
53
|
## Inside the form
|
|
52
54
|
|
|
53
|
-
- `useCommandInstance<UpdateSite>()` reads the form's command instance from a child; never construct a second command.
|
|
55
|
+
- `useCommandInstance<UpdateSite>()` reads the form's command instance from a child; never construct a second command (see Extend the form).
|
|
54
56
|
- `useCommandFormContext<UpdateSite>()` exposes the form's state and operations; it throws outside a form.
|
|
55
57
|
- `useIsCommandExecuting()` returns the busy flag, e.g. to disable the submit button.
|
|
56
58
|
- `<ValidationMessage<UpdateSite> value={site => site.name} />` shows one property's message where you place it; `ValidationSummary` is the default display for results no field claims.
|
|
@@ -72,6 +74,73 @@ The handle also exposes `isExecuting`, `isValid`, `isAuthorized` and `validation
|
|
|
72
74
|
|
|
73
75
|
Use `setCustomFieldError` for a rule only the client can check, such as two fields that must agree. While any custom error is set, `isValid` is `false` and `execute()` stops before sending.
|
|
74
76
|
|
|
77
|
+
## Extend the form
|
|
78
|
+
|
|
79
|
+
Everything that reads or submits the form's values sits beneath the form and uses the form's own instance: `useCommandInstance()` or `useCommandFormContext()` inside, `formRef` outside an inline form. The reading hooks work the same inside `CommandDialog` and the steppers; submitting differs by container. On `CommandDialog` and `StepperCommandDialog`, `formRef.current?.execute()` runs the dialog's own submission and is safe. On a standalone `CommandStepper` the handle reaches the inner form and skips the stepper's transform and confirmation, so submit only through the stepper's built-in Submit. Calling `UpdateSite.use()` or `useCommand(UpdateSite)` beside the form creates a second instance; executing it can submit different values from those on screen.
|
|
80
|
+
|
|
81
|
+
**Computed display.** A descendant reads the instance and renders the derived value. It re-renders as fields change. The value is display-only: it is not a command property and the backend stays authoritative.
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
function InvoicePreview() {
|
|
85
|
+
const invoice = useCommandInstance<CreateInvoice>();
|
|
86
|
+
return <output aria-live="polite">Total: {(invoice.quantity * invoice.unitPrice).toFixed(2)}</output>;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
A derived value the command validates must be on the instance before submission, from the start. Seed it alongside its inputs wherever those are prefilled (in `initialValues`, or returned by the populating query), and recompute it in the form's `onFieldChange` when an input changes; `onFieldChange` does not run for prefilled values, so a form that only recomputes can open invalid and stay that way. Two checks are involved. A dialog or stepper disables Submit while the form is invalid, and that gate is evaluated on the values as they stand, before `onBeforeExecute` ever runs. The command's own validation runs at execution, after the synchronous transform. So on a dialog or stepper, reserve `onBeforeExecute` for submit-time transforms that do not affect validity.
|
|
91
|
+
|
|
92
|
+
**Dependent dropdown.** The dependent field is a descendant that reads the controlling property from `useCommandInstance()`, loads its options for that value and shows them only when they belong to the current value. A failed load publishes an empty list and an error for that value. Clear the dependent property in the form's `onFieldChange` when the controlling one changes. `loadCities` is the application's own loader; keep its identity stable.
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
type Option = { id: string; name: string };
|
|
96
|
+
|
|
97
|
+
function CityField({ loadCities }: { loadCities: (country: string) => Promise<Option[]> }) {
|
|
98
|
+
const { country } = useCommandInstance<SaveLocation>();
|
|
99
|
+
const [loaded, setLoaded] = useState<{ country: string; options: Option[]; error: string }>();
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
let active = true;
|
|
103
|
+
if (country) {
|
|
104
|
+
void loadCities(country).then(
|
|
105
|
+
options => { if (active) setLoaded({ country, options, error: '' }); },
|
|
106
|
+
() => { if (active) setLoaded({ country, options: [], error: 'Cities could not be loaded.' }); }
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return () => { active = false; };
|
|
110
|
+
}, [country, loadCities]);
|
|
111
|
+
|
|
112
|
+
const current = country && loaded?.country === country ? loaded : undefined;
|
|
113
|
+
return (
|
|
114
|
+
<>
|
|
115
|
+
<DropdownField<SaveLocation> value={location => location.city} title="City" options={current?.options ?? []}
|
|
116
|
+
optionValue="id" optionLabel="name" />
|
|
117
|
+
{current?.error && <p role="alert">{current.error}</p>}
|
|
118
|
+
</>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
<CommandForm<SaveLocation> command={SaveLocation} initialValues={{ country: '', city: '' }}
|
|
125
|
+
onFieldChange={(location, field, oldValue, newValue) => {
|
|
126
|
+
if (field === 'country' && oldValue !== newValue) location.city = '';
|
|
127
|
+
}}>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
An empty or failed option list protects nothing; the backend validates that the pair belongs together.
|
|
131
|
+
|
|
132
|
+
## Autosave (edge case)
|
|
133
|
+
|
|
134
|
+
An explicit Save is the default. Autosave is not built in, and the form does not prevent overlapping submissions; the application coordinates them:
|
|
135
|
+
|
|
136
|
+
- **Trigger on an edit.** Queue a save only for an actual edit: reset the timer from the form's `onFieldChange` when `oldValue !== newValue`. The callback can also run on blur with identical old and new values, which is not an edit. It does not run when the form applies initial or populated values or when `onBeforeExecute` changes values during a submission, so those never queue a save; do not add a value comparison that would pick them up. Never trigger on `hasChanges`: it stays `true` across many edits, so it cannot signal a new one. Do not trigger on `commandVersion` from `useCommandFormContext()` alone: it also advances when the form applies initial or populated values and on every submission that runs `onBeforeExecute`, so a save would queue the next save without any edit.
|
|
137
|
+
- **Serialize.** Run one save at a time and record which revision each save submitted. When a newer revision arrived during a save, save again afterwards.
|
|
138
|
+
- **Execute through the form.** On an inline `CommandForm`, call the context's `onExecute()` or `formRef.current?.execute()`, so callbacks, result display and the busy flag follow each attempt. Neither is an autosave path for a standalone `CommandStepper`: both reach the inner form and skip the stepper's transform and `confirmBeforeExecute`.
|
|
139
|
+
- **Handle failure.** Show it and offer a retry; do not resave a refused revision in a loop.
|
|
140
|
+
- **Clean up.** Clear the timer on unmount.
|
|
141
|
+
|
|
142
|
+
Report the last revision that succeeded as "accepted". Success means the backend accepted the command; it does not by itself establish that anything is durably stored, nor that a read model has caught up. Say "saved" only when the command handler's success contract guarantees persistence.
|
|
143
|
+
|
|
75
144
|
## Validation state
|
|
76
145
|
|
|
77
146
|
`validation` (from the context, the handle or `onStateChange`) has one snapshot per channel: `client` for rules run in the browser and `server` for rules run by asking the backend.
|
|
@@ -93,4 +162,5 @@ Use `setCustomFieldError` for a rule only the client can check, such as two fiel
|
|
|
93
162
|
- `showErrors={false}` hides field errors, the summary and the exception panel; place `ValidationMessage` yourself then.
|
|
94
163
|
- `exceptionMessage` is the safe text shown when the command throws; `exceptionDisplayComponent` receives `{ message }`, and `validationSummaryComponent` receives `{ validationResults }`.
|
|
95
164
|
- `fieldContainerComponent`, `fieldDecoratorComponent`, `errorDisplayComponent`, `tooltipComponent`, `errorClassName` and `iconAddonClassName` restyle field chrome; avoid announcing the same error twice.
|
|
165
|
+
- `formatValidationResult={(result, { fieldTitle, fieldName }) => text}` replaces the text shown for a validation result; set it on the form or in `CommandFormDefaults`. A field passes its name and, when it has one, its title; the summary passes an empty context. Branch on the result's `reason` and `reasonDetail`, never on `message`. Only the displayed text changes: callbacks receive the original results, and custom field errors are shown as supplied. For what the form shows by default, see `cratis-arc-react-bind-slice`, `references/typescript-localization.md`.
|
|
96
166
|
- `<CommandFormDefaults value={{ validateOn: 'both', showTitles: false }}>` sets these presentation and validation settings for a subtree; explicit props win.
|
|
@@ -93,21 +93,23 @@ Pass the selection as dialog input: `useDialog<TResponse, TInput>(EditOperator)`
|
|
|
93
93
|
## Topic references
|
|
94
94
|
|
|
95
95
|
- [Fields](typescript-fields.md): every field with an example, nested data, custom fields and generated forms.
|
|
96
|
-
- [Command dialogs and steppers](typescript-commanddialog.md): transforms, confirmation, steppers and their parts, controlled visibility and the dialog footer.
|
|
97
|
-
- [Inline CommandForm](typescript-commandform.md): the inline form, `formRef.execute()` and its result contract, form context operations, validation freshness, display customization and shared defaults.
|
|
96
|
+
- [Command dialogs and steppers](typescript-commanddialog.md): transforms, confirmation, submitting through `formRef`, step rules, steppers and their parts, controlled visibility and the dialog footer.
|
|
97
|
+
- [Inline CommandForm](typescript-commandform.md): the inline form, `formRef.execute()` and its result contract, form context operations, computed displays, dependent dropdowns, autosave, validation freshness, display customization and shared defaults.
|
|
98
98
|
|
|
99
99
|
## Avoid
|
|
100
100
|
|
|
101
101
|
- Putting `CommandForm` inside a container; the container already is the form. To generate fields inside one, use `AutoCommandFields`.
|
|
102
102
|
- Executing a second command from a close or click handler; put caller-owned effects in `onSuccess`.
|
|
103
|
-
- Calling `formRef.current?.execute()`
|
|
104
|
-
- Required values known to the caller in `onBeforeExecute`; validation runs
|
|
103
|
+
- Calling `formRef.current?.execute()` on a standalone `CommandStepper`; it reaches the inner form and skips the stepper's transform and `confirmBeforeExecute`. Use the stepper's Submit. (On `CommandDialog` and `StepperCommandDialog` it runs the dialog's own submission.)
|
|
104
|
+
- Required values known to the caller in `onBeforeExecute`; a dialog or stepper keeps Submit disabled while the form is invalid, and that gate is evaluated before the transform runs (the command's own validation at execution runs after it), so they belong in `initialValues`.
|
|
105
105
|
- Returning a spread copy (`{ ...command }`) from `onBeforeExecute`; mutate and return the instance you receive.
|
|
106
106
|
- Constructing the `initialValues` object inline when it holds a fresh `Guid.create()`; capture it once with `useState`.
|
|
107
|
+
- Calling the generated command's `use()` (or `useCommand`) for the command a form already edits; that is a second instance and it can submit different values from those on screen. Read and submit through the form: see [Inline CommandForm](typescript-commandform.md), "Extend the form".
|
|
108
|
+
- Passing a command instance, or a spread of one, as `initialValues`; spreading a generated command does not copy its properties. Pass a plain object of values.
|
|
107
109
|
|
|
108
110
|
## When it goes off the usual path
|
|
109
111
|
|
|
110
|
-
- **
|
|
112
|
+
- **UI language and translated validation text:** see `cratis-arc-react-bind-slice`, `references/typescript-localization.md`. Do not send `Accept-Language` yourself.
|
|
111
113
|
- **Initial focus or Enter safety:** see `cratis-components-accessibility`.
|
|
112
114
|
- **Choosing a control or runtime-defined fields:** see `cratis-components-choose-control` and `cratis-components-edit-schema-data`.
|
|
113
115
|
- **Shared confirmation and busy dialogs:** see `cratis-components-coordinate-feedback`.
|
|
@@ -18,20 +18,20 @@ compatibility: Requires @cratis/components and a CSS bundler that resolves packa
|
|
|
18
18
|
|
|
19
19
|
Cratis Components splits appearance into three package stylesheets and one runtime provider. `tokens` declares the semantic `--cratis-*` CSS variables with light defaults. `styles` holds component structure and interaction-state rules. The optional `theme` adds document colors, dark mode, forced-colors values and themed subtrees. `CratisComponentsProvider` carries locale, labels, icons, routing, dialog header actions, the toast region and renderer selection. It loads no CSS. Product styling goes through tokens and stable parts, never through internal markup.
|
|
20
20
|
|
|
21
|
-
Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed. Cratis Components is React-only, so its imports and examples are in the typescript reference whatever SDK the backend uses. Language-neutral references: [tokens](references/tokens.md) (every `--cratis-*` variable), [palette](references/palette.md) (selector blocks for palette overrides), [parts](references/parts.md) (every stable part and its states)
|
|
21
|
+
Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Node server `package.json` → typescript, `*.kt` → kotlin, `*.java` → java, `go.mod` → go, `mix.exs` → elixir); only the project's languages are installed. Cratis Components is React-only, so its imports and examples are in the typescript reference whatever SDK the backend uses. Language-neutral references: [tokens](references/tokens.md) (every `--cratis-*` variable), [palette](references/palette.md) (selector blocks for palette overrides), [parts](references/parts.md) (every stable part and its states), [renderer adapters](references/renderer-adapters.md) (adapter coverage and setup), [localization](references/localization.md) (read for UI language, label translations and formats) and [upgrade from the previous major](references/upgrade-from-previous-major.md) (read when the app imports component namespaces from the package root). Names in examples are illustrative.
|
|
22
22
|
|
|
23
23
|
## How it works
|
|
24
24
|
|
|
25
25
|
- **Tokens are unlayered variables.** `tokens` declares light defaults on `:root`. Write overrides outside cascade layers. Selector specificity decides which value wins, then source order. A `var()` resolves where the `--cratis-*` variable is declared, so changing a brand variable on a nested element does not update an inherited Cratis token. Redeclare the `--cratis-*` mapping on that element.
|
|
26
26
|
- **Structure lives in cascade layers.** `styles` and `styles/base` declare `@layer cratis-theme, cratis-components, cratis-utilities`. Component rules go in `cratis-components`. Internal utilities (prefixed `cratis:`) go in `cratis-utilities`. Unlayered product CSS beats all three for normal declarations. The first `@layer` ordering statement fixes the order, and later declarations never reorder it.
|
|
27
|
-
- **The baseline theme is driven by selectors.** It needs no provider option
|
|
28
|
-
- **The provider resolves configuration
|
|
29
|
-
- **Renderer slots are narrow.** Without `library`, the built-in renderer draws everything: semantic native HTML, with React Aria used internally. An adapter replaces only the slots it declares: nine presentation slots, plus any atomic slots it declares. Components keeps its forms, tables, dialogs and pages. Undeclared slots use the built-in implementation by default; with `rendererFallback` set to `throw`, rendering
|
|
27
|
+
- **The baseline theme is driven by selectors.** It needs no provider option or wrapper class. Without a scheme class it follows `prefers-color-scheme`. `cratis-dark` on the root forces dark. `cratis-light` forces light and wins when both classes are present. Removing `cratis-dark` returns to the system preference, not to light. `.cratis-theme` on an element gives that subtree its own token values and foreground/background. Under `forced-colors: active` the theme maps key tokens to system colors.
|
|
28
|
+
- **The provider re-resolves configuration when `value`, `messagePacks` or `dialogHeaderActions` changes.** It deep-merges `value` over the default configuration (`en-US` and English labels; it holds no icons). An invalid `locale` falls back to `en-US` (a valid `formatLocale` still applies); the resolved configuration keeps the string you passed. Icons resolve per site: component icon prop, then provider icon, then the glyph that call site draws itself. A nested provider does **not** inherit the outer `value`; it merges its own `value` over the defaults. Renderer layers, `overlayEnvironment` and `rendererSetup` do inherit through nesting; `libraryMode` and `rendererFallback` do not.
|
|
29
|
+
- **Renderer slots are narrow.** Without `library`, the built-in renderer draws everything: semantic native HTML, with React Aria used internally. An adapter replaces only the slots it declares: nine presentation slots, plus any atomic slots it declares. Components keeps its forms, tables, dialogs and pages. Undeclared slots use the built-in implementation by default; with `rendererFallback` set to `throw`, rendering on an undeclared slot fails instead.
|
|
30
30
|
|
|
31
31
|
## Default path
|
|
32
32
|
|
|
33
|
-
1. Create one local stylesheet with the package imports in this order: `@cratis/components/tokens`, `@cratis/components/styles`, then `@cratis/components/theme` for the Cratis baseline. Import that file once from the application entry.
|
|
34
|
-
2. Mount one `CratisComponentsProvider` at the application root. Put it inside Arc's provider when you use Arc-bound components (command dialogs, data pages, query tables);
|
|
33
|
+
1. Install the peers (Install prerequisites in your language reference). Create one local stylesheet with the package imports in this order: `@cratis/components/tokens`, `@cratis/components/styles`, then `@cratis/components/theme` for the Cratis baseline. Import that file once from the application entry.
|
|
34
|
+
2. Mount one `CratisComponentsProvider` at the application root. Put it inside Arc's provider when you use Arc-bound components (command dialogs, data pages, query tables); it reads no Arc configuration. Put it inside the router when you pass `router`. Set `locale`. When the app uses Arc's locale, mount `ArcComponentsProvider` instead ([localization](references/localization.md)). Add `messages` or `icons` only for product wording or iconography. Keep a large `value` object stable (module-level or memoized). Pass `toaster` to mount the single app-wide toast region. If the app uses Arc's shared confirmation or busy-indicator dialogs, also mount their host once at the root (see `cratis-components-coordinate-feedback`); without it they resolve `Cancelled` silently.
|
|
35
35
|
3. Choose the scheme. Either leave it to the system preference, or toggle `cratis-dark` / `cratis-light` on the document element. When switching, remove the previous class.
|
|
36
36
|
4. To brand the app, override tokens in an unlayered product stylesheet loaded after the package imports. Repeat the baseline scheme selectors inside `@media (forced-colors: none)`; the blocks are in [palette](references/palette.md). A plain class rule on a `.cratis-theme` element loses to its scheme selectors.
|
|
37
37
|
5. To treat one instance differently, pass a class through `pt` to a named part. For a product-wide treatment, write CSS on `[data-cratis-part='…']` scoped to a component or product class.
|
|
@@ -56,8 +56,8 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
56
56
|
|
|
57
57
|
- `@cratis/components/tokens`: semantic `--cratis-*` variables with light defaults on `:root`. Always load first.
|
|
58
58
|
- `@cratis/components/styles`: structure for the whole library, internal utilities and the layer order. This is the default. It has no reset, no Tailwind Preflight and no token copies.
|
|
59
|
-
- `@cratis/components/styles/base`: internal utilities and the layer order only. Load it once, before any area sheet.
|
|
60
|
-
- `@cratis/components/<Area>/styles`: structure for one area, including that area's internal dependencies (PivotViewer includes Filter rules; DataPage includes split-view rules). Areas: `Canvas`, `Chat`, `CommandDialog`, `CommandStepper`, `CommandForm` (`CommandForm/fields` is the same sheet), `Common`, `ConfigurationEditor`, `DataPage`, `DataTables`, `Dialogs`, `Display`, `Dropdown`, `Filter`, `IconPicker`, `MarkdownEditor`, `Notifications`, `ObjectContentEditor`, `ObjectNavigationalBar`, `PivotViewer`, `renderer/builtin`, `SchemaEditor`, `TimeMachine`, `Toolbar`. Load the sheets for PivotViewer, Canvas, Chat and TimeMachine with the chunk that mounts them. Each sheet starts with an `Areas:` comment listing its coverage.
|
|
59
|
+
- `@cratis/components/styles/base`: internal utilities and the layer order only. Load it once, before any area sheet.
|
|
60
|
+
- `@cratis/components/<Area>/styles`: structure for one area, including that area's internal dependencies (PivotViewer includes Filter rules; DataPage includes split-view rules). Areas: `Canvas`, `Chat`, `CommandDialog`, `CommandStepper`, `CommandForm` (`CommandForm/fields` is the same sheet), `Common`, `ConfigurationEditor`, `DataPage`, `DataTables`, `Dialogs`, `Display`, `Dropdown`, `Filter`, `FloatingToolbar`, `IconPicker`, `Localization` (the `Common` sheet; load one), `MarkdownEditor`, `Menu`, `Notifications`, `ObjectContentEditor`, `ObjectNavigationalBar`, `PivotViewer`, `renderer/builtin`, `SchemaEditor`, `TimeMachine`, `Toolbar`. Load the sheets for PivotViewer, Canvas, Chat and TimeMachine with the chunk that mounts them. Each sheet starts with an `Areas:` comment listing its coverage.
|
|
61
61
|
- `@cratis/components/theme`: the optional baseline (document and subtree colors, system and explicit dark mode, forced-colors values, `.cratis-theme` subtrees).
|
|
62
62
|
- `@cratis/components/themes/designsystemet`: bridge from Designsystemet `--ds-*` variables to `--cratis-*`. Load it after `tokens` and before `styles`, never together with `theme`. It affects the built-in renderer only. The backdrop and z-index tokens keep their `tokens` values.
|
|
63
63
|
|
|
@@ -72,7 +72,7 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
72
72
|
### Cascade layers
|
|
73
73
|
|
|
74
74
|
- `cratis-theme`, `cratis-components`, `cratis-utilities` are declared by `styles` and `styles/base`. Area sheets only reopen `cratis-components`.
|
|
75
|
-
- If the host has its own layers (for example Tailwind), put the three Cratis names in the host's first `@layer` statement, after reset/base and before product components and utilities.
|
|
75
|
+
- If the host has its own layers (for example Tailwind), put the three Cratis names in the host's first `@layer` statement, after reset/base and before product components and utilities. The statement is under Stylesheet entry in your language reference. That statement must be parsed before any stylesheet. Otherwise a utility class passed through `pt` loses to component rules.
|
|
76
76
|
- `cratis:`-prefixed classes are internal and are not styling hooks.
|
|
77
77
|
|
|
78
78
|
### Tokens
|
|
@@ -93,8 +93,10 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
93
93
|
|
|
94
94
|
### Provider configuration
|
|
95
95
|
|
|
96
|
-
- `value.locale`:
|
|
97
|
-
- `value.
|
|
96
|
+
- `value.locale`: the UI language (BCP 47): React Aria texts, announcements and the message pack. Default `en-US`.
|
|
97
|
+
- `value.formatLocale`: the regional date and number format. Omit it to follow `locale`.
|
|
98
|
+
- `messagePacks="builtin"` (a prop): turns on the shipped English and Norwegian Bokmål labels, selected by `locale`. Without it `locale` selects no pack.
|
|
99
|
+
- `value.messages`: product wording for single Components-owned labels, in thirteen groups. Partial maps merge per key, per-instance props win, and some keys are functions. Groups, keys and resolution order: [localization](references/localization.md).
|
|
98
100
|
- `value.icons`: product glyphs for `close`, `remove`, `expand`, `sortAscending`, `sortDescending`, `previous`, `next` and `clear`.
|
|
99
101
|
- The map is partial and merges by name. Each value is used as given, by identity.
|
|
100
102
|
- `null` draws no glyph but keeps the button, its part and its accessible name.
|
|
@@ -102,10 +104,10 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
102
104
|
- An unregistered name draws the glyph that call site supplies itself; the default configuration registers none.
|
|
103
105
|
- Marks that carry parts (such as the ProgressSpinner ring) are not in the vocabulary.
|
|
104
106
|
- `value.router`: `navigate(href)` plus an optional `useHref(href)`, so Components links (for example `Breadcrumbs`) use the app router. Without it, links keep native or inherited routing.
|
|
105
|
-
- `dialogHeaderActions`: a prop or `value.dialogHeaderActions`; the prop wins. One renderer adds a header action to every `Dialog`, `CommandDialog` and `StepperCommandDialog`. It receives the dialog id, title, whether it is a command dialog and an optional slice location. It returns nothing to hide itself. Per dialog, `headerActions` adds actions first, `hideGlobalHeaderActions` drops the global ones and `sliceLocation` feeds the context.
|
|
106
|
-
- `toaster`: `true` mounts the app-wide toast region with defaults (top right). An object
|
|
107
|
+
- `dialogHeaderActions`: a prop or `value.dialogHeaderActions`; the prop wins. One renderer adds a header action to every `Dialog`, `CommandDialog` and `StepperCommandDialog`. It receives the dialog id, title, whether it is a command dialog and an optional slice location. It returns nothing to hide itself. Per dialog, `headerActions` adds actions first, `hideGlobalHeaderActions` drops the global ones and `sliceLocation` feeds the context.
|
|
108
|
+
- `toaster`: `true` mounts the app-wide toast region with defaults (top right). An object sets `position`, `limit`, `timeout`, aria labels and `pt`; see Provider in your language reference. Mount either this or a standalone toaster, never both, because both render the same global queue.
|
|
107
109
|
- `value.locales`: deprecated. Use `messages`.
|
|
108
|
-
- Read-side helpers
|
|
110
|
+
- Read-side helpers (default configuration, pure merge, resolved-configuration hook, icon resolver for product components): Configuration helpers in your language reference.
|
|
109
111
|
|
|
110
112
|
### Renderer selection and overlays
|
|
111
113
|
|
|
@@ -131,7 +133,7 @@ Read `references/<language>.md` for the project's SDK (`.csproj` → csharp, Nod
|
|
|
131
133
|
|
|
132
134
|
- Open a page with a field, a table and a dialog. Each should have layout, readable text and a visible keyboard-focus indicator.
|
|
133
135
|
- Check hover, active, disabled, validation and focus states in each scheme you support: light, dark, themed subtree and forced colors.
|
|
134
|
-
-
|
|
136
|
+
- Symptoms:
|
|
135
137
|
- Everything is unstyled: the local CSS file is not imported or bundled.
|
|
136
138
|
- One surface has no layout: its area sheet is missing.
|
|
137
139
|
- Product utilities lose: check the first `@layer` declaration.
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Language and regional format in Cratis Components
|
|
2
|
+
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- What each setting controls
|
|
6
|
+
- Default path
|
|
7
|
+
- Message packs
|
|
8
|
+
- Override a label
|
|
9
|
+
- Message groups
|
|
10
|
+
- Language switcher
|
|
11
|
+
- Format values
|
|
12
|
+
- Avoid
|
|
13
|
+
|
|
14
|
+
This is the home for the language of Components-owned labels and for the date and number formats of Components controls. The application's own screen texts and the language sent to the backend belong to Arc; see `cratis-arc-react-bind-slice` (`references/typescript-localization.md`). Cratis Components is React-only, so the examples are TypeScript whatever SDK the backend uses. Language tags and names in examples are illustrative.
|
|
15
|
+
|
|
16
|
+
## What each setting controls
|
|
17
|
+
|
|
18
|
+
| Setting | Controls | Does not control |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| `value.locale` | The UI language: the texts and announcements the underlying React Aria controls supply themselves, the calendar popover, and which message pack is selected. Default `en-US`. | Components-owned labels when no message pack is on. The format, when `formatLocale` is set. |
|
|
21
|
+
| `value.formatLocale` | The regional format of the date field, the number field and `useFormatting`. Omit it to follow `locale`. | The label language. Changing it never changes a label. |
|
|
22
|
+
| `messagePacks="builtin"` | Turns on the shipped translations of Components-owned labels, including their accessible names. | Application text, data and server validation messages. |
|
|
23
|
+
| `value.messages` | Single labels the product words differently, or a language no pack covers. | Formats. |
|
|
24
|
+
|
|
25
|
+
All tags are BCP 47. An invalid `locale` falls back to `en-US` for the UI language; a valid `formatLocale` still sets the format. An invalid `formatLocale` is ignored, and the format follows `locale`.
|
|
26
|
+
|
|
27
|
+
## Default path
|
|
28
|
+
|
|
29
|
+
1. **The app uses Arc's locale (default).** Mount `ArcComponentsProvider` from `@cratis/components/Localization` inside `<Arc>`, in place of `CratisComponentsProvider`. It always turns the message packs on and follows Arc's UI language and Arc's format locale separately. It takes every `CratisComponentsProvider` prop except `messagePacks`.
|
|
30
|
+
2. **Configure the languages in Arc**, not here: pass the locale to `<Arc>` as described in `cratis-arc-react-bind-slice` (`references/typescript-localization.md`).
|
|
31
|
+
3. **Add `LanguageSelector`** where the user switches language.
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { Arc } from '@cratis/arc.react';
|
|
35
|
+
import { ArcComponentsProvider, LanguageSelector } from '@cratis/components/Localization';
|
|
36
|
+
import { locale } from './locale'; // the Arc locale store
|
|
37
|
+
|
|
38
|
+
export const App = () => (
|
|
39
|
+
<Arc locale={locale}>
|
|
40
|
+
<ArcComponentsProvider toaster>
|
|
41
|
+
<LanguageSelector />
|
|
42
|
+
{/* routes */}
|
|
43
|
+
</ArcComponentsProvider>
|
|
44
|
+
</Arc>
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- Set `value.locale` or `value.formatLocale` on `ArcComponentsProvider` only to override that one setting; the other still follows Arc.
|
|
49
|
+
- `ArcComponentsProvider` is the application's Components provider. Never mount a `CratisComponentsProvider` next to it or around it.
|
|
50
|
+
- When `<Arc>` has no locale configured, `ArcComponentsProvider` behaves like a standalone provider with the packs on: `en-US` and English labels.
|
|
51
|
+
|
|
52
|
+
**Without Arc's locale:** mount `CratisComponentsProvider` with `messagePacks="builtin"` and `value.locale`. The application owns the language state.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
<CratisComponentsProvider messagePacks="builtin" value={{ locale: 'nb-NO' }}>
|
|
56
|
+
{/* routes */}
|
|
57
|
+
</CratisComponentsProvider>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Message packs
|
|
61
|
+
|
|
62
|
+
- Components ships two packs: English and Norwegian Bokmål.
|
|
63
|
+
- `nb-NO`, `nb` and `no` select Bokmål. Every other language gets English labels.
|
|
64
|
+
- The English fallback affects Components labels only. `locale` and `formatLocale` keep the values you set, so React Aria texts and formats still follow them.
|
|
65
|
+
- Without `messagePacks="builtin"` (and outside `ArcComponentsProvider`), `locale` selects no pack. Labels stay English unless `value.messages` supplies them, or the deprecated `value.locales` has an entry for the exact `locale` tag, which still supplies its paginator and date labels.
|
|
66
|
+
|
|
67
|
+
## Override a label
|
|
68
|
+
|
|
69
|
+
Resolution order for every label, first match wins:
|
|
70
|
+
|
|
71
|
+
1. The prop on the component instance.
|
|
72
|
+
2. `value.messages`.
|
|
73
|
+
3. The deprecated `value.locales` entry for the active locale (old paginator and date labels only).
|
|
74
|
+
4. The selected message pack, when packs are on.
|
|
75
|
+
5. English.
|
|
76
|
+
|
|
77
|
+
- Overrides merge per key. Override one key without restating its group.
|
|
78
|
+
- Function-valued keys stay functions: supply a function, never a string.
|
|
79
|
+
- For a language no pack covers, supply every label the application renders through `value.messages`.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
<ArcComponentsProvider value={{ messages: { paginator: { page: number => `Side ${number}` } } }}>
|
|
83
|
+
{/* routes */}
|
|
84
|
+
</ArcComponentsProvider>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Keep a `value` object stable (module-level or memoized), as for any Components provider.
|
|
88
|
+
|
|
89
|
+
## Message groups
|
|
90
|
+
|
|
91
|
+
`value.messages` (`CratisComponentsMessages`) has thirteen groups. Every key is optional. A key is a string unless a signature is shown; those keys build the text from values.
|
|
92
|
+
|
|
93
|
+
| Group | Labels for | Keys |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `paginator` | Table paging | `navigation`, `first`, `previous`, `next`, `last`, `pages`, `page: (page: number) => string`, `range: (start: number, end: number, total: number) => string` |
|
|
96
|
+
| `datePicker` | Date field and calendar actions | `today`, `clear`, `openCalendar`, `previousMonth`, `nextMonth`, `label` |
|
|
97
|
+
| `dropdown` | Dropdown actions | `showOptions`, `clearSelection` |
|
|
98
|
+
| `dialog` | Buttons of every Components dialog | `ok`, `cancel`, `yes`, `no`, `close`, `refused` (announced when a confirm is refused and the dialog stays open) |
|
|
99
|
+
| `stepper` | Step navigation | `next`, `previous`, `submit` |
|
|
100
|
+
| `notifications` | Toasts | `dismiss`, `region` |
|
|
101
|
+
| `dataTable` | Table selection, search and query states | `selectRow`, `selectAllRows`, `sortAscending`, `sortDescending`, `search`, `searchAriaLabel`, `loading`, `failed`, `unauthorized`, `filteredEmpty`, `filteredEmptyServer` |
|
|
102
|
+
| `filter` | Filter panel and its option lists | `label`, `searchAriaLabel`, `searchPlaceholder`, `searchFallback`, `empty`, `noMatches`, `clearFilter`, `clearRange`, `minimum`, `maximum`, `items` |
|
|
103
|
+
| `columnFilter` | Column filter popup | `filterTriggerAriaLabel: (field: string) => string`, `valueAriaLabel: (field: string) => string`, `matchModeAriaLabel`, `matchModeLabel: (mode: string, defaultLabel: string) => string`, `clear`, `apply`, `true`, `false` |
|
|
104
|
+
| `toolbar` | Toolbar names | `label`, `closeDrawer` |
|
|
105
|
+
| `command` | Command form feedback | `validationAnnouncement: (count: number, firstMessage: string) => string`, `guidFormat`, `guidRequired`, `showPassword`, `hidePassword` |
|
|
106
|
+
| `controls` | Remove buttons on chips and tags | `remove`, `removeItem: (item: string) => string` |
|
|
107
|
+
| `languageSelector` | Language switcher | `label` |
|
|
108
|
+
|
|
109
|
+
The packs leave `filter.searchAriaLabel` unset so the search placeholder names the input; set it only when the placeholder is not a fitting name.
|
|
110
|
+
|
|
111
|
+
## Language switcher
|
|
112
|
+
|
|
113
|
+
`LanguageSelector` from `@cratis/components/Localization` is a native select of languages.
|
|
114
|
+
|
|
115
|
+
- **Under Arc's locale it needs no props.** It lists the languages Arc supports and asks Arc to switch; nothing reloads.
|
|
116
|
+
- Each language is shown in its own name (for example "English", "Norsk bokmål"). When two supported tags share a language, each of them that carries a region adds it; a tag without a region shows the language name alone.
|
|
117
|
+
- **It renders nothing** when it has no selected language, no options or no change handler. That is the case when `<Arc>` has no locale configured and you pass no props.
|
|
118
|
+
- **Application-owned state:** pass `value`, `options` (language tags) and `onChange`; each one you pass replaces Arc's.
|
|
119
|
+
- A `value` outside `options` selects the first option with the same language; with no such option nothing is selected.
|
|
120
|
+
- Accessible name: the `languageSelector.label` message by default. Pass `label` to name it yourself, or give `pt.root` an `id` and associate a visible label with it.
|
|
121
|
+
- Styling: `className`, and `pt.root` / `pt.option` for other attributes.
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
const [locale, setLocale] = useState('en-US');
|
|
125
|
+
|
|
126
|
+
<CratisComponentsProvider messagePacks="builtin" value={{ locale }}>
|
|
127
|
+
<LanguageSelector value={locale} options={['en-US', 'nb-NO']} onChange={setLocale} />
|
|
128
|
+
{/* routes */}
|
|
129
|
+
</CratisComponentsProvider>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
When the app uses per-area stylesheets, load `@cratis/components/Localization/styles` or `@cratis/components/Common/styles`, not both: they are the same sheet.
|
|
133
|
+
|
|
134
|
+
## Format values
|
|
135
|
+
|
|
136
|
+
In a component, call `useFormatting()` from `@cratis/components/Formatting`. It returns the active format locale as `locale` and four helpers bound to it, and it updates when the format locale changes.
|
|
137
|
+
|
|
138
|
+
| The value is | Helper | Notes |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| A date without a time (due date, birthday) | `formatCalendarDate({ year, month, day }, options?)` | `month` and `day` are one-based. The day never shifts with the time zone; it accepts no `timeZone`. |
|
|
141
|
+
| A point in time (when something happened) | `formatInstant(value, options?)` | Takes a `Date`, or an ISO string with a time that ends in `Z` or an offset. Shows the viewer's time zone unless `options.timeZone` names another. |
|
|
142
|
+
| A number | `formatNumber(value, options?)` | `options` are `Intl.NumberFormat` options. |
|
|
143
|
+
| Month names | `getMonthNames(width?)` | Twelve names in calendar order; `long` (default), `short` or `narrow`. |
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { useFormatting } from '@cratis/components/Formatting';
|
|
147
|
+
|
|
148
|
+
const DueDate = ({ year, month, day }: { year: number; month: number; day: number }) => {
|
|
149
|
+
const { formatCalendarDate } = useFormatting();
|
|
150
|
+
return <span>{formatCalendarDate({ year, month, day }, { dateStyle: 'medium' })}</span>;
|
|
151
|
+
};
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- Absent or invalid input returns an empty string, never a shifted date; `getMonthNames` returns an empty array for an invalid locale. `formatInstant` returns an empty string for a date-only string and for a string without `Z` or an offset.
|
|
155
|
+
- Outside React, import the same four functions from `@cratis/components/Formatting` and pass the locale as the second argument (`getMonthNames` takes it first). They need no provider.
|
|
156
|
+
- Changing the language does not change the viewer's time zone.
|
|
157
|
+
- **One field in another format (edge case):** `formatLocale` on `DatePickerInput` or `NumberInput` overrides the provider for that field. The calendar popover and the control's labels stay in the UI language.
|
|
158
|
+
|
|
159
|
+
## Avoid
|
|
160
|
+
|
|
161
|
+
- Changing `locale` to get a date or number format. Set `formatLocale`.
|
|
162
|
+
- Setting `locale` and expecting translated labels without a message pack.
|
|
163
|
+
- Formatting a date-only value with `formatInstant`, or building a `Date` from one to format it. Use `formatCalendarDate`.
|
|
164
|
+
- Translating by hand what a pack already covers. Override single keys only.
|
|
165
|
+
- Replacing a function-valued key with a string.
|
|
166
|
+
- Nesting `ArcComponentsProvider` with another Components provider.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Contents
|
|
4
4
|
|
|
5
|
+
- Install prerequisites
|
|
5
6
|
- Stylesheet entry
|
|
6
7
|
- Provider
|
|
7
8
|
- Scheme and themed subtrees
|
|
@@ -14,6 +15,18 @@
|
|
|
14
15
|
|
|
15
16
|
Cratis Components is React-only; this reference applies whatever SDK the backend uses. Names such as `operator-admin`, `overlay-root`, `HelpAction` and `#651d9b` are illustrative.
|
|
16
17
|
|
|
18
|
+
## Install prerequisites
|
|
19
|
+
|
|
20
|
+
`@cratis/components` declares its requirements as peers; a strict installer needs each required one installed explicitly. `pixi.js` and `tsyringe` are optional peers.
|
|
21
|
+
|
|
22
|
+
- **React 19**, with `react-dom`.
|
|
23
|
+
- **`@cratis/arc` and `@cratis/arc.react`**, both on the version the generated proxies were produced with, inside the range the package declares. Update the two together.
|
|
24
|
+
- **`@cratis/fundamentals`**.
|
|
25
|
+
- **`reflect-metadata`**: import it once in the application entry, before the stylesheet and the application code.
|
|
26
|
+
- **`pixi.js` (optional)**: install it when the app imports from the `Canvas` or `PivotViewer` subpath, even before anything is mounted; those modules import it.
|
|
27
|
+
- `tsyringe` is an optional peer that Components never imports; Arc React brings it. Do not add it for Components.
|
|
28
|
+
- Nothing else: no UI kit, theme runtime or icon package. Renderer adapters are separate packages (see Renderer adapters and overlays).
|
|
29
|
+
|
|
17
30
|
## Stylesheet entry
|
|
18
31
|
|
|
19
32
|
Put the package imports in one local CSS file and import that file once from the application entry. JavaScript component imports load no CSS.
|
|
@@ -34,7 +47,7 @@ import 'reflect-metadata';
|
|
|
34
47
|
import './index.css';
|
|
35
48
|
```
|
|
36
49
|
|
|
37
|
-
- **Prefer the CSS file over TypeScript imports of the package sheets.** The stylesheet subpaths ship no type declarations, so `import '@cratis/components/tokens'` in a `.ts`/`.tsx` file can fail type
|
|
50
|
+
- **Prefer the CSS file over TypeScript imports of the package sheets.** The stylesheet subpaths ship no type declarations, so `import '@cratis/components/tokens'` in a `.ts`/`.tsx` file can fail type checking with `TS2882` on TypeScript 6, when the compiler checks side-effect imports and finds no matching declaration. If you import them from TypeScript anyway, declare each subpath once in a project `.d.ts` (`declare module '@cratis/components/tokens';`, one line per subpath). Vite projects type the local `./index.css` import through `vite/client`; other setups add `declare module '*.css';`.
|
|
38
51
|
- **Per-area sheets** replace `styles` in the same file:
|
|
39
52
|
|
|
40
53
|
```css
|
|
@@ -93,18 +106,9 @@ export const App = () => (
|
|
|
93
106
|
```
|
|
94
107
|
|
|
95
108
|
- **Shared dialogs:** if the app calls Arc's confirmation or busy-indicator hooks, also mount Arc's `DialogComponents` host (`@cratis/arc.react/dialogs`) once inside this root, with the Components dialog renderers. Without it those calls resolve `DialogResult.Cancelled` immediately and nothing renders. The wiring is in `cratis-components-coordinate-feedback`.
|
|
96
|
-
- `value` (`CratisComponentsConfig`): `locale
|
|
97
|
-
- `messages` (`CratisComponentsMessages`)
|
|
98
|
-
|
|
99
|
-
- `datePicker`: `today`, `clear`, `openCalendar`, `previousMonth`, `nextMonth`, `label` (name of the segmented input when it has no `aria-label` or placeholder).
|
|
100
|
-
- `dropdown`: `showOptions`, `clearSelection`.
|
|
101
|
-
- `dialog`: `ok`, `cancel`, `yes`, `no`, `close`, `refused` (polite announcement when a confirm is refused and the dialog stays open).
|
|
102
|
-
- `stepper`: `next`, `previous`, `submit`.
|
|
103
|
-
- `notifications`: `dismiss`, `region`.
|
|
104
|
-
- `dataTable`: `selectRow`, `selectAllRows`, `sortAscending`, `sortDescending`, `search`, `searchAriaLabel`, `loading`, `failed`, `unauthorized`, `filteredEmpty`, `filteredEmptyServer`.
|
|
105
|
-
- `filter`: `label` (FilterPanel dialog name), `searchAriaLabel`.
|
|
106
|
-
- `columnFilter`: `filterTriggerAriaLabel: (field: string) => string`, `valueAriaLabel: (field: string) => string`, `matchModeAriaLabel`, `matchModeLabel: (mode: string, defaultLabel: string) => string`, `clear`, `apply`, `true`, `false`.
|
|
107
|
-
- `toolbar`: `label` (toolbar name when it has no `aria-label` or `aria-labelledby`), `closeDrawer`.
|
|
109
|
+
- `value` (`CratisComponentsConfig`): `locale` (UI language), `formatLocale` (date and number format; follows `locale` when omitted), `messages` (below), `icons` (`close`, `remove`, `expand`, `sortAscending`, `sortDescending`, `previous`, `next`, `clear`; any `ReactNode` or `null`), `router` (`CratisComponentsRouter`: `navigate(href)`, optional `useHref(href)` hook), `dialogHeaderActions`. `locales` is deprecated; use `messages`.
|
|
110
|
+
- `messages` (`CratisComponentsMessages`): partial maps merge per key. Every group, key and signature, the shipped message packs and the resolution order are in [localization](localization.md).
|
|
111
|
+
- `messagePacks="builtin"` (a provider prop, not part of `value`): turns on the shipped label translations selected by `locale`. `ArcComponentsProvider` from `@cratis/components/Localization` replaces this provider when the app follows Arc's locale; see [localization](localization.md).
|
|
108
112
|
- `dialogHeaderActions` prop: a `DialogHeaderActionsRenderer`, `(dialog: DialogHeaderContext) => ReactNode`. The context has `dialogId`, `title`, `isCommandDialog` and optional `sliceLocation` (`{ module, feature, slice }`). Return `null` to add nothing. `dialogId` is also rendered as `data-cratis-dialog-id` on the dialog root, so tests and scripts can find that dialog with `[data-cratis-dialog-id='…']`. Per dialog, `Dialog`, `CommandDialog` and `StepperCommandDialog` take `headerActions` (rendered first), `hideGlobalHeaderActions` and `sliceLocation`.
|
|
109
113
|
- `toaster`: `true`, or `ToasterProps`: `position` (`ToasterPosition`: `'top-left'`, `'top-center'`, `'top-right'`, `'bottom-left'`, `'bottom-center'`, `'bottom-right'`; default `'top-right'`), `limit` (maximum visible toasts), `timeout` (default auto-dismiss in milliseconds), `dismissAriaLabel`, `regionAriaLabel`, `pt` (Toaster parts). The alternative is `<Toaster />` from `@cratis/components/Notifications`; never mount both.
|
|
110
114
|
- `library`, `libraryMode`, `rendererFallback`, `rendererSetup`, `overlayEnvironment`: see Renderer adapters and overlays.
|
|
@@ -234,7 +238,7 @@ All from `@cratis/components`:
|
|
|
234
238
|
- **A `pt` utility class loses to a component rule:** the host's first `@layer` statement does not place the Cratis layers before its utilities.
|
|
235
239
|
- **TypeScript rejects a stylesheet import:** move the import into the CSS file or add the module declaration.
|
|
236
240
|
|
|
237
|
-
Target documented parts, never guessed class names; a typed `pt` key is not always the DOM value. The provider configures messages and icons, not CSS themes. Tailwind
|
|
241
|
+
Target documented parts, never guessed class names; a typed `pt` key is not always the DOM value. The provider configures messages and icons, not CSS themes. Components does not need Tailwind, but the application templates ship it: use utility classes for layout and spacing, `--cratis-*` tokens for color and surface, and a stylesheet beside the component for the rest. Reserve inline `style` for runtime-computed values.
|
|
238
242
|
|
|
239
243
|
## Related skills
|
|
240
244
|
|