@astryxdesign/cli 0.6.6-canary.6ea1fb7 → 0.6.6-canary.7c8ddf2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/README.md +83 -83
  2. package/api/build/_adapter.d.mts +15 -0
  3. package/api/build/_adapter.mjs +22 -0
  4. package/api/build/build.doc.mjs +1 -1
  5. package/api/build/build.type.d.mts +4 -0
  6. package/api/build/build.type.mjs +1 -0
  7. package/api/build/help/help.mjs +1 -1
  8. package/api/build/kit/kit.mjs +12 -1
  9. package/api/component/component-replacement.test.mjs +12 -0
  10. package/api/component/component.doc.mjs +5 -2
  11. package/api/docs/_adapter.mjs +48 -1
  12. package/api/docs/compiled-topics.test.mjs +1 -1
  13. package/api/docs/detail/section/section.d.mts +44 -0
  14. package/api/docs/detail/section/section.mjs +164 -13
  15. package/api/docs/detail/section/section.test.mjs +4 -4
  16. package/api/docs/docOverlays.test.mjs +28 -17
  17. package/api/docs/docs.doc.mjs +3 -3
  18. package/api/docs/docs.mjs +11 -16
  19. package/api/docs/docs.test.mjs +9 -10
  20. package/api/docs/integration-tree.test.mjs +26 -26
  21. package/api/docs/integrationDocs.test.mjs +2 -2
  22. package/api/docs/namespace-section.test.mjs +260 -0
  23. package/api/docs/token-tables.test.mjs +93 -0
  24. package/api/doctor/doctor.d.mts +6 -0
  25. package/api/doctor/doctor.mjs +149 -40
  26. package/api/doctor/doctor.test.mjs +104 -0
  27. package/api/doctor/theme-checks.mjs +1 -1
  28. package/api/gap-report/gap-report.doc.mjs +2 -1
  29. package/api/init/run/run.mjs +1 -0
  30. package/api/integration/validate-integration.mjs +20 -4
  31. package/api/integration/validate-integration.test.mjs +73 -0
  32. package/api/layout/check/check.d.mts +1 -0
  33. package/api/layout/check/check.mjs +1 -0
  34. package/api/layout/expand/expand.d.mts +1 -0
  35. package/api/layout/expand/expand.mjs +1 -0
  36. package/api/layout/grammar/grammar.d.mts +1 -0
  37. package/api/layout/grammar/grammar.mjs +1 -0
  38. package/api/layout/layoutCheck.doc.mjs +1 -1
  39. package/api/layout/layoutExpand.doc.mjs +1 -1
  40. package/api/layout/layoutGrammar.doc.mjs +1 -1
  41. package/api/search/search.d.mts +44 -0
  42. package/api/search/search.domain-priority.test.mjs +261 -0
  43. package/api/search/search.mjs +191 -29
  44. package/api/swizzle/swizzle.doc.mjs +5 -2
  45. package/api/template/copy/copy.mjs +12 -0
  46. package/api/template/template.doc.mjs +1 -1
  47. package/api/template/template.type.d.mts +3 -0
  48. package/api/template/template.type.mjs +3 -0
  49. package/api/theme/build/build.d.mts +70 -0
  50. package/api/theme/build/build.mjs +205 -41
  51. package/api/theme/build/font-warning.d.mts +11 -0
  52. package/api/theme/build/font-warning.mjs +28 -3
  53. package/assets/docs/author-a-theme.doc.mjs +16 -11
  54. package/assets/docs/getting-started.doc.mjs +2 -2
  55. package/assets/docs/principles.doc.dense.mjs +3 -3
  56. package/assets/docs/principles.doc.mjs +4 -4
  57. package/assets/docs/principles.doc.zh.mjs +3 -3
  58. package/assets/docs/styling-overview.doc.mjs +6 -6
  59. package/assets/docs/theme.doc.dense.mjs +1 -1
  60. package/assets/docs/theme.doc.zh.mjs +1 -1
  61. package/assets/docs/tree/component-migration.doc.mjs +107 -0
  62. package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
  63. package/assets/docs/tree/font-setup.doc.mjs +122 -0
  64. package/assets/docs/tree/headers-and-footers.doc.mjs +0 -1
  65. package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
  66. package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
  67. package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
  68. package/assets/docs/tree/internationalization.doc.mjs +29 -0
  69. package/assets/docs/tree/layout.doc.mjs +23 -0
  70. package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
  71. package/assets/docs/tree/migration-verification.doc.mjs +67 -0
  72. package/assets/docs/tree/migration.doc.mjs +28 -0
  73. package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
  74. package/assets/docs/tree/other-libraries.doc.mjs +218 -0
  75. package/assets/docs/tree/responsive.doc.mjs +0 -4
  76. package/assets/docs/tree/scaffold.doc.mjs +0 -5
  77. package/assets/docs/tree/side-panels.doc.mjs +0 -1
  78. package/assets/docs/tree/structure.doc.mjs +0 -4
  79. package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
  80. package/assets/docs/tree/styling-basics.doc.mjs +181 -0
  81. package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
  82. package/assets/docs/tree/styling.doc.mjs +29 -0
  83. package/assets/docs/tree/tailwind.doc.mjs +65 -0
  84. package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
  85. package/assets/docs/tree/tokens-border.doc.mjs +46 -0
  86. package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
  87. package/assets/docs/tree/tokens-color.doc.mjs +438 -0
  88. package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
  89. package/assets/docs/tree/tokens-data.doc.mjs +323 -0
  90. package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
  91. package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
  92. package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
  93. package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
  94. package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
  95. package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
  96. package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
  97. package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
  98. package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
  99. package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
  100. package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
  101. package/assets/docs/tree/tokens-size.doc.mjs +54 -0
  102. package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
  103. package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
  104. package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
  105. package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
  106. package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
  107. package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
  108. package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
  109. package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
  110. package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
  111. package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
  112. package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
  113. package/assets/docs/tree/tokens.doc.mjs +28 -0
  114. package/assets/docs/tree/type-scale.doc.mjs +147 -0
  115. package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
  116. package/assets/docs/tree/typography.doc.mjs +29 -0
  117. package/assets/docs/use-a-theme.doc.mjs +6 -3
  118. package/assets/templates/pages/incident-console/page.tsx +1 -1
  119. package/assets/theme.template.ts +4 -3
  120. package/clients/cli/commands/blog.mjs +3 -3
  121. package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
  122. package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
  123. package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
  124. package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
  125. package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
  126. package/clients/cli/commands/build-theme.mjs +68 -18
  127. package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
  128. package/clients/cli/commands/build.mjs +1 -0
  129. package/clients/cli/commands/component/index.mjs +4 -1
  130. package/clients/cli/commands/component-replacement.text.test.mjs +45 -0
  131. package/clients/cli/commands/docs.doc.mjs +2 -1
  132. package/clients/cli/commands/docs.test.mjs +15 -12
  133. package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
  134. package/clients/cli/commands/doctor.test.mjs +50 -1
  135. package/clients/cli/commands/import-hint-correctness.test.mjs +23 -0
  136. package/clients/cli/commands/layout-check.doc.mjs +1 -0
  137. package/clients/cli/commands/layout-expand.doc.mjs +1 -0
  138. package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
  139. package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
  140. package/clients/cli/commands/layout.doc.mjs +1 -0
  141. package/clients/cli/commands/layout.mjs +6 -11
  142. package/clients/cli/commands/search.test.mjs +6 -2
  143. package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
  144. package/clients/cli/commands/template.mjs +4 -3
  145. package/clients/cli/commands/theme-add-lifecycle.test.mjs +9 -6
  146. package/clients/cli/commands/theme-build.doc.mjs +3 -1
  147. package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
  148. package/clients/cli/index.mjs +1 -1
  149. package/clients/cli/lib/component-format.mjs +13 -3
  150. package/clients/cli/lib/component-format.test.mjs +1 -1
  151. package/clients/cli/lib/define-command.mjs +4 -0
  152. package/foundation/agent-docs/agent-docs.mjs +18 -2
  153. package/foundation/agent-docs/agent-docs.test.mjs +18 -0
  154. package/foundation/config/project.test.mjs +1 -1
  155. package/foundation/discovery/docs-discovery.test.mjs +1 -1
  156. package/foundation/discovery/template-needs.d.mts +31 -0
  157. package/foundation/discovery/template-needs.mjs +156 -0
  158. package/foundation/discovery/template-needs.test.mjs +203 -0
  159. package/foundation/doc-compiler/bundle.mjs +52 -1
  160. package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
  161. package/foundation/doc-compiler/tree.d.mts +10 -0
  162. package/foundation/doc-compiler/tree.mjs +22 -0
  163. package/foundation/doc-compiler/tree.test.mjs +3 -2
  164. package/foundation/env/package-manager.d.mts +31 -8
  165. package/foundation/env/package-manager.mjs +120 -13
  166. package/foundation/env/package-manager.test.mjs +174 -1
  167. package/foundation/integrations/validate-contributions.d.mts +16 -0
  168. package/foundation/integrations/validate-contributions.mjs +56 -8
  169. package/foundation/response/response-types.doc.mjs +4 -4
  170. package/package.json +9 -9
  171. package/assets/docs/styling-libraries.doc.mjs +0 -469
  172. package/assets/docs/styling.doc.mjs +0 -412
  173. package/assets/docs/tokens.doc.dense.mjs +0 -15
  174. package/assets/docs/tokens.doc.mjs +0 -1491
  175. package/assets/docs/tokens.doc.zh.mjs +0 -15
  176. package/assets/docs/typography.doc.mjs +0 -286
