@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.
@@ -0,0 +1,216 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Standard component definitions for React Email catalogs.
5
+ *
6
+ * These define the available email components with their Zod prop schemas.
7
+ * All components render using @react-email/components primitives.
8
+ */
9
+ declare const standardComponentDefinitions: {
10
+ Html: {
11
+ props: z.ZodObject<{
12
+ lang: z.ZodNullable<z.ZodString>;
13
+ dir: z.ZodNullable<z.ZodEnum<{
14
+ ltr: "ltr";
15
+ rtl: "rtl";
16
+ }>>;
17
+ }, z.core.$strip>;
18
+ slots: string[];
19
+ description: string;
20
+ example: {
21
+ lang: string;
22
+ dir: string;
23
+ };
24
+ };
25
+ Head: {
26
+ props: z.ZodObject<{}, z.core.$strip>;
27
+ slots: string[];
28
+ description: string;
29
+ example: {};
30
+ };
31
+ Body: {
32
+ props: z.ZodObject<{
33
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
34
+ }, z.core.$strip>;
35
+ slots: string[];
36
+ description: string;
37
+ example: {
38
+ style: {
39
+ backgroundColor: string;
40
+ };
41
+ };
42
+ };
43
+ Container: {
44
+ props: z.ZodObject<{
45
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
46
+ }, z.core.$strip>;
47
+ slots: string[];
48
+ description: string;
49
+ example: {
50
+ style: {
51
+ maxWidth: string;
52
+ margin: string;
53
+ padding: string;
54
+ };
55
+ };
56
+ };
57
+ Section: {
58
+ props: z.ZodObject<{
59
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
60
+ }, z.core.$strip>;
61
+ slots: string[];
62
+ description: string;
63
+ example: {
64
+ style: {
65
+ padding: string;
66
+ backgroundColor: string;
67
+ };
68
+ };
69
+ };
70
+ Row: {
71
+ props: z.ZodObject<{
72
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
73
+ }, z.core.$strip>;
74
+ slots: string[];
75
+ description: string;
76
+ example: {
77
+ style: {};
78
+ };
79
+ };
80
+ Column: {
81
+ props: z.ZodObject<{
82
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
83
+ }, z.core.$strip>;
84
+ slots: string[];
85
+ description: string;
86
+ example: {
87
+ style: {
88
+ width: string;
89
+ };
90
+ };
91
+ };
92
+ Heading: {
93
+ props: z.ZodObject<{
94
+ text: z.ZodString;
95
+ as: z.ZodNullable<z.ZodEnum<{
96
+ h1: "h1";
97
+ h2: "h2";
98
+ h3: "h3";
99
+ h4: "h4";
100
+ h5: "h5";
101
+ h6: "h6";
102
+ }>>;
103
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
104
+ }, z.core.$strip>;
105
+ slots: never[];
106
+ description: string;
107
+ example: {
108
+ text: string;
109
+ as: string;
110
+ };
111
+ };
112
+ Text: {
113
+ props: z.ZodObject<{
114
+ text: z.ZodString;
115
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
116
+ }, z.core.$strip>;
117
+ slots: never[];
118
+ description: string;
119
+ example: {
120
+ text: string;
121
+ };
122
+ };
123
+ Link: {
124
+ props: z.ZodObject<{
125
+ text: z.ZodString;
126
+ href: z.ZodString;
127
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
128
+ }, z.core.$strip>;
129
+ slots: never[];
130
+ description: string;
131
+ example: {
132
+ text: string;
133
+ href: string;
134
+ style: {
135
+ color: string;
136
+ };
137
+ };
138
+ };
139
+ Button: {
140
+ props: z.ZodObject<{
141
+ text: z.ZodString;
142
+ href: z.ZodString;
143
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
144
+ }, z.core.$strip>;
145
+ slots: never[];
146
+ description: string;
147
+ example: {
148
+ text: string;
149
+ href: string;
150
+ style: {
151
+ backgroundColor: string;
152
+ borderRadius: string;
153
+ color: string;
154
+ padding: string;
155
+ };
156
+ };
157
+ };
158
+ Image: {
159
+ props: z.ZodObject<{
160
+ src: z.ZodString;
161
+ alt: z.ZodNullable<z.ZodString>;
162
+ width: z.ZodNullable<z.ZodNumber>;
163
+ height: z.ZodNullable<z.ZodNumber>;
164
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
165
+ }, z.core.$strip>;
166
+ slots: never[];
167
+ description: string;
168
+ example: {
169
+ src: string;
170
+ alt: string;
171
+ width: number;
172
+ height: number;
173
+ };
174
+ };
175
+ Hr: {
176
+ props: z.ZodObject<{
177
+ style: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
178
+ }, z.core.$strip>;
179
+ slots: never[];
180
+ description: string;
181
+ example: {
182
+ style: {
183
+ borderColor: string;
184
+ margin: string;
185
+ };
186
+ };
187
+ };
188
+ Preview: {
189
+ props: z.ZodObject<{
190
+ text: z.ZodString;
191
+ }, z.core.$strip>;
192
+ slots: never[];
193
+ description: string;
194
+ example: {
195
+ text: string;
196
+ };
197
+ };
198
+ Markdown: {
199
+ props: z.ZodObject<{
200
+ content: z.ZodString;
201
+ markdownContainerStyles: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
202
+ markdownCustomStyles: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
203
+ }, z.core.$strip>;
204
+ slots: never[];
205
+ description: string;
206
+ example: {
207
+ content: string;
208
+ };
209
+ };
210
+ };
211
+ type StandardComponentDefinitions = typeof standardComponentDefinitions;
212
+ type StandardComponentProps<K extends keyof StandardComponentDefinitions> = StandardComponentDefinitions[K]["props"] extends {
213
+ _output: infer O;
214
+ } ? O : z.output<StandardComponentDefinitions[K]["props"]>;
215
+
216
+ export { type StandardComponentDefinitions, type StandardComponentProps, standardComponentDefinitions };
@@ -0,0 +1,203 @@
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/catalog.ts
21
+ var catalog_exports = {};
22
+ __export(catalog_exports, {
23
+ standardComponentDefinitions: () => standardComponentDefinitions
24
+ });
25
+ module.exports = __toCommonJS(catalog_exports);
26
+ var import_zod = require("zod");
27
+ var styleSchema = import_zod.z.record(import_zod.z.string(), import_zod.z.any()).nullable();
28
+ var standardComponentDefinitions = {
29
+ // ==========================================================================
30
+ // Document Structure
31
+ // ==========================================================================
32
+ Html: {
33
+ props: import_zod.z.object({
34
+ lang: import_zod.z.string().nullable(),
35
+ dir: import_zod.z.enum(["ltr", "rtl"]).nullable()
36
+ }),
37
+ slots: ["default"],
38
+ description: "Top-level HTML email wrapper. Must be the root element. Children should include Head and Body.",
39
+ example: { lang: "en", dir: "ltr" }
40
+ },
41
+ Head: {
42
+ props: import_zod.z.object({}),
43
+ slots: ["default"],
44
+ description: "Email head section. Place inside Html. Can contain metadata but typically left empty.",
45
+ example: {}
46
+ },
47
+ Body: {
48
+ props: import_zod.z.object({
49
+ style: styleSchema
50
+ }),
51
+ slots: ["default"],
52
+ description: "Email body wrapper. Place inside Html after Head. Contains all visible email content.",
53
+ example: { style: { backgroundColor: "#f6f9fc" } }
54
+ },
55
+ Container: {
56
+ props: import_zod.z.object({
57
+ style: styleSchema
58
+ }),
59
+ slots: ["default"],
60
+ description: "Constrains content width for email clients. Place inside Body. Typically max-width 600px.",
61
+ example: {
62
+ style: {
63
+ maxWidth: "600px",
64
+ margin: "0 auto",
65
+ padding: "20px 0 48px"
66
+ }
67
+ }
68
+ },
69
+ Section: {
70
+ props: import_zod.z.object({
71
+ style: styleSchema
72
+ }),
73
+ slots: ["default"],
74
+ description: "Groups related content. Renders as a table-based section for email compatibility.",
75
+ example: { style: { padding: "24px", backgroundColor: "#ffffff" } }
76
+ },
77
+ Row: {
78
+ props: import_zod.z.object({
79
+ style: styleSchema
80
+ }),
81
+ slots: ["default"],
82
+ description: "Horizontal layout row. Use inside Section for multi-column layouts.",
83
+ example: { style: {} }
84
+ },
85
+ Column: {
86
+ props: import_zod.z.object({
87
+ style: styleSchema
88
+ }),
89
+ slots: ["default"],
90
+ description: "Column within a Row. Set width via style for proportional layouts.",
91
+ example: { style: { width: "50%" } }
92
+ },
93
+ // ==========================================================================
94
+ // Content Components
95
+ // ==========================================================================
96
+ Heading: {
97
+ props: import_zod.z.object({
98
+ text: import_zod.z.string(),
99
+ as: import_zod.z.enum(["h1", "h2", "h3", "h4", "h5", "h6"]).nullable(),
100
+ style: styleSchema
101
+ }),
102
+ slots: [],
103
+ description: "Heading text at various levels. h1 is largest, h6 is smallest.",
104
+ example: { text: "Welcome!", as: "h1" }
105
+ },
106
+ Text: {
107
+ props: import_zod.z.object({
108
+ text: import_zod.z.string(),
109
+ style: styleSchema
110
+ }),
111
+ slots: [],
112
+ description: "Body text paragraph. Use style for font size, color, weight, and alignment.",
113
+ example: { text: "Thank you for signing up." }
114
+ },
115
+ Link: {
116
+ props: import_zod.z.object({
117
+ text: import_zod.z.string(),
118
+ href: import_zod.z.string(),
119
+ style: styleSchema
120
+ }),
121
+ slots: [],
122
+ description: "Hyperlink with visible text and a URL.",
123
+ example: {
124
+ text: "Visit our website",
125
+ href: "https://example.com",
126
+ style: { color: "#2563eb" }
127
+ }
128
+ },
129
+ Button: {
130
+ props: import_zod.z.object({
131
+ text: import_zod.z.string(),
132
+ href: import_zod.z.string(),
133
+ style: styleSchema
134
+ }),
135
+ slots: [],
136
+ description: "Call-to-action button rendered as a link styled as a button. Provide text and href.",
137
+ example: {
138
+ text: "Get Started",
139
+ href: "https://example.com",
140
+ style: {
141
+ backgroundColor: "#5F51E8",
142
+ borderRadius: "3px",
143
+ color: "#fff",
144
+ padding: "12px 20px"
145
+ }
146
+ }
147
+ },
148
+ Image: {
149
+ props: import_zod.z.object({
150
+ src: import_zod.z.string(),
151
+ alt: import_zod.z.string().nullable(),
152
+ width: import_zod.z.number().nullable(),
153
+ height: import_zod.z.number().nullable(),
154
+ style: styleSchema
155
+ }),
156
+ slots: [],
157
+ description: "Image from a URL. src must be a fully qualified URL. Specify width and height for consistent rendering.",
158
+ example: {
159
+ src: "https://picsum.photos/400/200?random=1",
160
+ alt: "Hero image",
161
+ width: 400,
162
+ height: 200
163
+ }
164
+ },
165
+ Hr: {
166
+ props: import_zod.z.object({
167
+ style: styleSchema
168
+ }),
169
+ slots: [],
170
+ description: "Horizontal rule separator between content sections.",
171
+ example: {
172
+ style: { borderColor: "#e6ebf1", margin: "20px 0" }
173
+ }
174
+ },
175
+ // ==========================================================================
176
+ // Utility Components
177
+ // ==========================================================================
178
+ Preview: {
179
+ props: import_zod.z.object({
180
+ text: import_zod.z.string()
181
+ }),
182
+ slots: [],
183
+ description: "Preview text shown in email client inboxes before the email is opened. Place inside Html.",
184
+ example: { text: "You have a new message from Acme Corp" }
185
+ },
186
+ Markdown: {
187
+ props: import_zod.z.object({
188
+ content: import_zod.z.string(),
189
+ markdownContainerStyles: styleSchema,
190
+ markdownCustomStyles: import_zod.z.record(import_zod.z.string(), import_zod.z.any()).nullable()
191
+ }),
192
+ slots: [],
193
+ description: "Renders markdown content as email-safe HTML. Supports headings, paragraphs, lists, links, bold, italic, and code.",
194
+ example: {
195
+ content: "# Hello\n\nThis is **bold** and *italic* text."
196
+ }
197
+ }
198
+ };
199
+ // Annotate the CommonJS export names for ESM import in node:
200
+ 0 && (module.exports = {
201
+ standardComponentDefinitions
202
+ });
203
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/catalog.ts"],"sourcesContent":["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,iBAAkB;AAElB,IAAM,cAAc,aAAE,OAAO,aAAE,OAAO,GAAG,aAAE,IAAI,CAAC,EAAE,SAAS;AAQpD,IAAM,+BAA+B;AAAA;AAAA;AAAA;AAAA,EAK1C,MAAM;AAAA,IACJ,OAAO,aAAE,OAAO;AAAA,MACd,MAAM,aAAE,OAAO,EAAE,SAAS;AAAA,MAC1B,KAAK,aAAE,KAAK,CAAC,OAAO,KAAK,CAAC,EAAE,SAAS;AAAA,IACvC,CAAC;AAAA,IACD,OAAO,CAAC,SAAS;AAAA,IACjB,aACE;AAAA,IACF,SAAS,EAAE,MAAM,MAAM,KAAK,MAAM;AAAA,EACpC;AAAA,EAEA,MAAM;AAAA,IACJ,OAAO,aAAE,OAAO,CAAC,CAAC;AAAA,IAClB,OAAO,CAAC,SAAS;AAAA,IACjB,aACE;AAAA,IACF,SAAS,CAAC;AAAA,EACZ;AAAA,EAEA,MAAM;AAAA,IACJ,OAAO,aAAE,OAAO;AAAA,MACd,OAAO;AAAA,IACT,CAAC;AAAA,IACD,OAAO,CAAC,SAAS;AAAA,IACjB,aACE;AAAA,IACF,SAAS,EAAE,OAAO,EAAE,iBAAiB,UAAU,EAAE;AAAA,EACnD;AAAA,EAEA,WAAW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;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":[]}
@@ -0,0 +1,7 @@
1
+ import {
2
+ standardComponentDefinitions
3
+ } from "./chunk-GXJW4OIL.mjs";
4
+ export {
5
+ standardComponentDefinitions
6
+ };
7
+ //# sourceMappingURL=catalog.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,44 @@
1
+ // src/schema.ts
2
+ import { defineSchema } from "@json-render/core";
3
+ var schema = defineSchema(
4
+ (s) => ({
5
+ spec: s.object({
6
+ root: s.string(),
7
+ elements: s.record(
8
+ s.object({
9
+ type: s.ref("catalog.components"),
10
+ props: s.propsOf("catalog.components"),
11
+ children: s.array(s.string()),
12
+ visible: s.any()
13
+ })
14
+ )
15
+ }),
16
+ catalog: s.object({
17
+ components: s.map({
18
+ props: s.zod(),
19
+ slots: s.array(s.string()),
20
+ description: s.string(),
21
+ example: s.any()
22
+ })
23
+ })
24
+ }),
25
+ {
26
+ defaultRules: [
27
+ "The root element MUST be an Html component. Its children MUST include Head and Body components.",
28
+ "Body should contain a Container component to constrain width (typically 600px max for email clients).",
29
+ "All styles MUST be inline. Email clients strip <style> tags, so every component that accepts a style prop should use it for visual customization.",
30
+ "Image src must be a fully qualified URL (absolute, not relative). For placeholder images use https://picsum.photos/{width}/{height}?random={n}.",
31
+ "Emails are static documents. There are no interactive actions or form inputs.",
32
+ "Use Section, Row, and Column for layout. These map to table-based email structures for maximum compatibility.",
33
+ "Use Preview to set the preview text shown in email client inboxes before opening.",
34
+ "Use Heading (h1-h6) and Text for all text content. Raw strings are not supported.",
35
+ "Button renders as a link styled as a button. Always provide both text and href.",
36
+ "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."
37
+ ]
38
+ }
39
+ );
40
+
41
+ export {
42
+ schema
43
+ };
44
+ //# sourceMappingURL=chunk-3YN5NZJ7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema.ts"],"sourcesContent":["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"],"mappings":";AAAA,SAAS,oBAAoB;AAWtB,IAAM,SAAS;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,EAAE,QAAQ,oBAAoB;AAAA,UACrC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,UAC5B,SAAS,EAAE,IAAI;AAAA,QACjB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,IAED,SAAS,EAAE,OAAO;AAAA,MAChB,YAAY,EAAE,IAAI;AAAA,QAChB,OAAO,EAAE,IAAI;AAAA,QACb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,QACzB,aAAa,EAAE,OAAO;AAAA,QACtB,SAAS,EAAE,IAAI;AAAA,MACjB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,179 @@
1
+ // src/catalog.ts
2
+ import { z } from "zod";
3
+ var styleSchema = z.record(z.string(), z.any()).nullable();
4
+ var standardComponentDefinitions = {
5
+ // ==========================================================================
6
+ // Document Structure
7
+ // ==========================================================================
8
+ Html: {
9
+ props: z.object({
10
+ lang: z.string().nullable(),
11
+ dir: z.enum(["ltr", "rtl"]).nullable()
12
+ }),
13
+ slots: ["default"],
14
+ description: "Top-level HTML email wrapper. Must be the root element. Children should include Head and Body.",
15
+ example: { lang: "en", dir: "ltr" }
16
+ },
17
+ Head: {
18
+ props: z.object({}),
19
+ slots: ["default"],
20
+ description: "Email head section. Place inside Html. Can contain metadata but typically left empty.",
21
+ example: {}
22
+ },
23
+ Body: {
24
+ props: z.object({
25
+ style: styleSchema
26
+ }),
27
+ slots: ["default"],
28
+ description: "Email body wrapper. Place inside Html after Head. Contains all visible email content.",
29
+ example: { style: { backgroundColor: "#f6f9fc" } }
30
+ },
31
+ Container: {
32
+ props: z.object({
33
+ style: styleSchema
34
+ }),
35
+ slots: ["default"],
36
+ description: "Constrains content width for email clients. Place inside Body. Typically max-width 600px.",
37
+ example: {
38
+ style: {
39
+ maxWidth: "600px",
40
+ margin: "0 auto",
41
+ padding: "20px 0 48px"
42
+ }
43
+ }
44
+ },
45
+ Section: {
46
+ props: z.object({
47
+ style: styleSchema
48
+ }),
49
+ slots: ["default"],
50
+ description: "Groups related content. Renders as a table-based section for email compatibility.",
51
+ example: { style: { padding: "24px", backgroundColor: "#ffffff" } }
52
+ },
53
+ Row: {
54
+ props: z.object({
55
+ style: styleSchema
56
+ }),
57
+ slots: ["default"],
58
+ description: "Horizontal layout row. Use inside Section for multi-column layouts.",
59
+ example: { style: {} }
60
+ },
61
+ Column: {
62
+ props: z.object({
63
+ style: styleSchema
64
+ }),
65
+ slots: ["default"],
66
+ description: "Column within a Row. Set width via style for proportional layouts.",
67
+ example: { style: { width: "50%" } }
68
+ },
69
+ // ==========================================================================
70
+ // Content Components
71
+ // ==========================================================================
72
+ Heading: {
73
+ props: z.object({
74
+ text: z.string(),
75
+ as: z.enum(["h1", "h2", "h3", "h4", "h5", "h6"]).nullable(),
76
+ style: styleSchema
77
+ }),
78
+ slots: [],
79
+ description: "Heading text at various levels. h1 is largest, h6 is smallest.",
80
+ example: { text: "Welcome!", as: "h1" }
81
+ },
82
+ Text: {
83
+ props: z.object({
84
+ text: z.string(),
85
+ style: styleSchema
86
+ }),
87
+ slots: [],
88
+ description: "Body text paragraph. Use style for font size, color, weight, and alignment.",
89
+ example: { text: "Thank you for signing up." }
90
+ },
91
+ Link: {
92
+ props: z.object({
93
+ text: z.string(),
94
+ href: z.string(),
95
+ style: styleSchema
96
+ }),
97
+ slots: [],
98
+ description: "Hyperlink with visible text and a URL.",
99
+ example: {
100
+ text: "Visit our website",
101
+ href: "https://example.com",
102
+ style: { color: "#2563eb" }
103
+ }
104
+ },
105
+ Button: {
106
+ props: z.object({
107
+ text: z.string(),
108
+ href: z.string(),
109
+ style: styleSchema
110
+ }),
111
+ slots: [],
112
+ description: "Call-to-action button rendered as a link styled as a button. Provide text and href.",
113
+ example: {
114
+ text: "Get Started",
115
+ href: "https://example.com",
116
+ style: {
117
+ backgroundColor: "#5F51E8",
118
+ borderRadius: "3px",
119
+ color: "#fff",
120
+ padding: "12px 20px"
121
+ }
122
+ }
123
+ },
124
+ Image: {
125
+ props: z.object({
126
+ src: z.string(),
127
+ alt: z.string().nullable(),
128
+ width: z.number().nullable(),
129
+ height: z.number().nullable(),
130
+ style: styleSchema
131
+ }),
132
+ slots: [],
133
+ description: "Image from a URL. src must be a fully qualified URL. Specify width and height for consistent rendering.",
134
+ example: {
135
+ src: "https://picsum.photos/400/200?random=1",
136
+ alt: "Hero image",
137
+ width: 400,
138
+ height: 200
139
+ }
140
+ },
141
+ Hr: {
142
+ props: z.object({
143
+ style: styleSchema
144
+ }),
145
+ slots: [],
146
+ description: "Horizontal rule separator between content sections.",
147
+ example: {
148
+ style: { borderColor: "#e6ebf1", margin: "20px 0" }
149
+ }
150
+ },
151
+ // ==========================================================================
152
+ // Utility Components
153
+ // ==========================================================================
154
+ Preview: {
155
+ props: z.object({
156
+ text: z.string()
157
+ }),
158
+ slots: [],
159
+ description: "Preview text shown in email client inboxes before the email is opened. Place inside Html.",
160
+ example: { text: "You have a new message from Acme Corp" }
161
+ },
162
+ Markdown: {
163
+ props: z.object({
164
+ content: z.string(),
165
+ markdownContainerStyles: styleSchema,
166
+ markdownCustomStyles: z.record(z.string(), z.any()).nullable()
167
+ }),
168
+ slots: [],
169
+ description: "Renders markdown content as email-safe HTML. Supports headings, paragraphs, lists, links, bold, italic, and code.",
170
+ example: {
171
+ content: "# Hello\n\nThis is **bold** and *italic* text."
172
+ }
173
+ }
174
+ };
175
+
176
+ export {
177
+ standardComponentDefinitions
178
+ };
179
+ //# sourceMappingURL=chunk-GXJW4OIL.mjs.map