@astryxdesign/cli 0.7.0-canary.e3c1cfd → 0.7.0-canary.e48e2ef

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 (70) hide show
  1. package/README.md +61 -61
  2. package/api/integration/pack-check.test.mjs +8 -0
  3. package/api/template/template.doc.mjs +1 -1
  4. package/api/template/template.type.mjs +1 -1
  5. package/api/theme/build/build.d.mts +0 -1
  6. package/api/theme/build/build.mjs +4 -29
  7. package/api/theme/build/family.mjs +1 -1
  8. package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
  9. package/assets/codemods/transforms/next/__tests__/preserve-bottom-sheet-content-padding.test.mjs +178 -0
  10. package/assets/codemods/transforms/next/__tests__/validate-data-token-ownership.test.mjs +84 -0
  11. package/assets/codemods/transforms/next/index.mjs +24 -0
  12. package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
  13. package/assets/codemods/transforms/next/preserve-bottom-sheet-content-padding.mjs +242 -0
  14. package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
  15. package/assets/docs/author-a-theme.doc.mjs +1 -1
  16. package/assets/docs/spacing.doc.mjs +2 -2
  17. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  18. package/assets/docs/tree/tokens-spacing.doc.mjs +15 -15
  19. package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
  20. package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.tsx +1 -1
  21. package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.tsx +1 -1
  22. package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.tsx +1 -1
  23. package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +1 -1
  24. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
  25. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
  26. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
  27. package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.tsx +1 -1
  28. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  29. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
  30. package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
  31. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
  32. package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
  33. package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
  34. package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
  35. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
  36. package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
  37. package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
  38. package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
  39. package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
  40. package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
  41. package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
  42. package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
  43. package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
  44. package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
  45. package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
  46. package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
  47. package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
  48. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
  49. package/assets/templates/pages/canvas-editor/page.tsx +2 -2
  50. package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
  51. package/assets/templates/pages/payment-form/page.tsx +1 -1
  52. package/assets/templates/pages/table-filter/page.tsx +11 -6
  53. package/assets/templates/pages/table-inbox/page.tsx +3 -1
  54. package/assets/templates/pages/theme-showcase/page.tsx +2 -2
  55. package/assets/templates/themes/butter/butterTheme.ts +12 -0
  56. package/assets/templates/themes/chocolate/chocolateTheme.ts +12 -0
  57. package/assets/templates/themes/matcha/matchaTheme.ts +14 -14
  58. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +10 -9
  59. package/assets/templates/themes/neutral/neutralTheme.ts +12 -0
  60. package/assets/templates/themes/stone/stoneTheme.ts +12 -0
  61. package/assets/templates/themes/y2k/y2kTheme.ts +10 -10
  62. package/assets/theme.template.ts +1 -1
  63. package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
  64. package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
  65. package/foundation/discovery/template-needs.mjs +93 -11
  66. package/foundation/discovery/template-needs.test.mjs +106 -3
  67. package/foundation/env/package-manager.d.mts +13 -0
  68. package/foundation/env/package-manager.mjs +106 -63
  69. package/foundation/response/response-types.doc.mjs +1 -2
  70. package/package.json +9 -9
