@astryxdesign/cli 0.1.4-canary.aba685c → 0.1.4-canary.ac0186b
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/package.json +10 -10
- package/src/commands/build-theme.mjs +1 -8
- package/src/commands/build-theme.variants.test.mjs +18 -7
- package/templates/blocks/components/Collapsible/CollapsibleWithoutCard.tsx +23 -25
- package/templates/pages/classic-gallery/page.tsx +1 -1
- package/templates/pages/dashboard/page.tsx +1 -1
- package/templates/pages/documentation/page.tsx +1 -1
- package/templates/pages/mixed-gallery/page.tsx +1 -1
- package/templates/pages/payment-form/page.tsx +6 -2
- package/templates/pages/product-detail/page.tsx +11 -3
- package/templates/pages/product-gallery/page.tsx +1 -1
- package/templates/pages/settings/page.tsx +1 -1
- package/templates/pages/side-gallery/page.tsx +1 -1
- package/templates/pages/table-page/page.tsx +1 -1
- package/templates/pages/table-page-chart/page.tsx +1 -1
- package/templates/pages/table-page-heatmap-status/page.tsx +1 -1
- package/templates/pages/table-page-shoe-store-heatmap/page.tsx +1 -1
- package/src/commands/build-theme.color-scheme.test.mjs +0 -153
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.1.4-canary.
|
|
3
|
+
"version": "0.1.4-canary.ac0186b",
|
|
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",
|
|
@@ -68,17 +68,17 @@
|
|
|
68
68
|
"CHANGELOG.md"
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@clack/prompts": "^1.
|
|
71
|
+
"@clack/prompts": "^1.5.1",
|
|
72
72
|
"commander": "^12.1.0",
|
|
73
73
|
"jiti": "^2.7.0",
|
|
74
74
|
"jscodeshift": "^17.3.0",
|
|
75
75
|
"zod": "^4.4.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@astryxdesign/charts": "0.1.4-canary.
|
|
79
|
-
"@astryxdesign/core": "0.1.4-canary.
|
|
80
|
-
"@astryxdesign/lab": "0.1.4-canary.
|
|
81
|
-
"@astryxdesign/theme-neutral": "0.1.4-canary.
|
|
78
|
+
"@astryxdesign/charts": "0.1.4-canary.ac0186b",
|
|
79
|
+
"@astryxdesign/core": "0.1.4-canary.ac0186b",
|
|
80
|
+
"@astryxdesign/lab": "0.1.4-canary.ac0186b",
|
|
81
|
+
"@astryxdesign/theme-neutral": "0.1.4-canary.ac0186b",
|
|
82
82
|
"gpt-tokenizer": "^3.4.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|
|
@@ -96,10 +96,10 @@
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@astryxdesign/charts": "0.1.4-canary.
|
|
100
|
-
"@astryxdesign/core": "0.1.4-canary.
|
|
101
|
-
"@astryxdesign/lab": "0.1.4-canary.
|
|
102
|
-
"@astryxdesign/theme-neutral": "0.1.4-canary.
|
|
99
|
+
"@astryxdesign/charts": "0.1.4-canary.ac0186b",
|
|
100
|
+
"@astryxdesign/core": "0.1.4-canary.ac0186b",
|
|
101
|
+
"@astryxdesign/lab": "0.1.4-canary.ac0186b",
|
|
102
|
+
"@astryxdesign/theme-neutral": "0.1.4-canary.ac0186b",
|
|
103
103
|
"gpt-tokenizer": "^3.4.0"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
@@ -939,15 +939,8 @@ export function registerTheme(program) {
|
|
|
939
939
|
if (component.length > 0) {
|
|
940
940
|
const componentInner = component.join('\n\n');
|
|
941
941
|
const componentScope = `@scope (${scopeSelector}) to (${scopeTo}) {\n${componentInner}\n}`;
|
|
942
|
-
// light-dark() needs a color-scheme declaration in this bundle, but a
|
|
943
|
-
// bare `:root { color-scheme: light dark }` outranks reset.css's
|
|
944
|
-
// `html[data-theme]` mapping (astryx-theme layer comes after reset),
|
|
945
|
-
// silently defeating `<Theme mode>` forcing on <html>. Mirror the
|
|
946
|
-
// attribute-keyed mapping so the declaration follows the active mode.
|
|
947
942
|
const colorSchemeDecl = componentScope.includes('light-dark(')
|
|
948
|
-
? ' :root { color-scheme: light dark; }\n'
|
|
949
|
-
' html[data-theme="light"] { color-scheme: light; }\n' +
|
|
950
|
-
' html[data-theme="dark"] { color-scheme: dark; }\n\n'
|
|
943
|
+
? ' :root { color-scheme: light dark; }\n\n'
|
|
951
944
|
: '';
|
|
952
945
|
cssParts.push(
|
|
953
946
|
`@layer astryx-theme {\n${colorSchemeDecl}${componentScope}\n}`,
|
|
@@ -28,10 +28,20 @@ import * as fs from 'node:fs';
|
|
|
28
28
|
import * as path from 'node:path';
|
|
29
29
|
import * as os from 'node:os';
|
|
30
30
|
import {fileURLToPath} from 'node:url';
|
|
31
|
-
import {ensureCoreBuilt} from './ensure-core-built.mjs';
|
|
32
31
|
|
|
33
32
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
34
33
|
const CLI_BIN = path.resolve(__dirname, '../../bin/astryx.mjs');
|
|
34
|
+
const REPO_ROOT = path.resolve(__dirname, '../../../..');
|
|
35
|
+
const CORE_THEME_ENTRY = path.join(
|
|
36
|
+
REPO_ROOT,
|
|
37
|
+
'packages/core/dist/theme/index.js',
|
|
38
|
+
);
|
|
39
|
+
// The fix reads core's shipped component declarations to decide whether an
|
|
40
|
+
// interface is augmentable; those .d.ts files come from the same core build.
|
|
41
|
+
const CORE_BUTTON_DTS = path.join(
|
|
42
|
+
REPO_ROOT,
|
|
43
|
+
'packages/core/dist/Button/index.d.ts',
|
|
44
|
+
);
|
|
35
45
|
|
|
36
46
|
function runCli(args, cwd) {
|
|
37
47
|
try {
|
|
@@ -58,13 +68,14 @@ function writeTheme(dir, contents) {
|
|
|
58
68
|
return file;
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
// Build core through the shared lock helper — this suite previously ran its
|
|
62
|
-
// own unguarded `if (!exists) pnpm -F core build`, and when Vitest scheduled
|
|
63
|
-
// it alongside the other build-theme suites on a fresh checkout, the
|
|
64
|
-
// concurrent builds collided on packages/core/dist (core's build starts by
|
|
65
|
-
// wiping dist), nondeterministically breaking whichever suite was mid-read.
|
|
66
71
|
beforeAll(() => {
|
|
67
|
-
|
|
72
|
+
if (!fs.existsSync(CORE_THEME_ENTRY) || !fs.existsSync(CORE_BUTTON_DTS)) {
|
|
73
|
+
execFileSync('pnpm', ['-F', '@astryxdesign/core', 'build'], {
|
|
74
|
+
cwd: REPO_ROOT,
|
|
75
|
+
stdio: 'pipe',
|
|
76
|
+
timeout: 180_000,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
68
79
|
}, 200_000);
|
|
69
80
|
|
|
70
81
|
let tmpDir;
|
|
@@ -2,36 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
|
-
import {Collapsible
|
|
5
|
+
import {Collapsible} from '@astryxdesign/core/Collapsible';
|
|
6
6
|
import {Divider} from '@astryxdesign/core/Divider';
|
|
7
7
|
import {Text} from '@astryxdesign/core/Text';
|
|
8
8
|
import {VStack} from '@astryxdesign/core/Layout';
|
|
9
9
|
|
|
10
10
|
export default function CollapsibleWithoutCard() {
|
|
11
11
|
return (
|
|
12
|
-
<
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</VStack>
|
|
35
|
-
</CollapsibleGroup>
|
|
12
|
+
<VStack gap={3} style={{width: '100%', maxWidth: 400}}>
|
|
13
|
+
<Collapsible trigger="Deployment Details">
|
|
14
|
+
<Text type="body">
|
|
15
|
+
Last deployed on April 18, 2026 at 3:42 PM by Sarah Chen. Build
|
|
16
|
+
duration was 2m 14s with zero warnings.
|
|
17
|
+
</Text>
|
|
18
|
+
</Collapsible>
|
|
19
|
+
<Divider />
|
|
20
|
+
<Collapsible trigger="Environment Variables" defaultIsOpen={false}>
|
|
21
|
+
<Text type="body">
|
|
22
|
+
12 variables configured. Last updated March 30, 2026. All secrets are
|
|
23
|
+
encrypted at rest with AES-256.
|
|
24
|
+
</Text>
|
|
25
|
+
</Collapsible>
|
|
26
|
+
<Divider />
|
|
27
|
+
<Collapsible trigger="Build Logs" defaultIsOpen={false}>
|
|
28
|
+
<Text type="body">
|
|
29
|
+
Build completed successfully. 847 modules compiled, 0 errors, 0
|
|
30
|
+
warnings. Bundle size: 142 KB gzipped.
|
|
31
|
+
</Text>
|
|
32
|
+
</Collapsible>
|
|
33
|
+
</VStack>
|
|
36
34
|
);
|
|
37
35
|
}
|
|
@@ -153,6 +153,10 @@ const fmt = (n: number) => `$${n.toFixed(2)}`;
|
|
|
153
153
|
// :root by `@astryxdesign/core/astryx.css`). No StyleX compiler required.
|
|
154
154
|
|
|
155
155
|
const fullWidth: CSSProperties = {width: '100%'};
|
|
156
|
+
// LayoutContent clips overflow by default, which traps position:sticky
|
|
157
|
+
// children (the sticky order summary). With height="auto" the page scrolls
|
|
158
|
+
// at the window, so let overflow be visible here so sticky can pin.
|
|
159
|
+
const visibleOverflow: CSSProperties = {overflow: 'visible'};
|
|
156
160
|
// Form column flex-basis so the two checkout columns share width evenly.
|
|
157
161
|
const formColBasis: CSSProperties = {flexBasis: 0};
|
|
158
162
|
// Space the Order Summary content below its collapsible trigger title.
|
|
@@ -262,9 +266,9 @@ export default function PaymentFormPage() {
|
|
|
262
266
|
|
|
263
267
|
return (
|
|
264
268
|
<Layout
|
|
265
|
-
height="
|
|
269
|
+
height="auto"
|
|
266
270
|
content={
|
|
267
|
-
<LayoutContent padding={0}>
|
|
271
|
+
<LayoutContent padding={0} style={visibleOverflow}>
|
|
268
272
|
<Center axis="horizontal">
|
|
269
273
|
<Section
|
|
270
274
|
variant="transparent"
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useState} from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
VStack,
|
|
8
|
+
HStack,
|
|
9
|
+
Layout,
|
|
10
|
+
LayoutContent,
|
|
11
|
+
} from '@astryxdesign/core/Layout';
|
|
7
12
|
import {Center} from '@astryxdesign/core/Center';
|
|
8
13
|
import {Grid} from '@astryxdesign/core/Grid';
|
|
9
14
|
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
@@ -198,7 +203,10 @@ function ProductInfo() {
|
|
|
198
203
|
<VStack gap={2}>
|
|
199
204
|
<Text type="label">Finish</Text>
|
|
200
205
|
<VStack hAlign="start">
|
|
201
|
-
<SegmentedControl
|
|
206
|
+
<SegmentedControl
|
|
207
|
+
value={finish}
|
|
208
|
+
onChange={setFinish}
|
|
209
|
+
label="Finish">
|
|
202
210
|
{FINISHES.map(f => (
|
|
203
211
|
<SegmentedControlItem
|
|
204
212
|
key={f.value}
|
|
@@ -278,7 +286,7 @@ export default function ProductDetailTemplate() {
|
|
|
278
286
|
|
|
279
287
|
return (
|
|
280
288
|
<Layout
|
|
281
|
-
height="
|
|
289
|
+
height="auto"
|
|
282
290
|
contentWidth={1200}
|
|
283
291
|
content={
|
|
284
292
|
<LayoutContent padding={6}>
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Regression test for the `color-scheme` declaration `astryx theme build`
|
|
5
|
-
* emits alongside `light-dark()` token output (see #3658).
|
|
6
|
-
*
|
|
7
|
-
* `astryx theme build` injects a `color-scheme` declaration into
|
|
8
|
-
* `@layer astryx-theme` whenever the generated CSS contains `light-dark()`,
|
|
9
|
-
* so LightningCSS/browsers can resolve it. That declaration must mirror
|
|
10
|
-
* reset.css's own `html[data-theme]` -> `color-scheme` mapping (a bare
|
|
11
|
-
* `:root { color-scheme: light dark; }` alone permanently pins the page to
|
|
12
|
-
* "light dark", defeating `<Theme mode="light|dark">` forcing regardless of
|
|
13
|
-
* `@layer astryx-theme` being declared after `@layer reset` in layer order):
|
|
14
|
-
*
|
|
15
|
-
* :root { color-scheme: light dark; }
|
|
16
|
-
* html[data-theme="light"] { color-scheme: light; }
|
|
17
|
-
* html[data-theme="dark"] { color-scheme: dark; }
|
|
18
|
-
*
|
|
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
|
-
* Building `astryx theme build` requires a compiled @astryxdesign/core (there is no in-CLI
|
|
23
|
-
* fallback generator), so this suite builds core once in beforeAll via the
|
|
24
|
-
* shared ensureCoreBuilt() helper — which serializes concurrent Vitest workers
|
|
25
|
-
* behind a lock — to stay self-sufficient regardless of CI job ordering.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
import {describe, it, expect, beforeAll, beforeEach, afterEach} from 'vitest';
|
|
29
|
-
import {execFileSync} from 'node:child_process';
|
|
30
|
-
import * as fs from 'node:fs';
|
|
31
|
-
import * as path from 'node:path';
|
|
32
|
-
import * as os from 'node:os';
|
|
33
|
-
import {fileURLToPath} from 'node:url';
|
|
34
|
-
import {ensureCoreBuilt} from './ensure-core-built.mjs';
|
|
35
|
-
|
|
36
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
37
|
-
const CLI_BIN = path.resolve(__dirname, '../../bin/astryx.mjs');
|
|
38
|
-
|
|
39
|
-
const COLOR_SCHEME_ROOT_DECL = ':root { color-scheme: light dark; }';
|
|
40
|
-
const COLOR_SCHEME_LIGHT_DECL = 'html[data-theme="light"] { color-scheme: light; }';
|
|
41
|
-
const COLOR_SCHEME_DARK_DECL = 'html[data-theme="dark"] { color-scheme: dark; }';
|
|
42
|
-
|
|
43
|
-
function runCli(args, cwd) {
|
|
44
|
-
try {
|
|
45
|
-
const out = execFileSync('node', [CLI_BIN, ...args], {
|
|
46
|
-
cwd,
|
|
47
|
-
encoding: 'utf-8',
|
|
48
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
49
|
-
env: {...process.env, FORCE_COLOR: '0'},
|
|
50
|
-
});
|
|
51
|
-
return {code: 0, stdout: out, stderr: ''};
|
|
52
|
-
} catch (e) {
|
|
53
|
-
return {
|
|
54
|
-
code: e.status ?? 1,
|
|
55
|
-
stdout: e.stdout?.toString() ?? '',
|
|
56
|
-
stderr: e.stderr?.toString() ?? '',
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function writeTheme(dir, name, tokens) {
|
|
62
|
-
fs.mkdirSync(dir, {recursive: true});
|
|
63
|
-
// The CLI writes <basename>.css next to the source file, so use the
|
|
64
|
-
// theme name as the filename for unambiguous fixtures.
|
|
65
|
-
const file = path.join(dir, `${name}.mjs`);
|
|
66
|
-
fs.writeFileSync(
|
|
67
|
-
file,
|
|
68
|
-
`export default { name: ${JSON.stringify(name)}, tokens: ${JSON.stringify(tokens)} };\n`,
|
|
69
|
-
);
|
|
70
|
-
return file;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// `astryx theme build` imports the compiled @astryxdesign/core/theme entry. Build core
|
|
74
|
-
// once if it isn't already present so the suite works in any CI job.
|
|
75
|
-
beforeAll(() => {
|
|
76
|
-
ensureCoreBuilt();
|
|
77
|
-
}, 200_000);
|
|
78
|
-
|
|
79
|
-
let tmpDir;
|
|
80
|
-
beforeEach(() => {
|
|
81
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-build-theme-color-scheme-'));
|
|
82
|
-
});
|
|
83
|
-
afterEach(() => {
|
|
84
|
-
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('theme build color-scheme output', () => {
|
|
88
|
-
it('emits the mode-aware color-scheme rules in @layer astryx-theme for a light-dark() theme', () => {
|
|
89
|
-
const project = path.join(tmpDir, 'project');
|
|
90
|
-
const themesDir = path.join(project, 'themes');
|
|
91
|
-
// A raw light-dark() token value is what triggers the color-scheme
|
|
92
|
-
// injection in build-theme.mjs (it checks the generated CSS for the
|
|
93
|
-
// literal substring). `defineTheme.test.ts` already covers the separate
|
|
94
|
-
// [light, dark] tuple -> light-dark() conversion; this fixture writes
|
|
95
|
-
// the string directly so this test stays focused on the CLI's own
|
|
96
|
-
// color-scheme decision, not on that conversion.
|
|
97
|
-
const themeFile = writeTheme(themesDir, 'with-light-dark', {
|
|
98
|
-
'--color-accent': 'light-dark(#0077B6, #48CAE4)',
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
const result = runCli(
|
|
102
|
-
['theme', 'build', path.relative(project, themeFile)],
|
|
103
|
-
project,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
expect(result.code).toBe(0);
|
|
107
|
-
|
|
108
|
-
const cssPath = path.join(themesDir, 'with-light-dark.css');
|
|
109
|
-
expect(fs.existsSync(cssPath)).toBe(true);
|
|
110
|
-
const css = fs.readFileSync(cssPath, 'utf-8');
|
|
111
|
-
|
|
112
|
-
expect(css).toContain('light-dark(#0077B6, #48CAE4)');
|
|
113
|
-
|
|
114
|
-
// All 3 rules must be present...
|
|
115
|
-
expect(css).toContain(COLOR_SCHEME_ROOT_DECL);
|
|
116
|
-
expect(css).toContain(COLOR_SCHEME_LIGHT_DECL);
|
|
117
|
-
expect(css).toContain(COLOR_SCHEME_DARK_DECL);
|
|
118
|
-
|
|
119
|
-
// ...and specifically inside @layer astryx-theme, not @layer reset (the
|
|
120
|
-
// declaration must sit alongside the light-dark() token/component output
|
|
121
|
-
// it resolves, not the zero-specificity prose defaults).
|
|
122
|
-
const themeLayerStart = css.indexOf('@layer astryx-theme');
|
|
123
|
-
expect(themeLayerStart).toBeGreaterThanOrEqual(0);
|
|
124
|
-
const themeLayerBody = css.slice(themeLayerStart);
|
|
125
|
-
expect(themeLayerBody).toContain(COLOR_SCHEME_ROOT_DECL);
|
|
126
|
-
expect(themeLayerBody).toContain(COLOR_SCHEME_LIGHT_DECL);
|
|
127
|
-
expect(themeLayerBody).toContain(COLOR_SCHEME_DARK_DECL);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('omits all color-scheme rules for a theme with no light-dark() tokens', () => {
|
|
131
|
-
const project = path.join(tmpDir, 'project');
|
|
132
|
-
const themesDir = path.join(project, 'themes');
|
|
133
|
-
const themeFile = writeTheme(themesDir, 'no-light-dark', {
|
|
134
|
-
'--color-accent': '#0077B6',
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
const result = runCli(
|
|
138
|
-
['theme', 'build', path.relative(project, themeFile)],
|
|
139
|
-
project,
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
expect(result.code).toBe(0);
|
|
143
|
-
|
|
144
|
-
const cssPath = path.join(themesDir, 'no-light-dark.css');
|
|
145
|
-
expect(fs.existsSync(cssPath)).toBe(true);
|
|
146
|
-
const css = fs.readFileSync(cssPath, 'utf-8');
|
|
147
|
-
|
|
148
|
-
expect(css).not.toContain('light-dark(');
|
|
149
|
-
expect(css).not.toContain(COLOR_SCHEME_ROOT_DECL);
|
|
150
|
-
expect(css).not.toContain(COLOR_SCHEME_LIGHT_DECL);
|
|
151
|
-
expect(css).not.toContain(COLOR_SCHEME_DARK_DECL);
|
|
152
|
-
});
|
|
153
|
-
});
|