@astryxdesign/cli 0.7.15 → 0.7.16-canary.g22213fd

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 (222) hide show
  1. package/README.md +6 -4
  2. package/api/build/_adapter.d.mts +10 -0
  3. package/api/build/_adapter.mjs +24 -0
  4. package/api/build/blocks/blocks.d.mts +1 -0
  5. package/api/build/blocks/blocks.mjs +18 -1
  6. package/api/build/kit/shell.weights.json +1 -0
  7. package/api/build/kit/shellcall.d.mts +26 -0
  8. package/api/build/kit/shellcall.mjs +87 -0
  9. package/api/build/kit/start.mjs +67 -4
  10. package/api/build/kit/weights.d.mts +15 -0
  11. package/api/build/kit/weights.mjs +27 -0
  12. package/api/component/__fixtures__/resolutions/modules.txt +1 -1
  13. package/api/component/_adapter.d.mts +1 -1
  14. package/api/component/_adapter.mjs +28 -1
  15. package/api/doctor/_adapter.d.mts +38 -2
  16. package/api/doctor/_adapter.mjs +76 -1
  17. package/api/doctor/built-checks.mjs +1 -1
  18. package/api/doctor/doctor.d.mts +26 -0
  19. package/api/doctor/doctor.doc.mjs +1 -1
  20. package/api/doctor/doctor.mjs +156 -11
  21. package/api/doctor/theme-checks.mjs +163 -18
  22. package/api/icon/_adapter.d.mts +7 -3
  23. package/api/icon/_adapter.mjs +12 -3
  24. package/api/icon/icon.type.d.mts +15 -0
  25. package/api/icon/icon.type.mjs +10 -3
  26. package/api/icon/iconUse.doc.mjs +19 -5
  27. package/api/icon/list/list.mjs +7 -1
  28. package/api/icon/use/use.d.mts +8 -5
  29. package/api/icon/use/use.mjs +95 -13
  30. package/api/init/run/run.mjs +1 -0
  31. package/api/integration/add-contribution.mjs +3 -3
  32. package/api/integration/pack-check.mjs +14 -8
  33. package/api/integration/validate-integration.mjs +1 -1
  34. package/api/search/_adapter.mjs +15 -16
  35. package/api/search/_entries.d.mts +2 -1
  36. package/api/search/_entries.mjs +28 -1
  37. package/api/swizzle/_moduleGraph.mjs +1 -1
  38. package/api/template/template.type.d.mts +6 -2
  39. package/api/template/template.type.mjs +2 -1
  40. package/api/theme/_adapter.d.mts +5 -2
  41. package/api/theme/_adapter.mjs +59 -14
  42. package/api/theme/_fork.mjs +1 -1
  43. package/api/theme/build/build.d.mts +120 -32
  44. package/api/theme/build/build.mjs +471 -111
  45. package/api/theme/eject/eject.mjs +22 -1
  46. package/api/theme/generateTonalPalette.doc.mjs +2 -2
  47. package/api/theme/palette/generate/generator.mjs +141 -2
  48. package/api/theme/template/template.d.mts +19 -0
  49. package/api/theme/template/template.mjs +102 -25
  50. package/api/theme/theme.type.d.mts +44 -1
  51. package/api/theme/theme.type.mjs +23 -1
  52. package/api/theme/themeBuild.doc.mjs +4 -4
  53. package/api/theme/themeEject.doc.mjs +1 -1
  54. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  55. package/api/theme/themeTemplate.doc.mjs +9 -3
  56. package/api/theme-edit/_adapter.d.mts +33 -2
  57. package/api/theme-edit/_adapter.mjs +276 -41
  58. package/api/theme-edit/_check.d.mts +93 -4
  59. package/api/theme-edit/_check.mjs +1712 -223
  60. package/api/theme-edit/_color.d.mts +2 -8
  61. package/api/theme-edit/_color.mjs +292 -219
  62. package/api/theme-edit/_compiler.d.mts +1 -0
  63. package/api/theme-edit/_compiler.mjs +20 -1
  64. package/api/theme-edit/_context.d.mts +31 -1
  65. package/api/theme-edit/_context.mjs +445 -41
  66. package/api/theme-edit/_css.d.mts +60 -1
  67. package/api/theme-edit/_css.mjs +404 -28
  68. package/api/theme-edit/_edit.d.mts +25 -0
  69. package/api/theme-edit/_edit.mjs +1620 -154
  70. package/api/theme-edit/_how-commands.d.mts +11 -26
  71. package/api/theme-edit/_how-commands.mjs +30 -2
  72. package/api/theme-edit/_how-question.d.mts +15 -0
  73. package/api/theme-edit/_how-question.mjs +1469 -194
  74. package/api/theme-edit/_how.mjs +144 -30
  75. package/api/theme-edit/_marks.d.mts +13 -0
  76. package/api/theme-edit/_marks.mjs +15 -0
  77. package/api/theme-edit/_overview.mjs +2 -0
  78. package/api/theme-edit/_palette.d.mts +38 -0
  79. package/api/theme-edit/_palette.mjs +306 -73
  80. package/api/theme-edit/_parts.d.mts +33 -0
  81. package/api/theme-edit/_parts.mjs +138 -9
  82. package/api/theme-edit/_png.d.mts +18 -0
  83. package/api/theme-edit/_png.mjs +95 -14
  84. package/api/theme-edit/_preview-app.d.mts +55 -1
  85. package/api/theme-edit/_preview-app.mjs +1552 -101
  86. package/api/theme-edit/_preview.d.mts +71 -3
  87. package/api/theme-edit/_preview.mjs +565 -35
  88. package/api/theme-edit/_project.d.mts +15 -0
  89. package/api/theme-edit/_project.mjs +68 -13
  90. package/api/theme-edit/_settings.d.mts +299 -5
  91. package/api/theme-edit/_settings.mjs +2806 -158
  92. package/api/theme-edit/_tables.d.mts +24 -0
  93. package/api/theme-edit/_tables.mjs +212 -150
  94. package/api/theme-edit/_vet.d.mts +42 -0
  95. package/api/theme-edit/_vet.mjs +144 -0
  96. package/api/theme-edit/theme-edit.type.d.mts +31 -2
  97. package/api/theme-edit/theme-edit.type.mjs +10 -2
  98. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  99. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  100. package/api/theme-edit/themeEditShow.doc.mjs +11 -3
  101. package/api/upgrade/registry/registry.mjs +6 -1
  102. package/assets/codemods/parse.mjs +2 -2
  103. package/assets/docs/author-a-theme.doc.mjs +1 -1
  104. package/assets/docs/theme.doc.dense.mjs +1 -1
  105. package/assets/docs/theme.doc.mjs +1 -1
  106. package/assets/docs/theme.doc.zh.mjs +4 -3
  107. package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
  108. package/assets/docs/tree/icon-sets.doc.mjs +63 -8
  109. package/assets/docs/tree/single-component.doc.mjs +11 -2
  110. package/assets/docs/tree/tokens-and-setup.doc.mjs +39 -3
  111. package/assets/docs.generated.json +2 -2
  112. package/assets/preview-app/next.config.mjs +7 -1
  113. package/assets/preview-app/package.json +1 -0
  114. package/assets/preview-app/src/app/globals.css +1 -0
  115. package/assets/self-audit.generated.json +1 -1
  116. package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.doc.mjs +21 -0
  117. package/assets/templates/blocks/components/Outline/useOutlineFromDOMHookUsage.tsx +62 -0
  118. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.doc.mjs +14 -0
  119. package/assets/templates/blocks/components/Table/ColumnsVirtualizationHookUsage.tsx +53 -0
  120. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.doc.mjs +14 -0
  121. package/assets/templates/blocks/components/Table/InfiniteScrollHookUsage.tsx +33 -0
  122. package/assets/templates/components.generated.json +1 -1
  123. package/assets/templates/pages/ai-chat/page.tsx +20 -2
  124. package/assets/templates/pages/dashboard/page.tsx +1 -1
  125. package/assets/templates/themes/neutral/neutralPalettes.generated.receipt.json +2 -0
  126. package/authoring/config/config.doc.mjs +8 -0
  127. package/authoring/config/parse.d.mts +1 -0
  128. package/authoring/config/parse.mjs +12 -0
  129. package/authoring/config/type.ts +8 -0
  130. package/authoring/doctypes/_schema.d.mts +52 -5
  131. package/authoring/doctypes/_schema.mjs +62 -7
  132. package/authoring/doctypes/base/type.ts +10 -0
  133. package/authoring/doctypes/component/component.doc.mjs +1 -1
  134. package/authoring/doctypes/function/function.doc.mjs +6 -0
  135. package/authoring/doctypes/function/type.ts +3 -0
  136. package/authoring/doctypes/icon-set/icon-set-data.doc.mjs +3 -3
  137. package/authoring/doctypes/legacy.mjs +5 -1
  138. package/authoring/index.d.ts +1 -0
  139. package/authoring/shadcn/source-variants.d.mts +1 -1
  140. package/authoring/shadcn/source-variants.mjs +32 -10
  141. package/clients/cli/build-id.generated.json +1 -1
  142. package/clients/cli/commands/doctor.doc.mjs +2 -2
  143. package/clients/cli/commands/experimental/icon.mjs +61 -6
  144. package/clients/cli/commands/experimental/theme.mjs +244 -45
  145. package/clients/cli/commands/experimental-icon-use.doc.mjs +12 -5
  146. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  147. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +2 -2
  148. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
  149. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +3 -3
  150. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
  151. package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
  152. package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -1
  153. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  154. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  155. package/clients/cli/commands/experimental-theme-template.doc.mjs +2 -2
  156. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  157. package/clients/cli/commands/theme-eject.doc.mjs +1 -1
  158. package/clients/cli/commands/theme-template.doc.mjs +3 -1
  159. package/clients/cli/commands/theme.doc.mjs +7 -2
  160. package/clients/cli/commands/theme.mjs +222 -55
  161. package/clients/cli/commands.generated.json +1 -1
  162. package/clients/cli/formatters/index.mjs +7 -4
  163. package/clients/cli/index.mjs +25 -5
  164. package/clients/cli/lib/cli-error.mjs +9 -3
  165. package/clients/cli/lib/component-format.mjs +27 -9
  166. package/clients/cli/lib/json-shim.mjs +72 -2
  167. package/clients/cli/manifest.generated.json +1 -1
  168. package/clients/cli/run.mjs +49 -0
  169. package/foundation/agent-docs/agent-docs-target.d.mts +2 -6
  170. package/foundation/agent-docs/agent-docs-target.mjs +9 -17
  171. package/foundation/agent-docs/agent-docs.mjs +4 -3
  172. package/foundation/config/config-writer.d.mts +23 -0
  173. package/foundation/config/config-writer.mjs +152 -58
  174. package/foundation/config/project.mjs +103 -16
  175. package/foundation/discovery/component-discovery.mjs +11 -22
  176. package/foundation/discovery/icon-set-checks.mjs +164 -48
  177. package/foundation/discovery/icon-set-discovery.d.mts +38 -5
  178. package/foundation/discovery/icon-set-discovery.mjs +50 -6
  179. package/foundation/discovery/icon-set-theme-maps.d.mts +59 -0
  180. package/foundation/discovery/icon-set-theme-maps.mjs +95 -0
  181. package/foundation/discovery/icon-set-writer.d.mts +2 -3
  182. package/foundation/discovery/icon-set-writer.mjs +58 -17
  183. package/foundation/discovery/module-exports.mjs +1 -15
  184. package/foundation/discovery/template-adapter.mjs +44 -19
  185. package/foundation/discovery/template-icons.d.mts +27 -10
  186. package/foundation/discovery/template-icons.mjs +142 -26
  187. package/foundation/discovery/template-source-tree.mjs +3 -16
  188. package/foundation/discovery/theme-discovery.d.mts +30 -1
  189. package/foundation/discovery/theme-discovery.mjs +109 -50
  190. package/foundation/fs/exact-codec.d.mts +35 -0
  191. package/foundation/fs/exact-codec.mjs +148 -0
  192. package/foundation/fs/gather-cache.d.mts +15 -5
  193. package/foundation/fs/gather-cache.mjs +129 -31
  194. package/foundation/fs/paths.d.mts +39 -0
  195. package/foundation/fs/paths.mjs +44 -11
  196. package/foundation/fs/read-record.mjs +11 -1
  197. package/foundation/integrations/autolink.d.mts +4 -2
  198. package/foundation/integrations/autolink.mjs +4 -2
  199. package/foundation/integrations/cli-requirement.d.mts +16 -5
  200. package/foundation/integrations/cli-requirement.mjs +27 -6
  201. package/foundation/integrations/contribution-fixes.mjs +1 -16
  202. package/foundation/integrations/may-have-integrations.mjs +7 -3
  203. package/foundation/integrations/missing-dependency.d.mts +9 -0
  204. package/foundation/integrations/missing-dependency.mjs +100 -0
  205. package/foundation/integrations/public-imports.mjs +1 -1
  206. package/foundation/render/embedded-imports.mjs +1 -1
  207. package/foundation/render/host-exit.d.mts +8 -0
  208. package/foundation/render/host-exit.mjs +11 -0
  209. package/foundation/render/page-host.mjs +56 -10
  210. package/foundation/render/page-worker.mjs +14 -0
  211. package/foundation/render/render-page.mjs +37 -2
  212. package/foundation/response/error-codes.d.mts +2 -1
  213. package/foundation/response/error-codes.d.ts +1 -0
  214. package/foundation/response/error-codes.doc.mjs +5 -0
  215. package/foundation/response/error-codes.mjs +3 -0
  216. package/foundation/response/json.d.mts +15 -0
  217. package/foundation/response/json.mjs +52 -1
  218. package/foundation/response/response-types.doc.mjs +1 -1
  219. package/foundation/runtime/lazy-dependencies.d.mts +14 -0
  220. package/foundation/runtime/lazy-dependencies.mjs +82 -0
  221. package/foundation/xle/browser.d.mts +2 -2
  222. package/package.json +7 -6
