@blocknote/xl-email-exporter 0.34.0 → 0.36.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.
@@ -1,16 +1,140 @@
1
- import { jsx as r, jsxs as c } from "react/jsx-runtime";
2
- import { mapTableCell as b, Exporter as L, COLORS_DEFAULT as V } from "@blocknote/core";
3
- import { Text as u, Img as I, CodeBlock as S, dracula as k, Heading as M, Link as H, Section as w, Html as B, Head as A, Body as T, Preview as F, Tailwind as W, Container as Z } from "@react-email/components";
4
- import { render as D } from "@react-email/render";
1
+ import { jsx as l, jsxs as h } from "react/jsx-runtime";
2
+ import { mapTableCell as T, Exporter as E, COLORS_DEFAULT as R } from "@blocknote/core";
3
+ import { Text as f, Img as A, CodeBlock as D, dracula as F, Heading as W, Link as k, Section as I, Html as Z, Head as z, Body as N, Preview as _, Tailwind as O } from "@react-email/components";
4
+ import { render as j } from "@react-email/render";
5
5
  import v from "react";
6
- const R = {
7
- paragraph: (e, t) => /* @__PURE__ */ r(u, { children: t.transformInlineContent(e.content) }),
8
- bulletListItem: (e, t) => /* @__PURE__ */ r(u, { children: t.transformInlineContent(e.content) }),
9
- toggleListItem: (e, t) => /* @__PURE__ */ r(u, { children: t.transformInlineContent(e.content) }),
10
- numberedListItem: (e, t, n) => /* @__PURE__ */ r(u, { children: t.transformInlineContent(e.content) }),
6
+ const g = {
7
+ fontSize: 16,
8
+ lineHeight: 1.5,
9
+ margin: 3,
10
+ minHeight: 24
11
+ }, m = {
12
+ paragraph: {
13
+ style: g
14
+ },
15
+ bulletListItem: {
16
+ style: g
17
+ },
18
+ toggleListItem: {
19
+ style: g
20
+ },
21
+ numberedListItem: {
22
+ style: g
23
+ },
24
+ checkListItem: {
25
+ style: g
26
+ },
27
+ quote: {
28
+ style: g
29
+ },
30
+ tableError: {
31
+ style: g
32
+ },
33
+ tableCell: {
34
+ style: g
35
+ },
36
+ caption: {
37
+ style: g
38
+ },
39
+ heading1: {
40
+ style: {
41
+ fontSize: 48,
42
+ margin: 3
43
+ }
44
+ },
45
+ heading2: {
46
+ style: {
47
+ fontSize: 36,
48
+ margin: 3
49
+ }
50
+ },
51
+ heading3: {
52
+ style: {
53
+ fontSize: 24,
54
+ margin: 3
55
+ }
56
+ },
57
+ heading4: {
58
+ style: {
59
+ fontSize: 20,
60
+ margin: 3
61
+ }
62
+ },
63
+ heading5: {
64
+ style: {
65
+ fontSize: 18,
66
+ margin: 3
67
+ }
68
+ },
69
+ heading6: {
70
+ style: {
71
+ fontSize: 16,
72
+ margin: 3
73
+ }
74
+ },
75
+ codeBlock: {
76
+ style: g
77
+ }
78
+ }, H = (r = m) => ({
79
+ paragraph: (e, t) => {
80
+ var n;
81
+ return /* @__PURE__ */ l(
82
+ f,
83
+ {
84
+ ...r.paragraph,
85
+ style: {
86
+ ...m.paragraph.style,
87
+ ...(n = r.paragraph) == null ? void 0 : n.style
88
+ },
89
+ children: t.transformInlineContent(e.content)
90
+ }
91
+ );
92
+ },
93
+ bulletListItem: (e, t) => {
94
+ var n;
95
+ return /* @__PURE__ */ l(
96
+ f,
97
+ {
98
+ ...r.bulletListItem,
99
+ style: {
100
+ ...m.bulletListItem.style,
101
+ ...(n = r.bulletListItem) == null ? void 0 : n.style
102
+ },
103
+ children: t.transformInlineContent(e.content)
104
+ }
105
+ );
106
+ },
107
+ toggleListItem: (e, t) => {
108
+ var n;
109
+ return /* @__PURE__ */ l(
110
+ f,
111
+ {
112
+ ...r.toggleListItem,
113
+ style: {
114
+ ...m.toggleListItem.style,
115
+ ...(n = r.toggleListItem) == null ? void 0 : n.style
116
+ },
117
+ children: t.transformInlineContent(e.content)
118
+ }
119
+ );
120
+ },
121
+ numberedListItem: (e, t, n) => {
122
+ var o;
123
+ return /* @__PURE__ */ l(
124
+ f,
125
+ {
126
+ ...r.numberedListItem,
127
+ style: {
128
+ ...m.numberedListItem.style,
129
+ ...(o = r.numberedListItem) == null ? void 0 : o.style
130
+ },
131
+ children: t.transformInlineContent(e.content)
132
+ }
133
+ );
134
+ },
11
135
  checkListItem: (e, t) => {
12
- var s;
13
- const o = ((s = e.props) == null ? void 0 : s.checked) ? /* @__PURE__ */ c(
136
+ var i, s;
137
+ const o = ((i = e.props) == null ? void 0 : i.checked) ? /* @__PURE__ */ h(
14
138
  "svg",
15
139
  {
16
140
  width: "18",
@@ -18,7 +142,7 @@ const R = {
18
142
  viewBox: "0 0 18 18",
19
143
  style: { display: "inline", verticalAlign: "middle", marginRight: 8 },
20
144
  children: [
21
- /* @__PURE__ */ r(
145
+ /* @__PURE__ */ l(
22
146
  "rect",
23
147
  {
24
148
  x: "2",
@@ -31,7 +155,7 @@ const R = {
31
155
  strokeWidth: "2"
32
156
  }
33
157
  ),
34
- /* @__PURE__ */ r(
158
+ /* @__PURE__ */ l(
35
159
  "polyline",
36
160
  {
37
161
  points: "5,10 8,13 13,6",
@@ -42,14 +166,14 @@ const R = {
42
166
  )
43
167
  ]
44
168
  }
45
- ) : /* @__PURE__ */ r(
169
+ ) : /* @__PURE__ */ l(
46
170
  "svg",
47
171
  {
48
172
  width: "18",
49
173
  height: "18",
50
174
  viewBox: "0 0 18 18",
51
175
  style: { display: "inline", verticalAlign: "middle", marginRight: 8 },
52
- children: /* @__PURE__ */ r(
176
+ children: /* @__PURE__ */ l(
53
177
  "rect",
54
178
  {
55
179
  x: "2",
@@ -64,27 +188,56 @@ const R = {
64
188
  )
65
189
  }
66
190
  );
67
- return /* @__PURE__ */ c(u, { children: [
68
- o,
69
- /* @__PURE__ */ r("span", { children: t.transformInlineContent(e.content) })
70
- ] });
191
+ return /* @__PURE__ */ h(
192
+ f,
193
+ {
194
+ ...r.checkListItem,
195
+ style: {
196
+ ...m.checkListItem.style,
197
+ ...(s = r.checkListItem) == null ? void 0 : s.style
198
+ },
199
+ children: [
200
+ o,
201
+ /* @__PURE__ */ l("span", { children: t.transformInlineContent(e.content) })
202
+ ]
203
+ }
204
+ );
71
205
  },
72
- heading: (e, t) => /* @__PURE__ */ r(M, { as: `h${e.props.level}`, children: t.transformInlineContent(e.content) }),
73
- codeBlock: (e) => {
206
+ heading: (e, t) => {
74
207
  var n;
208
+ return /* @__PURE__ */ l(
209
+ W,
210
+ {
211
+ as: `h${e.props.level}`,
212
+ ...r[`heading${e.props.level}`],
213
+ style: {
214
+ ...m[`heading${e.props.level}`].style,
215
+ ...(n = r[`heading${e.props.level}`]) == null ? void 0 : n.style
216
+ },
217
+ children: t.transformInlineContent(e.content)
218
+ }
219
+ );
220
+ },
221
+ codeBlock: (e) => {
222
+ var n, o;
75
223
  const t = ((n = e.content[0]) == null ? void 0 : n.text) || "";
76
- return /* @__PURE__ */ r(
77
- S,
224
+ return /* @__PURE__ */ l(
225
+ D,
78
226
  {
79
227
  code: t,
80
228
  fontFamily: "'CommitMono', monospace",
81
229
  language: e.props.language,
82
- theme: k
230
+ theme: F,
231
+ ...r.codeBlock,
232
+ style: {
233
+ ...m.codeBlock.style,
234
+ ...(o = r.codeBlock) == null ? void 0 : o.style
235
+ }
83
236
  }
84
237
  );
85
238
  },
86
239
  audio: (e) => {
87
- const t = /* @__PURE__ */ r(
240
+ const t = /* @__PURE__ */ l(
88
241
  "svg",
89
242
  {
90
243
  height: "18",
@@ -92,12 +245,12 @@ const R = {
92
245
  viewBox: "0 0 24 24",
93
246
  fill: "#4F8A10",
94
247
  style: { display: "inline", verticalAlign: "middle" },
95
- children: /* @__PURE__ */ r("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" })
248
+ children: /* @__PURE__ */ l("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" })
96
249
  }
97
250
  ), n = "previewWidth" in e.props ? e.props.previewWidth : void 0;
98
- return /* @__PURE__ */ c("div", { style: { margin: "8px 0" }, children: [
99
- /* @__PURE__ */ r(
100
- y,
251
+ return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
252
+ /* @__PURE__ */ l(
253
+ x,
101
254
  {
102
255
  url: e.props.url,
103
256
  name: e.props.name,
@@ -105,11 +258,18 @@ const R = {
105
258
  icon: t
106
259
  }
107
260
  ),
108
- /* @__PURE__ */ r(C, { caption: e.props.caption, width: n })
261
+ /* @__PURE__ */ l(
262
+ L,
263
+ {
264
+ caption: e.props.caption,
265
+ width: n,
266
+ textStyles: r
267
+ }
268
+ )
109
269
  ] });
110
270
  },
111
271
  video: (e) => {
112
- const t = /* @__PURE__ */ r(
272
+ const t = /* @__PURE__ */ l(
113
273
  "svg",
114
274
  {
115
275
  height: "18",
@@ -117,12 +277,12 @@ const R = {
117
277
  viewBox: "0 0 24 24",
118
278
  fill: "#1976D2",
119
279
  style: { display: "inline", verticalAlign: "middle" },
120
- children: /* @__PURE__ */ r("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" })
280
+ children: /* @__PURE__ */ l("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" })
121
281
  }
122
282
  ), n = "previewWidth" in e.props ? e.props.previewWidth : void 0;
123
- return /* @__PURE__ */ c("div", { style: { margin: "8px 0" }, children: [
124
- /* @__PURE__ */ r(
125
- y,
283
+ return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
284
+ /* @__PURE__ */ l(
285
+ x,
126
286
  {
127
287
  url: e.props.url,
128
288
  name: e.props.name,
@@ -130,11 +290,18 @@ const R = {
130
290
  icon: t
131
291
  }
132
292
  ),
133
- /* @__PURE__ */ r(C, { caption: e.props.caption, width: n })
293
+ /* @__PURE__ */ l(
294
+ L,
295
+ {
296
+ caption: e.props.caption,
297
+ width: n,
298
+ textStyles: r
299
+ }
300
+ )
134
301
  ] });
135
302
  },
136
303
  file: (e) => {
137
- const t = /* @__PURE__ */ r(
304
+ const t = /* @__PURE__ */ l(
138
305
  "svg",
139
306
  {
140
307
  height: "18",
@@ -142,12 +309,12 @@ const R = {
142
309
  viewBox: "0 0 24 24",
143
310
  fill: "#888",
144
311
  style: { display: "inline", verticalAlign: "middle" },
145
- children: /* @__PURE__ */ r("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" })
312
+ children: /* @__PURE__ */ l("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" })
146
313
  }
147
314
  ), n = "previewWidth" in e.props ? e.props.previewWidth : void 0;
148
- return /* @__PURE__ */ c("div", { style: { margin: "8px 0" }, children: [
149
- /* @__PURE__ */ r(
150
- y,
315
+ return /* @__PURE__ */ h("div", { style: { margin: "8px 0" }, children: [
316
+ /* @__PURE__ */ l(
317
+ x,
151
318
  {
152
319
  url: e.props.url,
153
320
  name: e.props.name,
@@ -155,11 +322,18 @@ const R = {
155
322
  icon: t
156
323
  }
157
324
  ),
158
- /* @__PURE__ */ r(C, { caption: e.props.caption, width: n })
325
+ /* @__PURE__ */ l(
326
+ L,
327
+ {
328
+ caption: e.props.caption,
329
+ width: n,
330
+ textStyles: r
331
+ }
332
+ )
159
333
  ] });
160
334
  },
161
- image: (e) => /* @__PURE__ */ r(
162
- I,
335
+ image: (e) => /* @__PURE__ */ l(
336
+ A,
163
337
  {
164
338
  src: e.props.url,
165
339
  width: e.props.previewWidth,
@@ -169,9 +343,9 @@ const R = {
169
343
  table: (e, t) => {
170
344
  const n = e.content;
171
345
  if (!n || typeof n != "object" || !Array.isArray(n.rows))
172
- return /* @__PURE__ */ r(u, { children: "Table data not available" });
173
- const o = n.headerRows ?? 0, s = n.headerCols ?? 0;
174
- return /* @__PURE__ */ r(
346
+ return /* @__PURE__ */ l(f, { ...r.tableError, children: "Table data not available" });
347
+ const o = n.headerRows ?? 0, i = n.headerCols ?? 0;
348
+ return /* @__PURE__ */ l(
175
349
  "table",
176
350
  {
177
351
  style: {
@@ -185,49 +359,56 @@ const R = {
185
359
  border: 0,
186
360
  cellPadding: 0,
187
361
  cellSpacing: 0,
188
- children: /* @__PURE__ */ r("tbody", { children: n.rows.map((l, a) => /* @__PURE__ */ r("tr", { children: l.cells.map((p, h) => {
189
- const i = b(p), m = a < o, d = h < s, f = m || d;
190
- return /* @__PURE__ */ r(
191
- f ? "th" : "td",
362
+ children: /* @__PURE__ */ l("tbody", { children: n.rows.map((s, p) => /* @__PURE__ */ l("tr", { children: s.cells.map((u, a) => {
363
+ var b;
364
+ const c = T(u), d = p < o, w = a < i, C = d || w;
365
+ return /* @__PURE__ */ l(
366
+ C ? "th" : "td",
192
367
  {
193
368
  style: {
194
369
  border: "1px solid #ddd",
195
370
  padding: "8px 12px",
196
- background: f ? "#f5f5f5" : i.props.backgroundColor !== "default" ? i.props.backgroundColor : "#fff",
197
- fontWeight: f ? "bold" : "normal",
198
- textAlign: i.props.textAlignment || "left",
199
- color: i.props.textColor !== "default" ? i.props.textColor : "inherit"
371
+ background: c.props.backgroundColor !== "default" ? t.options.colors[c.props.backgroundColor].background : "inherit",
372
+ fontWeight: C ? "bold" : void 0,
373
+ textAlign: c.props.textAlignment || "left",
374
+ color: c.props.textColor !== "default" ? t.options.colors[c.props.textColor].text : "inherit",
375
+ ...m.tableCell.style,
376
+ ...(b = r.tableCell) == null ? void 0 : b.style
200
377
  },
201
- ...(i.props.colspan || 1) > 1 && {
202
- colSpan: i.props.colspan || 1
378
+ ...(c.props.colspan || 1) > 1 && {
379
+ colSpan: c.props.colspan || 1
203
380
  },
204
- ...(i.props.rowspan || 1) > 1 && {
205
- rowSpan: i.props.rowspan || 1
381
+ ...(c.props.rowspan || 1) > 1 && {
382
+ rowSpan: c.props.rowspan || 1
206
383
  },
207
- children: t.transformInlineContent(i.content)
384
+ children: t.transformInlineContent(c.content)
208
385
  },
209
- "row_" + a + "_col_" + h
386
+ "row_" + p + "_col_" + a
210
387
  );
211
- }) }, "row-" + a)) })
388
+ }) }, "row-" + p)) })
212
389
  }
213
390
  );
214
391
  },
215
- quote: (e, t) => /* @__PURE__ */ r(
216
- u,
217
- {
218
- style: {
219
- borderLeft: "4px solid #bdbdbd",
220
- background: "#f9f9f9",
221
- padding: "12px 16px",
222
- margin: "16px 0",
223
- fontStyle: "italic",
224
- color: "#555",
225
- display: "block"
226
- },
227
- children: t.transformInlineContent(e.content)
228
- }
229
- ),
230
- pageBreak: () => /* @__PURE__ */ r(
392
+ quote: (e, t) => {
393
+ var n;
394
+ return /* @__PURE__ */ l(
395
+ f,
396
+ {
397
+ ...r.quote,
398
+ style: {
399
+ borderLeft: "2px solid #bdbdbd",
400
+ padding: "0px 12px",
401
+ fontStyle: "italic",
402
+ color: t.options.colors.gray.text,
403
+ display: "block",
404
+ ...m.quote.style,
405
+ ...(n = r.quote) == null ? void 0 : n.style
406
+ },
407
+ children: t.transformInlineContent(e.content)
408
+ }
409
+ );
410
+ },
411
+ pageBreak: () => /* @__PURE__ */ l(
231
412
  "hr",
232
413
  {
233
414
  style: {
@@ -237,17 +418,17 @@ const R = {
237
418
  }
238
419
  }
239
420
  )
240
- };
241
- function y({
242
- url: e,
243
- name: t,
244
- defaultText: n,
245
- icon: o
421
+ }), P = H();
422
+ function x({
423
+ url: r,
424
+ name: e,
425
+ defaultText: t,
426
+ icon: n
246
427
  }) {
247
- return /* @__PURE__ */ c(
248
- H,
428
+ return /* @__PURE__ */ h(
429
+ k,
249
430
  {
250
- href: e,
431
+ href: r,
251
432
  style: {
252
433
  textDecoration: "none",
253
434
  color: "#333",
@@ -257,21 +438,42 @@ function y({
257
438
  fontSize: 16
258
439
  },
259
440
  children: [
260
- o,
261
- /* @__PURE__ */ r("span", { style: { verticalAlign: "middle" }, children: t || n })
441
+ n,
442
+ /* @__PURE__ */ l("span", { style: { verticalAlign: "middle" }, children: e || t })
262
443
  ]
263
444
  }
264
445
  );
265
446
  }
266
- function C({ caption: e, width: t }) {
267
- return e ? /* @__PURE__ */ r(u, { style: { width: t, fontSize: 13, color: "#888", margin: "4px 0 0 0" }, children: e }) : null;
447
+ function L({
448
+ caption: r,
449
+ width: e,
450
+ textStyles: t
451
+ }) {
452
+ var n;
453
+ return r ? /* @__PURE__ */ l(
454
+ f,
455
+ {
456
+ ...t.caption,
457
+ style: {
458
+ width: e,
459
+ fontSize: 13,
460
+ color: "#888",
461
+ margin: "4px 0 0 0",
462
+ ...m.caption.style,
463
+ ...(n = t.caption) == null ? void 0 : n.style
464
+ },
465
+ children: r
466
+ }
467
+ ) : null;
268
468
  }
269
- const E = {
270
- link: (e, t) => /* @__PURE__ */ c(H, { href: e.href, children: [
469
+ const M = {
470
+ link: {}
471
+ }, S = (r = M) => ({
472
+ link: (e, t) => /* @__PURE__ */ h(k, { href: e.href, ...r.link, children: [
271
473
  ...e.content.map((n) => t.transformStyledText(n))
272
474
  ] }),
273
475
  text: (e, t) => t.transformStyledText(e)
274
- }, N = {
476
+ }), q = S(), B = {}, V = (r = B) => ({
275
477
  bold: (e) => e ? {
276
478
  fontWeight: "bold"
277
479
  } : {},
@@ -285,157 +487,179 @@ const E = {
285
487
  strike: (e) => e ? {
286
488
  textDecoration: "line-through"
287
489
  } : {},
288
- backgroundColor: (e) => ({
289
- backgroundColor: e
290
- }),
291
- textColor: (e) => e ? {
292
- color: e
490
+ backgroundColor: (e, t) => e ? {
491
+ backgroundColor: t.options.colors[e].background
492
+ } : {},
493
+ textColor: (e, t) => e ? {
494
+ color: t.options.colors[e].text
293
495
  } : {},
294
496
  code: (e) => e ? {
295
- fontFamily: "Courier"
497
+ fontFamily: "GeistMono"
296
498
  } : {}
297
- }, G = {
298
- blockMapping: R,
299
- inlineContentMapping: E,
300
- styleMapping: N
301
- };
302
- class U extends L {
303
- constructor(t, n, o) {
304
- const l = {
499
+ }), $ = V(), G = {
500
+ textStyles: m,
501
+ linkStyles: M,
502
+ styleTransformStyles: B
503
+ }, Y = {
504
+ blockMapping: P,
505
+ inlineContentMapping: q,
506
+ styleMapping: $
507
+ }, ee = (r = G) => ({
508
+ blockMapping: H(
509
+ r.textStyles
510
+ ),
511
+ inlineContentMapping: S(
512
+ r.linkStyles
513
+ ),
514
+ styleMapping: V(
515
+ r.styleTransformStyles
516
+ )
517
+ });
518
+ class te extends E {
519
+ constructor(e, t, n) {
520
+ const i = {
305
521
  ...{
306
- colors: V
522
+ colors: R
307
523
  },
308
- ...o
524
+ ...n
309
525
  };
310
- super(t, n, l), this.schema = t;
526
+ super(e, t, i), this.schema = e;
311
527
  }
312
- transformStyledText(t) {
313
- const n = this.mapStyles(t.styles), o = Object.assign({}, ...n);
314
- return /* @__PURE__ */ r("span", { style: o, children: t.text });
528
+ transformStyledText(e) {
529
+ const t = this.mapStyles(e.styles), n = Object.assign({}, ...t);
530
+ return /* @__PURE__ */ l(
531
+ "span",
532
+ {
533
+ style: n,
534
+ dangerouslySetInnerHTML: {
535
+ __html: e.text.replace(/\n/g, "<br />")
536
+ }
537
+ }
538
+ );
315
539
  }
316
- async renderGroupedListBlocks(t, n, o) {
317
- const s = t[n].type, l = [];
318
- let a = n;
319
- for (let h = 1; a < t.length && t[a].type === s; a++, h++) {
320
- const i = t[a], m = await this.mapBlock(
321
- i,
322
- o,
323
- h
540
+ async renderGroupedListBlocks(e, t, n) {
541
+ const o = e[t].type, i = [];
542
+ let s = t;
543
+ for (let u = 1; s < e.length && e[s].type === o; s++, u++) {
544
+ const a = e[s], c = await this.mapBlock(
545
+ a,
546
+ n,
547
+ u
324
548
  );
325
549
  let d = [];
326
- i.children && i.children.length > 0 && (d = await this.renderNestedLists(
327
- i.children,
328
- o + 1,
329
- i.id
330
- )), l.push(
331
- /* @__PURE__ */ c(v.Fragment, { children: [
332
- m,
550
+ a.children && a.children.length > 0 && (d = await this.renderNestedLists(
551
+ a.children,
552
+ n + 1,
553
+ a.id
554
+ )), i.push(
555
+ /* @__PURE__ */ h("li", { children: [
556
+ c,
333
557
  d.length > 0 && d
334
- ] }, i.id)
558
+ ] }, a.id)
335
559
  );
336
560
  }
337
561
  let p;
338
- return s === "bulletListItem" || s === "toggleListItem" ? p = /* @__PURE__ */ r("ul", { className: "mb-2 list-disc pl-6", children: l }, t[n].id + "-ul") : p = /* @__PURE__ */ r(
562
+ return o === "bulletListItem" || o === "toggleListItem" ? p = /* @__PURE__ */ l("ul", { className: "mb-2 list-disc pl-6", children: i }, e[t].id + "-ul") : p = /* @__PURE__ */ l(
339
563
  "ol",
340
564
  {
341
565
  className: "mb-2 list-decimal pl-6",
342
566
  start: 1,
343
- children: l
567
+ children: i
344
568
  },
345
- t[n].id + "-ol"
346
- ), { element: p, nextIndex: a };
569
+ e[t].id + "-ol"
570
+ ), { element: p, nextIndex: s };
347
571
  }
348
- async renderNestedLists(t, n, o) {
349
- const s = [];
350
- let l = 0;
351
- for (; l < t.length; ) {
352
- const a = t[l];
353
- if (a.type === "bulletListItem" || a.type === "numberedListItem") {
354
- const p = a.type, h = [];
355
- let i = l;
356
- for (let m = 1; i < t.length && t[i].type === p; i++, m++) {
357
- const d = t[i], f = await this.mapBlock(
572
+ async renderNestedLists(e, t, n) {
573
+ const o = [];
574
+ let i = 0;
575
+ for (; i < e.length; ) {
576
+ const s = e[i];
577
+ if (s.type === "bulletListItem" || s.type === "numberedListItem") {
578
+ const p = s.type, u = [];
579
+ let a = i;
580
+ for (let c = 1; a < e.length && e[a].type === p; a++, c++) {
581
+ const d = e[a], w = await this.mapBlock(
358
582
  d,
359
- n,
360
- m
361
- ), x = this.blocknoteDefaultPropsToReactEmailStyle(
583
+ t,
584
+ c
585
+ ), C = this.blocknoteDefaultPropsToReactEmailStyle(
362
586
  d.props
363
587
  );
364
- let g = [];
365
- d.children && d.children.length > 0 && (d.children[0] && (d.children[0].type === "bulletListItem" || d.children[0].type === "numberedListItem") ? g = await this.renderNestedLists(
588
+ let y = [];
589
+ d.children && d.children.length > 0 && (d.children[0] && (d.children[0].type === "bulletListItem" || d.children[0].type === "numberedListItem") ? y = await this.renderNestedLists(
366
590
  d.children,
367
- n + 1,
591
+ t + 1,
368
592
  d.id
369
- ) : g = await this.transformBlocks(
593
+ ) : y = await this.transformBlocks(
370
594
  d.children,
371
- n + 1
372
- )), h.push(
373
- /* @__PURE__ */ c("li", { style: x, children: [
374
- f,
375
- g.length > 0 && /* @__PURE__ */ r("div", { style: { marginTop: "8px" }, children: g })
595
+ t + 1
596
+ )), u.push(
597
+ /* @__PURE__ */ h("li", { style: C, children: [
598
+ w,
599
+ y.length > 0 && /* @__PURE__ */ l("div", { style: { marginTop: "8px" }, children: y })
376
600
  ] }, d.id)
377
601
  );
378
602
  }
379
- p === "bulletListItem" ? s.push(
380
- /* @__PURE__ */ r(
603
+ p === "bulletListItem" ? o.push(
604
+ /* @__PURE__ */ l(
381
605
  "ul",
382
606
  {
383
607
  className: "mb-2 list-disc pl-6",
384
- children: h
608
+ children: u
385
609
  },
386
- o + "-ul-nested-" + l
610
+ n + "-ul-nested-" + i
387
611
  )
388
- ) : s.push(
389
- /* @__PURE__ */ r(
612
+ ) : o.push(
613
+ /* @__PURE__ */ l(
390
614
  "ol",
391
615
  {
392
616
  className: "mb-2 list-decimal pl-6",
393
617
  start: 1,
394
- children: h
618
+ children: u
395
619
  },
396
- o + "-ol-nested-" + l
620
+ n + "-ol-nested-" + i
397
621
  )
398
- ), l = i;
622
+ ), i = a;
399
623
  } else {
400
- const p = await this.transformBlocks([a], n);
401
- s.push(
402
- /* @__PURE__ */ r(w, { style: { marginLeft: "24px" }, children: p }, a.id)
403
- ), l++;
624
+ const p = await this.transformBlocks([s], t);
625
+ o.push(
626
+ /* @__PURE__ */ l(I, { style: { marginLeft: "24px" }, children: p }, s.id)
627
+ ), i++;
404
628
  }
405
629
  }
406
- return s;
630
+ return o;
407
631
  }
408
- async transformBlocks(t, n = 0) {
409
- const o = [];
410
- let s = 0;
411
- for (; s < t.length; ) {
412
- const l = t[s];
413
- if (l.type === "bulletListItem" || l.type === "numberedListItem") {
414
- const { element: i, nextIndex: m } = await this.renderGroupedListBlocks(
415
- t,
416
- s,
417
- n
632
+ async transformBlocks(e, t = 0) {
633
+ const n = [];
634
+ let o = 0;
635
+ for (; o < e.length; ) {
636
+ const i = e[o];
637
+ if (i.type === "bulletListItem" || i.type === "numberedListItem" || i.type === "toggleListItem") {
638
+ const { element: a, nextIndex: c } = await this.renderGroupedListBlocks(
639
+ e,
640
+ o,
641
+ t
418
642
  );
419
- o.push(i), s = m;
643
+ n.push(a), o = c;
420
644
  continue;
421
645
  }
422
- const a = await this.transformBlocks(l.children, n + 1), p = await this.mapBlock(l, n, 0), h = this.blocknoteDefaultPropsToReactEmailStyle(l.props);
423
- o.push(
424
- /* @__PURE__ */ c(v.Fragment, { children: [
425
- /* @__PURE__ */ r(w, { style: h, children: p }),
426
- a.length > 0 && /* @__PURE__ */ r("div", { style: { marginLeft: "24px" }, children: a })
427
- ] }, l.id)
428
- ), s++;
646
+ const s = await this.transformBlocks(i.children, t + 1), p = await this.mapBlock(i, t, 0), u = this.blocknoteDefaultPropsToReactEmailStyle(i.props);
647
+ n.push(
648
+ /* @__PURE__ */ h(v.Fragment, { children: [
649
+ /* @__PURE__ */ l(I, { style: u, children: p }),
650
+ s.length > 0 && /* @__PURE__ */ l("div", { style: { marginLeft: "24px" }, children: s })
651
+ ] }, i.id)
652
+ ), o++;
429
653
  }
430
- return o;
654
+ return n;
431
655
  }
432
- async toReactEmailDocument(t, n) {
433
- const o = await this.transformBlocks(t);
434
- return D(
435
- /* @__PURE__ */ c(B, { children: [
436
- /* @__PURE__ */ r(A, { children: n == null ? void 0 : n.head }),
437
- /* @__PURE__ */ c(
438
- T,
656
+ async toReactEmailDocument(e, t) {
657
+ const n = await this.transformBlocks(e), o = (t == null ? void 0 : t.container) || (({ children: i }) => /* @__PURE__ */ l(v.Fragment, { children: i }));
658
+ return j(
659
+ /* @__PURE__ */ h(Z, { children: [
660
+ /* @__PURE__ */ l(z, { children: t == null ? void 0 : t.head }),
661
+ /* @__PURE__ */ h(
662
+ N,
439
663
  {
440
664
  style: {
441
665
  fontFamily: "'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif",
@@ -444,11 +668,11 @@ class U extends L {
444
668
  color: "#333"
445
669
  },
446
670
  children: [
447
- (n == null ? void 0 : n.preview) && /* @__PURE__ */ r(F, { children: n.preview }),
448
- /* @__PURE__ */ r(W, { children: /* @__PURE__ */ c(Z, { children: [
449
- n == null ? void 0 : n.header,
450
- o,
451
- n == null ? void 0 : n.footer
671
+ (t == null ? void 0 : t.preview) && /* @__PURE__ */ l(_, { children: t.preview }),
672
+ /* @__PURE__ */ l(O, { children: /* @__PURE__ */ h(o, { children: [
673
+ t == null ? void 0 : t.header,
674
+ n,
675
+ t == null ? void 0 : t.footer
452
676
  ] }) })
453
677
  ]
454
678
  }
@@ -456,17 +680,28 @@ class U extends L {
456
680
  ] })
457
681
  );
458
682
  }
459
- blocknoteDefaultPropsToReactEmailStyle(t) {
683
+ blocknoteDefaultPropsToReactEmailStyle(e) {
460
684
  return {
461
- textAlign: t.textAlignment,
462
- backgroundColor: t.backgroundColor === "default" || !t.backgroundColor ? void 0 : this.options.colors[t.backgroundColor].background,
463
- color: t.textColor === "default" || !t.textColor ? void 0 : this.options.colors[t.textColor].text,
464
- alignItems: t.textAlignment === "right" ? "flex-end" : t.textAlignment === "center" ? "center" : void 0
685
+ textAlign: e.textAlignment,
686
+ backgroundColor: e.backgroundColor === "default" || !e.backgroundColor ? void 0 : this.options.colors[e.backgroundColor].background,
687
+ color: e.textColor === "default" || !e.textColor ? void 0 : this.options.colors[e.textColor].text,
688
+ alignItems: e.textAlignment === "right" ? "flex-end" : e.textAlignment === "center" ? "center" : void 0
465
689
  };
466
690
  }
467
691
  }
468
692
  export {
469
- U as ReactEmailExporter,
470
- G as reactEmailDefaultSchemaMappings
693
+ te as ReactEmailExporter,
694
+ H as createReactEmailBlockMappingForDefaultSchema,
695
+ S as createReactEmailInlineContentMappingForDefaultSchema,
696
+ V as createReactEmailStyleMappingForDefaultSchema,
697
+ G as defaultReactEmailDefaultSchemaStyles,
698
+ M as defaultReactEmailLinkStyles,
699
+ B as defaultReactEmailStyleTransformStyles,
700
+ m as defaultReactEmailTextStyles,
701
+ P as reactEmailBlockMappingForDefaultSchema,
702
+ Y as reactEmailDefaultSchemaMappings,
703
+ ee as reactEmailDefaultSchemaMappingsWithStyles,
704
+ q as reactEmailInlineContentMappingForDefaultSchema,
705
+ $ as reactEmailStyleMappingForDefaultSchema
471
706
  };
472
707
  //# sourceMappingURL=blocknote-xl-email-exporter.js.map