@astryxdesign/cli 0.1.4-canary.ce93640 → 0.1.4-canary.d209405
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/docs/getting-started.doc.mjs +4 -0
- package/docs/migration.doc.mjs +134 -0
- package/package.json +9 -9
|
@@ -69,6 +69,10 @@ export const docs = {
|
|
|
69
69
|
type: 'prose',
|
|
70
70
|
text: 'Available themes: @astryxdesign/theme-neutral (muted minimal, a good starting point), @astryxdesign/theme-butter, @astryxdesign/theme-chocolate, @astryxdesign/theme-gothic (dark-only), @astryxdesign/theme-matcha, @astryxdesign/theme-stone, and @astryxdesign/theme-y2k. See `npx astryx docs theme` for the full theming guide.',
|
|
71
71
|
},
|
|
72
|
+
{
|
|
73
|
+
type: 'prose',
|
|
74
|
+
text: 'These stylesheets are cascade-layered: the reset loads in @layer reset and component styles in @layer astryx-base. If your project has existing global CSS, a legacy reset, or Tailwind, declare the layer order explicitly and assign every stylesheet to a layer deliberately: unlayered styles and later layers both override astryx-base regardless of specificity. See the Cascade Layer Safety section in `npx astryx docs migration` before building screens.',
|
|
75
|
+
},
|
|
72
76
|
],
|
|
73
77
|
},
|
|
74
78
|
{
|
package/docs/migration.doc.mjs
CHANGED
|
@@ -33,6 +33,7 @@ export const docs = {
|
|
|
33
33
|
'Install the design system and run init so the project has package scripts, theme CSS, and agent docs.',
|
|
34
34
|
'Wrap the app root with Theme and choose the initial light, dark, or system mode behavior.',
|
|
35
35
|
'Make Tailwind and design system CSS layer order explicit before replacing components.',
|
|
36
|
+
'Render the foundation smoke test page and confirm primitives keep their padding before migrating any surface.',
|
|
36
37
|
'Move the persistent frame first: AppShell, TopNav, SideNav, page content, and mobile navigation.',
|
|
37
38
|
'Replace shared primitives: Button, IconButton, TextInput, NumberInput, Switch, CheckboxInput, RadioList, Selector, Tabs, Dialog, AlertDialog, Banner, Toast, Badge, Card, Table, and ListItem.',
|
|
38
39
|
'Replace global workflows: command palette, settings popover, theme toggle, search, filters, create flows, and destructive confirmation dialogs.',
|
|
@@ -125,6 +126,139 @@ export function AppRoot({children}: {children: React.ReactNode}) {
|
|
|
125
126
|
@import "@astryxdesign/core/tailwind-theme.css";
|
|
126
127
|
@import "tailwindcss/utilities.css" layer(utilities);`,
|
|
127
128
|
},
|
|
129
|
+
{
|
|
130
|
+
type: 'prose',
|
|
131
|
+
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
|
+
},
|
|
133
|
+
{
|
|
134
|
+
type: 'code',
|
|
135
|
+
lang: 'css',
|
|
136
|
+
label: 'Tailwind v3 coexistence',
|
|
137
|
+
code: `@layer reset, tw-preflight, astryx-base, astryx-theme;
|
|
138
|
+
|
|
139
|
+
@import "@astryxdesign/core/reset.css";
|
|
140
|
+
@import "@astryxdesign/core/astryx.css";
|
|
141
|
+
@import "@astryxdesign/theme-neutral/theme.css";
|
|
142
|
+
|
|
143
|
+
@layer tw-preflight {
|
|
144
|
+
@tailwind base; /* layered: astryx-theme now wins over preflight */
|
|
145
|
+
}
|
|
146
|
+
@tailwind components;
|
|
147
|
+
@tailwind utilities; /* unlayered: legacy utility classes keep winning */`,
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: 'Cascade Layer Safety',
|
|
153
|
+
content: [
|
|
154
|
+
{
|
|
155
|
+
type: 'prose',
|
|
156
|
+
text: 'In a stylesheet with no layers at all, a zero-specificity reset like `* { padding: 0 }` loses to any class selector, so most developers treat resets as harmless. Layers change the rules twice: unlayered styles beat every named layer, and a later layer beats an earlier one, both regardless of specificity. The same reset therefore wins against every component style either by staying unlayered or by landing in a layer declared after astryx-base. Same CSS, opposite outcome, and no error or warning when it happens.',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'prose',
|
|
160
|
+
text: 'This is the most common way an adoption breaks, through one of two @import mechanisms. A top-level @import without the layer() keyword keeps the legacy reset unlayered, where it overrides every design system layer. And an @import nested inside a file that was itself imported into a layer inherits that surrounding layer, so a reset can silently land in a consumer layer above astryx-base. Either way the fix is the same: import the legacy reset into the lowest layer explicitly.',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: 'code',
|
|
164
|
+
lang: 'css',
|
|
165
|
+
label: 'Legacy reset, explicitly layered',
|
|
166
|
+
code: `/* was: @import "./legacy-reset.css"; (unlayered: beats every layer) */
|
|
167
|
+
@import "./legacy-reset.css" layer(reset);`,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
type: 'prose',
|
|
171
|
+
text: 'Audit the layers around the design system with this checklist before building screens.',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: 'list',
|
|
175
|
+
style: 'unordered',
|
|
176
|
+
items: [
|
|
177
|
+
'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.',
|
|
178
|
+
'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.',
|
|
179
|
+
'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.',
|
|
180
|
+
'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.',
|
|
181
|
+
'Set moduleResolution to bundler or node16 and newer so subpath imports like @astryxdesign/core/reset.css resolve.',
|
|
182
|
+
'Theme with defineTheme and the accent family API instead of hand-writing individual color tokens. Derived tokens like --color-on-accent are generated from the accent scale automatically; hand-writing only --color-accent leaves --color-on-accent at its stale white default with no contrast guarantee against the new accent.',
|
|
183
|
+
'Run the foundation smoke test below and view a few components in both light and dark mode before migrating any route.',
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
type: 'prose',
|
|
188
|
+
text: 'One more mental model shift: a className or utility class you write on a component still reaches the DOM either way, but whether it overrides the component is a layer question, not a source order question. Keep app utilities in the utilities layer so they keep winning.',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
title: 'Foundation Smoke Test',
|
|
194
|
+
content: [
|
|
195
|
+
{
|
|
196
|
+
type: 'prose',
|
|
197
|
+
text: 'A broken layer order fails silently and identically on every page, so catch it before feature work instead of after N migrated screens. Render one throwaway page with a few primitives as the first migration step.',
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'code',
|
|
201
|
+
lang: 'tsx',
|
|
202
|
+
label: 'Foundation check page',
|
|
203
|
+
code: `import {useState} from 'react';
|
|
204
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
205
|
+
import {Card} from '@astryxdesign/core/Card';
|
|
206
|
+
import {Table} from '@astryxdesign/core/Table';
|
|
207
|
+
import {TextInput} from '@astryxdesign/core/TextInput';
|
|
208
|
+
import {VStack} from '@astryxdesign/core/VStack';
|
|
209
|
+
|
|
210
|
+
export default function FoundationCheck() {
|
|
211
|
+
const [email, setEmail] = useState('');
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div data-foundation-check>
|
|
215
|
+
<VStack gap={4}>
|
|
216
|
+
<Button label="Primary action" variant="primary" />
|
|
217
|
+
<TextInput
|
|
218
|
+
label="Email"
|
|
219
|
+
placeholder="you@example.com"
|
|
220
|
+
value={email}
|
|
221
|
+
onChange={setEmail}
|
|
222
|
+
/>
|
|
223
|
+
<Card>One card with default padding</Card>
|
|
224
|
+
<Table
|
|
225
|
+
data={[{name: 'Foundation', status: 'ok'}]}
|
|
226
|
+
columns={[
|
|
227
|
+
{key: 'name', header: 'Name'},
|
|
228
|
+
{key: 'status', header: 'Status'},
|
|
229
|
+
]}
|
|
230
|
+
/>
|
|
231
|
+
</VStack>
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
}`,
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
type: 'prose',
|
|
238
|
+
text: 'If the button renders with visible padding, a filled primary background, and the input and card have borders and internal spacing, the foundation is sound. For an assertion that can run in any test runner or a dev-only effect, check that a primitive keeps non-zero padding:',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: 'code',
|
|
242
|
+
lang: 'ts',
|
|
243
|
+
label: 'Foundation assertion',
|
|
244
|
+
code: `const button = document.querySelector<HTMLButtonElement>(
|
|
245
|
+
'[data-foundation-check] button',
|
|
246
|
+
);
|
|
247
|
+
if (!button) {
|
|
248
|
+
throw new Error('Foundation check page did not render a button.');
|
|
249
|
+
}
|
|
250
|
+
if (getComputedStyle(button).paddingInline === '0px') {
|
|
251
|
+
throw new Error(
|
|
252
|
+
'Foundation broken: an unlayered reset or a later cascade layer is ' +
|
|
253
|
+
'overriding component styles. Check that no app reset sits outside ' +
|
|
254
|
+
'the reset layer.',
|
|
255
|
+
);
|
|
256
|
+
}`,
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
type: 'prose',
|
|
260
|
+
text: 'When this fails, the fix is almost always in the layer order: find the stylesheet that zeroes padding, and move it into the reset layer or delete it.',
|
|
261
|
+
},
|
|
128
262
|
],
|
|
129
263
|
},
|
|
130
264
|
{
|
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.d209405",
|
|
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",
|
|
@@ -75,10 +75,10 @@
|
|
|
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.d209405",
|
|
79
|
+
"@astryxdesign/core": "0.1.4-canary.d209405",
|
|
80
|
+
"@astryxdesign/lab": "0.1.4-canary.d209405",
|
|
81
|
+
"@astryxdesign/theme-neutral": "0.1.4-canary.d209405",
|
|
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.d209405",
|
|
100
|
+
"@astryxdesign/core": "0.1.4-canary.d209405",
|
|
101
|
+
"@astryxdesign/lab": "0.1.4-canary.d209405",
|
|
102
|
+
"@astryxdesign/theme-neutral": "0.1.4-canary.d209405",
|
|
103
103
|
"gpt-tokenizer": "^3.4.0"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|