@blocknote/xl-email-exporter 0.44.2 → 0.46.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/dist/blocknote-xl-email-exporter.js +225 -220
- package/dist/blocknote-xl-email-exporter.js.map +1 -1
- package/dist/blocknote-xl-email-exporter.umd.cjs +1 -1
- package/dist/blocknote-xl-email-exporter.umd.cjs.map +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +4 -3
- package/src/react-email/__snapshots__/reactEmailExporter.test.tsx.snap +15 -15
- package/src/react-email/reactEmailExporter.tsx +26 -5
- package/types/src/react-email/reactEmailExporter.d.ts +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { mapTableCell as
|
|
3
|
-
import { Text as f, Img as
|
|
4
|
-
import { render as
|
|
5
|
-
import
|
|
1
|
+
import { jsx as n, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import { mapTableCell as T, Exporter as V, COLORS_DEFAULT as R } from "@blocknote/core";
|
|
3
|
+
import { Text as f, Img as E, CodeBlock as A, dracula as D, Heading as F, Link as I, Section as W, Html as Z, Head as z, Body as O, Preview as j, Tailwind as _ } from "@react-email/components";
|
|
4
|
+
import { render as N } from "@react-email/render";
|
|
5
|
+
import L from "react";
|
|
6
6
|
const g = {
|
|
7
7
|
fontSize: 16,
|
|
8
8
|
lineHeight: 1.5,
|
|
@@ -75,66 +75,66 @@ const g = {
|
|
|
75
75
|
codeBlock: {
|
|
76
76
|
style: g
|
|
77
77
|
}
|
|
78
|
-
},
|
|
78
|
+
}, k = (r = m) => ({
|
|
79
79
|
paragraph: (e, t) => {
|
|
80
|
-
var
|
|
81
|
-
return /* @__PURE__ */
|
|
80
|
+
var l;
|
|
81
|
+
return /* @__PURE__ */ n(
|
|
82
82
|
f,
|
|
83
83
|
{
|
|
84
|
-
...
|
|
84
|
+
...r.paragraph,
|
|
85
85
|
style: {
|
|
86
86
|
...m.paragraph.style,
|
|
87
|
-
...(
|
|
87
|
+
...(l = r.paragraph) == null ? void 0 : l.style
|
|
88
88
|
},
|
|
89
89
|
children: t.transformInlineContent(e.content)
|
|
90
90
|
}
|
|
91
91
|
);
|
|
92
92
|
},
|
|
93
93
|
bulletListItem: (e, t) => {
|
|
94
|
-
var
|
|
95
|
-
return /* @__PURE__ */
|
|
94
|
+
var l;
|
|
95
|
+
return /* @__PURE__ */ n(
|
|
96
96
|
f,
|
|
97
97
|
{
|
|
98
|
-
...
|
|
98
|
+
...r.bulletListItem,
|
|
99
99
|
style: {
|
|
100
100
|
...m.bulletListItem.style,
|
|
101
|
-
...(
|
|
101
|
+
...(l = r.bulletListItem) == null ? void 0 : l.style
|
|
102
102
|
},
|
|
103
103
|
children: t.transformInlineContent(e.content)
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
106
|
},
|
|
107
107
|
toggleListItem: (e, t) => {
|
|
108
|
-
var
|
|
109
|
-
return /* @__PURE__ */
|
|
108
|
+
var l;
|
|
109
|
+
return /* @__PURE__ */ n(
|
|
110
110
|
f,
|
|
111
111
|
{
|
|
112
|
-
...
|
|
112
|
+
...r.toggleListItem,
|
|
113
113
|
style: {
|
|
114
114
|
...m.toggleListItem.style,
|
|
115
|
-
...(
|
|
115
|
+
...(l = r.toggleListItem) == null ? void 0 : l.style
|
|
116
116
|
},
|
|
117
117
|
children: t.transformInlineContent(e.content)
|
|
118
118
|
}
|
|
119
119
|
);
|
|
120
120
|
},
|
|
121
|
-
numberedListItem: (e, t,
|
|
122
|
-
var
|
|
123
|
-
return /* @__PURE__ */
|
|
121
|
+
numberedListItem: (e, t, l) => {
|
|
122
|
+
var i;
|
|
123
|
+
return /* @__PURE__ */ n(
|
|
124
124
|
f,
|
|
125
125
|
{
|
|
126
|
-
...
|
|
126
|
+
...r.numberedListItem,
|
|
127
127
|
style: {
|
|
128
128
|
...m.numberedListItem.style,
|
|
129
|
-
...(
|
|
129
|
+
...(i = r.numberedListItem) == null ? void 0 : i.style
|
|
130
130
|
},
|
|
131
131
|
children: t.transformInlineContent(e.content)
|
|
132
132
|
}
|
|
133
133
|
);
|
|
134
134
|
},
|
|
135
135
|
checkListItem: (e, t) => {
|
|
136
|
-
var
|
|
137
|
-
const
|
|
136
|
+
var o, a;
|
|
137
|
+
const i = ((o = e.props) == null ? void 0 : o.checked) ? /* @__PURE__ */ h(
|
|
138
138
|
"svg",
|
|
139
139
|
{
|
|
140
140
|
width: "18",
|
|
@@ -142,7 +142,7 @@ const g = {
|
|
|
142
142
|
viewBox: "0 0 18 18",
|
|
143
143
|
style: { display: "inline", verticalAlign: "middle", marginRight: 8 },
|
|
144
144
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ n(
|
|
146
146
|
"rect",
|
|
147
147
|
{
|
|
148
148
|
x: "2",
|
|
@@ -155,7 +155,7 @@ const g = {
|
|
|
155
155
|
strokeWidth: "2"
|
|
156
156
|
}
|
|
157
157
|
),
|
|
158
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ n(
|
|
159
159
|
"polyline",
|
|
160
160
|
{
|
|
161
161
|
points: "5,10 8,13 13,6",
|
|
@@ -166,14 +166,14 @@ const g = {
|
|
|
166
166
|
)
|
|
167
167
|
]
|
|
168
168
|
}
|
|
169
|
-
) : /* @__PURE__ */
|
|
169
|
+
) : /* @__PURE__ */ n(
|
|
170
170
|
"svg",
|
|
171
171
|
{
|
|
172
172
|
width: "18",
|
|
173
173
|
height: "18",
|
|
174
174
|
viewBox: "0 0 18 18",
|
|
175
175
|
style: { display: "inline", verticalAlign: "middle", marginRight: 8 },
|
|
176
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ n(
|
|
177
177
|
"rect",
|
|
178
178
|
{
|
|
179
179
|
x: "2",
|
|
@@ -191,53 +191,53 @@ const g = {
|
|
|
191
191
|
return /* @__PURE__ */ h(
|
|
192
192
|
f,
|
|
193
193
|
{
|
|
194
|
-
...
|
|
194
|
+
...r.checkListItem,
|
|
195
195
|
style: {
|
|
196
196
|
...m.checkListItem.style,
|
|
197
|
-
...(a =
|
|
197
|
+
...(a = r.checkListItem) == null ? void 0 : a.style
|
|
198
198
|
},
|
|
199
199
|
children: [
|
|
200
|
-
|
|
201
|
-
/* @__PURE__ */
|
|
200
|
+
i,
|
|
201
|
+
/* @__PURE__ */ n("span", { children: t.transformInlineContent(e.content) })
|
|
202
202
|
]
|
|
203
203
|
}
|
|
204
204
|
);
|
|
205
205
|
},
|
|
206
206
|
heading: (e, t) => {
|
|
207
|
-
var
|
|
208
|
-
return /* @__PURE__ */
|
|
209
|
-
|
|
207
|
+
var l;
|
|
208
|
+
return /* @__PURE__ */ n(
|
|
209
|
+
F,
|
|
210
210
|
{
|
|
211
211
|
as: `h${e.props.level}`,
|
|
212
|
-
...
|
|
212
|
+
...r[`heading${e.props.level}`],
|
|
213
213
|
style: {
|
|
214
214
|
...m[`heading${e.props.level}`].style,
|
|
215
|
-
...(
|
|
215
|
+
...(l = r[`heading${e.props.level}`]) == null ? void 0 : l.style
|
|
216
216
|
},
|
|
217
217
|
children: t.transformInlineContent(e.content)
|
|
218
218
|
}
|
|
219
219
|
);
|
|
220
220
|
},
|
|
221
221
|
codeBlock: (e) => {
|
|
222
|
-
var
|
|
223
|
-
const t = ((
|
|
224
|
-
return /* @__PURE__ */
|
|
225
|
-
|
|
222
|
+
var l, i;
|
|
223
|
+
const t = ((l = e.content[0]) == null ? void 0 : l.text) || "";
|
|
224
|
+
return /* @__PURE__ */ n(
|
|
225
|
+
A,
|
|
226
226
|
{
|
|
227
227
|
code: t,
|
|
228
228
|
fontFamily: "'CommitMono', monospace",
|
|
229
229
|
language: e.props.language,
|
|
230
|
-
theme:
|
|
231
|
-
...
|
|
230
|
+
theme: D,
|
|
231
|
+
...r.codeBlock,
|
|
232
232
|
style: {
|
|
233
233
|
...m.codeBlock.style,
|
|
234
|
-
...(
|
|
234
|
+
...(i = r.codeBlock) == null ? void 0 : i.style
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
);
|
|
238
238
|
},
|
|
239
239
|
audio: (e) => {
|
|
240
|
-
const t = /* @__PURE__ */
|
|
240
|
+
const t = /* @__PURE__ */ n(
|
|
241
241
|
"svg",
|
|
242
242
|
{
|
|
243
243
|
height: "18",
|
|
@@ -245,12 +245,12 @@ const g = {
|
|
|
245
245
|
viewBox: "0 0 24 24",
|
|
246
246
|
fill: "#4F8A10",
|
|
247
247
|
style: { display: "inline", verticalAlign: "middle" },
|
|
248
|
-
children: /* @__PURE__ */
|
|
248
|
+
children: /* @__PURE__ */ n("path", { d: "M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z" })
|
|
249
249
|
}
|
|
250
|
-
),
|
|
250
|
+
), l = "previewWidth" in e.props ? e.props.previewWidth : void 0;
|
|
251
251
|
return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
|
|
252
|
+
/* @__PURE__ */ n(
|
|
253
|
+
w,
|
|
254
254
|
{
|
|
255
255
|
url: e.props.url,
|
|
256
256
|
name: e.props.name,
|
|
@@ -258,18 +258,18 @@ const g = {
|
|
|
258
258
|
icon: t
|
|
259
259
|
}
|
|
260
260
|
),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
|
|
261
|
+
/* @__PURE__ */ n(
|
|
262
|
+
x,
|
|
263
263
|
{
|
|
264
264
|
caption: e.props.caption,
|
|
265
|
-
width:
|
|
266
|
-
textStyles:
|
|
265
|
+
width: l,
|
|
266
|
+
textStyles: r
|
|
267
267
|
}
|
|
268
268
|
)
|
|
269
269
|
] });
|
|
270
270
|
},
|
|
271
271
|
video: (e) => {
|
|
272
|
-
const t = /* @__PURE__ */
|
|
272
|
+
const t = /* @__PURE__ */ n(
|
|
273
273
|
"svg",
|
|
274
274
|
{
|
|
275
275
|
height: "18",
|
|
@@ -277,12 +277,12 @@ const g = {
|
|
|
277
277
|
viewBox: "0 0 24 24",
|
|
278
278
|
fill: "#1976D2",
|
|
279
279
|
style: { display: "inline", verticalAlign: "middle" },
|
|
280
|
-
children: /* @__PURE__ */
|
|
280
|
+
children: /* @__PURE__ */ n("path", { d: "M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z" })
|
|
281
281
|
}
|
|
282
|
-
),
|
|
282
|
+
), l = "previewWidth" in e.props ? e.props.previewWidth : void 0;
|
|
283
283
|
return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
|
|
284
|
+
/* @__PURE__ */ n(
|
|
285
|
+
w,
|
|
286
286
|
{
|
|
287
287
|
url: e.props.url,
|
|
288
288
|
name: e.props.name,
|
|
@@ -290,18 +290,18 @@ const g = {
|
|
|
290
290
|
icon: t
|
|
291
291
|
}
|
|
292
292
|
),
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
|
|
293
|
+
/* @__PURE__ */ n(
|
|
294
|
+
x,
|
|
295
295
|
{
|
|
296
296
|
caption: e.props.caption,
|
|
297
|
-
width:
|
|
298
|
-
textStyles:
|
|
297
|
+
width: l,
|
|
298
|
+
textStyles: r
|
|
299
299
|
}
|
|
300
300
|
)
|
|
301
301
|
] });
|
|
302
302
|
},
|
|
303
303
|
file: (e) => {
|
|
304
|
-
const t = /* @__PURE__ */
|
|
304
|
+
const t = /* @__PURE__ */ n(
|
|
305
305
|
"svg",
|
|
306
306
|
{
|
|
307
307
|
height: "18",
|
|
@@ -309,12 +309,12 @@ const g = {
|
|
|
309
309
|
viewBox: "0 0 24 24",
|
|
310
310
|
fill: "#888",
|
|
311
311
|
style: { display: "inline", verticalAlign: "middle" },
|
|
312
|
-
children: /* @__PURE__ */
|
|
312
|
+
children: /* @__PURE__ */ n("path", { d: "M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z" })
|
|
313
313
|
}
|
|
314
|
-
),
|
|
314
|
+
), l = "previewWidth" in e.props ? e.props.previewWidth : void 0;
|
|
315
315
|
return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
|
|
316
|
+
/* @__PURE__ */ n(
|
|
317
|
+
w,
|
|
318
318
|
{
|
|
319
319
|
url: e.props.url,
|
|
320
320
|
name: e.props.name,
|
|
@@ -322,18 +322,18 @@ const g = {
|
|
|
322
322
|
icon: t
|
|
323
323
|
}
|
|
324
324
|
),
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
|
|
325
|
+
/* @__PURE__ */ n(
|
|
326
|
+
x,
|
|
327
327
|
{
|
|
328
328
|
caption: e.props.caption,
|
|
329
|
-
width:
|
|
330
|
-
textStyles:
|
|
329
|
+
width: l,
|
|
330
|
+
textStyles: r
|
|
331
331
|
}
|
|
332
332
|
)
|
|
333
333
|
] });
|
|
334
334
|
},
|
|
335
|
-
image: (e) => /* @__PURE__ */
|
|
336
|
-
|
|
335
|
+
image: (e) => /* @__PURE__ */ n(
|
|
336
|
+
E,
|
|
337
337
|
{
|
|
338
338
|
src: e.props.url,
|
|
339
339
|
width: e.props.previewWidth,
|
|
@@ -341,11 +341,11 @@ const g = {
|
|
|
341
341
|
}
|
|
342
342
|
),
|
|
343
343
|
table: (e, t) => {
|
|
344
|
-
const
|
|
345
|
-
if (!
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
const
|
|
348
|
-
return /* @__PURE__ */
|
|
344
|
+
const l = e.content;
|
|
345
|
+
if (!l || typeof l != "object" || !Array.isArray(l.rows))
|
|
346
|
+
return /* @__PURE__ */ n(f, { ...r.tableError, children: "Table data not available" });
|
|
347
|
+
const i = l.headerRows ?? 0, o = l.headerCols ?? 0;
|
|
348
|
+
return /* @__PURE__ */ n(
|
|
349
349
|
"table",
|
|
350
350
|
{
|
|
351
351
|
style: {
|
|
@@ -359,42 +359,42 @@ const g = {
|
|
|
359
359
|
border: 0,
|
|
360
360
|
cellPadding: 0,
|
|
361
361
|
cellSpacing: 0,
|
|
362
|
-
children: /* @__PURE__ */
|
|
363
|
-
var
|
|
364
|
-
const
|
|
365
|
-
return /* @__PURE__ */
|
|
362
|
+
children: /* @__PURE__ */ n("tbody", { children: l.rows.map((a, s) => /* @__PURE__ */ n("tr", { children: a.cells.map((u, c) => {
|
|
363
|
+
var v;
|
|
364
|
+
const d = T(u), p = s < i, b = c < o, C = p || b;
|
|
365
|
+
return /* @__PURE__ */ n(
|
|
366
366
|
C ? "th" : "td",
|
|
367
367
|
{
|
|
368
368
|
style: {
|
|
369
369
|
border: "1px solid #ddd",
|
|
370
370
|
padding: "8px 12px",
|
|
371
|
-
background:
|
|
371
|
+
background: d.props.backgroundColor !== "default" ? t.options.colors[d.props.backgroundColor].background : "inherit",
|
|
372
372
|
fontWeight: C ? "bold" : void 0,
|
|
373
|
-
textAlign:
|
|
374
|
-
color:
|
|
373
|
+
textAlign: d.props.textAlignment || "left",
|
|
374
|
+
color: d.props.textColor !== "default" ? t.options.colors[d.props.textColor].text : "inherit",
|
|
375
375
|
...m.tableCell.style,
|
|
376
|
-
...(
|
|
376
|
+
...(v = r.tableCell) == null ? void 0 : v.style
|
|
377
377
|
},
|
|
378
|
-
...(
|
|
379
|
-
colSpan:
|
|
378
|
+
...(d.props.colspan || 1) > 1 && {
|
|
379
|
+
colSpan: d.props.colspan || 1
|
|
380
380
|
},
|
|
381
|
-
...(
|
|
382
|
-
rowSpan:
|
|
381
|
+
...(d.props.rowspan || 1) > 1 && {
|
|
382
|
+
rowSpan: d.props.rowspan || 1
|
|
383
383
|
},
|
|
384
|
-
children: t.transformInlineContent(
|
|
384
|
+
children: t.transformInlineContent(d.content)
|
|
385
385
|
},
|
|
386
|
-
"row_" +
|
|
386
|
+
"row_" + s + "_col_" + c
|
|
387
387
|
);
|
|
388
|
-
}) }, "row-" +
|
|
388
|
+
}) }, "row-" + s)) })
|
|
389
389
|
}
|
|
390
390
|
);
|
|
391
391
|
},
|
|
392
392
|
quote: (e, t) => {
|
|
393
|
-
var
|
|
394
|
-
return /* @__PURE__ */
|
|
393
|
+
var l;
|
|
394
|
+
return /* @__PURE__ */ n(
|
|
395
395
|
f,
|
|
396
396
|
{
|
|
397
|
-
...
|
|
397
|
+
...r.quote,
|
|
398
398
|
style: {
|
|
399
399
|
borderLeft: "2px solid #bdbdbd",
|
|
400
400
|
padding: "0px 12px",
|
|
@@ -402,13 +402,13 @@ const g = {
|
|
|
402
402
|
color: t.options.colors.gray.text,
|
|
403
403
|
display: "block",
|
|
404
404
|
...m.quote.style,
|
|
405
|
-
...(
|
|
405
|
+
...(l = r.quote) == null ? void 0 : l.style
|
|
406
406
|
},
|
|
407
407
|
children: t.transformInlineContent(e.content)
|
|
408
408
|
}
|
|
409
409
|
);
|
|
410
410
|
},
|
|
411
|
-
pageBreak: () => /* @__PURE__ */
|
|
411
|
+
pageBreak: () => /* @__PURE__ */ n(
|
|
412
412
|
"hr",
|
|
413
413
|
{
|
|
414
414
|
style: {
|
|
@@ -418,7 +418,7 @@ const g = {
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
),
|
|
421
|
-
divider: () => /* @__PURE__ */
|
|
421
|
+
divider: () => /* @__PURE__ */ n(
|
|
422
422
|
"hr",
|
|
423
423
|
{
|
|
424
424
|
style: {
|
|
@@ -428,17 +428,17 @@ const g = {
|
|
|
428
428
|
}
|
|
429
429
|
}
|
|
430
430
|
)
|
|
431
|
-
}), P =
|
|
432
|
-
function
|
|
433
|
-
url:
|
|
431
|
+
}), P = k();
|
|
432
|
+
function w({
|
|
433
|
+
url: r,
|
|
434
434
|
name: e,
|
|
435
435
|
defaultText: t,
|
|
436
|
-
icon:
|
|
436
|
+
icon: l
|
|
437
437
|
}) {
|
|
438
438
|
return /* @__PURE__ */ h(
|
|
439
|
-
|
|
439
|
+
I,
|
|
440
440
|
{
|
|
441
|
-
href:
|
|
441
|
+
href: r,
|
|
442
442
|
style: {
|
|
443
443
|
textDecoration: "none",
|
|
444
444
|
color: "#333",
|
|
@@ -448,19 +448,19 @@ function x({
|
|
|
448
448
|
fontSize: 16
|
|
449
449
|
},
|
|
450
450
|
children: [
|
|
451
|
-
|
|
452
|
-
/* @__PURE__ */
|
|
451
|
+
l,
|
|
452
|
+
/* @__PURE__ */ n("span", { style: { verticalAlign: "middle" }, children: e || t })
|
|
453
453
|
]
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
456
|
}
|
|
457
|
-
function
|
|
458
|
-
caption:
|
|
457
|
+
function x({
|
|
458
|
+
caption: r,
|
|
459
459
|
width: e,
|
|
460
460
|
textStyles: t
|
|
461
461
|
}) {
|
|
462
|
-
var
|
|
463
|
-
return
|
|
462
|
+
var l;
|
|
463
|
+
return r ? /* @__PURE__ */ n(
|
|
464
464
|
f,
|
|
465
465
|
{
|
|
466
466
|
...t.caption,
|
|
@@ -470,20 +470,20 @@ function b({
|
|
|
470
470
|
color: "#888",
|
|
471
471
|
margin: "4px 0 0 0",
|
|
472
472
|
...m.caption.style,
|
|
473
|
-
...(
|
|
473
|
+
...(l = t.caption) == null ? void 0 : l.style
|
|
474
474
|
},
|
|
475
|
-
children:
|
|
475
|
+
children: r
|
|
476
476
|
}
|
|
477
477
|
) : null;
|
|
478
478
|
}
|
|
479
|
-
const
|
|
479
|
+
const H = {
|
|
480
480
|
link: {}
|
|
481
|
-
},
|
|
482
|
-
link: (e, t) => /* @__PURE__ */ h(
|
|
483
|
-
...e.content.map((
|
|
481
|
+
}, S = (r = H) => ({
|
|
482
|
+
link: (e, t) => /* @__PURE__ */ h(I, { href: e.href, ...r.link, children: [
|
|
483
|
+
...e.content.map((l) => t.transformStyledText(l))
|
|
484
484
|
] }),
|
|
485
485
|
text: (e, t) => t.transformStyledText(e)
|
|
486
|
-
}), q =
|
|
486
|
+
}), q = S(), M = {}, B = (r = M) => ({
|
|
487
487
|
bold: (e) => e ? {
|
|
488
488
|
fontWeight: "bold"
|
|
489
489
|
} : {},
|
|
@@ -506,170 +506,171 @@ const S = {
|
|
|
506
506
|
code: (e) => e ? {
|
|
507
507
|
fontFamily: "GeistMono"
|
|
508
508
|
} : {}
|
|
509
|
-
}), $ =
|
|
509
|
+
}), $ = B(), G = {
|
|
510
510
|
textStyles: m,
|
|
511
|
-
linkStyles:
|
|
512
|
-
styleTransformStyles:
|
|
511
|
+
linkStyles: H,
|
|
512
|
+
styleTransformStyles: M
|
|
513
513
|
}, Y = {
|
|
514
514
|
blockMapping: P,
|
|
515
515
|
inlineContentMapping: q,
|
|
516
516
|
styleMapping: $
|
|
517
|
-
}, ee = (
|
|
518
|
-
blockMapping:
|
|
519
|
-
|
|
517
|
+
}, ee = (r = G) => ({
|
|
518
|
+
blockMapping: k(
|
|
519
|
+
r.textStyles
|
|
520
520
|
),
|
|
521
|
-
inlineContentMapping:
|
|
522
|
-
|
|
521
|
+
inlineContentMapping: S(
|
|
522
|
+
r.linkStyles
|
|
523
523
|
),
|
|
524
|
-
styleMapping:
|
|
525
|
-
|
|
524
|
+
styleMapping: B(
|
|
525
|
+
r.styleTransformStyles
|
|
526
526
|
)
|
|
527
527
|
});
|
|
528
|
-
class te extends
|
|
529
|
-
constructor(e, t,
|
|
530
|
-
const
|
|
528
|
+
class te extends V {
|
|
529
|
+
constructor(e, t, l) {
|
|
530
|
+
const o = {
|
|
531
531
|
...{
|
|
532
532
|
colors: R
|
|
533
533
|
},
|
|
534
|
-
...
|
|
534
|
+
...l
|
|
535
535
|
};
|
|
536
|
-
super(e, t,
|
|
536
|
+
super(e, t, o), this.schema = e;
|
|
537
537
|
}
|
|
538
538
|
transformStyledText(e) {
|
|
539
|
-
const t = this.mapStyles(e.styles),
|
|
540
|
-
return /* @__PURE__ */
|
|
539
|
+
const t = this.mapStyles(e.styles), l = Object.assign({}, ...t);
|
|
540
|
+
return /* @__PURE__ */ n(
|
|
541
541
|
"span",
|
|
542
542
|
{
|
|
543
|
-
style:
|
|
543
|
+
style: l,
|
|
544
544
|
dangerouslySetInnerHTML: {
|
|
545
545
|
__html: e.text.replace(/\n/g, "<br />")
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
);
|
|
549
549
|
}
|
|
550
|
-
async renderGroupedListBlocks(e, t,
|
|
551
|
-
const
|
|
550
|
+
async renderGroupedListBlocks(e, t, l) {
|
|
551
|
+
const i = e[t].type, o = [];
|
|
552
552
|
let a = t;
|
|
553
|
-
for (let u = 1; a < e.length && e[a].type ===
|
|
554
|
-
const
|
|
555
|
-
|
|
556
|
-
|
|
553
|
+
for (let u = 1; a < e.length && e[a].type === i; a++, u++) {
|
|
554
|
+
const c = e[a], d = await this.mapBlock(
|
|
555
|
+
c,
|
|
556
|
+
l,
|
|
557
557
|
u
|
|
558
558
|
);
|
|
559
|
-
let
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
)),
|
|
559
|
+
let p = [];
|
|
560
|
+
c.children && c.children.length > 0 && (p = await this.renderNestedLists(
|
|
561
|
+
c.children,
|
|
562
|
+
l + 1,
|
|
563
|
+
c.id
|
|
564
|
+
)), o.push(
|
|
565
565
|
/* @__PURE__ */ h("li", { children: [
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
] },
|
|
566
|
+
d,
|
|
567
|
+
p.length > 0 && p
|
|
568
|
+
] }, c.id)
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
|
-
let
|
|
572
|
-
return
|
|
571
|
+
let s;
|
|
572
|
+
return i === "bulletListItem" || i === "toggleListItem" ? s = /* @__PURE__ */ n("ul", { className: "mb-2 list-disc pl-6", children: o }, e[t].id + "-ul") : s = /* @__PURE__ */ n(
|
|
573
573
|
"ol",
|
|
574
574
|
{
|
|
575
575
|
className: "mb-2 list-decimal pl-6",
|
|
576
576
|
start: 1,
|
|
577
|
-
children:
|
|
577
|
+
children: o
|
|
578
578
|
},
|
|
579
579
|
e[t].id + "-ol"
|
|
580
|
-
), { element:
|
|
580
|
+
), { element: s, nextIndex: a };
|
|
581
581
|
}
|
|
582
|
-
async renderNestedLists(e, t,
|
|
583
|
-
const
|
|
584
|
-
let
|
|
585
|
-
for (;
|
|
586
|
-
const a = e[
|
|
582
|
+
async renderNestedLists(e, t, l) {
|
|
583
|
+
const i = [];
|
|
584
|
+
let o = 0;
|
|
585
|
+
for (; o < e.length; ) {
|
|
586
|
+
const a = e[o];
|
|
587
587
|
if (a.type === "bulletListItem" || a.type === "numberedListItem") {
|
|
588
|
-
const
|
|
589
|
-
let
|
|
590
|
-
for (let
|
|
591
|
-
const
|
|
592
|
-
|
|
588
|
+
const s = a.type, u = [];
|
|
589
|
+
let c = o;
|
|
590
|
+
for (let d = 1; c < e.length && e[c].type === s; c++, d++) {
|
|
591
|
+
const p = e[c], b = await this.mapBlock(
|
|
592
|
+
p,
|
|
593
593
|
t,
|
|
594
|
-
|
|
594
|
+
d
|
|
595
595
|
), C = this.blocknoteDefaultPropsToReactEmailStyle(
|
|
596
|
-
|
|
596
|
+
p.props
|
|
597
597
|
);
|
|
598
598
|
let y = [];
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
p.children && p.children.length > 0 && (p.children[0] && (p.children[0].type === "bulletListItem" || p.children[0].type === "numberedListItem") ? y = await this.renderNestedLists(
|
|
600
|
+
p.children,
|
|
601
601
|
t + 1,
|
|
602
|
-
|
|
602
|
+
p.id
|
|
603
603
|
) : y = await this.transformBlocks(
|
|
604
|
-
|
|
604
|
+
p.children,
|
|
605
605
|
t + 1
|
|
606
606
|
)), u.push(
|
|
607
607
|
/* @__PURE__ */ h("li", { style: C, children: [
|
|
608
|
-
|
|
609
|
-
y.length > 0 && /* @__PURE__ */
|
|
610
|
-
] },
|
|
608
|
+
b,
|
|
609
|
+
y.length > 0 && /* @__PURE__ */ n("div", { style: { marginTop: "8px" }, children: y })
|
|
610
|
+
] }, p.id)
|
|
611
611
|
);
|
|
612
612
|
}
|
|
613
|
-
|
|
614
|
-
/* @__PURE__ */
|
|
613
|
+
s === "bulletListItem" ? i.push(
|
|
614
|
+
/* @__PURE__ */ n(
|
|
615
615
|
"ul",
|
|
616
616
|
{
|
|
617
617
|
className: "mb-2 list-disc pl-6",
|
|
618
618
|
children: u
|
|
619
619
|
},
|
|
620
|
-
|
|
620
|
+
l + "-ul-nested-" + o
|
|
621
621
|
)
|
|
622
|
-
) :
|
|
623
|
-
/* @__PURE__ */
|
|
622
|
+
) : i.push(
|
|
623
|
+
/* @__PURE__ */ n(
|
|
624
624
|
"ol",
|
|
625
625
|
{
|
|
626
626
|
className: "mb-2 list-decimal pl-6",
|
|
627
627
|
start: 1,
|
|
628
628
|
children: u
|
|
629
629
|
},
|
|
630
|
-
|
|
630
|
+
l + "-ol-nested-" + o
|
|
631
631
|
)
|
|
632
|
-
),
|
|
632
|
+
), o = c;
|
|
633
633
|
} else {
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
/* @__PURE__ */
|
|
637
|
-
),
|
|
634
|
+
const s = await this.transformBlocks([a], t);
|
|
635
|
+
i.push(
|
|
636
|
+
/* @__PURE__ */ n(W, { style: { marginLeft: "24px" }, children: s }, a.id)
|
|
637
|
+
), o++;
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
|
-
return
|
|
640
|
+
return i;
|
|
641
641
|
}
|
|
642
642
|
async transformBlocks(e, t = 0) {
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
for (;
|
|
646
|
-
const
|
|
647
|
-
if (
|
|
648
|
-
const { element:
|
|
643
|
+
const l = [];
|
|
644
|
+
let i = 0;
|
|
645
|
+
for (; i < e.length; ) {
|
|
646
|
+
const o = e[i];
|
|
647
|
+
if (o.type === "bulletListItem" || o.type === "numberedListItem" || o.type === "toggleListItem") {
|
|
648
|
+
const { element: c, nextIndex: d } = await this.renderGroupedListBlocks(
|
|
649
649
|
e,
|
|
650
|
-
|
|
650
|
+
i,
|
|
651
651
|
t
|
|
652
652
|
);
|
|
653
|
-
|
|
653
|
+
l.push(c), i = d;
|
|
654
654
|
continue;
|
|
655
655
|
}
|
|
656
|
-
const a = await this.transformBlocks(
|
|
657
|
-
|
|
658
|
-
/* @__PURE__ */ h(
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
a.length > 0 && /* @__PURE__ */
|
|
661
|
-
] },
|
|
662
|
-
),
|
|
656
|
+
const a = await this.transformBlocks(o.children, t + 1), s = await this.mapBlock(o, t, 0), u = this.blocknoteDefaultPropsToReactEmailStyle(o.props);
|
|
657
|
+
l.push(
|
|
658
|
+
/* @__PURE__ */ h(L.Fragment, { children: [
|
|
659
|
+
Object.entries(u).length > 0 ? /* @__PURE__ */ n("div", { style: u, children: s }) : s,
|
|
660
|
+
a.length > 0 && /* @__PURE__ */ n("div", { style: { marginLeft: "24px" }, children: a })
|
|
661
|
+
] }, o.id)
|
|
662
|
+
), i++;
|
|
663
663
|
}
|
|
664
|
-
return
|
|
664
|
+
return l;
|
|
665
665
|
}
|
|
666
666
|
async toReactEmailDocument(e, t) {
|
|
667
|
-
const
|
|
668
|
-
|
|
667
|
+
const l = await this.transformBlocks(e), i = (t == null ? void 0 : t.container) || (({ children: s }) => /* @__PURE__ */ n(L.Fragment, { children: s })), o = !globalThis.ReadableByteStreamController;
|
|
668
|
+
o && (globalThis.ReadableByteStreamController = (await import("web-streams-polyfill")).default.ReadableByteStreamController);
|
|
669
|
+
const a = await N(
|
|
669
670
|
/* @__PURE__ */ h(Z, { children: [
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ n(z, { children: t == null ? void 0 : t.head }),
|
|
671
672
|
/* @__PURE__ */ h(
|
|
672
|
-
|
|
673
|
+
O,
|
|
673
674
|
{
|
|
674
675
|
style: (t == null ? void 0 : t.bodyStyles) ?? {
|
|
675
676
|
fontFamily: "'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif",
|
|
@@ -678,10 +679,10 @@ class te extends E {
|
|
|
678
679
|
color: "#333"
|
|
679
680
|
},
|
|
680
681
|
children: [
|
|
681
|
-
(t == null ? void 0 : t.preview) && /* @__PURE__ */
|
|
682
|
-
/* @__PURE__ */
|
|
682
|
+
(t == null ? void 0 : t.preview) && /* @__PURE__ */ n(j, { children: t.preview }),
|
|
683
|
+
/* @__PURE__ */ n(_, { children: /* @__PURE__ */ h(i, { children: [
|
|
683
684
|
t == null ? void 0 : t.header,
|
|
684
|
-
|
|
685
|
+
l,
|
|
685
686
|
t == null ? void 0 : t.footer
|
|
686
687
|
] }) })
|
|
687
688
|
]
|
|
@@ -689,25 +690,29 @@ class te extends E {
|
|
|
689
690
|
)
|
|
690
691
|
] })
|
|
691
692
|
);
|
|
693
|
+
return o && delete globalThis.ReadableByteStreamController, a;
|
|
692
694
|
}
|
|
693
695
|
blocknoteDefaultPropsToReactEmailStyle(e) {
|
|
694
|
-
var
|
|
695
|
-
|
|
696
|
-
textAlign: e.textAlignment,
|
|
697
|
-
backgroundColor: e.backgroundColor === "default" || !e.backgroundColor || (
|
|
698
|
-
color: e.textColor === "default" || !e.textColor || (
|
|
696
|
+
var l, i;
|
|
697
|
+
const t = {
|
|
698
|
+
textAlign: e.textAlignment === "left" ? void 0 : e.textAlignment,
|
|
699
|
+
backgroundColor: e.backgroundColor === "default" || !e.backgroundColor || (l = this.options.colors[e.backgroundColor]) == null ? void 0 : l.background,
|
|
700
|
+
color: e.textColor === "default" || !e.textColor || (i = this.options.colors[e.textColor]) == null ? void 0 : i.text,
|
|
699
701
|
alignItems: e.textAlignment === "right" ? "flex-end" : e.textAlignment === "center" ? "center" : void 0
|
|
700
702
|
};
|
|
703
|
+
return Object.fromEntries(
|
|
704
|
+
Object.entries(t).filter(([o, a]) => a !== void 0)
|
|
705
|
+
);
|
|
701
706
|
}
|
|
702
707
|
}
|
|
703
708
|
export {
|
|
704
709
|
te as ReactEmailExporter,
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
710
|
+
k as createReactEmailBlockMappingForDefaultSchema,
|
|
711
|
+
S as createReactEmailInlineContentMappingForDefaultSchema,
|
|
712
|
+
B as createReactEmailStyleMappingForDefaultSchema,
|
|
708
713
|
G as defaultReactEmailDefaultSchemaStyles,
|
|
709
|
-
|
|
710
|
-
|
|
714
|
+
H as defaultReactEmailLinkStyles,
|
|
715
|
+
M as defaultReactEmailStyleTransformStyles,
|
|
711
716
|
m as defaultReactEmailTextStyles,
|
|
712
717
|
P as reactEmailBlockMappingForDefaultSchema,
|
|
713
718
|
Y as reactEmailDefaultSchemaMappings,
|