@astryxdesign/cli 0.7.0-canary.4ec1f4e → 0.7.0-canary.5442d61

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 (66) hide show
  1. package/README.md +61 -61
  2. package/api/build/build.mjs +9 -0
  3. package/api/component/_adapter.d.mts +2 -0
  4. package/api/component/_adapter.mjs +3 -1
  5. package/api/component/component.doc.mjs +5 -1
  6. package/api/docs/compiled-topics.test.mjs +16 -0
  7. package/api/integration/pack-check.test.mjs +8 -0
  8. package/api/template/list/list.mjs +23 -2
  9. package/api/template/list/list.test.mjs +52 -0
  10. package/api/template/template.doc.mjs +5 -4
  11. package/api/template/template.type.mjs +1 -1
  12. package/api/theme/build/build.d.mts +0 -1
  13. package/api/theme/build/build.mjs +4 -29
  14. package/api/theme/build/family.mjs +1 -1
  15. package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
  16. package/assets/codemods/transforms/next/__tests__/validate-data-token-ownership.test.mjs +84 -0
  17. package/assets/codemods/transforms/next/index.mjs +16 -0
  18. package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
  19. package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
  20. package/assets/docs/author-a-theme.doc.mjs +4 -4
  21. package/assets/docs/tree/tokens-data.doc.mjs +2 -2
  22. package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
  23. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
  24. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
  25. package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
  26. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
  27. package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
  28. package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
  29. package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
  30. package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
  31. package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
  32. package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
  33. package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
  34. package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
  35. package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
  36. package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
  37. package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
  38. package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
  39. package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
  40. package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
  41. package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
  42. package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
  43. package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
  44. package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
  45. package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
  46. package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
  47. package/assets/templates/pages/canvas-editor/page.tsx +2 -2
  48. package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
  49. package/assets/templates/pages/payment-form/page.tsx +1 -1
  50. package/assets/templates/pages/table-filter/page.tsx +3 -3
  51. package/assets/templates/pages/theme-showcase/page.tsx +2 -2
  52. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +10 -9
  53. package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
  54. package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
  55. package/clients/cli/commands/build.doc.mjs +1 -1
  56. package/clients/cli/commands/build.mjs +1 -1
  57. package/clients/cli/commands/component-ownership.test.mjs +2 -2
  58. package/clients/cli/commands/integration.mjs +2 -1
  59. package/clients/cli/commands/silent-success-refusals.test.mjs +15 -0
  60. package/clients/cli/commands/template.doc.mjs +1 -1
  61. package/foundation/discovery/template-needs.mjs +93 -11
  62. package/foundation/discovery/template-needs.test.mjs +106 -3
  63. package/foundation/env/package-manager.d.mts +13 -0
  64. package/foundation/env/package-manager.mjs +106 -63
  65. package/foundation/response/response-types.doc.mjs +1 -2
  66. package/package.json +9 -9
@@ -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
  );
@@ -44,7 +44,7 @@ export default function TokenizerMaxEntries() {
44
44
  value={value}
45
45
  onChange={items => setValue(items)}
46
46
  maxEntries={MAX_SKILLS}
47
- style={{width: 400}}
47
+ containerStyle={{width: 400}}
48
48
  />
49
49
  </Stack>
50
50
  );
