@sudajs/cli 0.12.0 → 0.12.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/package.json +1 -1
- package/templates/theme/AGENTS.md +68 -2
package/package.json
CHANGED
|
@@ -308,8 +308,8 @@ example `FeaturedPosts`, `LatestPosts`, or `TopicPosts`. Use it for homepage
|
|
|
308
308
|
insights, featured articles, case studies, news teasers, or tag-filtered post
|
|
309
309
|
groups on ordinary pages.
|
|
310
310
|
|
|
311
|
-
Define that section with one
|
|
312
|
-
default query on
|
|
311
|
+
Define that section with exactly one top-level `type: "posts"` field and a
|
|
312
|
+
default query on the same prop:
|
|
313
313
|
|
|
314
314
|
```tsx
|
|
315
315
|
fields: {
|
|
@@ -328,6 +328,11 @@ platform. In the section render function, call
|
|
|
328
328
|
with the exact posts field key. Never import Prisma, call platform APIs, or
|
|
329
329
|
query the database from theme code.
|
|
330
330
|
|
|
331
|
+
Do not add `resourceQuery: { type: "posts" }` or
|
|
332
|
+
`resource_query: { type: "posts" }`. Do not assume the field must be named
|
|
333
|
+
`query`. A section may have only one top-level posts field; do not nest posts
|
|
334
|
+
fields inside `object`, `array`, native slots, or `blockSlots`.
|
|
335
|
+
|
|
331
336
|
Starter pages must include one home/index page with `isHome: true`. Recommended
|
|
332
337
|
starter pages include `index`, `about-us`, `contact-us`, `services`, and `team`.
|
|
333
338
|
Those recommended pages are not hard requirements, but a publishable theme
|
|
@@ -409,6 +414,67 @@ export const Hero: SudaComponentConfig<HeroProps> = {
|
|
|
409
414
|
- If a page section needs controlled nested content, use Suda `blockSlots`, not a hand-written Puck slot field. `blockSlots` lets the theme define exactly which local block kinds are allowed inside that section.
|
|
410
415
|
- Do not use legacy DropZone or `zones` patterns.
|
|
411
416
|
|
|
417
|
+
## Design system rules
|
|
418
|
+
|
|
419
|
+
Build every theme from one theme-level design system. Do not let each section,
|
|
420
|
+
CMS template, block slot, or starter page invent its own colors, type scale,
|
|
421
|
+
radius, shadows, or spacing.
|
|
422
|
+
|
|
423
|
+
- Define the editable theme system once in `src/manifest.ts` as
|
|
424
|
+
`sourceManifest.designSystem`. Include `version`, `defaultPresetId`, and
|
|
425
|
+
named `presets` with complete token sets.
|
|
426
|
+
- Use stable token names from the engine contract. At minimum, provide the
|
|
427
|
+
color tokens the theme renders (`background`, `foreground`, `primary`,
|
|
428
|
+
`primaryForeground`, `accent`, `accentForeground`, `muted`,
|
|
429
|
+
`mutedForeground`) and the radius tokens the CSS consumes (`card`, `button`,
|
|
430
|
+
`input`). Do not invent platform-facing token keys without checking the
|
|
431
|
+
generated types first.
|
|
432
|
+
- Expose the design system at the layout root only:
|
|
433
|
+
`designSystem: designSystemField(t("common.fields.designSystem"),
|
|
434
|
+
sourceManifest.designSystem)`, with
|
|
435
|
+
`createThemeDesignDefault(sourceManifest.designSystem)` in `ROOT_DEFAULTS`.
|
|
436
|
+
- In the root render, resolve the value once with
|
|
437
|
+
`resolveThemeDesignTokens(sourceManifest.designSystem, props.designSystem)`
|
|
438
|
+
and apply `createThemeDesignCssVariables(tokens)` to the theme root element.
|
|
439
|
+
Components should consume CSS variables; they should not resolve design
|
|
440
|
+
presets themselves.
|
|
441
|
+
- In `src/styles.css`, map Suda variables to theme-local or Tailwind variables
|
|
442
|
+
once, for example `--color-primary: var(--suda-color-primary, #...)` and
|
|
443
|
+
`--radius-card: var(--suda-radius-card, 24px)`. Use those variables across
|
|
444
|
+
sections, cards, CMS layouts, post lists, forms, and local blocks.
|
|
445
|
+
- Keep typography and spacing scales centralized in `src/styles.css`. Define
|
|
446
|
+
reusable classes or variables for containers, section padding, headings,
|
|
447
|
+
eyebrow text, body copy, cards, buttons, inputs, and media frames. Reuse those
|
|
448
|
+
classes instead of writing new one-off Tailwind values in every section.
|
|
449
|
+
- Section props may expose semantic choices such as `tone`, `variant`,
|
|
450
|
+
`columns`, `mediaPosition`, `showImage`, or `spacing`. Map those choices to
|
|
451
|
+
the existing design tokens and shared CSS classes.
|
|
452
|
+
- Do not add raw `color`, `font`, `spacing`, `radius`, or `shadow` fields to a
|
|
453
|
+
section just because the CSS has a value. Expose a design token field only
|
|
454
|
+
when the user should intentionally customize that value per component
|
|
455
|
+
instance. Otherwise, keep the value in the theme CSS.
|
|
456
|
+
- Use `color`, `font`, and `spacing` field types only for real editor-facing
|
|
457
|
+
design controls. Use `select`/`radio` for named variants that are already
|
|
458
|
+
part of the theme design system.
|
|
459
|
+
- Local blocks inside `blockSlots` inherit the host section's design system.
|
|
460
|
+
Local block fields should edit content or semantic variants, not define their
|
|
461
|
+
own palette, type scale, radius, shadows, or spacing.
|
|
462
|
+
- CMS main sections (`MainPosts`, `MainPost`, `MainTags`, `MainTagPosts`) and
|
|
463
|
+
ordinary post-resource sections must use the same containers, heading scale,
|
|
464
|
+
card style, media ratio, pagination style, and empty/loading states as the
|
|
465
|
+
rest of the theme.
|
|
466
|
+
- Starter pages must demonstrate the same design system across different page
|
|
467
|
+
types. Vary content, order, media, and semantic variants; do not hardcode
|
|
468
|
+
unrelated colors, spacing, rounded corners, or shadows in starter page data to
|
|
469
|
+
make pages look different.
|
|
470
|
+
- When adding a new section, first choose the existing container, heading,
|
|
471
|
+
button, card, form, and media patterns it should reuse. Add a new CSS utility
|
|
472
|
+
or token only when multiple sections will use it or the theme needs a new
|
|
473
|
+
named pattern.
|
|
474
|
+
- Keep preview screenshots, default props, starter pages, CMS templates, and
|
|
475
|
+
AI examples aligned with the same token presets. The default preset should
|
|
476
|
+
look publishable without manual editor tweaks.
|
|
477
|
+
|
|
412
478
|
## Styling and assets
|
|
413
479
|
|
|
414
480
|
- Tailwind v4 starts in `src/styles.css` with `@import "tailwindcss";` and `@source "./**/*.{ts,tsx}";`.
|