@astryxdesign/cli 0.6.4-canary.06c8fa3 → 0.6.4-canary.0e1fbdb

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 (254) hide show
  1. package/README.md +49 -40
  2. package/api/build/build.doc.mjs +6 -1
  3. package/api/build/build.test.mjs +22 -0
  4. package/api/build/kit/kit.mjs +44 -5
  5. package/api/component/component.doc.mjs +14 -7
  6. package/api/docs/_adapter.d.mts +8 -3
  7. package/api/docs/_adapter.mjs +14 -6
  8. package/api/docs/docOverlays.test.mjs +27 -1
  9. package/api/docs/docs.doc.mjs +2 -2
  10. package/api/doctor/doctor.doc.mjs +17 -8
  11. package/api/doctor/doctor.type.d.mts +1 -1
  12. package/api/doctor/doctor.type.mjs +1 -1
  13. package/api/gap-report/gap-report.doc.mjs +19 -10
  14. package/api/hook/hook.doc.mjs +6 -3
  15. package/api/index.d.mts +2 -0
  16. package/api/index.mjs +3 -1
  17. package/api/init/init.doc.mjs +17 -12
  18. package/api/integration/add-theme.mjs +22 -1
  19. package/api/integration/add-theme.test.mjs +34 -0
  20. package/api/integration/authoring-checks.mjs +2 -2
  21. package/api/integration/integrationPackCheck.doc.mjs +3 -3
  22. package/api/integration/pack-check.lifecycle-output.test.mjs +2 -0
  23. package/api/integration/pack-check.mjs +54 -6
  24. package/api/integration/pack-check.test.mjs +90 -0
  25. package/api/integration/pack-check.type.mjs +1 -1
  26. package/api/json/assertResponse.doc.mjs +1 -1
  27. package/api/json/index.ts +1 -0
  28. package/api/json/isError.doc.mjs +1 -1
  29. package/api/layout/_adapter.d.mts +34 -0
  30. package/api/layout/_adapter.mjs +148 -0
  31. package/api/layout/check/check.d.mts +16 -0
  32. package/api/layout/check/check.mjs +40 -0
  33. package/api/layout/expand/expand.d.mts +22 -0
  34. package/api/layout/expand/expand.mjs +155 -0
  35. package/api/layout/expand/expand.path-safety.test.mjs +53 -0
  36. package/api/layout/grammar/grammar.d.mts +13 -0
  37. package/api/layout/grammar/grammar.mjs +87 -0
  38. package/api/layout/layout.d.mts +6 -0
  39. package/api/layout/layout.mjs +17 -0
  40. package/api/layout/layout.test.mjs +297 -0
  41. package/api/layout/layout.type.d.mts +89 -0
  42. package/api/layout/layout.type.mjs +103 -0
  43. package/api/layout/layoutCheck.doc.d.mts +11 -0
  44. package/api/layout/layoutCheck.doc.mjs +85 -0
  45. package/api/layout/layoutExpand.doc.d.mts +11 -0
  46. package/api/layout/layoutExpand.doc.mjs +107 -0
  47. package/api/layout/layoutGrammar.doc.d.mts +11 -0
  48. package/api/layout/layoutGrammar.doc.mjs +57 -0
  49. package/api/search/search.d.mts +27 -1
  50. package/api/search/search.doc.mjs +2 -2
  51. package/api/search/search.mjs +228 -16
  52. package/api/swizzle/swizzle.doc.mjs +7 -5
  53. package/api/template/copy/copy.mjs +1 -1
  54. package/api/template/copy/copy.test.mjs +9 -0
  55. package/api/template/template-integration.test.mjs +65 -1
  56. package/api/template/template.doc.mjs +2 -1
  57. package/api/template/template.mjs +1 -1
  58. package/api/theme/generateTonalPalette.doc.mjs +1 -2
  59. package/api/theme/listThemes.doc.mjs +1 -1
  60. package/api/theme/themeAdd.doc.mjs +9 -10
  61. package/api/theme/themeBuild.doc.mjs +13 -13
  62. package/api/theme/themeList.doc.mjs +1 -1
  63. package/api/theme/themeListAvailable.doc.mjs +2 -1
  64. package/api/theme/themePaletteGenerate.doc.mjs +15 -8
  65. package/api/theme/themeTargets.doc.mjs +3 -2
  66. package/api/theme/themeTemplate.doc.mjs +2 -1
  67. package/api/upgrade/run/run.mjs +1 -1
  68. package/api/upgrade/upgrade.doc.mjs +24 -22
  69. package/assets/docs/README.md +4 -2
  70. package/assets/docs/browser-support.doc.mjs +11 -11
  71. package/assets/docs/color.doc.mjs +8 -2
  72. package/assets/docs/elevation.doc.mjs +6 -4
  73. package/assets/docs/getting-started.doc.mjs +5 -16
  74. package/assets/docs/icons.doc.mjs +2 -21
  75. package/assets/docs/illustrations.doc.mjs +7 -15
  76. package/assets/docs/layout.doc.dense.mjs +130 -82
  77. package/assets/docs/layout.doc.mjs +133 -77
  78. package/assets/docs/migration.doc.mjs +19 -21
  79. package/assets/docs/motion.doc.mjs +16 -3
  80. package/assets/docs/principles.doc.dense.mjs +5 -5
  81. package/assets/docs/principles.doc.mjs +8 -0
  82. package/assets/docs/principles.doc.zh.mjs +6 -6
  83. package/assets/docs/shape.doc.mjs +8 -3
  84. package/assets/docs/spacing.doc.mjs +7 -2
  85. package/assets/docs/styling-libraries.doc.mjs +6 -2
  86. package/assets/docs/styling.doc.mjs +19 -23
  87. package/assets/docs/theme.doc.dense.mjs +58 -18
  88. package/assets/docs/theme.doc.mjs +56 -46
  89. package/assets/docs/theme.doc.zh.mjs +9 -8
  90. package/assets/docs/tokens.doc.dense.mjs +2 -2
  91. package/assets/docs/tokens.doc.mjs +389 -8
  92. package/assets/docs/tokens.doc.zh.mjs +2 -2
  93. package/assets/docs/tree/add-a-component.doc.mjs +75 -0
  94. package/assets/docs/tree/add-a-theme.doc.mjs +85 -0
  95. package/assets/docs/tree/add-a-topic.doc.mjs +144 -0
  96. package/assets/docs/tree/agent-guidance.doc.mjs +138 -0
  97. package/assets/docs/tree/block-template.doc.mjs +130 -0
  98. package/assets/docs/tree/build-the-template.doc.mjs +28 -0
  99. package/assets/docs/tree/building-blocks.doc.mjs +46 -0
  100. package/assets/docs/tree/check-your-docs.doc.mjs +137 -0
  101. package/assets/docs/tree/checks.doc.mjs +119 -0
  102. package/assets/docs/tree/codemods.doc.mjs +147 -0
  103. package/assets/docs/tree/component-family.doc.mjs +113 -0
  104. package/assets/docs/tree/component-imports.doc.mjs +69 -0
  105. package/assets/docs/tree/components.doc.mjs +23 -0
  106. package/assets/docs/tree/configuration.doc.mjs +23 -0
  107. package/assets/docs/tree/debug-and-gap-reports.doc.mjs +182 -0
  108. package/assets/docs/tree/define-the-theme.doc.mjs +118 -0
  109. package/assets/docs/tree/describe-the-component.doc.mjs +57 -0
  110. package/assets/docs/tree/docs.doc.mjs +21 -0
  111. package/assets/docs/tree/document-the-template.doc.mjs +28 -0
  112. package/assets/docs/tree/document-the-theme.doc.mjs +68 -0
  113. package/assets/docs/tree/export-template-assets.doc.mjs +147 -0
  114. package/assets/docs/tree/extend-or-replace.doc.mjs +103 -0
  115. package/assets/docs/tree/fonts-and-assets.doc.mjs +106 -0
  116. package/assets/docs/tree/generate-a-palette.doc.mjs +66 -0
  117. package/assets/docs/tree/grade-template-with-agent.doc.mjs +105 -0
  118. package/assets/docs/tree/help.doc.mjs +16 -0
  119. package/assets/docs/tree/integrations.doc.mjs +25 -470
  120. package/assets/docs/tree/links.doc.mjs +98 -0
  121. package/assets/docs/tree/package-and-test.doc.mjs +32 -0
  122. package/assets/docs/tree/page-template.doc.mjs +71 -0
  123. package/assets/docs/tree/publishing.doc.mjs +111 -0
  124. package/assets/docs/tree/quick-start.doc.mjs +272 -0
  125. package/assets/docs/tree/replace-a-core-component.doc.mjs +104 -0
  126. package/assets/docs/tree/replace-a-core-template.doc.mjs +172 -0
  127. package/assets/docs/tree/sections-and-placement.doc.mjs +108 -0
  128. package/assets/docs/tree/see-it-in-an-app.doc.mjs +59 -0
  129. package/assets/docs/tree/ship.doc.mjs +16 -0
  130. package/assets/docs/tree/short-and-findable.doc.mjs +108 -0
  131. package/assets/docs/tree/single-component.doc.mjs +165 -0
  132. package/assets/docs/tree/start-a-template.doc.mjs +143 -0
  133. package/assets/docs/tree/subcomponent.doc.mjs +115 -0
  134. package/assets/docs/tree/template-assets.doc.mjs +64 -0
  135. package/assets/docs/tree/template-doc-overview.doc.mjs +109 -0
  136. package/assets/docs/tree/template-fonts.doc.mjs +102 -0
  137. package/assets/docs/tree/template-grading-rubric.doc.mjs +452 -0
  138. package/assets/docs/tree/template-icons.doc.mjs +97 -0
  139. package/assets/docs/tree/template-images-media.doc.mjs +127 -0
  140. package/assets/docs/tree/template-styles.doc.mjs +93 -0
  141. package/assets/docs/tree/templates.doc.mjs +34 -0
  142. package/assets/docs/tree/test-in-an-app.doc.mjs +115 -0
  143. package/assets/docs/tree/test-template-in-app.doc.mjs +128 -0
  144. package/assets/docs/tree/themes.doc.mjs +39 -0
  145. package/assets/docs/tree/troubleshooting.doc.mjs +149 -0
  146. package/assets/docs/tree/upgrading.doc.mjs +103 -0
  147. package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +51 -0
  148. package/assets/docs/tree/verify-packed-template.doc.mjs +77 -0
  149. package/assets/docs/tree/versioning.doc.mjs +161 -0
  150. package/assets/docs/tree/write-good-templates.doc.mjs +64 -0
  151. package/assets/docs/tree/write-the-template-file.doc.mjs +154 -0
  152. package/assets/docs/typography.doc.mjs +24 -4
  153. package/assets/docs/working-with-ai.doc.mjs +30 -22
  154. package/authoring/config/config.doc.mjs +2 -2
  155. package/authoring/config/type.ts +2 -2
  156. package/authoring/doctypes/_schema.d.mts +3 -2
  157. package/authoring/doctypes/_schema.mjs +6 -0
  158. package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
  159. package/authoring/doctypes/base/type.ts +4 -2
  160. package/authoring/doctypes/command/command.doc.mjs +1 -1
  161. package/authoring/doctypes/command/type.ts +1 -1
  162. package/authoring/doctypes/component/component.doc.mjs +6 -0
  163. package/authoring/doctypes/component/type.ts +8 -0
  164. package/authoring/doctypes/reference/reference.doc.mjs +7 -0
  165. package/authoring/doctypes/reference/type.ts +5 -0
  166. package/authoring/doctypes/schema/schema.doc.mjs +2 -2
  167. package/authoring/doctypes/template/template.doc.mjs +1 -1
  168. package/authoring/doctypes/template/type.ts +2 -2
  169. package/authoring/integration/integration.doc.mjs +12 -10
  170. package/clients/cli/command-result-coverage.test.mjs +7 -7
  171. package/clients/cli/commands/component.doc.mjs +4 -3
  172. package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
  173. package/clients/cli/commands/docs.doc.mjs +1 -1
  174. package/clients/cli/commands/docs.mjs +60 -17
  175. package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -2
  176. package/clients/cli/commands/doctor-integration.test.mjs +53 -0
  177. package/clients/cli/commands/doctor.doc.mjs +3 -1
  178. package/clients/cli/commands/doctor.mjs +49 -5
  179. package/clients/cli/commands/gap-report.doc.mjs +10 -9
  180. package/clients/cli/commands/init.doc.mjs +9 -6
  181. package/clients/cli/commands/integration-add.doc.mjs +9 -9
  182. package/clients/cli/commands/integration-authoring.test.mjs +61 -10
  183. package/clients/cli/commands/integration-pack.doc.mjs +5 -9
  184. package/clients/cli/commands/integration-real-world.test.mjs +1 -1
  185. package/clients/cli/commands/integration-verify.doc.mjs +22 -0
  186. package/clients/cli/commands/integration.doc.mjs +4 -4
  187. package/clients/cli/commands/integration.mjs +74 -43
  188. package/clients/cli/commands/layout-check.doc.mjs +65 -0
  189. package/clients/cli/commands/layout-expand.doc.mjs +83 -0
  190. package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
  191. package/clients/cli/commands/layout.doc.mjs +34 -0
  192. package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
  193. package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
  194. package/clients/cli/commands/layout.mjs +275 -0
  195. package/clients/cli/commands/layout.path-help.test.mjs +33 -0
  196. package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
  197. package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
  198. package/clients/cli/commands/manifest.doc.mjs +1 -1
  199. package/clients/cli/commands/search.doc.mjs +10 -3
  200. package/clients/cli/commands/search.mjs +21 -2
  201. package/clients/cli/commands/search.test.mjs +21 -4
  202. package/clients/cli/commands/swizzle.doc.mjs +1 -1
  203. package/clients/cli/commands/template.doc.mjs +1 -1
  204. package/clients/cli/commands/text-json-parity.test.mjs +24 -1
  205. package/clients/cli/commands/theme-add.doc.mjs +1 -1
  206. package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
  207. package/clients/cli/commands/theme-palette.doc.mjs +1 -2
  208. package/clients/cli/commands/theme-targets.doc.mjs +2 -2
  209. package/clients/cli/commands/theme.doc.mjs +2 -1
  210. package/clients/cli/commands/upgrade.doc.mjs +62 -3
  211. package/clients/cli/index.mjs +32 -6
  212. package/clients/cli/lib/define-command.mjs +28 -4
  213. package/clients/cli/lib/define-command.test.mjs +54 -0
  214. package/clients/cli/lib/exit-codes.test.mjs +25 -2
  215. package/clients/cli/lib/json-shim.test.mjs +20 -6
  216. package/clients/cli/lib/manifest.mjs +23 -5
  217. package/foundation/agent-docs/agent-docs.mjs +1 -1
  218. package/foundation/discovery/authoring-self-docs.test.mjs +6 -2
  219. package/foundation/discovery/cli-self-docs.mjs +16 -2
  220. package/foundation/discovery/cli-self-docs.test.mjs +20 -0
  221. package/foundation/discovery/docs-discovery.mjs +5 -1
  222. package/foundation/discovery/docs-discovery.test.mjs +21 -0
  223. package/foundation/discovery/docs-section-key.d.mts +1 -1
  224. package/foundation/discovery/docs-section-key.mjs +1 -1
  225. package/foundation/discovery/template-adapter.mjs +1 -1
  226. package/foundation/doc-compiler/doc-loads.test.mjs +15 -2
  227. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  228. package/foundation/doc-compiler/tree.d.mts +4 -0
  229. package/foundation/doc-compiler/tree.mjs +6 -1
  230. package/foundation/integrations/cli-requirement.d.mts +26 -6
  231. package/foundation/integrations/cli-requirement.mjs +46 -11
  232. package/foundation/integrations/cli-requirement.test.mjs +7 -2
  233. package/foundation/integrations/contribution-inventory.mjs +1 -1
  234. package/foundation/response/error-codes.doc.mjs +6 -8
  235. package/foundation/response/error-codes.test.mjs +30 -5
  236. package/foundation/response/response-types.doc.d.mts +4 -3
  237. package/foundation/response/response-types.doc.mjs +42 -6
  238. package/foundation/response/response.doc.mjs +11 -10
  239. package/foundation/xle/browser.d.mts +3 -3
  240. package/foundation/xle/browser.mjs +3 -3
  241. package/foundation/xle/expand.mjs +2 -2
  242. package/foundation/xle/parse.mjs +1 -1
  243. package/foundation/xle/print.mjs +2 -2
  244. package/foundation/xle/splice.mjs +1 -1
  245. package/package.json +9 -9
  246. package/api/docs/docs.test.mjs +0 -245
  247. package/api/docs/integration-tree.test.mjs +0 -555
  248. package/api/docs/integrationDocs.test.mjs +0 -314
  249. package/api/search/search.test.mjs +0 -530
  250. package/assets/docs/tree/integrations.test.mjs +0 -62
  251. package/assets/docs/tree/writing-docs.doc.mjs +0 -286
  252. package/clients/cli/commands/docs.test.mjs +0 -323
  253. package/foundation/agent-docs/agent-docs.test.mjs +0 -1159
  254. package/foundation/doc-compiler/tree.test.mjs +0 -606