@@ -40,7 +40,7 @@ export default function TokenizerOverflow() {
40
40
  value={inlineValue}
41
41
  onChange={items => setInlineValue(items)}
42
42
  tokenOverflowBehavior="unfocusedInline"
43
- style={{width: 400, maxWidth: 400}}
43
+ containerStyle={{width: 400, maxWidth: 400}}
44
44
  />
45
45
  </Stack>
46
46
  <Stack direction="vertical" gap={1}>
@@ -54,7 +54,7 @@ export default function TokenizerOverflow() {
54
54
  value={layerValue}
55
55
  onChange={items => setLayerValue(items)}
56
56
  tokenOverflowBehavior="unfocusedLayer"
57
- style={{width: 400, maxWidth: 400}}
57
+ containerStyle={{width: 400, maxWidth: 400}}
58
58
  />
59
59
  </Stack>
60
60
  </Stack>
@@ -23,7 +23,7 @@ export default function TokenizerShowcase() {
23
23
  searchSource={source}
24
24
  value={value}
25
25
  onChange={setValue}
26
- style={{width: 400}}
26
+ containerStyle={{width: 400}}
27
27
  />
28
28
  );
29
29
  }
@@ -39,7 +39,7 @@ export default function TokenizerStates() {
39
39
  value={[users[0], users[2]]}
40
40
  onChange={() => {}}
41
41
  isDisabled
42
- style={{width: 400}}
42
+ containerStyle={{width: 400}}
43
43
  />
44
44
  <Tokenizer
45
45
  label="Error message"
@@ -49,7 +49,7 @@ export default function TokenizerStates() {
49
49
  onChange={items => setErrorValue(items)}
50
50
  isRequired
51
51
  status={{type: 'error', message: 'At least one reviewer is required'}}
52
- style={{width: 400}}
52
+ containerStyle={{width: 400}}
53
53
  />
54
54
  <Tokenizer
55
55
  label="Warning message"
@@ -61,7 +61,7 @@ export default function TokenizerStates() {
61
61
  type: 'warning',
62
62
  message: 'Consider adding at least 2 approvers',
63
63
  }}
64
- style={{width: 400}}
64
+ containerStyle={{width: 400}}
65
65
  />
66
66
  <Tokenizer
67
67
  label="Success message"
@@ -70,7 +70,7 @@ export default function TokenizerStates() {
70
70
  value={successValue}
71
71
  onChange={items => setSuccessValue(items)}
72
72
  status={{type: 'success', message: 'All required reviewers added'}}
73
- style={{width: 400}}
73
+ containerStyle={{width: 400}}
74
74
  />
75
75
  </Stack>
76
76
  );
@@ -231,7 +231,7 @@ export default function ToolbarTableFilter() {
231
231
  hasClear
232
232
  options={field.options}
233
233
  value={clauses[field.key] ?? null}
234
- xstyle={clauses[field.key] != null ? styles.filterFill : undefined}
234
+ controlXstyle={clauses[field.key] != null ? styles.filterFill : undefined}
235
235
  onChange={value => setClauses(prev => ({...prev, [field.key]: value}))}
236
236
  renderValue={option =>
237
237
  `${field.label} is ${option.label ?? option.value}`
@@ -1153,7 +1153,7 @@ function FilterRow({
1153
1153
  value={value}
1154
1154
  onChange={onChange}
1155
1155
  isWheelEnabled={false}
1156
- xstyle={styles.filterValue}
1156
+ controlXstyle={styles.filterValue}
1157
1157
  />
1158
1158
  </InspectorRow>
1159
1159
  );
@@ -2329,7 +2329,7 @@ export default function CanvasEditor() {
2329
2329
  // enough for the longest option
2330
2330
  // ("100%") to avoid truncation.
2331
2331
  width={92}
2332
- xstyle={[
2332
+ controlXstyle={[
2333
2333
  styles.toolBarControl,
2334
2334
  styles.toolBarTrailing,
2335
2335
  ]}
@@ -871,7 +871,7 @@ export default function FormWizardVerticalPage() {
871
871
  ref={fieldRefs.cover}
872
872
  label="Cover image"
873
873
  isLabelHidden
874
- style={hasCover ? dropzoneFill : undefined}
874
+ controlStyle={hasCover ? dropzoneFill : undefined}
875
875
  mode="dropzone"
876
876
  accept="image/png,image/jpeg"
877
877
  maxSize={5 * 1024 * 1024}
@@ -714,7 +714,7 @@ export default function PaymentFormPage() {
714
714
  placeholder="Enter promo code"
715
715
  value={promo}
716
716
  onChange={setPromo}
717
- style={fullWidth}
717
+ controlStyle={fullWidth}
718
718
  />
719
719
  </StackItem>
720
720
  <Button
@@ -3249,7 +3249,7 @@ export default function TableFilterTemplate() {
3249
3249
  renderValue={option =>
3250
3250
  `${field.label} ${field.operatorLabel} ${option.label ?? option.value}`
3251
3251
  }
3252
- xstyle={active ? styles.filterFill : undefined}
3252
+ controlXstyle={active ? styles.filterFill : undefined}
3253
3253
  onChange={next =>
3254
3254
  setFieldFilter(
3255
3255
  field.key,
@@ -3318,7 +3318,7 @@ export default function TableFilterTemplate() {
3318
3318
  }
3319
3319
  options={[...field.options]}
3320
3320
  value={multiValues[field.key]}
3321
- xstyle={
3321
+ controlXstyle={
3322
3322
  multiValues[field.key].length > 0 ? styles.filterFill : undefined
3323
3323
  }
3324
3324
  onChange={next => setMultiValues(field.key, next)}
@@ -3341,7 +3341,7 @@ export default function TableFilterTemplate() {
3341
3341
  value={quoteDraft}
3342
3342
  onChange={commitQuote}
3343
3343
  contentXstyle={styles.quotePopover}
3344
- xstyle={hasQuoteFilter ? styles.filterFill : undefined}>
3344
+ controlXstyle={hasQuoteFilter ? styles.filterFill : undefined}>
3345
3345
  {(range, onChange, close) => (
3346
3346
  <VStack gap={4}>
3347
3347
  <VStack gap={0}>
@@ -500,7 +500,7 @@ function StorePreview({
500
500
  max={99}
501
501
  size="sm"
502
502
  width={72}
503
- style={styles.quantityInput}
503
+ controlStyle={styles.quantityInput}
504
504
  />
505
505
  <Button
506
506
  label="Add to cart"
@@ -1143,7 +1143,7 @@ function InventoryCard({
1143
1143
  value=""
1144
1144
  onChange={() => {}}
1145
1145
  startIcon={<Search size={16} />}
1146
- style={styles.searchInput}
1146
+ controlStyle={styles.searchInput}
1147
1147
  />
1148
1148
  <OverflowList
1149
1149
  gap={2}
@@ -1,8 +1,9 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
- // Generated from neutralPalettes.generated.ts for the stops used by
4
- // neutralTheme.ts. Keep the complete palette available for authoring and
5
- // audits, but do not make consumers pay for unused palette stops.
3
+ // Generated from the committed full palette for the stops used by Neutral's
4
+ // theme source. Regenerate with `pnpm generate:neutral-palette-refs`.
5
+ // Keep the complete palette available for authoring and audits without
6
+ // making consumers pay for unused palette stops.
6
7
  // prettier-ignore
7
8
  export const neutralPaletteRefs = {
8
9
  purple: {
@@ -10,11 +11,11 @@ export const neutralPaletteRefs = {
10
11
  dark: {25: '#4a2f51', 80: '#eaacf8'},
11
12
  },
12
13
  green: {
13
- light: {25: '#00490b', 30: '#0b5615', 40: '#237028', 45: '#2f7d33', 65: '#6ab26b', 75: '#90ca90', 80: '#a4d6a3'},
14
+ light: {25: '#00490b', 30: '#0b5615', 45: '#2f7d33', 65: '#6ab26b', 75: '#90ca90', 80: '#a4d6a3'},
14
15
  dark: {25: '#2b422b', 80: '#aad4a9', 85: '#bce0bb'},
15
16
  },
16
17
  neutral: {
17
- light: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 30: '#474747', 35: '#525252', 45: '#6a6a6a', 50: '#777777', 60: '#919191', 65: '#9e9e9e', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
18
+ light: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 30: '#474747', 45: '#6a6a6a', 60: '#919191', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
18
19
  dark: {0: '#000000', 5: '#111111', 10: '#1b1b1b', 15: '#262626', 20: '#303030', 35: '#525252', 65: '#9e9e9e', 85: '#d4d4d4', 90: '#e2e2e2', 95: '#f1f1f1', 100: '#ffffff'},
19
20
  },
20
21
  orange: {
@@ -26,11 +27,11 @@ export const neutralPaletteRefs = {
26
27
  dark: {25: '#253c5a', 65: '#5aa0f8', 75: '#88bcff', 80: '#a1caff'},
27
28
  },
28
29
  red: {
29
- light: {25: '#76000c', 30: '#8a0011', 35: '#9e0015', 55: '#de4745', 65: '#fa6762', 70: '#ff7f77', 80: '#ffaea7', 85: '#ffc4be'},
30
+ light: {25: '#76000c', 30: '#8a0011', 55: '#de4745', 65: '#fa6762', 70: '#ff7f77', 80: '#ffaea7', 85: '#ffc4be'},
30
31
  dark: {25: '#5b2b28', 65: '#ee736c', 75: '#ff9890', 80: '#ffaea7', 85: '#ffc4be'},
31
32
  },
32
33
  yellow: {
33
- light: {25: '#4b3900', 30: '#584400', 40: '#745b00', 65: '#c29900', 75: '#e2b623', 80: '#eec448', 85: '#f8d36a'},
34
+ light: {25: '#4b3900', 30: '#584400', 65: '#c29900', 75: '#e2b623', 80: '#eec448', 85: '#f8d36a'},
34
35
  dark: {25: '#453a1c', 80: '#e3c36c', 90: '#fae19e'},
35
36
  },
36
37
  teal: {
@@ -39,10 +40,10 @@ export const neutralPaletteRefs = {
39
40
  },
40
41
  cyan: {
41
42
  dark: {25: '#274046', 65: '#49adc4', 75: '#71c7dd', 80: '#85d5e9', 85: '#9ae2f4'},
42
- light: {25: '#004351', 30: '#00505f'},
43
+ light: {25: '#004351'},
43
44
  },
44
45
  pink: {
45
- light: {25: '#70003f', 30: '#83004b', 70: '#fc78b1', 85: '#ffc0d7'},
46
+ light: {25: '#70003f', 70: '#fc78b1', 85: '#ffc0d7'},
46
47
  dark: {25: '#572b3d', 75: '#fd92bd', 80: '#ffa9ca'},
47
48
  },
48
49
  } as const;
@@ -17,9 +17,9 @@
17
17
  * html[data-theme="dark"] { color-scheme: dark; }
18
18
  *
19
19
  * Themes that never use `light-dark()` have no `color-scheme` ambiguity to
20
- * resolve, so none of the three rules should be emitted for them — the
21
- * generated CSS still carries the `--color-data-*` defaults, which are
22
- * `light-dark()` pairs, so the decision reads the theme's own values.
20
+ * resolve, so none of the three rules should be emitted for them. Canonical data
21
+ * defaults come from StyleX rather than theme output, so this decision continues
22
+ * to read only the theme's authored values.
23
23
  *
24
24
  * Building `astryx theme build` requires a compiled @astryxdesign/core (there is no in-CLI
25
25
  * fallback generator), so this suite builds core once in beforeAll via the
@@ -35,8 +35,10 @@ import {ensureCoreBuilt} from './ensure-core-built.mjs';
35
35
  import {runCli} from '../../../test-utils/run-cli.mjs';
36
36
 
37
37
  const COLOR_SCHEME_ROOT_DECL = ':root { color-scheme: light dark; }';
38
- const COLOR_SCHEME_LIGHT_DECL = 'html[data-theme="light"] { color-scheme: light; }';
39
- const COLOR_SCHEME_DARK_DECL = 'html[data-theme="dark"] { color-scheme: dark; }';
38
+ const COLOR_SCHEME_LIGHT_DECL =
39
+ 'html[data-theme="light"] { color-scheme: light; }';
40
+ const COLOR_SCHEME_DARK_DECL =
41
+ 'html[data-theme="dark"] { color-scheme: dark; }';
40
42
 
41
43
  function writeTheme(dir, name, tokens) {
42
44
  fs.mkdirSync(dir, {recursive: true});
@@ -58,7 +60,9 @@ beforeAll(() => {
58
60
 
59
61
  let tmpDir;
60
62
  beforeEach(() => {
61
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-build-theme-color-scheme-'));
63
+ tmpDir = fs.mkdtempSync(
64
+ path.join(os.tmpdir(), 'astryx-build-theme-color-scheme-'),
65
+ );
62
66
  });
63
67
  afterEach(() => {
64
68
  fs.rmSync(tmpDir, {recursive: true, force: true});
@@ -1,32 +1,17 @@
1
1
  // Copyright (c) Meta Platforms, Inc. and affiliates.
2
2
 
3
3
  /**
4
- * @file Asserts `astryx theme build` emits the `--color-data-*` defaults the
5
- * way the `<Theme>` runtime does — once, at `:root`, in `@layer astryx-base`.
6
- *
7
- * Seeding them into the theme's own `@scope` block instead makes every nested
8
- * `<Theme>` re-declare the default and shadow a parent theme's override, which
9
- * no other token family does. Layer order is fixed by first declaration, so
10
- * the base block also has to sit after `@layer reset` and before
11
- * `@layer astryx-theme` for a consumer who imports this stylesheet alone.
12
- *
13
- * Building requires a compiled @astryxdesign/core, so this suite builds core
14
- * once in beforeAll via the shared ensureCoreBuilt() helper.
15
- *
16
- * The build formats the defaults block itself, from the public
17
- * `dataTokenDefaults` export; core formats it for the runtime. This suite is
18
- * what keeps those two independent formattings byte-identical.
4
+ * @file Verifies `astryx theme build` emits sparse data overrides and no
5
+ * canonical root defaults while preserving explicit cascade-layer order.
6
+ * @input Temporary standalone theme modules compiled through the public CLI
7
+ * @output Structural assertions for AST-066 data-token ownership
8
+ * @position Regression suite for theme-build CSS ownership
19
9
  */
20
10
 
21
11
  import {describe, it, expect, beforeAll, beforeEach, afterEach} from 'vitest';
22
12
  import * as fs from 'node:fs';
23
13
  import * as path from 'node:path';
24
14
  import * as os from 'node:os';
25
- // Core's own generator, imported from source rather than from the package: it
26
- // is deliberately not part of `@astryxdesign/core/theme`'s public surface, and
27
- // this suite is the guard that the build's independent formatting matches it.
28
- import {generateDataTokenDefaultsCSS} from '../../../../core/src/theme/generateThemeRules';
29
- import {dataTokenDefaults as sourceDataTokenDefaults} from '../../../../core/src/theme/domainTokens/dataTokens';
30
15
  import {ensureCoreBuilt} from './ensure-core-built.mjs';
31
16
  import {runCli} from '../../../test-utils/run-cli.mjs';
32
17
 
@@ -67,78 +52,41 @@ afterEach(() => {
67
52
  });
68
53
 
69
54
  describe('theme build data token output', () => {
70
- it('emits the defaults once, at :root, in @layer astryx-base', async () => {
55
+ it('emits no canonical data defaults or raw root data block', async () => {
71
56
  const css = await buildTheme(tmpDir, 'charts-untouched', {
72
57
  tokens: {'--color-accent': '#0077B6'},
73
58
  });
74
59
 
75
- const baseStart = css.indexOf('@layer astryx-base');
76
- expect(baseStart).toBeGreaterThanOrEqual(0);
77
-
78
- const baseBlock = css.slice(baseStart, css.indexOf('@layer astryx-theme'));
79
- expect(baseBlock).toContain(':root {');
80
- expect(baseBlock).toContain('--color-data-categorical-blue:');
81
- expect(baseBlock).toContain('--color-data-gray-1:');
82
- expect(css.match(/--color-data-categorical-blue:/g)).toHaveLength(1);
83
- expect(css.match(/@layer astryx-base/g)).toHaveLength(1);
60
+ expect(css).not.toContain('--color-data-');
61
+ expect(css).not.toMatch(/:root\s*\{[^}]*--color-data-/s);
62
+ expect(css).not.toContain('@layer astryx-base {\n:root {');
84
63
  });
85
64
 
86
- it('declares astryx-base after reset and before astryx-theme', async () => {
65
+ it('registers layer order before every emitted layer block', async () => {
87
66
  const css = await buildTheme(tmpDir, 'charts-order', {
88
67
  tokens: {'--color-accent': '#0077B6'},
89
68
  });
90
69
 
91
- const reset = css.indexOf('@layer reset');
92
- const base = css.indexOf('@layer astryx-base');
93
- const theme = css.indexOf('@layer astryx-theme');
70
+ const order = css.indexOf('@layer reset, astryx-base, astryx-theme;');
71
+ const reset = css.indexOf('@layer reset {');
72
+ const theme = css.indexOf('@layer astryx-theme {');
94
73
 
95
- expect(reset).toBeGreaterThanOrEqual(0);
96
- expect(base).toBeGreaterThan(reset);
97
- expect(theme).toBeGreaterThan(base);
74
+ expect(order).toBeGreaterThanOrEqual(0);
75
+ expect(reset).toBeGreaterThan(order);
76
+ expect(theme).toBeGreaterThan(order);
98
77
  });
99
78
 
100
- it("puts only the theme's own data token in its scope block", async () => {
79
+ it("puts only the theme's authored data token in its donut", async () => {
101
80
  const css = await buildTheme(tmpDir, 'charts-override', {
102
81
  tokens: {'--color-data-categorical-blue': '#00A3FF'},
103
82
  });
104
83
 
105
- const themeBlock = css.slice(css.indexOf('@layer astryx-theme'));
106
- expect(themeBlock).toContain('--color-data-categorical-blue: #00A3FF;');
107
- expect(themeBlock).not.toContain('--color-data-categorical-orange');
108
- expect(themeBlock).not.toContain('--color-data-gray-1');
109
- });
110
-
111
- it('emits the bytes the runtime generator emits', async () => {
112
- const css = await buildTheme(tmpDir, 'charts-parity', {
113
- tokens: {'--color-accent': '#0077B6'},
114
- });
115
-
116
- // The expectation below comes from core's SOURCE; the stylesheet came from
117
- // core's dist. ensureCoreBuilt() only checks that dist exists, never that
118
- // it is current, so a dist older than the source would fail the byte
119
- // comparison with a colour mismatch that reads as formatter drift. Name
120
- // that case first.
121
- const {dataTokenDefaults: builtDataTokenDefaults} = await import(
122
- '@astryxdesign/core/theme'
123
- );
124
- expect(
125
- builtDataTokenDefaults,
126
- 'packages/core/dist is stale — run `pnpm -F @astryxdesign/core build`',
127
- ).toEqual(sourceDataTokenDefaults);
128
-
129
- // The build formats this block itself, from the public `dataTokenDefaults`
130
- // export; the runtime formats it in core. Nothing else holds the two
131
- // together, so compare the bytes — a changed indent or separator in either
132
- // one fails here.
133
- const runtimeBase = generateDataTokenDefaultsCSS();
134
- const marker = '@layer astryx-base {\n';
135
- const start = css.indexOf(marker);
136
- expect(start).toBeGreaterThanOrEqual(0);
137
-
138
- const bodyStart = start + marker.length;
139
- expect(css.slice(bodyStart, bodyStart + runtimeBase.length)).toBe(
140
- runtimeBase,
84
+ expect(css).toContain(
85
+ '@scope ([data-astryx-theme="charts-override"]) to ([data-astryx-theme])',
141
86
  );
142
- expect(css.slice(bodyStart + runtimeBase.length)).toMatch(/^\n\}/);
87
+ expect(css).toContain('--color-data-categorical-blue: #00A3FF;');
88
+ expect(css.match(/--color-data-/g)).toHaveLength(1);
89
+ expect(css).not.toContain('--color-data-categorical-orange');
90
+ expect(css).not.toContain('--color-data-gray-1');
143
91
  });
144
92
  });
@@ -51,7 +51,7 @@ export const doc = {
51
51
  {code: 0, when: 'success (including zero matches)'},
52
52
  {
53
53
  code: 1,
54
- when: 'invalid --type, a non-positive --limit, or a query when @astryxdesign/core cannot be found (the playbook needs no core)',
54
+ when: 'invalid --type, a --limit that is not a positive integer, or a query when @astryxdesign/core cannot be found (the playbook needs no core)',
55
55
  },
56
56
  ],
57
57
  related: ['search', 'template', 'component', 'hook', 'init'],