@astryxdesign/cli 0.3.0-canary.fbc60c5 → 0.3.0-canary.fcbc342
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.
- package/README.md +8 -8
- package/api/blog/blog.doc.mjs +2 -2
- package/api/build/build.doc.mjs +1 -1
- package/api/component/component.doc.mjs +1 -1
- package/api/discover/discover.doc.mjs +2 -2
- package/api/docs/docs.doc.mjs +2 -2
- package/api/doctor/doctor.doc.mjs +3 -3
- package/api/hook/hook.doc.mjs +1 -1
- package/api/init/init.doc.mjs +1 -1
- package/api/integration/summarizeIssues.doc.mjs +1 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/assertResponse.doc.mjs +2 -2
- package/api/json/isError.doc.mjs +1 -1
- package/api/json/parseResponse.doc.mjs +2 -2
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/swizzle/swizzle.doc.mjs +1 -1
- package/api/template/template.test.mjs +38 -13
- package/api/theme/listThemes.doc.mjs +2 -2
- package/api/theme/themeAdd.doc.mjs +1 -1
- package/api/theme/themeBuild.doc.mjs +3 -3
- package/api/theme/themeList.doc.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/assets/codemods/transforms/next/__tests__/next-codemods.test.mjs +92 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/rename-dropdown-menu-radio-dot-target.mjs +152 -0
- package/assets/codemods/transforms/v0.3.0/__tests__/migrate-grid-minchildwidth-to-columns.test.mjs +82 -0
- package/assets/codemods/transforms/v0.3.0/__tests__/migrate-table-rowexpansion-to-tree.test.mjs +201 -0
- package/assets/codemods/transforms/v0.3.0/index.mjs +8 -0
- package/assets/codemods/transforms/v0.3.0/migrate-grid-minchildwidth-to-columns.mjs +38 -2
- package/assets/codemods/transforms/v0.3.0/migrate-table-rowexpansion-to-tree.mjs +214 -0
- package/assets/docs/browser-support.doc.mjs +6 -6
- package/assets/docs/getting-started.doc.mjs +3 -3
- package/assets/docs/icons.doc.mjs +3 -3
- package/assets/docs/illustrations.doc.mjs +2 -2
- package/assets/docs/internationalization.doc.mjs +1 -1
- package/assets/docs/layout.doc.dense.mjs +1 -1
- package/assets/docs/migration.doc.mjs +1 -1
- package/assets/docs/principles.doc.mjs +1 -1
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +3 -3
- package/assets/docs/typography.doc.mjs +2 -2
- package/assets/templates/blocks/components/AspectRatio/AspectRatioCircleImage.tsx +1 -1
- package/assets/templates/blocks/components/AspectRatio/AspectRatioImageGallery.tsx +1 -1
- package/assets/templates/blocks/components/AspectRatio/AspectRatioShowcase.tsx +3 -3
- package/assets/templates/blocks/components/AspectRatio/AspectRatioSquareImage.tsx +1 -1
- package/assets/templates/blocks/components/AspectRatio/AspectRatioWidescreen.tsx +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarFallbackChain.tsx +6 -6
- package/assets/templates/blocks/components/Avatar/AvatarGroup.tsx +5 -5
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +2 -2
- package/assets/templates/blocks/components/Avatar/AvatarShowcase.tsx +4 -4
- package/assets/templates/blocks/components/Avatar/AvatarTooltip.tsx +4 -4
- package/assets/templates/blocks/components/Avatar/AvatarUserCard.tsx +3 -3
- package/assets/templates/blocks/components/Avatar/AvatarWithImage.tsx +4 -4
- package/assets/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -3
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerAttachments.tsx +5 -5
- package/assets/templates/blocks/components/Lightbox/LightboxGallery.tsx +4 -4
- package/assets/templates/blocks/components/Lightbox/LightboxShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Lightbox/LightboxVideo.tsx +1 -1
- package/assets/templates/blocks/components/Lightbox/LightboxZoom.tsx +2 -2
- package/assets/templates/blocks/components/MediaTheme/MediaThemeImageOverlay.tsx +1 -1
- package/assets/templates/blocks/components/MediaTheme/MediaThemeLightScrim.tsx +1 -1
- package/assets/templates/blocks/components/MediaTheme/MediaThemeShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Overlay/OverlayBottomStrip.tsx +1 -1
- package/assets/templates/blocks/components/Overlay/OverlayHoverReveal.tsx +1 -1
- package/assets/templates/blocks/components/Overlay/OverlayShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Stepper/StepperHorizontal.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperHorizontal.tsx +24 -0
- package/assets/templates/blocks/components/Stepper/StepperIndicatorModes.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperIndicatorModes.tsx +68 -0
- package/assets/templates/blocks/components/Stepper/StepperMultiStepForm.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperMultiStepForm.tsx +92 -0
- package/assets/templates/blocks/components/Stepper/StepperOnTrackVertical.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperOnTrackVertical.tsx +41 -0
- package/assets/templates/blocks/components/Stepper/StepperShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/Stepper/StepperShowcase.tsx +25 -0
- package/assets/templates/blocks/components/Stepper/StepperStatus.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperStatus.tsx +50 -0
- package/assets/templates/blocks/components/Stepper/StepperVerticalOnboarding.doc.mjs +14 -0
- package/assets/templates/blocks/components/Stepper/StepperVerticalOnboarding.tsx +40 -0
- package/assets/templates/blocks/components/Table/TableRowExpansionTable.tsx +61 -58
- package/assets/templates/blocks/components/TextArea/TextAreaStates.tsx +1 -1
- package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.tsx +1 -1
- package/assets/templates/pages/centered-hero/page.tsx +1 -1
- package/assets/templates/pages/classic-gallery/page.tsx +10 -10
- package/assets/templates/pages/detail-page/page.tsx +5 -5
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/gallery-hero/page.tsx +3 -3
- package/assets/templates/pages/library/page.tsx +30 -30
- package/assets/templates/pages/login/page.tsx +1 -2
- package/assets/templates/pages/login-card/page.tsx +1 -2
- package/assets/templates/pages/login-split/page.tsx +5 -6
- package/assets/templates/pages/login-sso/page.tsx +2 -3
- package/assets/templates/pages/mixed-gallery/page.tsx +5 -5
- package/assets/templates/pages/payment-form/page.tsx +3 -3
- package/assets/templates/pages/product-detail/page.tsx +7 -7
- package/assets/templates/pages/product-gallery/page.tsx +6 -6
- package/assets/templates/pages/shell-top-nav/page.tsx +2 -2
- package/assets/templates/pages/side-gallery/page.tsx +9 -9
- package/assets/templates/pages/table-page-chart/page.tsx +6 -6
- package/assets/templates/pages/theme-showcase/page.tsx +6 -6
- package/assets/templates/themes/neutral/neutralTheme.ts +4 -1
- package/authoring/codemod/codemod.doc.mjs +2 -2
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/doctypes/base/type.ts +21 -0
- package/authoring/doctypes/command/command.doc.mjs +2 -2
- package/authoring/doctypes/component/component.doc.mjs +7 -7
- package/authoring/doctypes/enum/enum.doc.mjs +2 -2
- package/authoring/doctypes/function/function.doc.mjs +3 -3
- package/authoring/doctypes/hook/hook.doc.mjs +3 -3
- package/authoring/doctypes/reference/reference.doc.mjs +3 -3
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/clients/cli/commands/build-theme.registry.test.mjs +14 -1
- package/clients/cli/commands/build.doc.mjs +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/doctor.doc.mjs +2 -2
- package/clients/cli/commands/layout-expand.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +1 -1
- package/clients/cli/commands/manifest.doc.mjs +3 -3
- package/clients/cli/commands/search.doc.mjs +1 -1
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-list.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +2 -2
- package/clients/cli/commands/validate-integration.doc.mjs +2 -2
- package/foundation/agent-docs/agent-docs.mjs +3 -4
- package/foundation/agent-docs/agent-docs.test.mjs +8 -0
- package/foundation/discovery/template-adapter.d.mts +6 -3
- package/foundation/discovery/template-adapter.mjs +33 -13
- package/foundation/response/response-types.doc.mjs +7 -7
- package/foundation/response/response.doc.mjs +5 -5
- package/package.json +9 -9
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Codemod: Migrate tree-mode useTableRowExpansion to the tree plugin
|
|
5
|
+
*
|
|
6
|
+
* useTableRowExpansion is now a detail-panel plugin (renderExpanded). Its old
|
|
7
|
+
* tree mode (child rows that reuse the parent columns) moved to
|
|
8
|
+
* useTableTreeData + useTableTreeState, and useTableRowExpansionState was
|
|
9
|
+
* removed. This codemod rewrites the standard tree pattern:
|
|
10
|
+
*
|
|
11
|
+
* const {data, expansionConfig} = useTableRowExpansionState({
|
|
12
|
+
* baseData, getChildren, getRowKey, expandedKeys, setExpandedKeys,
|
|
13
|
+
* });
|
|
14
|
+
* const expansion = useTableRowExpansion(expansionConfig);
|
|
15
|
+
*
|
|
16
|
+
* into:
|
|
17
|
+
*
|
|
18
|
+
* const {visibleData: data, treeConfig} = useTableTreeState({
|
|
19
|
+
* data: baseData, childrenKey: 'children', idKey: getRowKey, ...
|
|
20
|
+
* });
|
|
21
|
+
* const expansion = useTableTreeData(treeConfig);
|
|
22
|
+
*
|
|
23
|
+
* Files that use the new detail-panel API (renderExpanded, no
|
|
24
|
+
* useTableRowExpansionState import) are left untouched.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
export const meta = {
|
|
28
|
+
title: 'Migrate tree-mode useTableRowExpansion to the tree plugin',
|
|
29
|
+
description:
|
|
30
|
+
'Rewrites the removed useTableRowExpansionState tree pattern to useTableTreeState + useTableTreeData. Detail-panel usage (renderExpanded) is left untouched.',
|
|
31
|
+
pr: '#4612',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const IMPORT_SOURCES = new Set([
|
|
35
|
+
'@astryxdesign/core',
|
|
36
|
+
'@astryxdesign/core/Table',
|
|
37
|
+
'@xds/core',
|
|
38
|
+
'@xds/core/Table',
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
|
|
43
|
+
* @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
|
|
44
|
+
* @returns {string | null | undefined}
|
|
45
|
+
*/
|
|
46
|
+
export default function transformer(file, api) {
|
|
47
|
+
const j = api.jscodeshift;
|
|
48
|
+
const root = j(file.source);
|
|
49
|
+
|
|
50
|
+
// Only act on files importing the removed state hook. Detail-panel-only
|
|
51
|
+
// usage (useTableRowExpansion alone) is the new API and must be left alone.
|
|
52
|
+
let stateLocal = null;
|
|
53
|
+
let pluginLocal = null;
|
|
54
|
+
/** @type {any[]} */
|
|
55
|
+
const importPaths = [];
|
|
56
|
+
root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
|
|
57
|
+
if (!IMPORT_SOURCES.has(path.node.source.value)) return;
|
|
58
|
+
for (const spec of path.node.specifiers ?? []) {
|
|
59
|
+
if (spec.type !== 'ImportSpecifier') continue;
|
|
60
|
+
if (spec.imported.name === 'useTableRowExpansionState') {
|
|
61
|
+
stateLocal = spec.local?.name ?? spec.imported.name;
|
|
62
|
+
importPaths.push(path);
|
|
63
|
+
}
|
|
64
|
+
if (spec.imported.name === 'useTableRowExpansion') {
|
|
65
|
+
pluginLocal = spec.local?.name ?? spec.imported.name;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
if (!stateLocal) return undefined;
|
|
70
|
+
|
|
71
|
+
let hasChanges = false;
|
|
72
|
+
|
|
73
|
+
// --- 1. Rewrite the state hook call + its config object ---
|
|
74
|
+
root
|
|
75
|
+
.find(j.CallExpression, {callee: {name: stateLocal}})
|
|
76
|
+
.forEach((/** @type {any} */ path) => {
|
|
77
|
+
const arg = path.node.arguments[0];
|
|
78
|
+
if (!arg || arg.type !== 'ObjectExpression') return;
|
|
79
|
+
|
|
80
|
+
/** @type {any} */
|
|
81
|
+
let getChildrenValue = null;
|
|
82
|
+
const nextProps = [];
|
|
83
|
+
for (const prop of arg.properties) {
|
|
84
|
+
const key =
|
|
85
|
+
prop.key?.name ?? (prop.key?.value ? String(prop.key.value) : null);
|
|
86
|
+
if (key === 'baseData') {
|
|
87
|
+
nextProps.push(j.property('init', j.identifier('data'), prop.value));
|
|
88
|
+
} else if (key === 'getChildren') {
|
|
89
|
+
getChildrenValue = prop.value;
|
|
90
|
+
// childrenKey is emitted below (default 'children').
|
|
91
|
+
} else if (key === 'getRowKey') {
|
|
92
|
+
nextProps.push(j.property('init', j.identifier('idKey'), prop.value));
|
|
93
|
+
} else if (key === 'getIsItemExpandable') {
|
|
94
|
+
nextProps.push(
|
|
95
|
+
j.property('init', j.identifier('isItemExpandable'), prop.value),
|
|
96
|
+
);
|
|
97
|
+
} else if (key === 'expandedKeys' || key === 'setExpandedKeys') {
|
|
98
|
+
// The tree state hook owns expansion internally (uncontrolled) or
|
|
99
|
+
// via expandedIds/onExpandedIdsChange (controlled). The 1:1
|
|
100
|
+
// controlled mapping is not mechanical, so these are dropped and a
|
|
101
|
+
// guidance comment is attached below.
|
|
102
|
+
continue;
|
|
103
|
+
} else {
|
|
104
|
+
nextProps.push(prop);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// childrenKey: derive the literal when getChildren is the canonical
|
|
109
|
+
// `item => item.children` / `item.children ?? []`; otherwise keep the
|
|
110
|
+
// default and let the guidance comment flag it.
|
|
111
|
+
nextProps.splice(
|
|
112
|
+
1,
|
|
113
|
+
0,
|
|
114
|
+
j.property('init', j.identifier('childrenKey'), j.literal('children')),
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
arg.properties = nextProps;
|
|
118
|
+
path.node.callee = j.identifier('useTableTreeState');
|
|
119
|
+
hasChanges = true;
|
|
120
|
+
|
|
121
|
+
// Rename the destructured result: data -> visibleData (aliased back to
|
|
122
|
+
// the local name), expansionConfig -> treeConfig.
|
|
123
|
+
const declarator = path.parent.node;
|
|
124
|
+
if (
|
|
125
|
+
declarator.type === 'VariableDeclarator' &&
|
|
126
|
+
declarator.id.type === 'ObjectPattern'
|
|
127
|
+
) {
|
|
128
|
+
for (const p of declarator.id.properties) {
|
|
129
|
+
if (p.type !== 'ObjectProperty' && p.type !== 'Property') continue;
|
|
130
|
+
const kName = p.key?.name;
|
|
131
|
+
if (kName === 'data') {
|
|
132
|
+
// {data} -> {visibleData: data}
|
|
133
|
+
p.key = j.identifier('visibleData');
|
|
134
|
+
if (p.shorthand) {
|
|
135
|
+
p.shorthand = false;
|
|
136
|
+
p.value = j.identifier('data');
|
|
137
|
+
}
|
|
138
|
+
} else if (kName === 'expansionConfig') {
|
|
139
|
+
// {expansionConfig} -> {treeConfig} (keep it shorthand).
|
|
140
|
+
p.key = j.identifier('treeConfig');
|
|
141
|
+
if (p.value?.type === 'Identifier') {
|
|
142
|
+
p.value = j.identifier('treeConfig');
|
|
143
|
+
p.shorthand = true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Attach a one-line migration note as a leading comment on the
|
|
150
|
+
// statement, so a human confirms the expansion-state wiring.
|
|
151
|
+
const stmt = path.parent.parent.node;
|
|
152
|
+
if (stmt && !stmt.comments) {
|
|
153
|
+
stmt.comments = [
|
|
154
|
+
j.commentLine(
|
|
155
|
+
' astryx-migration: verify tree expansion state. useTableTreeState',
|
|
156
|
+
true,
|
|
157
|
+
false,
|
|
158
|
+
),
|
|
159
|
+
j.commentLine(
|
|
160
|
+
' is uncontrolled by default; pass defaultExpandedIds, or',
|
|
161
|
+
true,
|
|
162
|
+
false,
|
|
163
|
+
),
|
|
164
|
+
j.commentLine(
|
|
165
|
+
' expandedIds + onExpandedIdsChange for the old controlled set.',
|
|
166
|
+
true,
|
|
167
|
+
false,
|
|
168
|
+
),
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
void getChildrenValue;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// --- 2. Swap the plugin call: useTableRowExpansion(cfg) -> useTableTreeData(cfg) ---
|
|
175
|
+
if (pluginLocal) {
|
|
176
|
+
root
|
|
177
|
+
.find(j.CallExpression, {callee: {name: pluginLocal}})
|
|
178
|
+
.forEach((/** @type {any} */ path) => {
|
|
179
|
+
// Rename the argument identifier expansionConfig -> treeConfig.
|
|
180
|
+
const a = path.node.arguments[0];
|
|
181
|
+
if (a && a.type === 'Identifier' && a.name === 'expansionConfig') {
|
|
182
|
+
path.node.arguments[0] = j.identifier('treeConfig');
|
|
183
|
+
}
|
|
184
|
+
path.node.callee = j.identifier('useTableTreeData');
|
|
185
|
+
hasChanges = true;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (!hasChanges) return undefined;
|
|
190
|
+
|
|
191
|
+
// --- 3. Fix imports: drop the removed hooks, add the tree hooks ---
|
|
192
|
+
for (const path of importPaths) {
|
|
193
|
+
const specs = path.node.specifiers.filter(
|
|
194
|
+
(/** @type {any} */ s) =>
|
|
195
|
+
!(
|
|
196
|
+
s.type === 'ImportSpecifier' &&
|
|
197
|
+
(s.imported.name === 'useTableRowExpansionState' ||
|
|
198
|
+
s.imported.name === 'useTableRowExpansion')
|
|
199
|
+
),
|
|
200
|
+
);
|
|
201
|
+
const existing = new Set(
|
|
202
|
+
specs.map((/** @type {any} */ s) => s.imported?.name),
|
|
203
|
+
);
|
|
204
|
+
if (!existing.has('useTableTreeState')) {
|
|
205
|
+
specs.push(j.importSpecifier(j.identifier('useTableTreeState')));
|
|
206
|
+
}
|
|
207
|
+
if (!existing.has('useTableTreeData')) {
|
|
208
|
+
specs.push(j.importSpecifier(j.identifier('useTableTreeData')));
|
|
209
|
+
}
|
|
210
|
+
path.node.specifiers = specs;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return root.toSource({quote: 'single'});
|
|
214
|
+
}
|
|
@@ -15,7 +15,7 @@ export const docs = {
|
|
|
15
15
|
content: [
|
|
16
16
|
{
|
|
17
17
|
type: 'prose',
|
|
18
|
-
text: 'Astryx is built on modern web platform features: the Popover API, CSS anchor positioning, and CSS `light-dark()`. These let components stay small, accessible, and dependency-free, but they also set a floor on which browsers render everything correctly.',
|
|
18
|
+
text: 'Astryx is built on modern web platform features: the [`Popover`](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) API, CSS anchor positioning, and CSS `light-dark()`. These let components stay small, accessible, and dependency-free, but they also set a floor on which browsers render everything correctly.',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
type: 'prose',
|
|
@@ -73,7 +73,7 @@ export const docs = {
|
|
|
73
73
|
'Baseline 2026: the tightest requirement.',
|
|
74
74
|
],
|
|
75
75
|
[
|
|
76
|
-
'Popover API',
|
|
76
|
+
'[`Popover`](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) API',
|
|
77
77
|
'Opens, stacks, and light-dismisses layered surfaces via the top layer.',
|
|
78
78
|
'Baseline 2025.',
|
|
79
79
|
],
|
|
@@ -86,7 +86,7 @@ export const docs = {
|
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
type: 'prose',
|
|
89
|
-
text: 'The gap that matters is between Tier 1 and Tier 2: the Popover API and `light-dark()` reached wide availability well before anchor positioning. So in Tier 2 browsers, layered surfaces open and dismiss correctly; they just are not positioned. This is the one feature most consumers will need to reason about.',
|
|
89
|
+
text: 'The gap that matters is between Tier 1 and Tier 2: the [`Popover`](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) API and `light-dark()` reached wide availability well before anchor positioning. So in Tier 2 browsers, layered surfaces open and dismiss correctly; they just are not positioned. This is the one feature most consumers will need to reason about.',
|
|
90
90
|
},
|
|
91
91
|
],
|
|
92
92
|
},
|
|
@@ -112,7 +112,7 @@ export const docs = {
|
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
type: 'prose',
|
|
115
|
-
text: 'If your product does not use any of these, it has no anchor-positioning requirement at all; it needs only `light-dark()` (Tier 2 and up) for correct theme colors.
|
|
115
|
+
text: 'If your product does not use any of these, it has no anchor-positioning requirement at all; it needs only `light-dark()` (Tier 2 and up) for correct theme colors. Page layout, typography, forms, buttons, cards, tables, and navigation all work down to Tier 2 with no special handling.',
|
|
116
116
|
},
|
|
117
117
|
],
|
|
118
118
|
},
|
|
@@ -123,7 +123,7 @@ export const docs = {
|
|
|
123
123
|
type: 'list',
|
|
124
124
|
style: 'do',
|
|
125
125
|
items: [
|
|
126
|
-
'Components never throw on missing platform APIs. Where a browser lacks the Popover API, layers fall back to plain visibility instead of crashing.',
|
|
126
|
+
'Components never throw on missing platform APIs. Where a browser lacks the [`Popover`](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) API, layers fall back to plain visibility instead of crashing.',
|
|
127
127
|
'Tier 1 and Tier 2 are officially supported and tested.',
|
|
128
128
|
'Non-layered components render correctly down to Tier 2.',
|
|
129
129
|
],
|
|
@@ -192,7 +192,7 @@ const hasLightDark = CSS.supports('color', 'light-dark(#000, #fff)');`,
|
|
|
192
192
|
},
|
|
193
193
|
{
|
|
194
194
|
type: 'prose',
|
|
195
|
-
text: 'This is not an arbitrary window: Baseline − 2 is close to where anchor positioning stops being available while the Popover API and `light-dark()` still are, so the tier boundary tracks a real capability edge, not a guessed date. The version floors above are reviewed and advanced roughly once a year as new Baseline years land. Always feature-detect rather than hardcoding version numbers, so your app adapts automatically as the platform moves.',
|
|
195
|
+
text: 'This is not an arbitrary window: Baseline − 2 is close to where anchor positioning stops being available while the [`Popover`](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) API and `light-dark()` still are, so the tier boundary tracks a real capability edge, not a guessed date. The version floors above are reviewed and advanced roughly once a year as new Baseline years land. Always feature-detect rather than hardcoding version numbers, so your app adapts automatically as the platform moves.',
|
|
196
196
|
},
|
|
197
197
|
],
|
|
198
198
|
},
|
|
@@ -21,7 +21,7 @@ export const docs = {
|
|
|
21
21
|
type: 'code',
|
|
22
22
|
lang: 'text',
|
|
23
23
|
label: 'Paste this into your AI',
|
|
24
|
-
code: 'Install @astryxdesign/core, @astryxdesign/theme-neutral, and @astryxdesign/cli in this project, then run `npx @astryxdesign/cli init` to set up agent docs. Read the generated files to learn the conventions.',
|
|
24
|
+
code: 'Install @astryxdesign/core, @stylexjs/stylex, @astryxdesign/theme-neutral, and @astryxdesign/cli in this project, then run `npx @astryxdesign/cli init` to set up agent docs. Read the generated files to learn the conventions.',
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
27
|
},
|
|
@@ -34,13 +34,13 @@ export const docs = {
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
type: 'prose',
|
|
37
|
-
text: 'Add the core package, a theme
|
|
37
|
+
text: 'Add the core package and its `@stylexjs/stylex` peer dependency, plus a theme and the CLI.',
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
type: 'code',
|
|
41
41
|
lang: 'bash',
|
|
42
42
|
label: 'Terminal',
|
|
43
|
-
code: `npm install @astryxdesign/core @astryxdesign/theme-neutral @astryxdesign/cli`,
|
|
43
|
+
code: `npm install @astryxdesign/core @stylexjs/stylex @astryxdesign/theme-neutral @astryxdesign/cli`,
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
type: 'prose',
|
|
@@ -114,9 +114,9 @@ export const brandTheme = defineTheme({
|
|
|
114
114
|
type: 'list',
|
|
115
115
|
style: 'ordered',
|
|
116
116
|
items: [
|
|
117
|
-
'Add the name to IconName type in packages/core/src/Icon/globalIconRegistry.tsx',
|
|
118
|
-
'Add the default SVG to packages/core/src/Icon/defaultIcons.tsx',
|
|
119
|
-
'Add a row to the Available Names table in packages/cli/docs/icons.doc.mjs',
|
|
117
|
+
'Add the name to IconName type in `packages/core/src/Icon/globalIconRegistry.tsx`',
|
|
118
|
+
'Add the default SVG to `packages/core/src/Icon/defaultIcons.tsx`',
|
|
119
|
+
'Add a row to the Available Names table in `packages/cli/assets/docs/icons.doc.mjs`',
|
|
120
120
|
],
|
|
121
121
|
},
|
|
122
122
|
],
|
|
@@ -40,7 +40,7 @@ export const docs = {
|
|
|
40
40
|
'Keep illustrations consistent in style across the product.',
|
|
41
41
|
'Use simple, flat illustrations that work in both light and dark mode.',
|
|
42
42
|
'Size illustrations proportionally to the container, typically 120\u2013240px.',
|
|
43
|
-
'
|
|
43
|
+
'Place illustrations centered with supporting text below.',
|
|
44
44
|
],
|
|
45
45
|
},
|
|
46
46
|
{
|
|
@@ -59,7 +59,7 @@ export const docs = {
|
|
|
59
59
|
content: [
|
|
60
60
|
{
|
|
61
61
|
type: 'prose',
|
|
62
|
-
text: '
|
|
62
|
+
text: 'Place illustrations inside Center with supporting text stacked below. Typical illustration sizes range from 120px for inline empty states to 240px for full-page onboarding screens. Always pair the illustration with a heading and optional body text to explain what the user should do next.',
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
type: 'code',
|
|
@@ -300,7 +300,7 @@ export default function App() {
|
|
|
300
300
|
content: [
|
|
301
301
|
{
|
|
302
302
|
type: 'prose',
|
|
303
|
-
text: 'Astryx generates a `pseudo` locale that wraps every string in `⟦…⟧` and replaces letters with accented look-alikes.
|
|
303
|
+
text: 'Astryx generates a `pseudo` locale that wraps every string in `⟦…⟧` and replaces letters with accented look-alikes. Turn it on in development to catch hardcoded astryx strings and layout issues caused by longer text.',
|
|
304
304
|
},
|
|
305
305
|
{
|
|
306
306
|
type: 'code',
|
|
@@ -64,7 +64,7 @@ export const docsDense = {
|
|
|
64
64
|
'no Card-wrapped list items (card soup)',
|
|
65
65
|
'no stacked full-width Cards as page structure',
|
|
66
66
|
'no Cards in Cards',
|
|
67
|
-
'no decorative Badge
|
|
67
|
+
'no decorative Badge: counts/enums only; StatusDot/Token for status',
|
|
68
68
|
],
|
|
69
69
|
},
|
|
70
70
|
],
|
|
@@ -350,7 +350,7 @@ if (getComputedStyle(button).paddingInline === '0px') {
|
|
|
350
350
|
'Run the app in light and dark mode and check that surfaces, borders, text, icons, hover states, focus rings, and status colors flow together.',
|
|
351
351
|
'Open the command palette from the shell, type into it, select items by keyboard, and confirm focus returns to the trigger.',
|
|
352
352
|
'Check the SideNav at collapsed, expanded, active, hover, nested, and mobile states.',
|
|
353
|
-
'Verify settings popovers and dialogs in jsdom and in a real browser because native dialog and Popover APIs may need test shims.',
|
|
353
|
+
'Verify settings popovers and dialogs in jsdom and in a real browser because the native dialog and [`Popover`](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) APIs may need test shims.',
|
|
354
354
|
'Search for leftover hardcoded Tailwind colors, arbitrary hex values, and one-off hover colors after each route migration.',
|
|
355
355
|
'Run component tests, build, and at least one browser screenshot pass for each migrated route.',
|
|
356
356
|
],
|
|
@@ -39,7 +39,7 @@ export const docs = {
|
|
|
39
39
|
style: 'ordered',
|
|
40
40
|
items: [
|
|
41
41
|
'Use components for everything they cover',
|
|
42
|
-
'
|
|
42
|
+
'Page layout is frame-first: pick the shell and budget regions before writing content (see \`astryx docs layout\`)',
|
|
43
43
|
'Dense data renders as rows (Table, List/Item), edge-to-edge with dividers; Card is for widgets, galleries, and settings groups',
|
|
44
44
|
'StyleX or Tailwind for custom styling; both are first-class (see \`astryx docs styling\`)',
|
|
45
45
|
'Semantic tokens, not hardcoded values (see \`astryx docs tokens\`)',
|
|
@@ -56,7 +56,7 @@ export const docs = {
|
|
|
56
56
|
'`@astryxdesign/core/tailwind-theme.css`',
|
|
57
57
|
],
|
|
58
58
|
[
|
|
59
|
-
'
|
|
59
|
+
'Design token resolver APIs',
|
|
60
60
|
'JavaScript needs token values for charts, canvas, SVG, or config objects',
|
|
61
61
|
"`resolveThemeToken(theme, '--color-data-categorical-blue', {mode})`",
|
|
62
62
|
],
|
|
@@ -22,10 +22,10 @@ export const docs = {
|
|
|
22
22
|
type: 'table',
|
|
23
23
|
headers: ['Approach', 'Use for', 'Example'],
|
|
24
24
|
rows: [
|
|
25
|
-
['StyleX', 'Component-specific overrides, reusable styles, pseudo-classes, and typed tokens', 'const styles = stylex.create(...); <Button xstyle={styles.save}
|
|
26
|
-
['Tailwind utilities', '
|
|
27
|
-
['className', 'Integrating with external CSS or Tailwind on components', 'className="my-card shadow-lg"'],
|
|
28
|
-
['Styling-library token aliases', 'Keeping Panda, Chakra, MUI, Emotion, styled-components, UnoCSS, CSS Modules, or Sass in sync with the system', "colors.surface = 'var(--color-background-surface)'"],
|
|
25
|
+
['StyleX', 'Component-specific overrides, reusable styles, pseudo-classes, and typed tokens', '`const styles = stylex.create(...); <Button xstyle={styles.save} />`'],
|
|
26
|
+
['Tailwind utilities', 'Page layout, wrappers, and utility styling', '`className="flex gap-3 p-4"`'],
|
|
27
|
+
['className', 'Integrating with external CSS or Tailwind on components', '`className="my-card shadow-lg"`'],
|
|
28
|
+
['Styling-library token aliases', 'Keeping Panda, Chakra, MUI, Emotion, styled-components, UnoCSS, CSS Modules, or Sass in sync with the system', "`colors.surface = 'var(--color-background-surface)'`"],
|
|
29
29
|
],
|
|
30
30
|
},
|
|
31
31
|
{
|
|
@@ -106,7 +106,7 @@ function App() {
|
|
|
106
106
|
[
|
|
107
107
|
'Y2K',
|
|
108
108
|
"import {y2kTheme} from '@astryxdesign/theme-y2k'",
|
|
109
|
-
'Playful Y2K pop; periwinkle body, holographic accents, Poppins + Crimson Text
|
|
109
|
+
'Playful Y2K pop; periwinkle body, holographic accents, Poppins + `Crimson Text`.',
|
|
110
110
|
],
|
|
111
111
|
],
|
|
112
112
|
},
|
|
@@ -510,7 +510,7 @@ import './themes/ocean.css';
|
|
|
510
510
|
content: [
|
|
511
511
|
{
|
|
512
512
|
type: 'prose',
|
|
513
|
-
text: 'Wrap different sections in separate
|
|
513
|
+
text: 'Wrap different sections in separate [`<Theme>`](/components/Theme) providers.',
|
|
514
514
|
},
|
|
515
515
|
{
|
|
516
516
|
type: 'code',
|
|
@@ -606,7 +606,7 @@ function ChartConfig() {
|
|
|
606
606
|
},
|
|
607
607
|
{
|
|
608
608
|
type: 'prose',
|
|
609
|
-
text: 'Prefer CSS variables, StyleX token imports, xstyle, or className for ordinary styling. To change the theme or mode, manage state at the app level and pass it to
|
|
609
|
+
text: 'Prefer CSS variables, StyleX token imports, xstyle, or className for ordinary styling. To change the theme or mode, manage state at the app level and pass it to `<Theme>`.',
|
|
610
610
|
},
|
|
611
611
|
{
|
|
612
612
|
type: 'prose',
|
|
@@ -122,7 +122,7 @@ export const docs = {
|
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
type: 'prose',
|
|
125
|
-
text: 'Display text often needs heading semantics for accessibility. Use the type prop on Heading to apply display styling while preserving the correct HTML element:
|
|
125
|
+
text: 'Display text often needs heading semantics for accessibility. Use the type prop on Heading to apply display styling while preserving the correct HTML element: `<Heading level={1} type="display-1">` gives you display-1 styling with an `<h1>` tag, so screen readers see the correct document outline.',
|
|
126
126
|
},
|
|
127
127
|
],
|
|
128
128
|
},
|
|
@@ -205,7 +205,7 @@ const denseTheme = defineTheme({
|
|
|
205
205
|
items: [
|
|
206
206
|
'Use Heading for document headings and Text for everything else; they apply the full type scale automatically.',
|
|
207
207
|
'Adjust typography holistically: change base and ratio in defineTheme to shift the entire ramp (e.g. { base: 16, ratio: 1.25 } for editorial, { base: 12, ratio: 1.125 } for dense UI).',
|
|
208
|
-
'Use display types with as="h1" (or h2/h3) when display text is a page heading; this preserves accessibility while giving you display-level sizing. Or better, use
|
|
208
|
+
'Use display types with as="h1" (or h2/h3) when display text is a page heading; this preserves accessibility while giving you display-level sizing. Or better, use `<Heading level={1} type="display-1">` which handles both semantics and styling.',
|
|
209
209
|
'Let line-height snap to the 4px grid via the type scale; expandTypeScale computes leading automatically from base and ratio.',
|
|
210
210
|
'Use the supporting type for secondary information: timestamps, helper text, metadata, captions.',
|
|
211
211
|
'Use accessibilityLevel on Heading when the visual hierarchy doesn\u0027t match the document outline (e.g. sidebar or card headings).',
|
|
@@ -10,7 +10,7 @@ export default function AspectRatioCircleImage() {
|
|
|
10
10
|
<Center width={300}>
|
|
11
11
|
<AspectRatio ratio={1} shape="ellipse" fit="cover">
|
|
12
12
|
<img
|
|
13
|
-
src="
|
|
13
|
+
src="/template-assets/light-home-square-1.png"
|
|
14
14
|
alt="Circular image"
|
|
15
15
|
/>
|
|
16
16
|
</AspectRatio>
|
|
@@ -27,7 +27,7 @@ export default function AspectRatioImageGallery() {
|
|
|
27
27
|
{images.map(({id, alt}) => (
|
|
28
28
|
<AspectRatio key={id} ratio={4 / 3} fit="cover">
|
|
29
29
|
<img
|
|
30
|
-
src="
|
|
30
|
+
src="/template-assets/illustrative-horizontal-1.png"
|
|
31
31
|
alt={alt}
|
|
32
32
|
style={{borderRadius: 8}}
|
|
33
33
|
/>
|
|
@@ -10,19 +10,19 @@ const items = [
|
|
|
10
10
|
{
|
|
11
11
|
ratio: 1,
|
|
12
12
|
label: '1 : 1',
|
|
13
|
-
src: '
|
|
13
|
+
src: '/template-assets/light-home-square-1.png',
|
|
14
14
|
alt: '1:1 square',
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
ratio: 4 / 3,
|
|
18
18
|
label: '4 : 3',
|
|
19
|
-
src: '
|
|
19
|
+
src: '/template-assets/illustrative-horizontal-1.png',
|
|
20
20
|
alt: '4:3 standard',
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
ratio: 16 / 9,
|
|
24
24
|
label: '16 : 9',
|
|
25
|
-
src: '
|
|
25
|
+
src: '/template-assets/light-scene-horizontal-1.png',
|
|
26
26
|
alt: '16:9 widescreen',
|
|
27
27
|
},
|
|
28
28
|
];
|
|
@@ -10,7 +10,7 @@ export default function AspectRatioSquareImage() {
|
|
|
10
10
|
<Center width={300}>
|
|
11
11
|
<AspectRatio ratio={1} fit="cover">
|
|
12
12
|
<img
|
|
13
|
-
src="
|
|
13
|
+
src="/template-assets/light-home-square-1.png"
|
|
14
14
|
alt="1:1 square"
|
|
15
15
|
/>
|
|
16
16
|
</AspectRatio>
|
|
@@ -10,7 +10,7 @@ export default function AspectRatioWidescreen() {
|
|
|
10
10
|
<Center width={600}>
|
|
11
11
|
<AspectRatio ratio={16 / 9} fit="cover">
|
|
12
12
|
<img
|
|
13
|
-
src="
|
|
13
|
+
src="/template-assets/light-scene-horizontal-1.png"
|
|
14
14
|
alt="16:9 widescreen"
|
|
15
15
|
/>
|
|
16
16
|
</AspectRatio>
|
|
@@ -11,7 +11,7 @@ export default function AvatarFallbackChain() {
|
|
|
11
11
|
<VStack gap={4}>
|
|
12
12
|
<HStack gap={3} vAlign="center">
|
|
13
13
|
<Avatar
|
|
14
|
-
src="
|
|
14
|
+
src="/template-assets/DATA-Daniela-Gimenez.png"
|
|
15
15
|
name="Daniela Gimenez"
|
|
16
16
|
size="lg"
|
|
17
17
|
/>
|
|
@@ -19,8 +19,8 @@ export default function AvatarFallbackChain() {
|
|
|
19
19
|
</HStack>
|
|
20
20
|
<HStack gap={3} vAlign="center">
|
|
21
21
|
<Avatar
|
|
22
|
-
src="
|
|
23
|
-
fallbackSrc="
|
|
22
|
+
src="/template-assets/does-not-exist-primary.jpg"
|
|
23
|
+
fallbackSrc="/template-assets/DATA-Ami-Pena.png"
|
|
24
24
|
name="Invalid User"
|
|
25
25
|
size="lg"
|
|
26
26
|
/>
|
|
@@ -28,8 +28,8 @@ export default function AvatarFallbackChain() {
|
|
|
28
28
|
</HStack>
|
|
29
29
|
<HStack gap={3} vAlign="center">
|
|
30
30
|
<Avatar
|
|
31
|
-
src="
|
|
32
|
-
fallbackSrc="
|
|
31
|
+
src="/template-assets/does-not-exist-primary.jpg"
|
|
32
|
+
fallbackSrc="/template-assets/does-not-exist-fallback.jpg"
|
|
33
33
|
name="Test User"
|
|
34
34
|
size="lg"
|
|
35
35
|
/>
|
|
@@ -37,7 +37,7 @@ export default function AvatarFallbackChain() {
|
|
|
37
37
|
</HStack>
|
|
38
38
|
<HStack gap={3} vAlign="center">
|
|
39
39
|
<Avatar
|
|
40
|
-
src="
|
|
40
|
+
src="/template-assets/does-not-exist-primary.jpg"
|
|
41
41
|
size="lg"
|
|
42
42
|
/>
|
|
43
43
|
<Text type="supporting">All invalid, no name</Text>
|
|
@@ -10,23 +10,23 @@ import {Text} from '@astryxdesign/core/Text';
|
|
|
10
10
|
const USERS = [
|
|
11
11
|
{
|
|
12
12
|
name: 'Ami Pena',
|
|
13
|
-
src: '
|
|
13
|
+
src: '/template-assets/DATA-Ami-Pena.png',
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
name: 'Drew Young',
|
|
17
|
-
src: '
|
|
17
|
+
src: '/template-assets/DATA-Drew-Young.png',
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: 'Gabriela Fernandez',
|
|
21
|
-
src: '
|
|
21
|
+
src: '/template-assets/DATA-Gabriela-Fernandez.png',
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
name: 'Jihoo Song',
|
|
25
|
-
src: '
|
|
25
|
+
src: '/template-assets/DATA-Jihoo-Song.png',
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
name: 'Nam Tran',
|
|
29
|
-
src: '
|
|
29
|
+
src: '/template-assets/DATA-Nam-Tran.png',
|
|
30
30
|
},
|
|
31
31
|
];
|
|
32
32
|
|
|
@@ -11,7 +11,7 @@ export default function AvatarInteractive() {
|
|
|
11
11
|
<Stack direction="horizontal" gap={6} vAlign="start">
|
|
12
12
|
<Stack direction="vertical" gap={2} hAlign="center">
|
|
13
13
|
<Avatar
|
|
14
|
-
src="
|
|
14
|
+
src="/template-assets/DATA-Itai-Jordaan.png"
|
|
15
15
|
name="Itai Jordaan"
|
|
16
16
|
size="xl"
|
|
17
17
|
href="https://example.com/people/itai-jordaan"
|
|
@@ -22,7 +22,7 @@ export default function AvatarInteractive() {
|
|
|
22
22
|
</Stack>
|
|
23
23
|
<Stack direction="vertical" gap={2} hAlign="center">
|
|
24
24
|
<Avatar
|
|
25
|
-
src="
|
|
25
|
+
src="/template-assets/DATA-Margot-Schroder.png"
|
|
26
26
|
name="Margot Schroder"
|
|
27
27
|
size="xl"
|
|
28
28
|
onClick={() => window.alert('Opening Margot Schroder’s profile')}
|
|
@@ -9,23 +9,23 @@ export default function AvatarShowcase() {
|
|
|
9
9
|
return (
|
|
10
10
|
<Stack direction="horizontal" gap={4} vAlign="center">
|
|
11
11
|
<Avatar
|
|
12
|
-
src="
|
|
12
|
+
src="/template-assets/DATA-Ana-Thomas.png"
|
|
13
13
|
name="Ana Thomas"
|
|
14
14
|
size="xl"
|
|
15
15
|
status={<AvatarStatusDot variant="success" label="Online" />}
|
|
16
16
|
/>
|
|
17
17
|
<Avatar
|
|
18
|
-
src="
|
|
18
|
+
src="/template-assets/DATA-Drew-Young.png"
|
|
19
19
|
name="Drew Young"
|
|
20
20
|
size="xl"
|
|
21
21
|
/>
|
|
22
22
|
<Avatar
|
|
23
|
-
src="
|
|
23
|
+
src="/template-assets/DATA-Jihoo-Song.png"
|
|
24
24
|
name="Jihoo Song"
|
|
25
25
|
size="xl"
|
|
26
26
|
/>
|
|
27
27
|
<Avatar
|
|
28
|
-
src="
|
|
28
|
+
src="/template-assets/DATA-Nam-Tran.png"
|
|
29
29
|
name="Nam Tran"
|
|
30
30
|
size="xl"
|
|
31
31
|
status={<AvatarStatusDot variant="error" label="Busy" />}
|