@@ -0,0 +1,242 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Codemod: preserve BottomSheet content geometry after it became a container
5
+ *
6
+ * BottomSheet now pads its content box like Dialog (theme `bottom-sheet`
7
+ * padding, else `--spacing-4`). Before, the content box had no padding, so
8
+ * callers supplied their own inset. This codemod keeps every existing sheet's
9
+ * geometry by adding `padding={0}` to imported BottomSheet elements that do not
10
+ * set `padding`.
11
+ *
12
+ * Sheets whose only child is a core `Section` or `Layout` are left alone: both
13
+ * escape the inset their container publishes, so they already render exactly
14
+ * as they did in the unpadded box.
15
+ *
16
+ * `padding={0}` goes before the first spread attribute, so a spread that
17
+ * carries `padding` still wins.
18
+ *
19
+ * `padding={0}` also zeroes the inset a nested `Layout` puts between its
20
+ * regions: a Layout's own `padding` restores only its outer edges, and the
21
+ * inner inset comes from the sheet's container chain. Such a sheet still gets
22
+ * `padding={0}`, plus a TODO comment on its statement (api.report is a stub;
23
+ * comments are the only warning channel).
24
+ */
25
+
26
+ export const meta = {
27
+ title: 'Preserve BottomSheet content padding',
28
+ description:
29
+ 'BottomSheet now pads its content like Dialog. Adds `padding={0}` to ' +
30
+ 'BottomSheet elements that do not set `padding`, keeping their previous ' +
31
+ 'unpadded content box. Sheets whose only child is a Section ' +
32
+ 'or Layout are left unchanged; they render identically. A sheet with a ' +
33
+ 'nested Layout anywhere in its content also gets a TODO comment, because ' +
34
+ "padding={0} removes the inset between that Layout's regions and the " +
35
+ "Layout's own padding restores only its outer edges. Remove " +
36
+ '`padding={0}` and your own inset to adopt the theme padding. An app ' +
37
+ 'whose theme already sets `bottom-sheet` padding on every edge is not ' +
38
+ 'affected by the new default; the transform cannot see the theme, so ' +
39
+ 'remove the added `padding={0}` there to keep the theme inset.',
40
+ };
41
+
42
+ const CORE_IMPORT_RE = /^@(astryxdesign|xds)\/core(?:\/|$)/;
43
+
44
+ const TODO_COMMENT =
45
+ ' TODO(astryx upgrade): BottomSheet now pads its content like Dialog. ' +
46
+ 'padding={0} keeps the unpadded content box, but it also removes the inset ' +
47
+ "between a nested Layout's regions, which the Layout's own padding does " +
48
+ "not restore. Drop padding={0} and the sheet content's own inset, or give " +
49
+ 'the Layout its inset another way. ';
50
+
51
+ /**
52
+ * Local JSX names bound to core components, by imported name.
53
+ * @param {any} root
54
+ * @param {any} j
55
+ * @param {string} component
56
+ * @returns {{direct: Set<string>, namespaces: Set<string>}}
57
+ */
58
+ function findBindings(root, j, component) {
59
+ const direct = new Set();
60
+ const namespaces = new Set();
61
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ importPath) => {
62
+ const source = importPath.node.source.value;
63
+ if (
64
+ importPath.node.importKind === 'type' ||
65
+ typeof source !== 'string' ||
66
+ !CORE_IMPORT_RE.test(source)
67
+ ) {
68
+ return;
69
+ }
70
+ const subpath = source.split('/').at(-1);
71
+ for (const specifier of importPath.node.specifiers ?? []) {
72
+ if (specifier.importKind === 'type') continue;
73
+ if (specifier.type === 'ImportSpecifier') {
74
+ const imported = specifier.imported?.name ?? specifier.imported?.value;
75
+ if (imported === component) {
76
+ direct.add(specifier.local?.name ?? imported);
77
+ }
78
+ } else if (
79
+ specifier.type === 'ImportDefaultSpecifier' &&
80
+ subpath === component
81
+ ) {
82
+ direct.add(specifier.local.name);
83
+ } else if (specifier.type === 'ImportNamespaceSpecifier') {
84
+ namespaces.add(specifier.local.name);
85
+ }
86
+ }
87
+ });
88
+ return {direct, namespaces};
89
+ }
90
+
91
+ /**
92
+ * @param {any} name JSX element name node
93
+ * @param {{direct: Set<string>, namespaces: Set<string>}} bindings
94
+ * @param {string} component
95
+ */
96
+ function nameMatches(name, bindings, component) {
97
+ if (name?.type === 'JSXIdentifier') {
98
+ return bindings.direct.has(name.name);
99
+ }
100
+ return (
101
+ name?.type === 'JSXMemberExpression' &&
102
+ name.object?.type === 'JSXIdentifier' &&
103
+ bindings.namespaces.has(name.object.name) &&
104
+ name.property?.name === component
105
+ );
106
+ }
107
+
108
+ // A parameter or local declaration with the imported name shadows the module
109
+ // binding (same rule as transform-prop.mjs): only a tag whose root binding
110
+ // resolves to the Program scope is the imported component.
111
+ /** @param {any} elementPath @param {any} name */
112
+ function isModuleBinding(elementPath, name) {
113
+ const localName =
114
+ name?.type === 'JSXIdentifier'
115
+ ? name.name
116
+ : name?.type === 'JSXMemberExpression' &&
117
+ name.object?.type === 'JSXIdentifier'
118
+ ? name.object.name
119
+ : null;
120
+ if (localName == null) return false;
121
+ const scope = elementPath.scope?.lookup(localName);
122
+ return scope?.path?.node?.type === 'Program';
123
+ }
124
+
125
+ /**
126
+ * Children that render something: drops whitespace-only text and empty
127
+ * `{}` / `{/* comment *\/}` containers.
128
+ * @param {any[]} children
129
+ */
130
+ function meaningfulChildren(children) {
131
+ return children.filter((/** @type {any} */ child) => {
132
+ if (child.type === 'JSXText') {
133
+ return child.value.trim() !== '';
134
+ }
135
+ if (child.type === 'JSXExpressionContainer') {
136
+ return child.expression?.type !== 'JSXEmptyExpression';
137
+ }
138
+ return true;
139
+ });
140
+ }
141
+
142
+ /**
143
+ * Attach the TODO to the nearest enclosing statement: a comment on a JSX node
144
+ * inside JSX children would print as text.
145
+ * @param {any} j
146
+ * @param {any} elementPath
147
+ */
148
+ function addTodo(j, elementPath) {
149
+ let path = elementPath;
150
+ while (path && !j.Statement.check(path.node)) {
151
+ path = path.parent;
152
+ }
153
+ if (!path) return;
154
+ const host = path.node;
155
+ host.comments = host.comments ?? [];
156
+ if (host.comments.some((/** @type {any} */ c) => c.value === TODO_COMMENT)) {
157
+ return;
158
+ }
159
+ host.comments.push(j.commentBlock(TODO_COMMENT, true, false));
160
+ }
161
+
162
+ /**
163
+ * @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
164
+ * @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
165
+ * @returns {string | null | undefined}
166
+ */
167
+ export default function transformer(file, api) {
168
+ if (!file.source.includes('BottomSheet')) return undefined;
169
+ const j = api.jscodeshift;
170
+ const root = j(file.source);
171
+ const sheets = findBindings(root, j, 'BottomSheet');
172
+ if (sheets.direct.size === 0 && sheets.namespaces.size === 0) {
173
+ return undefined;
174
+ }
175
+ const sections = findBindings(root, j, 'Section');
176
+ const layouts = findBindings(root, j, 'Layout');
177
+ let hasChanges = false;
178
+
179
+ root.find(j.JSXElement).forEach((/** @type {any} */ elementPath) => {
180
+ const opening = elementPath.node.openingElement;
181
+ if (!nameMatches(opening.name, sheets, 'BottomSheet')) return;
182
+ if (!isModuleBinding(elementPath, opening.name)) return;
183
+
184
+ const attributes = opening.attributes ?? [];
185
+ const setsPadding = attributes.some(
186
+ (/** @type {any} */ attribute) =>
187
+ attribute.type === 'JSXAttribute' && attribute.name?.name === 'padding',
188
+ );
189
+ if (setsPadding) return;
190
+
191
+ const children = meaningfulChildren(elementPath.node.children ?? []);
192
+ const hasChildrenAttribute = attributes.some(
193
+ (/** @type {any} */ attribute) =>
194
+ attribute.type === 'JSXAttribute' &&
195
+ attribute.name?.name === 'children',
196
+ );
197
+ if (
198
+ !hasChildrenAttribute &&
199
+ children.length === 1 &&
200
+ children[0].type === 'JSXElement' &&
201
+ (nameMatches(children[0].openingElement.name, sections, 'Section') ||
202
+ nameMatches(children[0].openingElement.name, layouts, 'Layout')) &&
203
+ isModuleBinding(
204
+ elementPath.get('children', 0),
205
+ children[0].openingElement.name,
206
+ )
207
+ ) {
208
+ return;
209
+ }
210
+
211
+ const padding = j.jsxAttribute(
212
+ j.jsxIdentifier('padding'),
213
+ j.jsxExpressionContainer(j.numericLiteral(0)),
214
+ );
215
+ const firstSpread = attributes.findIndex(
216
+ (/** @type {any} */ attribute) => attribute.type === 'JSXSpreadAttribute',
217
+ );
218
+ if (firstSpread === -1) {
219
+ attributes.push(padding);
220
+ } else {
221
+ attributes.splice(firstSpread, 0, padding);
222
+ }
223
+ opening.attributes = attributes;
224
+ hasChanges = true;
225
+
226
+ // Any nested core Layout loses the inset between its regions, with or
227
+ // without its own padding, so every one gets the TODO.
228
+ const hasNestedLayout =
229
+ j(elementPath)
230
+ .find(j.JSXOpeningElement)
231
+ .filter(
232
+ (/** @type {any} */ openingPath) =>
233
+ nameMatches(openingPath.node.name, layouts, 'Layout') &&
234
+ isModuleBinding(openingPath, openingPath.node.name),
235
+ ).length > 0;
236
+ if (hasNestedLayout) {
237
+ addTodo(j, elementPath);
238
+ }
239
+ });
240
+
241
+ return hasChanges ? root.toSource() : undefined;
242
+ }
@@ -0,0 +1,102 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Report data-token consumers that need an ownership migration.
5
+ *
6
+ * @input Consumer JavaScript/TypeScript source and generated theme CSS
7
+ * @output No rewritten source; actionable upgrade errors for fallback-less
8
+ * `var(--color-data-*)` uses (in JS strings, embedded or whole, and in CSS)
9
+ * and stale generated root-default artifacts
10
+ * @position Next-release upgrade validation for spec:AST-066
11
+ */
12
+
13
+ import * as path from 'node:path';
14
+
15
+ export const meta = {
16
+ title: 'Validate data-token ownership',
17
+ description:
18
+ 'Reports fallback-less data-token var() uses in source strings and stylesheets for manual CSS/non-CSS migration, and stale generated theme CSS that still owns root defaults.',
19
+ fileExtensions: ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs', '.css'],
20
+ };
21
+
22
+ // A use without a fallback; `var(--color-data-x, <fallback>)` stays valid.
23
+ const DIRECT_DATA_VAR = /var\(\s*(--color-data-[a-z0-9-]+)\s*\)/u;
24
+ const CSS_COMMENT = /\/\*[\s\S]*?\*\//gu;
25
+ const GENERATED_THEME_HEADER = '@generated by `astryx theme build`';
26
+ const ROOT_DATA_DECLARATION = /:root\s*\{[^}]*--color-data-/su;
27
+
28
+ /** @param {any} node */
29
+ function staticString(node) {
30
+ if (
31
+ (node?.type === 'StringLiteral' || node?.type === 'Literal') &&
32
+ typeof node.value === 'string'
33
+ ) {
34
+ return node.value;
35
+ }
36
+ if (node?.type === 'TemplateLiteral') {
37
+ // Each static chunk of the template; a use can sit between expressions.
38
+ return (node.quasis ?? [])
39
+ .map((/** @type {any} */ q) => q?.value?.cooked ?? q?.value?.raw ?? '')
40
+ .join('\u0000');
41
+ }
42
+ return undefined;
43
+ }
44
+
45
+ /**
46
+ * @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
47
+ * @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
48
+ * @returns {undefined}
49
+ */
50
+ export default function validateDataTokenOwnership(file, api) {
51
+ if (!file.source.includes('--color-data-')) return undefined;
52
+
53
+ if (path.extname(file.path) === '.css') {
54
+ if (
55
+ file.source.includes(GENERATED_THEME_HEADER) &&
56
+ ROOT_DATA_DECLARATION.test(file.source)
57
+ ) {
58
+ throw new Error(
59
+ 'This generated theme CSS still emits canonical data defaults at :root. Rebuild it with `astryx theme build`; defaults now come from compiled dataVars consumers.',
60
+ );
61
+ }
62
+ const uncommented = file.source.replace(CSS_COMMENT, comment =>
63
+ comment.replace(/[^\n]/gu, ' '),
64
+ );
65
+ const cssMatch = DIRECT_DATA_VAR.exec(uncommented);
66
+ if (cssMatch) {
67
+ const line = uncommented.slice(0, cssMatch.index).split('\n').length;
68
+ throw new Error(
69
+ `Raw var(${cssMatch[1]}) without a fallback at line ${line} needs manual migration: compiled dataVars output is not guaranteed in this stylesheet, so add an explicit fallback or style the element from code that imports dataVars from @astryxdesign/core/theme/dataTokens.stylex.`,
70
+ );
71
+ }
72
+ return undefined;
73
+ }
74
+
75
+ const j = api.jscodeshift;
76
+ const root = j(file.source);
77
+ /** @type {{token: string, line: number|null}|null} */
78
+ let found = null;
79
+ const inspect = (/** @type {any} */ node) => {
80
+ if (found) return;
81
+ const value = staticString(node);
82
+ const match =
83
+ typeof value === 'string' ? value.match(DIRECT_DATA_VAR) : null;
84
+ if (match) {
85
+ found = {token: match[1], line: node.loc?.start?.line ?? null};
86
+ }
87
+ };
88
+
89
+ /** @param {any} nodePath */
90
+ const inspectPath = nodePath => inspect(nodePath.node);
91
+ root.find(j.StringLiteral).forEach(inspectPath);
92
+ root.find(j.Literal).forEach(inspectPath);
93
+ root.find(j.TemplateLiteral).forEach(inspectPath);
94
+
95
+ if (found) {
96
+ const {token, line} = found;
97
+ throw new Error(
98
+ `Direct var(${token})${line == null ? '' : ` at line ${line}`} needs manual migration: CSS-capable code imports dataVars from @astryxdesign/core/theme/dataTokens.stylex; Canvas and other non-CSS APIs use resolveThemeToken() or useTheme().token().`,
99
+ );
100
+ }
101
+ return undefined;
102
+ }
@@ -157,7 +157,7 @@ export const docs = {
157
157
  {
158
158
  title: 'useTheme Hook',
159
159
  content: [
160
- {type: 'prose', text: '`useTheme()` reads the nearest Theme and effective color mode from React context. Use it inside client components for SVG, canvas, charts, maps, and third-party configuration objects that need token values in JavaScript.'},
160
+ {type: 'prose', text: '`useTheme()` reads the nearest Theme and effective color mode from React context. Prefer `dataVars` for CSS-capable SVG and DOM values. Use this hook for canvas, charts, maps, third-party configuration objects, or an SVG API that requires a concrete JavaScript color instead of a `var(...)` reference.'},
161
161
  {type: 'code', lang: 'tsx', label: 'Access resolved token values in React', code: "import {useMemo} from 'react';\nimport {useTheme} from '@astryxdesign/core/theme';\n\nfunction ChartConfig() {\n const {mode, tokens} = useTheme();\n const options = useMemo(() => ({\n mode,\n textColor: tokens['--color-text-primary'],\n gridColor: tokens['--color-border'],\n seriesColor: tokens['--color-data-categorical-blue'],\n }), [mode, tokens]);\n return <Chart options={options} />;\n}"},
162
162
  {type: 'prose', text: 'Prefer CSS variables for ordinary styling. See {@link generic:use-a-theme} for the provider setup, and {@link namespace:tokens} for the full token reference.'},
163
163
  ],
@@ -18,7 +18,7 @@ export const docs = {
18
18
  content: [
19
19
  {
20
20
  type: 'prose',
21
- text: 'The design system uses a 4px base-unit spacing scale. Component gap props accept step values that map to these tokens. The scale provides fine-grained control at the small end (2px, 4px, 6px) and consistent rhythm at larger sizes (multiples of 4px).',
21
+ text: 'The design system uses a 4px base-unit spacing scale, written in rem so gaps and padding grow with the reader\'s browser font size the way text does: each step is 0.25rem, which is 4px at the default 16px root. Component gap props accept step values that map to these tokens. The scale provides fine-grained control at the small end (2px, 4px, 6px) and consistent rhythm at larger sizes (multiples of 4px).',
22
22
  },
23
23
  ],
24
24
  },
@@ -28,7 +28,7 @@ export const docs = {
28
28
  content: [
29
29
  {
30
30
  type: 'prose',
31
- text: 'Fifteen spacing tokens, from 0px to 48px.',
31
+ text: 'Fifteen spacing tokens, from 0 to 3rem (0px to 48px at the default 16px root).',
32
32
  },
33
33
  {
34
34
  type: 'token-ref',
@@ -17,14 +17,14 @@ export const docs = {
17
17
  "order": 20
18
18
  },
19
19
  "category": "foundations",
20
- "description": "Colors for charts and graphs: one categorical accent per series, a neutral for labels and reference lines, and sequential ramps from 5 (darkest) to 1 (lightest) for ordered scales and heatmaps. Import their public StyleX variables from @astryxdesign/core/theme/dataTokens.stylex.",
20
+ "description": "Colors for charts and graphs: one categorical accent per series, a neutral for labels and reference lines, and sequential ramps from 5 (darkest) to 1 (lightest) for ordered scales and heatmaps. Import dataVars from @astryxdesign/core/theme/dataTokens.stylex for CSS-capable code. Retaining any member emits the complete 56-variable group; an unused graph emits none.",
21
21
  "sections": [
22
22
  {
23
23
  "title": "Data Visualization Tokens",
24
24
  "content": [
25
25
  {
26
26
  "type": "prose",
27
- "text": "Colors for charts and graphs: one categorical accent per series, a neutral for labels and reference lines, and sequential ramps from 5 (darkest) to 1 (lightest) for ordered scales and heatmaps. Import their public StyleX variables from @astryxdesign/core/theme/dataTokens.stylex."
27
+ "text": "Colors for charts and graphs: one categorical accent per series, a neutral for labels and reference lines, and sequential ramps from 5 (darkest) to 1 (lightest) for ordered scales and heatmaps. Import dataVars from @astryxdesign/core/theme/dataTokens.stylex for CSS-capable code. Retaining any member emits the complete 56-variable group; an unused graph emits none."
28
28
  },
29
29
  {
30
30
  "type": "table",
@@ -35,63 +35,63 @@ export const docs = {
35
35
  "rows": [
36
36
  [
37
37
  "--spacing-0",
38
- "0px"
38
+ "0rem"
39
39
  ],
40
40
  [
41
41
  "--spacing-0-5",
42
- "2px"
42
+ "0.125rem"
43
43
  ],
44
44
  [
45
45
  "--spacing-1",
46
- "4px"
46
+ "0.25rem"
47
47
  ],
48
48
  [
49
49
  "--spacing-1-5",
50
- "6px"
50
+ "0.375rem"
51
51
  ],
52
52
  [
53
53
  "--spacing-2",
54
- "8px"
54
+ "0.5rem"
55
55
  ],
56
56
  [
57
57
  "--spacing-3",
58
- "12px"
58
+ "0.75rem"
59
59
  ],
60
60
  [
61
61
  "--spacing-4",
62
- "16px"
62
+ "1rem"
63
63
  ],
64
64
  [
65
65
  "--spacing-5",
66
- "20px"
66
+ "1.25rem"
67
67
  ],
68
68
  [
69
69
  "--spacing-6",
70
- "24px"
70
+ "1.5rem"
71
71
  ],
72
72
  [
73
73
  "--spacing-7",
74
- "28px"
74
+ "1.75rem"
75
75
  ],
76
76
  [
77
77
  "--spacing-8",
78
- "32px"
78
+ "2rem"
79
79
  ],
80
80
  [
81
81
  "--spacing-9",
82
- "36px"
82
+ "2.25rem"
83
83
  ],
84
84
  [
85
85
  "--spacing-10",
86
- "40px"
86
+ "2.5rem"
87
87
  ],
88
88
  [
89
89
  "--spacing-11",
90
- "44px"
90
+ "2.75rem"
91
91
  ],
92
92
  [
93
93
  "--spacing-12",
94
- "48px"
94
+ "3rem"
95
95
  ]
96
96
  ]
97
97
  }
@@ -28,7 +28,7 @@ export const docs = {
28
28
  },
29
29
  {
30
30
  "type": "prose",
31
- "text": "See {@link namespace:styling} for how to apply tokens via xstyle, className, and compound component patterns. See {@link generic:author-a-theme} for overriding tokens with defineTheme."
31
+ "text": "Use `dataVars` for StyleX, DOM styles, and SVG presentation attributes. Canvas and other APIs that require concrete mode-resolved values use `resolveThemeToken()` or `useTheme().token()` instead. Raw CSS may use the stable custom-property names only when compiled dataVars output is guaranteed or the declaration carries an explicit fallback. See {@link namespace:styling} for xstyle, className, and compound component patterns, and {@link generic:author-a-theme} for overriding tokens with defineTheme."
32
32
  }
33
33
  ]
34
34
  }
@@ -34,7 +34,7 @@ export default function BottomSheetHeights() {
34
34
  onOpenChange={isOpen => !isOpen && setHeight(null)}
35
35
  label={`${height ?? 'Hug'} height`}
36
36
  height={height ?? 'hug'}>
37
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
37
+ <VStack gap={4}>
38
38
  <Heading level={3}>{height ?? 'Hug'} height</Heading>
39
39
  <Divider />
40
40
  <Text type="body">{descriptions[height ?? 'hug']}</Text>
@@ -51,7 +51,7 @@ export default function BottomSheetMobileKeyboard() {
51
51
  event.preventDefault();
52
52
  setIsOpen(false);
53
53
  }}>
54
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
54
+ <VStack gap={4}>
55
55
  <Heading level={3}>Edit profile</Heading>
56
56
  <Divider />
57
57
  <Text type="supporting" color="secondary">
@@ -33,7 +33,7 @@ export default function BottomSheetNoScrim() {
33
33
  label="Place details"
34
34
  height="hug"
35
35
  hasScrim={false}>
36
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
36
+ <VStack gap={4}>
37
37
  <Heading level={3}>Central Park</Heading>
38
38
  <Divider />
39
39
  <Text type="body">
@@ -122,7 +122,7 @@ export default function BottomSheetSnapPoints() {
122
122
  label="Directions to the Ferry Building"
123
123
  height="tall"
124
124
  snapPoints={SNAP_POINTS}>
125
- <VStack gap={4} padding={4}>
125
+ <VStack gap={4}>
126
126
  <VStack gap={1}>
127
127
  <Heading level={3}>Ferry Building</Heading>
128
128
  <HStack gap={2}>
@@ -47,7 +47,7 @@ export default function ComplexSelectorDeadlinePicker() {
47
47
  value={value}
48
48
  onChange={setValue}
49
49
  triggerLabel={formatDeadline(value)}
50
- style={{width: 320}}>
50
+ controlStyle={{width: 320}}>
51
51
  {(selectedValue, onChange, close) => {
52
52
  const set = (patch: Partial<Deadline>) =>
53
53
  onChange({...selectedValue, ...patch});
@@ -184,7 +184,7 @@ export default function ComplexSelectorShowcase() {
184
184
  value={value}
185
185
  onChange={setValue}
186
186
  triggerLabel={`${value.fruit} · ${value.ripeness}`}
187
- style={{width: 280}}>
187
+ controlStyle={{width: 280}}>
188
188
  {(selectedValue, onChange, close) => (
189
189
  <FruitRipenessGrid
190
190
  value={selectedValue}
@@ -175,7 +175,7 @@ export default function ComplexSelectorTreeSearch() {
175
175
  value={value}
176
176
  onChange={setValue}
177
177
  triggerLabel={value.path}
178
- style={{width: 360}}>
178
+ controlStyle={{width: 360}}>
179
179
  {(selectedValue, onChange, close) => (
180
180
  <DestinationSearch
181
181
  value={selectedValue}
@@ -68,7 +68,7 @@ function AdaptiveDialog({
68
68
  label={title}
69
69
  purpose={purpose}
70
70
  height={bottomSheetHeight}>
71
- <VStack gap={4} style={{padding: 'var(--spacing-4)'}}>
71
+ <VStack gap={4}>
72
72
  <Heading level={3}>{title}</Heading>
73
73
  {children}
74
74
  {footer}
@@ -29,7 +29,7 @@ export default function InternationalizationProviderShippedLocale() {
29
29
  <SegmentedControlItem value="fr-FR" label="FR" />
30
30
  </SegmentedControl>
31
31
  <Selector
32
- style={{width: 300}}
32
+ controlStyle={{width: 300}}
33
33
  label="Billing region"
34
34
  options={[
35
35
  {value: 'americas', label: 'Americas'},
@@ -17,7 +17,7 @@ export default function InternationalizationProviderOverrides() {
17
17
  },
18
18
  }}>
19
19
  <Selector
20
- style={{width: 300}}
20
+ controlStyle={{width: 300}}
21
21
  label="Billing region"
22
22
  options={[
23
23
  {value: 'americas', label: 'Americas'},
@@ -9,7 +9,7 @@ export default function SelectorClearable() {
9
9
  const [value, setValue] = useState<string | null>('engineering');
10
10
  return (
11
11
  <Selector
12
- style={{width: 300}}
12
+ controlStyle={{width: 300}}
13
13
  label="Department"
14
14
  options={[
15
15
  {value: 'engineering', label: 'Engineering'},
@@ -32,7 +32,7 @@ export default function SelectorOptionDescriptions() {
32
32
  return (
33
33
  <Stack direction="vertical" gap={6}>
34
34
  <Selector
35
- style={{width: 320}}
35
+ controlStyle={{width: 320}}
36
36
  label="Visibility"
37
37
  description="Default trigger: one line at the size token."
38
38
  options={VISIBILITY}
@@ -40,7 +40,7 @@ export default function SelectorOptionDescriptions() {
40
40
  onChange={setCondensed}
41
41
  />
42
42
  <Selector
43
- style={{width: 320}}
43
+ controlStyle={{width: 320}}
44
44
  label="Visibility"
45
45
  description="A stacked SelectorOption: the description gets its own line, and the trigger grows by exactly one line."
46
46
  options={VISIBILITY}
@@ -9,7 +9,7 @@ export default function SelectorShowcase() {
9
9
  const [value, setValue] = useState<string | undefined>();
10
10
  return (
11
11
  <Selector
12
- style={{width: 300}}
12
+ controlStyle={{width: 300}}
13
13
  label="Fruit"
14
14
  options={['Apple', 'Banana', 'Orange', 'Mango', 'Pineapple']}
15
15
  placeholder="Select a fruit..."
@@ -9,7 +9,7 @@ export default function SelectorWithSections() {
9
9
  const [value, setValue] = useState<string | undefined>();
10
10
  return (
11
11
  <Selector
12
- style={{width: 300}}
12
+ controlStyle={{width: 300}}
13
13
  label="Office"
14
14
  options={[
15
15
  {
@@ -22,7 +22,7 @@ export default function SelectorOptionBasic() {
22
22
 
23
23
  return (
24
24
  <Selector
25
- style={{width: 300}}
25
+ controlStyle={{width: 300}}
26
26
  label="Role"
27
27
  options={roles}
28
28
  value={value}
@@ -25,7 +25,7 @@ export default function SelectorOptionShowcase() {
25
25
 
26
26
  return (
27
27
  <Selector
28
- style={{width: 300}}
28
+ controlStyle={{width: 300}}
29
29
  label="Role"
30
30
  options={roles}
31
31
  value={value}