@astryxdesign/cli 0.7.1-canary.458a74c → 0.7.1-canary.4fe4a3c

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.
@@ -129,15 +129,31 @@ export function AppRoot({children}: {children: React.ReactNode}) {
129
129
  },
130
130
  {
131
131
  type: 'prose',
132
- text: 'On Tailwind v3 there is no preflight.css to import, so wrap the @tailwind base directive in a named layer instead. Keep utilities unlayered so existing app utility classes still win everywhere.',
132
+ text: 'A layer\'s rank is set by the first stylesheet on the page that names it, so the global CSS file (or a `layers.css` holding only the `@layer` line) must be the first import in the root layout or app entry. Import it before any module that imports Astryx or theme CSS, including the `astryx-themes` module generated by `astryx theme add` and a root component like the `AppRoot` above that imports `theme.css`. If a theme stylesheet loads first, Tailwind preflight overrides Astryx base styles and theme overrides lose.',
133
133
  },
134
134
  {
135
135
  type: 'code',
136
- lang: 'css',
137
- label: 'Tailwind v3 coexistence',
138
- code: `@layer reset, tw-preflight, astryx-base, astryx-theme;
136
+ lang: 'tsx',
137
+ label: 'Root layout or app entry',
138
+ code: `import './globals.css'; // first: declares the cascade-layer order
139
139
 
140
- @import "@astryxdesign/core/reset.css";
140
+ import {AppRoot} from './AppRoot';`,
141
+ },
142
+ {
143
+ type: 'prose',
144
+ text: 'On Tailwind v3 there is no preflight.css to import, so wrap the @tailwind base directive in a named layer instead. Keep utilities unlayered so existing app utility classes still win everywhere. Put the `@layer` order line in its own `layers.css` and import it first, before `globals.css`: Next.js (webpack or Turbopack) and other bundlers that hoist CSS imports move the imported files above an inline `@layer` line, so the order would arrive too late.',
145
+ },
146
+ {
147
+ type: 'code',
148
+ lang: 'css',
149
+ label: 'layers.css (imported first)',
150
+ code: `@layer reset, tw-preflight, astryx-base, astryx-theme;`,
151
+ },
152
+ {
153
+ type: 'code',
154
+ lang: 'css',
155
+ label: 'globals.css (Tailwind v3 coexistence)',
156
+ code: `@import "@astryxdesign/core/reset.css";
141
157
  @import "@astryxdesign/core/astryx.css";
142
158
  @import "@astryxdesign/theme-neutral/theme.css";
143
159
 
@@ -147,6 +163,15 @@ export function AppRoot({children}: {children: React.ReactNode}) {
147
163
  @tailwind components;
148
164
  @tailwind utilities; /* unlayered: legacy utility classes keep winning */`,
149
165
  },
166
+ {
167
+ type: 'code',
168
+ lang: 'tsx',
169
+ label: 'Root layout or app entry (Tailwind v3)',
170
+ code: `import './layers.css'; // first: declares the cascade-layer order
171
+ import './globals.css';
172
+
173
+ import {AppRoot} from './AppRoot';`,
174
+ },
150
175
  ],
151
176
  },
152
177
  {
@@ -186,7 +211,7 @@ export function AppRoot({children}: {children: React.ReactNode}) {
186
211
  type: 'list',
187
212
  style: 'unordered',
188
213
  items: [
189
- 'Declare the canonical @layer order once, before any @import. With webpack-based bundlers (including Next.js) the order declaration must live in its own CSS file imported first, such as layers.css, because webpack hoists @import content above the inline CSS that follows it.',
214
+ 'Declare the canonical @layer order once, before any @import. With Next.js (webpack or Turbopack) and other bundlers that hoist CSS imports, the order declaration must live in its own CSS file imported first, such as layers.css, because the bundler hoists @import content above the inline CSS that follows it.',
190
215
  'Audit every pre-existing global or reset stylesheet and assign each one to a layer deliberately. Top-level imports without layer() stay unlayered and beat every layer; imports nested inside a layered file inherit that layer.',
191
216
  'Remove or demote the app legacy reset. The design system ships its own :where() reset in the lowest layer, so any app reset belongs in that same reset layer and never in a layer above astryx-base.',
192
217
  'Layer Tailwind preflight. On Tailwind v4, import preflight.css with layer(base). On Tailwind v3, wrap the @tailwind base directive in a named layer (see the snippet in Theme and CSS Setup). Unlayered preflight overrides theme CSS silently.',
@@ -21,6 +21,9 @@ export const docs = {
21
21
  'Dialog',
22
22
  'BottomSheet',
23
23
  'contract',
24
+ 'Grid',
25
+ 'columns',
26
+ 'minWidth',
24
27
  ],
25
28
 
26
29
  sections: [
@@ -94,5 +97,39 @@ const isNarrow = useMediaQuery('(max-width: 1024px)');
94
97
  },
95
98
  ],
96
99
  },
100
+ {
101
+ id: 'columns-that-reflow',
102
+ title: 'Columns that reflow',
103
+ content: [
104
+ {
105
+ type: 'prose',
106
+ text: 'For columns that reflow on small screens, use `Grid columns={{minWidth, max}}`. A numeric `columns` is exactly N columns at every width and never reflows: `columns={4}` on a 390px phone renders four tracks under 100px wide, and the row overflows the page as soon as their content cannot shrink to fit. `{minWidth: 240, max: 4}` renders at most four columns, each at least 240px, and drops to one full-width column when the container is narrow; `max` is what lets that last column shrink to the container, and `gap` counts toward the room the columns need.',
107
+ },
108
+ {
109
+ type: 'code',
110
+ lang: 'tsx',
111
+ label: 'Reflowing stat row versus a fixed week row',
112
+ code: `// Reflows: 4 columns on desktop, 3 in a 768px-wide grid, 1 on a phone.
113
+ <Grid columns={{minWidth: 240, max: 4}} gap={3}>
114
+ {stats.map(stat => <StatCard key={stat.id} {...stat} />)}
115
+ </Grid>
116
+
117
+ // Fixed: exactly 7 columns at every width (a number never reflows).
118
+ <Grid columns={7} gap={1}>
119
+ {days.map(day => <DayCell key={day} day={day} />)}
120
+ </Grid>`,
121
+ },
122
+ {
123
+ type: 'list',
124
+ style: 'unordered',
125
+ items: [
126
+ '`{minWidth}` alone: as many columns as fit at the floor, no cap; a container narrower than `minWidth` overflows, so add `max` for anything that reaches a phone',
127
+ "`{minWidth, repeat: 'fit'}`: empty tracks collapse so present items stretch",
128
+ "A numeric `GridSpan` wider than the grid's current columns adds implicit columns to the whole grid; items placed before and after the span flow into them, and `columns='full'` then covers only the explicit columns. In a reflowing grid keep spans within the smallest count it can reach, or use `'full'`, which adds none",
129
+ 'Styling that changes the room columns have to fit changes the count a reflowing shape reaches: a `columnGap` or `gap` step, inline padding on the grid, or `grid-auto-flow: column` through `xstyle`, which places items into extra implicit columns. A `className` rule replaces the computed track list only when it wins the cascade against the generated styles; prefer `xstyle` for overrides',
130
+ ],
131
+ },
132
+ ],
133
+ },
97
134
  ],
98
135
  };
@@ -47,6 +47,18 @@ export const docs = {
47
47
  type: 'prose',
48
48
  text: 'Pre-declare every layer before any imports. This keeps reset lowest, Tailwind preflight above reset, component/theme styles in the middle, and Tailwind utilities last so utility classes on `className` can intentionally override component defaults.',
49
49
  },
50
+ {
51
+ type: 'prose',
52
+ text: 'A layer\'s rank is set by the first stylesheet on the page that names it, so this order only holds when `globals.css` loads first. Make it the first import in the root layout or app entry, before any module that imports Astryx or theme CSS. That includes the `astryx-themes` module generated by `astryx theme add` and any root component that imports a theme\'s `theme.css`. If a theme stylesheet loads first, Tailwind preflight overrides Astryx base styles and theme overrides lose. If `globals.css` cannot come first, move the `@layer` line into its own `layers.css` and import that first instead.',
53
+ },
54
+ {
55
+ type: 'code',
56
+ lang: 'tsx',
57
+ label: 'Root layout or app entry',
58
+ code: `import './globals.css'; // first: declares the cascade-layer order
59
+
60
+ import {themes, defaultThemeSlug} from './astryx-themes';`,
61
+ },
50
62
  {
51
63
  type: 'code',
52
64
  lang: 'tsx',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.1-canary.458a74c",
3
+ "version": "0.7.1-canary.4fe4a3c",
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.458a74c",
105
- "@astryxdesign/core": "0.7.1-canary.458a74c",
106
- "@astryxdesign/lab": "0.7.1-canary.458a74c",
107
- "@astryxdesign/theme-neutral": "0.7.1-canary.458a74c"
104
+ "@astryxdesign/charts": "0.7.1-canary.4fe4a3c",
105
+ "@astryxdesign/core": "0.7.1-canary.4fe4a3c",
106
+ "@astryxdesign/lab": "0.7.1-canary.4fe4a3c",
107
+ "@astryxdesign/theme-neutral": "0.7.1-canary.4fe4a3c"
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.458a74c",
125
- "@astryxdesign/core": "0.7.1-canary.458a74c",
126
- "@astryxdesign/lab": "0.7.1-canary.458a74c",
127
- "@astryxdesign/theme-neutral": "0.7.1-canary.458a74c",
124
+ "@astryxdesign/charts": "0.7.1-canary.4fe4a3c",
125
+ "@astryxdesign/core": "0.7.1-canary.4fe4a3c",
126
+ "@astryxdesign/lab": "0.7.1-canary.4fe4a3c",
127
+ "@astryxdesign/theme-neutral": "0.7.1-canary.4fe4a3c",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",