@json-render/react-email 0.8.0
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/LICENSE +201 -0
- package/README.md +147 -0
- package/dist/catalog-types-Dh9gul8V.d.mts +17 -0
- package/dist/catalog-types-Dh9gul8V.d.ts +17 -0
- package/dist/catalog.d.mts +216 -0
- package/dist/catalog.d.ts +216 -0
- package/dist/catalog.js +203 -0
- package/dist/catalog.js.map +1 -0
- package/dist/catalog.mjs +7 -0
- package/dist/catalog.mjs.map +1 -0
- package/dist/chunk-3YN5NZJ7.mjs +44 -0
- package/dist/chunk-3YN5NZJ7.mjs.map +1 -0
- package/dist/chunk-GXJW4OIL.mjs +179 -0
- package/dist/chunk-GXJW4OIL.mjs.map +1 -0
- package/dist/chunk-MPWIHNXF.mjs +253 -0
- package/dist/chunk-MPWIHNXF.mjs.map +1 -0
- package/dist/index.d.mts +114 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.js +1298 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +847 -0
- package/dist/index.mjs.map +1 -0
- package/dist/render-DFHuQRW0.d.ts +80 -0
- package/dist/render-kNHi7tZ2.d.mts +80 -0
- package/dist/render.d.mts +5 -0
- package/dist/render.d.ts +5 -0
- package/dist/render.js +259 -0
- package/dist/render.js.map +1 -0
- package/dist/render.mjs +11 -0
- package/dist/render.mjs.map +1 -0
- package/dist/server.d.mts +43 -0
- package/dist/server.d.ts +43 -0
- package/dist/server.js +247 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +11 -0
- package/dist/server.mjs.map +1 -0
- package/package.json +78 -0
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as _json_render_core from '@json-render/core';
|
|
2
|
+
export { Spec, StateModel } from '@json-render/core';
|
|
3
|
+
export { StandardComponentDefinitions, StandardComponentProps, standardComponentDefinitions } from './catalog.js';
|
|
4
|
+
export { a as ComponentContext, b as ComponentFn, C as Components, S as SetState } from './catalog-types-Dh9gul8V.js';
|
|
5
|
+
import 'zod';
|
|
6
|
+
import 'react';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The schema for @json-render/react-email
|
|
10
|
+
*
|
|
11
|
+
* Defines:
|
|
12
|
+
* - Spec: A flat tree of elements with keys, types, props, and children references
|
|
13
|
+
* - Catalog: Components with props schemas
|
|
14
|
+
*
|
|
15
|
+
* Reuses the same { root, elements } spec format as the React and React Native renderers.
|
|
16
|
+
*/
|
|
17
|
+
declare const schema: _json_render_core.Schema<{
|
|
18
|
+
spec: _json_render_core.SchemaType<"object", {
|
|
19
|
+
root: _json_render_core.SchemaType<"string", unknown>;
|
|
20
|
+
elements: _json_render_core.SchemaType<"record", _json_render_core.SchemaType<"object", {
|
|
21
|
+
type: _json_render_core.SchemaType<"ref", string>;
|
|
22
|
+
props: _json_render_core.SchemaType<"propsOf", string>;
|
|
23
|
+
children: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>>;
|
|
24
|
+
visible: _json_render_core.SchemaType<"any", unknown>;
|
|
25
|
+
}>>;
|
|
26
|
+
}>;
|
|
27
|
+
catalog: _json_render_core.SchemaType<"object", {
|
|
28
|
+
components: _json_render_core.SchemaType<"map", {
|
|
29
|
+
props: _json_render_core.SchemaType<"zod", unknown>;
|
|
30
|
+
slots: _json_render_core.SchemaType<"array", _json_render_core.SchemaType<"string", unknown>>;
|
|
31
|
+
description: _json_render_core.SchemaType<"string", unknown>;
|
|
32
|
+
example: _json_render_core.SchemaType<"any", unknown>;
|
|
33
|
+
}>;
|
|
34
|
+
}>;
|
|
35
|
+
}>;
|
|
36
|
+
type ReactEmailSchema = typeof schema;
|
|
37
|
+
type ReactEmailSpec<TCatalog> = typeof schema extends {
|
|
38
|
+
createCatalog: (catalog: TCatalog) => {
|
|
39
|
+
_specType: infer S;
|
|
40
|
+
};
|
|
41
|
+
} ? S : never;
|
|
42
|
+
|
|
43
|
+
export { type ReactEmailSchema, type ReactEmailSpec, schema };
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/server.ts
|
|
21
|
+
var server_exports = {};
|
|
22
|
+
__export(server_exports, {
|
|
23
|
+
schema: () => schema,
|
|
24
|
+
standardComponentDefinitions: () => standardComponentDefinitions
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(server_exports);
|
|
27
|
+
|
|
28
|
+
// src/schema.ts
|
|
29
|
+
var import_core = require("@json-render/core");
|
|
30
|
+
var schema = (0, import_core.defineSchema)(
|
|
31
|
+
(s) => ({
|
|
32
|
+
spec: s.object({
|
|
33
|
+
root: s.string(),
|
|
34
|
+
elements: s.record(
|
|
35
|
+
s.object({
|
|
36
|
+
type: s.ref("catalog.components"),
|
|
37
|
+
props: s.propsOf("catalog.components"),
|
|
38
|
+
children: s.array(s.string()),
|
|
39
|
+
visible: s.any()
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
}),
|
|
43
|
+
catalog: s.object({
|
|
44
|
+
components: s.map({
|
|
45
|
+
props: s.zod(),
|
|
46
|
+
slots: s.array(s.string()),
|
|
47
|
+
description: s.string(),
|
|
48
|
+
example: s.any()
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
{
|
|
53
|
+
defaultRules: [
|
|
54
|
+
"The root element MUST be an Html component. Its children MUST include Head and Body components.",
|
|
55
|
+
"Body should contain a Container component to constrain width (typically 600px max for email clients).",
|
|
56
|
+
"All styles MUST be inline. Email clients strip <style> tags, so every component that accepts a style prop should use it for visual customization.",
|
|
57
|
+
"Image src must be a fully qualified URL (absolute, not relative). For placeholder images use https://picsum.photos/{width}/{height}?random={n}.",
|
|
58
|
+
"Emails are static documents. There are no interactive actions or form inputs.",
|
|
59
|
+
"Use Section, Row, and Column for layout. These map to table-based email structures for maximum compatibility.",
|
|
60
|
+
"Use Preview to set the preview text shown in email client inboxes before opening.",
|
|
61
|
+
"Use Heading (h1-h6) and Text for all text content. Raw strings are not supported.",
|
|
62
|
+
"Button renders as a link styled as a button. Always provide both text and href.",
|
|
63
|
+
"CRITICAL INTEGRITY CHECK: Before outputting ANY element that references children, you MUST have already output (or will output) each child as its own element. If an element has children: ['a', 'b'], then elements 'a' and 'b' MUST exist."
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// src/catalog.ts
|
|
69
|
+
var import_zod = require("zod");
|
|
70
|
+
var styleSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.any()).nullable();
|
|
71
|
+
var standardComponentDefinitions = {
|
|
72
|
+
// ==========================================================================
|
|
73
|
+
// Document Structure
|
|
74
|
+
// ==========================================================================
|
|
75
|
+
Html: {
|
|
76
|
+
props: import_zod.z.object({
|
|
77
|
+
lang: import_zod.z.string().nullable(),
|
|
78
|
+
dir: import_zod.z.enum(["ltr", "rtl"]).nullable()
|
|
79
|
+
}),
|
|
80
|
+
slots: ["default"],
|
|
81
|
+
description: "Top-level HTML email wrapper. Must be the root element. Children should include Head and Body.",
|
|
82
|
+
example: { lang: "en", dir: "ltr" }
|
|
83
|
+
},
|
|
84
|
+
Head: {
|
|
85
|
+
props: import_zod.z.object({}),
|
|
86
|
+
slots: ["default"],
|
|
87
|
+
description: "Email head section. Place inside Html. Can contain metadata but typically left empty.",
|
|
88
|
+
example: {}
|
|
89
|
+
},
|
|
90
|
+
Body: {
|
|
91
|
+
props: import_zod.z.object({
|
|
92
|
+
style: styleSchema
|
|
93
|
+
}),
|
|
94
|
+
slots: ["default"],
|
|
95
|
+
description: "Email body wrapper. Place inside Html after Head. Contains all visible email content.",
|
|
96
|
+
example: { style: { backgroundColor: "#f6f9fc" } }
|
|
97
|
+
},
|
|
98
|
+
Container: {
|
|
99
|
+
props: import_zod.z.object({
|
|
100
|
+
style: styleSchema
|
|
101
|
+
}),
|
|
102
|
+
slots: ["default"],
|
|
103
|
+
description: "Constrains content width for email clients. Place inside Body. Typically max-width 600px.",
|
|
104
|
+
example: {
|
|
105
|
+
style: {
|
|
106
|
+
maxWidth: "600px",
|
|
107
|
+
margin: "0 auto",
|
|
108
|
+
padding: "20px 0 48px"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
Section: {
|
|
113
|
+
props: import_zod.z.object({
|
|
114
|
+
style: styleSchema
|
|
115
|
+
}),
|
|
116
|
+
slots: ["default"],
|
|
117
|
+
description: "Groups related content. Renders as a table-based section for email compatibility.",
|
|
118
|
+
example: { style: { padding: "24px", backgroundColor: "#ffffff" } }
|
|
119
|
+
},
|
|
120
|
+
Row: {
|
|
121
|
+
props: import_zod.z.object({
|
|
122
|
+
style: styleSchema
|
|
123
|
+
}),
|
|
124
|
+
slots: ["default"],
|
|
125
|
+
description: "Horizontal layout row. Use inside Section for multi-column layouts.",
|
|
126
|
+
example: { style: {} }
|
|
127
|
+
},
|
|
128
|
+
Column: {
|
|
129
|
+
props: import_zod.z.object({
|
|
130
|
+
style: styleSchema
|
|
131
|
+
}),
|
|
132
|
+
slots: ["default"],
|
|
133
|
+
description: "Column within a Row. Set width via style for proportional layouts.",
|
|
134
|
+
example: { style: { width: "50%" } }
|
|
135
|
+
},
|
|
136
|
+
// ==========================================================================
|
|
137
|
+
// Content Components
|
|
138
|
+
// ==========================================================================
|
|
139
|
+
Heading: {
|
|
140
|
+
props: import_zod.z.object({
|
|
141
|
+
text: import_zod.z.string(),
|
|
142
|
+
as: import_zod.z.enum(["h1", "h2", "h3", "h4", "h5", "h6"]).nullable(),
|
|
143
|
+
style: styleSchema
|
|
144
|
+
}),
|
|
145
|
+
slots: [],
|
|
146
|
+
description: "Heading text at various levels. h1 is largest, h6 is smallest.",
|
|
147
|
+
example: { text: "Welcome!", as: "h1" }
|
|
148
|
+
},
|
|
149
|
+
Text: {
|
|
150
|
+
props: import_zod.z.object({
|
|
151
|
+
text: import_zod.z.string(),
|
|
152
|
+
style: styleSchema
|
|
153
|
+
}),
|
|
154
|
+
slots: [],
|
|
155
|
+
description: "Body text paragraph. Use style for font size, color, weight, and alignment.",
|
|
156
|
+
example: { text: "Thank you for signing up." }
|
|
157
|
+
},
|
|
158
|
+
Link: {
|
|
159
|
+
props: import_zod.z.object({
|
|
160
|
+
text: import_zod.z.string(),
|
|
161
|
+
href: import_zod.z.string(),
|
|
162
|
+
style: styleSchema
|
|
163
|
+
}),
|
|
164
|
+
slots: [],
|
|
165
|
+
description: "Hyperlink with visible text and a URL.",
|
|
166
|
+
example: {
|
|
167
|
+
text: "Visit our website",
|
|
168
|
+
href: "https://example.com",
|
|
169
|
+
style: { color: "#2563eb" }
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
Button: {
|
|
173
|
+
props: import_zod.z.object({
|
|
174
|
+
text: import_zod.z.string(),
|
|
175
|
+
href: import_zod.z.string(),
|
|
176
|
+
style: styleSchema
|
|
177
|
+
}),
|
|
178
|
+
slots: [],
|
|
179
|
+
description: "Call-to-action button rendered as a link styled as a button. Provide text and href.",
|
|
180
|
+
example: {
|
|
181
|
+
text: "Get Started",
|
|
182
|
+
href: "https://example.com",
|
|
183
|
+
style: {
|
|
184
|
+
backgroundColor: "#5F51E8",
|
|
185
|
+
borderRadius: "3px",
|
|
186
|
+
color: "#fff",
|
|
187
|
+
padding: "12px 20px"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
Image: {
|
|
192
|
+
props: import_zod.z.object({
|
|
193
|
+
src: import_zod.z.string(),
|
|
194
|
+
alt: import_zod.z.string().nullable(),
|
|
195
|
+
width: import_zod.z.number().nullable(),
|
|
196
|
+
height: import_zod.z.number().nullable(),
|
|
197
|
+
style: styleSchema
|
|
198
|
+
}),
|
|
199
|
+
slots: [],
|
|
200
|
+
description: "Image from a URL. src must be a fully qualified URL. Specify width and height for consistent rendering.",
|
|
201
|
+
example: {
|
|
202
|
+
src: "https://picsum.photos/400/200?random=1",
|
|
203
|
+
alt: "Hero image",
|
|
204
|
+
width: 400,
|
|
205
|
+
height: 200
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
Hr: {
|
|
209
|
+
props: import_zod.z.object({
|
|
210
|
+
style: styleSchema
|
|
211
|
+
}),
|
|
212
|
+
slots: [],
|
|
213
|
+
description: "Horizontal rule separator between content sections.",
|
|
214
|
+
example: {
|
|
215
|
+
style: { borderColor: "#e6ebf1", margin: "20px 0" }
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
// ==========================================================================
|
|
219
|
+
// Utility Components
|
|
220
|
+
// ==========================================================================
|
|
221
|
+
Preview: {
|
|
222
|
+
props: import_zod.z.object({
|
|
223
|
+
text: import_zod.z.string()
|
|
224
|
+
}),
|
|
225
|
+
slots: [],
|
|
226
|
+
description: "Preview text shown in email client inboxes before the email is opened. Place inside Html.",
|
|
227
|
+
example: { text: "You have a new message from Acme Corp" }
|
|
228
|
+
},
|
|
229
|
+
Markdown: {
|
|
230
|
+
props: import_zod.z.object({
|
|
231
|
+
content: import_zod.z.string(),
|
|
232
|
+
markdownContainerStyles: styleSchema,
|
|
233
|
+
markdownCustomStyles: import_zod.z.record(import_zod.z.string(), import_zod.z.any()).nullable()
|
|
234
|
+
}),
|
|
235
|
+
slots: [],
|
|
236
|
+
description: "Renders markdown content as email-safe HTML. Supports headings, paragraphs, lists, links, bold, italic, and code.",
|
|
237
|
+
example: {
|
|
238
|
+
content: "# Hello\n\nThis is **bold** and *italic* text."
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
243
|
+
0 && (module.exports = {
|
|
244
|
+
schema,
|
|
245
|
+
standardComponentDefinitions
|
|
246
|
+
});
|
|
247
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts","../src/schema.ts","../src/catalog.ts"],"sourcesContent":["// Server-safe entry point: schema and catalog definitions only.\n// Does not import React or @react-email/components.\n\nexport { schema, type ReactEmailSchema, type ReactEmailSpec } from \"./schema\";\n\nexport {\n standardComponentDefinitions,\n type StandardComponentDefinitions,\n type StandardComponentProps,\n} from \"./catalog\";\n\nexport type { Spec } from \"@json-render/core\";\n\nexport type {\n SetState,\n StateModel,\n ComponentContext,\n ComponentFn,\n Components,\n} from \"./catalog-types\";\n","import { defineSchema } from \"@json-render/core\";\n\n/**\n * The schema for @json-render/react-email\n *\n * Defines:\n * - Spec: A flat tree of elements with keys, types, props, and children references\n * - Catalog: Components with props schemas\n *\n * Reuses the same { root, elements } spec format as the React and React Native renderers.\n */\nexport const schema = defineSchema(\n (s) => ({\n spec: s.object({\n root: s.string(),\n elements: s.record(\n s.object({\n type: s.ref(\"catalog.components\"),\n props: s.propsOf(\"catalog.components\"),\n children: s.array(s.string()),\n visible: s.any(),\n }),\n ),\n }),\n\n catalog: s.object({\n components: s.map({\n props: s.zod(),\n slots: s.array(s.string()),\n description: s.string(),\n example: s.any(),\n }),\n }),\n }),\n {\n defaultRules: [\n \"The root element MUST be an Html component. Its children MUST include Head and Body components.\",\n \"Body should contain a Container component to constrain width (typically 600px max for email clients).\",\n \"All styles MUST be inline. Email clients strip <style> tags, so every component that accepts a style prop should use it for visual customization.\",\n \"Image src must be a fully qualified URL (absolute, not relative). For placeholder images use https://picsum.photos/{width}/{height}?random={n}.\",\n \"Emails are static documents. There are no interactive actions or form inputs.\",\n \"Use Section, Row, and Column for layout. These map to table-based email structures for maximum compatibility.\",\n \"Use Preview to set the preview text shown in email client inboxes before opening.\",\n \"Use Heading (h1-h6) and Text for all text content. Raw strings are not supported.\",\n \"Button renders as a link styled as a button. Always provide both text and href.\",\n \"CRITICAL INTEGRITY CHECK: Before outputting ANY element that references children, you MUST have already output (or will output) each child as its own element. If an element has children: ['a', 'b'], then elements 'a' and 'b' MUST exist.\",\n ],\n },\n);\n\nexport type ReactEmailSchema = typeof schema;\n\nexport type ReactEmailSpec<TCatalog> = typeof schema extends {\n createCatalog: (catalog: TCatalog) => { _specType: infer S };\n}\n ? S\n : never;\n","import { z } from \"zod\";\n\nconst styleSchema = z.record(z.string(), z.any()).nullable();\n\n/**\n * Standard component definitions for React Email catalogs.\n *\n * These define the available email components with their Zod prop schemas.\n * All components render using @react-email/components primitives.\n */\nexport const standardComponentDefinitions = {\n // ==========================================================================\n // Document Structure\n // ==========================================================================\n\n Html: {\n props: z.object({\n lang: z.string().nullable(),\n dir: z.enum([\"ltr\", \"rtl\"]).nullable(),\n }),\n slots: [\"default\"],\n description:\n \"Top-level HTML email wrapper. Must be the root element. Children should include Head and Body.\",\n example: { lang: \"en\", dir: \"ltr\" },\n },\n\n Head: {\n props: z.object({}),\n slots: [\"default\"],\n description:\n \"Email head section. Place inside Html. Can contain metadata but typically left empty.\",\n example: {},\n },\n\n Body: {\n props: z.object({\n style: styleSchema,\n }),\n slots: [\"default\"],\n description:\n \"Email body wrapper. Place inside Html after Head. Contains all visible email content.\",\n example: { style: { backgroundColor: \"#f6f9fc\" } },\n },\n\n Container: {\n props: z.object({\n style: styleSchema,\n }),\n slots: [\"default\"],\n description:\n \"Constrains content width for email clients. Place inside Body. Typically max-width 600px.\",\n example: {\n style: {\n maxWidth: \"600px\",\n margin: \"0 auto\",\n padding: \"20px 0 48px\",\n },\n },\n },\n\n Section: {\n props: z.object({\n style: styleSchema,\n }),\n slots: [\"default\"],\n description:\n \"Groups related content. Renders as a table-based section for email compatibility.\",\n example: { style: { padding: \"24px\", backgroundColor: \"#ffffff\" } },\n },\n\n Row: {\n props: z.object({\n style: styleSchema,\n }),\n slots: [\"default\"],\n description:\n \"Horizontal layout row. Use inside Section for multi-column layouts.\",\n example: { style: {} },\n },\n\n Column: {\n props: z.object({\n style: styleSchema,\n }),\n slots: [\"default\"],\n description:\n \"Column within a Row. Set width via style for proportional layouts.\",\n example: { style: { width: \"50%\" } },\n },\n\n // ==========================================================================\n // Content Components\n // ==========================================================================\n\n Heading: {\n props: z.object({\n text: z.string(),\n as: z.enum([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]).nullable(),\n style: styleSchema,\n }),\n slots: [],\n description:\n \"Heading text at various levels. h1 is largest, h6 is smallest.\",\n example: { text: \"Welcome!\", as: \"h1\" },\n },\n\n Text: {\n props: z.object({\n text: z.string(),\n style: styleSchema,\n }),\n slots: [],\n description:\n \"Body text paragraph. Use style for font size, color, weight, and alignment.\",\n example: { text: \"Thank you for signing up.\" },\n },\n\n Link: {\n props: z.object({\n text: z.string(),\n href: z.string(),\n style: styleSchema,\n }),\n slots: [],\n description: \"Hyperlink with visible text and a URL.\",\n example: {\n text: \"Visit our website\",\n href: \"https://example.com\",\n style: { color: \"#2563eb\" },\n },\n },\n\n Button: {\n props: z.object({\n text: z.string(),\n href: z.string(),\n style: styleSchema,\n }),\n slots: [],\n description:\n \"Call-to-action button rendered as a link styled as a button. Provide text and href.\",\n example: {\n text: \"Get Started\",\n href: \"https://example.com\",\n style: {\n backgroundColor: \"#5F51E8\",\n borderRadius: \"3px\",\n color: \"#fff\",\n padding: \"12px 20px\",\n },\n },\n },\n\n Image: {\n props: z.object({\n src: z.string(),\n alt: z.string().nullable(),\n width: z.number().nullable(),\n height: z.number().nullable(),\n style: styleSchema,\n }),\n slots: [],\n description:\n \"Image from a URL. src must be a fully qualified URL. Specify width and height for consistent rendering.\",\n example: {\n src: \"https://picsum.photos/400/200?random=1\",\n alt: \"Hero image\",\n width: 400,\n height: 200,\n },\n },\n\n Hr: {\n props: z.object({\n style: styleSchema,\n }),\n slots: [],\n description: \"Horizontal rule separator between content sections.\",\n example: {\n style: { borderColor: \"#e6ebf1\", margin: \"20px 0\" },\n },\n },\n\n // ==========================================================================\n // Utility Components\n // ==========================================================================\n\n Preview: {\n props: z.object({\n text: z.string(),\n }),\n slots: [],\n description:\n \"Preview text shown in email client inboxes before the email is opened. Place inside Html.\",\n example: { text: \"You have a new message from Acme Corp\" },\n },\n\n Markdown: {\n props: z.object({\n content: z.string(),\n markdownContainerStyles: styleSchema,\n markdownCustomStyles: z.record(z.string(), z.any()).nullable(),\n }),\n slots: [],\n description:\n \"Renders markdown content as email-safe HTML. Supports headings, paragraphs, lists, links, bold, italic, and code.\",\n example: {\n content: \"# Hello\\n\\nThis is **bold** and *italic* text.\",\n },\n },\n};\n\nexport type StandardComponentDefinitions = typeof standardComponentDefinitions;\n\nexport type StandardComponentProps<\n K extends keyof StandardComponentDefinitions,\n> = StandardComponentDefinitions[K][\"props\"] extends { _output: infer O }\n ? O\n : z.output<StandardComponentDefinitions[K][\"props\"]>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA6B;AAWtB,IAAM,aAAS;AAAA,EACpB,CAAC,OAAO;AAAA,IACN,MAAM,EAAE,OAAO;AAAA,MACb,MAAM,EAAE,OAAO;AAAA,MACf,UAAU,EAAE;AAAA,QACV,EAAE,OAAO;AAAA,UACP,MAAM,EAAE,IAAI,oBAAoB;AAAA,UAChC,OAAO,EA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O,aAAE,OAAO;AAAA,MACd,OAAO;AAAA,IACT,CAAC;AAAA,IACD,OAAO,CAAC;AAAA,IACR,aAAa;AAAA,IACb,SAAS;AAAA,MACP,OAAO,EAAE,aAAa,WAAW,QAAQ,SAAS;AAAA,IACpD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAMA,SAAS;AAAA,IACP,OAAO,aAAE,OAAO;AAAA,MACd,MAAM,aAAE,OAAO;AAAA,IACjB,CAAC;AAAA,IACD,OAAO,CAAC;AAAA,IACR,aACE;AAAA,IACF,SAAS,EAAE,MAAM,wCAAwC;AAAA,EAC3D;AAAA,EAEA,UAAU;AAAA,IACR,OAAO,aAAE,OAAO;AAAA,MACd,SAAS,aAAE,OAAO;AAAA,MAClB,yBAAyB;AAAA,MACzB,sBAAsB,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,IAAI,CAAC,EAAE,SAAS;AAAA,IAC/D,CAAC;AAAA,IACD,OAAO,CAAC;AAAA,IACR,aACE;AAAA,IACF,SAAS;AAAA,MACP,SAAS;AAAA,IACX;AAAA,EACF;AACF;","names":[]}
|
package/dist/server.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@json-render/react-email",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"description": "React Email renderer for @json-render/core. JSON becomes HTML emails.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"json",
|
|
8
|
+
"email",
|
|
9
|
+
"react-email",
|
|
10
|
+
"ai",
|
|
11
|
+
"generative-ui",
|
|
12
|
+
"llm",
|
|
13
|
+
"renderer",
|
|
14
|
+
"html"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/vercel-labs/json-render.git",
|
|
19
|
+
"directory": "packages/react-email"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/vercel-labs/json-render#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/vercel-labs/json-render/issues"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"module": "./dist/index.mjs",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.mjs",
|
|
35
|
+
"require": "./dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./server": {
|
|
38
|
+
"types": "./dist/server.d.ts",
|
|
39
|
+
"import": "./dist/server.mjs",
|
|
40
|
+
"require": "./dist/server.js"
|
|
41
|
+
},
|
|
42
|
+
"./catalog": {
|
|
43
|
+
"types": "./dist/catalog.d.ts",
|
|
44
|
+
"import": "./dist/catalog.mjs",
|
|
45
|
+
"require": "./dist/catalog.js"
|
|
46
|
+
},
|
|
47
|
+
"./render": {
|
|
48
|
+
"types": "./dist/render.d.ts",
|
|
49
|
+
"import": "./dist/render.mjs",
|
|
50
|
+
"require": "./dist/render.js"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist"
|
|
55
|
+
],
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@react-email/components": "^1.0.8",
|
|
58
|
+
"@react-email/render": "^2.0.4",
|
|
59
|
+
"@json-render/core": "0.11.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/react": "19.2.3",
|
|
63
|
+
"tsup": "^8.0.2",
|
|
64
|
+
"typescript": "^5.4.5",
|
|
65
|
+
"zod": "^4.0.0",
|
|
66
|
+
"@internal/typescript-config": "0.0.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependencies": {
|
|
69
|
+
"react": "^19.0.0",
|
|
70
|
+
"zod": "^4.0.0"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "tsup",
|
|
74
|
+
"dev": "tsup --watch",
|
|
75
|
+
"check-types": "tsc --noEmit",
|
|
76
|
+
"typecheck": "tsc --noEmit"
|
|
77
|
+
}
|
|
78
|
+
}
|