@@ -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
- name: 'internationalization',
7
- title: 'Internationalization',
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
- 'Set the active locale for astryx components, load locale catalogs, coexist with your own i18n library, swap languages at runtime, and test translations with the pseudo locale.',
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
+ };
@@ -25,6 +25,29 @@ export const docs = {
25
25
  'AppShell',
26
26
  'SideNav',
27
27
  'TopNav',
28
+ 'hasDivider',
29
+ 'MobileNav',
30
+ 'contentWidth',
31
+ ],
32
+ blocks: [
33
+ {
34
+ type: 'prose',
35
+ text: "Build a layout outside-in. Settle the shell and its region budgets before any content exists, then work inward. Content-first layouts drift into a padded column of cards, because every section ends up inventing its own container.",
36
+ },
37
+ {
38
+ type: 'list',
39
+ style: 'ordered',
40
+ items: [
41
+ "Scaffold: pick the shell, budget each region, and choose navigation",
42
+ "Structure: rank the content in each region, then pick the weakest container that groups it",
43
+ "Spacing: hold one content line per region, then tune gaps and density",
44
+ "Breakpoints: decide what each region does as width changes",
45
+ ],
46
+ },
47
+ {
48
+ type: 'prose',
49
+ text: "This guide decides layout, not component APIs. Run `npx astryx build \"<idea>\"` to start from the closest template for your app type, and `npx astryx component <Name>` for a component's props.",
50
+ },
28
51
  ],
