@sudajs/cli 0.12.4 → 0.13.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudajs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
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": "5.
|
|
37
|
+
"@sudajs/theme-engine": "5.1.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@tailwindcss/postcss": "^4.3.0",
|
|
@@ -288,6 +288,32 @@ or AI examples.
|
|
|
288
288
|
- React, React DOM, Puck, and `@sudajs/theme-engine` are host-provided peers. Do not bundle private copies into the theme runtime.
|
|
289
289
|
- Keep persisted props JSON-serializable. Do not store functions, React nodes, class instances, database ids for media, or environment-specific absolute filesystem paths.
|
|
290
290
|
|
|
291
|
+
## Puck editor CSS isolation
|
|
292
|
+
|
|
293
|
+
Puck renders the editable preview in a same-origin iframe. The outer
|
|
294
|
+
`#puck-canvas-root` and `#preview-frame` may be only one viewport tall; the
|
|
295
|
+
full page must scroll inside the iframe. Theme CSS must not collapse or disable
|
|
296
|
+
that iframe document.
|
|
297
|
+
|
|
298
|
+
- In editor mode, make the theme root content-height driven. A root marker such
|
|
299
|
+
as `[data-suda-editor="true"]` should use `height: auto`,
|
|
300
|
+
`min-height: 100vh`, and `overflow: visible` unless the theme has a stronger
|
|
301
|
+
reason not to.
|
|
302
|
+
- If the theme root is rendered inside Puck's `#frame-root`, ensure
|
|
303
|
+
`#frame-root` can grow with content in editor mode. Do not leave it stuck at
|
|
304
|
+
a collapsed height when it contains the theme root.
|
|
305
|
+
- Root `[data-puck-dropzone]` wrappers must be able to grow with page content.
|
|
306
|
+
Avoid forcing `height: 100%` on the root DropZone when that turns the page
|
|
307
|
+
into a single viewport-height box.
|
|
308
|
+
- Keep public-site resets from leaking into Puck behavior. Be very careful with
|
|
309
|
+
global `html`, `body`, `iframe`, `.hidden`, `img`, `button`, `input`, and
|
|
310
|
+
Tailwind preflight rules; they can hide editor wrappers, change intrinsic
|
|
311
|
+
media sizing, or break iframe scrolling.
|
|
312
|
+
- When importing third-party CSS, add editor-scoped overrides under the theme
|
|
313
|
+
root marker instead of changing public runtime behavior globally.
|
|
314
|
+
- Verify the editor canvas by scrolling through every starter page. Components
|
|
315
|
+
must be visible and reachable without selecting them from the outline first.
|
|
316
|
+
|
|
291
317
|
## CMS and starter templates
|
|
292
318
|
|
|
293
319
|
Suda CMS is a built-in fixed post system. Themes must provide exactly these
|
|
@@ -367,6 +393,12 @@ platform. In the section render function, call
|
|
|
367
393
|
with the exact posts field key. Never import Prisma, call platform APIs, or
|
|
368
394
|
query the database from theme code.
|
|
369
395
|
|
|
396
|
+
When rendering posts returned by `getPostResource`, build links from the
|
|
397
|
+
platform-provided `post.url` first. If it is missing, derive the URL only from
|
|
398
|
+
`post.slug` as `/posts/${encodeURIComponent(post.slug)}`; if neither exists,
|
|
399
|
+
use `#`. Do not guess alternate fields such as `href`, `path`, `permalink`,
|
|
400
|
+
`postUrl`, or `canonicalUrl`.
|
|
401
|
+
|
|
370
402
|
Do not add `resourceQuery: { type: "posts" }` or
|
|
371
403
|
`resource_query: { type: "posts" }`. Do not assume the field must be named
|
|
372
404
|
`query`. A section may have only one top-level posts field; do not nest posts
|
|
@@ -520,7 +552,8 @@ radius, shadows, or spacing.
|
|
|
520
552
|
|
|
521
553
|
- Tailwind v4 starts in `src/styles.css` with `@import "tailwindcss";` and `@source "./**/*.{ts,tsx}";`.
|
|
522
554
|
- Theme-local assets live in top-level `assets/`; the CLI copies them to `dist/assets/` during build.
|
|
523
|
-
-
|
|
555
|
+
- Import `themeAsset` from `./theme-asset.js` and use `themeAsset("assets/...")` for every theme-bundled asset in default props, starter pages, CMS templates, and AI examples.
|
|
556
|
+
- Do not hand-write `themes/<themeKey>/<version>/...` paths and do not import theme-local images from React code. Full external URLs are allowed, for example CDN URLs such as jsDelivr.
|
|
524
557
|
- Use `resolveAsset(puck?.metadata, value)` from `@sudajs/theme-engine/runtime` before rendering user-selected media fields.
|
|
525
558
|
- Scope theme CSS with the generated theme key classes. Avoid global resets that could affect the host editor or other themes.
|
|
526
559
|
- Preview screenshots are required at `assets/preview/desktop.png`, `assets/preview/tablet.png`, and `assets/preview/mobile.png`; run `suda theme capture` to generate them.
|
|
@@ -588,7 +621,7 @@ Good component instructions explain:
|
|
|
588
621
|
- Frequency: whether it should appear once, multiple times, or only near another section.
|
|
589
622
|
- Composition: required neighboring content or local blocks, when relevant.
|
|
590
623
|
|
|
591
|
-
- For icons, expose props with `{ type: "icon" }`, type values as `SudaLucideIconName`, render them with `SudaLucideIcon` from `@sudajs/theme-engine/
|
|
624
|
+
- For icons, expose props with `{ type: "icon" }`, type values as `SudaLucideIconName`, render them with `SudaLucideIcon` from `@sudajs/theme-engine/icons`, and store canonical Lucide names such as `"rocket"` or `"mouse-pointer-click"` (not `"lucide-rocket"`). Do not keep theme-local icon maps, emoji/icon switch statements, or custom SVG icon registries unless the theme truly needs a bespoke non-Lucide graphic.
|
|
592
625
|
- Add optional field-level `ai.instructions`, `ai.required`, or `ai.exclude` when a prop needs generation guidance beyond its label and type.
|
|
593
626
|
- Use `ai.exclude: true` only for structural or editor-only components, and still provide instructions explaining why AI must not generate them. `PageOutlet` is the standard example.
|
|
594
627
|
|
|
@@ -698,7 +731,7 @@ Starter page data should use the public host component type and a standard array
|
|
|
698
731
|
- Do not put local block `id` values in starter pages. Only top-level page components need `props.id`.
|
|
699
732
|
- Where practical, wrap authored data with `defineSudaPageData(pageConfig, data)` so TypeScript checks top-level component keys and block-slot nested `type` values.
|
|
700
733
|
- Match starter page content to the theme's intended audience and category. The home page should show the theme's best composition, not just every component in order.
|
|
701
|
-
- Use `themeAsset("assets/...")` for bundled starter media.
|
|
734
|
+
- Use `themeAsset("assets/...")` for bundled starter media; never hand-write generated theme asset paths.
|
|
702
735
|
|
|
703
736
|
## Commands
|
|
704
737
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { SudaComponentConfig
|
|
1
|
+
import type { SudaComponentConfig } from "@sudajs/theme-engine";
|
|
2
|
+
import {
|
|
3
|
+
SudaLucideIcon,
|
|
4
|
+
type SudaLucideIconName,
|
|
5
|
+
} from "@sudajs/theme-engine/icons";
|
|
2
6
|
import {
|
|
3
7
|
getPostResource,
|
|
4
8
|
resolveAsset,
|
|
5
|
-
SudaLucideIcon,
|
|
6
9
|
type ThemePostResourceQuery,
|
|
7
10
|
type ThemeRenderMetadata,
|
|
8
11
|
} from "@sudajs/theme-engine/runtime";
|
|
@@ -245,6 +248,8 @@ export const FeaturedPosts: SudaComponentConfig<FeaturedPostsProps> = {
|
|
|
245
248
|
fieldKey: "postList",
|
|
246
249
|
});
|
|
247
250
|
const posts = resource.posts;
|
|
251
|
+
const postHref = (post: (typeof posts)[number]) =>
|
|
252
|
+
post.url || (post.slug ? `/posts/${encodeURIComponent(post.slug)}` : "#");
|
|
248
253
|
return (
|
|
249
254
|
<section className="__SUDA_THEME_KEY__-section">
|
|
250
255
|
<h2>{title}</h2>
|
|
@@ -258,7 +263,7 @@ export const FeaturedPosts: SudaComponentConfig<FeaturedPostsProps> = {
|
|
|
258
263
|
</p>
|
|
259
264
|
<h3>{post.title}</h3>
|
|
260
265
|
<p>{post.excerpt}</p>
|
|
261
|
-
<a href={post
|
|
266
|
+
<a href={postHref(post)}>{post.title}</a>
|
|
262
267
|
</article>
|
|
263
268
|
))
|
|
264
269
|
) : (
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createThemeAsset } from "@sudajs/theme-engine/runtime";
|
|
2
2
|
|
|
3
3
|
import { sourceManifest } from "./manifest.js";
|
|
4
4
|
|
|
5
|
-
export const themeAsset =
|
|
5
|
+
export const themeAsset = createThemeAsset({
|
|
6
|
+
...sourceManifest,
|
|
7
|
+
version: __SUDA_THEME_VERSION__,
|
|
8
|
+
});
|