@maildeno/editor 0.4.3 → 0.4.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.5
4
+
5
+ Packaging only. No API change, no behaviour change.
6
+
7
+ ### Changed
8
+
9
+ **The 15 runtime dependencies moved to devDependencies.** TipTap,
10
+ ProseMirror, reka-ui, @vueuse/core, prettier and @internationalized/date
11
+ are all bundled into `dist` at build time, so declaring them as runtime
12
+ dependencies made npm install a second, unused copy of each into every
13
+ consumer's node_modules.
14
+
15
+ `dist` imports exactly one external module — `vue` — which is already the
16
+ sole peerDependency. Verified across every emitted chunk, and by
17
+ installing the package with nothing but Vue and building a consumer:
18
+ 32/32 scoped selectors present, no unresolved imports.
19
+
20
+ Installing the package now pulls **25 MB across 15 packages instead of
21
+ 71 MB across 45**.
22
+
23
+ If any of these is ever externalised rather than bundled, it has to move
24
+ back. `dist` importing anything other than `vue` is the signal.
25
+
26
+ ## 0.4.4
27
+
28
+ Packaging only. No API change, no behaviour change in the editor itself.
29
+ The published package drops from 8.13 MB unpacked to 5.48 MB, 32.6% smaller.
30
+
31
+ ### Changed
32
+
33
+ **React Email export formats with prettier's babel-ts parser** instead of
34
+ the typescript parser. `prettier/plugins/typescript` is 900kB of source
35
+ against babel's 318kB and was the largest single file in the package.
36
+ Output is byte-identical on the TSX this package generates, verified
37
+ across generics, JSX, inline style objects and mapped children. The
38
+ typescript parser is the stricter of the two, which matters for arbitrary
39
+ user code but not for TSX `react-email.ts` generated moments earlier.
40
+ Saves 600kB.
41
+
42
+ **Both build passes are minified.** They have to agree: the two passes
43
+ share chunks by content hash, so identical output collapses to one file
44
+ and differing output ships two. Minifying only the element pass made the
45
+ package *larger* — 8.68 MB — because every prettier chunk was then
46
+ carried twice, once minified and once not. Saves 1.92MB with both on.
47
+
48
+ **`element-scoped-styles.css` is no longer emitted.** Nothing referenced
49
+ it: not `src/`, not the framework guides, not the README, not the exports
50
+ map. The shadow root reads those rules from the substituted string inside
51
+ the chunk, and Vite only extracted the file because library mode always
52
+ does. `dist/editor.css` is unaffected and `./style.css` still resolves.
53
+ Saves 72kB.
54
+
3
55
  ## 0.4.3
4
56
 
5
57
  ### Fixed
