@astryxdesign/cli 0.7.0-canary.de3959f → 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.
- package/README.md +61 -61
- package/api/integration/pack-check.test.mjs +8 -0
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.type.mjs +1 -1
- package/api/theme/build/build.d.mts +0 -1
- package/api/theme/build/build.mjs +4 -29
- package/api/theme/build/family.mjs +1 -1
- package/assets/codemods/transforms/next/__tests__/migrate-field-input-styling.test.mjs +108 -0
- package/assets/codemods/transforms/next/__tests__/preserve-bottom-sheet-content-padding.test.mjs +178 -0
- package/assets/codemods/transforms/next/__tests__/validate-data-token-ownership.test.mjs +84 -0
- package/assets/codemods/transforms/next/index.mjs +24 -0
- package/assets/codemods/transforms/next/migrate-field-input-styling.mjs +198 -0
- package/assets/codemods/transforms/next/preserve-bottom-sheet-content-padding.mjs +242 -0
- package/assets/codemods/transforms/next/validate-data-token-ownership.mjs +102 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -1
- package/assets/docs/spacing.doc.mjs +2 -2
- package/assets/docs/tree/tokens-data.doc.mjs +2 -2
- package/assets/docs/tree/tokens-spacing.doc.mjs +15 -15
- package/assets/docs/tree/tokens-usage.doc.mjs +1 -1
- package/assets/templates/blocks/components/BottomSheet/BottomSheetHeights.tsx +1 -1
- package/assets/templates/blocks/components/BottomSheet/BottomSheetMobileKeyboard.tsx +1 -1
- package/assets/templates/blocks/components/BottomSheet/BottomSheetNoScrim.tsx +1 -1
- package/assets/templates/blocks/components/BottomSheet/BottomSheetSnapPoints.tsx +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorDeadlinePicker.tsx +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorShowcase.tsx +1 -1
- package/assets/templates/blocks/components/ComplexSelector/ComplexSelectorTreeSearch.tsx +1 -1
- package/assets/templates/blocks/components/Dialog/DialogAdaptivePresentation.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorClearable.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +2 -2
- package/assets/templates/blocks/components/Selector/SelectorShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorWithSections.tsx +1 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionBasic.tsx +1 -1
- package/assets/templates/blocks/components/SelectorOption/SelectorOptionShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderFormattedValue.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderRangeSlider.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Slider/SliderWithMarks.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerClear.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerCreatable.tsx +2 -2
- package/assets/templates/blocks/components/Tokenizer/TokenizerEndContent.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerIcon.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerMaxEntries.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerOverflow.tsx +2 -2
- package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Tokenizer/TokenizerStates.tsx +4 -4
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +1 -1
- package/assets/templates/pages/canvas-editor/page.tsx +2 -2
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/table-filter/page.tsx +11 -6
- package/assets/templates/pages/table-inbox/page.tsx +3 -1
- package/assets/templates/pages/theme-showcase/page.tsx +2 -2
- package/assets/templates/themes/butter/butterTheme.ts +12 -0
- package/assets/templates/themes/chocolate/chocolateTheme.ts +12 -0
- package/assets/templates/themes/matcha/matchaTheme.ts +14 -14
- package/assets/templates/themes/neutral/neutralTheme.ts +12 -0
- package/assets/templates/themes/stone/stoneTheme.ts +12 -0
- package/assets/templates/themes/y2k/y2kTheme.ts +10 -10
- package/assets/theme.template.ts +1 -1
- package/clients/cli/commands/build-theme.color-scheme.test.mjs +10 -6
- package/clients/cli/commands/build-theme.data-tokens.test.mjs +23 -75
- package/foundation/discovery/template-needs.mjs +93 -11
- package/foundation/discovery/template-needs.test.mjs +106 -3
- package/foundation/env/package-manager.d.mts +13 -0
- package/foundation/env/package-manager.mjs +106 -63
- package/foundation/response/response-types.doc.mjs +1 -2
- package/package.json +9 -9
|
@@ -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
|
-
|
|
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
|
-
|
|
62
|
+
containerStyle={{width: 400}}
|
|
63
63
|
/>
|
|
64
64
|
</Stack>
|
|
65
65
|
</Stack>
|
|
@@ -40,7 +40,7 @@ export default function TokenizerOverflow() {
|
|
|
40
40
|
value={inlineValue}
|
|
41
41
|
onChange={items => setInlineValue(items)}
|
|
42
42
|
tokenOverflowBehavior="unfocusedInline"
|
|
43
|
-
|
|
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
|
-
|
|
57
|
+
containerStyle={{width: 400, maxWidth: 400}}
|
|
58
58
|
/>
|
|
59
59
|
</Stack>
|
|
60
60
|
</Stack>
|
|
@@ -39,7 +39,7 @@ export default function TokenizerStates() {
|
|
|
39
39
|
value={[users[0], users[2]]}
|
|
40
40
|
onChange={() => {}}
|
|
41
41
|
isDisabled
|
|
42
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
874
|
+
controlStyle={hasCover ? dropzoneFill : undefined}
|
|
875
875
|
mode="dropzone"
|
|
876
876
|
accept="image/png,image/jpeg"
|
|
877
877
|
maxSize={5 * 1024 * 1024}
|
|
@@ -2084,7 +2084,8 @@ function FilterOverflow({
|
|
|
2084
2084
|
isOpen={isOpen}
|
|
2085
2085
|
onOpenChange={setIsOpen}
|
|
2086
2086
|
label={label}
|
|
2087
|
-
height="hug"
|
|
2087
|
+
height="hug"
|
|
2088
|
+
padding={0}>
|
|
2088
2089
|
{body}
|
|
2089
2090
|
</BottomSheet>
|
|
2090
2091
|
</>
|
|
@@ -3249,7 +3250,7 @@ export default function TableFilterTemplate() {
|
|
|
3249
3250
|
renderValue={option =>
|
|
3250
3251
|
`${field.label} ${field.operatorLabel} ${option.label ?? option.value}`
|
|
3251
3252
|
}
|
|
3252
|
-
|
|
3253
|
+
controlXstyle={active ? styles.filterFill : undefined}
|
|
3253
3254
|
onChange={next =>
|
|
3254
3255
|
setFieldFilter(
|
|
3255
3256
|
field.key,
|
|
@@ -3318,7 +3319,7 @@ export default function TableFilterTemplate() {
|
|
|
3318
3319
|
}
|
|
3319
3320
|
options={[...field.options]}
|
|
3320
3321
|
value={multiValues[field.key]}
|
|
3321
|
-
|
|
3322
|
+
controlXstyle={
|
|
3322
3323
|
multiValues[field.key].length > 0 ? styles.filterFill : undefined
|
|
3323
3324
|
}
|
|
3324
3325
|
onChange={next => setMultiValues(field.key, next)}
|
|
@@ -3341,7 +3342,7 @@ export default function TableFilterTemplate() {
|
|
|
3341
3342
|
value={quoteDraft}
|
|
3342
3343
|
onChange={commitQuote}
|
|
3343
3344
|
contentXstyle={styles.quotePopover}
|
|
3344
|
-
|
|
3345
|
+
controlXstyle={hasQuoteFilter ? styles.filterFill : undefined}>
|
|
3345
3346
|
{(range, onChange, close) => (
|
|
3346
3347
|
<VStack gap={4}>
|
|
3347
3348
|
<VStack gap={0}>
|
|
@@ -4087,7 +4088,10 @@ export default function TableFilterTemplate() {
|
|
|
4087
4088
|
isOpen={isCompactSurface && isViewOpen}
|
|
4088
4089
|
onOpenChange={setIsViewOpen}
|
|
4089
4090
|
label="View options"
|
|
4090
|
-
height="tall"
|
|
4091
|
+
height="tall"
|
|
4092
|
+
// The tab strip compensates against a container inset, so the sheet
|
|
4093
|
+
// publishes none and the wrapper below owns the top band.
|
|
4094
|
+
padding={0}>
|
|
4091
4095
|
{/* The inset is the wrapper's, so the strip's own box starts at the tab
|
|
4092
4096
|
row and its scroll arrow lands on the tabs rather than above them. */}
|
|
4093
4097
|
<VStack gap={0} paddingBlockStart={SHEET_TOP_INSET}>
|
|
@@ -4313,7 +4317,8 @@ export default function TableFilterTemplate() {
|
|
|
4313
4317
|
isOpen={isCompactSurface && activeJob != null}
|
|
4314
4318
|
onOpenChange={open => !open && setActiveJobId(null)}
|
|
4315
4319
|
label="Job details"
|
|
4316
|
-
height="tall"
|
|
4320
|
+
height="tall"
|
|
4321
|
+
padding={0}>
|
|
4317
4322
|
{detailBody}
|
|
4318
4323
|
</BottomSheet>
|
|
4319
4324
|
);
|
|
@@ -1773,7 +1773,9 @@ function ComposeWindow({
|
|
|
1773
1773
|
// cheaper answer to the same problem: there is not much to drag out of
|
|
1774
1774
|
// the way in the first place.
|
|
1775
1775
|
height="hug"
|
|
1776
|
-
hasScrim={false}
|
|
1776
|
+
hasScrim={false}
|
|
1777
|
+
// The Layout below owns the inset; the sheet adds none of its own.
|
|
1778
|
+
padding={0}>
|
|
1777
1779
|
{/* The grab handle floats over the top edge, out of flow, about 12px
|
|
1778
1780
|
down. The Layout's own padding is not quite enough to clear it — the
|
|
1779
1781
|
heading came up level with the pill, four pixels under it — so the
|
|
@@ -500,7 +500,7 @@ function StorePreview({
|
|
|
500
500
|
max={99}
|
|
501
501
|
size="sm"
|
|
502
502
|
width={72}
|
|
503
|
-
|
|
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
|
-
|
|
1146
|
+
controlStyle={styles.searchInput}
|
|
1147
1147
|
/>
|
|
1148
1148
|
<OverflowList
|
|
1149
1149
|
gap={2}
|
|
@@ -65,6 +65,18 @@ export const butterTheme = defineTheme({
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
|
|
68
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
69
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
70
|
+
// ratio' = 1.25 * (14/16)^(1/6) ~= 1.2225. Body 14 -> 16px, display-1 stays 53px.
|
|
71
|
+
adaptations: {
|
|
72
|
+
rules: [
|
|
73
|
+
{
|
|
74
|
+
when: {pointer: 'coarse', width: {below: 'lg'}},
|
|
75
|
+
value: {typography: {scale: {base: 16, ratio: 1.2225}}},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
|
|
68
80
|
motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
|
|
69
81
|
|
|
70
82
|
syntax: butterSyntax,
|
|
@@ -55,6 +55,18 @@ export const chocolateTheme = defineTheme({
|
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
|
|
58
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
59
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
60
|
+
// ratio' = 1.2 * (14/16)^(1/6) ~= 1.1736. Body 14 -> 16px, display-1 stays 42px.
|
|
61
|
+
adaptations: {
|
|
62
|
+
rules: [
|
|
63
|
+
{
|
|
64
|
+
when: {pointer: 'coarse', width: {below: 'lg'}},
|
|
65
|
+
value: {typography: {scale: {base: 16, ratio: 1.1736}}},
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
|
|
58
70
|
motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
|
|
59
71
|
|
|
60
72
|
syntax: chocolateSyntax,
|
|
@@ -180,20 +180,20 @@ export const matchaTheme = defineTheme({
|
|
|
180
180
|
// =========================================================================
|
|
181
181
|
// Spacing
|
|
182
182
|
// =========================================================================
|
|
183
|
-
'--spacing-0-5': '
|
|
184
|
-
'--spacing-1': '
|
|
185
|
-
'--spacing-1-5': '
|
|
186
|
-
'--spacing-2': '
|
|
187
|
-
'--spacing-3': '
|
|
188
|
-
'--spacing-4': '
|
|
189
|
-
'--spacing-5': '
|
|
190
|
-
'--spacing-6': '
|
|
191
|
-
'--spacing-7': '
|
|
192
|
-
'--spacing-8': '
|
|
193
|
-
'--spacing-9': '
|
|
194
|
-
'--spacing-10': '
|
|
195
|
-
'--spacing-11': '
|
|
196
|
-
'--spacing-12': '
|
|
183
|
+
'--spacing-0-5': '0.1875rem',
|
|
184
|
+
'--spacing-1': '0.375rem',
|
|
185
|
+
'--spacing-1-5': '0.5625rem',
|
|
186
|
+
'--spacing-2': '0.75rem',
|
|
187
|
+
'--spacing-3': '1.125rem',
|
|
188
|
+
'--spacing-4': '1.5rem',
|
|
189
|
+
'--spacing-5': '1.875rem',
|
|
190
|
+
'--spacing-6': '2.25rem',
|
|
191
|
+
'--spacing-7': '2.625rem',
|
|
192
|
+
'--spacing-8': '3rem',
|
|
193
|
+
'--spacing-9': '3.375rem',
|
|
194
|
+
'--spacing-10': '3.75rem',
|
|
195
|
+
'--spacing-11': '4.125rem',
|
|
196
|
+
'--spacing-12': '4.5rem',
|
|
197
197
|
|
|
198
198
|
// =========================================================================
|
|
199
199
|
// Radius — soft and rounded
|
|
@@ -95,6 +95,18 @@ export const neutralTheme = defineTheme({
|
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
97
|
|
|
98
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
99
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
100
|
+
// ratio' = 1.2 * (14/16)^(1/6) ~= 1.1736. Body 14 -> 16px, display-1 stays 42px.
|
|
101
|
+
adaptations: {
|
|
102
|
+
rules: [
|
|
103
|
+
{
|
|
104
|
+
when: {pointer: 'coarse', width: {below: 'lg'}},
|
|
105
|
+
value: {typography: {scale: {base: 16, ratio: 1.1736}}},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
|
|
98
110
|
// Motion: snappier than default to match shadcn/Tailwind conventions.
|
|
99
111
|
// Produces: fast-min=95ms, fast=125ms, fast-max=165ms,
|
|
100
112
|
// medium-min=225ms, medium=300ms, medium-max=400ms.
|
|
@@ -81,6 +81,18 @@ export const stoneTheme = defineTheme({
|
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
83
|
|
|
84
|
+
// Touch + narrow (Mobile Type, Pin): floor base to the 16px floor and
|
|
85
|
+
// re-derive the ratio so Display 1 keeps its desktop size:
|
|
86
|
+
// ratio' = 1.25 * (14/16)^(1/6) ~= 1.2225. Body 14 -> 16px, display-1 stays 53px.
|
|
87
|
+
adaptations: {
|
|
88
|
+
rules: [
|
|
89
|
+
{
|
|
90
|
+
when: {pointer: 'coarse', width: {below: 'lg'}},
|
|
91
|
+
value: {typography: {scale: {base: 16, ratio: 1.2225}}},
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
|
|
84
96
|
motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},
|
|
85
97
|
|
|
86
98
|
syntax: stoneSyntax,
|
|
@@ -63,16 +63,16 @@ export const y2kTheme = defineTheme({
|
|
|
63
63
|
// =========================================================================
|
|
64
64
|
// Spacing — comfortable preset (base=6)
|
|
65
65
|
// =========================================================================
|
|
66
|
-
'--spacing-0-5': '
|
|
67
|
-
'--spacing-1': '
|
|
68
|
-
'--spacing-1-5': '
|
|
69
|
-
'--spacing-2': '
|
|
70
|
-
'--spacing-3': '
|
|
71
|
-
'--spacing-4': '
|
|
72
|
-
'--spacing-5': '
|
|
73
|
-
'--spacing-6': '
|
|
74
|
-
'--spacing-7': '
|
|
75
|
-
'--spacing-8': '
|
|
66
|
+
'--spacing-0-5': '0.1875rem',
|
|
67
|
+
'--spacing-1': '0.375rem',
|
|
68
|
+
'--spacing-1-5': '0.5625rem',
|
|
69
|
+
'--spacing-2': '0.75rem',
|
|
70
|
+
'--spacing-3': '1.125rem',
|
|
71
|
+
'--spacing-4': '1.5rem',
|
|
72
|
+
'--spacing-5': '1.875rem',
|
|
73
|
+
'--spacing-6': '2.25rem',
|
|
74
|
+
'--spacing-7': '2.625rem',
|
|
75
|
+
'--spacing-8': '3rem',
|
|
76
76
|
|
|
77
77
|
// Size — comfortable preset
|
|
78
78
|
'--size-element-sm': '32px',
|
package/assets/theme.template.ts
CHANGED
|
@@ -373,7 +373,7 @@ export const myTheme = defineTheme({
|
|
|
373
373
|
// {
|
|
374
374
|
// // Narrow at every pointer precision.
|
|
375
375
|
// when: {width: {below: 'md'}},
|
|
376
|
-
// value: {tokens: {'--spacing-4': '
|
|
376
|
+
// value: {tokens: {'--spacing-4': '0.75rem'}},
|
|
377
377
|
// },
|
|
378
378
|
// {
|
|
379
379
|
// // Taller controls under a finger or stylus at every width.
|
|
@@ -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
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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 =
|
|
39
|
-
|
|
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(
|
|
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
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
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
|
|
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
|
-
|
|
76
|
-
expect(
|
|
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('
|
|
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
|
|
92
|
-
const
|
|
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(
|
|
96
|
-
expect(
|
|
97
|
-
expect(theme).toBeGreaterThan(
|
|
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
|
|
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
|
-
|
|
106
|
-
|
|
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.
|
|
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
|
});
|