@astryxdesign/cli 0.6.3-canary.db4e378 → 0.6.3-canary.dea6813

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 (31) hide show
  1. package/README.md +57 -57
  2. package/api/component/component.doc.mjs +1 -1
  3. package/api/component/component.mjs +3 -3
  4. package/api/component/component.type.d.mts +4 -5
  5. package/api/component/component.type.mjs +4 -5
  6. package/api/component/detail/blocks/blocks.d.mts +1 -2
  7. package/api/component/detail/blocks/blocks.mjs +3 -4
  8. package/api/component/list/list.d.mts +5 -0
  9. package/api/component/list/list.mjs +9 -37
  10. package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +165 -86
  11. package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +210 -72
  12. package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +115 -83
  13. package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +186 -57
  14. package/clients/cli/commands/component-package.test.mjs +0 -28
  15. package/foundation/response/response-types.doc.mjs +7 -7
  16. package/package.json +9 -9
  17. package/assets/codemods/transform-prop.mjs +0 -109
  18. package/assets/codemods/transform-prop.test.mjs +0 -95
  19. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +0 -14
  20. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +0 -61
  21. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +0 -14
  22. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +0 -126
  23. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +0 -15
  24. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +0 -86
  25. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +0 -14
  26. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +0 -99
  27. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +0 -14
  28. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +0 -122
  29. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +0 -14
  30. package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +0 -95
  31. package/foundation/response/response-types.doc.test.mjs +0 -158
