@astryxdesign/cli 0.7.1-canary.4a14542 → 0.7.1-canary.4eaefd4

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.
@@ -0,0 +1,45 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Regression coverage for the table-filter page's compact view-options tabs.
5
+ * @input The shipped table-filter page template source.
6
+ * @output Assertions that the shared tabpanel is labelled by its selected tab.
7
+ * @position Template contract test for the tabs relationship in the narrow-view sheet.
8
+ */
9
+
10
+ import fs from 'node:fs';
11
+ import path from 'node:path';
12
+ import {fileURLToPath} from 'node:url';
13
+ import {describe, expect, it} from 'vitest';
14
+
15
+ const sourcePath = path.resolve(
16
+ path.dirname(fileURLToPath(import.meta.url)),
17
+ '../../assets/templates/pages/table-filter/page.tsx',
18
+ );
19
+ const source = fs.readFileSync(sourcePath, 'utf8');
20
+ const sheet = source.match(
21
+ /const viewOptionsSheet = \(([\s\S]*?)\n {2}\);/,
22
+ )?.[1];
23
+ const tab = sheet?.match(/<Tab\b([\s\S]*?)\/>/)?.[1];
24
+ const panel = sheet?.match(/<VStack\b([^>]*?role="tabpanel"[^>]*?)>/)?.[1];
25
+
26
+ describe('table-filter view-options tabs', () => {
27
+ it('finds the compact sheet, its tab and its panel', () => {
28
+ expect(sheet).toBeDefined();
29
+ expect(tab).toBeDefined();
30
+ expect(panel).toBeDefined();
31
+ });
32
+
33
+ it('gives every tab an id derived from the panel id and its section', () => {
34
+ expect(tab).toContain('id={`${viewPanelId}-tab-${section.key}`}');
35
+ expect(tab).toContain('panelId={viewPanelId}');
36
+ });
37
+
38
+ it('labels the shared panel by the selected tab, not a fixed string', () => {
39
+ expect(panel).toContain('id={viewPanelId}');
40
+ expect(panel).toContain(
41
+ 'aria-labelledby={`${viewPanelId}-tab-${viewSection}`}',
42
+ );
43
+ expect(panel).not.toContain('aria-label=');
44
+ });
45
+ });
@@ -185,16 +185,6 @@ const overrides = stylex.create({
185
185
  'Next.js + Tailwind bridge',
186
186
  '[apps/example-nextjs-tailwind](https://github.com/facebook/astryx/tree/main/apps/example-nextjs-tailwind)',
187
187
  ],
188
- [
189
- 'Next.js Source',
190
- 'Next.js importing from source',
191
- '[apps/example-nextjs-source](https://github.com/facebook/astryx/tree/main/apps/example-nextjs-source)',
192
- ],
193
- [
194
- 'Vite',
195
- 'Vite',
196
- '[apps/example-vite](https://github.com/facebook/astryx/tree/main/apps/example-vite)',
197
- ],
198
188
  [
199
189
  'Vite + Tailwind',
200
190
  'Vite + Tailwind bridge',
@@ -4,7 +4,8 @@
4
4
  * @file `astryx docs styling-overview`
5
5
  *
6
6
  * One question: "How do I set up CSS?"
7
- * Three paths, each with its exact imports.
7
+ * Three paths, each with its exact imports. Every path loads the prebuilt
8
+ * stylesheets (spec:AST-080 FR5); none compiles Astryx package source.
8
9
  */
9
10
 
10
11
  /** @type {import('@astryxdesign/cli/authoring').ReferenceDoc} */
@@ -14,7 +15,7 @@ export const docs = {
14
15
  title: 'Styling overview',
15
16
  category: 'guide',
16
17
  description:
17
- 'How to set up CSS — exact imports for three paths: plain, Tailwind, and StyleX from source.',
18
+ 'How to set up CSS — exact imports for three paths: plain, Tailwind, and StyleX for your own code — plus the stylesheet each Astryx package ships.',
18
19
  keywords: [
19
20
  'styling',
20
21
  'CSS',
@@ -46,15 +47,15 @@ export const docs = {
46
47
  "None beyond Tailwind's own.",
47
48
  ],
48
49
  [
49
- 'StyleX from source',
50
- 'Swizzled (ejected) components. Raw StyleX source needs a compiler plugin.',
51
- 'Yes \u2014 a StyleX bundler plugin.',
50
+ 'StyleX for your own code',
51
+ 'Your own `stylex.create()` styles and swizzled (ejected) components. Astryx itself stays prebuilt.',
52
+ 'Yes \u2014 a StyleX plugin for your own code.',
52
53
  ],
53
54
  ],
54
55
  },
55
56
  {
56
57
  type: 'prose',
57
- text: 'All three resolve to the same design tokens and support theming and dark mode. You can mix them in one app.',
58
+ text: 'All three load the same prebuilt Astryx stylesheets, resolve to the same design tokens, and support theming and dark mode. None of them compiles Astryx package source. You can mix them in one app.',
58
59
  },
59
60
  ],
60
61
  },
@@ -117,12 +118,12 @@ export const docs = {
117
118
  ],
