@sudajs/cli 0.19.0 → 0.20.1
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/dist/index.d.ts +286 -2
- package/dist/index.js +50 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/templates/theme/AGENTS.md +48 -0
- package/templates/theme/docs/agent-guides/design-and-runtime.md +13 -0
- package/templates/theme/src/manifest.ts +10 -0
- package/templates/theme/src/styles.css +15 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudajs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"suda": "./bin/suda.js"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"react": "^19.2.7",
|
|
34
34
|
"react-dom": "^19.2.7",
|
|
35
35
|
"zod": "^3.24.1",
|
|
36
|
-
"@sudajs/theme-engine": "6.
|
|
36
|
+
"@sudajs/theme-engine": "6.8.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@tailwindcss/postcss": "^4.3.0",
|
|
@@ -173,6 +173,54 @@ it must not substitute placeholder copy, labels, links, icons, or menu items.
|
|
|
173
173
|
}
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
+
- Configure the three font slots in every preset's `tokens`. Use font IDs, not
|
|
177
|
+
display names:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
typography: {
|
|
181
|
+
heading: "inter",
|
|
182
|
+
body: "noto-sans-sc",
|
|
183
|
+
mono: "jetbrains-mono",
|
|
184
|
+
},
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Read available IDs from `SUDA_THEME_FONT_FAMILIES`. System fonts such as
|
|
188
|
+
`system-sans`, `microsoft-yahei`, and `songti-sc` do not make network requests.
|
|
189
|
+
|
|
190
|
+
- Connect the design system field in the layout root's `fields` and
|
|
191
|
+
`defaultProps`:
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
fields: {
|
|
195
|
+
designSystem: designSystemField(t("layout.root.fields.designSystem"), sourceManifest.designSystem),
|
|
196
|
+
},
|
|
197
|
+
defaultProps: {
|
|
198
|
+
designSystem: createThemeDesignDefault(sourceManifest.designSystem),
|
|
199
|
+
},
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
- Use the resolved CSS variables for theme typography:
|
|
203
|
+
|
|
204
|
+
```css
|
|
205
|
+
.my-theme-root {
|
|
206
|
+
font-family: var(--font-sans);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.my-theme-root h1,
|
|
210
|
+
.my-theme-root h2,
|
|
211
|
+
.my-theme-root h3,
|
|
212
|
+
.my-theme-root h4,
|
|
213
|
+
.my-theme-root h5,
|
|
214
|
+
.my-theme-root h6 {
|
|
215
|
+
font-family: var(--font-heading);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.my-theme-root code,
|
|
219
|
+
.my-theme-root pre {
|
|
220
|
+
font-family: var(--font-mono);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
176
224
|
- In the layout root, resolve the selected preset and apply its CSS variables
|
|
177
225
|
to the element that wraps `children`. Use this exact pattern:
|
|
178
226
|
|
|
@@ -54,6 +54,10 @@ scales, radii, shadows, or spacing.
|
|
|
54
54
|
consumes (`background`, `foreground`, `primary`, `primaryForeground`,
|
|
55
55
|
`secondary`, `secondaryForeground`, `accent`, `accentForeground`, `muted`,
|
|
56
56
|
`mutedForeground`) and consumed radius tokens (`card`, `button`, `input`).
|
|
57
|
+
- Define `typography.heading`, `typography.body`, and `typography.mono` with
|
|
58
|
+
font ids exported by `@sudajs/theme-engine`. Use
|
|
59
|
+
`SUDA_THEME_FONT_FAMILIES` when presenting or validating available choices;
|
|
60
|
+
never persist raw family names, CSS, or custom font URLs.
|
|
57
61
|
- Do not invent platform-facing token names without checking generated types.
|
|
58
62
|
- Expose `designSystemField(...)` only at the layout root and initialize it with
|
|
59
63
|
`createThemeDesignDefault(sourceManifest.designSystem)`.
|
|
@@ -79,6 +83,15 @@ palette. Foreground tokens always pair with the surface token actually used.
|
|
|
79
83
|
| `--muted` / `--muted-foreground` | Low-emphasis surface and secondary text/icons. |
|
|
80
84
|
| `--radius` | Generic radius fallback. |
|
|
81
85
|
| `--radius-card` / `--radius-button` / `--radius-input` | Radius for cards, command buttons, and form controls. |
|
|
86
|
+
| `--font-heading` | Selected heading font family stack. |
|
|
87
|
+
| `--font-sans` | Selected body font family stack. |
|
|
88
|
+
| `--font-mono` | Selected monospace font family stack. |
|
|
89
|
+
|
|
90
|
+
Apply `--font-sans` to the theme root and body copy, `--font-heading` to
|
|
91
|
+
headings, and `--font-mono` to code-like content. The host loads one deduplicated
|
|
92
|
+
Google Fonts stylesheet for the selected web fonts with `display=swap`.
|
|
93
|
+
System-font choices do not make a network request, and every variable includes
|
|
94
|
+
a readable cross-platform fallback stack.
|
|
82
95
|
|
|
83
96
|
Hand-written CSS consumes these unprefixed variables directly. Do not use
|
|
84
97
|
Tailwind aliases such as `var(--color-primary)` or `var(--color-background)`
|
|
@@ -38,6 +38,11 @@ export const sourceManifest: ThemeSourceManifest = {
|
|
|
38
38
|
layout: {
|
|
39
39
|
contentWidth: "1280px",
|
|
40
40
|
},
|
|
41
|
+
typography: {
|
|
42
|
+
heading: "inter",
|
|
43
|
+
body: "inter",
|
|
44
|
+
mono: "jetbrains-mono",
|
|
45
|
+
},
|
|
41
46
|
},
|
|
42
47
|
},
|
|
43
48
|
{
|
|
@@ -64,6 +69,11 @@ export const sourceManifest: ThemeSourceManifest = {
|
|
|
64
69
|
layout: {
|
|
65
70
|
contentWidth: "1280px",
|
|
66
71
|
},
|
|
72
|
+
typography: {
|
|
73
|
+
heading: "space-grotesk",
|
|
74
|
+
body: "inter",
|
|
75
|
+
mono: "geist-mono",
|
|
76
|
+
},
|
|
67
77
|
},
|
|
68
78
|
},
|
|
69
79
|
],
|
|
@@ -22,10 +22,24 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.__SUDA_THEME_KEY__-root {
|
|
25
|
-
font-family:
|
|
25
|
+
font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);
|
|
26
26
|
color: var(--foreground, #111827);
|
|
27
27
|
background: var(--background, #ffffff);
|
|
28
28
|
}
|
|
29
|
+
.__SUDA_THEME_KEY__-root h1,
|
|
30
|
+
.__SUDA_THEME_KEY__-root h2,
|
|
31
|
+
.__SUDA_THEME_KEY__-root h3,
|
|
32
|
+
.__SUDA_THEME_KEY__-root h4,
|
|
33
|
+
.__SUDA_THEME_KEY__-root h5,
|
|
34
|
+
.__SUDA_THEME_KEY__-root h6 {
|
|
35
|
+
font-family: var(--font-heading, ui-serif, Georgia, serif);
|
|
36
|
+
}
|
|
37
|
+
.__SUDA_THEME_KEY__-root code,
|
|
38
|
+
.__SUDA_THEME_KEY__-root pre,
|
|
39
|
+
.__SUDA_THEME_KEY__-root kbd,
|
|
40
|
+
.__SUDA_THEME_KEY__-root samp {
|
|
41
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
42
|
+
}
|
|
29
43
|
.__SUDA_THEME_KEY__-header,
|
|
30
44
|
.__SUDA_THEME_KEY__-footer {
|
|
31
45
|
padding: 20px clamp(20px, 5vw, 64px);
|