@@ -39,6 +39,7 @@ import {DropdownMenu} from '@astryxdesign/core/DropdownMenu';
39
39
  import {MoreMenu} from '@astryxdesign/core/MoreMenu';
40
40
  import {Toolbar} from '@astryxdesign/core/Toolbar';
41
41
  import {useResizable, ResizeHandle} from '@astryxdesign/core/Resizable';
42
+ import {rtlStyles} from '@astryxdesign/core/utils';
42
43
 
43
44
  import {
44
45
  DocumentTextIcon,
@@ -92,6 +93,11 @@ const AI_CHAT_CSS = `
92
93
  .ai-chat-resize-handle {
93
94
  display: flex;
94
95
  }
96
+ /* The scrollbar ends where the handle's grab zone begins, so the zone
97
+ never covers it. */
98
+ .ai-chat-column-beside-handle {
99
+ padding-inline-end: var(--spacing-2);
100
+ }
95
101
  .ai-chat-artifact-panel {
96
102
  overflow: hidden;
97
103
  display: flex;
@@ -103,6 +109,9 @@ const AI_CHAT_CSS = `
103
109
  .ai-chat-resize-handle {
104
110
  display: none;
105
111
  }
112
+ .ai-chat-column-beside-handle {
113
+ padding-inline-end: 0;
114
+ }
106
115
  .ai-chat-artifact-panel {
107
116
  display: none;
108
117
  width: 100%;
@@ -260,7 +269,12 @@ function ArtifactCard({onOpen}: {onOpen: () => void}) {
260
269
  </Text>
261
270
  </VStack>
262
271
  </StackItem>
263
- <Icon icon={ChevronRightIcon} size="sm" color="secondary" />
272
+ <Icon
273
+ icon={ChevronRightIcon}
274
+ size="sm"
275
+ color="secondary"
276
+ xstyle={rtlStyles.mirror}
277
+ />
264
278
  </HStack>
265
279
  </ClickableCard>
266
280
  );
@@ -300,7 +314,11 @@ export default function AIChatConversationTemplate() {
300
314
  <LayoutContent padding={0}>
301
315
  <HStack height="100%">
302
316
  {/* Chat column — flexes to fill the space the artifact leaves */}
303
- <VStack style={chatColumn}>
317
+ <VStack
318
+ style={chatColumn}
319
+ className={
320
+ isArtifactOpen ? 'ai-chat-column-beside-handle' : undefined
321
+ }>
304
322
  <ChatLayout
305
323
  density="spacious"
306
324
  style={chatLayout}
@@ -753,7 +753,7 @@ export default function DashboardTemplate() {
753
753
  <MetricCard
754
754
  key={m.label}
755
755
  {...m}
756
- sparkline={sparklines[start + i]}
756
+ sparkline={sparklines[start + i] ?? []}
757
757
  />
758
758
  ))}
759
759
  </Grid>
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "recipe": "astryx-oklch-v1",
4
+ "generatorVersion": "palette-generator-v1",
5
+ "candidateFormatVersion": "palette-typescript-v1",
4
6
  "candidateSha256": "a9b186bd7aaffafe34bfabd5b76116115cf667e91066e59ff8f11bcdaaee69bf",
5
7
  "request": {
6
8
  "recipe": "astryx-oklch-v1",
@@ -83,6 +83,14 @@ export const doc = {
83
83
  "Experimental: may change or be removed in a patch release. The project's main icon set, by set name or as `<package>/<set>`; or a list of them, the main set first and then backup sets in order. A copied template takes each icon from the first set in the list that has its meaning, and draws a placeholder the copied file declares when none has it. It is the opt-in: copied templates use these icons, and `astryx discover` and `astryx doctor` report icon sets, only when it is set. `astryx experimental icon use <main> --backup <set>` writes it. `astryx experimental icon` ranks the main set's icons first; without it, the only installed set is the project's there. `astryx search` never returns icons.",
84
84
  example: "['@acme/outline-icons/outline', '@acme/brand-icons/brand']",
85
85
  },
86
+ {
87
+ name: 'experimental.iconVariant',
88
+ type: 'string',
89
+ stability: 'experimental',
90
+ description:
91
+ "Experimental: may change or be removed in a patch release. The look every icon of the project draws, such as `outline` or `filled`, by the variant name the icon sets declare. Each set in `experimental.iconSet` that declares a variant of that name draws it: copied templates import that variant's icons, and a theme takes that look's theme map (`themeIconsFilled`). A set that declares no variant of that name draws its default look. The main set must declare it, and it needs `experimental.iconSet`. `astryx experimental icon use <main> --variant <variant>` writes it; without `--variant` that command removes it.",
92
+ example: "'filled'",
93
+ },
86
94
  {
87
95
  name: 'experimental.xle.components',
88
96
  type: 'Record<string, XleComponent>',
@@ -59,6 +59,7 @@ declare const configSchema: z.ZodObject<{
59
59
  }, z.core.$strict>>>;
60
60
  }, z.core.$strict>>;
61
61
  iconSet: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
62
+ iconVariant: z.ZodOptional<z.ZodString>;
62
63
  }, z.core.$strict>>;
63
64
  }, z.core.$strict>;
