@astryxdesign/cli 0.6.0 → 0.6.1

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 (219) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/README.md +76 -67
  3. package/api/build/build.test.mjs +37 -0
  4. package/api/build/build.type.mjs +1 -1
  5. package/api/build/kit/kit.mjs +31 -1
  6. package/api/component/_adapter.mjs +14 -28
  7. package/api/component/integration-import-agreement.test.mjs +318 -0
  8. package/api/doctor/doctor.d.mts +32 -3
  9. package/api/doctor/doctor.doc.mjs +2 -1
  10. package/api/doctor/doctor.mjs +97 -4
  11. package/api/doctor/doctor.test.mjs +90 -1
  12. package/api/gap-report/gap-report-worker.d.mts +4 -0
  13. package/api/gap-report/gap-report-worker.mjs +73 -0
  14. package/api/gap-report/gap-report.d.mts +81 -0
  15. package/api/gap-report/gap-report.doc.d.mts +9 -0
  16. package/api/gap-report/gap-report.doc.mjs +127 -0
  17. package/api/gap-report/gap-report.mjs +707 -0
  18. package/api/gap-report/gap-report.test.mjs +1210 -0
  19. package/api/gap-report/gap-report.type.d.mts +88 -0
  20. package/api/gap-report/gap-report.type.mjs +69 -0
  21. package/api/index.d.mts +8 -1
  22. package/api/index.mjs +24 -1
  23. package/api/integration/add-contribution.d.mts +44 -0
  24. package/api/integration/add-contribution.mjs +1160 -0
  25. package/api/integration/add-contribution.test.mjs +733 -0
  26. package/api/integration/add-helpers.d.mts +80 -0
  27. package/api/integration/add-helpers.mjs +333 -0
  28. package/api/integration/add-helpers.test.mjs +161 -0
  29. package/api/integration/add-theme.d.mts +10 -0
  30. package/api/integration/add-theme.mjs +332 -0
  31. package/api/integration/add-theme.test.mjs +194 -0
  32. package/api/integration/integration-authoring.type.d.mts +55 -0
  33. package/api/integration/integration-authoring.type.mjs +76 -0
  34. package/api/integration/integration-block-exports.test.mjs +4 -0
  35. package/api/integration/integrationAdd.doc.d.mts +5 -0
  36. package/api/integration/integrationAdd.doc.mjs +100 -0
  37. package/api/integration/integrationAddAgentDoc.doc.d.mts +5 -0
  38. package/api/integration/integrationAddAgentDoc.doc.mjs +49 -0
  39. package/api/integration/integrationAddCodemod.doc.d.mts +5 -0
  40. package/api/integration/integrationAddCodemod.doc.mjs +55 -0
  41. package/api/integration/integrationAddComponent.doc.d.mts +5 -0
  42. package/api/integration/integrationAddComponent.doc.mjs +49 -0
  43. package/api/integration/integrationAddDoc.doc.d.mts +5 -0
  44. package/api/integration/integrationAddDoc.doc.mjs +59 -0
  45. package/api/integration/integrationAddTemplate.doc.d.mts +5 -0
  46. package/api/integration/integrationAddTemplate.doc.mjs +55 -0
  47. package/api/integration/integrationAddTheme.doc.d.mts +5 -0
  48. package/api/integration/integrationAddTheme.doc.mjs +85 -0
  49. package/api/integration/integrationPackCheck.doc.d.mts +5 -0
  50. package/api/integration/integrationPackCheck.doc.mjs +35 -0
  51. package/api/integration/pack-check.d.mts +27 -0
  52. package/api/integration/pack-check.mjs +795 -0
  53. package/api/integration/pack-check.test.mjs +569 -0
  54. package/api/integration/pack-check.type.d.mts +45 -0
  55. package/api/integration/pack-check.type.mjs +56 -0
  56. package/api/integration/public-api.test.mjs +21 -0
  57. package/api/integration/validate-integration.mjs +221 -11
  58. package/api/integration/validate-integration.test.mjs +189 -5
  59. package/api/integration/validateIntegration.doc.mjs +2 -2
  60. package/api/json/index.ts +1 -0
  61. package/api/search/search.mjs +19 -1
  62. package/api/theme/_adapter.d.mts +26 -28
  63. package/api/theme/_adapter.mjs +101 -38
  64. package/api/theme/add/add.d.mts +2 -1
  65. package/api/theme/add/add.mjs +56 -20
  66. package/api/theme/add/add.test.mjs +1 -0
  67. package/api/theme/build/build.d.mts +25 -0
  68. package/api/theme/build/build.mjs +101 -70
  69. package/api/theme/build/build.test.mjs +77 -44
  70. package/api/theme/integration-themes.test.mjs +183 -0
  71. package/api/theme/list/list.d.mts +10 -2
  72. package/api/theme/list/list.mjs +31 -10
  73. package/api/theme/list/list.test.mjs +102 -23
  74. package/api/theme/listThemes.doc.d.mts +1 -5
  75. package/api/theme/listThemes.doc.mjs +6 -13
  76. package/api/theme/targets/targets.test.mjs +22 -8
  77. package/api/theme/theme.d.mts +1 -1
  78. package/api/theme/theme.mjs +1 -1
  79. package/api/theme/theme.type.d.mts +9 -0
  80. package/api/theme/theme.type.mjs +3 -1
  81. package/api/theme/themeAdd.doc.d.mts +1 -4
  82. package/api/theme/themeAdd.doc.mjs +31 -31
  83. package/api/theme/themeBuild.doc.mjs +1 -1
  84. package/api/theme/themeList.doc.d.mts +1 -4
  85. package/api/theme/themeList.doc.mjs +7 -15
  86. package/api/theme/themeListAvailable.doc.d.mts +8 -0
  87. package/api/theme/themeListAvailable.doc.mjs +57 -0
  88. package/api/theme/themeTargets.doc.mjs +21 -7
  89. package/api/upgrade/_adapter.d.mts +2 -0
  90. package/api/upgrade/_adapter.mjs +1 -0
  91. package/api/upgrade/registry/registry.d.mts +40 -0
  92. package/api/upgrade/registry/registry.mjs +1154 -0
  93. package/api/upgrade/registry/registry.test.mjs +826 -0
  94. package/api/upgrade/run/run.mjs +49 -8
  95. package/api/upgrade/status/status.d.mts +6 -4
  96. package/api/upgrade/status/status.mjs +26 -8
  97. package/api/upgrade/upgrade.d.mts +2 -2
  98. package/api/upgrade/upgrade.doc.mjs +33 -9
  99. package/api/upgrade/upgrade.mjs +34 -7
  100. package/api/upgrade/upgrade.test.mjs +198 -8
  101. package/api/upgrade/upgrade.type.d.mts +90 -1
  102. package/api/upgrade/upgrade.type.mjs +51 -2
  103. package/assets/docs/cli-integrations.doc.mjs +152 -28
  104. package/assets/docs/getting-started.doc.mjs +1 -1
  105. package/assets/docs/{shadcn-compatibility.doc.mjs → shadcn-compatibility.doc.draft.mjs} +23 -13
  106. package/assets/docs/styling.doc.mjs +3 -3
  107. package/assets/docs/theme.doc.dense.mjs +2 -2
  108. package/assets/docs/theme.doc.mjs +23 -13
  109. package/assets/docs/theme.doc.zh.mjs +1 -1
  110. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +2 -1
  111. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +38 -12
  112. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadShowcase.doc.mjs +15 -0
  113. package/assets/templates/blocks/components/BaseTypeahead/BaseTypeaheadShowcase.tsx +87 -0
  114. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +23 -0
  115. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.tsx +75 -0
  116. package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +5 -19
  117. package/assets/templates/blocks/components/Center/CenterHorizontal.doc.mjs +3 -2
  118. package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +4 -5
  119. package/assets/templates/blocks/components/Toast/ToastAction.tsx +2 -1
  120. package/assets/templates/blocks/components/Toast/ToastDeduplication.tsx +2 -1
  121. package/assets/templates/blocks/components/Toast/ToastDismiss.tsx +2 -1
  122. package/assets/templates/blocks/components/Toast/ToastShowcase.tsx +2 -1
  123. package/assets/templates/blocks/components/Toast/ToastStacking.tsx +2 -1
  124. package/assets/templates/blocks/components/Toast/ToastTypes.tsx +2 -1
  125. package/assets/templates/pages/dashboard/template.doc.mjs +2 -2
  126. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +3 -2
  127. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +3 -2
  128. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +3 -3
  129. package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -2
  130. package/assets/templates/pages/dashboard-progress/template.doc.mjs +2 -2
  131. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -2
  132. package/assets/templates/themes/butter/butterTheme.ts +3 -3
  133. package/assets/templates/themes/neutral/neutralTheme.ts +2 -2
  134. package/assets/templates/themes/stone/stoneTheme.ts +3 -3
  135. package/assets/theme.template.ts +4 -7
  136. package/authoring/config/config.doc.mjs +9 -1
  137. package/authoring/config/parse.d.mts +2 -0
  138. package/authoring/config/parse.mjs +28 -3
  139. package/authoring/config/parse.test.mjs +25 -3
  140. package/authoring/config/type.ts +3 -0
  141. package/authoring/doctypes/_schema.d.mts +3 -0
  142. package/authoring/doctypes/_schema.mjs +6 -1
  143. package/authoring/doctypes/base/type.ts +6 -6
  144. package/authoring/doctypes/component/component.doc.mjs +6 -0
  145. package/authoring/doctypes/component/type.ts +2 -0
  146. package/authoring/gap-report/parse.d.mts +63 -0
  147. package/authoring/gap-report/parse.mjs +121 -0
  148. package/authoring/gap-report/parse.test.mjs +172 -0
  149. package/authoring/gap-report/type.ts +107 -0
  150. package/authoring/index.d.mts +1 -0
  151. package/authoring/index.d.ts +12 -0
  152. package/authoring/index.mjs +4 -0
  153. package/authoring/integration/integration.doc.mjs +14 -2
  154. package/authoring/integration/parse.test.mjs +9 -4
  155. package/authoring/integration/schema.d.mts +2 -0
  156. package/authoring/integration/schema.mjs +1 -0
  157. package/authoring/integration/type.ts +23 -6
  158. package/authoring/shadcn/receipt.d.mts +219 -0
  159. package/authoring/shadcn/receipt.mjs +248 -0
  160. package/authoring/shadcn/receipt.test.mjs +187 -0
  161. package/authoring/shadcn/source-variants.d.mts +28 -0
  162. package/authoring/shadcn/source-variants.mjs +176 -0
  163. package/authoring/shadcn/source-variants.test.mjs +120 -0
  164. package/clients/cli/commands/build-theme.mjs +54 -19
  165. package/clients/cli/commands/build-theme.variants.test.mjs +15 -12
  166. package/clients/cli/commands/component/index.mjs +1 -1
  167. package/clients/cli/commands/docs.test.mjs +1 -0
  168. package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
  169. package/clients/cli/commands/gap-report.doc.mjs +73 -0
  170. package/clients/cli/commands/gap-report.mjs +114 -0
  171. package/clients/cli/commands/gap-report.test.mjs +198 -0
  172. package/clients/cli/commands/import-hint-correctness.test.mjs +88 -0
  173. package/clients/cli/commands/integration-add.doc.mjs +88 -0
  174. package/clients/cli/commands/integration-authoring.test.mjs +177 -0
  175. package/clients/cli/commands/integration-pack.doc.mjs +34 -0
  176. package/clients/cli/commands/integration-real-world.test.mjs +618 -0
  177. package/clients/cli/commands/integration.doc.mjs +28 -0
  178. package/clients/cli/commands/integration.mjs +153 -0
  179. package/clients/cli/commands/theme-add.doc.mjs +11 -6
  180. package/clients/cli/commands/theme-list.doc.mjs +21 -5
  181. package/clients/cli/commands/theme-targets.behavior.test.mjs +19 -2
  182. package/clients/cli/commands/theme.doc.mjs +2 -2
  183. package/clients/cli/commands/upgrade.doc.mjs +17 -4
  184. package/clients/cli/commands/upgrade.mjs +12 -1
  185. package/clients/cli/commands/upgrade.test.mjs +41 -0
  186. package/clients/cli/index.mjs +5 -0
  187. package/clients/cli/lib/component-format.mjs +42 -26
  188. package/clients/cli/lib/component-format.test.mjs +34 -3
  189. package/clients/cli/lib/manifest.mjs +12 -0
  190. package/foundation/config/project-themes.test.mjs +127 -0
  191. package/foundation/config/project.d.mts +23 -4
  192. package/foundation/config/project.mjs +96 -9
  193. package/foundation/config/project.test.mjs +132 -6
  194. package/foundation/discovery/component-discovery.d.mts +36 -0
  195. package/foundation/discovery/component-discovery.mjs +96 -0
  196. package/foundation/discovery/theme-discovery.d.mts +39 -0
  197. package/foundation/discovery/theme-discovery.mjs +650 -0
  198. package/foundation/discovery/theme-discovery.test.mjs +375 -0
  199. package/foundation/discovery/theming-targets.d.mts +16 -0
  200. package/foundation/discovery/theming-targets.mjs +39 -3
  201. package/foundation/discovery/theming-targets.test.mjs +139 -0
  202. package/foundation/integrations/autolink.d.mts +96 -0
  203. package/foundation/integrations/autolink.mjs +265 -0
  204. package/foundation/integrations/autolink.test.mjs +430 -0
  205. package/foundation/integrations/contribution-inventory.d.mts +152 -0
  206. package/foundation/integrations/contribution-inventory.mjs +497 -0
  207. package/foundation/integrations/contribution-inventory.test.mjs +361 -0
  208. package/foundation/integrations/integrations.d.mts +73 -9
  209. package/foundation/integrations/integrations.mjs +158 -8
  210. package/foundation/integrations/integrations.test.mjs +152 -29
  211. package/foundation/integrations/manifest-writer.d.mts +56 -0
  212. package/foundation/integrations/manifest-writer.mjs +328 -0
  213. package/foundation/integrations/manifest-writer.test.mjs +229 -0
  214. package/foundation/integrations/validate-contributions.mjs +81 -6
  215. package/foundation/response/error-codes.d.mts +4 -1
  216. package/foundation/response/error-codes.doc.mjs +16 -1
  217. package/foundation/response/error-codes.mjs +10 -1
  218. package/foundation/response/response-types.doc.mjs +23 -2
  219. package/package.json +8 -1
