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

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 (53) 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__/validate-data-token-ownership.test.mjs +84 -0
  10. package/assets/codemods/transforms/next/index.mjs +16 -0
  11. package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
  12. package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
  13. package/assets/docs/author-a-theme.doc.mjs +1 -1
  14. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  15. package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
  16. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
  17. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
  18. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
  19. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  20. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
  21. package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
  22. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
  23. package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
  24. package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
  25. package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
  26. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
  27. package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
  28. package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
  29. package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
  30. package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
  31. package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
  32. package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
  33. package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
  34. package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
  35. package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
  36. package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
  37. package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
  38. package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
  39. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
  40. package/assets/templates/pages/canvas-editor/page.tsx +2 -2
  41. package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
  42. package/assets/templates/pages/payment-form/page.tsx +1 -1
  43. package/assets/templates/pages/table-filter/page.tsx +3 -3
  44. package/assets/templates/pages/theme-showcase/page.tsx +2 -2
  45. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +10 -9
  46. package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
  47. package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
  48. package/foundation/discovery/template-needs.mjs +93 -11
  49. package/foundation/discovery/template-needs.test.mjs +106 -3
  50. package/foundation/env/package-manager.d.mts +13 -0
  51. package/foundation/env/package-manager.mjs +106 -63
  52. package/foundation/response/response-types.doc.mjs +1 -2
  53. package/package.json +9 -9
@@ -0,0 +1,84 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, expect, it} from 'vitest';
4
+ import transform from '../validate-data-token-ownership.mjs';
5
+
6
+ async function run(source, file = 'test.tsx') {
7
+ const jscodeshift = (await import('jscodeshift')).default;
8
+ const parser =
9
+ file.endsWith('.ts') || file.endsWith('.tsx') ? 'tsx' : 'babel';
10
+ const api = {
11
+ jscodeshift: jscodeshift.withParser(parser),
12
+ stats: () => {},
13
+ report: () => {},
14
+ };
15
+ return transform({source, path: file}, api);
16
+ }
17
+
18
+ describe('validate-data-token-ownership', () => {
19
+ it('reports direct string and static-template consumers with both migration paths', async () => {
20
+ for (const source of [
21
+ `const fill = 'var(--color-data-categorical-green)';`,
22
+ 'const fill = `var(--color-data-categorical-green)`;',
23
+ `const border = '1px solid var(--color-data-categorical-green)';`,
24
+ 'const border = `${width}px solid var(--color-data-categorical-green)`;',
25
+ ]) {
26
+ await expect(run(source)).rejects.toThrow(
27
+ /CSS-capable code imports dataVars.*Canvas.*resolveThemeToken/s,
28
+ );
29
+ }
30
+ });
31
+
32
+ it('leaves fallbacks, dataVars access, and comments unchanged', async () => {
33
+ const source = `
34
+ // var(--color-data-categorical-green)
35
+ const fallback = 'var(--color-data-categorical-green, #008000)';
36
+ const fill = dataVars['--color-data-categorical-green'];
37
+ `;
38
+ expect(await run(source)).toBeUndefined();
39
+ });
40
+
41
+ it('reports stale generated theme CSS with root data defaults', async () => {
42
+ const source = `/* @generated by \`astryx theme build\` */
43
+ @layer astryx-base {
44
+ :root { --color-data-categorical-green: #008000; }
45
+ }`;
46
+ await expect(run(source, 'theme.css')).rejects.toThrow(
47
+ /Rebuild it with `astryx theme build`/,
48
+ );
49
+ });
50
+
51
+ it('reports raw stylesheet uses without a fallback', async () => {
52
+ await expect(
53
+ run('.bar { fill: var(--color-data-categorical-green); }', 'chart.css'),
54
+ ).rejects.toThrow(/Raw var\(--color-data-categorical-green\).*line 1/s);
55
+ });
56
+
57
+ it('leaves stylesheet uses with a fallback, and comments, unchanged', async () => {
58
+ expect(
59
+ await run(
60
+ `/* var(--color-data-categorical-green) */
61
+ .bar { fill: var(--color-data-categorical-green, #008000); }`,
62
+ 'chart.css',
63
+ ),
64
+ ).toBeUndefined();
65
+ });
66
+
67
+ it('does not claim ownership of hand-authored CSS or sparse theme overrides', async () => {
68
+ expect(
69
+ await run(
70
+ ':root { --color-data-categorical-green: #008000; }',
71
+ 'app.css',
72
+ ),
73
+ ).toBeUndefined();
74
+ expect(
75
+ await run(
76
+ `/* @generated by \`astryx theme build\` */
77
+ @scope ([data-astryx-theme="ocean"]) {
78
+ :scope { --color-data-categorical-green: #008000; }
79
+ }`,
80
+ 'theme.css',
81
+ ),
82
+ ).toBeUndefined();
83
+ });
84
+ });
@@ -10,6 +10,12 @@
10
10
  import migrateDeprecatedThemeSurface, {
11
11
  meta as migrateDeprecatedThemeSurfaceMeta,
12
12
  } from './migrate-deprecated-theme-surface.mjs';
