@sudajs/cli 0.8.0 → 0.8.2
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 +1 -0
- package/dist/index.js +32 -24
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/templates/theme/AGENTS.md +82 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudajs/cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"suda": "./bin/suda.js"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"react": "^19.2.7",
|
|
33
33
|
"react-dom": "^19.2.7",
|
|
34
34
|
"zod": "^3.24.1",
|
|
35
|
-
"@sudajs/theme-engine": "2.1
|
|
35
|
+
"@sudajs/theme-engine": "2.2.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@tailwindcss/postcss": "^4.3.0",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"vite": "^7.3.3",
|
|
49
49
|
"vitest": "^3.2.4",
|
|
50
50
|
"@suda/build-config": "0.0.0",
|
|
51
|
-
"@suda/
|
|
52
|
-
"@suda/
|
|
51
|
+
"@suda/tsconfig": "0.0.0",
|
|
52
|
+
"@suda/eslint-config": "0.0.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsup",
|
|
@@ -45,3 +45,85 @@ Use `visibleIf: ({ props }, { fields }) => boolean` for synchronous field visibi
|
|
|
45
45
|
- Put editor-only controls in props when they change rendering, for example `showLogo`; pair dependent controls with `visibleIf` rather than hiding logic only in JSX.
|
|
46
46
|
- Keep persisted props JSON-serializable. Do not store functions, React nodes, class instances, database ids for media, or environment-specific absolute filesystem paths.
|
|
47
47
|
- Add optional field-level `ai.instructions`, `ai.required`, or `ai.exclude` when a prop needs generation guidance beyond its label and type.
|
|
48
|
+
|
|
49
|
+
## Block slot authoring rules
|
|
50
|
+
|
|
51
|
+
Prefer `blockSlots` when a section owns nested content that benefits from independent editor selection and configuration, such as hero actions, pricing cards, feature rows, stats, or timeline items. This is usually more editor-friendly than modeling those items as plain `array` / `object` fields because each local block can be selected and configured on its own in the visual editor. Keep ordinary section props in `fields`; `fields` is optional and does not need to list every prop.
|
|
52
|
+
|
|
53
|
+
- Type the slot prop as Puck `Slot` and declare `blockSlots` with the same prop key. Non-slot props should stay in `fields` or nested `array` / `object` fields.
|
|
54
|
+
- Define local block kinds under `blockSlots.<slotName>.blocks`. Local blocks support normal Suda fields, `label`, `defaultProps`, `render`, `metadata`, `inline`, `permissions`, and optional `ai`.
|
|
55
|
+
- Do not add nested `blockSlots` or `cms` to local blocks. Block slots are one level deep in the theme authoring API.
|
|
56
|
+
- Do not put the slot prop in the host component's `defaultProps`; use `defaultBlocks` on the slot instead.
|
|
57
|
+
- Do not hand-write `id` in local block `defaultProps`, `defaultBlocks[].props`, or starter page nested block props. The editor/runtime owns block ids.
|
|
58
|
+
|
|
59
|
+
Example:
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import type { Slot } from "@puckeditor/core";
|
|
63
|
+
import type { SudaComponentConfig } from "@sudajs/theme-engine";
|
|
64
|
+
|
|
65
|
+
type HeroProps = {
|
|
66
|
+
title?: string;
|
|
67
|
+
actions?: Slot;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const Hero: SudaComponentConfig<HeroProps> = {
|
|
71
|
+
label: "Hero",
|
|
72
|
+
ai: {
|
|
73
|
+
instructions: "Primary page introduction with editable call-to-action blocks.",
|
|
74
|
+
},
|
|
75
|
+
fields: {
|
|
76
|
+
title: { type: "text", label: "Title" },
|
|
77
|
+
},
|
|
78
|
+
blockSlots: {
|
|
79
|
+
actions: {
|
|
80
|
+
label: "Actions",
|
|
81
|
+
blocks: {
|
|
82
|
+
button: {
|
|
83
|
+
label: "Button",
|
|
84
|
+
fields: {
|
|
85
|
+
label: { type: "text", label: "Label" },
|
|
86
|
+
href: { type: "url", label: "Link" },
|
|
87
|
+
},
|
|
88
|
+
defaultProps: {
|
|
89
|
+
label: "Get started",
|
|
90
|
+
href: "/contact",
|
|
91
|
+
},
|
|
92
|
+
render: ({ label, href }) => <a href={href}>{label}</a>,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
defaultBlocks: [{ kind: "button" }],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
defaultProps: {
|
|
99
|
+
title: "Build with SudaCloud",
|
|
100
|
+
},
|
|
101
|
+
render: ({ title, actions: Actions }) => (
|
|
102
|
+
<section>
|
|
103
|
+
<h1>{title}</h1>
|
|
104
|
+
<Actions />
|
|
105
|
+
</section>
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Starter page data should use the public host component type and a standard slot array on the slot prop. Use local block `kind` values as nested `type` values.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
{
|
|
114
|
+
type: "Hero",
|
|
115
|
+
props: {
|
|
116
|
+
id: "Hero-1",
|
|
117
|
+
title: "Welcome",
|
|
118
|
+
actions: [
|
|
119
|
+
{
|
|
120
|
+
type: "button",
|
|
121
|
+
props: {
|
|
122
|
+
label: "Contact us",
|
|
123
|
+
href: "/contact",
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
```
|