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