@@ -0,0 +1,402 @@
1
+ import { Fragment as b, computed as G, createBlock as V, createCommentVNode as v, createElementBlock as a, createElementVNode as c, createTextVNode as q, defineComponent as J, normalizeStyle as r, openBlock as o, renderList as S, resolveDynamicComponent as O, toDisplayString as x } from "vue";
2
+ var K = ["innerHTML"], Q = ["src", "alt"], U = ["src", "alt"], X = {
3
+ style: {
4
+ width: "30%",
5
+ height: "30%",
6
+ color: "#9ca3af"
7
+ },
8
+ fill: "currentColor",
9
+ viewBox: "0 0 20 20"
10
+ }, Y = ["src", "alt"], Z = ["src", "alt"], _ = ["innerHTML"], tt = { key: 8 }, et = { key: 0 }, nt = ["src", "alt"], it = {
11
+ key: 1,
12
+ style: {
13
+ "font-size": "7px",
14
+ color: "#9ca3af",
15
+ "font-style": "italic"
16
+ }
17
+ }, ot = {
18
+ key: 11,
19
+ class: "rounded truncate",
20
+ style: {
21
+ "font-size": "7px",
22
+ color: "#9ca3af",
23
+ background: "#f3f4f6",
24
+ padding: "1px 3px"
25
+ }
26
+ }, at = /* @__PURE__ */ J({
27
+ __name: "RowPreviewLegacyComponent",
28
+ props: {
29
+ comp: {},
30
+ scale: {}
31
+ },
32
+ setup(e) {
33
+ const y = e, l = G(() => y.comp.componentType ?? y.comp.type);
34
+ function u(t) {
35
+ return t ? t.replace(/<span[^>]*\bdata-merge="([^"]+)"(?:[^>]*\bdata-merge-default="([^"]*)")?[^>]*>.*?<\/span>/gs, (n, i, g) => {
36
+ const d = i.trim(), f = g?.trim();
37
+ return f ? `{{ ${d}|'${f}' }}` : `{{ ${d} }}`;
38
+ }) : "";
39
+ }
40
+ function m(t) {
41
+ const n = t?.backgroundGradient;
42
+ if (n?.useGradient === !0 && Array.isArray(n?.gradient?.colors) && n.gradient.colors.length >= 2) {
43
+ const { type: i, direction: g, colors: d } = n.gradient, f = d.map((p) => `${p.color} ${p.position}%`).join(", ");
44
+ return i === "radial" ? `radial-gradient(circle at center, ${f})` : `linear-gradient(${g}, ${f})`;
45
+ }
46
+ return t?.backgroundColor || "transparent";
47
+ }
48
+ function s(t) {
49
+ if (t && (t.includes(" ") || [
50
+ "Roboto",
51
+ "Open Sans",
52
+ "Lato",
53
+ "Montserrat",
54
+ "Poppins",
55
+ "Nunito",
56
+ "Raleway",
57
+ "Plus Jakarta Sans"
58
+ ].some((n) => t.includes(n))) && typeof document < "u") {
59
+ const n = `https://fonts.googleapis.com/css2?family=${t.replace(/ /g, "+")}:wght@300;400;500;600;700;800&display=swap`;
60
+ if (!document.querySelector(`link[href="${n}"]`)) {
61
+ const i = document.createElement("link");
62
+ i.href = n, i.rel = "stylesheet", document.head.appendChild(i);
63
+ }
64
+ }
65
+ }
66
+ function k(t) {
67
+ return t?.fontFamily && s(t.fontFamily), {
68
+ fontSize: Math.max(7, t?.fontSize || 24) + "px",
69
+ color: t?.color || "#111111",
70
+ fontWeight: t?.fontWeight || "bold",
71
+ fontFamily: t?.fontFamily || "Arial, sans-serif",
72
+ textAlign: t?.align || "left",
73
+ lineHeight: String(t?.lineHeight ?? 1.2),
74
+ letterSpacing: `${t?.letterSpacing ?? 0}px`,
75
+ textTransform: t?.textTransform || "none",
76
+ textDecoration: t?.textDecoration || "none",
77
+ background: m(t),
78
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 4}px ${t?.margin?.left ?? 0}px`,
79
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`
80
+ };
81
+ }
82
+ function w(t) {
83
+ return t?.fontFamily && s(t.fontFamily), {
84
+ fontSize: Math.max(6, t?.fontSize || 16) + "px",
85
+ color: t?.color || "#111111",
86
+ fontFamily: t?.fontFamily || "Arial, sans-serif",
87
+ fontWeight: t?.fontWeight || "normal",
88
+ fontStyle: t?.fontStyle || "normal",
89
+ textAlign: t?.align || "left",
90
+ lineHeight: String(t?.lineHeight ?? 1.5),
91
+ letterSpacing: `${t?.letterSpacing ?? 0}px`,
92
+ textTransform: t?.textTransform || "none",
93
+ textDecoration: t?.textDecoration || "none",
94
+ background: m(t),
95
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 4}px ${t?.margin?.left ?? 0}px`,
96
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`
97
+ };
98
+ }
99
+ function F(t) {
100
+ return {
101
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 0}px ${t?.margin?.left ?? 0}px`,
102
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`,
103
+ textAlign: t?.align || "left"
104
+ };
105
+ }
106
+ function z(t) {
107
+ const n = t?.align || "left";
108
+ return {
109
+ width: (t?.width || 100) + "%",
110
+ height: t?.height || "auto",
111
+ borderRadius: (t?.borderRadius || 0) + "px",
112
+ border: `${t?.border?.width || 0}px ${t?.border?.style || "solid"} ${t?.border?.color || "#000000"}`,
113
+ display: "block",
114
+ margin: n === "center" ? "0 auto" : n === "right" ? "0 0 0 auto" : "0"
115
+ };
116
+ }
117
+ function A(t) {
118
+ return {
119
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 0}px ${t?.margin?.left ?? 0}px`,
120
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`,
121
+ textAlign: t?.align || "left",
122
+ maxWidth: "100%"
123
+ };
124
+ }
125
+ function C(t) {
126
+ const n = t?.align || "left";
127
+ return {
128
+ width: "100%",
129
+ maxWidth: "100%",
130
+ paddingBottom: "56.25%",
131
+ height: "0",
132
+ position: "relative",
133
+ display: "inline-block",
134
+ borderRadius: (t?.borderRadius || 0) + "px",
135
+ border: `${t?.border?.width || 0}px ${t?.border?.style || "solid"} ${t?.border?.color || "#000000"}`,
136
+ overflow: "hidden",
137
+ marginLeft: n === "center" || n === "right" ? "auto" : "0",
138
+ marginRight: n === "center" ? "auto" : "0",
139
+ boxSizing: "border-box"
140
+ };
141
+ }
142
+ function H() {
143
+ return {
144
+ position: "absolute",
145
+ top: "0",
146
+ left: "0",
147
+ width: "100%",
148
+ height: "100%",
149
+ objectFit: "cover",
150
+ display: "block"
151
+ };
152
+ }
153
+ function M() {
154
+ return {
155
+ position: "absolute",
156
+ top: "0",
157
+ left: "0",
158
+ width: "100%",
159
+ height: "100%",
160
+ background: "#e5e7eb",
161
+ display: "flex",
162
+ alignItems: "center",
163
+ justifyContent: "center"
164
+ };
165
+ }
166
+ function T(t) {
167
+ return {
168
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 4}px ${t?.margin?.left ?? 0}px`,
169
+ textAlign: t?.align || "center"
170
+ };
171
+ }
172
+ function L(t) {
173
+ t?.fontFamily && s(t.fontFamily);
174
+ const n = !!t?.icon;
175
+ return {
176
+ background: m(t),
177
+ color: t?.color || "#ffffff",
178
+ fontSize: Math.max(5, t?.fontSize || 16) + "px",
179
+ fontWeight: t?.fontWeight || "500",
180
+ fontFamily: t?.fontFamily || "Arial, sans-serif",
181
+ letterSpacing: `${t?.letterSpacing ?? 0}px`,
182
+ padding: `${t?.padding?.top ?? 8}px ${t?.padding?.right ?? 16}px ${t?.padding?.bottom ?? 8}px ${t?.padding?.left ?? 16}px`,
183
+ borderRadius: (t?.borderRadius || 4) + "px",
184
+ border: `${t?.border?.width || 0}px ${t?.border?.style || "solid"} ${t?.border?.color || "#000000"}`,
185
+ ...n ? {
186
+ display: "inline-flex",
187
+ alignItems: "center",
188
+ verticalAlign: "middle"
189
+ } : { display: "inline-block" },
190
+ lineHeight: "1.2",
191
+ textDecoration: "none"
192
+ };
193
+ }
194
+ function h(t) {
195
+ const n = Math.max(4, t?.iconSize ?? 20), i = t?.iconGap ?? 8, g = t?.iconPosition !== "after";
196
+ return {
197
+ display: "block",
198
+ width: n + "px",
199
+ height: n + "px",
200
+ flexShrink: "0",
201
+ marginRight: g ? i + "px" : "0",
202
+ marginLeft: g ? "0" : i + "px"
203
+ };
204
+ }
205
+ function $(t) {
206
+ const n = t.target;
207
+ n.style.display = "none";
208
+ }
209
+ function R(t) {
210
+ return {
211
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 4}px ${t?.margin?.left ?? 0}px`,
212
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`,
213
+ textAlign: t?.align || "left"
214
+ };
215
+ }
216
+ function W(t) {
217
+ return t?.fontFamily && s(t.fontFamily), {
218
+ color: t?.color || "#007bff",
219
+ fontSize: Math.max(6, t?.fontSize || 16) + "px",
220
+ fontWeight: t?.fontWeight || "normal",
221
+ fontFamily: t?.fontFamily || "Arial, sans-serif",
222
+ letterSpacing: `${t?.letterSpacing ?? 0}px`,
223
+ textDecoration: t?.textDecoration || "underline"
224
+ };
225
+ }
226
+ function D(t) {
227
+ return t?.fontFamily && s(t.fontFamily), {
228
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 0}px ${t?.margin?.left ?? 0}px`,
229
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 16}px`,
230
+ fontSize: Math.max(6, t?.fontSize || 16) + "px",
231
+ fontFamily: t?.fontFamily || "Arial, sans-serif",
232
+ lineHeight: String(t?.lineHeight ?? 1.5),
233
+ letterSpacing: `${t?.letterSpacing ?? 0}px`,
234
+ color: t?.color || "#111111",
235
+ background: m(t)
236
+ };
237
+ }
238
+ function I(t) {
239
+ return {
240
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 0}px ${t?.margin?.left ?? 0}px`,
241
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`,
242
+ textAlign: t?.align || "left"
243
+ };
244
+ }
245
+ function P(t) {
246
+ const n = t?.align || "left";
247
+ return {
248
+ width: (t?.width || 100) + "%",
249
+ height: (t?.height || 1) + "px",
250
+ background: m(t),
251
+ border: "none",
252
+ margin: n === "center" ? "0 auto" : n === "right" ? "0 0 0 auto" : "0"
253
+ };
254
+ }
255
+ function B(t) {
256
+ return {
257
+ width: "100%",
258
+ height: (t?.height || 16) + "px",
259
+ background: m(t)
260
+ };
261
+ }
262
+ function E(t) {
263
+ return t?.fontFamily && s(t.fontFamily), {
264
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 0}px ${t?.margin?.left ?? 0}px`,
265
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`,
266
+ textAlign: t?.align || "left",
267
+ lineHeight: "0",
268
+ background: m(t)
269
+ };
270
+ }
271
+ function j(t, n, i) {
272
+ t?.fontFamily && s(t.fontFamily);
273
+ const g = t?.mobileStack === !0, d = t?.spacing ?? 8, f = n === 0, p = n === i - 1;
274
+ return {
275
+ display: "inline-block",
276
+ marginLeft: f ? "0px" : `${d / 2}px`,
277
+ marginRight: p ? "0px" : `${d / 2}px`,
278
+ fontSize: Math.max(6, t?.fontSize ?? 14) + "px",
279
+ lineHeight: String(t?.lineHeight ?? 1.4),
280
+ letterSpacing: (t?.letterSpacing ?? 0) + "px",
281
+ color: t?.color || "#111111",
282
+ fontWeight: t?.fontWeight || "normal",
283
+ fontFamily: t?.fontFamily ? `'${t.fontFamily}', Arial, sans-serif` : "Arial, sans-serif",
284
+ fontStyle: t?.fontStyle || "normal",
285
+ textTransform: t?.textTransform || "none",
286
+ textDecoration: t?.textDecoration || "none",
287
+ whiteSpace: g ? "normal" : "nowrap",
288
+ cursor: "default"
289
+ };
290
+ }
291
+ function N(t) {
292
+ return {
293
+ margin: `${t?.margin?.top ?? 0}px ${t?.margin?.right ?? 0}px ${t?.margin?.bottom ?? 0}px ${t?.margin?.left ?? 0}px`,
294
+ padding: `${t?.padding?.top ?? 0}px ${t?.padding?.right ?? 0}px ${t?.padding?.bottom ?? 0}px ${t?.padding?.left ?? 0}px`,
295
+ textAlign: t?.align || "left",
296
+ display: "flex",
297
+ flexWrap: "wrap",
298
+ gap: (t?.spacing ?? 8) + "px",
299
+ justifyContent: t?.align === "center" ? "center" : t?.align === "right" ? "flex-end" : "flex-start"
300
+ };
301
+ }
302
+ return (t, n) => l.value === "heading" ? (o(), V(O(e.comp.props?.level || "h2"), {
303
+ key: 0,
304
+ style: r(k(e.comp.props)),
305
+ class: "truncate",
306
+ innerHTML: u(e.comp.props?.content) || "Heading"
307
+ }, null, 8, ["style", "innerHTML"])) : l.value === "paragraph" ? (o(), a("p", {
308
+ key: 1,
309
+ style: r([w(e.comp.props), {
310
+ display: "-webkit-box",
311
+ "-webkit-line-clamp": "2",
312
+ "-webkit-box-orient": "vertical"
313
+ }]),
314
+ class: "overflow-hidden",
315
+ innerHTML: u(e.comp.props?.content) || "Text"
316
+ }, null, 12, K)) : l.value === "image" ? (o(), a("div", {
317
+ key: 2,
318
+ style: r(F(e.comp.props))
319
+ }, [c("img", {
320
+ src: e.comp.props?.src,
321
+ alt: e.comp.props?.alt || "",
322
+ style: r(z(e.comp.props))
323
+ }, null, 12, Q)], 4)) : l.value === "video" ? (o(), a("div", {
324
+ key: 3,
325
+ style: r(A(e.comp.props))
326
+ }, [c("div", { style: r(C(e.comp.props)) }, [e.comp.props?.coverImage ? (o(), a("img", {
327
+ key: 0,
328
+ src: e.comp.props.coverImage,
329
+ alt: e.comp.props?.alt || "Video",
330
+ style: r(H())
331
+ }, null, 12, U)) : (o(), a("div", {
332
+ key: 1,
333
+ style: r(M())
334
+ }, [(o(), a("svg", X, [...n[0] || (n[0] = [c("path", {
335
+ "fill-rule": "evenodd",
336
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zM9.555 7.168A1 1 0 008 8v4a1 1 0 001.555.832l3-2a1 1 0 000-1.664l-3-2z",
337
+ "clip-rule": "evenodd"
338
+ }, null, -1)])]))], 4))], 4)], 4)) : l.value === "button" ? (o(), a("div", {
339
+ key: 4,
340
+ style: r(T(e.comp.props))
341
+ }, [c("span", {
342
+ style: r(L(e.comp.props)),
343
+ class: "inline-block truncate"
344
+ }, [
345
+ e.comp.props?.icon && e.comp.props?.iconPosition !== "after" ? (o(), a("img", {
346
+ key: 0,
347
+ src: e.comp.props.icon,
348
+ alt: e.comp.props?.iconAlt || "",
349
+ style: r(h(e.comp.props)),
350
+ onError: $
351
+ }, null, 44, Y)) : v("", !0),
352
+ q(" " + x(e.comp.props?.text || "Button") + " ", 1),
353
+ e.comp.props?.icon && e.comp.props?.iconPosition === "after" ? (o(), a("img", {
354
+ key: 1,
355
+ src: e.comp.props.icon,
356
+ alt: e.comp.props?.iconAlt || "",
357
+ style: r(h(e.comp.props)),
358
+ onError: $
359
+ }, null, 44, Z)) : v("", !0)
360
+ ], 4)], 4)) : l.value === "anchor" ? (o(), a("div", {
361
+ key: 5,
362
+ style: r(R(e.comp.props))
363
+ }, [c("span", {
364
+ style: r(W(e.comp.props)),
365
+ class: "truncate block"
366
+ }, x(e.comp.props?.text || "Link"), 5)], 4)) : l.value === "list" ? (o(), a("div", {
367
+ key: 6,
368
+ style: r(D(e.comp.props)),
369
+ innerHTML: u(e.comp.props?.content) || "<ul><li>Item</li></ul>"
370
+ }, null, 12, _)) : l.value === "divider" ? (o(), a("div", {
371
+ key: 7,
372
+ style: r(I(e.comp.props))
373
+ }, [c("hr", { style: r(P(e.comp.props)) }, null, 4)], 4)) : l.value === "spacer" ? (o(), a("div", tt, [c("div", { style: r(B(e.comp.props)) }, null, 4)])) : l.value === "menu" ? (o(), a("div", {
374
+ key: 9,
375
+ style: r(E(e.comp.props))
376
+ }, [e.comp.props?.items?.some((i) => i.enabled && i.label) ? (o(!0), a(b, { key: 1 }, S(e.comp.props.items.filter((i) => i.enabled && i.label), (i, g) => (o(), a("span", {
377
+ key: i._id || g,
378
+ style: r(j(e.comp.props, Number(g), e.comp.props.items.filter((d) => d.enabled && d.label).length))
379
+ }, x(i.label), 5))), 128)) : (o(), a("div", et, " Menu "))], 4)) : l.value === "socials" ? (o(), a("div", {
380
+ key: 10,
381
+ style: r(N(e.comp.props))
382
+ }, [e.comp.props?.platforms?.some((i) => i.enabled && i.link) ? (o(!0), a(b, { key: 0 }, S(e.comp.props.platforms.filter((i) => i.enabled && i.link), (i) => (o(), a("span", {
383
+ key: i.name,
384
+ style: {
385
+ display: "inline-flex",
386
+ alignItems: "center",
387
+ justifyContent: "center"
388
+ }
389
+ }, [c("img", {
390
+ src: i.icon,
391
+ alt: i.name,
392
+ style: r({
393
+ width: (e.comp.props?.iconSize || 24) + "px",
394
+ height: (e.comp.props?.iconSize || 24) + "px",
395
+ display: "block"
396
+ })
397
+ }, null, 12, nt)]))), 128)) : (o(), a("span", it, "Socials"))], 4)) : (o(), a("div", ot, x(l.value), 1));
398
+ }
399
+ }), lt = at;
400
+ export {
401
+ lt as default
402
+ };