@astryxdesign/cli 0.7.5-canary.d26cdf3 → 0.7.5-canary.d6004fd

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 (33) hide show
  1. package/api/template/tokenizer-showcase.test.mjs +47 -0
  2. package/api/theme/build/build.mjs +9 -4
  3. package/assets/codemods/transforms/next/__tests__/migrate-codeblock-tokenizer-to-language.test.mjs +130 -0
  4. package/assets/codemods/transforms/next/index.mjs +11 -1
  5. package/assets/codemods/transforms/next/migrate-codeblock-tokenizer-to-language.mjs +315 -0
  6. package/assets/docs/author-a-theme.doc.mjs +2 -1
  7. package/assets/docs/icons.doc.mjs +24 -1
  8. package/assets/docs/tree/template-styles.doc.mjs +1 -1
  9. package/assets/docs/tree/tokens-color.doc.mjs +145 -1
  10. package/assets/docs/tree/tokens.doc.mjs +1 -1
  11. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.doc.mjs +6 -4
  12. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherReviewFlow.tsx +61 -55
  13. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.doc.mjs +6 -4
  14. package/assets/templates/blocks/components/BottomSheet/BottomSheetSwitcherShowcase.tsx +68 -37
  15. package/assets/templates/blocks/components/Thumbnail/ThumbnailDisabled.doc.mjs +1 -1
  16. package/assets/templates/blocks/components/Tokenizer/TokenizerShowcase.tsx +13 -6
  17. package/assets/templates/pages/dashboard-alert-rail/page.tsx +3 -3
  18. package/assets/templates/pages/table-comparison/page.tsx +12 -3
  19. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +3 -2
  20. package/assets/templates/themes/butter/butterTheme.ts +47 -44
  21. package/assets/templates/themes/chocolate/chocolateTheme.ts +15 -2
  22. package/assets/templates/themes/gothic/gothicTheme.ts +21 -16
  23. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +1 -1
  24. package/assets/templates/themes/matcha/matchaTheme.ts +15 -2
  25. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +4 -4
  26. package/assets/templates/themes/neutral/neutralTheme.ts +24 -119
  27. package/assets/templates/themes/stone/stoneTheme.ts +46 -21
  28. package/assets/templates/themes/y2k/y2kTheme.ts +20 -16
  29. package/assets/theme.template.ts +9 -5
  30. package/clients/cli/commands/build-theme.adaptations.test.mjs +110 -0
  31. package/foundation/agent-docs/agent-docs.mjs +1 -0
  32. package/foundation/agent-docs/agent-docs.test.mjs +5 -0
  33. package/package.json +9 -9