29
52
  slots: {
30
53
  guides: {title: 'Guides', accepts: {kinds: ['generic']}},
@@ -1,13 +1,28 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
+ /**
4
+ * @file `astryx docs migration/migration-setup`: theme and CSS setup,
5
+ * cascade layer safety, layer audit, and the foundation smoke test.
6
+ */
7
+
3
8
  /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
4
9
 
5
10
  export const docs = {
6
- name: 'migration',
7
- title: 'Migration Guide',
11
+ type: 'generic',
12
+ name: 'migration-setup',
13
+ title: 'Setup',
14
+ placement: {parent: 'namespace:migration', slot: 'guides', order: 10},
8
15
  category: 'guide',
9
16
  description:
10
- 'How to migrate an existing Tailwind, shadcn, or Radix application to the design system incrementally.',
17
+ 'Install the theme, wire CSS layers, audit resets, and run the foundation smoke test before migrating any surface.',
18
+ keywords: [
19
+ 'setup',
20
+ 'theme',
21
+ 'reset',
22
+ 'smoke test',
23
+ 'layer audit',
24
+ 'Tailwind coexistence',
25
+ ],
11
26
 
12
27
  sections: [
13
28
  {
@@ -30,15 +45,15 @@ export const docs = {
30
45
  type: 'list',
31
46
  style: 'ordered',
32
47
  items: [
33
- 'Install the packages and run `astryx init` for agent docs, then add the reset, `astryx.css`, and theme CSS imports (see Theme and CSS Setup).',
48
+ 'Install the packages and run `astryx init` for agent docs, then add the reset, `astryx.css`, and theme CSS imports (see Theme and CSS Setup below).',
34
49
  'Wrap the app root with Theme and choose the initial light, dark, or system mode behavior.',
35
50
  'Make Tailwind and design system CSS layer order explicit before replacing components.',
36
51
  'Render the foundation smoke test page and confirm primitives keep their padding before migrating any surface.',
37
- 'Move the persistent frame first: AppShell, TopNav, SideNav, page content, and mobile navigation.',
38
- 'Replace shared primitives: Button, IconButton, TextInput, NumberInput, Switch, CheckboxInput, RadioList, Selector, TabList, Dialog, AlertDialog, Banner, Toast, Badge, Card, Table, and ListItem.',
52
+ 'Move the persistent frame first: AppShell, TopNav, SideNav, page content, and mobile navigation. See {@link generic:component-migration}.',
53
+ 'Replace shared primitives: Button, IconButton, TextInput, NumberInput, Switch, CheckboxInput, RadioList, Selector, TabList, Dialog, AlertDialog, Banner, Toast, Badge, Card, Table, and ListItem. See {@link generic:component-migration}.',
39
54
  'Replace global workflows: command palette, settings popover, theme toggle, search, filters, create flows, and destructive confirmation dialogs.',
40
55
  'Remove legacy Tailwind classes from each completed surface, keeping only token-backed layout utilities or local wrappers that still need to be migrated.',
41
- 'Verify both light and dark modes, keyboard navigation, responsive layout, and empty/error/loading states before moving to the next route.',
56
+ 'Verify both light and dark modes, keyboard navigation, responsive layout, and empty/error/loading states before moving to the next route. See {@link generic:migration-verification}.',
42
57
  ],
43
58
  },
44
59
  ],
@@ -110,7 +125,7 @@ export function AppRoot({children}: {children: React.ReactNode}) {
110
125
  },
111
126
  {
112
127
  type: 'prose',
113
- text: 'When Tailwind remains in the app, declare layer order once in the global CSS file. Load the Astryx reset and theme CSS before Tailwind utilities so migrated components keep design system defaults while legacy utility classes still work. On Tailwind v4, use the imports and layer order in the Tailwind section of {@link generic:styling-libraries}.',
128
+ text: 'When Tailwind remains in the app, declare layer order once in the global CSS file. Load the Astryx reset and theme CSS before Tailwind utilities so migrated components keep design system defaults while legacy utility classes still work. On Tailwind v4, use the imports and layer order in {@link generic:tailwind}.',
114
129
  },
115
130
  {
116
131
  type: 'prose',
@@ -155,7 +170,7 @@ export function AppRoot({children}: {children: React.ReactNode}) {
155
170
  },
156
171
  {
157
172
  type: 'prose',
158
- text: 'Before building screens, check every stylesheet against Cascade layer audit.',
173
+ text: 'Before building screens, check every stylesheet against the cascade layer audit below.',
159
174
  },
160
175
  ],
161
176
  },
@@ -258,125 +273,5 @@ if (getComputedStyle(button).paddingInline === '0px') {
258
273
  },
259
274
  ],
260
275
  },