64
65
  export {};
@@ -106,8 +106,20 @@ const configSchema = z
106
106
  iconSet: z
107
107
  .union([z.string().min(1), z.array(z.string().min(1)).min(1)])
108
108
  .optional(),
109
+ iconVariant: z.string().min(1).optional(),
109
110
  })
110
111
  .strict()
112
+ // The variant is the look of the sets `iconSet` names, so it needs them.
113
+ .superRefine((value, ctx) => {
114
+ if (value.iconVariant !== undefined && value.iconSet === undefined) {
115
+ ctx.addIssue({
116
+ code: 'custom',
117
+ path: ['iconVariant'],
118
+ message:
119
+ 'iconVariant is the look of the icon sets experimental.iconSet names: set experimental.iconSet too (`astryx experimental icon use <set> --variant <variant>` writes both)',
120
+ });
121
+ }
122
+ })
111
123
  .optional(),
112
124
  })
113
125
  .strict();
@@ -132,5 +132,13 @@ export interface AstryxConfig {
132
132
  * @experimental May change or be removed in a patch release.
133
133
  */
134
134
  iconSet?: string | string[];
135
+ /**
136
+ * Experimental icon variant: the look every icon of the project draws,
137
+ * by the name the sets declare (`"filled"`). Each set in `iconSet` that
138
+ * declares a variant of that name draws it; a set that does not draws
139
+ * its default look. The main set must declare it. Needs `iconSet`.
140
+ * @experimental May change or be removed in a patch release.
141
+ */
142
+ iconVariant?: string;
135
143
  };