@@ -185,6 +185,7 @@ const styles = stylex.create({
185
185
  ],
186
186
  },
187
187
  {
188
+ id: 'semantic-token-systems',
188
189
  title: 'Panda, Chakra, and Other Semantic Token Systems',
189
190
  category: 'guide',
190
191
  content: [
@@ -246,7 +247,7 @@ tokens: {
246
247
  content: [
247
248
  {
248
249
  type: 'prose',
249
- text: 'MUI expects palette slots such as primary, background, text, and divider. Map those slots to system variables for ordinary component styling. Use raw values only when MUI or your code needs to parse colors for contrast, alpha, lighten, or darken calculations.',
250
+ text: '`MUI` expects palette slots such as primary, background, text, and divider. Map those slots to system variables for ordinary component styling. Use raw values only when MUI or your code needs to parse colors for contrast, alpha, lighten, or darken calculations.',
250
251
  },
251
252
  {
252
253
  type: 'code',
@@ -293,12 +294,13 @@ tokens: {
293
294
  ],
294
295
  },
295
296
  {
297
+ id: 'css-in-js',
296
298
  title: 'Emotion, styled-components, Theme UI, and Styled System',
297
299
  category: 'guide',
298
300
  content: [
299
301
  {
300
302
  type: 'prose',
301
- text: 'Runtime CSS-in-JS libraries usually accept arbitrary theme objects. Keep those objects semantic, but store system CSS variable references as the values. This keeps generated classes stable while the system updates values through the CSS cascade.',
303
+ text: 'Runtime CSS-in-JS libraries such as `Emotion` and `styled-components` usually accept arbitrary theme objects. Keep those objects semantic, but store system CSS variable references as the values. This keeps generated classes stable while the system updates values through the CSS cascade.',
302
304
  },
303
305
  {
304
306
  type: 'code',
@@ -327,6 +329,7 @@ tokens: {
327
329
  ],
328
330
  },
329
331
  {
332
+ id: 'unocss',
330
333
  title: 'UnoCSS and Custom Utility Systems',
331
334
  category: 'guide',
332
335
  content: [
@@ -422,6 +425,7 @@ function RevenueChart({data}: {data: Array<{x: string; y: number}>}) {
422
425
  ],
423
426
  },
424
427
  {
428
+ id: 'non-css-best-practices',
425
429
  title: 'Non-CSS Processing Best Practices',
426
430
  category: 'guide',
427
431
  content: [
@@ -8,6 +8,7 @@ export const docs = {
8
8
  category: 'guide',
9
9
  description:
10
10
  'How to customize component appearance: xstyle prop, Tailwind, StyleX, className, rest props, compound component patterns, theming hooks, and styling-library interop.',
11
+ keywords: ['override', 'customize', 'css'],
11
12
 
12
13
  sections: [
13
14
  {
@@ -16,7 +17,7 @@ export const docs = {
16
17
  content: [
17
18
  {
18
19
  type: 'prose',
19
- text: 'There are several ways to style things. Here is when to use each:',
20
+ text: 'Style components with `xstyle` (StyleX), `className` (Tailwind or your own CSS), or a styling library aliased to Astryx tokens. All of them resolve to the same tokens.',
20
21
  },
21
22
  {
22
23
  type: 'table',
@@ -30,7 +31,7 @@ export const docs = {
30
31
  },
31
32
  {
32
33
  type: 'prose',
33
- text: 'All approaches resolve to the same design tokens, so theming and dark mode work regardless of which you choose. For external styling libraries, run {@link generic:styling-libraries}; it covers Tailwind, StyleX, Panda, Chakra, MUI, CSS-in-JS, CSS Modules, Sass, and `useTheme()` for non-CSS processing.',
34
+ text: 'Theming and dark mode work whichever you choose. For external styling libraries, run {@link generic:styling-libraries}; it covers Tailwind, StyleX, Panda, Chakra, MUI, CSS-in-JS, CSS Modules, Sass, and `useTheme()` for non-CSS processing.',
34
35
  },
35
36
  ],
36
37
  },
@@ -40,7 +41,7 @@ export const docs = {
40
41
  content: [
41
42
  {
42
43
  type: 'prose',
43
- text: 'Every component accepts an xstyle prop for style customization. It accepts StyleX styles created via stylex.create(), not inline objects or class name strings. StyleX styles are compiled at build time for optimal deduplication and dead-code elimination.',
44
+ text: 'Every component accepts an `xstyle` prop for style customization. It accepts StyleX styles created via `stylex.create()`, not inline objects or class name strings. StyleX styles are compiled at build time for optimal deduplication and dead-code elimination.',
44
45
  },
45
46
  {
46
47
  type: 'code',
@@ -94,24 +95,14 @@ const overrides = stylex.create({
94
95
  text: 'The package ships a Tailwind v4 theme bridge that maps all design tokens to Tailwind utility classes. Import it once and use Tailwind classes backed by design tokens: colors, spacing, radius, shadows, and typography all resolve to the active theme.',
95
96
  },
96
97
  {
97
- type: 'code',
98
- lang: 'css',
99
- label: 'globals.css: import the bridge',
100
- code: `@layer reset, theme, base, astryx-base, astryx-theme, components, utilities;
101
-
102
- @import "tailwindcss/theme.css" layer(theme);
103
- @import "tailwindcss/preflight.css" layer(base);
104
- @import "@astryxdesign/core/reset.css";
105
- @import "@astryxdesign/core/astryx.css";
106
- @import "@astryxdesign/theme-neutral/theme.css";
107
- @import "@astryxdesign/core/tailwind-theme.css";
108
- @import "tailwindcss/utilities.css" layer(utilities);`,
98
+ type: 'prose',
99
+ text: 'For the imports and the cascade-layer order to put in your global CSS, see the Tailwind section of {@link generic:styling-libraries}.',
109
100
  },
110
101
  {
111
102
  type: 'code',
112
103
  lang: 'tsx',
113
104
  label: 'Tailwind utilities alongside components',
114
- code: `<div className="text-primary bg-surface rounded-container p-4 flex gap-3">
105
+ code: `<div className="text-primary bg-surface rounded-lg p-4 flex gap-3">
115
106
  <Button label="Save" variant="primary" />
116
107
  <Button label="Cancel" variant="secondary" />
117
108
  </div>`,
@@ -128,7 +119,7 @@ const overrides = stylex.create({
128
119
  content: [
129
120
  {
130
121
  type: 'prose',
131
- text: 'Every component also accepts standard className and style props. className is appended after the component\'s own classes. style is merged after StyleX inline styles, so consumer values win on conflict.',
122
+ text: 'Every component also accepts standard `className` and `style` props. `className` is appended after the component\'s own classes. `style` is merged after StyleX inline styles, so consumer values win on conflict.',
132
123
  },
133
124
  {
134
125
  type: 'code',
@@ -226,7 +217,10 @@ const overrides = stylex.create({
226
217
  ],
227
218
  },
228
219
  {
229
- title: 'Preferred Selector Surface: Data Attributes',
220
+ // The key it had in 0.6, so `astryx docs styling
221
+ // preferred-selector-surface-data-attributes` keeps working.
222
+ id: 'preferred-selector-surface-data-attributes',
223
+ title: 'Data attribute selectors',
230
224
  category: 'guide',
231
225
  content: [
232
226
  {
@@ -268,12 +262,13 @@ const overrides = stylex.create({
268
262
  ],
269
263
  },
270
264
  {
265
+ id: 'deprecated-classes',
271
266
  title: 'Deprecated: Bare Prop and State Classes',
272
267
  category: 'guide',
273
268
  content: [
274
269
  {
275
270
  type: 'prose',
276
- text: 'Astryx continues to emit deprecated bare prop/state classes such as `.primary`, `.sm`, `.level-2`, and `.checked` through the 0.7.0 removal window. Prefer the explicit reflected data attributes for new CSS, and run `astryx upgrade --apply` before 0.7.0 to parse `.css` files and rewrite selectors qualified by a known Astryx target when the 0.5.4 target/value pair has one or more known meanings. Declarations, comments, JavaScript/TypeScript strings, and unqualified classes are never rewritten. Stable base target classes (`.astryx-button`, `.astryx-card`, etc.) remain unchanged.',
271
+ text: 'Astryx still emits the deprecated bare classes (`.primary`, `.sm`, `.level-2`, `.checked`) and will remove them in a later release. Use data attributes for new CSS; `astryx upgrade --from <old version> --apply` rewrites qualified selectors in `.css` files.',
277
272
  },
278
273
  {
279
274
  type: 'code',
@@ -290,7 +285,7 @@ const overrides = stylex.create({
290
285
  },
291
286
  {
292
287
  type: 'prose',
293
- text: 'Each known old value becomes a specificity-preserving `:is(...)` union containing the original class arm plus every v0.5.4 data-attribute arm. Both arms match Astryx output during the deprecation window; the data-attribute arm continues matching after the bare compatibility classes are eligible for removal in 0.7.0. The class arm also preserves consumer-supplied `className` matches. Narrow the union later only when class provenance or prop-axis intent is known. Custom/unknown qualified classes and unqualified classes stay unchanged. Search for unqualified old values such as `.primary` or `.sm` and migrate only confirmed Astryx uses manually. Migrate selectors embedded in JavaScript or TypeScript manually with the same rules.',
288
+ text: 'The upgrade rewrites a selector only when an `.astryx-*` component class qualifies it, turning the old class into an `:is(...)` union of that class and the data attributes it stood for. The union keeps the selector\'s specificity and your own `className` matches, and keeps matching once the bare classes are gone; the `.astryx-*` classes themselves stay. It leaves unqualified classes (a bare `.primary`), unknown classes, and selectors in JavaScript or TypeScript alone: migrate those by hand, and only where they target Astryx.',
294
289
  },
295
290
  ],
296
291
  },
@@ -343,6 +338,7 @@ const styles = stylex.create({
343
338
  ],
344
339
  },
345
340
  {
341
+ id: 'stylex-setup',
346
342
  title: 'StyleX Build Setup (required for swizzled components)',
347
343
  category: 'guide',
348
344
  content: [
@@ -362,11 +358,11 @@ const styles = stylex.create({
362
358
  },
363
359
  {
364
360
  type: 'prose',
365
- text: 'Next.js (App Router) is the sharp edge. StyleX\'s canonical compiler is a Babel plugin, but introducing a Babel config in Next.js disables the SWC compiler, which in turn breaks SWC-dependent features like `next/font`. So the "obvious" Babel setup is actively incompatible with a standard Next 15 App Router app.',
361
+ text: 'Next.js (App Router) is the sharp edge. StyleX\'s canonical compiler is a Babel plugin, but introducing a Babel config in Next.js disables the SWC compiler, and with it SWC-dependent features like `next/font`.',
366
362
  },
367
363
  {
368
364
  type: 'prose',
369
- text: 'The working path on Next.js is an SWC-based StyleX transform (e.g. the community `@stylexswc/nextjs-plugin`) wired into `next.config`, which keeps SWC and `next/font` intact. See the example app `apps/example-nextjs-stylex` in the repo for a complete, working Next.js + StyleX + SWC configuration.',
365
+ text: 'The repo\'s `apps/example-nextjs-stylex` takes the Babel path (`next/babel`, `@stylexjs/babel-plugin`, `@stylexjs/postcss-plugin`). Babel turns off SWC, so that app does not use `next/font`. To keep `next/font`, use an SWC transform such as `@stylexswc/nextjs-plugin`.',
370
366
  },
371
367
  {
372
368
  type: 'code',
@@ -389,7 +385,7 @@ export default stylexPlugin({
389
385
  style: 'unordered',
390
386
  items: [
391
387
  'Symptom of a missing compiler: swizzled component renders with no styles, but no build or runtime error.',
392
- 'Do NOT add @stylexjs/babel-plugin to a Next.js App Router app; it disables SWC and breaks next/font.',
388
+ 'A Babel config turns off SWC in Next.js; skip it if you need `next/font`.',
393
389
  'Pure theming (defineTheme + astryx theme build) needs NO StyleX compiler; only swizzled/authored StyleX source does.',
394
390
  ],
395
391
  },
@@ -3,11 +3,12 @@
3
3
  /** @type {import('@astryxdesign/cli/authoring').ReferenceTranslationDoc} */
4
4
 
5
5
  export const docsDense = {
6
- description: 'Theme provider, custom themes, light/dark, component overrides',
6
+ description:
7
+ 'Theme provider, custom themes, theme build (prod/SSR), light/dark, component overrides',
7
8
  sections: [
8
9
  {
9
- section: 'Quick Start',
10
- title: 'Quick Start',
10
+ section: 'Wrap your app in a theme',
11
+ title: 'Wrap your app',
11
12
  content: [
12
13
  null,
13
14
  null,
@@ -31,9 +32,18 @@ export const docsDense = {
31
32
  },
32
33
  ],
33
34
  },
34
- {section: 'Theme Props', title: 'Props', content: [null]},
35
35
  {
36
- section: 'Creating a Custom Theme',
36
+ section: 'Theme Props',
37
+ title: 'Props',
38
+ content: [
39
+ {
40
+ type: 'prose',
41
+ text: "<Theme> props: theme (required), mode ('system' default, or 'light'/'dark'), children. every prop: astryx component Theme.",
42
+ },
43
+ ],
44
+ },
45
+ {
46
+ section: 'Custom themes',
37
47
  title: 'Custom Theme',
38
48
  content: [
39
49
  {
@@ -65,10 +75,36 @@ export const docsDense = {
65
75
  content: [
66
76
  {
67
77
  type: 'prose',
68
- text: 'adaptations = ordered {when,value} rules over width/pointer/contrast/motion. widthBreakpoints fixed sm|md|lg|xl|2xl defaults 640|768|1024|1280|1536; map alone emits no CSS. width.from inclusive, width.below exclusive; condition fields AND. root first, then matching rules in authored order (later writes win), then onDark/onLight. rules can write typography/color/radius/motion/tokens/localTokens/components; local names belong on root. Component writes validate exactly like root components (same targets/axes/domains); only difference: a rule cannot be the sole enroller of a custom value (type augmentation is unconditional) — declare it on root, then restyle. Built-ins need no root declaration. Co-matching token/localToken writes are validated together; any reachable var() cycle fails. extends inherits breakpoints + ordered rules, appends child rules, re-resolves against child axes. CSS-only; use built themes for SSR first paint.',
78
+ text: 'adaptations = ordered {when,value} rules over width/pointer/contrast/motion. condition fields AND. rules can write typography/color/radius/motion/tokens/localTokens/components.',
69
79
  },
70
80
  null,
71
81
  null,
82
+ {
83
+ type: 'prose',
84
+ text: 'widthBreakpoints fixed sm|md|lg|xl|2xl defaults 640|768|1024|1280|1536; map alone emits no CSS. width.from inclusive, width.below exclusive. order + validation: see Adaptation Rules.',
85
+ },
86
+ ],
87
+ },
88
+ {
89
+ section: 'Adaptation order and validation',
90
+ title: 'Adaptation Rules',
91
+ content: [
92
+ {
93
+ type: 'prose',
94
+ text: 'root first, then matching rules in authored order (later writes win), then onDark/onLight on the same leaf.',
95
+ },
96
+ {
97
+ type: 'prose',
98
+ text: 'extends inherits breakpoints + ordered rules, appends child rules, re-resolves against child axes. an empty child rule is a no-op, not a removal.',
99
+ },
100
+ {
101
+ type: 'prose',
102
+ text: 'local names belong on root. Component writes validate exactly like root components (same targets/axes/domains); only difference: a rule cannot be the sole enroller of a custom value (type augmentation is unconditional) — declare it on root, then restyle. Built-ins need no root declaration. Co-matching token/localToken writes are validated together; any reachable var() cycle fails.',
103
+ },
104
+ {
105
+ type: 'prose',
106
+ text: 'CSS-only (media queries, no resize listener); use built themes for SSR first paint.',
107
+ },
72
108
  ],
73
109
  },
74
110
  {
@@ -77,7 +113,7 @@ export const docsDense = {
77
113
  content: [
78
114
  {
79
115
  type: 'prose',
80
- text: 'components field uses semantic component keys + style keys (base, variant:value, stateName), not raw selectors. for external CSS, prefer data-* selectors from `astryx docs styling`. write standard CSS (borderRadius, padding) — pipeline expands to internal vars. public vars (--button-focus-offset etc) set directly. private vars (--_*) cannot be set — use CSS properties. run `astryx theme targets [Name]` to enumerate every themeable key (--json for lint), `astryx component <Name>` for one component.',
116
+ text: 'components field uses semantic component keys + style keys (base, variant:value, stateName), not raw selectors. for external CSS, prefer data-* selectors ({@link generic:styling}). write standard CSS (borderRadius, padding) — pipeline expands to internal vars. public vars (--button-focus-offset etc) set directly. private vars (--_*) cannot be set — use CSS properties. run `astryx theme targets [Name]` to enumerate every themeable key (--json for lint), `astryx component <Name>` for one component.',
81
117
  },
82
118
  null,
83
119
  null,
@@ -100,16 +136,19 @@ export const docsDense = {
100
136
  ],
101
137
  },
102
138
  {
103
- section: 'Building Themes for Production',
139
+ section: 'Build a theme',
104
140
  title: 'Build for Production',
105
141
  content: [
106
142
  {
107
143
  type: 'prose',
108
144
  text: 'astryx theme build compiles defineTheme to static CSS. outputs .css + .js (__built:true) + .d.ts.',
109
145
  },
110
- null,
111
- null,
112
- null,
146
+ ],
147
+ },
148
+ {
149
+ section: 'Built themes with an icon registry',
150
+ title: 'Icon Registry',
151
+ content: [
113
152
  {
114
153
  type: 'prose',
115
154
  text: 'current build detects named imports used by icons:. registry module is not compiled. inline/local registries accepted by defineTheme are omitted from built output; move them to a separate module and import by name.',
@@ -123,9 +162,6 @@ export const docsDense = {
123
162
  type: 'prose',
124
163
  text: 'without --icons-specifier, source import is copied unchanged. default flow without --out: bundlers can resolve ./icons to neighboring icons.tsx; Node ESM fails with ERR_MODULE_NOT_FOUND. moving output changes relative import resolution.',
125
164
  },
126
- null,
127
- null,
128
- null,
129
165
  ],
130
166
  },
131
167
  {
@@ -154,8 +190,8 @@ export const docsDense = {
154
190
  ],
155
191
  },
156
192
  {
157
- section: 'Light/Dark Mode',
158
- title: 'Light/Dark',
193
+ section: 'Dark mode',
194
+ title: 'Dark mode',
159
195
  content: [
160
196
  {
161
197
  type: 'prose',
@@ -166,7 +202,7 @@ export const docsDense = {
166
202
  ],
167
203
  },
168
204
  {
169
- section: 'Nesting Themes',
205
+ section: 'Nested themes',
170
206
  title: 'Nesting',
171
207
  content: [
172
208
  {type: 'prose', text: 'wrap sections in separate <Theme> providers'},
@@ -178,7 +214,11 @@ export const docsDense = {
178
214
  title: 'useTheme',
179
215
  content: [
180
216
  null,
181
- {type: 'prose', text: 'read-only. manage state at app level.'},
217
+ null,
218
+ {
219
+ type: 'prose',
220
+ text: 'read-only. ordinary styling: CSS vars, StyleX tokens, xstyle, className. to change theme/mode, manage state at app level and pass it to <Theme>.',
221
+ },
182
222
  ],
183
223
  },
184
224
  ],
@@ -11,7 +11,8 @@ export const docs = {
11
11
 
12
12
  sections: [
13
13
  {
14
- title: 'Quick Start',
14
+ id: 'quick-start',
15
+ title: 'Wrap your app in a theme',
15
16
  category: 'guide',
16
17
  content: [
17
18
  {
@@ -96,7 +97,7 @@ function App() {
96
97
  [
97
98
  'Matcha',
98
99
  "import {matchaTheme} from '@astryxdesign/theme-matcha'",
99
- 'Earthy green theme with Figtree typography.',
100
+ 'Earthy greens; DM Sans + Playwrite US Trad type.',
100
101
  ],
101
102
  [
102
103
  'Stone',
@@ -121,22 +122,13 @@ function App() {
121
122
  category: 'guide',
122
123
  content: [
123
124
  {
124
- type: 'table',
125
- headers: ['Prop', 'Type', 'Default', 'Description'],
126
- rows: [
127
- ['theme', 'DefinedTheme', '-', 'Theme object (required)'],
128
- [
129
- 'mode',
130
- "'system' | 'light' | 'dark'",
131
- "'system'",
132
- 'Color mode. system follows OS preference.',
133
- ],
134
- ['children', 'ReactNode', '-', 'App content'],
135
- ],
125
+ type: 'prose',
126
+ text: "`<Theme>` takes `theme` (required), `mode` (`'system'` by default, or `'light'`/`'dark'`), and `children`. For every prop, run `astryx component Theme`.",
136
127
  },
137
128
  ],
138
129
  },
139
130
  {
131
+ id: 'integration-themes',
140
132
  title: 'Using a Theme from an Integration',
141
133
  category: 'guide',
142
134
  content: [
@@ -157,7 +149,8 @@ function App() {
157
149
  ],
158
150
  },
159
151
  {
160
- title: 'Creating a Custom Theme',
152
+ id: 'creating-a-custom-theme',
153
+ title: 'Custom themes',
161
154
  category: 'guide',
162
155
  content: [
163
156
  {
@@ -365,11 +358,18 @@ const brandTheme = defineTheme({
365
358
  },
366
359
  {
367
360
  type: 'prose',
368
- text: '`widthBreakpoints` are fixed named start points. Defaults are 640 / 768 / 1024 / 1280 / 1536 CSS pixels. `from` includes its point; `below` excludes it. Breakpoint configuration alone emits no CSS.',
361
+ text: '`widthBreakpoints` are fixed named start points. Defaults are 640 / 768 / 1024 / 1280 / 1536 CSS pixels. `from` includes its point; `below` excludes it. Breakpoint configuration alone emits no CSS. For how matching rules combine and what a rule may write, see Adaptation order and validation.',
369
362
  },
363
+ ],
364
+ },
365
+ {
366
+ id: 'adaptation-rules',
367
+ title: 'Adaptation order and validation',
368
+ category: 'guide',
369
+ content: [
370
370
  {
371
371
  type: 'prose',
372
- text: '**Precedence follows rule order.** Root theme values apply first, then every matching rule in declaration order. A later rule may deliberately restore a root value. `onDark` and `onLight` media-surface overrides apply after adaptations and win on the same leaf.',
372
+ text: 'Precedence follows rule order. Root theme values apply first, then every matching rule in declaration order. A later rule may deliberately restore a root value. `onDark` and `onLight` media-surface overrides apply after adaptations and win on the same leaf.',
373
373
  },
374
374
  {
375
375
  type: 'prose',
@@ -464,7 +464,7 @@ const brandTheme = defineTheme({
464
464
  banner: {
465
465
  // Any extensible prop axis works — not just variant
466
466
  'status:neutral': {
467
- backgroundColor: 'var(--color-muted)',
467
+ backgroundColor: 'var(--color-background-muted)',
468
468
  color: 'var(--color-text-secondary)',
469
469
  },
470
470
  },
@@ -489,7 +489,8 @@ const brandTheme = defineTheme({
489
489
  ],
490
490
  },
491
491
  {
492
- title: 'Building Themes for Production',
492
+ id: 'building-themes-for-production',
493
+ title: 'Build a theme',
493
494
  category: 'guide',
494
495
  content: [
495
496
  {
@@ -516,7 +517,7 @@ const brandTheme = defineTheme({
516
517
  ],
517
518
  [
518
519
  'ocean.js',
519
- 'ES module exporting the theme object with `__built: true` and pre-resolved token values. Also imports and re-exports an icon registry when the build detects its named import in the source theme (see the limitations below).',
520
+ 'ES module exporting the theme object with `__built: true` and pre-resolved token values. Also imports and re-exports an icon registry when the build detects its named import in the source theme (see Built themes with an icon registry).',
520
521
  ],
521
522
  [
522
523
  'ocean.d.ts',
@@ -528,29 +529,6 @@ const brandTheme = defineTheme({
528
529
  ],
529
530
  ],
530
531
  },
531
- {
532
- type: 'prose',
533
- text: "The current `theme build` implementation emits an icon import when it detects a named import used by the theme’s `icons:` field, such as `import {oceanIcons} from './icons'` with `icons: oceanIcons`. It does not compile that registry module. Inline registries, including local constants, are currently omitted from the generated theme even though `defineTheme` accepts them at runtime. Move the registry to a separate module and use a named import for this build flow. For a registry that uses React and lucide-react, the following example compiles it alongside the generated theme:",
534
- },
535
- {
536
- type: 'code',
537
- lang: 'bash',
538
- label: 'Compiling the icon registry sidecar',
539
- code: `# Emit the built theme; point its icon import at the file the next step produces
540
- astryx theme build ./src/themes/ocean.ts -o dist/theme.css --icons-specifier ./icons.mjs
541
-
542
- # Compile the icon registry to a real ES module next to the generated JS
543
- esbuild src/themes/icons.tsx --bundle --format=esm --outfile=dist/icons.mjs \\
544
- --external:react --external:lucide-react --jsx=automatic`,
545
- },
546
- {
547
- type: 'prose',
548
- text: 'In the example above, the generated theme imports `./icons.mjs` from `dist`. If the second command is skipped, `theme build` can still succeed, but loading or bundling the generated module fails because `dist/icons.mjs` is missing. `--icons-specifier` changes the emitted import; it does not create or verify the target file. Match the specifier to a module that resolves from the generated JS file. Keep `react` and the icon library external so the registry does not bundle its own copies of those dependencies.',
549
- },
550
- {
551
- type: 'prose',
552
- text: 'Without `--icons-specifier`, the detected source import specifier is emitted unchanged. In the default no-`--out` flow, a bundler can resolve an extensionless `./icons` to the neighboring `icons.tsx` source. Node ESM does not perform that lookup and reports `ERR_MODULE_NOT_FOUND`. Moving the output with `--out` also changes where relative imports resolve; the generated module cannot find the original source merely because a bundler is used.',
553
- },
554
532
  {
555
533
  type: 'prose',
556
534
  text: 'The `__built: true` flag tells Theme to skip runtime `<style>` injection; the CSS file handles it.',
@@ -576,6 +554,36 @@ import './themes/ocean.css';
576
554
  },
577
555
  ],
578
556
  },
557
+ {
558
+ id: 'icon-registry',
559
+ title: 'Built themes with an icon registry',
560
+ category: 'guide',
561
+ content: [
562
+ {
563
+ type: 'prose',
564
+ text: "The current `theme build` implementation emits an icon import when it detects a named import used by the theme’s `icons:` field, such as `import {oceanIcons} from './icons'` with `icons: oceanIcons`. It does not compile that registry module. Inline registries, including local constants, are currently omitted from the generated theme even though `defineTheme` accepts them at runtime. Move the registry to a separate module and use a named import for this build flow. For a registry that uses React and lucide-react, the following example compiles it alongside the generated theme:",
565
+ },
566
+ {
567
+ type: 'code',
568
+ lang: 'bash',
569
+ label: 'Compiling the icon registry sidecar',
570
+ code: `# Emit the built theme; point its icon import at the file the next step produces
571
+ astryx theme build ./src/themes/ocean.ts -o dist/theme.css --icons-specifier ./icons.mjs
572
+
573
+ # Compile the icon registry to a real ES module next to the generated JS
574
+ esbuild src/themes/icons.tsx --bundle --format=esm --outfile=dist/icons.mjs \\
575
+ --external:react --external:lucide-react --jsx=automatic`,
576
+ },
577
+ {
578
+ type: 'prose',
579
+ text: 'In the example above, the generated theme imports `./icons.mjs` from `dist`. If the second command is skipped, `theme build` can still succeed, but loading or bundling the generated module fails because `dist/icons.mjs` is missing. `--icons-specifier` changes the emitted import; it does not create or verify the target file. Match the specifier to a module that resolves from the generated JS file. Keep `react` and the icon library external so the registry does not bundle its own copies of those dependencies.',
580
+ },
581
+ {
582
+ type: 'prose',
583
+ text: 'Without `--icons-specifier`, the detected source import specifier is emitted unchanged. In the default no-`--out` flow, a bundler can resolve an extensionless `./icons` to the neighboring `icons.tsx` source. Node ESM does not perform that lookup and reports `ERR_MODULE_NOT_FOUND`. Moving the output with `--out` also changes where relative imports resolve; the generated module cannot find the original source merely because a bundler is used.',
584
+ },
585
+ ],
586
+ },
579
587
  {
580
588
  title: 'Building a Theme Family',
581
589
  category: 'guide',
@@ -677,7 +685,8 @@ import './themes/ocean.css';
677
685
  ],
678
686
  },
679
687
  {
680
- title: 'Light/Dark Mode',
688
+ id: 'light-dark-mode',
689
+ title: 'Dark mode',
681
690
  category: 'guide',
682
691
  content: [
683
692
  {
@@ -706,12 +715,13 @@ import './themes/ocean.css';
706
715
  ],
707
716
  },
708
717
  {
709
- title: 'Nesting Themes',
718
+ id: 'nesting-themes',
719
+ title: 'Nested themes',
710
720
  category: 'guide',
711
721
  content: [
712
722
  {
713
723
  type: 'prose',
714
- text: 'Wrap different sections in separate [`<Theme>`](/components/Theme) providers.',
724
+ text: 'Wrap different sections in separate `<Theme>` providers.',
715
725
  },
716
726
  {
717
727
  type: 'code',
@@ -3,17 +3,18 @@
3
3
  /** @type {import('@astryxdesign/cli/authoring').ReferenceTranslationDoc} */
4
4
 
5
5
  export const docsZh = {
6
- description: 'Theme 提供者、自定义主题、亮/暗模式和组件样式覆盖。',
6
+ description: 'Theme 提供者、自定义主题、生产/SSR 主题构建、亮/暗模式和组件样式覆盖。',
7
7
  sections: [
8
- { section: 'Quick Start', title: '快速开始', content: [null, null, null, null, { type: 'prose', text: '默认导入使用运行时样式注入。/built 导入使用预编译 CSS(需配合 theme.css)。' }] },
8
+ { section: 'Wrap your app in a theme', title: '用主题包裹应用', content: [null, null, null, null, { type: 'prose', text: '默认导入使用运行时样式注入。/built 导入使用预编译 CSS(需配合 theme.css)。' }] },
9
9
  { section: 'Available Themes', title: '可用主题', content: [null, null, { type: 'prose', text: '已发布主题:neutral(推荐起点)、butter、chocolate、gothic(仅暗色)、matcha、stone、y2k。@astryxdesign/theme-{name} = 源码版(运行时注入)。@astryxdesign/theme-{name}/built = 优化版(配合 theme.css)。' }] },
10
- { section: 'Theme Props', title: 'Theme 属性', content: [null] },
11
- { section: 'Creating a Custom Theme', title: '创建自定义主题', content: [{ type: 'prose', text: '用 `theme list` + `theme add <slug>` 从内置主题或已安装集成提供的主题开始;重名时传 `--package`。也可以用 defineTheme 从零编写。只覆盖与默认值不同的令牌。' }, null, { type: 'prose', text: '`astryx theme template` 会写入 theme.template.ts:带注释的完整参考,涵盖每个 defineTheme 字段、令牌族和覆盖语法,并标明打印各自参考的 CLI 命令。' }] },
10
+ { section: 'Theme Props', title: 'Theme 属性', content: [{ type: 'prose', text: "`<Theme>` 接受 `theme`(必填)、`mode`(默认 `'system'`,也可以是 `'light'` 或 `'dark'`)和 `children`。运行 `astryx component Theme` 查看全部属性。" }] },
11
+ { section: 'Custom themes', title: '自定义主题', content: [{ type: 'prose', text: '用 `theme list` + `theme add <slug>` 从内置主题或已安装集成提供的主题开始;重名时传 `--package`。也可以用 defineTheme 从零编写。只覆盖与默认值不同的令牌。' }, null, { type: 'prose', text: '`astryx theme template` 会写入 theme.template.ts:带注释的完整参考,涵盖每个 defineTheme 字段、令牌族和覆盖语法,并标明打印各自参考的 CLI 命令。' }] },
12
12
  { section: 'defineTheme', title: 'defineTheme', content: [{ type: 'prose', text: '支持比例配置(color、typography、radius、motion)+ 显式令牌覆盖 + 组件覆盖。color 通过 HCT 从 accent 派生完整调色板;accent 接受单个十六进制值或 [light, dark] 元组(每个模式使用各自的种子色)。tokens 覆盖按令牌逐个生效;--color-on-accent 始终由 color.accent 计算得出,因此优先使用元组 accent 而不是覆盖 --color-accent。' }, null, null] },
13
- { section: 'Building Themes for Production', title: '生产构建', content: [{ type: 'prose', text: 'astryx theme build 将 defineTheme 编译为静态 CSS。输出 .css + .js(__built:true)+ .d.ts。' }, null, null, null, { type: 'prose', text: '当前 theme build 仅在检测到 icons: 字段使用的具名导入时,才在生成的模块中导入图标注册表;它不会编译注册表模块。defineTheme 在运行时接受的内联注册表(包括本地常量)目前会在构建产物中被省略。使用此构建流程时,请把注册表移到独立模块并使用具名导入。以下示例适用于使用 React 和 lucide-react 的注册表。' }, null, { type: 'prose', text: '上例中生成的主题从 dist 导入 ./icons.mjs。如果跳过第二条命令,theme build 仍可能成功,但加载或打包生成的模块都会因缺少 dist/icons.mjs 而失败。--icons-specifier 只更改生成的导入,不会创建或验证目标文件。路径应相对于生成的 JS 文件可解析。将 react 和图标库标记为 external,避免在注册表中重复打包这些依赖。' }, { type: 'prose', text: '不传 --icons-specifier 时,会原样保留检测到的源码导入路径。默认不传 --out 时,打包器可以把无扩展名的 ./icons 解析为旁边的 icons.tsx;Node ESM 不执行这种查找,会报 ERR_MODULE_NOT_FOUND。用 --out 移动输出位置也会改变相对导入的解析位置;使用打包器并不意味着它能自动找到原来的源码。' }, null, null, null] },
13
+ { section: 'Build a theme', title: '构建主题', content: [{ type: 'prose', text: 'astryx theme build 将 defineTheme 编译为静态 CSS。输出 .css + .js(__built:true)+ .d.ts。' }] },
14
+ { section: 'Built themes with an icon registry', title: '带图标注册表的构建主题', content: [{ type: 'prose', text: '当前 theme build 仅在检测到 icons: 字段使用的具名导入时,才在生成的模块中导入图标注册表;它不会编译注册表模块。defineTheme 在运行时接受的内联注册表(包括本地常量)目前会在构建产物中被省略。使用此构建流程时,请把注册表移到独立模块并使用具名导入。以下示例适用于使用 React 和 lucide-react 的注册表。' }, null, { type: 'prose', text: '上例中生成的主题从 dist 导入 ./icons.mjs。如果跳过第二条命令,theme build 仍可能成功,但加载或打包生成的模块都会因缺少 dist/icons.mjs 而失败。--icons-specifier 只更改生成的导入,不会创建或验证目标文件。路径应相对于生成的 JS 文件可解析。将 react 和图标库标记为 external,避免在注册表中重复打包这些依赖。' }, { type: 'prose', text: '不传 --icons-specifier 时,会原样保留检测到的源码导入路径。默认不传 --out 时,打包器可以把无扩展名的 ./icons 解析为旁边的 icons.tsx;Node ESM 不执行这种查找,会报 ERR_MODULE_NOT_FOUND。用 --out 移动输出位置也会改变相对导入的解析位置;使用打包器并不意味着它能自动找到原来的源码。' }] },
14
15
  { section: 'Runtime vs Built Themes', title: '运行时 vs 构建', content: [{ type: 'prose', text: '运行时:useInsertionEffect 在客户端注入样式。构建:静态 CSS 在首次渲染时就存在。SSR 应用请使用 /built + theme.css。' }, null, null, null] },
15
- { section: 'Light/Dark Mode', title: '亮/暗模式', content: [{ type: 'prose', text: "令牌值使用 [light, dark] 元组实现自动模式切换。Theme 上 mode='system'(默认)跟随系统偏好。" }, null, null] },
16
- { section: 'Nesting Themes', title: '嵌套主题', content: [{ type: 'prose', text: '将不同部分包裹在独立的 <Theme> 提供者中。' }, null] },
17
- { section: 'useTheme Hook', title: 'useTheme 钩子', content: [null, { type: 'prose', text: '这是只读的。要更改主题/模式,在应用层管理状态并传递给 <Theme>。' }] },
16
+ { section: 'Dark mode', title: '亮/暗模式', content: [{ type: 'prose', text: "令牌值使用 [light, dark] 元组实现自动模式切换。Theme 上 mode='system'(默认)跟随系统偏好。" }, null, null] },
17
+ { section: 'Nested themes', title: '嵌套主题', content: [{ type: 'prose', text: '将不同部分包裹在独立的 <Theme> 提供者中。' }, null] },
18
+ { section: 'useTheme Hook', title: 'useTheme 钩子', content: [null, null, { type: 'prose', text: '普通样式优先使用 CSS 变量、StyleX 令牌导入、xstyle 或 className。useTheme() 是只读的:要更改主题或模式,在应用层管理状态并传递给 <Theme>。' }] },
18
19
  ],
19
20
  };
@@ -3,10 +3,10 @@
3
3
  /** @type {import('@astryxdesign/cli/authoring').ReferenceTranslationDoc} */
4
4
 
5
5
  export const docsDense = {
6
- description: 'spacing/color/radius/type/shadow token ref',
6
+ description: 'color/data-viz/syntax/spacing/size/radius/shadow/motion/type token ref',
7
7
  sections: [
8
8
  { section: 'Color Tokens', title: 'Color', content: [{ type: 'prose', text: 'semantic colors, support light-dark() auto switching.' }, null, null, null] },
9
- { section: 'Spacing Tokens', title: 'Spacing', content: [{ type: 'prose', text: 'defined in tokens.stylex.ts. gap props use space0-space12.' }, null] },
9
+ { section: 'Spacing Tokens', title: 'Spacing', content: [{ type: 'prose', text: 'padding/gap/margin scale. gap props take steps 0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10.' }, null] },
10
10
  { section: 'Size Tokens', title: 'Size', content: [{ type: 'prose', text: 'control heights for buttons/inputs/selectors.' }, null] },
11
11
  { section: 'Radius Tokens', title: 'Radius', content: [null] },
12
12
  { section: 'Shadow Tokens', title: 'Elevation', content: [null] },