@sudajs/cli 0.12.2 → 0.12.4
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudajs/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"suda": "./bin/suda.js"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react": "^19.2.7",
|
|
35
35
|
"react-dom": "^19.2.7",
|
|
36
36
|
"zod": "^3.24.1",
|
|
37
|
-
"@sudajs/theme-engine": "
|
|
37
|
+
"@sudajs/theme-engine": "5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@tailwindcss/postcss": "^4.3.0",
|
|
@@ -4,6 +4,47 @@ This directory is a standalone Vite + React + Tailwind Suda theme generated by `
|
|
|
4
4
|
|
|
5
5
|
Your job in a theme project is to create a complete, publishable theme with theme-specific components, realistic starter pages, scoped styling, assets, and AI metadata. Do not build pages by assembling generic engine components; those are reserved for end users who need supplemental editing blocks after the theme is installed.
|
|
6
6
|
|
|
7
|
+
## Component naming and editor organization
|
|
8
|
+
|
|
9
|
+
Use the clean Puck Cloud component naming style as a reference for
|
|
10
|
+
editor-facing section names and public component keys. Do not copy its component
|
|
11
|
+
list 1:1; learn the style: names should be short, concrete, and easy to infer
|
|
12
|
+
from the editor without opening the component.
|
|
13
|
+
|
|
14
|
+
- Group components by page role when `pageConfig.categories` is used. Category
|
|
15
|
+
`title` values must use `t(...)`, the same as component and field labels.
|
|
16
|
+
Keep the translated text short and task-oriented, such as `Introduction`,
|
|
17
|
+
`Content`, `Social Proof`, `Business`, `CMS`, and `Layout`, ordered roughly
|
|
18
|
+
by where those sections appear in a page.
|
|
19
|
+
- Name components with concise PascalCase nouns that describe the visitor-facing
|
|
20
|
+
pattern. For example, `ArticleCard` should clearly suggest an article preview
|
|
21
|
+
card, `FeatureCards` should suggest a group of feature cards, and `ContactUs`
|
|
22
|
+
should suggest a contact section. Use names that fit the theme's actual
|
|
23
|
+
sections rather than forcing a fixed list.
|
|
24
|
+
- Avoid theme names, implementation details, and filler suffixes such as
|
|
25
|
+
`Section`, `Component`, `Block`, `New`, or `Custom` unless the word is part
|
|
26
|
+
of the public pattern users recognize.
|
|
27
|
+
- When a theme needs multiple components with the same broad purpose, prefer a
|
|
28
|
+
friendly semantic variant name that tells editors what is different at a
|
|
29
|
+
glance. Use the content, media, layout, density, or page job as the
|
|
30
|
+
differentiator, such as `HeroImage`, `HeroVideo`, `MediaHero`,
|
|
31
|
+
`FeatureCards`, `FeatureList`, `PricingTable`, `PricingCards`,
|
|
32
|
+
`TestimonialsCarousel`, or `TestimonialsGrid`.
|
|
33
|
+
- Use numbered variants only as a fallback when the variants genuinely share
|
|
34
|
+
the same purpose and no concise semantic name would make the difference
|
|
35
|
+
clearer. In that case keep the base name and append a numbered variant to the
|
|
36
|
+
public key and editor label, for example `FeatureCards-1`,
|
|
37
|
+
`FeatureCards-2`, `Hero-1`, `Hero-2`, `Cta-1`, or `Cta-2`. Treat `-1` as the
|
|
38
|
+
primary or most generally useful option, and use later numbers for variants
|
|
39
|
+
with a clearly different visual rhythm, content density, or business
|
|
40
|
+
emphasis.
|
|
41
|
+
- Explain the difference between semantic or numbered variants in
|
|
42
|
+
`ai.instructions` and placement guidance so AI chooses the right one instead
|
|
43
|
+
of treating them as interchangeable duplicates.
|
|
44
|
+
- Keep instance ids separate from component type names. `content[].type` must
|
|
45
|
+
match the public component key, while `content[].props.id` remains a stable
|
|
46
|
+
unique instance id for that concrete page item.
|
|
47
|
+
|
|
7
48
|
## Theme-building workflow
|
|
8
49
|
|
|
9
50
|
When you add or change a section, complete the whole theme authoring loop in
|
|
@@ -98,7 +139,7 @@ Field source of truth:
|
|
|
98
139
|
generation reliable.
|
|
99
140
|
- Use `description`, `placeholder`, and `visibleIf` only when they help the
|
|
100
141
|
editor or AI choose the right value.
|
|
101
|
-
- Suda extended field types are `url`, `icon`, `
|
|
142
|
+
- Suda extended field types are `url`, `icon`, `color`,
|
|
102
143
|
`range`, `spacing`, `media`, `image`, `video`, and `posts`. These are valid
|
|
103
144
|
in `fields` and are normalized by `@sudajs/theme-engine`.
|
|
104
145
|
|
|
@@ -148,8 +189,6 @@ fields: {
|
|
|
148
189
|
download: { type: "media", kind: "file", label: t("common.fields.file") },
|
|
149
190
|
icon: { type: "icon", label: t("common.fields.icon") },
|
|
150
191
|
accentColor: { type: "color", label: t("common.fields.color") },
|
|
151
|
-
font: { type: "font", label: t("common.fields.font") },
|
|
152
|
-
links: { type: "menu", label: t("common.fields.menu") },
|
|
153
192
|
spacing: { type: "spacing", label: t("common.fields.spacing") },
|
|
154
193
|
|
|
155
194
|
// Dynamic post lists. Use this only on page sections that intentionally
|
|
@@ -357,7 +396,7 @@ Theme editor labels are localized by the host editor. Use the template's
|
|
|
357
396
|
other editor-facing configuration string.
|
|
358
397
|
|
|
359
398
|
- Import `t` from `./i18n.js` in files that define `pageConfig`, `layoutConfig`,
|
|
360
|
-
fields, options, or local blocks.
|
|
399
|
+
categories, fields, options, or local blocks.
|
|
361
400
|
- Write labels as stable dot-path keys, for example
|
|
362
401
|
`label: t("sections.hero.fields.title")`, not hardcoded strings.
|
|
363
402
|
- Add every key used with `t(...)` to `src/locales/en.json`. This file is the
|
|
@@ -429,10 +468,12 @@ radius, shadows, or spacing.
|
|
|
429
468
|
`mutedForeground`) and the radius tokens the CSS consumes (`card`, `button`,
|
|
430
469
|
`input`). Do not invent platform-facing token keys without checking the
|
|
431
470
|
generated types first.
|
|
432
|
-
- Expose the design system at the layout root only:
|
|
433
|
-
|
|
434
|
-
sourceManifest.designSystem)
|
|
435
|
-
|
|
471
|
+
- Expose the design system at the layout root only, for example:
|
|
472
|
+
```ts
|
|
473
|
+
designSystem: designSystemField(t("common.fields.designSystem"), sourceManifest.designSystem);
|
|
474
|
+
```
|
|
475
|
+
Use `createThemeDesignDefault(sourceManifest.designSystem)` in
|
|
476
|
+
`ROOT_DEFAULTS`.
|
|
436
477
|
- In the root render, resolve the value once with
|
|
437
478
|
`resolveThemeDesignTokens(sourceManifest.designSystem, props.designSystem)`
|
|
438
479
|
and apply `createThemeDesignCssVariables(tokens)` to the theme root element.
|
|
@@ -449,11 +490,11 @@ radius, shadows, or spacing.
|
|
|
449
490
|
- Section props may expose semantic choices such as `tone`, `variant`,
|
|
450
491
|
`columns`, `mediaPosition`, `showImage`, or `spacing`. Map those choices to
|
|
451
492
|
the existing design tokens and shared CSS classes.
|
|
452
|
-
- Do not add raw `color`,
|
|
493
|
+
- Do not add raw `color`, typography, `spacing`, `radius`, or `shadow` fields to a
|
|
453
494
|
section just because the CSS has a value. Expose a design token field only
|
|
454
495
|
when the user should intentionally customize that value per component
|
|
455
496
|
instance. Otherwise, keep the value in the theme CSS.
|
|
456
|
-
- Use `color
|
|
497
|
+
- Use `color` and `spacing` field types only for real editor-facing
|
|
457
498
|
design controls. Use `select`/`radio` for named variants that are already
|
|
458
499
|
part of the theme design system.
|
|
459
500
|
- Local blocks inside `blockSlots` inherit the host section's design system.
|
|
@@ -491,10 +532,11 @@ Use the most specific field type available. A generic `text` field may pass type
|
|
|
491
532
|
|
|
492
533
|
- Always use `url` for links and routes, including anchors, `mailto:` links, and external URLs. Do not use `text` for href-like props.
|
|
493
534
|
- Use `image` for images, `video` for videos, and `media` only when the same prop intentionally accepts mixed media.
|
|
494
|
-
- Use `color` for color values, `icon` for icon names, `
|
|
535
|
+
- Use `color` for color values, `icon` for icon names, `range` for bounded numbers, and `spacing` for spacing tokens.
|
|
536
|
+
- Use `select` for typography choices and `array`/`object` fields for navigation lists.
|
|
495
537
|
- Use `select` or `radio` for fixed choices. Keep option values stable, short, and serializable.
|
|
496
538
|
- Use `array` for repeatable items and `object` for grouped settings. Keep nested field names aligned with the prop shape and `defaultProps`.
|
|
497
|
-
- Use `textarea` for multi-sentence copy. Use `text` only for short labels, headings, slugs, names, or plain strings that are not URLs, media, colors, icons,
|
|
539
|
+
- Use `textarea` for multi-sentence copy. Use `text` only for short labels, headings, slugs, names, or plain strings that are not URLs, media, colors, icons, typography choices, or navigation lists.
|
|
498
540
|
- Use `t(...)` for every editor-facing `label` in components, fields, nested
|
|
499
541
|
`arrayFields` / `object.fields`, local blocks, and option lists. Add matching
|
|
500
542
|
keys to `src/locales/en.json` at the same time.
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { LayoutData, SudaConfig } from "@sudajs/theme-engine";
|
|
2
2
|
|
|
3
|
+
import { t } from "./i18n.js";
|
|
3
4
|
import { LAYOUT_COMPONENTS, rootConfig } from "./layout.js";
|
|
4
5
|
import { SECTION_COMPONENTS } from "./sections.js";
|
|
5
6
|
|
|
6
7
|
export const pageConfig: SudaConfig = {
|
|
7
8
|
components: SECTION_COMPONENTS,
|
|
9
|
+
categories: {
|
|
10
|
+
sections: {
|
|
11
|
+
title: t("common.categories.sections"),
|
|
12
|
+
components: ["Hero", "FeatureGrid", "FeaturedPosts", "Testimonial", "CallToAction"],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
8
15
|
};
|
|
9
16
|
|
|
10
17
|
export const layoutConfig: SudaConfig = {
|