136
144
  }
@@ -207,6 +207,26 @@ export const NamespaceContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
207
207
  full: "full";
208
208
  }>>;
209
209
  }, z.core.$strict>], "type">;
210
+ /**
211
+ * The example fields of any doc, checked before the permissive legacy union so
212
+ * a bad `kind` fails with its own message, not as a union mismatch.
213
+ */
214
+ export const DocExampleKindsSchema: z.ZodObject<{
215
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
216
+ kind: z.ZodOptional<z.ZodEnum<{
217
+ setup: "setup";
218
+ demo: "demo";
219
+ }>>;
220
+ }, z.core.$loose>>>;
221
+ components: z.ZodOptional<z.ZodArray<z.ZodObject<{
222
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
223
+ kind: z.ZodOptional<z.ZodEnum<{
224
+ setup: "setup";
225
+ demo: "demo";
226
+ }>>;
227
+ }, z.core.$loose>>>;
228
+ }, z.core.$loose>>>;
229
+ }, z.core.$loose>;
210
230
  /**
211
231
  * New-format stamped component doc (`type: 'component'`): one component's
212
232
  * `props`, or the `components` a group doc documents together. These are the
@@ -217,7 +237,12 @@ export const ComponentDocKindSchema: z.ZodObject<{
217
237
  type: z.ZodLiteral<"component">;
218
238
  theming: z.ZodOptional<z.ZodUnknown>;
219
239
  playground: z.ZodOptional<z.ZodUnknown>;
220
- examples: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
240
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
241
+ kind: z.ZodOptional<z.ZodEnum<{
242
+ setup: "setup";
243
+ demo: "demo";
244
+ }>>;
245
+ }, z.core.$loose>>>;
221
246
  replaces: z.ZodOptional<z.ZodString>;
222
247
  deprecated: z.ZodOptional<z.ZodObject<{
223
248
  replacement: z.ZodString;
@@ -255,6 +280,12 @@ export const ComponentDocKindSchema: z.ZodObject<{
255
280
  }, z.core.$loose>>>;
256
281
  components: z.ZodOptional<z.ZodArray<z.ZodObject<{
257
282
  name: z.ZodString;
283
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
284
+ kind: z.ZodOptional<z.ZodEnum<{
285
+ setup: "setup";
286
+ demo: "demo";
287
+ }>>;
288
+ }, z.core.$loose>>>;
258
289
  }, z.core.$loose>>>;
259
290
  }, z.core.$loose>;
260
291
  /** New-format stamped function doc (`type: 'function'`). */
