@astryxdesign/cli 0.7.2-canary.c9f2659 → 0.7.2-canary.cbb7fa3

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 (72) hide show
  1. package/api/component/_adapter.d.mts +41 -1
  2. package/api/component/_adapter.mjs +93 -7
  3. package/api/component/component.mjs +22 -5
  4. package/api/component/component.test.mjs +420 -167
  5. package/api/component/integration-export-name.test.mjs +644 -0
  6. package/api/component/list/list.mjs +42 -4
  7. package/api/gap-report/gap-report.mjs +67 -4
  8. package/api/integration/add-contribution.component-names.test.mjs +66 -0
  9. package/api/integration/add-contribution.mjs +7 -3
  10. package/api/integration/pack-check.mjs +61 -107
  11. package/api/integration/pack-check.test.mjs +359 -0
  12. package/api/search/search.d.mts +9 -0
  13. package/api/search/search.mjs +108 -16
  14. package/api/search/search.test.mjs +36 -0
  15. package/api/swizzle/copy/copy.mjs +28 -14
  16. package/api/template/template.test.mjs +120 -3
  17. package/api/theme/build/build.family.test.mjs +16 -0
  18. package/api/theme/build/build.mjs +77 -18
  19. package/api/theme/themeBuild.doc.mjs +3 -3
  20. package/assets/codemods/transforms/next/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
  21. package/assets/codemods/transforms/next/index.mjs +11 -1
  22. package/assets/codemods/transforms/next/migrate-list-edge-compensation-to-edge.mjs +198 -0
  23. package/assets/docs/tree/add-a-component.doc.mjs +10 -0
  24. package/assets/docs/tree/checks.doc.mjs +1 -1
  25. package/assets/docs/tree/component-family.doc.mjs +5 -1
  26. package/assets/docs/tree/component-imports.doc.mjs +8 -0
  27. package/assets/docs/tree/single-component.doc.mjs +1 -1
  28. package/assets/docs/tree/troubleshooting.doc.mjs +9 -1
  29. package/assets/docs/tree/versioning.doc.mjs +1 -0
  30. package/assets/docs/working-with-ai.doc.mjs +43 -4
  31. package/assets/templates/blocks/components/Drawer/DrawerForm.doc.mjs +24 -0
  32. package/assets/templates/blocks/components/Drawer/DrawerForm.tsx +62 -0
  33. package/assets/templates/blocks/components/Drawer/DrawerScrim.doc.mjs +22 -0
  34. package/assets/templates/blocks/components/Drawer/DrawerScrim.tsx +68 -0
  35. package/assets/templates/blocks/components/Drawer/DrawerShowcase.doc.mjs +22 -0
  36. package/assets/templates/blocks/components/Drawer/DrawerShowcase.tsx +41 -0
  37. package/assets/templates/blocks/components/Drawer/DrawerStart.doc.mjs +21 -0
  38. package/assets/templates/blocks/components/Drawer/DrawerStart.tsx +41 -0
  39. package/assets/templates/blocks/components/Drawer/DrawerWidths.doc.mjs +22 -0
  40. package/assets/templates/blocks/components/Drawer/DrawerWidths.tsx +54 -0
  41. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.doc.mjs +15 -0
  42. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderShowcase.tsx +73 -0
  43. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.doc.mjs +22 -0
  44. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderSubtitleEndContent.tsx +49 -0
  45. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.doc.mjs +21 -0
  46. package/assets/templates/blocks/components/DrawerHeader/DrawerHeaderWithCloseButton.tsx +42 -0
  47. package/assets/templates/pages/detail-page/page.tsx +3 -3
  48. package/assets/templates/pages/table-inbox/page.tsx +10 -8
  49. package/authoring/doctypes/base/type.ts +6 -0
  50. package/authoring/doctypes/component/component.doc.mjs +4 -4
  51. package/authoring/doctypes/component/type.ts +6 -3
  52. package/clients/cli/commands/build-theme.path-safety.test.mjs +84 -0
  53. package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
  54. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  55. package/clients/cli/lib/component-format.mjs +5 -1
  56. package/foundation/discovery/component-discovery.d.mts +172 -10
  57. package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
  58. package/foundation/discovery/component-discovery.mjs +863 -55
  59. package/foundation/discovery/component-discovery.test.mjs +96 -0
  60. package/foundation/discovery/component-replacement.mjs +18 -0
  61. package/foundation/discovery/component-replacement.test.mjs +40 -0
  62. package/foundation/discovery/module-exports.d.mts +27 -0
  63. package/foundation/discovery/module-exports.mjs +356 -31
  64. package/foundation/discovery/module-exports.test.mjs +172 -0
  65. package/foundation/discovery/template-adapter.mjs +74 -5
  66. package/foundation/doc-compiler/doc-loads.test.mjs +5 -1
  67. package/foundation/doc-compiler/inputs.mjs +23 -0
  68. package/foundation/doc-compiler/inputs.test.mjs +0 -1
  69. package/foundation/integrations/contribution-inventory.mjs +6 -1
  70. package/foundation/xle/registry.mjs +4 -0
  71. package/foundation/xle/registry.test.mjs +28 -0
  72. package/package.json +10 -10