@@ -7,7 +7,7 @@ export const docs = {
7
7
  title: 'CLI Integrations',
8
8
  category: 'guide',
9
9
  description:
10
- 'Author an npm package that contributes components, templates, and upgrade codemods to Astryx.',
10
+ 'Author an npm package that contributes components, templates, themes, docs, and upgrade codemods to Astryx.',
11
11
 
12
12
  sections: [
13
13
  {
@@ -16,15 +16,15 @@ export const docs = {
16
16
  content: [
17
17
  {
18
18
  type: 'prose',
19
- text: 'An integration is an npm package that contributes components, templates, doc topics, and/or upgrade codemods to a consumer\'s design-system workflow. Consumers install the package and add it to their `astryx.config`; from then on the integration\'s contributions show up alongside core\'s in the same CLI commands.',
19
+ text: "An integration is an npm package that contributes components, templates, source themes, doc topics, agent guidance, and/or upgrade codemods to a consumer's design-system workflow. Consumers install the package as a direct dependency and Astryx autolinks it; an explicit `astryx.config` entry remains available when the app needs to control ordering.",
20
20
  },
21
21
  {
22
22
  type: 'prose',
23
- text: 'The system runs on two files. The consumer writes `astryx.config.{ts,mjs,js}` at their project root to list which packages to load. The author writes `astryx.integration.{ts,mjs,js}` at the package root to declare what the package contributes. This page is the author\'s guide. For the consumer side, run `npx astryx docs getting-started`.',
23
+ text: 'The authoring CLI owns the integration file. The first `astryx integration add` creates `astryx.integration.mjs`; each later add declares its root only after writing a valid contribution behind it. Identity (name and version) still comes from package.json. For the consumer side, run `npx astryx docs getting-started`.',
24
24
  },
25
25
  {
26
26
  type: 'prose',
27
- text: 'On the consumer side, adding your package is one line:',
27
+ text: 'A consumer can still name the package explicitly when order or precedence matters:',
28
28
  },
29
29
  {
30
30
  type: 'code',
@@ -33,7 +33,7 @@ export const docs = {
33
33
  },
34
34
  {
35
35
  type: 'prose',
36
- text: 'Your components and templates then appear next to core\'s:',
36
+ text: "Your components and templates then appear next to core's:",
37
37
  },
38
38
  {
39
39
  type: 'code',
@@ -42,18 +42,80 @@ export const docs = {
42
42
  },
43
43
  ],
44
44
  },
45
+ {
46
+ title: 'Authoring with the CLI',
47
+ category: 'guide',
48
+ content: [
49
+ {
50
+ type: 'prose',
51
+ text: 'Do not start by hand-editing a manifest. Add the contribution you mean to ship; Astryx creates the manifest, writes every required file, preserves an existing custom root, and updates an existing package.json files allowlist without creating one.',
52
+ },
53
+ {
54
+ type: 'code',
55
+ lang: 'bash',
56
+ code: "astryx integration add component AcmeCarousel\nastryx integration add doc deploying\nastryx integration add template dashboard --type page\nastryx integration add codemod rename-prop --to 1.2.0\nastryx integration add agent-doc 'Use AcmeCarousel for rotating content.'\nastryx integration add theme ocean",
57
+ },
58
+ {
59
+ type: 'prose',
60
+ text: 'The package self-resolves while you author it. Run `astryx component --list`, `astryx docs`, `astryx template --list`, or `astryx theme list` from the package and its local contributions appear with the package name. You do not publish or build a throwaway app to see your own work.',
61
+ },
62
+ {
63
+ type: 'prose',
64
+ text: 'Every add is non-interactive, refuses to overwrite authored files, supports --dry-run, and verifies the generated contribution through the same discovery rules a consumer uses. Before publishing, run the package gate:',
65
+ },
66
+ {
67
+ type: 'code',
68
+ lang: 'bash',
69
+ code: 'astryx integration pack --check',
70
+ },
71
+ {
72
+ type: 'prose',
73
+ text: 'The gate runs the package lifecycle, creates the real npm tarball, checks every required contribution file against the pack list, extracts it into a scratch consumer, and compares the local and packed contribution inventories. `astryx doctor integration` remains the read-only diagnostic surface when something is not found.',
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ title: 'Theme Package Walkthrough',
79
+ category: 'guide',
80
+ content: [
81
+ {
82
+ type: 'prose',
83
+ text: 'A useful theme package usually ships more than colors. Start with the source theme, then add the guides its consumers need. Each command writes a complete contribution and keeps the package manifest in sync.',
84
+ },
85
+ {
86
+ type: 'code',
87
+ lang: 'bash',
88
+ label: 'In the provider package',
89
+ code: 'astryx integration add theme ocean\nastryx theme palette generate palette.config.json --out themes/ocean/tokens/ocean.palette.ts\nastryx integration add doc brand-theme\nastryx integration add doc theme-migration\nastryx theme list --package @acme/brand-integration\nastryx docs brand-theme\nastryx integration pack --check\nnpm pack',
90
+ },
91
+ {
92
+ type: 'prose',
93
+ text: 'Edit the generated theme and guide files before publishing. Palette generation writes an importable TypeScript candidate and a reproducibility receipt; import the candidate from the theme and list both nested files in that theme catalog entry. `integration pack --check` runs the real package lifecycle and compares local discovery with the npm tarball, so a missing source file or files allowlist entry fails before a consumer sees it.',
94
+ },
95
+ {
96
+ type: 'code',
97
+ lang: 'bash',
98
+ label: 'In a separate consumer app',
99
+ code: 'npm install @astryxdesign/core ../brand-integration/acme-brand-integration-1.0.0.tgz\nastryx theme list --package @acme/brand-integration\nastryx docs brand-theme\nastryx docs theme-migration\nastryx theme add ocean --package @acme/brand-integration\nastryx theme build src/themes/ocean/oceanTheme.ts',
100
+ },
101
+ {
102
+ type: 'prose',
103
+ text: 'The package must be a direct dependency for automatic discovery. No `astryx.config` entry is needed unless the app must control integration order. `theme add` copies every file listed by the selected catalog entry, including nested token modules, and refuses to overwrite existing project files.',
104
+ },
105
+ ],
106
+ },
45
107
  {
46
108
  title: 'The Integration File',
47
109
  category: 'guide',
48
110
  content: [
49
111
  {
50
112
  type: 'prose',
51
- text: 'To register your package as an integration, add an `astryx.integration.{ts,mjs,js}` file as a sibling of your `package.json`. It tells the CLI where to find your components, templates, doc topics, and codemods. Identity (name, version) comes from your `package.json`, not this file.',
113
+ text: 'The CLI creates one `astryx.integration.mjs` beside package.json and adds a root only when that same operation writes a real contribution. The file tells consumers where each contribution kind lives; this example is the resulting shape, not a setup step:',
52
114
  },
53
115
  {
54
116
  type: 'code',
55
117
  lang: 'typescript',
56
- code: "// astryx.integration.ts\nexport default {\n components: './components',\n templates: './templates',\n codemods: './codemods',\n docs: './docs',\n issuesUrl: 'https://github.com/acme/widgets/issues',\n};",
118
+ code: "// astryx.integration.ts\nexport default {\n components: './components',\n templates: './templates',\n themes: './themes',\n codemods: './codemods',\n docs: './docs',\n issuesUrl: 'https://github.com/acme/widgets/issues',\n};",
57
119
  },
58
120
  {
59
121
  type: 'prose',
@@ -86,7 +148,7 @@ export const docs = {
86
148
  content: [
87
149
  {
88
150
  type: 'prose',
89
- text: 'Templates are usually not exported from the package directly. Instead, consumers browse them through the CLI and materialize them into their app. Define a template as a plain object stamped with `type: \'page\'` (full pages) or `type: \'block\'` (smaller chunks) in a `.template.{ts,mjs,js}` file next to the source, for example `AcmeLandingPage.tsx` and `AcmeLandingPage.template.ts`.',
151
+ text: "Templates are usually not exported from the package directly. Instead, consumers browse them through the CLI and materialize them into their app. Define a template as a plain object stamped with `type: 'page'` (full pages) or `type: 'block'` (smaller chunks) in a `.template.{ts,mjs,js}` file next to the source, for example `AcmeLandingPage.tsx` and `AcmeLandingPage.template.ts`.",
90
152
  },
91
153
  {
92
154
  type: 'prose',
@@ -99,21 +161,7 @@ export const docs = {
99
161
  },
100
162
  {
101
163
  type: 'prose',
102
- text: 'The CLI needs the template source at consume time, so make sure it is included in your published package. This is typically done via the `exports` key in `package.json`. It also lets the docsite render template previews in the future.',
103
- },
104
- {
105
- type: 'code',
106
- lang: 'jsonc',
107
- code: '{\n "exports": {\n // ...\n "./templates/*.tsx": "./templates/*.tsx"\n }\n}',
108
- },
109
- {
110
- type: 'prose',
111
- text: 'To verify it resolves, try importing the template component with its `.tsx` extension. An extensionless specifier will not resolve under `moduleResolution: bundler`, and the extensionful export above is what lets this type-check without consumers enabling `allowImportingTsExtensions`.',
112
- },
113
- {
114
- type: 'code',
115
- lang: 'typescript',
116
- code: "import('@acme/astryx-widgets/templates/AcmeLandingPage.tsx');",
164
+ text: 'The CLI needs both files at consume time. `integration add` includes the templates root when package.json already has a files allowlist. It never creates an exports map, because doing that can make previously-open deep imports private; when a map already exists, it adds the generated source subpath without replacing author-owned entries. `integration pack --check` proves the source and metadata survive the tarball and verifies every component through the public import its metadata advertises.',
117
165
  },
118
166
  ],
119
167
  },
@@ -148,14 +196,46 @@ export const docs = {
148
196
  style: 'unordered',
149
197
  items: [
150
198
  'A topic name is a CLI argument and a docsite path, so it may hold only letters, digits, `_` and `-`.',
151
- "A name that collides with an existing topic and declares neither `replaces` nor `extends` is an error, not a silent override; the CLI will not guess which one you meant.",
152
- '`replaces` and `extends` are exclusive: a topic either takes another\'s place or merges onto it.',
199
+ 'A name that collides with an existing topic and declares neither `replaces` nor `extends` is an error, not a silent override; the CLI will not guess which one you meant.',
200
+ "`replaces` and `extends` are exclusive: a topic either takes another's place or merges onto it.",
153
201
  'Two integrations replacing one topic is a warning, and the one configured later in `astryx.config` wins.',
154
202
  '`astryx doctor integration docs <package>` classifies Core overlaps as intentional replacements, intentional extensions, or accidental same-name conflicts.',
155
203
  ],
156
204
  },
157
205
  ],
158
206
  },
207
+ {
208
+ title: 'Themes',
209
+ category: 'guide',
210
+ content: [
211
+ {
212
+ type: 'prose',
213
+ text: "A theme contribution is editable `defineTheme` source, not compiled CSS. Add `themes: './themes'` to `astryx.integration.*`, place the source under one directory per slug, and list it in `themes/manifest.json`. If package.json has a `files` allowlist, include both the integration manifest and the themes root; packages with no allowlist already publish both. Do not add an `exports` map only for theme discovery.",
214
+ },
215
+ {
216
+ type: 'code',
217
+ lang: 'text',
218
+ code: 'themes/\n manifest.json\n ocean/\n oceanTheme.ts',
219
+ },
220
+ {
221
+ type: 'prose',
222
+ text: "The root catalog uses the same entry contract as Astryx's bundled themes: `slug`, `displayName`, `description`, `maintained`, `entry`, `exportName`, and `files`. `entry` and every file are relative to `themes/<slug>/`; `exportName` identifies a named runtime export in the entry source. Astryx parses that source without executing it, requires every local static import and re-export to name a file in `files`, and rejects missing or type-only exports.",
223
+ },
224
+ {
225
+ type: 'code',
226
+ lang: 'json',
227
+ code: '{\n "version": 1,\n "themes": [{\n "slug": "ocean",\n "displayName": "Ocean",\n "description": "Ocean theme.",\n "maintained": true,\n "entry": "oceanTheme.ts",\n "exportName": "oceanTheme",\n "files": ["oceanTheme.ts"]\n }]\n}',
228
+ },
229
+ {
230
+ type: 'prose',
231
+ text: 'After a consumer installs the package, `astryx theme list` shows its themes with the owner package, and `astryx theme add <slug> --package <package>` copies the selected source into the app. If two packages use one slug, an unscoped add fails instead of choosing one silently.',
232
+ },
233
+ {
234
+ type: 'prose',
235
+ text: "Compatibility is additive. A CLI released before the `themes` field ignores that unknown key with a warning and continues loading the integration's older contribution kinds, but it cannot list or add the contributed theme. Upgrade `@astryxdesign/cli` in the consumer to use it.",
236
+ },
237
+ ],
238
+ },
159
239
  {
160
240
  title: 'Agent Docs',
161
241
  category: 'guide',
@@ -185,7 +265,7 @@ export const docs = {
185
265
  content: [
186
266
  {
187
267
  type: 'prose',
188
- text: 'Ship codemods so `astryx upgrade` can migrate consumers across breaking changes in your package. Point the integration file\'s `codemods` field at your codemods root, and author each one as a plain object stamped with `type: \'code\'` (transforms source files) or `type: \'config\'` (rewrites the consumer\'s `astryx.config`).',
268
+ text: "Ship codemods so `astryx upgrade` can migrate consumers across breaking changes in your package. Point the integration file's `codemods` field at your codemods root, and author each one as a plain object stamped with `type: 'code'` (transforms source files) or `type: 'config'` (rewrites the consumer's `astryx.config`).",
189
269
  },
190
270
  {
191
271
  type: 'code',
@@ -213,7 +293,7 @@ export const docs = {
213
293
  },
214
294
  {
215
295
  type: 'prose',
216
- text: 'The event is the same `DebugEvent` a consumer receives from `debug` in their own `astryx.config`, and both run: an app that sets its own handler still reaches yours, and yours never displaces theirs. The app handler is called first, then each integration in the order the config lists them. Every handler is called in isolation with its own copy of the event — one that throws, prints, or calls `process.exit` cannot change the command\'s output or exit code, and cannot stop the others.',
296
+ text: "The event is the same `DebugEvent` a consumer receives from `debug` in their own `astryx.config`, and both run: an app that sets its own handler still reaches yours, and yours never displaces theirs. The app handler is called first, then each integration in the order the config lists them. Every handler is called in isolation with its own copy of the event — one that throws, prints, or calls `process.exit` cannot change the command's output or exit code, and cannot stop the others.",
217
297
  },
218
298
  {
219
299
  type: 'prose',
@@ -221,13 +301,57 @@ export const docs = {
221
301
  },
222
302
  ],
223
303
  },
304
+ {
305
+ title: 'Gap report handler',
306
+ category: 'guide',
307
+ content: [
308
+ {
309
+ type: 'prose',
310
+ text: 'An integration can handle `astryx gap-report` events by exporting a `gapReport` handler from its integration module. The handler is a plain object with an `audience` and a `handle` function — not an executable command. Export it as a named export; do not put it in the default manifest. Older CLI versions ignore the named export and continue loading every manifest contribution they understand.',
311
+ },
312
+ {
313
+ type: 'code',
314
+ lang: 'typescript',
315
+ code: "// astryx.integration.ts\nimport type {GapReportHandler} from '@astryxdesign/cli/authoring';\n\nexport const gapReport: GapReportHandler = {\n audience: 'public',\n async handle(event, {signal}) {\n // event is a normalized GapReport with camelCase fields\n // and event.target.{package, version, issuesUrl}\n const url = await createIssue(event, {signal});\n return { status: 'filed', url };\n },\n};\n\nexport default {\n components: './components',\n issuesUrl: 'https://github.com/acme/widgets/issues',\n};",
316
+ },
317
+ {
318
+ type: 'prose',
319
+ text: 'The same handler type is available as a `gapReport` field in `astryx.config` for project-level handling. When both exist, the project handler runs first, then each integration handler in config order. Every handler runs — none overrides another.',
320
+ },
321
+ {
322
+ type: 'code',
323
+ lang: 'typescript',
324
+ code: "// astryx.config.ts\nimport type {AstryxConfig, GapReportHandler} from '@astryxdesign/cli/authoring';\n\nconst projectHandler: GapReportHandler = {\n audience: 'internal',\n async handle(event) {\n await postToTracker(event);\n return { status: 'filed', message: 'Posted to internal tracker' };\n },\n};\n\nexport default {\n integrations: ['@acme/astryx-widgets'],\n gapReport: projectHandler,\n} satisfies AstryxConfig;",
325
+ },
326
+ {
327
+ type: 'prose',
328
+ text: "Each handler receives its own deep copy of the `GapReport` event (via `structuredClone`) plus an `AbortSignal` that fires at the 30-second timeout. Each handler runs in its own worker. A throw, timeout, `stdout` write, `process.exit`, or `process.exitCode` change is contained there and produces a failed delivery for that handler only. On timeout the CLI aborts the signal, terminates the worker before starting the next handler, and preserves its own output and exit code. Handler `stdout` is forwarded to the CLI's `stderr` so it cannot corrupt a JSON envelope.",
329
+ },
330
+ {
331
+ type: 'prose',
332
+ text: "A handler MUST return a `GapReportHandlerReceipt` with a `status` of `'filed'`, `'routed_only'`, or `'skipped'`, plus optional `url` and `message` strings. The aggregate response includes an ordered `deliveries` array. Each entry names its project, integration package, or fallback and includes the declared audience, final status, URL, and message.",
333
+ },
334
+ {
335
+ type: 'prose',
336
+ text: "Use `audience: 'public'` for any public or third-party destination. The CLI will not invoke a public handler unless the caller explicitly confirms the public write. `audience: 'internal'` requires no additional confirmation. In a fan-out with mixed audiences, internal handlers run unconditionally while public handlers are consent-gated independently.",
337
+ },
338
+ {
339
+ type: 'prose',
340
+ text: 'When the effective handler set is empty (no project handler, no integration handlers), and the target has a GitHub `issuesUrl`, the CLI falls back to `gh issue create` after explicit confirmation. Any other `issuesUrl` scheme produces a `routed_only` receipt. The fallback is suppressed entirely when at least one handler is configured.',
341
+ },
342
+ ],
343
+ },
224
344
  {
225
345
  title: 'How It Works',
226
346
  category: 'guide',
227
347
  content: [
228
348
  {
229
349
  type: 'prose',
230
- text: 'Every CLI command loads the consumer\'s `astryx.config`, resolves each listed integration\'s manifest from `node_modules`, and discovers its contributions. Each file is parsed at the load boundary through `@astryxdesign/cli/authoring` — when the CLI loads it, not when you author it. A field of the wrong type fails there. A field this CLI does not know is ignored with a warning naming it, so a manifest written against a newer CLI still contributes everything this one understands. There are no factories; you write a plain object and stamp its `type`.',
350
+ text: "Every CLI command loads the consumer's `astryx.config`, resolves each listed integration's manifest from `node_modules`, and discovers its contributions. Each file is parsed at the load boundary through `@astryxdesign/cli/authoring` — when the CLI loads it, not when you author it. A field of the wrong type fails there. A field this CLI does not know is ignored with a warning naming it, so a manifest written against a newer CLI still contributes everything this one understands. There are no factories; you write a plain object and stamp its `type`.",
351
+ },
352
+ {
353
+ type: 'prose',
354
+ text: 'Runtime integration features — `debug` and `gapReport` — use named exports from the integration module rather than fields in the default manifest. The CLI discovers them alongside the manifest but loads them through the composition rules in `spec:AST-031`: every configured handler runs additively, each in isolation with its own copy of the event.',
231
355
  },
232
356
  {
233
357
  type: 'prose',
@@ -31,7 +31,7 @@ export const docs = {
31
31
  type: 'code',
32
32
  lang: 'text',
33
33
  label: 'Give it a look',
34
- code: "Ask me what look and feel this app should have. Run `npx @astryxdesign/cli theme list` and start from the closest shipped theme with `theme add <slug>`, which copies it in as editable source; if none of them fit, run `npx @astryxdesign/cli theme template` and fill in the annotated template it writes. Default to neutral if I have no preference, and show me the result before moving on.",
34
+ code: "Ask me what look and feel this app should have. Run `npx @astryxdesign/cli theme list` and start from the closest available theme with `theme add <slug>`; the list includes bundled themes and themes from installed integrations, with each owner shown. Use `--package` if owners share a slug. The command copies the theme in as editable source. If none fit, run `npx @astryxdesign/cli theme template` and fill in the annotated template it writes. Default to neutral if I have no preference, and show me the result before moving on.",
35
35
  },
36
36
  ],
37
37
  },
@@ -15,7 +15,7 @@ export const docs = {
15
15
  content: [
16
16
  {
17
17
  type: 'prose',
18
- text: 'Astryx supports the shadcn Registry as a compatibility and distribution protocol. This does not make Astryx a shadcn-based library. The Astryx packages remain the implementation and the Astryx CLI remains the primary interface for discovery, composition, theming, validation, and upgrades.',
18
+ text: 'This guide is for existing shadcn users who want to add Astryx without replacing their current toolchain. Astryx supports the shadcn Registry as a compatibility and distribution protocol. The Astryx packages remain the implementation and the Astryx CLI remains the richer interface for discovery, composition, theming, validation, and upgrades.',
19
19
  },
20
20
  {
21
21
  type: 'prose',
@@ -23,7 +23,7 @@ export const docs = {
23
23
  },
24
24
  {
25
25
  type: 'prose',
26
- text: 'This compatibility path is experimental. Use it to test incremental adoption in an existing shadcn-style application. Do not treat the registry URL or generated catalog as a stable support promise until Astryx announces it as supported.',
26
+ text: 'The registry is published as-is for existing shadcn users. Issues are welcome in the Astryx repository, with no response-time promise.',
27
27
  },
28
28
  ],
29
29
  },
@@ -66,17 +66,17 @@ export const docs = {
66
66
  [
67
67
  'Showcase or example',
68
68
  'Editable application-level composition source that imports Astryx packages',
69
- 'Your app owns the composition; Astryx owns the imported components',
69
+ 'Your app owns its edits; the adjacent Astryx receipt enables safe upgrades',
70
70
  ],
71
71
  [
72
72
  'Block',
73
73
  'A larger editable composition plus its package dependencies',
74
- 'Your app owns the composition; Astryx owns the imported components',
74
+ 'Your app owns its edits; the adjacent Astryx receipt enables safe upgrades',
75
75
  ],
76
76
  [
77
77
  'Page',
78
78
  'A complete editable page plus its package dependencies',
79
- 'Your app owns the page; Astryx owns the imported components',
79
+ 'Your app owns its edits; the adjacent Astryx receipt enables safe upgrades',
80
80
  ],
81
81
  ],
82
82
  },
@@ -97,19 +97,23 @@ export const docs = {
97
97
  type: 'code',
98
98
  lang: 'bash',
99
99
  label: 'Install the Button package entry',
100
- code: 'npx shadcn@latest add <registry-origin>/components/button.json',
100
+ code: 'npx shadcn@4.19.0 add <registry-origin>/components/button.json',
101
101
  },
102
102
  {
103
103
  type: 'code',
104
104
  lang: 'bash',
105
105
  label: 'Install the editable Button showcase',
106
- code: 'npx shadcn@latest add <registry-origin>/showcases/button/variants.json',
106
+ code: 'npx shadcn@4.19.0 add <registry-origin>/showcases/button/variants.json',
107
107
  },
108
108
  {
109
109
  type: 'code',
110
110
  lang: 'bash',
111
111
  label: 'Install the complete dashboard page',
112
- code: 'npx shadcn@latest add <registry-origin>/templates/dashboard.json',
112
+ code: 'npx shadcn@4.19.0 add <registry-origin>/templates/dashboard.json',
113
+ },
114
+ {
115
+ type: 'prose',
116
+ text: 'Astryx pins the tested shadcn client in these commands. The JavaScript receipt base must match the exact transform that client writes; use the displayed version rather than replacing it with `latest`.',
113
117
  },
114
118
  ],
115
119
  },
@@ -128,7 +132,7 @@ export const docs = {
128
132
  },
129
133
  {
130
134
  type: 'prose',
131
- text: 'For an example, block, or page, the command writes editable TSX into your app. That TSX imports public Astryx package paths. It does not reach into package internals and it does not require a StyleX compiler in your app.',
135
+ text: 'For an example, block, or page, the command writes editable TSX in TypeScript projects or JS/JSX in JavaScript projects, plus a small adjacent `.astryx` receipt. A composition that required StyleX compilation stays honest precompiled JSX in both modes and installs a narrow declaration for strict TypeScript imports. The source imports public Astryx package paths. The receipt stores every distinct install base so a later upgrade can preserve your edits; it is not application code and should stay committed with the copied file.',
132
136
  },
133
137
  ],
134
138
  },
@@ -147,7 +151,8 @@ export const docs = {
147
151
  astryx component Button
148
152
  astryx template dashboard
149
153
  astryx doctor
150
- astryx upgrade --apply`,
154
+ astryx upgrade --registry
155
+ astryx upgrade --registry --apply`,
151
156
  },
152
157
  ],
153
158
  },
@@ -159,9 +164,14 @@ astryx upgrade --apply`,
159
164
  style: 'unordered',
160
165
  items: [
161
166
  'Package upgrades update Astryx components, hooks, behavior, accessibility, and compiled styles.',
162
- 'Copied examples, blocks, and pages are application code. They do not update automatically when the catalog changes.',
163
- 'The experimental catalog excludes unpublished packages because an external package manager cannot install them.',
164
- 'Your project needs a valid components.json and TypeScript configuration for the shadcn CLI to resolve target paths.',
167
+ 'A normal `astryx upgrade` also checks copied-composition receipts. Use `astryx upgrade --registry` to preview only those files; add `--apply` to write safe updates.',
168
+ 'Registry source must match the installed Astryx release. The command refuses to copy source from a newer or older release.',
169
+ 'An unchanged copied file updates automatically. Non-overlapping edits are three-way merged against the installed base.',
170
+ 'JavaScript formatting or quote changes from a compatible shadcn printer are treated as unchanged only when the parsed syntax tree and attached comments still match.',
171
+ 'A conflicting edit leaves your file untouched and writes a separate `.astryx-conflict` file for review.',
172
+ 'A deleted or moved copied file is reported but never recreated or overwritten.',
173
+ 'The registry excludes unpublished packages because an external package manager cannot install them.',
174
+ 'Your project needs a valid components.json and path-alias configuration for the shadcn CLI to resolve target paths.',
165
175
  'The compatibility layer is additive. It does not require replacing existing shadcn components or migrating the whole application.',
166
176
  ],
167
177
  },
@@ -268,12 +268,12 @@ const overrides = stylex.create({
268
268
  ],
269
269
  },
270
270
  {
271
- title: 'Removed: Bare Prop and State Classes',
271
+ title: 'Deprecated: Bare Prop and State Classes',
272
272
  category: 'guide',
273
273
  content: [
274
274
  {
275
275
  type: 'prose',
276
- text: 'Astryx no longer emits bare prop/state classes such as `.primary`, `.sm`, `.level-2`, and `.checked`. Run `astryx upgrade --apply` 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.',
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.',
277
277
  },
278
278
  {
279
279
  type: 'code',
@@ -290,7 +290,7 @@ const overrides = stylex.create({
290
290
  },
291
291
  {
292
292
  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. The class arm preserves consumer-supplied `className` matches; the attribute arms match v0.6 props and states. 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.',
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.',
294
294
  },
295
295
  ],
296
296
  },
@@ -38,7 +38,7 @@ export const docsDense = {
38
38
  content: [
39
39
  {
40
40
  type: 'prose',
41
- text: '`theme list` + `theme add <slug>` to start from a shipped theme, or defineTheme from scratch. only override tokens that differ.',
41
+ text: '`theme list` + `theme add <slug>` to start from a bundled or installed integration theme; use `--package` for a shared slug. Or defineTheme from scratch. only override tokens that differ.',
42
42
  },
43
43
  null,
44
44
  {
@@ -53,7 +53,7 @@ export const docsDense = {
53
53
  content: [
54
54
  {
55
55
  type: 'prose',
56
- text: 'scale configs (color, typography, radius, motion) + explicit token overrides + component overrides. color derives full palette from accent via HCT; accent = hex or [light, dark] tuple (per-scheme palettes). tokens overrides win token-by-token; --color-on-accent stays baked from color.accent, so prefer a tuple accent over overriding --color-accent.',
56
+ text: 'scale configs (color, typography, radius, motion) + explicit token overrides + component overrides. color derives full palette from accent via HCT; accent = hex or [light, dark] tuple (per-scheme palettes). tokens overrides win token-by-token; --color-on-accent stays baked from color.accent, so prefer a tuple accent over overriding --color-accent. localTokens accepts any valid CSS custom-property name; prefixes do not establish ownership.',
57
57
  },
58
58
  null,
59
59
  null,
@@ -136,19 +136,39 @@ function App() {
136
136
  },
137
137
  ],
138
138
  },
139
+ {
140
+ title: 'Using a Theme from an Integration',
141
+ category: 'guide',
142
+ content: [
143
+ {
144
+ type: 'prose',
145
+ text: 'Install the integration as a direct dependency and Astryx discovers its source themes and guide topics without an `astryx.config` file. Install Core too because the copied source imports `defineTheme` from `@astryxdesign/core/theme`.',
146
+ },
147
+ {
148
+ type: 'code',
149
+ lang: 'bash',
150
+ label: 'Install, inspect, copy, and build',
151
+ code: 'npm install @astryxdesign/core @acme/brand-integration\nastryx theme list --package @acme/brand-integration\nastryx docs brand-theme\nastryx theme add ocean --package @acme/brand-integration\nastryx theme build src/themes/ocean/oceanTheme.ts',
152
+ },
153
+ {
154
+ type: 'prose',
155
+ text: 'The copy is editable project source, not a reference back into node_modules. Every file named by the theme catalog comes with it, including nested token or palette modules. A second add refuses to overwrite those files unless you pass `--overwrite`.',
156
+ },
157
+ ],
158
+ },
139
159
  {
140
160
  title: 'Creating a Custom Theme',
141
161
  category: 'guide',
142
162
  content: [
143
163
  {
144
164
  type: 'prose',
145
- text: 'Start from a theme we ship, or write one from scratch with defineTheme. Only override tokens that differ from defaults; omitted tokens use the design system defaults.',
165
+ text: 'Start from a bundled theme or one contributed by an installed integration, or write one from scratch with defineTheme. `theme list` names each owner; when packages share a slug, pass `--package`. Only override tokens that differ from defaults; omitted tokens use the design system defaults.',
146
166
  },
147
167
  {
148
168
  type: 'code',
149
169
  lang: 'bash',
150
170
  label: 'Browse, then copy a theme in as editable source',
151
- code: 'astryx theme list\nastryx theme add stone',
171
+ code: 'astryx theme list\nastryx theme add stone\nastryx theme add ocean --package @acme/themes',
152
172
  },
153
173
  {
154
174
  type: 'prose',
@@ -162,7 +182,7 @@ function App() {
162
182
  content: [
163
183
  {
164
184
  type: 'prose',
165
- text: 'defineTheme creates a theme from token overrides and optional scale configs. Scale configs generate tokens from parameters. Explicit token overrides always take precedence over scale-generated values, token by token. Theme maintainers may declare reusable, non-portable roles through localTokens using complete --astryx-theme-<name>-* custom-property names; these roles remain inside that enrolled theme family and do not expand the shared token vocabulary. One caveat for the accent: overriding --color-accent in tokens re-points the reference tokens (--color-accent-muted, --color-text-accent, --color-icon-accent) but NOT --color-on-accent, which stays baked from the color.accent seed. To give each scheme its own accent with a consistent derived palette, pass a [light, dark] tuple to color.accent instead of overriding the token.',
185
+ text: 'defineTheme creates a theme from token overrides and optional scale configs. Scale configs generate tokens from parameters. Explicit token overrides always take precedence over scale-generated values, token by token. localTokens accepts any valid CSS custom-property name; prefixes do not establish ownership. One caveat for the accent: overriding --color-accent in tokens re-points the reference tokens (--color-accent-muted, --color-text-accent, --color-icon-accent) but NOT --color-on-accent, which stays baked from the color.accent seed. To give each scheme its own accent with a consistent derived palette, pass a [light, dark] tuple to color.accent instead of overriding the token.',
166
186
  },
167
187
  {
168
188
  type: 'code',
@@ -184,16 +204,6 @@ const myTheme = defineTheme({
184
204
  // Explicit overrides take precedence over scale-generated values
185
205
  '--color-background-body': ['#FFFFFF', '#0A0A0A'],
186
206
  },
187
- localTokens: {
188
- '--astryx-theme-my-theme-color-status-fill-accent': ['#0077B6', '#48CAE4'],
189
- },
190
- components: {
191
- badge: {
192
- 'variant:info': {
193
- backgroundColor: 'var(--astryx-theme-my-theme-color-status-fill-accent)',
194
- },
195
- },
196
- },
197
207
  });`,
198
208
  },
199
209
  {
@@ -8,7 +8,7 @@ export const docsZh = {
8
8
  { section: 'Quick Start', 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
10
  { section: 'Theme Props', title: 'Theme 属性', content: [null] },
11
- { section: 'Creating a Custom Theme', title: '创建自定义主题', content: [{ type: 'prose', text: '用 `theme list` + `theme add <slug>` 从内置主题开始,或用 defineTheme 从零编写。只覆盖与默认值不同的令牌。' }, null, { type: 'prose', text: '`astryx theme template` 会写入 theme.template.ts:带注释的完整参考,涵盖每个 defineTheme 字段、令牌族和覆盖语法,并标明打印各自参考的 CLI 命令。' }] },
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 命令。' }] },
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
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] },
14
14
  { section: 'Runtime vs Built Themes', title: '运行时 vs 构建', content: [{ type: 'prose', text: '运行时:useInsertionEffect 在客户端注入样式。构建:静态 CSS 在首次渲染时就存在。SSR 应用请使用 /built + theme.css。' }, null, null, null] },
@@ -7,8 +7,9 @@ export const doc = {
7
7
  name: 'BaseTypeahead — Custom Search Bar',
8
8
  displayName: 'BaseTypeahead — Custom Search Bar',
9
9
  description:
10
- 'BaseTypeahead embedded inside a custom-styled wrapper. The wrapper provides its own border and icon chrome; anchorRef positions the dropdown relative to it. Use this pattern when Typeahead\'s built-in field layout does not fit your composition.',
10
+ "BaseTypeahead embedded inside a custom-styled wrapper. The wrapper provides its own border and icon chrome; anchorRef positions the dropdown relative to it. Use this pattern when Typeahead's built-in field layout does not fit your composition.",
11
11
  isReady: true,
12
+ isShowcase: true,
12
13
  aspectRatio: 16 / 9,
13
14
  componentsUsed: ['BaseTypeahead', 'Icon', 'Layout', 'Text'],
14
15
  };
@@ -3,11 +3,19 @@
3
3
  'use client';
4
4
 
5
5
  import {useRef, useState} from 'react';
6
+ import * as stylex from '@stylexjs/stylex';
6
7
  import {BaseTypeahead, createStaticSource} from '@astryxdesign/core/Typeahead';
7
8
  import type {SearchableItem} from '@astryxdesign/core/Typeahead';
8
9
  import {Icon} from '@astryxdesign/core/Icon';
9
10
  import {HStack, VStack} from '@astryxdesign/core/Layout';
10
11
  import {Text} from '@astryxdesign/core/Text';
12
+ import {
13
+ borderVars,
14
+ colorVars,
15
+ focusVars,
16
+ radiusVars,
17
+ spacingVars,
18
+ } from '@astryxdesign/core/theme/tokens.stylex';
11
19
  import {MagnifyingGlassIcon} from '@heroicons/react/24/outline';
12
20
 
13
21
  const frameworks: SearchableItem[] = [
@@ -23,24 +31,42 @@ const frameworks: SearchableItem[] = [
23
31
 
24
32
  const source = createStaticSource(frameworks);
25
33
 
34
+ const styles = stylex.create({
35
+ root: {
36
+ width: '100%',
37
+ maxWidth: 360,
38
+ },
39
+ field: {
40
+ backgroundColor: colorVars['--color-background-surface'],
41
+ borderColor: colorVars['--color-border'],
42
+ borderRadius: radiusVars['--radius-element'],
43
+ borderStyle: 'solid',
44
+ borderWidth: borderVars['--border-width'],
45
+ paddingBlock: spacingVars['--spacing-1-5'],
46
+ paddingInline: spacingVars['--spacing-2'],
47
+ outlineColor: {
48
+ default: 'transparent',
49
+ ':has(input:focus-visible)': focusVars['--focus-outline-color'],
50
+ },
51
+ outlineOffset: focusVars['--focus-outline-offset'],
52
+ outlineStyle: 'solid',
53
+ outlineWidth: {
54
+ default: '0',
55
+ ':has(input:focus-visible)': focusVars['--focus-outline-width'],
56
+ },
57
+ },
58
+ });
59
+
26
60
  export default function BaseTypeaheadCustomSearch() {
27
61
  const [value, setValue] = useState<SearchableItem | null>(null);
28
- const wrapperRef = useRef<HTMLElement>(null);
62
+ const wrapperRef = useRef<HTMLDivElement>(null);
29
63
 
30
64
  return (
31
- <VStack gap={3} style={{width: 320}}>
32
- <HStack
33
- ref={wrapperRef}
34
- gap={2}
35
- vAlign="center"
36
- style={{
37
- border: '1px solid var(--color-border)',
38
- borderRadius: 'var(--radius-control)',
39
- padding: '6px 10px',
40
- background: 'var(--color-surface)',
41
- }}>
65
+ <VStack gap={3} xstyle={styles.root}>
66
+ <HStack ref={wrapperRef} gap={2} vAlign="center" xstyle={styles.field}>
42
67
  <Icon icon={MagnifyingGlassIcon} size="sm" color="secondary" />
43
68
  <BaseTypeahead
69
+ aria-label="Search frameworks"
44
70
  searchSource={source}
45
71
  value={value}
46
72
  onChange={setValue}