@@ -272,6 +303,15 @@ export const FunctionDocKindSchema: z.ZodObject<{
272
303
  type: z.ZodString;
273
304
  description: z.ZodString;
274
305
  }, z.core.$loose>>;
306
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
307
+ label: z.ZodOptional<z.ZodString>;
308
+ code: z.ZodString;
309
+ result: z.ZodOptional<z.ZodString>;
310
+ kind: z.ZodOptional<z.ZodEnum<{
311
+ setup: "setup";
312
+ demo: "demo";
313
+ }>>;
314
+ }, z.core.$loose>>>;
275
315
  name: z.ZodString;
276
316
  displayName: z.ZodOptional<z.ZodString>;
277
317
  description: z.ZodOptional<z.ZodString>;
@@ -981,6 +1021,7 @@ export type ReferenceSection = import("./reference/type.js").ReferenceSection;
981
1021
  export type ReferenceDoc = import("./reference/type.js").ReferenceDoc;
982
1022
  export type SingleComponentDoc = import("./component/type.js").SingleComponentDoc;
983
1023
  export type ComponentPropDoc = import("./base/type.js").ComponentPropDoc;
1024
+ export type ExampleKind = import("./base/type.js").ExampleKind;
984
1025
  export type HookDoc = import("./hook/type.js").HookDoc;
985
1026
  export type FunctionDoc = import("./function/type.js").FunctionDoc;
986
1027
  export type SchemaDoc = import("./schema/type.js").SchemaDoc;
@@ -994,9 +1035,10 @@ export type _SectionContentBlockDriftLock = import("../_shared/contract.js").Exp
994
1035
  /**
995
1036
  * A stamped component doc as it loads. The loader accepts what the unstamped
996
1037
  * format always accepted, so stamping an existing doc never breaks it:
997
- * `displayName` may be missing, `category` is any string, `usage`, `theming`,
998
- * `playground` and `examples` pass through unchecked, and a doc has `props`,
999
- * `components`, or both; each `components` entry needs only a `name`. Every
1038
+ * `displayName` may be missing, `category` is any string, `usage`, `theming`
1039
+ * and `playground` pass through unchecked, an example is checked only for its
1040
+ * `kind`, and a doc has `props`, `components`, or both; each `components` entry
1041
+ * needs only a `name`. Every
1000
1042
  * other field matches the published type.
1001
1043
  */
1002
1044
  export type LoadedComponentDoc = Omit<SingleComponentDoc, "type" | "displayName" | "category" | "usage" | "theming" | "examples" | "playground" | "props"> & {
@@ -1005,11 +1047,16 @@ export type LoadedComponentDoc = Omit<SingleComponentDoc, "type" | "displayName"
1005
1047
  category?: string;
1006
1048
  usage?: unknown;
1007
1049
  theming?: unknown;
1008
- examples?: unknown[];
1050
+ examples?: Array<{
1051
+ kind?: ExampleKind;
1052
+ }>;
1009
1053
  playground?: unknown;
1010
1054
  props?: ComponentPropDoc[];
1011
1055
  components?: Array<{
1012
1056
  name: string;
1057
+ examples?: Array<{
1058
+ kind?: ExampleKind;
1059
+ }>;
1013
1060
  }>;
1014
1061
  };
1015
1062
  export type _ComponentDocDriftLock = import("../_shared/contract.js").Expect<import("../_shared/contract.js").MutuallyAssignable<import("../_shared/contract.js").NamedFields<z.infer<typeof ComponentDocKindSchema>>, import("../_shared/contract.js").NamedFields<LoadedComponentDoc>>>;
@@ -20,6 +20,7 @@ import {z} from 'zod';
20
20
  /** @typedef {import('./reference/type.js').ReferenceDoc} ReferenceDoc */
21
21
  /** @typedef {import('./component/type.js').SingleComponentDoc} SingleComponentDoc */
22
22
  /** @typedef {import('./base/type.js').ComponentPropDoc} ComponentPropDoc */
23
+ /** @typedef {import('./base/type.js').ExampleKind} ExampleKind */
23
24
  /** @typedef {import('./hook/type.js').HookDoc} HookDoc */
