Skip to content

Commit dba6fe3

Browse files
committed
Merge branch 'main' into svelte-renderer
2 parents e7d7b7b + b6f12d4 commit dba6fe3

File tree

156 files changed

+12655
-345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+12655
-345
lines changed

.changeset/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[
77
"@json-render/core",
88
"@json-render/react",
9+
"@json-render/react-email",
910
"@json-render/react-pdf",
1011
"@json-render/shadcn",
1112
"@json-render/react-native",
@@ -15,7 +16,8 @@
1516
"@json-render/redux",
1617
"@json-render/jotai",
1718
"@json-render/vue",
18-
"@json-render/xstate"
19+
"@json-render/xstate",
20+
"@json-render/image"
1921
]
2022
],
2123
"linked": [],

AGENTS.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This ensures we don't install outdated versions that may have incompatible types
2626

2727
- Do not use emojis in code or UI
2828
- Use shadcn CLI to add shadcn/ui components: `pnpm dlx shadcn@latest add <component>`
29+
- **Web app docs (`apps/web/`):** Never use Markdown table syntax (`| col | col |`). Always use HTML `<table>` with `<thead>`, `<tbody>`, `<tr>`, `<th>`, `<td>`. Markdown tables do not render correctly in the web app. Inside HTML table cells, curly braces must be escaped as JSX expressions (e.g. `<code>{'{ "$state": "/path" }'}</code>`) because MDX parses `{` as a JSX expression boundary.
2930

3031
## AI SDK / AI Gateway
3132

@@ -72,6 +73,41 @@ Do **not** add `--port` flags -- portless handles port assignment automatically.
7273
- Skills in `skills/*/SKILL.md` (if the package has a corresponding skill)
7374
- `AGENTS.md` (if workflow or conventions change)
7475