@@ -1,14 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
- export const doc = {
5
- type: 'block',
6
- exampleFor: 'ScrollableArea',
7
- name: 'ScrollableArea — Sticky Passthrough',
8
- displayName: 'Scrollable Area — Sticky Passthrough',
9
- description:
10
- 'A section whose content fits clips instead of scrolling, so its sticky label passes outward and pins to the panel edge. The next section sets stickyContainment="always" and keeps its label in its own box.',
11
- isReady: true,
12
- aspectRatio: 1,
13
- componentsUsed: ['ScrollableArea', 'Card', 'Grid'],
14
- };
@@ -1,122 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import * as stylex from '@stylexjs/stylex';
6
- import {ScrollableArea} from '@astryxdesign/core/ScrollableArea';
7
- import {Card} from '@astryxdesign/core/Card';
8
- import {Grid} from '@astryxdesign/core/Grid';
9
- import {VStack} from '@astryxdesign/core/Layout';
10
- import {Heading, Text} from '@astryxdesign/core/Text';
11
- import {colorVars, spacingVars} from '@astryxdesign/core/theme/tokens.stylex';
12
-
13
- const styles = stylex.create({
14
- sectionLabel: {
15
- position: 'sticky',
16
- insetBlockStart: 0,
17
- zIndex: 1,
18
- backgroundColor: colorVars['--color-background-card'],
19
- paddingBlock: spacingVars['--spacing-2'],
20
- },
21
- });
22
-
23
- const SHARED = [
24
- {id: 'brand', title: 'Brand refresh', meta: 'Priya Raman'},
25
- {id: 'checkout', title: 'Checkout audit', meta: 'Tomas Lindqvist'},
26
- {id: 'partner', title: 'Partner deck', meta: 'Ines Okafor'},
27
- {id: 'research', title: 'Research synthesis', meta: 'Mei Watanabe'},
28
- {id: 'tax', title: 'Tax region notes', meta: 'Hugo Bernard'},
29
- {id: 'sso', title: 'SSO rollout plan', meta: 'Sofia Marchetti'},
30
- ];
31
-
32
- const TEMPLATES = [
33
- {id: 'weekly', title: 'Weekly report', meta: 'Used 24 times'},
34
- {id: 'checklist', title: 'Launch checklist', meta: 'Used 18 times'},
35
- {id: 'review', title: 'Design review', meta: 'Used 11 times'},
36
- {id: 'retro', title: 'Retro board', meta: 'Used 9 times'},
37
- {id: 'brief', title: 'Project brief', meta: 'Used 7 times'},
38
- {id: 'postmortem', title: 'Postmortem', meta: 'Used 4 times'},
39
- ];
40
-
41
- const ARCHIVED = [
42
- {id: 'roadmap', title: '2025 roadmap', meta: 'Archived in March'},
43
- {id: 'legacy', title: 'Legacy pricing', meta: 'Archived in March'},
44
- {id: 'kit', title: 'Old brand kit', meta: 'Archived in January'},
45
- {id: 'beta', title: 'Beta feedback', meta: 'Archived in January'},
46
- {id: 'survey', title: 'Q4 survey results', meta: 'Archived in January'},
47
- {id: 'offsite', title: 'Offsite agenda', meta: 'Archived last year'},
48
- ];
49
-
50
- function FileGrid({
51
- files,
52
- }: {
53
- files: Array<{id: string; title: string; meta: string}>;
54
- }) {
55
- return (
56
- <Grid columns={2} gap={2}>
57
- {files.map(file => (
58
- <Card key={file.id} variant="muted" padding={3}>
59
- <VStack gap={1}>
60
- <Text weight="medium" maxLines={1}>
61
- {file.title}
62
- </Text>
63
- <Text type="supporting" maxLines={1}>
64
- {file.meta}
65
- </Text>
66
- </VStack>
67
- </Card>
68
- ))}
69
- </Grid>
70
- );
71
- }
72
-
73
- export default function ScrollableAreaStickyPassthrough() {
74
- return (
75
- <Card width={400} padding={0}>
76
- <ScrollableArea
77
- axis="block"
78
- role="region"
79
- label="Workspace files"
80
- height={300}
81
- padding={4}>
82
- <VStack gap={0.5} paddingBlockEnd={2}>
83
- <Heading level={3}>Workspace files</Heading>
84
- <Text type="supporting">18 files across 3 sections</Text>
85
- </VStack>
86
-
87
- {/* This section's content fits, so its viewport clips instead of
88
- scrolling and never becomes the Sticky boundary: the label
89
- passes outward and pins to the panel's edge. */}
90
- <ScrollableArea axis="block" label="Shared with you">
91
- <div {...stylex.props(styles.sectionLabel)}>
92
- <Text type="label" color="secondary">
93
- Shared with you
94
- </Text>
95
- </div>
96
- <FileGrid files={SHARED} />
97
- </ScrollableArea>
98
-
99
- {/* Same fitting content, but containment is explicit: this viewport
100
- stays the Sticky boundary, so its label leaves with the box. */}
101
- <ScrollableArea
102
- axis="block"
103
- label="Templates"
104
- stickyContainment="always">
105
- <div {...stylex.props(styles.sectionLabel)}>
106
- <Text type="label" color="secondary">
107
- Templates
108
- </Text>
109
- </div>
110
- <FileGrid files={TEMPLATES} />
111
- </ScrollableArea>
112
-
113
- <div {...stylex.props(styles.sectionLabel)}>
114
- <Text type="label" color="secondary">
115
- Archived
116
- </Text>
117
- </div>
118
- <FileGrid files={ARCHIVED} />
119
- </ScrollableArea>
120
- </Card>
121
- );
122
- }
@@ -1,14 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
4
- export const doc = {
5
- type: 'block',
6
- exampleFor: 'ScrollableArea',
7
- name: 'ScrollableArea — Two-Axis Board',
8
- displayName: 'Scrollable Area — Two-Axis Board',
9
- description:
10
- 'axis="both" gives the content box max-content inline sizing, so a board wider and taller than its panel scrolls on both axes from one viewport.',
11
- isReady: true,
12
- aspectRatio: 1,
13
- componentsUsed: ['ScrollableArea', 'Card', 'Grid'],
14
- };
@@ -1,95 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- 'use client';
4
-
5
- import {ScrollableArea} from '@astryxdesign/core/ScrollableArea';
6
- import {Card} from '@astryxdesign/core/Card';
7
- import {HStack, VStack} from '@astryxdesign/core/Layout';
8
- import {Heading, Text} from '@astryxdesign/core/Text';
9
-
10
- const COLUMNS = [
11
- {
12
- label: 'Recently opened',
13
- files: [
14
- {id: 'brief', title: 'Q3 launch brief', meta: 'Edited 2 days ago'},
15
- {id: 'pricing', title: 'Pricing rework', meta: 'Edited 3 days ago'},
16
- {
17
- id: 'onboarding',
18
- title: 'Onboarding flow v4',
19
- meta: 'Edited 4 days ago',
20
- },
21
- {id: 'macros', title: 'Support macros', meta: 'Edited last week'},
22
- ],
23
- },
24
- {
25
- label: 'Shared with you',
26
- files: [
27
- {id: 'brand', title: 'Brand refresh', meta: 'Priya Raman'},
28
- {id: 'checkout', title: 'Checkout audit', meta: 'Tomas Lindqvist'},
29
- {id: 'partner', title: 'Partner deck', meta: 'Ines Okafor'},
30
- {id: 'research', title: 'Research synthesis', meta: 'Mei Watanabe'},
31
- ],
32
- },
33
- {
34
- label: 'Templates',
35
- files: [
36
- {id: 'weekly', title: 'Weekly report', meta: 'Used 24 times'},
37
- {id: 'checklist', title: 'Launch checklist', meta: 'Used 18 times'},
38
- {id: 'review', title: 'Design review', meta: 'Used 11 times'},
39
- {id: 'retro', title: 'Retro board', meta: 'Used 9 times'},
40
- ],
41
- },
42
- {
43
- label: 'Archived',
44
- files: [
45
- {id: 'roadmap', title: '2025 roadmap', meta: 'Archived in March'},
46
- {id: 'legacy', title: 'Legacy pricing', meta: 'Archived in March'},
47
- {id: 'kit', title: 'Old brand kit', meta: 'Archived in January'},
48
- {id: 'beta', title: 'Beta feedback', meta: 'Archived in January'},
49
- ],
50
- },
51
- ];
52
-
53
- export default function ScrollableAreaTwoAxisBoard() {
54
- return (
55
- <Card width={420} padding={0}>
56
- {/* axis="both" gives the content box max-content inline sizing, so the
57
- board is free to be wider than the viewport on both axes. The
58
- heading is inside that box and travels with it. */}
59
- <ScrollableArea
60
- axis="both"
61
- role="region"
62
- label="Workspace board"
63
- height={300}
64
- padding={4}>
65
- <VStack gap={4}>
66
- <VStack gap={0.5}>
67
- <Heading level={3}>Workspace board</Heading>
68
- <Text type="supporting">16 files across 4 sections</Text>
69
- </VStack>
70
- <HStack gap={3} vAlign="start">
71
- {COLUMNS.map(column => (
72
- <VStack key={column.label} gap={2} width={180}>
73
- <Text type="label" color="secondary">
74
- {column.label}
75
- </Text>
76
- {column.files.map(file => (
77
- <Card key={file.id} variant="muted" padding={3}>
78
- <VStack gap={1}>
79
- <Text weight="medium" maxLines={1}>
80
- {file.title}
81
- </Text>
82
- <Text type="supporting" maxLines={1}>
83
- {file.meta}
84
- </Text>
85
- </VStack>
86
- </Card>
87
- ))}
88
- </VStack>
89
- ))}
90
- </HStack>
91
- </VStack>
92
- </ScrollableArea>
93
- </Card>
94
- );
95
- }
@@ -1,158 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file The response-types EnumDoc names every field of the responses below,
5
- * nested entry fields included. Fields come from real responses where one is
6
- * cheap to produce, else from the canonical typedef.
7
- */
8
-
9
- import * as fs from 'node:fs';
10
- import * as os from 'node:os';
11
- import * as path from 'node:path';
12
- import {describe, it, expect} from 'vitest';
13
- import {doc} from './response-types.doc.mjs';
14
- import {runCli} from '../../test-utils/run-cli.mjs';
15
-
16
- /** @param {string} type */
17
- const describedAs = (type) => doc.members.find((m) => m.value === type)?.description ?? '';
18
-
19
- /** @param {string} text @param {string} field */
20
- const names = (text, field) => new RegExp(`(^|\\W)${field}(\\W|$)`).test(text);
21
-
22
- /**
23
- * Keys of an object, plus the keys of each nested object or array entry, `depth`
24
- * levels down.
25
- * @param {unknown} value @param {number} depth @returns {Set<string>}
26
- */
27
- function fieldsOf(value, depth = 2) {
28
- const out = new Set();
29
- const visit = (/** @type {unknown} */ v, /** @type {number} */ d) => {
30
- if (Array.isArray(v)) return v.forEach((item) => visit(item, d));
31
- if (!v || typeof v !== 'object' || d < 0) return;
32
- for (const [key, child] of Object.entries(v)) {
33
- out.add(key);
34
- visit(child, d - 1);
35
- }
36
- };
37
- visit(value, depth);
38
- return out;
39
- }
40
-
41
- /** @param {string[]} args @param {string} [cwd] */
42
- async function data(args, cwd) {
43
- const {status, stdout} = await runCli(['--json', ...args], cwd ? {cwd} : undefined);
44
- expect(status, stdout).toBe(0);
45
- return JSON.parse(stdout);
46
- }
47
-
48
- /** @param {string} type @param {Iterable<string>} fields */
49
- function expectNamed(type, fields) {
50
- const text = describedAs(type);
51
- const missing = [...fields].filter((f) => !names(text, f));
52
- expect(missing, `${type} omits`).toEqual([]);
53
- }
54
-
55
- describe('response-types EnumDoc names every field', () => {
56
- it('component.detail: the ownership fields and parentDoc', async () => {
57
- const res = await data(['component', 'HStack']);
58
- expect(res.type).toBe('component.detail');
59
- const ownership = ['package', 'import', 'sourceAvailable', 'parentDoc'];
60
- for (const f of ownership) expect(Object.keys(res.data)).toContain(f);
61
- expectNamed('component.detail', ownership);
62
- // The canonical response type declares parentDoc too.
63
- const types = fs.readFileSync(
64
- new URL('../../api/component/component.type.mjs', import.meta.url),
65
- 'utf8',
66
- );
67
- expect(types).toMatch(/@property \{string\} \[parentDoc\]/);
68
- });
69
-
70
- it('docs.index', async () => {
71
- const res = await data(['docs', 'theme', '--index']);
72
- expect(res.type).toBe('docs.index');
73
- expectNamed('docs.index', fieldsOf(res.data));
74
- });
75
-
76
- it('search, across component, hook, template, and doc results', async () => {
77
- const mixed = await data(['search', 'dashboard', '--limit', '50']);
78
- const docsOnly = await data(['search', 'tokens', '--type', 'doc']);
79
- expect(new Set(mixed.data.results.map((r) => r.domain))).toContain('template');
80
- expectNamed('search', new Set([...fieldsOf(mixed.data), ...fieldsOf(docsOnly.data)]));
81
- });
82
-
83
- it('build.kit, including the hint a thin kit carries', async () => {
84
- const res = await data(['build', 'zzqx-nothing-matches']);
85
- expect(res.type).toBe('build.kit');
86
- expect(res.data.hint).toBeDefined();
87
- const fields = fieldsOf(res.data, 0);
88
- for (const f of Object.keys(res.data.hint)) fields.add(f);
89
- expectNamed('build.kit', fields);
90
- });
91
-
92
- it('theme.targets, including deprecatedFor', async () => {
93
- const res = await data(['theme', 'targets']);
94
- const fields = fieldsOf(res.data);
95
- expect(fields).toContain('deprecatedFor');
96
- expectNamed('theme.targets', fields);
97
- });
98
-
99
- it('gap-report.file, including each delivery', async () => {
100
- const res = await data(['gap-report', 'Button', '--category', 'docs_gap', '--reason', 'probe']);
101
- expect(res.type).toBe('gap-report.file');
102
- expect(res.data.deliveries.length).toBeGreaterThan(0);
103
- expectNamed('gap-report.file', fieldsOf(res.data));
104
- });
105
-
106
- it('theme.build, including notices', async () => {
107
- const cwd = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-response-types-'));
108
- fs.writeFileSync(path.join(cwd, 'package.json'), '{"name":"app","version":"1.0.0"}');
109
- await data(['theme', 'template', 'starter.ts'], cwd);
110
- const res = await data(['theme', 'build', 'starter.ts', '--out', 'starter.css'], cwd);
111
- expect(res.type).toBe('theme.build');
112
- expectNamed('theme.build', fieldsOf(res.data));
113
- });
114
-
115
- it('integration.pack-check (fields from api/integration/pack-check.type.mjs)', () => {
116
- expectNamed('integration.pack-check', [
117
- // PackCheckData
118
- 'name',
119
- 'version',
120
- 'packable',
121
- 'tarball',
122
- 'inventory',
123
- 'contributions',
124
- 'issues',
125
- // PackCheckTarball
126
- 'filename',
127
- 'fileCount',
128
- 'size',
129
- 'unpackedSize',
130
- // PackCheckInventory and PackCheckInventoryRoot
131
- 'manifest',
132
- 'roots',
133
- 'kind',
134
- 'path',
135
- 'expectedFiles',
136
- 'missingFiles',
137
- 'complete',
138
- 'packedFiles',
139
- // contributions, each ContributionIdentities
140
- 'local',
141
- 'packed',
142
- 'themes',
143
- 'slug',
144
- 'exportName',
145
- 'components',
146
- 'templates',
147
- 'id',
148
- 'type',
149
- 'codemods',
150
- 'docs',
151
- 'agentDocsAppend',
152
- // issues, each AstryxIntegrationIssue
153
- 'code',
154
- 'severity',
155
- 'message',
156
- ]);
157
- });
158
- });