24
25
  /** @typedef {import('./function/type.js').FunctionDoc} FunctionDoc */
25
26
  /** @typedef {import('./schema/type.js').SchemaDoc} SchemaDoc */
@@ -290,6 +291,43 @@ const ReturnSchema = z
290
291
  })
291
292
  .passthrough();
292
293
 
294
+ /** Every example kind, in the order the docs list them. */
295
+ const EXAMPLE_KINDS = /** @type {const} */ (['demo', 'setup']);
296
+
297
+ /**
298
+ * An example's `kind`. The message names both values and what each one does,
299
+ * because an author who misspells it needs to pick again.
300
+ */
301
+ const ExampleKindSchema = z.enum(EXAMPLE_KINDS, {
302
+ error: issue =>
303
+ `unknown example kind ${JSON.stringify(issue.input)}; use 'demo' (may render as a live preview) or 'setup' (code only)`,
304
+ });
305
+
306
+ /**
307
+ * One component example as it loads. Only `kind` is checked: the rest passes
308
+ * through unchecked, as component examples always have.
309
+ */
310
+ const ComponentExampleSchema = z
311
+ .object({kind: ExampleKindSchema.optional()})
312
+ .passthrough();
313
+
314
+ /**
315
+ * The example fields of any doc, checked before the permissive legacy union so
316
+ * a bad `kind` fails with its own message, not as a union mismatch.
317
+ */
318
+ export const DocExampleKindsSchema = z
319
+ .object({
320
+ examples: z.array(ComponentExampleSchema).optional(),
321
+ components: z
322
+ .array(
323
+ z
324
+ .object({examples: z.array(ComponentExampleSchema).optional()})
325
+ .passthrough(),
326
+ )
327
+ .optional(),
328
+ })
329
+ .passthrough();
330
+
293
331
  const BaseDocFields = {
294
332
  ...AuthoredDocGraphFields,
295
333
  name: z.string().min(1, 'name is required'),
@@ -323,7 +361,7 @@ const ComponentBaseSchema = z
323
361
  type: z.literal('component'),
324
362
  theming: z.unknown().optional(),
325
363
  playground: z.unknown().optional(),
326
- examples: z.array(z.unknown()).optional(),
364
+ examples: z.array(ComponentExampleSchema).optional(),
327
365
  replaces: z.string().min(1).optional(),
328
366
  deprecated: ComponentDeprecationSchema.optional(),
329
367
  })
@@ -335,7 +373,10 @@ const ComponentBaseSchema = z
335
373
  * is checked here; the rest passes through, as on an unstamped doc.
336
374
  */
337
375
  const ComponentGroupEntrySchema = z
338
- .object({name: z.string().min(1, 'component name is required')})
376
+ .object({
377
+ name: z.string().min(1, 'component name is required'),
378
+ examples: z.array(ComponentExampleSchema).optional(),
379
+ })
339
380
  .passthrough();
340
381
 
341
382
  /**
@@ -361,16 +402,18 @@ export const ComponentDocKindSchema = ComponentBaseSchema.extend({
361
402
  /**
362
403
  * A stamped component doc as it loads. The loader accepts what the unstamped
363
404
  * format always accepted, so stamping an existing doc never breaks it:
364
- * `displayName` may be missing, `category` is any string, `usage`, `theming`,
365
- * `playground` and `examples` pass through unchecked, and a doc has `props`,
366
- * `components`, or both; each `components` entry needs only a `name`. Every
405
+ * `displayName` may be missing, `category` is any string, `usage`, `theming`
406
+ * and `playground` pass through unchecked, an example is checked only for its
407
+ * `kind`, and a doc has `props`, `components`, or both; each `components` entry
408
+ * needs only a `name`. Every
367
409
  * other field matches the published type.
368
410
  *
369
411
  * @typedef {Omit<SingleComponentDoc,
370
412
  * 'type' | 'displayName' | 'category' | 'usage' | 'theming' | 'examples' | 'playground' | 'props'>
371
413
  * & {type: 'component', displayName?: string, category?: string, usage?: unknown,
372
- * theming?: unknown, examples?: unknown[], playground?: unknown,
373
- * props?: ComponentPropDoc[], components?: Array<{name: string}>}} LoadedComponentDoc
414
+ * theming?: unknown, examples?: Array<{kind?: ExampleKind}>, playground?: unknown,
415
+ * props?: ComponentPropDoc[],
416
+ * components?: Array<{name: string, examples?: Array<{kind?: ExampleKind}>}>}} LoadedComponentDoc
374
417
  */
375
418
  /**
376
419
  * @typedef {import('../_shared/contract.js').Expect<
@@ -397,6 +440,18 @@ export const FunctionDocKindSchema = z
397
440
  type: z.literal('function'),
398
441
  params: z.array(ParamSchema),
399
442
  returns: z.array(FunctionReturnSchema),
443
+ examples: z
444
+ .array(
445
+ z
446
+ .object({
447
+ label: z.string().optional(),
448
+ code: z.string(),
449
+ result: z.string().optional(),
450
+ kind: ExampleKindSchema.optional(),
451
+ })
452
+ .passthrough(),
453
+ )
454
+ .optional(),
400
455
  })
401
456
  .passthrough();
402
457
 
@@ -223,6 +223,14 @@ export interface ComponentAccessibilityThemeCoverage {
223
223
  notMeasured?: string[];
224
224
  }
225
225
 
226
+ /**
227
+ * What an example is for. A `demo` example runs on its own, so a docs site may
228
+ * render it as a live preview. A `setup` example is code to read and copy, such
229
+ * as an app setup file, a server route, or a snippet that uses variables
230
+ * defined elsewhere; it is always shown as code only.
231
+ */
232
+ export type ExampleKind = 'demo' | 'setup';
233
+
226
234
  /**
227
235
  * Code example for a component or sub-component.
228
236
  */