76+
## Releases
77+
78+
This monorepo uses [Changesets](https://github.com/changesets/changesets) for versioning and publishing.
79+
80+
### Fixed version group
81+
82+
All public `@json-render/*` packages are in a **fixed** group (see `.changeset/config.json`). A changeset that bumps any one of them bumps all of them to the same version. You only need to list the packages that actually changed in the changeset front matter — the fixed group handles the rest.
83+
84+
### Preparing a release
85+
86+
When asked to prepare a release (e.g. "prepare v0.12.0"):
87+
88+
1. **Create a changeset file** at `.changeset/v0-<N>-release.md` following the existing pattern:
89+
- YAML front matter listing changed packages with bump type (`minor` for feature releases, `patch` for bug-fix-only releases)
90+
- A one-line summary, then `### New:` / `### Improved:` / `### Fixed:` sections describing each change
91+
- Always list `@json-render/core` plus any packages with actual code changes
92+
2. **Do NOT bump versions** in `package.json` files — CI runs `pnpm ci:version` (which calls `changeset version`) to do that automatically
93+
3. **Do NOT manually write `CHANGELOG.md`** entries — `changeset version` generates them from the changeset file
94+
4. **Add new packages to the fixed group** in `.changeset/config.json` if they should be versioned together with the rest
95+
5. **Fill documentation gaps** — every public package should have:
96+
- A row in the root `README.md` packages table
97+
- A renderer section in the root `README.md` (if it's a renderer)
98+
- An API reference page at `apps/web/app/(main)/docs/api/<name>/page.mdx`
99+
- An entry in `apps/web/lib/page-titles.ts` and `apps/web/lib/docs-navigation.ts`
100+
- An entry in the docs-chat system prompt (`apps/web/app/api/docs-chat/route.ts`)
101+
- A skill at `skills/json-render-<name>/SKILL.md`
102+
- A `packages/<name>/README.md`
103+
6. **Run `pnpm type-check`** after all changes to verify nothing is broken
104+
105+
### CI scripts
106+
107+
- `pnpm changeset` — interactively create a new changeset
108+
- `pnpm ci:version` — run `changeset version` + lockfile update (CI only)
109+
- `pnpm ci:publish` — build all packages and publish to npm (CI only)
110+
75111
<!-- opensrc:start -->
76112

77113
## Source Code Reference

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ npm install @json-render/core @json-render/react-native
1515
npm install @json-render/core @json-render/remotion
1616
# or for PDF documents
1717
npm install @json-render/core @json-render/react-pdf
18+
# or for HTML email
19+
npm install @json-render/core @json-render/react-email @react-email/components @react-email/render
1820
# or for Vue
1921
npm install @json-render/core @json-render/vue
2022
```
@@ -118,6 +120,8 @@ function Dashboard({ spec }) {
118120
| `@json-render/react-native` | React Native renderer with standard mobile components |
119121
| `@json-render/remotion` | Remotion video renderer, timeline schema |
120122
| `@json-render/react-pdf` | React PDF renderer for generating PDF documents from specs |
123+
| `@json-render/react-email` | React Email renderer for HTML/plain-text emails from specs |
124+
| `@json-render/image` | Image renderer for SVG/PNG output (OG images, social cards) via Satori |
121125
| `@json-render/redux` | Redux / Redux Toolkit adapter for `StateStore` |
122126
| `@json-render/zustand` | Zustand adapter for `StateStore` |
123127
| `@json-render/jotai` | Jotai adapter for `StateStore` |
@@ -287,6 +291,69 @@ const spec = {
287291
const buffer = await renderToBuffer(spec);
288292
```
289293

294+
### React Email (Email)
295+
296+
```typescript
297+
import { renderToHtml } from "@json-render/react-email";
298+
import { schema, standardComponentDefinitions } from "@json-render/react-email";
299+
import { defineCatalog } from "@json-render/core";
300+
301+
const catalog = defineCatalog(schema, {
302+
components: standardComponentDefinitions,
303+
});
304+
305+
const spec = {
306+
root: "html-1",
307+
elements: {
308+
"html-1": { type: "Html", props: { lang: "en", dir: "ltr" }, children: ["head-1", "body-1"] },
309+
"head-1": { type: "Head", props: {}, children: [] },
310+
"body-1": {
311+
type: "Body",
312+
props: { style: { backgroundColor: "#f6f9fc" } },
313+
children: ["container-1"],
314+
},
315+
"container-1": {
316+
type: "Container",
317+
props: { style: { maxWidth: "600px", margin: "0 auto", padding: "20px" } },
318+
children: ["heading-1", "text-1"],
319+
},
320+
"heading-1": { type: "Heading", props: { text: "Welcome" }, children: [] },
321+
"text-1": { type: "Text", props: { text: "Thanks for signing up." }, children: [] },
322+
},
323+
};
324+
325+
const html = await renderToHtml(spec);
326+
```
327+
328+
### Image (SVG/PNG)
329+
330+
```typescript
331+
import { renderToPng } from "@json-render/image/render";
332+
333+
const spec = {
334+
root: "frame",
335+
elements: {
336+
frame: {
337+
type: "Frame",
338+
props: { width: 1200, height: 630, backgroundColor: "#1a1a2e" },
339+
children: ["heading"],
340+
},
341+
heading: {
342+
type: "Heading",
343+
props: { text: "Hello World", level: "h1", color: "#ffffff" },
344+
children: [],
345+
},
346+
},
347+
};
348+
349+
// Render to PNG (requires @resvg/resvg-js)
350+
const png = await renderToPng(spec, { fonts });
351+
352+
// Or render to SVG string
353+
import { renderToSvg } from "@json-render/image/render";
354+
const svg = await renderToSvg(spec, { fonts });
355+
```
356+
290357
## Features
291358

292359
### Streaming (SpecStream)
@@ -392,6 +459,7 @@ pnpm dev
392459

393460
- http://json-render.localhost:1355 - Docs & Playground
394461
- http://dashboard-demo.json-render.localhost:1355 - Example Dashboard
462+
- http://react-email-demo.json-render.localhost:1355 - React Email Example
395463
- http://remotion-demo.json-render.localhost:1355 - Remotion Video Example
396464
- Chat Example: run `pnpm dev` in `examples/chat`
397465
- Svelte Example: run `pnpm dev` in `examples/svelte` or `examples/svelte-chat`

apps/web/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# web
22

3+
## 0.1.4
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [3f1e71e]
8+
- @json-render/core@0.11.0
9+
- @json-render/codegen@0.11.0
10+
- @json-render/react@0.11.0
11+
312
## 0.1.3
413

514
### Patch Changes

0 commit comments

Comments
 (0)