13
+ import migrateFieldInputStyling, {
14
+ meta as migrateFieldInputStylingMeta,
15
+ } from './migrate-field-input-styling.mjs';
16
+ import validateDataTokenOwnership, {
17
+ meta as validateDataTokenOwnershipMeta,
18
+ } from './validate-data-token-ownership.mjs';
13
19
 
14
20
  export default [
15
21
  {
@@ -17,4 +23,14 @@ export default [
17
23
  transform: migrateDeprecatedThemeSurface,
18
24
  meta: migrateDeprecatedThemeSurfaceMeta,
19
25
  },
26
+ {
27
+ name: 'validate-data-token-ownership',
28
+ transform: validateDataTokenOwnership,
29
+ meta: validateDataTokenOwnershipMeta,
30
+ },
31
+ {
32
+ name: 'migrate-field-input-styling',
33
+ transform: migrateFieldInputStyling,
34
+ meta: migrateFieldInputStylingMeta,
35
+ },
20
36
  ];
@@ -0,0 +1,198 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Migrate root styling on Field-composed inputs to their named parts.
5
+ *
6
+ * Field-composed inputs no longer accept root `xstyle`, `className`, or
7
+ * `style` (family:input-fields FR10). Each rename keeps the element the
8
+ * styling reached before: components whose root styling painted the visual
9
+ * control box move to `controlXstyle`/`controlClassName`/`controlStyle`;
10
+ * components whose root styling reached the Field box move to
11
+ * `containerXstyle`/`containerClassName`/`containerStyle`.
12
+ *
13
+ * Only JSX attributes written directly on an element bound to an Astryx import
14
+ * are renamed (named, aliased, or namespace imports). Spread attributes,
15
+ * wrappers that forward their own props, and unrelated components of the same
16
+ * name are left alone; those callsites fail type-checking and are migrated by
17
+ * hand. When the target attribute is already present, the root attribute gets a
18
+ * TODO instead of a rename so no value is silently dropped.
19
+ */
20
+
21
+ import {transformProp} from '../../transform-prop.mjs';
22
+
23
+ export const meta = {
24
+ title: 'Migrate input root styling to container/control parts',
25
+ description:
26
+ 'Renames root `xstyle`/`className`/`style` on Field-composed inputs to the `control*` or `container*` part they styled before.',
27
+ fileExtensions: ['.tsx', '.jsx', '.ts', '.js', '.mjs', '.cjs'],
28
+ };
29
+
30
+ /** Components whose root styling painted the visual control box. */
31
+ const CONTROL_COMPONENTS = [
32
+ 'TextInput',
33
+ 'TextArea',
34
+ 'NumberInput',
35
+ 'FileInput',
36
+ 'DateInput',
37
+ 'DateRangeInput',
38
+ 'DateTimeInput',
39
+ 'TimeInput',
40
+ 'Selector',
41
+ 'MultiSelector',
42
+ 'ComplexSelector',
43
+ ];
44
+
45
+ /** Components whose root styling reached the Field box. */
46
+ const CONTAINER_COMPONENTS = [
47
+ 'Typeahead',
48
+ 'Tokenizer',
49
+ 'CheckboxList',
50
+ 'RadioList',
51
+ 'Slider',
52
+ ];
53
+
54
+ /**
55
+ * Field-root members that also render inside InputGroup. There Field is absent
56
+ * and root styling painted the control surface, so it moves to `control*`.
57
+ */
58
+ const GROUPED_CONTROL_COMPONENTS = new Set(['Typeahead']);
59
+
60
+ /** @type {ReadonlyMap<string, 'control' | 'container'>} */
61
+ const PART_BY_COMPONENT = new Map([
62
+ ...CONTROL_COMPONENTS.map(name => /** @type {const} */ ([name, 'control'])),
63
+ ...CONTAINER_COMPONENTS.map(
64
+ name => /** @type {const} */ ([name, 'container']),
65
+ ),
66
+ ]);
67
+
68
+ const ROOT_STYLE_PROPS = /** @type {const} */ ({
69
+ xstyle: 'Xstyle',
70
+ className: 'ClassName',
71
+ style: 'Style',
72
+ });
73
+
74
+ const PACKAGE_PATTERN = /^@(astryxdesign|xds)\/core(\/[A-Za-z]+)?$/u;
75
+
76
+ const TODO =
77
+ ' TODO(astryx upgrade): root styling is no longer accepted here; merge it into ';
78
+
79
+ /** @type {ReadonlyMap<string, ReadonlySet<string>>} */
80
+ const COMPONENT_PROPS = new Map(
81
+ [...PART_BY_COMPONENT.keys()].map(name => [
82
+ name,
83
+ new Set(Object.keys(ROOT_STYLE_PROPS)),
84
+ ]),
85
+ );
86
+
87
+ /**
88
+ * @param {import('../../../../authoring/codemod/type').AstryxCodemodFile} file
89
+ * @param {import('../../../../authoring/codemod/type').CodemodTransformApi} api
90
+ * @returns {string | undefined}
91
+ */
92
+ export default function migrateFieldInputStyling(file, api) {
93
+ if (!/xstyle|className|style/u.test(file.source)) return undefined;
94
+ if (![...PART_BY_COMPONENT.keys()].some(name => file.source.includes(name))) {
95
+ return undefined;
96
+ }
97
+
98
+ const j = api.jscodeshift;
99
+ const root = j(file.source);
100
+ const matchesImport = (/** @type {string} */ source) =>
101
+ PACKAGE_PATTERN.test(source);
102
+
103
+ // Local names that resolve to an Astryx InputGroup (named or namespace).
104
+ /** @type {Set<string>} */
105
+ const inputGroupNames = new Set();
106
+ /** @type {Set<string>} */
107
+ const namespaceNames = new Set();
108
+ root.find(j.ImportDeclaration).forEach((/** @type {any} */ path) => {
109
+ const source = path.node.source.value;
110
+ if (path.node.importKind === 'type') return;
111
+ if (typeof source !== 'string' || !matchesImport(source)) return;
112
+ for (const specifier of path.node.specifiers ?? []) {
113
+ if (specifier.importKind === 'type') continue;
114
+ if (
115
+ specifier.type === 'ImportSpecifier' &&
116
+ specifier.imported?.name === 'InputGroup'
117
+ ) {
118
+ inputGroupNames.add(specifier.local?.name ?? 'InputGroup');
119
+ } else if (specifier.type === 'ImportNamespaceSpecifier') {
120
+ namespaceNames.add(specifier.local.name);
121
+ }
122
+ }
123
+ });
124
+
125
+ /** @param {any} elementPath a JSXElement path */
126
+ const isInputGroup = elementPath => {
127
+ const name = elementPath.node.openingElement.name;
128
+ let localName;
129
+ if (name.type === 'JSXIdentifier' && inputGroupNames.has(name.name)) {
130
+ localName = name.name;
131
+ } else if (
132
+ name.type === 'JSXMemberExpression' &&
133
+ name.object?.type === 'JSXIdentifier' &&
134
+ name.property?.type === 'JSXIdentifier' &&
135
+ name.property.name === 'InputGroup' &&
136
+ namespaceNames.has(name.object.name)
137
+ ) {
138
+ localName = name.object.name;
139
+ } else {
140
+ return false;
141
+ }
142
+ const scope = elementPath.scope?.lookup(localName);
143
+ return scope?.path.node.type === 'Program';
144
+ };
145
+
146
+ /** @param {any} openingPath a JSXOpeningElement path */
147
+ const isInsideInputGroup = openingPath => {
148
+ for (let p = openingPath.parent?.parent; p; p = p.parent) {
149
+ if (p.node.type === 'JSXElement' && isInputGroup(p)) return true;
150
+ }
151
+ return false;
152
+ };
153
+
154
+ let changed = false;
155
+ transformProp(
156
+ root,
157
+ j,
158
+ {matchesImport, components: COMPONENT_PROPS},
159
+ (propPath, {component}) => {
160
+ const attribute = propPath.node;
161
+ const openingPath = propPath.parent;
162
+ let part = PART_BY_COMPONENT.get(component);
163
+ if (!part) return;
164
+ if (
165
+ part === 'container' &&
166
+ GROUPED_CONTROL_COMPONENTS.has(component) &&
167
+ isInsideInputGroup(openingPath)
168
+ ) {
169
+ part = 'control';
170
+ }
171
+ const name = /** @type {keyof typeof ROOT_STYLE_PROPS} */ (
172
+ attribute.name.name
173
+ );
174
+ const next = part + ROOT_STYLE_PROPS[name];
175
+ const present = (openingPath.node.attributes ?? []).some(
176
+ (/** @type {any} */ a) =>
177
+ a.type === 'JSXAttribute' && a.name?.name === next,
178
+ );
179
+ if (present) {
180
+ const comment = `${TODO}\`${next}\`. `;
181
+ attribute.comments ??= [];
182
+ if (
183
+ !attribute.comments.some(
184
+ (/** @type {any} */ c) => c.value === comment,
185
+ )
186
+ ) {
187
+ attribute.comments.push(j.commentBlock(comment, true, false));
188
+ changed = true;
189
+ }
190
+ return;
191
+ }
192
+ attribute.name = j.jsxIdentifier(next);
193
+ changed = true;
194
+ },
195
+ );
196
+
197
+ return changed ? root.toSource({quote: 'single'}) : undefined;
198
+ }
@@ -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
  ],
