@maily-to/render 0.2.2 → 2.0.0-beta.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/dist/index.cjs +1428 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +230 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +194 -256
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1397 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +43 -49
- package/readme.md +20 -56
- package/LICENSE +0 -21
- package/dist/index.d.ts +0 -292
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { AnyMailyMark, AnyMailyNode, FontFamilyItem, FontProps, RendererThemeOptions } from "@maily-to/shared";
|
|
2
|
+
import * as react from "react";
|
|
1
3
|
import { HtmlProps } from "@react-email/components";
|
|
2
|
-
import
|
|
3
|
-
import { JSONContent, JSONContent as JSONContent$1 } from "@tiptap/core";
|
|
4
|
-
import { RendererThemeOptions } from "@maily-to/shared";
|
|
4
|
+
import { JSONContent } from "@tiptap/core";
|
|
5
5
|
|
|
6
|
-
//#region src/meta.d.ts
|
|
6
|
+
//#region src/lib/meta.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Descriptor for a single meta element to inject into the `<head>`.
|
|
9
|
+
* Supports the same shapes as Remix/React-Router's MetaDescriptor:
|
|
10
|
+
* charSet, title, name/content, property/content, httpEquiv/content,
|
|
11
|
+
* tagName ('meta' | 'link'), and a catch-all for arbitrary attrs.
|
|
12
|
+
*/
|
|
7
13
|
type MetaDescriptor = {
|
|
8
14
|
charSet: 'utf-8';
|
|
9
15
|
} | {
|
|
@@ -19,274 +25,206 @@ type MetaDescriptor = {
|
|
|
19
25
|
content: string;
|
|
20
26
|
} | {
|
|
21
27
|
tagName: 'meta' | 'link';
|
|
22
|
-
[
|
|
28
|
+
[attr: string]: string;
|
|
23
29
|
} | {
|
|
24
30
|
[name: string]: string;
|
|
25
31
|
};
|
|
26
|
-
type MetaDescriptors = MetaDescriptor[];
|
|
27
32
|
//#endregion
|
|
28
|
-
//#region src/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
private doc;
|
|
35
|
-
private paragraph;
|
|
36
|
-
private text;
|
|
37
|
-
private variable;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=preheader.d.ts.map
|
|
40
|
-
//#endregion
|
|
41
|
-
//#region src/maily.d.ts
|
|
42
|
-
interface NodeOptions {
|
|
43
|
-
parent?: JSONContent$1;
|
|
44
|
-
prev?: JSONContent$1;
|
|
45
|
-
next?: JSONContent$1;
|
|
46
|
-
payloadValue?: PayloadValue;
|
|
47
|
-
}
|
|
48
|
-
interface MarkType {
|
|
49
|
-
[key: string]: any;
|
|
50
|
-
type: string;
|
|
51
|
-
attrs?: Record<string, any> | undefined;
|
|
52
|
-
}
|
|
53
|
-
interface MailyConfig {
|
|
54
|
-
/**
|
|
55
|
-
* The preview text is the snippet of text that is pulled into the inbox
|
|
56
|
-
* preview of an email client, usually right after the subject line.
|
|
57
|
-
*
|
|
58
|
-
* Default: `undefined`
|
|
59
|
-
*/
|
|
60
|
-
preview?: string | JSONContent$1;
|
|
61
|
-
/**
|
|
62
|
-
* The theme object allows you to customize the colors and font sizes of the
|
|
63
|
-
* rendered email.
|
|
64
|
-
*
|
|
65
|
-
* Default:
|
|
66
|
-
* ```js
|
|
67
|
-
* {
|
|
68
|
-
* colors: {
|
|
69
|
-
* heading: '#111827',
|
|
70
|
-
* paragraph: '#374151',
|
|
71
|
-
* horizontal: '#EAEAEA',
|
|
72
|
-
* footer: '#64748B',
|
|
73
|
-
* },
|
|
74
|
-
* fontSize: {
|
|
75
|
-
* paragraph: '15px',
|
|
76
|
-
* footer: {
|
|
77
|
-
* size: '14px',
|
|
78
|
-
* lineHeight: '24px',
|
|
79
|
-
* },
|
|
80
|
-
* },
|
|
81
|
-
* }
|
|
82
|
-
* ```
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```js
|
|
86
|
-
* const maily = new Maily(content, {
|
|
87
|
-
* theme: {
|
|
88
|
-
* colors: {
|
|
89
|
-
* heading: '#111827',
|
|
90
|
-
* },
|
|
91
|
-
* fontSize: {
|
|
92
|
-
* footer: {
|
|
93
|
-
* size: '14px',
|
|
94
|
-
* lineHeight: '24px',
|
|
95
|
-
* },
|
|
96
|
-
* },
|
|
97
|
-
* },
|
|
98
|
-
* });
|
|
99
|
-
* ```
|
|
100
|
-
*/
|
|
101
|
-
theme?: Partial<RendererThemeOptions>;
|
|
102
|
-
}
|
|
103
|
-
declare const DEFAULT_SECTION_BACKGROUND_COLOR = "#ffffff";
|
|
104
|
-
declare const DEFAULT_SECTION_ALIGN = "left";
|
|
105
|
-
declare const DEFAULT_SECTION_BORDER_WIDTH = 1;
|
|
106
|
-
declare const DEFAULT_SECTION_BORDER_COLOR = "#000000";
|
|
107
|
-
declare const DEFAULT_SECTION_MARGIN_TOP = 0;
|
|
108
|
-
declare const DEFAULT_SECTION_MARGIN_RIGHT = 0;
|
|
109
|
-
declare const DEFAULT_SECTION_MARGIN_BOTTOM = 0;
|
|
110
|
-
declare const DEFAULT_SECTION_MARGIN_LEFT = 0;
|
|
111
|
-
declare const DEFAULT_SECTION_PADDING_TOP = 5;
|
|
112
|
-
declare const DEFAULT_SECTION_PADDING_RIGHT = 5;
|
|
113
|
-
declare const DEFAULT_SECTION_PADDING_BOTTOM = 5;
|
|
114
|
-
declare const DEFAULT_SECTION_PADDING_LEFT = 5;
|
|
115
|
-
declare const DEFAULT_COLUMNS_WIDTH = "100%";
|
|
116
|
-
declare const DEFAULT_COLUMNS_GAP = 8;
|
|
117
|
-
declare const DEFAULT_COLUMN_BACKGROUND_COLOR = "transparent";
|
|
118
|
-
declare const DEFAULT_COLUMN_BORDER_RADIUS = 0;
|
|
119
|
-
declare const DEFAULT_COLUMN_BORDER_WIDTH = 0;
|
|
120
|
-
declare const DEFAULT_COLUMN_BORDER_COLOR = "transparent";
|
|
121
|
-
declare const DEFAULT_COLUMN_PADDING_TOP = 0;
|
|
122
|
-
declare const DEFAULT_COLUMN_PADDING_RIGHT = 0;
|
|
123
|
-
declare const DEFAULT_COLUMN_PADDING_BOTTOM = 0;
|
|
124
|
-
declare const DEFAULT_COLUMN_PADDING_LEFT = 0;
|
|
125
|
-
declare const DEFAULT_INLINE_IMAGE_HEIGHT = 20;
|
|
126
|
-
declare const DEFAULT_INLINE_IMAGE_WIDTH = 20;
|
|
127
|
-
declare const LINK_PROTOCOL_REGEX: RegExp;
|
|
128
|
-
declare const DEFAULT_META_TAGS: MetaDescriptors;
|
|
129
|
-
declare const DEFAULT_HTML_PROPS: HtmlProps;
|
|
130
|
-
interface RenderOptions {
|
|
131
|
-
/**
|
|
132
|
-
* The options object allows you to customize the output of the rendered
|
|
133
|
-
* email.
|
|
134
|
-
* - `pretty` - If `true`, the output will be formatted with indentation and
|
|
135
|
-
* line breaks.
|
|
136
|
-
* - `plainText` - If `true`, the output will be plain text instead of HTML.
|
|
137
|
-
* This is useful for testing purposes.
|
|
138
|
-
*
|
|
139
|
-
* Default: `pretty` - `false`, `plainText` - `false`
|
|
140
|
-
*/
|
|
141
|
-
pretty?: boolean;
|
|
142
|
-
plainText?: boolean;
|
|
143
|
-
}
|
|
144
|
-
type VariableFormatter = (options: {
|
|
33
|
+
//#region src/config.d.ts
|
|
34
|
+
/**
|
|
35
|
+
* Custom formatter called when a variable has no value in `variables`.
|
|
36
|
+
* Return a placeholder string (e.g. `{{name}}` or `${name}`).
|
|
37
|
+
*/
|
|
38
|
+
type VariableFormatter = (opts: {
|
|
145
39
|
variable: string;
|
|
146
40
|
fallback?: string;
|
|
147
41
|
}) => string;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Any value that can be stored in the unified `variables` map.
|
|
44
|
+
*
|
|
45
|
+
* - `string` — text substitution (variable nodes, link href overrides)
|
|
46
|
+
* - `number` — numeric comparisons in visibility rules
|
|
47
|
+
* - `boolean` — truthy/falsy visibility checks
|
|
48
|
+
* - `Record<string, unknown>` — nested object data
|
|
49
|
+
* - `Array<Record<string, unknown>>` — arrays iterated by repeat nodes
|
|
50
|
+
*/
|
|
51
|
+
type VariableValue = string | number | boolean | Record<string, unknown> | Array<Record<string, unknown>>;
|
|
52
|
+
/** Internal resolved config produced by buildConfig. */
|
|
53
|
+
type MailyRenderConfig = {
|
|
54
|
+
theme: RendererThemeOptions;
|
|
55
|
+
fontFamilies: FontFamilyItem[];
|
|
56
|
+
variableFormatter: VariableFormatter;
|
|
57
|
+
variableValues: Map<string, VariableValue>;
|
|
58
|
+
preview?: string | JSONContent;
|
|
59
|
+
meta: MetaDescriptor[];
|
|
60
|
+
htmlProps: HtmlProps;
|
|
61
|
+
openTrackingPixel?: string;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Public config passed to `render()`.
|
|
65
|
+
*
|
|
66
|
+
* All user-provided data lives under a single `variables` key:
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* render(json, {
|
|
71
|
+
* variables: {
|
|
72
|
+
* name: 'Alice', // string → variable substitution
|
|
73
|
+
* active: true, // boolean → visibility rules
|
|
74
|
+
* items: [{ id: 1 }], // array → repeat iteration
|
|
75
|
+
* cta: 'https://example.com', // string → link href override
|
|
76
|
+
* },
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* Resolution priority (highest → lowest):
|
|
81
|
+
* 1. `item` — per-iteration data set by repeat nodes (via context)
|
|
82
|
+
* 2. `variables` — this map
|
|
83
|
+
* 3. `variableFormatter` — fallback that produces a placeholder string
|
|
84
|
+
*/
|
|
85
|
+
type MailyConfig = {
|
|
86
|
+
preview?: string | JSONContent;
|
|
87
|
+
theme?: Partial<RendererThemeOptions>;
|
|
88
|
+
fontFamilies?: FontFamilyItem[];
|
|
89
|
+
variables?: Record<string, VariableValue>;
|
|
90
|
+
variableFormatter?: VariableFormatter;
|
|
91
|
+
meta?: MetaDescriptor[];
|
|
92
|
+
htmlProps?: HtmlProps;
|
|
93
|
+
openTrackingPixel?: string;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Merges user-provided MailyConfig with defaults to produce the
|
|
97
|
+
* internal MailyRenderConfig used throughout the render pass.
|
|
98
|
+
*/
|
|
99
|
+
declare function buildConfig(config?: MailyConfig): MailyRenderConfig;
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/context.d.ts
|
|
102
|
+
/**
|
|
103
|
+
* Typed variable keys available on every RenderContext.
|
|
104
|
+
*
|
|
105
|
+
* Built-in keys:
|
|
106
|
+
* - `item` — the current record during a repeat iteration. Set by repeat.tsx
|
|
107
|
+
* when looping over an array variable. Each iteration gets its own copy so
|
|
108
|
+
* sibling iterations are isolated. Variable/visibility lookups check `item`
|
|
109
|
+
* first, then fall back to `config.variableValues`.
|
|
110
|
+
* - `columnTdWidth` — the TD-relative percentage width string (e.g. `"48.4%"`)
|
|
111
|
+
* set by columns.tsx and consumed by column.tsx.
|
|
112
|
+
*
|
|
113
|
+
* Extend via module augmentation to add custom keys:
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* declare module '@maily-to/render' {
|
|
118
|
+
* interface RenderVariableMap {
|
|
119
|
+
* theme: 'light' | 'dark';
|
|
120
|
+
* locale: string;
|
|
121
|
+
* }
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
interface RenderVariableMap {
|
|
126
|
+
item?: Record<string, unknown>;
|
|
127
|
+
columnTdWidth?: string;
|
|
128
|
+
}
|
|
129
|
+
type BoxModel = {
|
|
130
|
+
totalWidth: number;
|
|
131
|
+
totalBorder: number;
|
|
132
|
+
totalPadding: number;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Render-time context threaded through every node and mark renderer.
|
|
136
|
+
*
|
|
137
|
+
* State scoping:
|
|
138
|
+
* - `config` — immutable, shared by the entire tree.
|
|
139
|
+
* - `styles` / `fonts` — shared collectors that accumulate to the document root.
|
|
140
|
+
* Use `style()` and `font()` from any depth; they all write to the same sets.
|
|
141
|
+
* - `vars` — cloned per `child()` call. A child inherits the parent's vars at
|
|
142
|
+
* creation time, but mutations in either direction are isolated. This is what
|
|
143
|
+
* allows nested repeat iterations to each carry their own `item` without
|
|
144
|
+
* leaking into siblings or parents.
|
|
145
|
+
* - `parent`, `siblingIndex`, `size` — local to each context instance.
|
|
146
|
+
*/
|
|
147
|
+
interface RenderContext<Variables extends RenderVariableMap = RenderVariableMap> {
|
|
148
|
+
readonly parent: AnyMailyNode | AnyMailyMark | undefined;
|
|
149
|
+
readonly siblingIndex: number;
|
|
150
|
+
readonly config: MailyRenderConfig;
|
|
151
|
+
readonly size: Readonly<BoxModel>;
|
|
152
|
+
/** Content width after subtracting border and padding from `size.totalWidth`. */
|
|
153
|
+
readonly box: number;
|
|
154
|
+
/** Render a single node using the registered node renderers. */
|
|
155
|
+
render(node: AnyMailyNode): React.ReactNode;
|
|
156
|
+
/** Render all child nodes of a parent, creating a child context for each. */
|
|
157
|
+
children(parent: AnyMailyNode): React.ReactNode[];
|
|
203
158
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
* Default: `false`
|
|
159
|
+
* Set a typed variable on this context.
|
|
160
|
+
* Only affects this context — child contexts created via `child()` get
|
|
161
|
+
* their own copy and won't see mutations made here after creation.
|
|
208
162
|
*/
|
|
209
|
-
|
|
163
|
+
set<K extends keyof Variables>(key: K, value: Variables[K]): void;
|
|
164
|
+
/** Get a typed variable from this context. */
|
|
165
|
+
get<K extends keyof Variables>(key: K): Variables[K];
|
|
210
166
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* @param meta - The meta tags
|
|
167
|
+
* Access all variables as a readonly object. Creates a new object on
|
|
168
|
+
* each access — prefer `get()` for individual lookups.
|
|
214
169
|
*/
|
|
215
|
-
|
|
170
|
+
readonly var: Readonly<Variables>;
|
|
171
|
+
/** Add a CSS rule to the shared document-level style collector. */
|
|
172
|
+
style(css: string): void;
|
|
173
|
+
/** Register a font face in the shared document-level font collector. */
|
|
174
|
+
font(name: string, props: FontProps): void;
|
|
216
175
|
/**
|
|
217
|
-
*
|
|
176
|
+
* Derive a child context for rendering a child node.
|
|
218
177
|
*
|
|
219
|
-
*
|
|
178
|
+
* - `config`, `styles`, and `fonts` are shared by reference.
|
|
179
|
+
* - `vars` are shallow-cloned so child `set()` calls don't affect the parent.
|
|
180
|
+
* - `parent`, `siblingIndex`, and `size` can be overridden; unset fields
|
|
181
|
+
* inherit from the current context.
|
|
220
182
|
*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
render(options?: RenderOptions): Promise<string>;
|
|
225
|
-
/**
|
|
226
|
-
* `children` will return the children of the content.
|
|
227
|
-
* this is useful for rendering the content in a custom component.
|
|
228
|
-
*
|
|
229
|
-
* @returns The children of the content as JSX elements
|
|
230
|
-
*/
|
|
231
|
-
children(): (react_jsx_runtime0.JSX.Element | null)[];
|
|
232
|
-
/**
|
|
233
|
-
* `markup` will render the JSON content into React Email markup.
|
|
234
|
-
* and return the raw React Tree.
|
|
235
|
-
*/
|
|
236
|
-
markup(): react_jsx_runtime0.JSX.Element;
|
|
237
|
-
private getMarginOverrideConditions;
|
|
238
|
-
private getMappedContent;
|
|
239
|
-
private renderNode;
|
|
240
|
-
private renderMark;
|
|
241
|
-
private paragraph;
|
|
242
|
-
private text;
|
|
243
|
-
private bold;
|
|
244
|
-
private italic;
|
|
245
|
-
private underline;
|
|
246
|
-
private strike;
|
|
247
|
-
private textStyle;
|
|
248
|
-
private link;
|
|
249
|
-
private removeLinkProtocol;
|
|
250
|
-
private variableUrlValue;
|
|
251
|
-
private heading;
|
|
252
|
-
private variable;
|
|
253
|
-
getVariableValue(variable: string, fallback?: string, options?: NodeOptions): string;
|
|
254
|
-
private horizontalRule;
|
|
255
|
-
private orderedList;
|
|
256
|
-
private bulletList;
|
|
257
|
-
private listItem;
|
|
258
|
-
private button;
|
|
259
|
-
private spacer;
|
|
260
|
-
private hardBreak;
|
|
261
|
-
private logo;
|
|
262
|
-
private image;
|
|
263
|
-
private footer;
|
|
264
|
-
private blockquote;
|
|
265
|
-
private code;
|
|
266
|
-
private linkCard;
|
|
267
|
-
private section;
|
|
268
|
-
private columns;
|
|
269
|
-
private adjustColumnsContent;
|
|
270
|
-
private column;
|
|
271
|
-
private repeat;
|
|
272
|
-
/**
|
|
273
|
-
* @deprecated
|
|
274
|
-
* This for node is an alias for the repeat node
|
|
275
|
-
* we will remove this in the future
|
|
276
|
-
* @param node
|
|
277
|
-
* @param options
|
|
278
|
-
* @returns JSX.Element
|
|
279
|
-
*/
|
|
280
|
-
private for;
|
|
281
|
-
private shouldShow;
|
|
282
|
-
htmlCodeBlock(node: JSONContent$1, options?: NodeOptions): JSX.Element;
|
|
283
|
-
private inlineImage;
|
|
183
|
+
child(opts: ChildContextOptions): RenderContext<Variables>;
|
|
184
|
+
readonly styles: ReadonlySet<string>;
|
|
185
|
+
readonly fonts: ReadonlyMap<string, FontProps>;
|
|
284
186
|
}
|
|
187
|
+
type ChildContextOptions = {
|
|
188
|
+
parent?: AnyMailyNode | AnyMailyMark;
|
|
189
|
+
siblingIndex?: number;
|
|
190
|
+
size?: Partial<BoxModel>;
|
|
191
|
+
};
|
|
192
|
+
type CreateRenderContextOptions = {
|
|
193
|
+
config: MailyRenderConfig;
|
|
194
|
+
parent?: AnyMailyNode | AnyMailyMark;
|
|
195
|
+
siblingIndex?: number;
|
|
196
|
+
size?: Partial<BoxModel>;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Creates the root RenderContext for a render pass. Node renderers
|
|
200
|
+
* derive child contexts via `ctx.child()` as they descend the tree.
|
|
201
|
+
*/
|
|
202
|
+
declare function defineRenderContext<Variables extends RenderVariableMap = RenderVariableMap>(opts: CreateRenderContextOptions): RenderContext<Variables>;
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/lib/link.d.ts
|
|
205
|
+
/**
|
|
206
|
+
* Extracts all valid URLs from link marks in a Maily document.
|
|
207
|
+
* Returns a deduplicated Set of href strings.
|
|
208
|
+
*/
|
|
209
|
+
declare function links(json: JSONContent): Set<string>;
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/node.d.ts
|
|
212
|
+
/**
|
|
213
|
+
* Function signature for a node renderer. Each node type (paragraph,
|
|
214
|
+
* button, image, etc.) implements this to produce its React output.
|
|
215
|
+
*/
|
|
216
|
+
type NodeRenderer = (node: AnyMailyNode, ctx: RenderContext) => React.ReactNode;
|
|
217
|
+
declare function dispatch(node: AnyMailyNode, ctx: RenderContext): React.ReactNode;
|
|
218
|
+
declare function children(parent: AnyMailyNode, ctx: RenderContext): React.ReactNode[];
|
|
285
219
|
//#endregion
|
|
286
220
|
//#region src/render.d.ts
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Converts a Maily JSON document into React elements. Returns null
|
|
223
|
+
* if the input is not a valid Maily node.
|
|
224
|
+
*/
|
|
225
|
+
declare function markup(json: JSONContent, config?: MailyConfig): react.ReactNode;
|
|
226
|
+
/** Renders a Maily JSON document to an HTML string using @react-email/render. */
|
|
227
|
+
declare function render(json: JSONContent, config?: MailyConfig): Promise<string>;
|
|
290
228
|
//#endregion
|
|
291
|
-
export {
|
|
229
|
+
export { BoxModel, ChildContextOptions, CreateRenderContextOptions, MailyConfig, MailyRenderConfig, type MetaDescriptor, NodeRenderer, RenderContext, RenderVariableMap, VariableFormatter, VariableValue, buildConfig, children, defineRenderContext, dispatch, links, markup, render };
|
|
292
230
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/meta.tsx","../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/lib/meta.tsx","../src/config.ts","../src/context.ts","../src/lib/link.ts","../src/node.tsx","../src/render.tsx"],"mappings":";;;;;;;;;;;;KAMY,cAAA;EACN,OAAA;AAAA;EACA,KAAA;AAAA;EACA,IAAA;EAAc,OAAA;AAAA;EACd,QAAA;EAAkB,OAAA;AAAA;EAClB,SAAA;EAAmB,OAAA;AAAA;EACnB,OAAA;EAAA,CAA2B,IAAA;AAAA;EAAA,CAC1B,IAAA;AAAA;;;;;AAPP;;KCQY,iBAAA,IAAqB,IAAA;EAC/B,QAAA;EACA,QAAA;AAAA;;;;;;;;;;KAYU,aAAA,+BAIR,MAAA,oBACA,KAAA,CAAM,MAAA;;KAGE,iBAAA;EACV,KAAA,EAAO,oBAAA;EACP,YAAA,EAAc,cAAA;EAEd,iBAAA,EA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