@@ -1,8 +1,20 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * The entry a family doc gives `name` in its `components`, when the doc is not
6
+ * the component's own (Stack's doc for VStack); null otherwise.
7
+ * @param {any} docs - a loaded component doc
8
+ * @param {string} name - bare component name
9
+ * @returns {any}
10
+ */
11
+ export function familyMember(docs: any, name: string): any;
4
12
  /**
5
13
  * Auto-discover components by scanning for Astryx*.tsx files in core/src/.
14
+ * A component is listed when a doc documents it: a doc in its folder, or, for a
15
+ * component folder with no doc of its own, the doc `findComponentReadme` finds
16
+ * elsewhere (Heading's doc in the Text folder; HStack and VStack as members of
17
+ * Stack's doc).
6
18
  *
7
19
  * Returns an ordered Record where:
8
20
  * - Grouped components use the group name as key: `'Buttons': ['Button', 'IconButton']`
@@ -103,19 +115,81 @@ export function discoverExternalComponentsGrouped(docsDir: string): Record<strin
103
115
  * @returns {string | null}
104
116
  */
105
117
  export function findExternalComponentDoc(docsDir: string, name: string): string | null;
118
+ /** @param {string} docPath */
119
+ export function docStem(docPath: string): string;
120
+ /**
121
+ * Each family doc under an integration's components root that names an
122
+ * import, with the file the import resolves to: null when it resolves to none,
123
+ * such as build output that does not exist yet.
124
+ *
125
+ * @param {{name: string, components?: string, issuesUrl?: string, __packageDir?: string, __packageExports?: Record<string, unknown>|null}} integration
126
+ * @returns {Array<{docPath: string, module: string | null}>}
127
+ */
128
+ export function familyImports(integration: {
129
+ name: string;
130
+ components?: string;
131
+ issuesUrl?: string;
132
+ __packageDir?: string;
133
+ __packageExports?: Record<string, unknown> | null;
134
+ }): Array<{
135
+ docPath: string;
136
+ module: string | null;
137
+ }>;
138
+ /**
139
+ * Whether a discovered integration record is a member its family doc lists,
140
+ * decided from the files, not from whether the doc loads.
141
+ *
142
+ * @param {{name: string, docPath: string|null}} record
143
+ * @returns {boolean}
144
+ */
145
+ export function isIntegrationMember(record: {
146
+ name: string;
147
+ docPath: string | null;
148
+ }): boolean;
149
+ /**
150
+ * The entry a family doc gives a member that discovery lists under its own
151
+ * name, or null when the record is the doc's own component or the loaded doc
152
+ * has no entry for it.
153
+ *
154
+ * @param {any} doc the doc loaded from `record.docPath`
155
+ * @param {{name: string, docPath: string|null}} record
156
+ * @returns {any}
157
+ */
158
+ export function integrationMemberEntry(doc: any, record: {
159
+ name: string;
160
+ docPath: string | null;
161
+ }): any;
162
+ /**
163
+ * Visit every component doc under an integration's components root, hidden
164
+ * ones included, in discovery order, with its stem.
165
+ * @param {string | undefined} componentsDir
166
+ * @param {(docPath: string, stem: string) => void} visit
167
+ */
168
+ export function forEachIntegrationDoc(componentsDir: string | undefined, visit: (docPath: string, stem: string) => void): void;
106
169
  /**
107
170
  * Discover ownership records for the components contributed by a single loaded
108
171
  * integration. Scans the integration's resolved `components` dir for same-stem
109
- * doc files and records each with owner package + issuesUrl + sourcePath.
172
+ * doc files and records each with owner package + issuesUrl + sourcePath. A doc
173
+ * that names a differently named export of its file is recorded under that
174
+ * export, and each family member it lists, under the member's name, unless the
175
+ * name is taken: every doc's file name (a hidden doc's too), a Core name a doc
176
+ * in the package replaces, and a name an earlier doc records.
110
177
  *
111
- * @param {{name: string, components?: string, issuesUrl?: string}} integration
178
+ * @param {{name: string, components?: string, issuesUrl?: string, __packageDir?: string, __packageExports?: Record<string, unknown>|null}} integration
112
179
  * a single entry from `loadedIntegrations` (lib/integrations.mjs)
180
+ * @param {{documentedNames?: boolean}} [options] `documentedNames: false`
181
+ * records each doc under its file name alone, without reading the names
182
+ * docs document: for a caller that needs only what each doc says
113
183
  * @returns {Array<{name: string, package: string, docPath: string, sourcePath: string|null, issuesUrl: string|undefined, group: string|null}>}
114
184
  */