@@ -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",
@@ -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
  }
@@ -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}
@@ -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}
@@ -9,7 +9,7 @@ export default function SliderFormattedValue() {
9
9
  const [value, setValue] = useState(72);
10
10
  return (
11
11
  <Slider
12
- style={{width: 300}}
12
+ containerStyle={{width: 300}}
13
13
  label="Temperature"
14
14
  value={value}
15
15
  onChange={setValue}
@@ -12,7 +12,7 @@ export default function SliderRangeSlider() {
12
12
  label="Price range"
13
13
  value={value}
14
14
  onChange={setValue}
15
- style={{width: 300}}
15
+ containerStyle={{width: 300}}
16
16
  />
17
17
  );
18
18
  }
@@ -12,7 +12,7 @@ export default function SliderShowcase() {
12
12
  label="Volume"
13
13
  value={value}
14
14
  onChange={setValue}
15
- style={{width: 300}}
15
+ containerStyle={{width: 300}}
16
16
  />
17
17
  );
18
18
  }
@@ -9,7 +9,7 @@ export default function SliderWithMarks() {
9
9
  const [value, setValue] = useState(50);
10
10
  return (
11
11
  <Slider
12
- style={{width: 300}}
12
+ containerStyle={{width: 300}}
13
13
  label="Volume"
14
14
  value={value}
15
15
  onChange={setValue}
@@ -37,7 +37,7 @@ export default function TokenizerClear() {
37
37
  value={value}
38
38
  onChange={items => setValue(items)}
39
39
  hasClear
40
- style={{width: 400}}
40
+ containerStyle={{width: 400}}
41
41
  />
42
42
  </Stack>
43
43
  );
@@ -44,7 +44,7 @@ export default function TokenizerCreatable() {
44
44
  onChange={items => setTags(items)}
45
45
  hasCreate
46
46
  placeholder="Type a tag and press Enter..."
47
- style={{width: 400}}
47
+ containerStyle={{width: 400}}
48
48
  />
49
49
  </Stack>
50
50
  <Stack direction="vertical" gap={1}>
@@ -59,7 +59,7 @@ export default function TokenizerCreatable() {
59
59
  hasCreate
60
60
  hasEntriesOnFocus
61
61
  placeholder="Search or type a new name..."
62
- style={{width: 400}}
62
+ containerStyle={{width: 400}}
63
63
  />
64
64
  </Stack>
65
65
  </Stack>
@@ -39,7 +39,7 @@ export default function TokenizerEndContent() {
39
39
  value={value}
40
40
  onChange={items => setValue(items)}
41
41
  endContent={<Button label="Apply" variant="primary" size="sm" />}
42
- style={{width: 400}}
42
+ containerStyle={{width: 400}}
43
43
  />
44
44
  </Stack>
45
45
  );
@@ -38,7 +38,7 @@ export default function TokenizerIcon() {
38
38
  value={value}
39
39
  onChange={items => setValue(items)}
40
40
  startIcon={MagnifyingGlassIcon}
41
- style={{width: 400}}
41
+ containerStyle={{width: 400}}
42
42
  />
43
43
  </Stack>
44
44
  );