@nersh/render 0.2.2 → 0.2.3

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/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # @nersh/render
2
+
3
+ Framework-agnostic renderer for nertia composition sites. Reads a `site.json` recipe, applies a skin, and renders the layout.
4
+
5
+ Used internally by projects scaffolded with `npm create nersh@latest`.
6
+
7
+ ---
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @nersh/render
13
+ ```
14
+
15
+ ### Peer dependencies
16
+
17
+ Your project needs these installed alongside `@nersh/render`:
18
+
19
+ ```bash
20
+ npm install react react-dom next lucide-react motion recharts class-variance-authority cobe zod @base-ui/react @calcom/embed-react
21
+ ```
22
+
23
+ Projects created with `create-nersh` include all of these automatically.
24
+
25
+ ---
26
+
27
+ ## Usage
28
+
29
+ ```tsx
30
+ "use client";
31
+
32
+ import { SiteRenderer } from "@nersh/render";
33
+ import { registry } from "@/registry";
34
+ import siteJson from "../site.json";
35
+
36
+ const site = siteJson as any;
37
+
38
+ export default function Home() {
39
+ return <SiteRenderer site={site} registry={registry} />;
40
+ }
41
+ ```
42
+
43
+ ### `site.json` shape
44
+
45
+ ```json
46
+ {
47
+ "slug": "my-site",
48
+ "mode": "easy",
49
+ "status": "published",
50
+ "skinId": "zinc",
51
+ "composition": {
52
+ "id": "marketing",
53
+ "sections": [
54
+ { "id": "navbar", "instanceId": "nav-1" },
55
+ { "id": "marketing-hero", "instanceId": "hero-1" }
56
+ ]
57
+ },
58
+ "copy": {
59
+ "hero-1.headline": "\"Your headline\"",
60
+ "hero-1.sub": "\"Supporting copy\""
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### Registry
66
+
67
+ The registry maps section IDs to React components. `create-nersh` generates this automatically:
68
+
69
+ ```ts
70
+ // src/registry.ts
71
+ import { NavbarSection } from "./sections/navbar";
72
+ import { MarketingHeroSection } from "./sections/marketing-hero";
73
+
74
+ export const registry = {
75
+ navbar: NavbarSection,
76
+ "marketing-hero": MarketingHeroSection,
77
+ };
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Tailwind v4 setup
83
+
84
+ `@nersh/render` uses Tailwind utility classes internally. Add a `@source` directive to your `globals.css` so Tailwind v4 scans the package:
85
+
86
+ ```css
87
+ @import "tailwindcss";
88
+ @source "../node_modules/@nersh/render/dist";
89
+ ```
90
+
91
+ Without this, styles from the render package will not appear.
92
+
93
+ ---
94
+
95
+ ## `SiteRenderer` props
96
+
97
+ | Prop | Type | Description |
98
+ |------|------|-------------|
99
+ | `site` | `CompositionSite` | The parsed `site.json` |
100
+ | `registry` | `Record<string, ComponentType>` | Maps section IDs to components |
101
+
102
+ ---
103
+
104
+ ## Available skins
105
+
106
+ `zinc` · `slate` · `stone` · `rose` · `coral` · `indigo` · `ocean` · `forest` · `gold` · `amber` · `purple` · `violet` · `graphite` · `midnight`
107
+
108
+ Set via `skinId` in `site.json`.
109
+
110
+ ---
111
+
112
+ ## Related
113
+
114
+ - [`create-nersh`](https://www.npmjs.com/package/create-nersh) — scaffold a full site with `npm create nersh@latest`
115
+ - [nertia.ai](https://nertia.ai) — browser-based builder that writes the same `site.json` format
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nersh/render",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Framework-agnostic renderer for nertia composition sites",
5
5
  "license": "MIT",
6
6
  "author": "nersh <ps2pdx@gmail.com>",