@@ -231,6 +239,8 @@ export interface ComponentExampleDoc {
231
239
  label?: string;
232
240
  /** TSX source for the example. */
233
241
  code: string;
242
+ /** `demo` (default) may render as a live preview; `setup` is code only. */
243
+ kind?: ExampleKind;
234
244
  }
235
245
 
236
246
  /**
@@ -181,7 +181,7 @@ export const doc = {
181
181
  name: 'examples',
182
182
  type: 'ComponentExampleDoc[]',
183
183
  description:
184
- 'Short code examples ({label?, code}) rendered by the CLI after the props table.',
184
+ "Short code examples ({label?, code, kind?}) rendered by the CLI after the props table. `kind` is `'demo'` (the default; it may render as a live preview) or `'setup'` (shown as code, never rendered live).",
185
185
  },
186
186
  {
187
187
  name: 'playground',
@@ -186,6 +186,12 @@ export const doc = {
186
186
  type: 'string',
187
187
  description: 'Optional sample result.',
188
188
  },
189
+ {
190
+ name: 'examples[].kind',
191
+ type: "'demo' | 'setup'",
192
+ description:
193
+ "`'demo'` (the default) may render as a live preview; `'setup'` is shown as code, never rendered live.",
194
+ },
189
195
  ],
190
196
  },
191
197
  {
@@ -12,6 +12,7 @@
12
12
 
13
13
  import type {
14
14
  AuthoredDocGraphFields,
15
+ ExampleKind,
15
16
  HookParamDoc,
16
17
  UsageDoc,
17
18
  } from '../base/type.js';
@@ -41,6 +42,8 @@ export interface FunctionExampleDoc {
41
42
  code: string;
42
43
  /** Optional sample result. */
43
44
  result?: string;
45
+ /** `demo` (default) may render as a live preview; `setup` is code only. */
46
+ kind?: ExampleKind;
44
47
  }
45
48
 
46
49
  /**
@@ -61,8 +61,8 @@ export const doc = {
61
61
  name: 'variants',
62
62
  type: 'string[]',
63
63
  description:
64
- 'The named looks the set offers, in lower-kebab case, such as `outline` and `solid`. Icon size is never a variant: CSS sets it. Omit it when the set has one look.',
65
- example: "['outline', 'solid']",
64
+ "The named looks the set offers, in lower-kebab case, such as `outline` and `filled`. Icon size is never a variant: CSS sets it. Omit it when the set has one look. A project's `experimental.iconVariant` names one of these, so call each look what it draws rather than the library's word for it.",
65
+ example: "['outline', 'filled']",
66
66
  },
67
67
  {
68
68
  name: 'default',
@@ -75,7 +75,7 @@ export const doc = {
75
75
  name: 'themeMap',
76
76
  type: 'string',
77
77
  description:
78
- 'The export that maps each built-in icon definition to its artwork, keyed by exactly the built-in definitions in `map`.',
78
+ "The export that maps each built-in icon definition to its artwork, keyed by exactly the built-in definitions in `map`. When it is `themeIcons`, the generated module writes it, and beside it one map for each other variant an icon draws, `themeIcons<Variant>` (`themeIconsFilled`), whose entries draw that variant, or an icon's own export when it has none.",
79
79
  example: "'themeIcons'",
80
80
  },
81
81
  {
@@ -7,7 +7,7 @@
7
7
  * stamped `type`.
8
8
  */
9
9
 
10
- import {LegacyDocSchema} from './_schema.mjs';
10
+ import {DocExampleKindsSchema, LegacyDocSchema} from './_schema.mjs';
11
11
  import {formatZodError} from '../_shared/errors.mjs';
12
12
 
13
13
  /** @typedef {import('./types.js').ComponentDoc} ComponentDoc */
@@ -22,6 +22,10 @@ import {formatZodError} from '../_shared/errors.mjs';
22
22
  * @returns {ComponentDoc | HookDoc | ReferenceDoc}
23
23
  */