@@ -192,6 +192,18 @@ export const y2kTheme = defineTheme({
192
192
  '--color-on-error': [red.light[30], red.dark[20]],
193
193
  '--color-on-warning': [yellow.light[30], yellow.dark[20]],
194
194
 
195
+ '--color-info': [blue.light[40], blue.dark[75]],
196
+ '--color-info-muted': 'var(--color-background-blue)',
197
+
198
+ '--color-text-info': [blue.light[20], blue.dark[75]],
199
+ '--color-text-success': [green.light[30], green.dark[75]],
200
+ '--color-text-warning': [yellow.light[30], yellow.dark[85]],
201
+ '--color-text-error': [red.light[30], red.dark[75]],
202
+ '--color-on-info-muted': 'var(--color-text-blue)',
203
+ '--color-on-success-muted': 'var(--color-text-green)',
204
+ '--color-on-warning-muted': 'var(--color-text-yellow)',
205
+ '--color-on-error-muted': 'var(--color-text-red)',
206
+
195
207
  // Icon
196
208
  '--color-icon-accent': [neutral.light[15], neutral.dark[95]],
197
209
  '--color-icon-primary': [neutral.light[15], neutral.dark[95]],
@@ -393,28 +405,20 @@ export const y2kTheme = defineTheme({
393
405
  borderRadius: '0px',
394
406
  },
395
407
  'status:info': {
396
- backgroundColor: 'var(--color-background-blue)',
397
- '--color-text-primary': 'var(--color-text-blue)',
398
- '--color-text-secondary': 'var(--color-text-blue)',
399
- '--color-accent': 'var(--color-text-blue)',
408
+ '--color-info-muted': 'var(--color-background-blue)',
409
+ '--color-on-info-muted': 'var(--color-text-blue)',
400
410
  },
401
411
  'status:success': {
402
- backgroundColor: 'var(--color-background-green)',
403
- '--color-text-primary': 'var(--color-text-green)',
404
- '--color-text-secondary': 'var(--color-text-green)',
405
- '--color-success': 'var(--color-text-green)',
412
+ '--color-success-muted': 'var(--color-background-green)',
413
+ '--color-on-success-muted': 'var(--color-text-green)',
406
414
  },
407
415
  'status:warning': {
408
- backgroundColor: 'var(--color-background-yellow)',
409
- '--color-text-primary': 'var(--color-text-yellow)',
410
- '--color-text-secondary': 'var(--color-text-yellow)',
411
- '--color-warning': 'var(--color-text-yellow)',
416
+ '--color-warning-muted': 'var(--color-background-yellow)',
417
+ '--color-on-warning-muted': 'var(--color-text-yellow)',
412
418
  },
413
419
  'status:error': {
414
- backgroundColor: 'var(--color-background-red)',
415
- '--color-text-primary': 'var(--color-text-red)',
416
- '--color-text-secondary': 'var(--color-text-red)',
417
- '--color-error': 'var(--color-text-red)',
420
+ '--color-error-muted': 'var(--color-background-red)',
421
+ '--color-on-error-muted': 'var(--color-text-red)',
418
422
  },
419
423
  },
420
424
 
@@ -91,9 +91,11 @@ export const myTheme = defineTheme({
91
91
 
92
92
  /**
93
93
  * Start from another theme instead of the defaults. Tokens are copied then
94
- * overridden, `components` deep-merge, `icons` shallow-merge — but the scale
95
- * configs below REPLACE the base's rather than merging, because they are
96
- * inputs to a generator, not values.
94
+ * overridden, `components` deep-merge, `icons` shallow-merge — but the
95
+ * typography, radius and color scale configs below REPLACE the base's rather
96
+ * than merging, because they are inputs to a generator, not values. `motion`
97
+ * inherits field by field: `fast`, `medium` and `ratio` regenerate the fast
98
+ * and medium durations, and a `slow` or `easing` left unset keeps the base's.
97
99
  *
98
100
  * Reference: `astryx theme list` (themes you can install and extend).
99
101
  */
@@ -312,10 +314,12 @@ export const myTheme = defineTheme({
312
314
 
313
315
  /**
314
316
  * Swap the artwork behind semantic icon names — every component that asks
315
- * for `check`, `close`, `chevron-down` gets yours.
317
+ * for `check`, `close`, `chevron-down` gets yours. An entry may also be a
318
+ * pure function of `{size, variant}` that picks artwork for the size Icon
319
+ * renders at.
316
320
  * Reference: `astryx docs icons` lists the names.
317
321
  */
318
- // icons: {check: <MyCheck />, close: <MyClose />},
322
+ // icons: {check: <MyCheck />, info: ({size}) => <MyInfo bold={size === 'sm'} />},
319
323
 
320
324
  /**
321
325
  * Replace the small components that DRAW control state — the checkbox box,
@@ -95,6 +95,116 @@ describe('theme build adaptations', () => {
95
95
  );
96
96
  });
97
97
 
98
+ it('emits scoped status aliases in built CSS and preserves child extension parity', async () => {
99
+ const {defineTheme, generateThemeCSS} =
100
+ await import('@astryxdesign/core/theme');
101
+ const project = path.join(tmpDir, 'project');
102
+ const themesDir = path.join(project, 'themes');
103
+ const input = {
104
+ name: 'status-aliases',
105
+ tokens: {
106
+ '--color-info': '#225bff',
107
+ '--color-text-blue': '#203a6c',
108
+ },
109
+ adaptations: {
110
+ rules: [
111
+ {
112
+ when: {contrast: 'more'},
113
+ value: {
114
+ tokens: {'--color-text-success': '#123456'},
115
+ },
116
+ },
117
+ {
118
+ when: {pointer: 'coarse'},
119
+ value: {tokens: {'--color-text-green': '#abcdef'}},
120
+ },
121
+ ],
122
+ },
123
+ onDark: {
124
+ tokens: {'--color-text-blue': '#fefefe'},
125
+ },
126
+ };
127
+ const themeFile = writeTheme(themesDir, input.name, JSON.stringify(input));
128
+
129
+ const result = await build(project, themeFile);
130
+ expect(result.code, result.stderr).toBe(0);
131
+
132
+ const css = fs.readFileSync(
133
+ path.join(themesDir, 'status-aliases.css'),
134
+ 'utf8',
135
+ );
136
+ const mediaAlias = '--color-text-info: var(--color-text-blue);';
137
+ const adaptationAlias = '--color-text-success: var(--color-text-green);';
138
+ const authoredRole = '--color-text-success: #123456;';
139
+ // The authored Info fill is a concrete hue, so theme generation derives
140
+ // its content, text, and pale-fill content (theme-compilation INV17).
141
+ for (const role of ['on-info', 'text-info', 'on-info-muted']) {
142
+ expect(css).toMatch(
143
+ new RegExp(
144
+ `--color-${role}: light-dark\\(#[0-9A-F]{6}, #[0-9A-F]{6}\\);`,
145
+ ),
146
+ );
147
+ }
148
+ // The dark media surface that sets the hue rebinds the text alias.
149
+ expect(css).toContain(mediaAlias);
150
+ expect(css).toContain(adaptationAlias);
151
+ expect(css.split(authoredRole).length - 1).toBeGreaterThanOrEqual(2);
152
+ expect(css.lastIndexOf(authoredRole)).toBeGreaterThan(
153
+ css.lastIndexOf(adaptationAlias),
154
+ );
155
+
156
+ const {statusAliasesTheme: builtTheme} = await import(
157
+ pathToFileURL(path.join(themesDir, 'status-aliases.js')).href
158
+ );
159
+ const source = defineTheme(input);
160
+ const childInput = {
161
+ name: 'status-alias-child',
162
+ tokens: {'--color-text-blue': '#345678'},
163
+ };
164
+ const fromSource = defineTheme({...childInput, extends: source});
165
+ const fromBuilt = defineTheme({...childInput, extends: builtTheme});
166
+ expect(generateThemeCSS(fromBuilt)).toEqual(generateThemeCSS(fromSource));
167
+ });
168
+
169
+ it('derives a complete status set for a minimal theme in built CSS (INV17)', async () => {
170
+ const {defineTheme, generateThemeCSS} =
171
+ await import('@astryxdesign/core/theme');
172
+ const project = path.join(tmpDir, 'project');
173
+ const themesDir = path.join(project, 'themes');
174
+ const input = {
175
+ name: 'status-minimal',
176
+ tokens: {
177
+ '--color-success': '#3FB950',
178
+ '--color-warning': '#D29922',
179
+ '--color-error': '#F85149',
180
+ '--color-info': '#6E40C9',
181
+ },
182
+ };
183
+ const themeFile = writeTheme(themesDir, input.name, JSON.stringify(input));
184
+ const result = await build(project, themeFile);
185
+ expect(result.code, result.stderr).toBe(0);
186
+
187
+ const css = fs.readFileSync(
188
+ path.join(themesDir, 'status-minimal.css'),
189
+ 'utf8',
190
+ );
191
+ for (const status of ['success', 'warning', 'error', 'info']) {
192
+ expect(css).toMatch(
193
+ new RegExp(
194
+ `--color-text-${status}: light-dark\\(#[0-9A-F]{6}, #[0-9A-F]{6}\\);`,
195
+ ),
196
+ );
197
+ expect(css).toContain(
198
+ `--color-icon-${status}: var(--color-text-${status});`,
199
+ );
200
+ }
201
+ // Built and runtime output derive the same values.
202
+ const runtime = generateThemeCSS(defineTheme(input));
203
+ const derived = css.match(/--color-text-warning: [^;]+;/)?.[0];
204
+ expect(derived).toBeDefined();
205
+ expect(JSON.stringify(runtime)).toContain(derived);
206
+ });
207
+
98
208
  it.each([
99
209
  ['defined', writeTheme],
100
210
  ['plain', writePlainTheme],
@@ -673,6 +673,7 @@ export function detectStylingSystem(targetDir) {
673
673
  '@stylexjs/rollup-plugin',
674
674
  '@stylexjs/webpack-plugin',
675
675
  '@stylexjs/nextjs-plugin',
676
+ '@stylexjs/unplugin',
676
677
  'vite-plugin-stylex',
677
678
  'unplugin-stylex',
678
679
  '@stylexswc/unplugin',
@@ -552,6 +552,11 @@ describe('detectStylingSystem', () => {
552
552
  expect(detectStylingSystem(tmpDir)).toBe('stylex');
553
553
  });
554
554
 
555
+ it('detects the official unplugin (the standard Vite path)', () => {
556
+ writePkg({'@stylexjs/unplugin': '0.10.0'});
557
+ expect(detectStylingSystem(tmpDir)).toBe('stylex');
558
+ });
559
+
555
560
  it('detects tailwind when tailwindcss is present', () => {
556
561
  writePkg({tailwindcss: '4.0.0'});
557
562
  expect(detectStylingSystem(tmpDir)).toBe('tailwind');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.5-canary.d26cdf3",
3
+ "version": "0.7.5-canary.d6004fd",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -111,10 +111,10 @@
111
111
  "zod": "^4.4.3"
112
112
  },
113
113
  "peerDependencies": {
114
- "@astryxdesign/charts": "0.7.5-canary.d26cdf3",
115
- "@astryxdesign/core": "0.7.5-canary.d26cdf3",
116
- "@astryxdesign/lab": "0.7.5-canary.d26cdf3",
117
- "@astryxdesign/theme-neutral": "0.7.5-canary.d26cdf3"
114
+ "@astryxdesign/charts": "0.7.5-canary.d6004fd",
115
+ "@astryxdesign/core": "0.7.5-canary.d6004fd",
116
+ "@astryxdesign/lab": "0.7.5-canary.d6004fd",
117
+ "@astryxdesign/theme-neutral": "0.7.5-canary.d6004fd"
118
118
  },
119
119
  "peerDependenciesMeta": {
120
120
  "@astryxdesign/charts": {
@@ -131,10 +131,10 @@
131
131
  }
132
132
  },
133
133
  "devDependencies": {
134
- "@astryxdesign/charts": "0.7.5-canary.d26cdf3",
135
- "@astryxdesign/core": "0.7.5-canary.d26cdf3",
136
- "@astryxdesign/lab": "0.7.5-canary.d26cdf3",
137
- "@astryxdesign/theme-neutral": "0.7.5-canary.d26cdf3",
134
+ "@astryxdesign/charts": "0.7.5-canary.d6004fd",
135
+ "@astryxdesign/core": "0.7.5-canary.d6004fd",
136
+ "@astryxdesign/lab": "0.7.5-canary.d6004fd",
137
+ "@astryxdesign/theme-neutral": "0.7.5-canary.d6004fd",
138
138
  "@heroicons/react": "^2.2.0",
139
139
  "@stylexjs/stylex": "^0.19.0",
140
140
  "@types/babel__core": "^7.20.5",