@astryxdesign/cli 0.6.6 → 0.6.7-canary.7ec9564
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/CHANGELOG.md +129 -0
- package/README.md +84 -82
- package/api/build/_adapter.d.mts +20 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.test.mjs +1 -1
- package/api/build/build.type.d.mts +12 -0
- package/api/build/build.type.mjs +3 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +13 -1
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +615 -0
- package/api/component/component.doc.mjs +5 -2
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +73 -1
- package/api/docs/compiled-topics.test.mjs +1 -1
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.d.mts +44 -0
- package/api/docs/detail/section/section.mjs +171 -14
- package/api/docs/detail/section/section.test.mjs +4 -4
- package/api/docs/docOverlays.test.mjs +38 -23
- package/api/docs/docs.depth.test.mjs +2 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.mjs +13 -16
- package/api/docs/docs.test.mjs +9 -10
- package/api/docs/docs.type.d.mts +43 -3
- package/api/docs/docs.type.mjs +23 -3
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +26 -26
- package/api/docs/integrationDocs.test.mjs +8 -7
- package/api/docs/namespace-section.test.mjs +260 -0
- package/api/docs/node/node.mjs +3 -0
- package/api/docs/token-tables.test.mjs +93 -0
- package/api/doctor/_adapter.d.mts +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +6 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +144 -150
- package/api/doctor/doctor.test.mjs +104 -0
- package/api/doctor/theme-checks.d.mts +24 -0
- package/api/doctor/theme-checks.mjs +1231 -0
- package/api/doctor/theme-checks.test.mjs +667 -0
- package/api/gap-report/gap-report.doc.mjs +2 -1
- package/api/gap-report/gap-report.mjs +15 -1
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +11 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +16 -2
- package/api/integration/add-theme.test.mjs +66 -15
- package/api/integration/authoring-checks.mjs +21 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +483 -1
- package/api/integration/pack-check.test.mjs +568 -8
- package/api/integration/validate-integration.mjs +20 -4
- package/api/integration/validate-integration.test.mjs +73 -0
- package/api/layout/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +1 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/search/search.d.mts +47 -3
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.domain-priority.test.mjs +261 -0
- package/api/search/search.mjs +247 -43
- package/api/search/search.test.mjs +5 -1
- package/api/search/search.type.d.mts +3 -3
- package/api/search/search.type.mjs +2 -2
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +29 -10
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +5 -2
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +14 -1
- package/api/template/show/show.mjs +2 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +15 -0
- package/api/template/template.type.mjs +6 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +96 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.mjs +286 -118
- package/api/theme/build/build.test.mjs +30 -0
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/upgrade.type.d.mts +4 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
- package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +166 -0
- package/assets/docs/getting-started.doc.mjs +61 -17
- package/assets/docs/principles.doc.dense.mjs +4 -4
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/principles.doc.zh.mjs +4 -4
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/theme.doc.dense.mjs +10 -198
- package/assets/docs/theme.doc.mjs +13 -771
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +5 -4
- package/assets/docs/tree/component-migration.doc.mjs +107 -0
- package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/font-setup.doc.mjs +122 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
- package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
- package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
- package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
- package/assets/docs/tree/internationalization.doc.mjs +29 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +55 -0
- package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
- package/assets/docs/tree/migration-verification.doc.mjs +67 -0
- package/assets/docs/tree/migration.doc.mjs +28 -0
- package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
- package/assets/docs/tree/other-libraries.doc.mjs +218 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/responsive.doc.mjs +98 -0
- package/assets/docs/tree/scaffold.doc.mjs +140 -0
- package/assets/docs/tree/side-panels.doc.mjs +81 -0
- package/assets/docs/tree/structure.doc.mjs +140 -0
- package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
- package/assets/docs/tree/styling-basics.doc.mjs +181 -0
- package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
- package/assets/docs/tree/styling.doc.mjs +29 -0
- package/assets/docs/tree/tailwind.doc.mjs +65 -0
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
- package/assets/docs/tree/tokens-border.doc.mjs +46 -0
- package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-color.doc.mjs +438 -0
- package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-data.doc.mjs +323 -0
- package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
- package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
- package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
- package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
- package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
- package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
- package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.mjs +54 -0
- package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
- package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
- package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
- package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
- package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
- package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
- package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens.doc.mjs +28 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +4 -0
- package/assets/docs/tree/type-scale.doc.mjs +147 -0
- package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
- package/assets/docs/tree/typography.doc.mjs +29 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +4 -1
- package/assets/docs/use-a-theme.doc.mjs +212 -0
- package/assets/templates/pages/incident-console/page.tsx +1 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/theme.template.ts +4 -3
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/type.ts +1 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +3 -3
- package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
- package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
- package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
- package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +338 -45
- package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
- package/clients/cli/commands/build.mjs +8 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +91 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/docs.doc.mjs +2 -1
- package/clients/cli/commands/docs.mjs +63 -23
- package/clients/cli/commands/docs.test.mjs +17 -15
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.test.mjs +59 -52
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/layout-check.doc.mjs +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +2 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +2 -0
- package/clients/cli/commands/layout.mjs +40 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.test.mjs +10 -4
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
- package/clients/cli/commands/template.mjs +56 -5
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-build.doc.mjs +3 -1
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +29 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +48 -30
- package/foundation/agent-docs/agent-docs.test.mjs +47 -34
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/project.test.mjs +1 -1
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-discovery.test.mjs +1 -1
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- package/foundation/discovery/theme-discovery.d.mts +72 -5
- package/foundation/discovery/theme-discovery.mjs +134 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/bundle.mjs +52 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
- package/foundation/doc-compiler/tree.d.mts +10 -0
- package/foundation/doc-compiler/tree.mjs +22 -0
- package/foundation/doc-compiler/tree.test.mjs +3 -2
- package/foundation/env/package-manager.d.mts +31 -8
- package/foundation/env/package-manager.mjs +120 -13
- package/foundation/env/package-manager.test.mjs +174 -1
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +22 -0
- package/foundation/integrations/cli-requirement.mjs +31 -0
- package/foundation/integrations/cli-requirement.test.mjs +70 -0
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/integrations/validate-contributions.d.mts +16 -0
- package/foundation/integrations/validate-contributions.mjs +56 -8
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.mjs +41 -26
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
- package/assets/docs/styling-libraries.doc.mjs +0 -469
- package/assets/docs/styling.doc.mjs +0 -412
- package/assets/docs/tokens.doc.dense.mjs +0 -15
- package/assets/docs/tokens.doc.mjs +0 -1491
- package/assets/docs/tokens.doc.zh.mjs +0 -15
- package/assets/docs/typography.doc.mjs +0 -286
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs layout/headers-and-footers`: pin a header or footer
|
|
5
|
+
* while the body scrolls.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
9
|
+
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'generic',
|
|
12
|
+
name: 'headers-and-footers',
|
|
13
|
+
title: 'Headers and footers',
|
|
14
|
+
placement: {parent: 'namespace:layout', slot: 'guides', order: 30},
|
|
15
|
+
category: 'guide',
|
|
16
|
+
description:
|
|
17
|
+
'Pin a header or footer while the body scrolls, so the title and commit actions stay reachable.',
|
|
18
|
+
keywords: [
|
|
19
|
+
'LayoutHeader',
|
|
20
|
+
'LayoutFooter',
|
|
21
|
+
'Toolbar',
|
|
22
|
+
'defaultHasDividers',
|
|
23
|
+
'pinned header',
|
|
24
|
+
'pinned footer',
|
|
25
|
+
'scrolling body',
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
sections: [
|
|
29
|
+
{
|
|
30
|
+
id: 'headers-and-footers',
|
|
31
|
+
title: 'Headers and footers',
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: 'prose',
|
|
35
|
+
text: 'A region can pin a header or footer while its body scrolls. Both are Layout slots, and padding set once on Layout reaches all three, so header, body, and footer share one content line.',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: 'list',
|
|
39
|
+
style: 'unordered',
|
|
40
|
+
items: [
|
|
41
|
+
'LayoutHeader in the header slot: the region title and its primary action',
|
|
42
|
+
'Toolbar instead of LayoutHeader when the header carries interactive controls',
|
|
43
|
+
'LayoutFooter in the footer slot: actions that commit the work and must stay reachable',
|
|
44
|
+
'defaultHasDividers on Layout fences both at once, rather than hasDivider per slot',
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'code',
|
|
49
|
+
lang: 'tsx',
|
|
50
|
+
label: 'Pinned header and footer around a scrolling body',
|
|
51
|
+
code: `// padding on Layout reaches every slot, so all three align.
|
|
52
|
+
<Layout
|
|
53
|
+
padding={4}
|
|
54
|
+
defaultHasDividers
|
|
55
|
+
header={<LayoutHeader>{/* title + primary action */}</LayoutHeader>}
|
|
56
|
+
content={<LayoutContent>{/* rows */}</LayoutContent>}
|
|
57
|
+
footer={<LayoutFooter>{/* Save and Cancel */}</LayoutFooter>}
|
|
58
|
+
/>`,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'prose',
|
|
62
|
+
text: 'Verify: scroll the body. The header and footer stay put, their dividers run full-bleed, and all three still share one left content line.',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs internationalization/i18n-library-integration`: override
|
|
5
|
+
* default text, coexist with your own i18n library, or use astryx as your
|
|
6
|
+
* i18n library.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
10
|
+
|
|
11
|
+
export const docs = {
|
|
12
|
+
type: 'generic',
|
|
13
|
+
name: 'i18n-library-integration',
|
|
14
|
+
title: 'Library Integration',
|
|
15
|
+
placement: {parent: 'namespace:internationalization', slot: 'guides', order: 20},
|
|
16
|
+
category: 'guide',
|
|
17
|
+
description:
|
|
18
|
+
"Override astryx's default text, coexist with react-intl / i18next / next-intl / LinguiJS, or use astryx as your i18n library.",
|
|
19
|
+
keywords: [
|
|
20
|
+
'react-intl',
|
|
21
|
+
'i18next',
|
|
22
|
+
'next-intl',
|
|
23
|
+
'LinguiJS',
|
|
24
|
+
'overrides',
|
|
25
|
+
'useTranslator',
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
sections: [
|
|
29
|
+
{
|
|
30
|
+
title: "Overriding astryx's default text",
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'prose',
|
|
34
|
+
text: 'Use `overrides` to change individual strings without shipping a full catalog. Overrides are keyed by locale and merged on top of the built-in and user-supplied catalogs.',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'code',
|
|
38
|
+
lang: 'tsx',
|
|
39
|
+
label: 'Change one string in English',
|
|
40
|
+
code: `<InternationalizationProvider
|
|
41
|
+
locale="en"
|
|
42
|
+
overrides={{en: {'@astryx.pagination.next': 'Next →'}}}
|
|
43
|
+
>
|
|
44
|
+
<App />
|
|
45
|
+
</InternationalizationProvider>`,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'prose',
|
|
49
|
+
text: 'Overrides win over both bundled English and any `messages` catalog for the same key. Use them for brand voice tweaks or one-off wording changes.',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: 'Using astryx with your own i18n library',
|
|
55
|
+
content: [
|
|
56
|
+
{
|
|
57
|
+
type: 'prose',
|
|
58
|
+
text: "Astryx components render astryx strings through astryx's provider. Consumer components render consumer strings through whatever i18n library you already use: react-intl, i18next, next-intl, LinguiJS, and so on. The two systems coexist and read from the same source of truth for the active locale.",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'code',
|
|
62
|
+
lang: 'tsx',
|
|
63
|
+
label: 'Astryx + react-intl side by side',
|
|
64
|
+
code: `import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
65
|
+
import {Selector} from '@astryxdesign/core/Selector';
|
|
66
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
67
|
+
import {FormattedMessage, IntlProvider, useIntl} from 'react-intl';
|
|
68
|
+
import astryxFr from './locales/astryx/fr.json'; // astryx's UI, in French
|
|
69
|
+
import appFr from './locales/app/fr.json'; // your app strings, in French
|
|
70
|
+
|
|
71
|
+
function Pricing() {
|
|
72
|
+
// Consumer strings — resolved by react-intl.
|
|
73
|
+
const intl = useIntl();
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<section>
|
|
77
|
+
<h1><FormattedMessage id="pricing.heading" /></h1>
|
|
78
|
+
|
|
79
|
+
{/* Astryx Selector — trigger placeholder, search-box placeholder,
|
|
80
|
+
clear-button aria-label all resolved by
|
|
81
|
+
<InternationalizationProvider>. Options come from react-intl. */}
|
|
82
|
+
<Selector
|
|
83
|
+
label={intl.formatMessage({id: 'pricing.region.label'})}
|
|
84
|
+
options={[
|
|
85
|
+
{value: 'na', label: intl.formatMessage({id: 'pricing.region.na'})},
|
|
86
|
+
{value: 'eu', label: intl.formatMessage({id: 'pricing.region.eu'})},
|
|
87
|
+
]}
|
|
88
|
+
hasSearch
|
|
89
|
+
hasClear
|
|
90
|
+
/>
|
|
91
|
+
|
|
92
|
+
<Button label={intl.formatMessage({id: 'pricing.cta.subscribe'})} />
|
|
93
|
+
</section>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export default function App() {
|
|
98
|
+
return (
|
|
99
|
+
// Same locale, two providers reading their own catalogs.
|
|
100
|
+
<IntlProvider locale="fr" messages={appFr}>
|
|
101
|
+
<InternationalizationProvider locale="fr" messages={{fr: astryxFr}}>
|
|
102
|
+
<Pricing />
|
|
103
|
+
</InternationalizationProvider>
|
|
104
|
+
</IntlProvider>
|
|
105
|
+
);
|
|
106
|
+
}`,
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
type: 'prose',
|
|
110
|
+
text: 'Keep the two providers in sync on locale, and each library owns its own catalog. Astryx never sees your app strings, and your i18n library never sees astryx internals. Runtime locale swap works the same way: re-render both providers with a new `locale` prop and the whole tree updates live.',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
type: 'prose',
|
|
114
|
+
text: "Single-catalog usage (where an external i18n runtime like react-intl or i18next resolves both your app strings AND astryx's strings through one provider) is on the roadmap via a `Translator` adapter. Track [facebook/astryx#4029](https://github.com/facebook/astryx/issues/4029). For now, run the two providers side by side as shown above.",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
title: 'Using astryx as your i18n library',
|
|
120
|
+
content: [
|
|
121
|
+
{
|
|
122
|
+
type: 'prose',
|
|
123
|
+
text: "For production apps with substantial localization needs, we recommend a dedicated i18n library such as react-intl, i18next, next-intl, or LinguiJS. If your app is small or you do not want another runtime, you can resolve your own strings through astryx too. Keep app keys in a separate namespace from `@astryx.*`, and include your own `en` catalog because astryx's built-in English fallback only contains astryx component strings.",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: 'code',
|
|
127
|
+
lang: 'tsx',
|
|
128
|
+
label: 'Translate app strings with astryx',
|
|
129
|
+
code: `import {Button} from '@astryxdesign/core/Button';
|
|
130
|
+
import {
|
|
131
|
+
InternationalizationProvider,
|
|
132
|
+
useTranslator,
|
|
133
|
+
type Catalog,
|
|
134
|
+
type MessagesByLocale,
|
|
135
|
+
} from '@astryxdesign/core/i18n';
|
|
136
|
+
|
|
137
|
+
const en: Catalog = {
|
|
138
|
+
'@myapp.actions.save': {defaultMessage: 'Save'},
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const fr: Catalog = {
|
|
142
|
+
'@myapp.actions.save': {defaultMessage: 'Enregistrer'},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const messages: MessagesByLocale = {en, fr};
|
|
146
|
+
|
|
147
|
+
function SaveButton() {
|
|
148
|
+
const t = useTranslator();
|
|
149
|
+
return <Button label={t('@myapp.actions.save')} />;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default function App() {
|
|
153
|
+
return (
|
|
154
|
+
<InternationalizationProvider locale="fr" messages={messages}>
|
|
155
|
+
<SaveButton />
|
|
156
|
+
</InternationalizationProvider>
|
|
157
|
+
);
|
|
158
|
+
}`,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
type: 'prose',
|
|
162
|
+
text: '`Catalog` types the rich `{defaultMessage, description?}` authoring shape. `RuntimeCatalog` types the generated key-to-message string map. `ProviderMessagesByLocale` accepts either shape for the provider, while `MessagesByLocale` keeps the original rich-only context shape.',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs internationalization/i18n-quick-start`: wrap your app in
|
|
5
|
+
* a provider, load a locale catalog, and swap languages at runtime.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
9
|
+
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'generic',
|
|
12
|
+
name: 'i18n-quick-start',
|
|
13
|
+
title: 'Quick Start',
|
|
14
|
+
placement: {parent: 'namespace:internationalization', slot: 'guides', order: 10},
|
|
15
|
+
category: 'guide',
|
|
16
|
+
description:
|
|
17
|
+
'Wrap your app in InternationalizationProvider, load a locale catalog, and swap languages at runtime.',
|
|
18
|
+
keywords: [
|
|
19
|
+
'InternationalizationProvider',
|
|
20
|
+
'quick start',
|
|
21
|
+
'language swap',
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
sections: [
|
|
25
|
+
{
|
|
26
|
+
title: 'Quick Start',
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'prose',
|
|
30
|
+
text: 'Internationalization ships with `@astryxdesign/core`. There is nothing to install. Wrap your app in `<InternationalizationProvider>` and set the active `locale`; astryx components pick up localized strings from that provider.',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: 'code',
|
|
34
|
+
lang: 'tsx',
|
|
35
|
+
label: 'Wrap your app',
|
|
36
|
+
code: `import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
37
|
+
|
|
38
|
+
function App() {
|
|
39
|
+
return (
|
|
40
|
+
<InternationalizationProvider locale="en">
|
|
41
|
+
<YourApp />
|
|
42
|
+
</InternationalizationProvider>
|
|
43
|
+
);
|
|
44
|
+
}`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 'prose',
|
|
48
|
+
text: 'The provider always has the built-in English catalog. Pass additional catalogs through `messages` when you enable another locale.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'code',
|
|
52
|
+
lang: 'tsx',
|
|
53
|
+
label: 'Load an astryx locale catalog',
|
|
54
|
+
code: `import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
55
|
+
import frFR from '@astryxdesign/core/locales/fr-FR.generated.js';
|
|
56
|
+
|
|
57
|
+
<InternationalizationProvider
|
|
58
|
+
locale="fr-FR"
|
|
59
|
+
messages={{'fr-FR': frFR}}>
|
|
60
|
+
<App />
|
|
61
|
+
</InternationalizationProvider>;`,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: 'prose',
|
|
65
|
+
text: 'Astryx ships English and first-party translations for supported locales. Compact runtime modules from `@astryxdesign/core/locales/*.generated.js` contain only the messages apps need; the existing `@astryxdesign/core/locales/*.json` files retain translator context. Until a locale is available, apps can pass a local catalog in either shape. Missing keys fall back through the locale chain to English (for example, `pt-BR` walks to `pt`, then to shipped `en`).',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'prose',
|
|
69
|
+
text: 'Locale catalogs only affect astryx strings. Your app can continue using its own i18n system for product copy.',
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: 'Runtime language swap',
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: 'prose',
|
|
78
|
+
text: 'Re-render `<InternationalizationProvider>` with a new `locale` prop and every astryx string updates live. No reload, no separate API call.',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
type: 'code',
|
|
82
|
+
lang: 'tsx',
|
|
83
|
+
label: 'Toggle between locales',
|
|
84
|
+
code: `const [locale, setLocale] = useState<'en' | 'fr'>('en');
|
|
85
|
+
|
|
86
|
+
<InternationalizationProvider locale={locale} messages={{fr}}>
|
|
87
|
+
<Button
|
|
88
|
+
label={locale === 'en' ? 'Français' : 'English'}
|
|
89
|
+
onClick={() => setLocale(l => (l === 'en' ? 'fr' : 'en'))}
|
|
90
|
+
/>
|
|
91
|
+
<App />
|
|
92
|
+
</InternationalizationProvider>;`,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: 'prose',
|
|
96
|
+
text: "Persisting the user's choice (localStorage, cookie, URL segment, account setting) is up to the consumer. Astryx reads whatever `locale` you pass in.",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
@@ -1,95 +1,31 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs internationalization/i18n-rtl-and-testing`: text
|
|
5
|
+
* direction (RTL), pseudo-locale testing, and contributor guidance.
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
/** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
|
|
4
9
|
|
|
5
10
|
export const docs = {
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
type: 'generic',
|
|
12
|
+
name: 'i18n-rtl-and-testing',
|
|
13
|
+
title: 'RTL & Testing',
|
|
14
|
+
placement: {parent: 'namespace:internationalization', slot: 'guides', order: 30},
|
|
8
15
|
category: 'guide',
|
|
9
16
|
description:
|
|
10
|
-
'
|
|
17
|
+
'Text direction (RTL), pseudo-locale testing, and contributor guidance for developers and translators.',
|
|
18
|
+
keywords: [
|
|
19
|
+
'dir',
|
|
20
|
+
'pseudo locale',
|
|
21
|
+
'testing',
|
|
22
|
+
'Crowdin',
|
|
23
|
+
'logical properties',
|
|
24
|
+
],
|
|
11
25
|
|
|
12
26
|
sections: [
|
|
13
|
-
{
|
|
14
|
-
title: 'Quick Start',
|
|
15
|
-
category: 'guide',
|
|
16
|
-
content: [
|
|
17
|
-
{
|
|
18
|
-
type: 'prose',
|
|
19
|
-
text: 'Internationalization ships with `@astryxdesign/core`. There is nothing to install. Wrap your app in `<InternationalizationProvider>` and set the active `locale`; astryx components pick up localized strings from that provider.',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: 'code',
|
|
23
|
-
lang: 'tsx',
|
|
24
|
-
label: 'Wrap your app',
|
|
25
|
-
code: `import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
26
|
-
|
|
27
|
-
function App() {
|
|
28
|
-
return (
|
|
29
|
-
<InternationalizationProvider locale="en">
|
|
30
|
-
<YourApp />
|
|
31
|
-
</InternationalizationProvider>
|
|
32
|
-
);
|
|
33
|
-
}`,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: 'prose',
|
|
37
|
-
text: 'The provider always has the built-in English catalog. Pass additional catalogs through `messages` when you enable another locale.',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'code',
|
|
41
|
-
lang: 'tsx',
|
|
42
|
-
label: 'Load an astryx locale catalog',
|
|
43
|
-
code: `import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
44
|
-
import frFR from '@astryxdesign/core/locales/fr-FR.generated.js';
|
|
45
|
-
|
|
46
|
-
<InternationalizationProvider
|
|
47
|
-
locale="fr-FR"
|
|
48
|
-
messages={{'fr-FR': frFR}}>
|
|
49
|
-
<App />
|
|
50
|
-
</InternationalizationProvider>;`,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
type: 'prose',
|
|
54
|
-
text: 'Astryx ships English and first-party translations for supported locales. Compact runtime modules from `@astryxdesign/core/locales/*.generated.js` contain only the messages apps need; the existing `@astryxdesign/core/locales/*.json` files retain translator context. Until a locale is available, apps can pass a local catalog in either shape. Missing keys fall back through the locale chain to English (for example, `pt-BR` walks to `pt`, then to shipped `en`).',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
type: 'prose',
|
|
58
|
-
text: 'Locale catalogs only affect astryx strings. Your app can continue using its own i18n system for product copy.',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
title: 'Runtime language swap',
|
|
64
|
-
category: 'guide',
|
|
65
|
-
content: [
|
|
66
|
-
{
|
|
67
|
-
type: 'prose',
|
|
68
|
-
text: 'Re-render `<InternationalizationProvider>` with a new `locale` prop and every astryx string updates live. No reload, no separate API call.',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
type: 'code',
|
|
72
|
-
lang: 'tsx',
|
|
73
|
-
label: 'Toggle between locales',
|
|
74
|
-
code: `const [locale, setLocale] = useState<'en' | 'fr'>('en');
|
|
75
|
-
|
|
76
|
-
<InternationalizationProvider locale={locale} messages={{fr}}>
|
|
77
|
-
<Button
|
|
78
|
-
label={locale === 'en' ? 'Français' : 'English'}
|
|
79
|
-
onClick={() => setLocale(l => (l === 'en' ? 'fr' : 'en'))}
|
|
80
|
-
/>
|
|
81
|
-
<App />
|
|
82
|
-
</InternationalizationProvider>;`,
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: 'prose',
|
|
86
|
-
text: "Persisting the user's choice (localStorage, cookie, URL segment, account setting) is up to the consumer. Astryx reads whatever `locale` you pass in.",
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
},
|
|
90
27
|
{
|
|
91
28
|
title: 'Text direction (RTL)',
|
|
92
|
-
category: 'guide',
|
|
93
29
|
content: [
|
|
94
30
|
{
|
|
95
31
|
type: 'prose',
|
|
@@ -156,149 +92,8 @@ export default function RootLayout({children, params}) {
|
|
|
156
92
|
},
|
|
157
93
|
],
|
|
158
94
|
},
|
|
159
|
-
{
|
|
160
|
-
title: "Overriding astryx's default text",
|
|
161
|
-
category: 'guide',
|
|
162
|
-
content: [
|
|
163
|
-
{
|
|
164
|
-
type: 'prose',
|
|
165
|
-
text: 'Use `overrides` to change individual strings without shipping a full catalog. Overrides are keyed by locale and merged on top of the built-in and user-supplied catalogs.',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
type: 'code',
|
|
169
|
-
lang: 'tsx',
|
|
170
|
-
label: 'Change one string in English',
|
|
171
|
-
code: `<InternationalizationProvider
|
|
172
|
-
locale="en"
|
|
173
|
-
overrides={{en: {'@astryx.pagination.next': 'Next →'}}}
|
|
174
|
-
>
|
|
175
|
-
<App />
|
|
176
|
-
</InternationalizationProvider>`,
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
type: 'prose',
|
|
180
|
-
text: 'Overrides win over both bundled English and any `messages` catalog for the same key. Use them for brand voice tweaks or one-off wording changes.',
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
title: 'Using astryx with your own i18n library',
|
|
186
|
-
category: 'guide',
|
|
187
|
-
content: [
|
|
188
|
-
{
|
|
189
|
-
type: 'prose',
|
|
190
|
-
text: "Astryx components render astryx strings through astryx's provider. Consumer components render consumer strings through whatever i18n library you already use: react-intl, i18next, next-intl, LinguiJS, and so on. The two systems coexist and read from the same source of truth for the active locale.",
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
type: 'code',
|
|
194
|
-
lang: 'tsx',
|
|
195
|
-
label: 'Astryx + react-intl side by side',
|
|
196
|
-
code: `import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
197
|
-
import {Selector} from '@astryxdesign/core/Selector';
|
|
198
|
-
import {Button} from '@astryxdesign/core/Button';
|
|
199
|
-
import {FormattedMessage, IntlProvider, useIntl} from 'react-intl';
|
|
200
|
-
import astryxFr from './locales/astryx/fr.json'; // astryx's UI, in French
|
|
201
|
-
import appFr from './locales/app/fr.json'; // your app strings, in French
|
|
202
|
-
|
|
203
|
-
function Pricing() {
|
|
204
|
-
// Consumer strings — resolved by react-intl.
|
|
205
|
-
const intl = useIntl();
|
|
206
|
-
|
|
207
|
-
return (
|
|
208
|
-
<section>
|
|
209
|
-
<h1><FormattedMessage id="pricing.heading" /></h1>
|
|
210
|
-
|
|
211
|
-
{/* Astryx Selector — trigger placeholder, search-box placeholder,
|
|
212
|
-
clear-button aria-label all resolved by
|
|
213
|
-
<InternationalizationProvider>. Options come from react-intl. */}
|
|
214
|
-
<Selector
|
|
215
|
-
label={intl.formatMessage({id: 'pricing.region.label'})}
|
|
216
|
-
options={[
|
|
217
|
-
{value: 'na', label: intl.formatMessage({id: 'pricing.region.na'})},
|
|
218
|
-
{value: 'eu', label: intl.formatMessage({id: 'pricing.region.eu'})},
|
|
219
|
-
]}
|
|
220
|
-
hasSearch
|
|
221
|
-
hasClear
|
|
222
|
-
/>
|
|
223
|
-
|
|
224
|
-
<Button label={intl.formatMessage({id: 'pricing.cta.subscribe'})} />
|
|
225
|
-
</section>
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export default function App() {
|
|
230
|
-
return (
|
|
231
|
-
// Same locale, two providers reading their own catalogs.
|
|
232
|
-
<IntlProvider locale="fr" messages={appFr}>
|
|
233
|
-
<InternationalizationProvider locale="fr" messages={{fr: astryxFr}}>
|
|
234
|
-
<Pricing />
|
|
235
|
-
</InternationalizationProvider>
|
|
236
|
-
</IntlProvider>
|
|
237
|
-
);
|
|
238
|
-
}`,
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
type: 'prose',
|
|
242
|
-
text: 'Keep the two providers in sync on locale, and each library owns its own catalog. Astryx never sees your app strings, and your i18n library never sees astryx internals. Runtime locale swap works the same way: re-render both providers with a new `locale` prop and the whole tree updates live.',
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
type: 'prose',
|
|
246
|
-
text: "Single-catalog usage (where an external i18n runtime like react-intl or i18next resolves both your app strings AND astryx's strings through one provider) is on the roadmap via a `Translator` adapter. Track [facebook/astryx#4029](https://github.com/facebook/astryx/issues/4029). For now, run the two providers side by side as shown above.",
|
|
247
|
-
},
|
|
248
|
-
],
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
title: 'Using astryx as your i18n library',
|
|
252
|
-
category: 'guide',
|
|
253
|
-
content: [
|
|
254
|
-
{
|
|
255
|
-
type: 'prose',
|
|
256
|
-
text: "For production apps with substantial localization needs, we recommend a dedicated i18n library such as react-intl, i18next, next-intl, or LinguiJS. If your app is small or you do not want another runtime, you can resolve your own strings through astryx too. Keep app keys in a separate namespace from `@astryx.*`, and include your own `en` catalog because astryx's built-in English fallback only contains astryx component strings.",
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
type: 'code',
|
|
260
|
-
lang: 'tsx',
|
|
261
|
-
label: 'Translate app strings with astryx',
|
|
262
|
-
code: `import {Button} from '@astryxdesign/core/Button';
|
|
263
|
-
import {
|
|
264
|
-
InternationalizationProvider,
|
|
265
|
-
useTranslator,
|
|
266
|
-
type Catalog,
|
|
267
|
-
type MessagesByLocale,
|
|
268
|
-
} from '@astryxdesign/core/i18n';
|
|
269
|
-
|
|
270
|
-
const en: Catalog = {
|
|
271
|
-
'@myapp.actions.save': {defaultMessage: 'Save'},
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
const fr: Catalog = {
|
|
275
|
-
'@myapp.actions.save': {defaultMessage: 'Enregistrer'},
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
const messages: MessagesByLocale = {en, fr};
|
|
279
|
-
|
|
280
|
-
function SaveButton() {
|
|
281
|
-
const t = useTranslator();
|
|
282
|
-
return <Button label={t('@myapp.actions.save')} />;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
export default function App() {
|
|
286
|
-
return (
|
|
287
|
-
<InternationalizationProvider locale="fr" messages={messages}>
|
|
288
|
-
<SaveButton />
|
|
289
|
-
</InternationalizationProvider>
|
|
290
|
-
);
|
|
291
|
-
}`,
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
type: 'prose',
|
|
295
|
-
text: '`Catalog` types the rich `{defaultMessage, description?}` authoring shape. `RuntimeCatalog` types the generated key-to-message string map. `ProviderMessagesByLocale` accepts either shape for the provider, while `MessagesByLocale` keeps the original rich-only context shape.',
|
|
296
|
-
},
|
|
297
|
-
],
|
|
298
|
-
},
|
|
299
95
|
{
|
|
300
96
|
title: 'Testing your translations',
|
|
301
|
-
category: 'guide',
|
|
302
97
|
content: [
|
|
303
98
|
{
|
|
304
99
|
type: 'prose',
|
|
@@ -319,7 +114,6 @@ import pseudo from '@astryxdesign/core/locales/pseudo.generated.js';
|
|
|
319
114
|
},
|
|
320
115
|
{
|
|
321
116
|
title: 'For contributors',
|
|
322
|
-
category: 'guide',
|
|
323
117
|
content: [
|
|
324
118
|
{
|
|
325
119
|
type: 'heading',
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx docs internationalization`: the internationalization namespace.
|
|
5
|
+
* Groups guides for quick-start locale setup, library integration, and
|
|
6
|
+
* RTL + testing.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').NamespaceDoc} */
|
|
10
|
+
export const docs = {
|
|
11
|
+
type: 'namespace',
|
|
12
|
+
name: 'internationalization',
|
|
13
|
+
title: 'Internationalization',
|
|
14
|
+
summary:
|
|
15
|
+
'Set the active locale, load catalogs, coexist with your own i18n library, handle RTL, and test translations.',
|
|
16
|
+
keywords: [
|
|
17
|
+
'i18n',
|
|
18
|
+
'internationalization',
|
|
19
|
+
'locale',
|
|
20
|
+
'translation',
|
|
21
|
+
'RTL',
|
|
22
|
+
'right-to-left',
|
|
23
|
+
'language',
|
|
24
|
+
'catalog',
|
|
25
|
+
],
|
|
26
|
+
slots: {
|
|
27
|
+
guides: {title: 'Guides', accepts: {kinds: ['generic']}},
|
|
28
|
+
},
|
|
29
|
+
};
|