24
24
  export function parseLegacyDoc(input, label = 'doc') {
25
+ const kinds = DocExampleKindsSchema.safeParse(input);
26
+ if (!kinds.success) {
27
+ throw new Error(formatZodError(label, kinds.error));
28
+ }
25
29
  const result = LegacyDocSchema.safeParse(input);
26
30
  if (!result.success) {
27
31
  throw new Error(formatZodError(label, result.error));
@@ -123,6 +123,7 @@ export type {
123
123
  ComponentTranslationDoc,
124
124
  ComponentPropDoc,
125
125
  ComponentExampleDoc,
126
+ ExampleKind,
126
127
  ComponentAnatomyElement,
127
128
  ComponentAccessibilityRequirement,
128
129
  ComponentAccessibilityThemeStatus,
@@ -18,7 +18,7 @@ export function shadcnPrecompiledDeclarationTarget(sourceTarget: string): string
18
18
  * chunks from the shadcn package.
19
19
  * @param {string} source
20
20
  */
21
- export function transformShadcnJavaScriptSource(source: string): string;
21
+ export function transformShadcnJavaScriptSource(source: string): any;
22
22
  /**
23
23
  * Recognize printer-only JavaScript differences without hiding code or comment
24
24
  * edits. This protects receipts from compatible ShadCN formatter drift.
@@ -7,16 +7,38 @@
7
7
  * @position Shared compatibility boundary for generated receipt variants and upgrades.
8
8
  */
9
9
 
10
- import {transformFromAstSync} from '@babel/core';
11
- import {parse} from '@babel/parser';
12
10
  import {createRequire} from 'node:module';
13
11
  import * as path from 'node:path';
14
- import * as recast from 'recast';
15
12
 
13
+ // Babel and recast load on first use, not with this module: everything that
14
+ // imports the CLI's API reaches it, and most runs never transform a source.
15
+ // (The same packages foundation/runtime/lazy-dependencies.mjs loads, which
16
+ // authoring/ may not import; each resolves to one file either way.)
16
17
  const require = createRequire(import.meta.url);
17
- /** @type {import('@babel/core').PluginItem} */
18
- const transformTypeScript =
19
- require('@babel/plugin-transform-typescript').default;
18
+ // Resolved, not loaded: a missing package fails here, at import.
19
+ for (const pkg of [
20
+ '@babel/core',
21
+ '@babel/parser',
22
+ 'recast',
23
+ '@babel/plugin-transform-typescript',
24
+ ]) {
25
+ require.resolve(pkg);
26
+ }
27
+ /** @type {typeof import('@babel/core') | undefined} */
28
+ let babelCore;
29
+ /** @type {typeof import('@babel/parser') | undefined} */
30
+ let babelParser;
31
+ /** @type {typeof import('recast') | undefined} */
32
+ let recastModule;
33
+ /** @type {import('@babel/core').PluginItem | undefined} */
34
+ let typeScriptPlugin;
35
+ const babel = () => (babelCore ??= require('@babel/core'));
36
+ /** @type {typeof import('@babel/parser').parse} */
37
+ const parse = (input, options) =>
38
+ (babelParser ??= require('@babel/parser')).parse(input, options);
39
+ const recast = () => (recastModule ??= require('recast'));
40
+ const transformTypeScript = () =>
41
+ (typeScriptPlugin ??= require('@babel/plugin-transform-typescript').default);
20
42
 
21
43
  /** @type {import('@babel/parser').ParserOptions} */
22
44
  const SHADCN_PARSER_OPTIONS = {
@@ -105,23 +127,23 @@ export function shadcnPrecompiledDeclarationTarget(sourceTarget) {
105
127
  * @param {string} source
106
128
  */
107
129
  export function transformShadcnJavaScriptSource(source) {
108
- const ast = recast.parse(source, {
130
+ const ast = recast().parse(source, {
109
131
  parser: {
110
132
  /** @param {string} input */
111
133
  parse: input => parse(input, SHADCN_PARSER_OPTIONS),
112
134
  },
113
135
  });
114
- const transformed = transformFromAstSync(ast, source, {
136
+ const transformed = babel().transformFromAstSync(ast, source, {
115
137
  cloneInputAst: false,
116
138
  code: false,
117
139
  ast: true,
118
- plugins: [transformTypeScript],
140
+ plugins: [transformTypeScript()],
119
141
  configFile: false,
120
142
  });
121
143
  if (!transformed?.ast) {
122
144
  throw new Error('ShadCN JavaScript transform produced no AST');
123
145
  }
124
- return recast.print(transformed.ast).code;
146
+ return recast().print(transformed.ast).code;
125
147
  }
126
148
 
127
149
  /**
@@ -1 +1 @@
1
- {"id":"55cd1168a93331c6c988c853d3f54e3616cc44e464e722005f051d0b646116af"}
1
+ {"id":"1e11e8602f0ddba6f93a8e681b4003c7eeb503498a8e2da463cab4ec90b448dd"}
@@ -15,10 +15,10 @@ export const doc = {
15
15
  namespace: 'cli/commands',
16
16
  summary: 'Diagnose Astryx projects and integration packages',
17
17
  description:
18
- 'Runs read-only project health diagnostics by default: Node version, @astryxdesign/core ' +
18
+ 'Runs project health diagnostics by default: Node version, @astryxdesign/core ' +
19
19
  'install and version alignment, theme packages, generated app themes when present, earlier copied-theme migration, config, integrations (every one astryx.config names must load, linked without a config entry, ' +
20
20
  'provider identity, contribution issues), agent docs, core peer dependencies, package manager, ' +
21
- "the docs the CLI reads, the newest release the computer knows of, with the install and upgrade commands when the project's release is older, and every `astryx` command on the search path, warning when the first one is not the Astryx CLI or predates the hand-off. It writes nothing, but loading astryx.config runs that file's code. " +
21
+ "the docs the CLI reads, the newest release the computer knows of, with the install and upgrade commands when the project's release is older, and every `astryx` command on the search path, warning when the first one is not the Astryx CLI or predates the hand-off. Loading astryx.config runs that file's code. " +
22
22
  'The `integration` subcommands provide authoring checks for one integration package. ' +
23
23
  'Outside a project it checks the computer instead: the Node version, the release that answered, ' +
24
24
  "the newest release this computer knows of, with the command that upgrades the CLI installed for the computer when it is older, the astryx commands on the search path, the integrations installed for the computer (warning about one it skips), and whether the computer-level agent text (`{@command init --user}`) is present, matches this release, was edited, or is turned off (info only); when that text names `astryx` and no `astryx` command is on the search path, apart from a package runner's own copy, it says so and names the install step the text records, or npm's when it records none. " +