115
185
  export function discoverIntegrationComponents(integration: {
116
186
  name: string;
117
187
  components?: string;
118
188
  issuesUrl?: string;
189
+ __packageDir?: string;
190
+ __packageExports?: Record<string, unknown> | null;
191
+ }, { documentedNames }?: {
192
+ documentedNames?: boolean;
119
193
  }): Array<{
120
194
  name: string;
121
195
  package: string;
@@ -129,11 +203,16 @@ export function discoverIntegrationComponents(integration: {
129
203
  * Invalid metadata or a missing same-stem source removes only that component;
130
204
  * callers can report the returned errors while retaining valid siblings. A
131
205
  * component whose doc sets `replaces` carries the value as written; the
132
- * component replacement resolver decides what it means.
206
+ * component replacement resolver decides what it means. A family member is
207
+ * read through its family's doc: it never carries the family's `replaces`, and
208
+ * a family doc that fails to load is reported once. A doc that fails to load
209
+ * is reported under its file name: what it says cannot be trusted.
133
210
  *
134
211
  * @param {{name: string, components?: string, issuesUrl?: string}} integration
212
+ * @param {{documentedNames?: boolean}} [options] as for
213
+ * {@link discoverIntegrationComponents}
135
214
  * @returns {Promise<{
136
- * components: Array<{name: string, package: string, docPath: string, sourcePath: string, issuesUrl: string|undefined, group: string|null, replaces?: unknown}>,
215
+ * components: Array<{name: string, package: string, docPath: string, sourcePath: string|null, issuesUrl: string|undefined, group: string|null, replaces?: unknown}>,
137
216
  * discovered: Array<{name: string, package: string, docPath: string, sourcePath: string|null, issuesUrl: string|undefined, group: string|null}>,
138
217
  * errors: Array<{name: string, message: string}>,
139
218
  * }>}
@@ -142,12 +221,14 @@ export function discoverValidIntegrationComponents(integration: {
142
221
  name: string;
143
222
  components?: string;
144
223
  issuesUrl?: string;
224
+ }, options?: {
225
+ documentedNames?: boolean;
145
226
  }): Promise<{
146
227
  components: Array<{
147
228
  name: string;
148
229
  package: string;
149
230
  docPath: string;
150
- sourcePath: string;
231
+ sourcePath: string | null;
151
232
  issuesUrl: string | undefined;
152
233
  group: string | null;
153
234
  replaces?: unknown;
@@ -165,30 +246,103 @@ export function discoverValidIntegrationComponents(integration: {
165
246
  message: string;
166
247
  }>;
167
248
  }>;
249
+ /**
250
+ * How an owner holds a component name, which the owner rule
251
+ * ({@link unscopedComponentOwners}) reads: `core` when Core documents it;
252
+ * `file` when an integration doc named after its file is recorded under it;
253
+ * `doc` when only a doc records it: an export name, a member, or the file name
254
+ * of a doc recorded under another export.
255
+ * @typedef {'core' | 'file' | 'doc'} NameHold
256
+ */
257
+ /**
258
+ * How a discovered integration record holds its name.
259
+ * @param {{name: string, docPath: string|null}} record
260
+ * @returns {'file' | 'doc'}
261
+ */
262
+ export function integrationRecordHold(record: {
263
+ name: string;
264
+ docPath: string | null;
265
+ }): "file" | "doc";
266
+ /**
267
+ * The integration component a name finds, as discovery records it, and its
268
+ * hold: the same-stem doc first, then a doc that records the name as an export
269
+ * or a member.
270
+ *
271
+ * @param {{name?: string, components?: string, __packageDir?: string, __packageExports?: Record<string, unknown>|null}} integration
272
+ * @param {string} name
273
+ * @returns {{docPath: string, sourcePath: string|null, hold: 'file' | 'doc'} | null}
274
+ */
275
+ export function findIntegrationComponent(integration: {
276
+ name?: string;
277
+ components?: string;
278
+ __packageDir?: string;
279
+ __packageExports?: Record<string, unknown> | null;
280
+ }, name: string): {
281
+ docPath: string;
282
+ sourcePath: string | null;
283
+ hold: "file" | "doc";
284
+ } | null;
285
+ /**
286
+ * The name discovery records a component doc under: the export its `name`
287
+ * documents when the doc is recorded under it, else the doc's file name.
288
+ *
289
+ * @param {{name?: string, components?: string, __packageDir?: string, __packageExports?: Record<string, unknown>|null}} integration
290
+ * @param {string} docPath
291
+ * @returns {string}
292
+ */
293
+ export function recordedDocName(integration: {
294
+ name?: string;
295
+ components?: string;
296
+ __packageDir?: string;
297
+ __packageExports?: Record<string, unknown> | null;
298
+ }, docPath: string): string;
168
299
  /**
169
300
  * Find an integration component's doc file by name within a loaded
170
301
  * integration's resolved `components` dir. Honors the same-stem convention
171
- * (`{Name}.doc.{ts,mjs,js}`), preferring `.ts` → `.mjs` → `.js`.
302
+ * (`{Name}.doc.{ts,mjs,js}`), preferring `.ts` → `.mjs` → `.js`, and finds a
303
+ * doc that records the component under another name: a differently named
304
+ * export of its file, or a member its family doc lists.
172
305
  *
173
- * @param {{components?: string}} integration
306
+ * @param {{name?: string, components?: string, __packageDir?: string, __packageExports?: Record<string, unknown>|null}} integration
174
307
  * @param {string} name bare component name (no `XDS`/`Astryx` prefix)
175
308
  * @returns {string|null}
176
309
  */
177
310
  export function findIntegrationComponentDoc(integration: {
311
+ name?: string;
178
312
  components?: string;
313
+ __packageDir?: string;
314
+ __packageExports?: Record<string, unknown> | null;
179
315
  }, name: string): string | null;
180
316
  /**
181
- * Find an integration component's swizzleable source file (`{Name}.tsx`) by
182
- * name within a loaded integration's resolved `components` dir. Returns null
317
+ * Find an integration component's swizzleable source file by name within a
318
+ * loaded integration's resolved `components` dir: the same-stem `{Name}.tsx`
319
+ * of its doc, or, for a family member, the file that declares it. Returns null
183
320
  * when the integration ships docs without source.
184
321
  *
185
- * @param {{components?: string}} integration
322
+ * @param {{name?: string, components?: string, __packageDir?: string, __packageExports?: Record<string, unknown>|null}} integration
186
323
  * @param {string} name bare component name
187
324
  * @returns {string|null}
188
325
  */
189
326
  export function findIntegrationComponentSource(integration: {
327
+ name?: string;
190
328
  components?: string;
329
+ __packageDir?: string;
330
+ __packageExports?: Record<string, unknown> | null;
191
331
  }, name: string): string | null;
332
+ /**
333
+ * The owner rule: an owner that holds a name only because a doc records it
334
+ * (`hold: 'doc'`) yields to Core and to every file-named owner; `--package`
335
+ * still reaches it. Surfaces resolve a replacement first, then this rule, then
336
+ * which docs load.
337
+ *
338
+ * @template {{hold?: string}} T
339
+ * @param {T[]} owners each with its {@link NameHold}; an owner without one
340
+ * counts as Core's or file-named
341
+ * @returns {T[]}
342
+ */
343
+ export function unscopedComponentOwners<T extends {
344
+ hold?: string;
345
+ }>(owners: T[]): T[];
192
346
  /**
193
347
  * Build a flat list of ownership records for ALL discoverable components —
194
348
  * core (built-in) plus every loaded integration. This is the authoritative
@@ -217,3 +371,11 @@ export function discoverOwnedComponents(coreDir: string, loadedIntegrations?: Ar
217
371
  }>;
218
372
  /** The owner package name for built-in (core) components. */
219
373
  export const CORE_PACKAGE: import("../../authoring/index.js").ProviderId;
374
+ /**
375
+ * How an owner holds a component name, which the owner rule
376
+ * ({@link unscopedComponentOwners}) reads: `core` when Core documents it;
377
+ * `file` when an integration doc named after its file is recorded under it;
378
+ * `doc` when only a doc records it: an export name, a member, or the file name
379
+ * of a doc recorded under another export.
380
+ */
381
+ export type NameHold = "core" | "file" | "doc";