261
- {
262
- title: 'Move the App Frame First',
263
- content: [
264
- {
265
- type: 'prose',
266
- text: 'Start with AppShell so page migration happens inside the final navigation, spacing, surface, and responsive frame. This also exposes theme and color issues early because every route shares the same shell.',
267
- },
268
- {
269
- type: 'table',
270
- headers: ['Legacy surface', 'Component', 'Notes'],
271
- rows: [
272
- ['Header', 'TopNav', 'Use for product identity, global actions, account entry, and command/search trigger.'],
273
- ['Sidebar', 'SideNav', 'Use sections and nested nav items for route groups. Keep selection state driven by the router.'],
274
- ['Main page wrapper', 'AppShell + Layout', 'Let the shell own persistent structure; let route components own page content.'],
275
- ['Mobile drawer nav', 'MobileNav or AppShell mobile behavior', 'Verify focus, close behavior, and route changes on narrow viewports.'],
276
- ['Settings menu', 'Popover + Layout + Switch', 'Use as the home for theme mode and app preferences.'],
277
- ],
278
- },
279
- ],
280
- },
281
- {
282
- title: 'Map shadcn and Radix Primitives',
283
- content: [
284
- {
285
- type: 'prose',
286
- text: 'Do not wrap old shadcn components in design system styles. Replace the primitive with the component that owns the behavior, accessibility, state classes, and token usage.',
287
- },
288
- {
289
- type: 'table',
290
- headers: ['Existing primitive', 'Component', 'Migration note'],
291
- rows: [
292
- ['button / shadcn Button', 'Button or IconButton', 'Use Button for labeled commands and IconButton for icon-only toolbar actions.'],
293
- ['input', 'TextInput', 'Keep validation state in status props rather than ad hoc border classes.'],
294
- ['textarea', 'TextArea', 'Use when multiline editing is the primary action.'],
295
- ['switch', 'Switch', 'Use for persisted boolean settings, including theme mode when represented as a binary choice.'],
296
- ['checkbox', 'CheckboxInput or CheckboxList', 'Use list variants for grouped selection.'],
297
- ['radio group', 'RadioList', 'Use when one option must be selected from a visible set.'],
298
- ['select / combobox', 'Selector or Typeahead', 'Use Selector for bounded options and Typeahead for searchable async options.'],
299
- ['tabs used as page nav', 'TabList', 'Use route state or current page state as the source of truth.'],
300
- ['command dialog', 'CommandPalette', 'Keep app-specific search sources outside the shell and feed searchable items.'],
301
- ['dropdown action menu', 'DropdownMenu or MoreMenu', 'Use MoreMenu for compact overflow actions.'],
302
- ['alert / callout', 'Banner or Toast', 'Use Banner for page or section messages and Toast for transient feedback.'],
303
- ['dialog', 'Dialog or AlertDialog', 'Use AlertDialog for destructive confirmation and Dialog for task flows.'],
304
- ['card-like list row', 'ListItem', 'Prefer ListItem for selectable rows instead of styling Button as a row.'],
305
- ],
306
- },
307
- ],
308
- },
309
- {
310
- id: 'command-palette',
311
- title: 'Command Palette, Settings, and Theme',
312
- content: [
313
- {
314
- type: 'prose',
315
- text: 'Move global search to CommandPalette once the shell exists. Treat the palette as a view over app commands: routes, contextual actions, create actions, filters, recent items, and entity results. Keep data normalization in app code so search sources always return arrays of searchable items.',
316
- },
317
- {
318
- type: 'prose',
319
- text: 'Put light and dark mode controls in the settings popover or account menu. The switch or selector should update the mode passed to Theme, not toggle isolated body classes.',
320
- },
321
- {
322
- type: 'code',
323
- lang: 'tsx',
324
- label: 'Settings popover theme control',
325
- code: `function ThemeModeSwitch() {
326
- const {mode, setMode} = useSettings();
327
- const isDark = mode === 'dark';
328
-
329
- return (
330
- <Switch
331
- label="Dark mode"
332
- description="Use the dark color theme"
333
- value={isDark}
334
- onChange={next => setMode(next ? 'dark' : 'light')}
335
- />
336
- );
337
- }`,
338
- },
339
- ],
340
- },
341
- {
342
- title: 'Verification Checklist',
343
- content: [
344
- {
345
- type: 'list',
346
- style: 'unordered',
347
- items: [
348
- 'Run the app in light and dark mode and check that surfaces, borders, text, icons, hover states, focus rings, and status colors flow together.',
349
- 'Open the command palette from the shell, type into it, select items by keyboard, and confirm focus returns to the trigger.',
350
- 'Check the SideNav at collapsed, expanded, active, hover, nested, and mobile states.',
351
- 'Verify settings popovers and dialogs in jsdom and in a real browser because the native dialog and [`Popover`](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) APIs may need test shims.',
352
- 'Search for leftover hardcoded Tailwind colors, arbitrary hex values, and one-off hover colors after each route migration.',
353
- 'Run component tests, build, and at least one browser screenshot pass for each migrated route.',
354
- ],
355
- },
356
- ],
357
- },
358
- {
359
- title: 'AI Migration Prompt',
360
- content: [
361
- {
362
- type: 'prose',
363
- text: 'When using an AI coding agent, give it an explicit migration loop instead of asking for a full-app rewrite.',
364
- },
365
- {
366
- type: 'code',
367
- lang: 'text',
368
- label: 'Paste this into your AI',
369
- code: `We are migrating this existing Tailwind/shadcn app to Astryx incrementally.
370
-
371
- First run:
372
- - astryx docs migration --dense
373
- - astryx docs theme --dense
374
- - astryx docs styling --dense
375
- - astryx template AppShellTopNavWithSideNav --skeleton
376
-
377
- Then migrate one route or shell surface at a time. Keep business logic and routing intact. Replace shadcn/Radix/Tailwind primitives with Astryx components, remove hardcoded colors, verify light and dark mode, and take screenshots before moving to the next surface.`,
378
- },
379
- ],
380
- },
381
276
  ],
382
277
  };