118
119
  },
119
120
  {
120
- id: 'stylex-from-source',
121
- title: 'StyleX from source',
121
+ id: 'stylex-own-code',
122
+ title: 'StyleX for your own code',
122
123
  content: [
123
124
  {
124
125
  type: 'prose',
125
- text: 'Only needed when you swizzle a component (`astryx swizzle <Component>`) or write your own StyleX. The plain path already supports `xstyle` overrides \u2014 this path is for editing component internals. Some built-in page templates also use StyleX for layout; if you scaffold one and see "Unexpected stylex.create call at runtime", add the compiler plugin for your bundler below.',
126
+ text: 'Only needed when you write your own StyleX (`stylex.create()`) or swizzle a component (`astryx swizzle <Component>`), which copies its StyleX source into your app. The plain path already supports `xstyle` overrides \u2014 this path is for your own StyleX code. Some built-in page templates also use StyleX for layout; if you scaffold one and see "Unexpected stylex.create call at runtime", add the compiler plugin for your bundler below.',
126
127
  },
127
128
  {
128
129
  type: 'code',
@@ -134,14 +135,13 @@ export const docs = {
134
135
  type: 'code',
135
136
  lang: 'css',
136
137
  label: 'globals.css',
137
- code: `@layer reset, astryx-base, astryx-theme;
138
-
139
- @import "@astryxdesign/core/reset.css";
138
+ code: `@import "@astryxdesign/core/reset.css";
139
+ @import "@astryxdesign/core/astryx.css";
140
140
  @import "@astryxdesign/theme-neutral/theme.css";`,
141
141
  },
142
142
  {
143
143
  type: 'prose',
144
- text: 'No `astryx.css` \u2014 the StyleX compiler produces component styles from source. Add the plugin for your bundler:',
144
+ text: 'Keep `astryx.css`: Astryx component styles always come from the prebuilt stylesheets. Point the StyleX compiler at your own source only, never at `node_modules/@astryxdesign`. Add the plugin for your bundler:',
145
145
  },
146
146
  {
147
147
  type: 'table',
@@ -149,7 +149,10 @@ export const docs = {
149
149
  rows: [
150
150
  ['Webpack', '@stylexjs/webpack-plugin'],
151
151
  ['Vite / Rollup', '@stylexjs/rollup-plugin'],
152
- ['Babel (any)', '@stylexjs/babel-plugin + @stylexjs/postcss-plugin'],
152
+ [
153
+ 'Babel (any)',
154
+ '@stylexjs/babel-plugin + @stylexjs/postcss-plugin',
155
+ ],
153
156
  ['Next.js (keep next/font)', '@stylexswc/nextjs-plugin'],
154
157
  ],
155
158
  },
@@ -159,6 +162,37 @@ export const docs = {
159
162
  },
160
163
  ],
161
164
  },
165
+ {
166
+ id: 'other-packages',
167
+ title: 'Other Astryx packages',
168
+ content: [
169
+ {
170
+ type: 'prose',
171
+ text: 'Every Astryx package whose components carry styles ships its own prebuilt stylesheet. Import it after `astryx.css` for each package you use. All of them place their rules in the same `astryx-base` layer, so your theme overrides win over every package.',
172
+ },
173
+ {
174
+ type: 'code',
175
+ lang: 'css',
176
+ label: 'globals.css',
177
+ code: `@import "@astryxdesign/core/reset.css";
178
+ @import "@astryxdesign/core/astryx.css";
179
+ @import "@astryxdesign/richtext/richtext.css"; /* Rich Text */
180
+ @import "@astryxdesign/lab/lab.css"; /* Lab */
181
+ @import "@astryxdesign/charts/charts.css"; /* Charts */
182
+ @import "@astryxdesign/theme-neutral/theme.css";`,
183
+ },
184
+ {
185
+ type: 'table',
186
+ headers: ['Package', 'Stylesheet'],
187
+ rows: [
188
+ ['@astryxdesign/core', '@astryxdesign/core/astryx.css'],
189
+ ['@astryxdesign/richtext', '@astryxdesign/richtext/richtext.css'],
190
+ ['@astryxdesign/lab', '@astryxdesign/lab/lab.css'],
191
+ ['@astryxdesign/charts', '@astryxdesign/charts/charts.css'],
192
+ ],
193
+ },
194
+ ],
195
+ },
162
196
  {
163
197
  id: 'what-each-file-does',
164
198
  title: 'What each import does',
@@ -175,7 +209,12 @@ export const docs = {
175
209
  [
176
210
  'astryx.css',
177
211
  'astryx-base',
178
- 'Pre-compiled component styles. Required for plain and Tailwind. Omit when compiling from source.',
212
+ 'Prebuilt component styles. Required on every path.',
213
+ ],
214
+ [
215
+ 'richtext.css, lab.css, charts.css',
216
+ 'astryx-base',
217
+ 'Prebuilt styles for each other Astryx package you use. Load after astryx.css.',
179
218
  ],
180
219
  [
181
220
  'theme.css',
@@ -77,7 +77,7 @@ const styles = stylex.create({
77
77
  content: [
78
78
  {
79
79
  type: 'prose',
80
- text: 'Astryx components ship pre-compiled, so consuming the published package needs no StyleX setup. But `astryx swizzle <Component>` copies the raw StyleX *source* into your app, and StyleX source requires a build-time StyleX compiler to produce atomic CSS. Without one the component compiles but renders completely unstyled: no error, no warning. If a swizzled component looks unstyled, a missing StyleX compiler is almost always why. The same applies if you author your own StyleX with `stylex.create()`.',
80
+ text: 'Astryx components ship pre-compiled: `astryx.css` and each package\'s own stylesheet hold all of their styles, so consuming the published packages needs no StyleX setup. But `astryx swizzle <Component>` copies the raw StyleX *source* into your app, and StyleX source requires a build-time StyleX compiler to produce atomic CSS. Without one the component compiles but renders completely unstyled: no error, no warning. If a swizzled component looks unstyled, a missing StyleX compiler is almost always why. The same applies if you author your own StyleX with `stylex.create()`.',
81
81
  },
82
82
  {
83
83
  type: 'table',
@@ -105,7 +105,7 @@ const styles = stylex.create({
105
105
 
106
106
  export default stylexPlugin({
107
107
  rsOptions: {
108
- // Resolve @astryxdesign/core's StyleX so swizzled component source compiles.
108
+ // Resolve the Astryx token modules that swizzled source imports.
109
109
  aliases: {'@/*': ['./src/*']},
110
110
  unstable_moduleResolution: {type: 'commonJS'},
111
111
  },
@@ -120,6 +120,7 @@ export default stylexPlugin({
120
120
  'Symptom of a missing compiler: swizzled component renders with no styles, but no build or runtime error.',
121
121
  'A Babel config turns off SWC in Next.js; skip it if you need `next/font`.',
122
122
  'Pure theming (defineTheme + astryx theme build) needs NO StyleX compiler; only swizzled/authored StyleX source does.',
123
+ 'Keep loading `astryx.css` with a StyleX compiler in place. The compiler builds your own and swizzled source only; never add `node_modules/@astryxdesign` to its inputs.',
123
124
  ],
124
125
  },
125
126
  ],
@@ -4099,7 +4099,7 @@ export default function TableFilterTemplate() {
4099
4099
  restates the selected tab word for word, and the strip already
4100
4100
  marks which one that is. On a phone that is a line of vertical
4101
4101
  space spent saying it twice. The panel keeps the name for anyone
4102
- not seeing the strip, as its accessible label. */}
4102
+ not seeing the strip: its selected tab labels it. */}
4103
4103
  <TabList
4104
4104
  value={viewSection}
4105
4105
  onChange={value => setViewSection(value as ViewSection)}
@@ -4109,6 +4109,7 @@ export default function TableFilterTemplate() {
4109
4109
  {VIEW_SECTIONS.map(section => (
4110
4110
  <Tab
4111
4111
  key={section.key}
4112
+ id={`${viewPanelId}-tab-${section.key}`}
4112
4113
  value={section.key}
4113
4114
  label={section.label}
4114
4115
  icon={section.icon}
@@ -4126,7 +4127,7 @@ export default function TableFilterTemplate() {
4126
4127
  gap={0}
4127
4128
  id={viewPanelId}
4128
4129
  role="tabpanel"
4129
- aria-label={activeSection?.title}
4130
+ aria-labelledby={`${viewPanelId}-tab-${viewSection}`}
4130
4131
  paddingBlockStart={3}>
4131
4132
  {viewPanelBody()}
4132
4133
  </VStack>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.1-canary.4a14542",
3
+ "version": "0.7.1-canary.4eaefd4",
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",
@@ -101,10 +101,10 @@
101
101
  "zod": "^4.4.3"
102
102
  },
103
103
  "peerDependencies": {
104
- "@astryxdesign/charts": "0.7.1-canary.4a14542",
105
- "@astryxdesign/core": "0.7.1-canary.4a14542",
106
- "@astryxdesign/lab": "0.7.1-canary.4a14542",
107
- "@astryxdesign/theme-neutral": "0.7.1-canary.4a14542"
104
+ "@astryxdesign/charts": "0.7.1-canary.4eaefd4",
105
+ "@astryxdesign/core": "0.7.1-canary.4eaefd4",
106
+ "@astryxdesign/lab": "0.7.1-canary.4eaefd4",
107
+ "@astryxdesign/theme-neutral": "0.7.1-canary.4eaefd4"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.7.1-canary.4a14542",
125
- "@astryxdesign/core": "0.7.1-canary.4a14542",
126
- "@astryxdesign/lab": "0.7.1-canary.4a14542",
127
- "@astryxdesign/theme-neutral": "0.7.1-canary.4a14542",
124
+ "@astryxdesign/charts": "0.7.1-canary.4eaefd4",
125
+ "@astryxdesign/core": "0.7.1-canary.4eaefd4",
126
+ "@astryxdesign/lab": "0.7.1-canary.4eaefd4",
127
+ "@astryxdesign/theme-neutral": "0.7.1-canary.4eaefd4",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",