@templatical/editor 0.45.0 → 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/{AiChatSidebar-BlFWWhBv.js → AiChatSidebar-DGcH4Lyo.js} +1 -1
- package/dist/{AiFeatureMenu-CvWygUmC.js → AiFeatureMenu-B4q-0g1S.js} +1 -1
- package/dist/{BlockPreviewCanvas-DwxJOTzH.js → BlockPreviewCanvas-DIZ0KgUD.js} +3 -3
- package/dist/{CloudHeaderExtras-BzM1QU1r.js → CloudHeaderExtras-ehMYJP68.js} +1 -1
- package/dist/{CloudPanels-d36YXXyn.js → CloudPanels-BwOaAlKz.js} +2 -2
- package/dist/{CollaboratorBar-rwXe_Qd2.js → CollaboratorBar-qOZFRNPx.js} +1 -1
- package/dist/{CountdownToolbar-lbjCc8ik.js → CountdownToolbar-BeF21SeB.js} +4 -4
- package/dist/{DesignReferenceSidebar-zlJQsP0X.js → DesignReferenceSidebar-zH93uB15.js} +1 -1
- package/dist/{IssuesPanel-CHx3m8SP.js → IssuesPanel-Dltw9haP.js} +1 -1
- package/dist/{LogicTagInsertButton-BvftbkL4.js → LogicTagInsertButton-CHa-UD76.js} +12 -12
- package/dist/{MergeTagInput-CR1kcj8X.js → MergeTagInput-B3ntd4dN.js} +1 -1
- package/dist/{MergeTagModeToggle-DssKrVYb.js → MergeTagModeToggle-C_06ZL0Q.js} +1 -1
- package/dist/{ParagraphEditor-DFizsZRc.js → ParagraphEditor-CxuW3TV0.js} +6 -6
- package/dist/{RestoreVersionDialog-Cp3q2mU4.js → RestoreVersionDialog-B1n37M1Z.js} +1 -1
- package/dist/{RichTextEditorContent-Cj3oaPMk.js → RichTextEditorContent-CP_uULWB.js} +2 -2
- package/dist/{SaveBlockDialog-BR8vW_XF.js → SaveBlockDialog-BSKX_7_v.js} +5 -5
- package/dist/{SavedBlocksBrowserModal-DmwbmKxI.js → SavedBlocksBrowserModal-CHKrH1gO.js} +4 -4
- package/dist/{SavedBlocksPanels-D4XKrs-a.js → SavedBlocksPanels-B-xDqBcz.js} +1 -1
- package/dist/{SavedBlocksPickBar-gfc-o5sR.js → SavedBlocksPickBar-D2J-g82g.js} +1 -1
- package/dist/{TemplateSettings-D7aNrd0d.js → TemplateSettings-D07K_Y4m.js} +4 -4
- package/dist/{TestEmailModal-DUmtcSm-.js → TestEmailModal-BNPw_lID.js} +5 -5
- package/dist/{TestEmailPanel-s9gISTI8.js → TestEmailPanel-8klWo8hE.js} +1 -1
- package/dist/{TitleEditor-C-uHqtml.js → TitleEditor-CmC9OuhA.js} +4 -4
- package/dist/{ToggleSwitch-CTwwCIVA.js → ToggleSwitch-COeyWGfT.js} +1 -1
- package/dist/{Toolbar-CLpA36RO.js → Toolbar-CqhRb6EM.js} +36 -36
- package/dist/{TplModal-D6XtxusQ.js → TplModal-BGFawHY9.js} +1 -1
- package/dist/{VersionHistoryPanels-Dvowtt7V.js → VersionHistoryPanels-DdbGjEOR.js} +1 -1
- package/dist/{WrapperBlock-CzJa2Mxw.js → WrapperBlock-CTkmA887.js} +1 -1
- package/dist/{blockTypeIcons-D3aj5u_5.js → blockTypeIcons-CVKo6V_v.js} +1 -1
- package/dist/bundle-stats.json +6 -6
- package/dist/cdn/chunks/{AiChatSidebar-SRGBP-SL.js → AiChatSidebar-kCK4NZM9.js} +2 -2
- package/dist/cdn/chunks/{AiChatSidebar-SRGBP-SL.js.map → AiChatSidebar-kCK4NZM9.js.map} +1 -1
- package/dist/cdn/chunks/{AiFeatureMenu-oZhlgsGh.js → AiFeatureMenu-K1dLeDft.js} +2 -2
- package/dist/cdn/chunks/{AiFeatureMenu-oZhlgsGh.js.map → AiFeatureMenu-K1dLeDft.js.map} +1 -1
- package/dist/cdn/chunks/{BlockPreviewCanvas-hKxE6f-k.js → BlockPreviewCanvas-Djz9YAFx.js} +4 -4
- package/dist/cdn/chunks/{BlockPreviewCanvas-hKxE6f-k.js.map → BlockPreviewCanvas-Djz9YAFx.js.map} +1 -1
- package/dist/cdn/chunks/{CloudHeaderExtras-t-_ZlHwn.js → CloudHeaderExtras-5ONQ1RCa.js} +2 -2
- package/dist/cdn/chunks/{CloudHeaderExtras-t-_ZlHwn.js.map → CloudHeaderExtras-5ONQ1RCa.js.map} +1 -1
- package/dist/cdn/chunks/{CloudPanels-DR2eEcpX.js → CloudPanels-_irSdWbi.js} +3 -3
- package/dist/cdn/chunks/{CloudPanels-DR2eEcpX.js.map → CloudPanels-_irSdWbi.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-w8_2WPE0.js → CollaboratorBar-CZufI1On.js} +2 -2
- package/dist/cdn/chunks/{CollaboratorBar-w8_2WPE0.js.map → CollaboratorBar-CZufI1On.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-CvNuDR5Z.js → CountdownToolbar-BaXCefQM.js} +5 -5
- package/dist/cdn/chunks/{CountdownToolbar-CvNuDR5Z.js.map → CountdownToolbar-BaXCefQM.js.map} +1 -1
- package/dist/cdn/chunks/{DesignReferenceSidebar-CJg_5GXU.js → DesignReferenceSidebar-GjkpHylX.js} +2 -2
- package/dist/cdn/chunks/{DesignReferenceSidebar-CJg_5GXU.js.map → DesignReferenceSidebar-GjkpHylX.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-DXqlRk19.js → IssuesPanel-C1Lv2y_O.js} +2 -2
- package/dist/cdn/chunks/{IssuesPanel-DXqlRk19.js.map → IssuesPanel-C1Lv2y_O.js.map} +1 -1
- package/dist/cdn/chunks/{LogicTagInsertButton-DnHghQHb.js → LogicTagInsertButton-BYjdrDnQ.js} +4 -4
- package/dist/cdn/chunks/{LogicTagInsertButton-DnHghQHb.js.map → LogicTagInsertButton-BYjdrDnQ.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagInput-heTX9P_k.js → MergeTagInput-Cx67J_vg.js} +2 -2
- package/dist/cdn/chunks/{MergeTagInput-heTX9P_k.js.map → MergeTagInput-Cx67J_vg.js.map} +1 -1
- package/dist/cdn/chunks/{MergeTagModeToggle-C9EfuZIP.js → MergeTagModeToggle-DZ4EuXVp.js} +2 -2
- package/dist/cdn/chunks/{MergeTagModeToggle-C9EfuZIP.js.map → MergeTagModeToggle-DZ4EuXVp.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-B5DN4Sy4.js → ParagraphEditor-DndEFXmR.js} +7 -7
- package/dist/cdn/chunks/{ParagraphEditor-B5DN4Sy4.js.map → ParagraphEditor-DndEFXmR.js.map} +1 -1
- package/dist/cdn/chunks/{RestoreVersionDialog-DBgJ-Nui.js → RestoreVersionDialog-CFYs13a4.js} +2 -2
- package/dist/cdn/chunks/{RestoreVersionDialog-DBgJ-Nui.js.map → RestoreVersionDialog-CFYs13a4.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-LOas4rfU.js → RichTextEditorContent-DKkDQ0dc.js} +3 -3
- package/dist/cdn/chunks/{RichTextEditorContent-LOas4rfU.js.map → RichTextEditorContent-DKkDQ0dc.js.map} +1 -1
- package/dist/cdn/chunks/{SaveBlockDialog-Dx-QVQCX.js → SaveBlockDialog-BOA2RaC_.js} +6 -6
- package/dist/cdn/chunks/{SaveBlockDialog-Dx-QVQCX.js.map → SaveBlockDialog-BOA2RaC_.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-C2RQ-JCc.js → SavedBlocksBrowserModal-DQDVek3K.js} +4 -4
- package/dist/cdn/chunks/{SavedBlocksBrowserModal-C2RQ-JCc.js.map → SavedBlocksBrowserModal-DQDVek3K.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPanels-BmRbvqqL.js → SavedBlocksPanels-Lu3tJ3QA.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPanels-BmRbvqqL.js.map → SavedBlocksPanels-Lu3tJ3QA.js.map} +1 -1
- package/dist/cdn/chunks/{SavedBlocksPickBar-BzwKojoJ.js → SavedBlocksPickBar-D7MtqG6r.js} +2 -2
- package/dist/cdn/chunks/{SavedBlocksPickBar-BzwKojoJ.js.map → SavedBlocksPickBar-D7MtqG6r.js.map} +1 -1
- package/dist/cdn/chunks/{TemplateSettings-G-yV7C1C.js → TemplateSettings-rZiHmq24.js} +5 -5
- package/dist/cdn/chunks/{TemplateSettings-G-yV7C1C.js.map → TemplateSettings-rZiHmq24.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailModal-lOeztfTN.js → TestEmailModal-DWEyHXH2.js} +6 -6
- package/dist/cdn/chunks/{TestEmailModal-lOeztfTN.js.map → TestEmailModal-DWEyHXH2.js.map} +1 -1
- package/dist/cdn/chunks/{TestEmailPanel-CZswVkk_.js → TestEmailPanel-XXMD-Lnr.js} +2 -2
- package/dist/cdn/chunks/{TestEmailPanel-CZswVkk_.js.map → TestEmailPanel-XXMD-Lnr.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-CnTT2Y3H.js → TitleEditor-D1F0YoE-.js} +4 -4
- package/dist/cdn/chunks/{TitleEditor-CnTT2Y3H.js.map → TitleEditor-D1F0YoE-.js.map} +1 -1
- package/dist/cdn/chunks/{ToggleSwitch-CLHteVMO.js → ToggleSwitch-B5U9cqhi.js} +2 -2
- package/dist/cdn/chunks/{ToggleSwitch-CLHteVMO.js.map → ToggleSwitch-B5U9cqhi.js.map} +1 -1
- package/dist/cdn/chunks/{Toolbar-K4tIkpG1.js → Toolbar-C_5HfUQq.js} +55 -55
- package/dist/cdn/chunks/{Toolbar-K4tIkpG1.js.map → Toolbar-C_5HfUQq.js.map} +1 -1
- package/dist/cdn/chunks/{TplModal-OOT36AjS.js → TplModal-CYBbPCHL.js} +2 -2
- package/dist/cdn/chunks/{TplModal-OOT36AjS.js.map → TplModal-CYBbPCHL.js.map} +1 -1
- package/dist/cdn/chunks/{VersionHistoryPanels-BrpYRSfW.js → VersionHistoryPanels-Dq12VsTX.js} +2 -2
- package/dist/cdn/chunks/{VersionHistoryPanels-BrpYRSfW.js.map → VersionHistoryPanels-Dq12VsTX.js.map} +1 -1
- package/dist/cdn/chunks/{WrapperBlock-DdrnwH80.js → WrapperBlock-CJ0CLqi2.js} +2 -2
- package/dist/cdn/chunks/{WrapperBlock-DdrnwH80.js.map → WrapperBlock-CJ0CLqi2.js.map} +1 -1
- package/dist/cdn/chunks/{cloud-bhW8qTnh.js → cloud-h1vaHp2p.js} +2 -2
- package/dist/cdn/chunks/{cloud-bhW8qTnh.js.map → cloud-h1vaHp2p.js.map} +1 -1
- package/dist/cdn/chunks/{createCloudRuntime-CeRJkLR2.js → createCloudRuntime-bJN9EM1H.js} +3 -3
- package/dist/cdn/chunks/{createCloudRuntime-CeRJkLR2.js.map → createCloudRuntime-bJN9EM1H.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-xjRsIjMP.js → extensions-CrmXF4MW.js} +6 -6
- package/dist/cdn/chunks/extensions-CrmXF4MW.js.map +1 -0
- package/dist/{preRenderCustomBlocks-DAS48ZCp.js → cdn/chunks/preRenderCustomBlocks-CyGB3lZr.js} +5 -3
- package/dist/cdn/chunks/{preRenderCustomBlocks-CFwa7nP9.js.map → preRenderCustomBlocks-CyGB3lZr.js.map} +1 -1
- package/dist/cdn/chunks/{socialIcons-CsYnPPll.js → socialIcons-ClJVDZwt.js} +82 -101
- package/dist/cdn/chunks/socialIcons-ClJVDZwt.js.map +1 -0
- package/dist/cdn/chunks/{src-HA9F2kvk.js → src-B0pZeTYO.js} +200 -183
- package/dist/cdn/chunks/src-B0pZeTYO.js.map +1 -0
- package/dist/cdn/chunks/{src-CkXmV2I2.js → src-BMw3u-iV.js} +213 -215
- package/dist/cdn/chunks/src-BMw3u-iV.js.map +1 -0
- package/dist/cdn/chunks/{src-BcqNlDMe.js → src-Bh0MoJ67.js} +280 -187
- package/dist/cdn/chunks/src-Bh0MoJ67.js.map +1 -0
- package/dist/cdn/chunks/{useEditorCore-BF1ZhcGu.js → useEditorCore-DuC7kVti.js} +323 -319
- package/dist/cdn/chunks/useEditorCore-DuC7kVti.js.map +1 -0
- package/dist/cdn/chunks/{useLogicTag-91bO_SOi.js → useLogicTag-B3uV3XHG.js} +2 -2
- package/dist/cdn/chunks/{useLogicTag-91bO_SOi.js.map → useLogicTag-B3uV3XHG.js.map} +1 -1
- package/dist/cdn/chunks/{useMergeTag-hwifK582.js → useMergeTag-DJLM-7WQ.js} +2 -2
- package/dist/cdn/chunks/{useMergeTag-hwifK582.js.map → useMergeTag-DJLM-7WQ.js.map} +1 -1
- package/dist/cdn/chunks/{useScrollToBlock-BDNJ25X1.js → useScrollToBlock-CpmB5KxW.js} +2 -3
- package/dist/cdn/chunks/useScrollToBlock-CpmB5KxW.js.map +1 -0
- package/dist/cdn/chunks/withCurrentFont-isIyuezD.js +21 -0
- package/dist/cdn/chunks/withCurrentFont-isIyuezD.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +435 -417
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{cloud-CVfwPu19.js → cloud-DPGjMGfv.js} +1 -1
- package/dist/{createCloudRuntime-GRv_TDb2.js → createCloudRuntime-D0RRgWab.js} +2 -2
- package/dist/{dist-CSaWqmWM.js → dist-BI_LeQGl.js} +271 -200
- package/dist/{extensions-B65sfZRk.js → extensions-CYigjb1g.js} +13 -13
- package/dist/index.d.ts +34 -12
- package/dist/{cdn/chunks/preRenderCustomBlocks-CFwa7nP9.js → preRenderCustomBlocks-DokBGA_M.js} +3 -5
- package/dist/{socialIcons-CvAixjj8.js → socialIcons-Ct_IoqPQ.js} +107 -126
- package/dist/style.css +1 -1
- package/dist/templatical-editor.js +456 -438
- package/dist/{useEditorCore-DQSeKPE9.js → useEditorCore-BJAQMvNW.js} +482 -478
- package/dist/{useLogicTag-BH87j1vZ.js → useLogicTag-B5gjcMzn.js} +1 -1
- package/dist/{useMergeTag-DfPKX2Tk.js → useMergeTag-BwsBIDzR.js} +3 -3
- package/dist/{useScrollToBlock-Dr7Sb6Tr.js → useScrollToBlock-JRxhT1u_.js} +1 -2
- package/dist/withCurrentFont-C9vqrduu.js +19 -0
- package/package.json +8 -8
- package/dist/cdn/chunks/extensions-xjRsIjMP.js.map +0 -1
- package/dist/cdn/chunks/socialIcons-CsYnPPll.js.map +0 -1
- package/dist/cdn/chunks/src-BcqNlDMe.js.map +0 -1
- package/dist/cdn/chunks/src-CkXmV2I2.js.map +0 -1
- package/dist/cdn/chunks/src-HA9F2kvk.js.map +0 -1
- package/dist/cdn/chunks/useEditorCore-BF1ZhcGu.js.map +0 -1
- package/dist/cdn/chunks/useScrollToBlock-BDNJ25X1.js.map +0 -1
- package/dist/cdn/chunks/withCurrentFont-DeCbPVaE.js +0 -32
- package/dist/cdn/chunks/withCurrentFont-DeCbPVaE.js.map +0 -1
- package/dist/withCurrentFont-DeCbPVaE.js +0 -30
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as e, Ct as t, D as n, Dt as r, E as i, Et as a, S as o, T as s, X as c, _t as l, at as u, b as d, ct as f, dt as p, ft as m, ht as h, it as g, mt as _, nt as v, ot as y, pt as b, rt as x, st as S, tt as C, ut as ee, v as te, w as ne, wt as w, x as re } from "./src-Bh0MoJ67.js";
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region ../renderer/src/render-context.ts
|
|
4
|
-
var
|
|
4
|
+
var T = `https://cdn.jsdelivr.net/npm/@templatical/renderer@${{
|
|
5
5
|
name: "@templatical/renderer",
|
|
6
6
|
description: "Render Templatical email templates to MJML",
|
|
7
|
-
version: "0.
|
|
7
|
+
version: "0.46.0",
|
|
8
8
|
bugs: "https://github.com/templatical/sdk/issues",
|
|
9
9
|
dependencies: { "@templatical/types": "workspace:*" },
|
|
10
10
|
devDependencies: {
|
|
@@ -43,16 +43,7 @@ var S = `https://cdn.jsdelivr.net/npm/@templatical/renderer@${{
|
|
|
43
43
|
},
|
|
44
44
|
type: "module",
|
|
45
45
|
types: "./dist/index.d.ts"
|
|
46
|
-
}.version}/assets/social`,
|
|
47
|
-
arial: "Arial, sans-serif",
|
|
48
|
-
helvetica: "Helvetica, sans-serif",
|
|
49
|
-
georgia: "Georgia, serif",
|
|
50
|
-
"times new roman": "'Times New Roman', serif",
|
|
51
|
-
verdana: "Verdana, sans-serif",
|
|
52
|
-
"trebuchet ms": "'Trebuchet MS', sans-serif",
|
|
53
|
-
"courier new": "'Courier New', monospace",
|
|
54
|
-
tahoma: "Tahoma, sans-serif"
|
|
55
|
-
}, C = class e {
|
|
46
|
+
}.version}/assets/social`, E = class e {
|
|
56
47
|
containerWidth;
|
|
57
48
|
customFonts;
|
|
58
49
|
defaultFallbackFont;
|
|
@@ -61,31 +52,34 @@ var S = `https://cdn.jsdelivr.net/npm/@templatical/renderer@${{
|
|
|
61
52
|
socialIconsBaseUrl;
|
|
62
53
|
blockRenderers;
|
|
63
54
|
contentDirection;
|
|
64
|
-
constructor(e, t, n, r, i = /* @__PURE__ */ new Map(), a =
|
|
55
|
+
constructor(e, t, n, r, i = /* @__PURE__ */ new Map(), a = T, o = {}, s = "ltr") {
|
|
65
56
|
this.containerWidth = e, this.customFonts = t, this.defaultFallbackFont = n, this.allowHtmlBlocks = r, this.customBlockHtml = i, this.socialIconsBaseUrl = a, this.blockRenderers = o, this.contentDirection = s;
|
|
66
57
|
}
|
|
67
58
|
withContainerWidth(t) {
|
|
68
59
|
return new e(t, this.customFonts, this.defaultFallbackFont, this.allowHtmlBlocks, this.customBlockHtml, this.socialIconsBaseUrl, this.blockRenderers, this.contentDirection);
|
|
69
60
|
}
|
|
70
61
|
resolveFontFamily(e) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
let t = re(e);
|
|
63
|
+
if (t.length !== 1) return e;
|
|
64
|
+
let [n] = t, r = n.name.toLowerCase();
|
|
65
|
+
for (let e of this.customFonts) if (e.name.toLowerCase() === r) {
|
|
66
|
+
let t = e.fallback ?? this.defaultFallbackFont;
|
|
67
|
+
return `'${e.name}', ${t}`;
|
|
74
68
|
}
|
|
75
|
-
return
|
|
69
|
+
return te[r] || (d(n) ? e : `${o(n.name)}, ${this.defaultFallbackFont}`);
|
|
76
70
|
}
|
|
77
71
|
};
|
|
78
72
|
//#endregion
|
|
79
73
|
//#region ../renderer/src/visibility.ts
|
|
80
|
-
function
|
|
74
|
+
function D(e) {
|
|
81
75
|
let t = e.visibility;
|
|
82
76
|
return t ? !t.desktop && !t.mobile : !1;
|
|
83
77
|
}
|
|
84
|
-
function
|
|
85
|
-
let n = [
|
|
78
|
+
function O(e, t = []) {
|
|
79
|
+
let n = [k(e), ...t].filter((e) => e !== "").join(" ");
|
|
86
80
|
return n === "" ? "" : ` css-class="${n}"`;
|
|
87
81
|
}
|
|
88
|
-
function
|
|
82
|
+
function k(e) {
|
|
89
83
|
let t = e.visibility;
|
|
90
84
|
if (!t) return "";
|
|
91
85
|
let n = [];
|
|
@@ -93,94 +87,98 @@ function E(e) {
|
|
|
93
87
|
}
|
|
94
88
|
//#endregion
|
|
95
89
|
//#region ../renderer/src/unrenderable.ts
|
|
96
|
-
var
|
|
97
|
-
function
|
|
90
|
+
var A = "templatical:unrenderable-block";
|
|
91
|
+
function j(e) {
|
|
98
92
|
return e.replace(/[<>]/g, "").replace(/-{2,}/g, "-");
|
|
99
93
|
}
|
|
100
|
-
function
|
|
101
|
-
return console.warn(`[Templatical] No renderer for block type "${e.type}" (id: ${e.id}). A placeholder comment was emitted in its place. Pass a \`blockRenderers\` entry for this type to render it.`), `<mj-raw><!-- ${
|
|
94
|
+
function M(e) {
|
|
95
|
+
return console.warn(`[Templatical] No renderer for block type "${e.type}" (id: ${e.id}). A placeholder comment was emitted in its place. Pass a \`blockRenderers\` entry for this type to render it.`), `<mj-raw><!-- ${A} type="${j(e.type)}" id="${j(e.id)}" --></mj-raw>`;
|
|
102
96
|
}
|
|
103
97
|
//#endregion
|
|
104
98
|
//#region ../renderer/src/escape.ts
|
|
105
|
-
var
|
|
99
|
+
var N = {
|
|
106
100
|
"&": "&",
|
|
107
101
|
"<": "<",
|
|
108
102
|
">": ">",
|
|
109
103
|
"\"": """,
|
|
110
104
|
"'": "'"
|
|
111
|
-
},
|
|
112
|
-
function
|
|
113
|
-
return e === "" ? "" : e.replace(
|
|
105
|
+
}, P = /[&<>"']/g;
|
|
106
|
+
function F(e) {
|
|
107
|
+
return e === "" ? "" : e.replace(P, (e) => N[e] ?? e);
|
|
114
108
|
}
|
|
115
|
-
function
|
|
116
|
-
return e === "" ? "" : e.replace(
|
|
109
|
+
function I(e) {
|
|
110
|
+
return e === "" ? "" : e.replace(P, (e) => N[e] ?? e);
|
|
117
111
|
}
|
|
118
|
-
function
|
|
119
|
-
return e === "" ? "" :
|
|
112
|
+
function L(e) {
|
|
113
|
+
return e === "" ? "" : I(e).replace(/[;{}\r\n]/g, "");
|
|
120
114
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
115
|
+
var ie = /[&<>"]/g;
|
|
116
|
+
function R(e) {
|
|
117
|
+
return e.replace(ie, (e) => N[e] ?? e);
|
|
118
|
+
}
|
|
119
|
+
function z(e) {
|
|
120
|
+
return e === "" ? "" : ae(e, (e) => B(e, "data-merge-tag") ?? B(e, "data-logic-merge-tag"));
|
|
121
|
+
}
|
|
122
|
+
function ae(t, n) {
|
|
123
|
+
let r = "", i = 0;
|
|
124
|
+
for (; i < t.length;) {
|
|
125
|
+
let a = t.indexOf("<span", i);
|
|
126
|
+
if (a === -1) {
|
|
127
|
+
r += t.substring(i);
|
|
130
128
|
break;
|
|
131
129
|
}
|
|
132
|
-
let
|
|
133
|
-
if (
|
|
134
|
-
|
|
130
|
+
let o = t[a + 5];
|
|
131
|
+
if (o !== ">" && o !== " " && o !== " " && o !== "\n" && o !== "\r" && o !== "/") {
|
|
132
|
+
r += t.substring(i, a + 5), i = a + 5;
|
|
135
133
|
continue;
|
|
136
134
|
}
|
|
137
|
-
let
|
|
138
|
-
if (
|
|
139
|
-
|
|
135
|
+
let s = e(t, a + 5);
|
|
136
|
+
if (s === -1) {
|
|
137
|
+
r += t.substring(i);
|
|
140
138
|
break;
|
|
141
139
|
}
|
|
142
|
-
let
|
|
143
|
-
if (
|
|
144
|
-
|
|
140
|
+
let c = t.indexOf("</span>", s + 1);
|
|
141
|
+
if (c === -1) {
|
|
142
|
+
r += t.substring(i);
|
|
145
143
|
break;
|
|
146
144
|
}
|
|
147
|
-
let
|
|
148
|
-
|
|
145
|
+
let l = n(t.substring(a + 5, s));
|
|
146
|
+
l === null ? (r += t.substring(i, a + 5), i = a + 5) : (r += t.substring(i, a), r += l, i = c + 7);
|
|
149
147
|
}
|
|
150
|
-
return
|
|
148
|
+
return r;
|
|
151
149
|
}
|
|
152
|
-
function
|
|
150
|
+
function B(e, t) {
|
|
153
151
|
return ne(e, t);
|
|
154
152
|
}
|
|
155
153
|
//#endregion
|
|
156
154
|
//#region ../renderer/src/padding.ts
|
|
157
|
-
function
|
|
155
|
+
function V(e) {
|
|
158
156
|
return `${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`;
|
|
159
157
|
}
|
|
160
158
|
//#endregion
|
|
161
159
|
//#region ../renderer/src/utils.ts
|
|
162
|
-
function
|
|
160
|
+
function H(e, t) {
|
|
163
161
|
return e ? ` ${t === "native" ? "background-color" : "container-background-color"}="${e}"` : "";
|
|
164
162
|
}
|
|
165
|
-
function
|
|
163
|
+
function U(e) {
|
|
166
164
|
return typeof e != "number" || !Number.isFinite(e) || e <= 0 ? "" : ` height="${e}px"`;
|
|
167
165
|
}
|
|
168
|
-
function
|
|
169
|
-
return Object.entries(
|
|
166
|
+
function W(e) {
|
|
167
|
+
return Object.entries(a(e)).map(([e, t]) => ` ${e}="${L(t)}"`).join("");
|
|
170
168
|
}
|
|
171
|
-
function
|
|
172
|
-
let t =
|
|
169
|
+
function G(e) {
|
|
170
|
+
let t = r(e);
|
|
173
171
|
return t === null ? "" : ` border-radius="${t}"`;
|
|
174
172
|
}
|
|
175
173
|
//#endregion
|
|
176
174
|
//#region ../renderer/src/rich-text.ts
|
|
177
|
-
var
|
|
178
|
-
function
|
|
179
|
-
return `${
|
|
175
|
+
var K = "tpl-rich-text";
|
|
176
|
+
function q(e) {
|
|
177
|
+
return `${K}-${e}`;
|
|
180
178
|
}
|
|
181
|
-
function
|
|
182
|
-
let n =
|
|
183
|
-
let t = `.${
|
|
179
|
+
function oe(e, t = "ltr") {
|
|
180
|
+
let n = w, r = `.${K}`, i = [...new Set(e)].sort((e, t) => e - t).flatMap((e) => {
|
|
181
|
+
let t = `.${q(e)}`;
|
|
184
182
|
return [`${t} p { margin: 0 0 ${e}px; }`, `${t} p:last-child { margin-bottom: 0; }`];
|
|
185
183
|
}), a = t === "rtl" ? "padding-right" : "padding-left";
|
|
186
184
|
return [
|
|
@@ -189,41 +187,41 @@ function ae(e, t = "ltr") {
|
|
|
189
187
|
`${r} li { margin: ${n.listItemMarginY}px 0; }`
|
|
190
188
|
].join("\n ");
|
|
191
189
|
}
|
|
192
|
-
function
|
|
193
|
-
return e ??
|
|
190
|
+
function J(e) {
|
|
191
|
+
return e ?? w.paragraphGap;
|
|
194
192
|
}
|
|
195
|
-
function
|
|
196
|
-
let t = [
|
|
197
|
-
if (e.type === "paragraph" && t.push(
|
|
198
|
-
else if (
|
|
193
|
+
function se(e) {
|
|
194
|
+
let t = [w.paragraphGap], n = (e) => {
|
|
195
|
+
if (e.type === "paragraph" && t.push(J(e.paragraphSpacing)), f(e)) for (let t of e.children) for (let e of t) n(e);
|
|
196
|
+
else if (h(e)) for (let t of e.children) n(t);
|
|
199
197
|
};
|
|
200
198
|
for (let t of e) n(t);
|
|
201
199
|
return t;
|
|
202
200
|
}
|
|
203
201
|
//#endregion
|
|
204
202
|
//#region ../renderer/src/renderers/title.ts
|
|
205
|
-
function
|
|
206
|
-
if (
|
|
207
|
-
let
|
|
203
|
+
function ce(e, n) {
|
|
204
|
+
if (D(e)) return "";
|
|
205
|
+
let r = V(e.styles.padding), i = H(e.styles.backgroundColor, "container"), a = le(z(e.content)), o = t[e.level] ?? t[2], s = e.color ? `\n color="${I(e.color)}"` : "", c = e.textAlign, l = ue(e.fontFamily, n), u = O(e, [K, q(J(void 0))]), d = `h${t[e.level] ? e.level : 2}`;
|
|
208
206
|
return `<mj-text
|
|
209
|
-
font-size="${
|
|
210
|
-
align="${
|
|
207
|
+
font-size="${o}px"${s}
|
|
208
|
+
align="${c}"
|
|
211
209
|
line-height="1.3"
|
|
212
|
-
padding="${
|
|
213
|
-
><${
|
|
210
|
+
padding="${r}"${i}${l}${u}
|
|
211
|
+
><${d} style="margin:0;font-size:inherit;color:inherit;line-height:inherit">${a}</${d}></mj-text>`;
|
|
214
212
|
}
|
|
215
|
-
function
|
|
213
|
+
function le(e) {
|
|
216
214
|
let t = e.match(/^\s*<p\b[^>]*>([\s\S]*)<\/p>\s*$/);
|
|
217
215
|
return !t || /<\/p>\s*<p\b/i.test(t[1]) ? e : t[1];
|
|
218
216
|
}
|
|
219
|
-
function
|
|
220
|
-
return e ? ` font-family="${t.resolveFontFamily(e)}"` : "";
|
|
217
|
+
function ue(e, t) {
|
|
218
|
+
return e ? ` font-family="${R(t.resolveFontFamily(e))}"` : "";
|
|
221
219
|
}
|
|
222
220
|
//#endregion
|
|
223
221
|
//#region ../renderer/src/renderers/paragraph.ts
|
|
224
|
-
function
|
|
225
|
-
if (
|
|
226
|
-
let n =
|
|
222
|
+
function de(e, t) {
|
|
223
|
+
if (D(e) || e.content.replace(/<\/?p\b[^<>]*>/gi, "").trim() === "") return "";
|
|
224
|
+
let n = V(e.styles.padding), r = H(e.styles.backgroundColor, "container"), i = z(e.content), a = O(e, [K, q(J(e.paragraphSpacing))]);
|
|
227
225
|
return `<mj-text
|
|
228
226
|
line-height="1.5"${t.contentDirection === "rtl" ? "\n align=\"right\"" : ""}
|
|
229
227
|
padding="${n}"${r}${a}
|
|
@@ -231,14 +229,14 @@ function ue(e, t) {
|
|
|
231
229
|
}
|
|
232
230
|
//#endregion
|
|
233
231
|
//#region ../renderer/src/renderers/image.ts
|
|
234
|
-
function
|
|
235
|
-
if (
|
|
236
|
-
let n =
|
|
237
|
-
e.linkUrl && (l = ` href="${
|
|
238
|
-
let u =
|
|
232
|
+
function fe(e, t) {
|
|
233
|
+
if (D(e) || e.src === "") return "";
|
|
234
|
+
let n = V(e.styles.padding), r = H(e.styles.backgroundColor, "container"), i = e.width === "full" ? t.containerWidth + "px" : e.width + "px", a = U(e.height), o = O(e), s = G(e.borderRadius), c = W(e.border), l = "";
|
|
235
|
+
e.linkUrl && (l = ` href="${I(e.linkUrl)}"`, e.linkOpenInNewTab && (l += " target=\"_blank\" rel=\"noopener\""));
|
|
236
|
+
let u = I(e.src), d = e.decorative === !0;
|
|
239
237
|
return `<mj-image
|
|
240
238
|
src="${u}"
|
|
241
|
-
alt="${d ? "" :
|
|
239
|
+
alt="${d ? "" : I(e.alt)}"
|
|
242
240
|
width="${i}"${a}
|
|
243
241
|
align="${e.align}"
|
|
244
242
|
padding="${n}"${r}${c}${s}${l}${o}${d ? " role=\"presentation\"" : ""}
|
|
@@ -246,69 +244,69 @@ function de(e, t) {
|
|
|
246
244
|
}
|
|
247
245
|
//#endregion
|
|
248
246
|
//#region ../renderer/src/renderers/button.ts
|
|
249
|
-
var
|
|
250
|
-
function
|
|
251
|
-
if (
|
|
252
|
-
let n =
|
|
247
|
+
var Y = "tpl-button-full";
|
|
248
|
+
function pe(e, t) {
|
|
249
|
+
if (D(e)) return "";
|
|
250
|
+
let n = V(e.styles.padding), r = H(e.styles.backgroundColor, "container"), i = V(e.buttonPadding), a = e.url === "" ? "" : I(e.url), o = a === "" ? "" : ` href="${a}"`, s = me(e.backgroundColor), c = I(e.textColor), l = e.fontSize, u = ge(e.borderRadius), d = F(e.text), f = e.openInNewTab ? " target=\"_blank\" rel=\"noopener\"" : "", p = he(e.fontFamily, t), m = _e(e.width), h = O(e, e.width === "full" ? [Y] : []);
|
|
253
251
|
return `<mj-button${o}${f}
|
|
254
252
|
background-color="${s}"
|
|
255
253
|
color="${c}"
|
|
256
254
|
font-size="${l}px"
|
|
257
255
|
font-weight="bold"
|
|
258
|
-
border-radius="${u}"${
|
|
256
|
+
border-radius="${u}"${W(e.border)}
|
|
259
257
|
inner-padding="${i}"
|
|
260
258
|
align="${e.align ?? "center"}"
|
|
261
259
|
padding="${n}"${r}${p}${m}${h}
|
|
262
260
|
>${d}</mj-button>`;
|
|
263
261
|
}
|
|
264
|
-
function
|
|
265
|
-
return e.trim() === "" ? "transparent" :
|
|
262
|
+
function me(e) {
|
|
263
|
+
return e.trim() === "" ? "transparent" : I(e);
|
|
266
264
|
}
|
|
267
|
-
function
|
|
268
|
-
return e ? ` font-family="${t.resolveFontFamily(e)}"` : "";
|
|
269
|
-
}
|
|
270
|
-
function he(e) {
|
|
271
|
-
return typeof e == "number" ? `${e}px` : i(e) ?? "0px";
|
|
265
|
+
function he(e, t) {
|
|
266
|
+
return e ? ` font-family="${R(t.resolveFontFamily(e))}"` : "";
|
|
272
267
|
}
|
|
273
268
|
function ge(e) {
|
|
269
|
+
return typeof e == "number" ? `${e}px` : r(e) ?? "0px";
|
|
270
|
+
}
|
|
271
|
+
function _e(e) {
|
|
274
272
|
return e === void 0 ? "" : ` width="${e === "full" ? "100%" : `${e}px`}"`;
|
|
275
273
|
}
|
|
276
274
|
//#endregion
|
|
277
275
|
//#region ../renderer/src/renderers/divider.ts
|
|
278
|
-
function
|
|
279
|
-
if (
|
|
280
|
-
let n =
|
|
276
|
+
function ve(e, t) {
|
|
277
|
+
if (D(e)) return "";
|
|
278
|
+
let n = V(e.styles.padding), r = e.styles.backgroundColor ? ` container-background-color="${I(e.styles.backgroundColor)}"` : "", i = e.width === "full" ? "100%" : typeof e.width == "number" ? `${e.width}px` : e.width;
|
|
281
279
|
return `<mj-divider
|
|
282
280
|
border-width="${e.thickness}px"
|
|
283
281
|
border-style="${e.lineStyle}"
|
|
284
|
-
border-color="${
|
|
282
|
+
border-color="${I(e.color)}"
|
|
285
283
|
width="${i}"
|
|
286
|
-
padding="${n}"${r}${
|
|
284
|
+
padding="${n}"${r}${O(e)}
|
|
287
285
|
/>`;
|
|
288
286
|
}
|
|
289
287
|
//#endregion
|
|
290
288
|
//#region ../renderer/src/renderers/spacer.ts
|
|
291
|
-
function
|
|
292
|
-
return
|
|
289
|
+
function ye(e, t) {
|
|
290
|
+
return D(e) ? "" : `<mj-spacer height="${e.height}px" padding="0"${e.styles.backgroundColor ? ` container-background-color="${I(e.styles.backgroundColor)}"` : ""}${O(e)} />`;
|
|
293
291
|
}
|
|
294
292
|
//#endregion
|
|
295
293
|
//#region ../renderer/src/renderers/html.ts
|
|
296
|
-
function
|
|
297
|
-
if (
|
|
294
|
+
function be(e, t) {
|
|
295
|
+
if (D(e) || !t.allowHtmlBlocks) return "";
|
|
298
296
|
let n = e.content;
|
|
299
297
|
if (n === "") return "";
|
|
300
|
-
let r =
|
|
301
|
-
return `<mj-text padding="${
|
|
298
|
+
let r = O(e);
|
|
299
|
+
return `<mj-text padding="${V(e.styles.padding)}"${H(e.styles.backgroundColor, "container")}${r}>
|
|
302
300
|
${n}
|
|
303
301
|
</mj-text>`;
|
|
304
302
|
}
|
|
305
303
|
//#endregion
|
|
306
304
|
//#region ../renderer/src/renderers/social.ts
|
|
307
|
-
function
|
|
308
|
-
if (
|
|
305
|
+
function xe(e, t) {
|
|
306
|
+
if (D(e)) return "";
|
|
309
307
|
let n = e.icons;
|
|
310
308
|
if (n.length === 0) return "";
|
|
311
|
-
let r =
|
|
309
|
+
let r = V(e.styles.padding), i = e.styles.backgroundColor ? ` container-background-color="${I(e.styles.backgroundColor)}"` : "", a = O(e), o = e.align, s = e.iconSize, c = e.iconStyle, u = l(c, e.iconTone), d = e.spacing, f;
|
|
312
310
|
switch (s) {
|
|
313
311
|
case "small":
|
|
314
312
|
f = 24;
|
|
@@ -339,83 +337,83 @@ function be(e, t) {
|
|
|
339
337
|
padding="${r}"${i}${a}
|
|
340
338
|
>
|
|
341
339
|
${n.map((e, n) => {
|
|
342
|
-
let r = e.platform, i =
|
|
340
|
+
let r = e.platform, i = I(e.url), a = `${t.socialIconsBaseUrl}/${u}/${r}.png`, o = n === m - 1 ? 0 : d;
|
|
343
341
|
return `<mj-social-element src="${a}" href="${i}" icon-size="${f}px" padding="0 ${o}px 0 0" border-radius="${p}" background-color="transparent"></mj-social-element>`;
|
|
344
342
|
}).join("\n")}
|
|
345
343
|
</mj-social>`;
|
|
346
344
|
}
|
|
347
345
|
//#endregion
|
|
348
346
|
//#region ../renderer/src/renderers/menu.ts
|
|
349
|
-
function
|
|
350
|
-
if (
|
|
351
|
-
let n =
|
|
347
|
+
function Se(e, t) {
|
|
348
|
+
if (D(e) || e.items.length === 0) return "";
|
|
349
|
+
let n = V(e.styles.padding), r = H(e.styles.backgroundColor, "container"), i = O(e), a = Te(e.fontFamily, t), o = e.textAlign;
|
|
352
350
|
return `<mj-text
|
|
353
|
-
font-size="${e.fontSize}px"${e.color ? `\n color="${
|
|
351
|
+
font-size="${e.fontSize}px"${e.color ? `\n color="${I(e.color)}"` : ""}
|
|
354
352
|
align="${o}"
|
|
355
353
|
line-height="1.5"
|
|
356
354
|
padding="${n}"${r}${a}${i}
|
|
357
|
-
>${
|
|
355
|
+
>${Ce(e)}</mj-text>`;
|
|
358
356
|
}
|
|
359
|
-
function
|
|
360
|
-
let t = e.items, n =
|
|
361
|
-
for (let e = 0; e < s; e++) o.push(
|
|
357
|
+
function Ce(e) {
|
|
358
|
+
let t = e.items, n = F(e.separator), r = L(e.separatorColor), i = e.spacing, a = e.linkColor ?? e.color, o = [], s = t.length;
|
|
359
|
+
for (let e = 0; e < s; e++) o.push(we(t[e], a)), e < s - 1 && o.push(`<span style="color: ${r}; padding: 0 ${i}px;">${n}</span>`);
|
|
362
360
|
return o.join("");
|
|
363
361
|
}
|
|
364
|
-
function Ce(e, t) {
|
|
365
|
-
let n = M(e.text), r = N(e.url), i = e.color ?? t, a = e.openInNewTab ? " target=\"_blank\" rel=\"noopener\"" : "", o = ["text-decoration: none"];
|
|
366
|
-
return i && o.unshift(`color: ${P(i)}`), e.bold && o.push("font-weight: bold"), e.underline && o.push("text-decoration: underline"), `<a href="${r}" style="${o.join("; ")}"${a}>${n}</a>`;
|
|
367
|
-
}
|
|
368
362
|
function we(e, t) {
|
|
369
|
-
|
|
363
|
+
let n = F(e.text), r = I(e.url), i = e.color ?? t, a = e.openInNewTab ? " target=\"_blank\" rel=\"noopener\"" : "", o = ["text-decoration: none"];
|
|
364
|
+
return i && o.unshift(`color: ${L(i)}`), e.bold && o.push("font-weight: bold"), e.underline && o.push("text-decoration: underline"), `<a href="${r}" style="${o.join("; ")}"${a}>${n}</a>`;
|
|
365
|
+
}
|
|
366
|
+
function Te(e, t) {
|
|
367
|
+
return e ? ` font-family="${R(t.resolveFontFamily(e))}"` : "";
|
|
370
368
|
}
|
|
371
369
|
//#endregion
|
|
372
370
|
//#region ../renderer/src/renderers/table.ts
|
|
373
|
-
function
|
|
374
|
-
if (
|
|
375
|
-
let n =
|
|
371
|
+
function Ee(e, t) {
|
|
372
|
+
if (D(e) || e.rows.length === 0) return "";
|
|
373
|
+
let n = V(e.styles.padding), r = H(e.styles.backgroundColor, "container"), i = O(e), a = Ae(e.fontFamily, t);
|
|
376
374
|
return `<mj-text
|
|
377
|
-
font-size="${e.fontSize}px"${e.color ? `\n color="${
|
|
375
|
+
font-size="${e.fontSize}px"${e.color ? `\n color="${I(e.color)}"` : ""}
|
|
378
376
|
align="${e.textAlign}"
|
|
379
377
|
line-height="1.5"
|
|
380
378
|
padding="${n}"${r}${a}${i}
|
|
381
|
-
>${
|
|
379
|
+
>${De(e)}</mj-text>`;
|
|
382
380
|
}
|
|
383
|
-
function
|
|
384
|
-
let t =
|
|
381
|
+
function De(e) {
|
|
382
|
+
let t = L(e.borderColor), n = e.borderWidth, r = "";
|
|
385
383
|
for (let i = 0; i < e.rows.length; i++) {
|
|
386
384
|
let a = e.rows[i];
|
|
387
|
-
r +=
|
|
385
|
+
r += Oe(a, e, e.hasHeaderRow && i === 0, t, n);
|
|
388
386
|
}
|
|
389
387
|
return `<table style="width: 100%; border-collapse: collapse;">${r}</table>`;
|
|
390
388
|
}
|
|
391
|
-
function
|
|
389
|
+
function Oe(e, t, n, r, i) {
|
|
392
390
|
let a = "";
|
|
393
|
-
for (let o of e.cells) a +=
|
|
391
|
+
for (let o of e.cells) a += ke(o, t, n, r, i);
|
|
394
392
|
return `<tr>${a}</tr>`;
|
|
395
393
|
}
|
|
396
|
-
function
|
|
394
|
+
function ke(e, t, n, r, i) {
|
|
397
395
|
let a = t.cellPadding, o = [`border: ${i}px solid ${r}`, `padding: ${a}px`];
|
|
398
|
-
n && (o.push("font-weight: bold"), t.headerBackgroundColor && o.push(`background-color: ${
|
|
399
|
-
let s = o.join("; "), c =
|
|
396
|
+
n && (o.push("font-weight: bold"), t.headerBackgroundColor && o.push(`background-color: ${L(t.headerBackgroundColor)}`));
|
|
397
|
+
let s = o.join("; "), c = F(z(e.content)), l = n ? "th" : "td";
|
|
400
398
|
return `<${l} style="${s}">${c}</${l}>`;
|
|
401
399
|
}
|
|
402
|
-
function
|
|
403
|
-
return e ? ` font-family="${t.resolveFontFamily(e)}"` : "";
|
|
400
|
+
function Ae(e, t) {
|
|
401
|
+
return e ? ` font-family="${R(t.resolveFontFamily(e))}"` : "";
|
|
404
402
|
}
|
|
405
403
|
//#endregion
|
|
406
404
|
//#region ../renderer/src/renderers/custom.ts
|
|
407
|
-
function
|
|
408
|
-
if (
|
|
405
|
+
function je(e, t) {
|
|
406
|
+
if (D(e)) return "";
|
|
409
407
|
let n = t.customBlockHtml.get(e.id) ?? e.renderedHtml;
|
|
410
408
|
if (!n || n === "") return "";
|
|
411
|
-
let r =
|
|
412
|
-
return `<mj-text padding="${
|
|
409
|
+
let r = O(e);
|
|
410
|
+
return `<mj-text padding="${V(e.styles.padding)}"${H(e.styles.backgroundColor, "container")}${r}>
|
|
413
411
|
${n}
|
|
414
412
|
</mj-text>`;
|
|
415
413
|
}
|
|
416
414
|
//#endregion
|
|
417
415
|
//#region ../renderer/src/columns.ts
|
|
418
|
-
function
|
|
416
|
+
function X(e) {
|
|
419
417
|
switch (e) {
|
|
420
418
|
case "2": return ["50%", "50%"];
|
|
421
419
|
case "3": return [
|
|
@@ -428,7 +426,7 @@ function K(e) {
|
|
|
428
426
|
default: return ["100%"];
|
|
429
427
|
}
|
|
430
428
|
}
|
|
431
|
-
function
|
|
429
|
+
function Me(e, t) {
|
|
432
430
|
switch (e) {
|
|
433
431
|
case "2": return [t * .5, t * .5];
|
|
434
432
|
case "3": return [
|
|
@@ -443,7 +441,7 @@ function q(e, t) {
|
|
|
443
441
|
}
|
|
444
442
|
//#endregion
|
|
445
443
|
//#region ../renderer/src/display-condition.ts
|
|
446
|
-
function
|
|
444
|
+
function Z(e, t) {
|
|
447
445
|
if (t === "") return "";
|
|
448
446
|
let n = e.displayCondition;
|
|
449
447
|
return n ? `<mj-raw>${n.before}</mj-raw>
|
|
@@ -452,28 +450,28 @@ function J(e, t) {
|
|
|
452
450
|
}
|
|
453
451
|
//#endregion
|
|
454
452
|
//#region ../renderer/src/renderers/section.ts
|
|
455
|
-
function
|
|
456
|
-
if (
|
|
457
|
-
let r = e.columns, i =
|
|
458
|
-
for (let e = 0; e <
|
|
459
|
-
let r =
|
|
460
|
-
|
|
453
|
+
function Ne(e, t, n) {
|
|
454
|
+
if (D(e)) return "";
|
|
455
|
+
let r = e.columns, i = X(r), a = Me(r, t.containerWidth), o = V(e.styles.padding), s = H(e.styles.backgroundColor, "native"), c = O(e), l = G(e.borderRadius), u = W(e.border), d = t.contentDirection === "rtl" ? " direction=\"rtl\"" : "", p = e.children, m = [];
|
|
456
|
+
for (let e = 0; e < p.length; e++) {
|
|
457
|
+
let r = p[e], o = i[e] ?? "100%", s = Math.floor(a[e] ?? t.containerWidth), c = Pe(r, t.allowHtmlBlocks).filter((e) => !f(e)), l = t.withContainerWidth(s), u = c.map((e) => Z(e, n(e, l))).filter((e) => e !== "").join("\n");
|
|
458
|
+
m.push(`<mj-column width="${o}"${d}>
|
|
461
459
|
${u === "" ? "<mj-text> </mj-text>" : u}
|
|
462
460
|
</mj-column>`);
|
|
463
461
|
}
|
|
464
|
-
let
|
|
462
|
+
let h = m.join("\n");
|
|
465
463
|
return `<mj-section${s} padding="${o}"${u}${l}${c}${d}>
|
|
466
|
-
${e.stackOnMobile === !1 &&
|
|
467
|
-
${
|
|
468
|
-
</mj-group>` :
|
|
464
|
+
${e.stackOnMobile === !1 && m.length > 1 ? `<mj-group${d}>
|
|
465
|
+
${h}
|
|
466
|
+
</mj-group>` : h}
|
|
469
467
|
</mj-section>`;
|
|
470
468
|
}
|
|
471
|
-
function
|
|
469
|
+
function Pe(e, t) {
|
|
472
470
|
return t ? e : e.filter((e) => e.type !== "html");
|
|
473
471
|
}
|
|
474
472
|
//#endregion
|
|
475
473
|
//#region ../renderer/src/renderers/video.ts
|
|
476
|
-
function
|
|
474
|
+
function Fe(e, t) {
|
|
477
475
|
if (t) return t;
|
|
478
476
|
if (!e) return null;
|
|
479
477
|
for (let t of [/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/, /youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})/]) {
|
|
@@ -483,79 +481,79 @@ function Ne(e, t) {
|
|
|
483
481
|
let n = e.match(/vimeo\.com\/(?:video\/)?(\d+)/);
|
|
484
482
|
return n ? `https://vumbnail.com/${n[1]}.jpg` : null;
|
|
485
483
|
}
|
|
486
|
-
function
|
|
487
|
-
if (
|
|
488
|
-
let n =
|
|
484
|
+
function Ie(e, t) {
|
|
485
|
+
if (D(e)) return "";
|
|
486
|
+
let n = Fe(e.url, e.thumbnailUrl);
|
|
489
487
|
if (!n) return "";
|
|
490
|
-
let r =
|
|
488
|
+
let r = V(e.styles.padding), i = H(e.styles.backgroundColor, "container"), a = e.width === "full" ? t.containerWidth + "px" : e.width + "px", o = U(e.height), s = O(e);
|
|
491
489
|
return `<mj-image
|
|
492
|
-
src="${
|
|
493
|
-
alt="${
|
|
490
|
+
src="${I(n)}"
|
|
491
|
+
alt="${I(e.alt)}"
|
|
494
492
|
width="${a}"${o}
|
|
495
493
|
align="${e.align}"
|
|
496
494
|
padding="${r}"
|
|
497
|
-
href="${
|
|
495
|
+
href="${I(e.url)}"
|
|
498
496
|
target="_blank"
|
|
499
497
|
rel="noopener"${i}${s}
|
|
500
498
|
/>`;
|
|
501
499
|
}
|
|
502
500
|
//#endregion
|
|
503
501
|
//#region ../renderer/src/renderers/index.ts
|
|
504
|
-
function
|
|
505
|
-
let
|
|
506
|
-
return
|
|
502
|
+
function Q(e, t) {
|
|
503
|
+
let n = t.blockRenderers[e.type];
|
|
504
|
+
return n ? n(e, t) : f(e) ? Ne(e, t, Q) : b(e) ? ce(e, t) : S(e) ? de(e, t) : u(e) ? fe(e, t) : C(e) ? pe(e, t) : x(e) ? ve(e, t) : p(e) ? ye(e, t) : g(e) ? be(e, t) : ee(e) ? xe(e, t) : y(e) ? Se(e, t) : m(e) ? Ee(e, t) : _(e) ? Ie(e, t) : v(e) ? je(e, t) : D(e) ? "" : M(e);
|
|
507
505
|
}
|
|
508
506
|
//#endregion
|
|
509
507
|
//#region ../renderer/src/index.ts
|
|
510
|
-
var
|
|
511
|
-
async function
|
|
512
|
-
let
|
|
513
|
-
return `<mjml lang="${
|
|
514
|
-
<mj-head>${
|
|
508
|
+
var Le = `.${Y} a { display: block !important; }`;
|
|
509
|
+
async function Re(e, t) {
|
|
510
|
+
let r = t?.layout ? s(t.layout, e) : (i(e), n(e), e), a = t?.customFonts ?? [], o = t?.defaultFallbackFont ?? "Arial, sans-serif", l = t?.allowHtmlBlocks ?? !0, u = He(t?.socialIconsBaseUrl ?? T), d = await Ke(r, t?.renderCustomBlock), f = qe(r, t?.getCustomBlockStylesheet), p = c(r.settings), m = new E(r.settings.width, a, o, l, d, u, t?.blockRenderers ?? {}, p), h = Ge(r.blocks, l), g = m.resolveFontFamily(r.settings.fontFamily), _ = r.settings.backgroundColor, v = r.settings.textColor ? ` color="${I(r.settings.textColor)}"` : "", y = r.settings.linkColor ? L(r.settings.linkColor) : "inherit", b = r.settings.linkUnderline ? "underline" : "none", x = h.map((e) => ze(e, m)).filter((e) => e !== "").join("\n"), S = We(a), C = Ue(r.settings.preheaderText);
|
|
511
|
+
return `<mjml lang="${I(r.settings.locale)}" dir="${I(p)}">
|
|
512
|
+
<mj-head>${C}
|
|
515
513
|
<mj-attributes>
|
|
516
|
-
<mj-all font-family="${
|
|
517
|
-
<mj-text font-size="14px"${
|
|
514
|
+
<mj-all font-family="${R(g)}" />
|
|
515
|
+
<mj-text font-size="14px"${v} />
|
|
518
516
|
<mj-section padding="0" />
|
|
519
517
|
<mj-column padding="0" />
|
|
520
518
|
<mj-image fluid-on-mobile="true" />
|
|
521
|
-
</mj-attributes>${
|
|
519
|
+
</mj-attributes>${S}
|
|
522
520
|
<mj-style inline="inline">
|
|
523
|
-
${
|
|
524
|
-
${
|
|
521
|
+
${oe(se(h), p)}
|
|
522
|
+
${Le}
|
|
525
523
|
</mj-style>
|
|
526
524
|
<mj-style>
|
|
527
|
-
a { color: ${
|
|
525
|
+
a { color: ${y}; text-decoration: ${b}; }
|
|
528
526
|
@media only screen and (max-width: 480px) {
|
|
529
527
|
.tpl-hide-mobile { display: none !important; mso-hide: all !important; }
|
|
530
528
|
}
|
|
531
529
|
@media only screen and (min-width: 481px) {
|
|
532
530
|
.tpl-hide-desktop { display: none !important; mso-hide: all !important; }
|
|
533
531
|
}
|
|
534
|
-
</mj-style>${
|
|
532
|
+
</mj-style>${Je(f)}
|
|
535
533
|
</mj-head>
|
|
536
|
-
<mj-body width="${
|
|
537
|
-
${
|
|
534
|
+
<mj-body width="${m.containerWidth}px" background-color="${_}">
|
|
535
|
+
${x}
|
|
538
536
|
</mj-body>
|
|
539
537
|
</mjml>`;
|
|
540
538
|
}
|
|
541
|
-
function
|
|
542
|
-
if (
|
|
539
|
+
function ze(e, t) {
|
|
540
|
+
if (h(e)) return Z(e, Be(Ge(e.children, t.allowHtmlBlocks).map((e) => ze(e, t)).filter((e) => e !== "").join("\n"), {
|
|
543
541
|
backgroundColor: e.styles.backgroundColor,
|
|
544
542
|
padding: e.styles.padding,
|
|
545
543
|
borderRadius: e.borderRadius
|
|
546
544
|
}, t.contentDirection));
|
|
547
|
-
if (
|
|
548
|
-
let n =
|
|
549
|
-
return
|
|
545
|
+
if (f(e)) {
|
|
546
|
+
let n = Q(e, t);
|
|
547
|
+
return Z(e, e.wrapper && n !== "" ? Be(n, e.wrapper, t.contentDirection) : n);
|
|
550
548
|
}
|
|
551
|
-
return
|
|
549
|
+
return Z(e, Ve(Q(e, t), t.contentDirection));
|
|
552
550
|
}
|
|
553
|
-
function
|
|
554
|
-
return `<mj-wrapper${
|
|
551
|
+
function Be(e, t, n) {
|
|
552
|
+
return `<mj-wrapper${H(t.backgroundColor, "native")}${` padding="${t.padding ? V(t.padding) : "0"}"`}${G(t.borderRadius)}${n === "rtl" ? " direction=\"rtl\"" : ""}>
|
|
555
553
|
${e}
|
|
556
554
|
</mj-wrapper>`;
|
|
557
555
|
}
|
|
558
|
-
function
|
|
556
|
+
function Ve(e, t) {
|
|
559
557
|
if (e === "") return "";
|
|
560
558
|
let n = t === "rtl" ? " direction=\"rtl\"" : "";
|
|
561
559
|
return `<mj-section${n}>
|
|
@@ -564,21 +562,21 @@ ${e}
|
|
|
564
562
|
</mj-column>
|
|
565
563
|
</mj-section>`;
|
|
566
564
|
}
|
|
567
|
-
function
|
|
565
|
+
function He(e) {
|
|
568
566
|
return e.endsWith("/") ? e.slice(0, -1) : e;
|
|
569
567
|
}
|
|
570
|
-
function
|
|
568
|
+
function Ue(e) {
|
|
571
569
|
if (!e) return "";
|
|
572
570
|
let t = e.trim();
|
|
573
|
-
return t === "" ? "" : `\n <mj-preview>${
|
|
571
|
+
return t === "" ? "" : `\n <mj-preview>${F(t)}</mj-preview>`;
|
|
574
572
|
}
|
|
575
|
-
function
|
|
576
|
-
return e.length === 0 ? "" : e.map((e) => `\n <mj-font name="${
|
|
573
|
+
function We(e) {
|
|
574
|
+
return e.length === 0 ? "" : e.map((e) => `\n <mj-font name="${I(e.name)}" href="${I(e.url)}" />`).join("");
|
|
577
575
|
}
|
|
578
|
-
function
|
|
576
|
+
function Ge(e, t) {
|
|
579
577
|
return t ? e : e.filter((e) => e.type !== "html");
|
|
580
578
|
}
|
|
581
|
-
async function
|
|
579
|
+
async function Ke(e, t) {
|
|
582
580
|
let n = /* @__PURE__ */ new Map();
|
|
583
581
|
if (!t) return n;
|
|
584
582
|
let r = [];
|
|
@@ -588,11 +586,11 @@ async function Ve(e, t) {
|
|
|
588
586
|
return n;
|
|
589
587
|
}
|
|
590
588
|
function $(e, t) {
|
|
591
|
-
for (let n of e) if (
|
|
592
|
-
else if (
|
|
593
|
-
else
|
|
589
|
+
for (let n of e) if (v(n)) t.push(n);
|
|
590
|
+
else if (f(n)) for (let e of n.children) $(e, t);
|
|
591
|
+
else h(n) && $(n.children, t);
|
|
594
592
|
}
|
|
595
|
-
function
|
|
593
|
+
function qe(e, t) {
|
|
596
594
|
if (!t) return [];
|
|
597
595
|
let n = [];
|
|
598
596
|
if ($(e.blocks, n), n.length === 0) return [];
|
|
@@ -607,10 +605,10 @@ function He(e, t) {
|
|
|
607
605
|
}
|
|
608
606
|
return a;
|
|
609
607
|
}
|
|
610
|
-
function
|
|
608
|
+
function Je(e) {
|
|
611
609
|
return e.length === 0 ? "" : e.map((e) => `\n <mj-style>\n${e}\n </mj-style>`).join("");
|
|
612
610
|
}
|
|
613
611
|
//#endregion
|
|
614
|
-
export {
|
|
612
|
+
export { Y as BUTTON_FULL_WIDTH_CSS_CLASS, T as DEFAULT_SOCIAL_ICONS_BASE_URL, K as RICH_TEXT_CSS_CLASS, E as RenderContext, A as UNRENDERABLE_MARKER_PREFIX, z as convertMergeTagsToValues, I as escapeAttr, F as escapeHtml, O as getCssClassAttr, k as getCssClasses, X as getWidthPercentages, Me as getWidthPixels, D as isHiddenOnAll, Q as renderBlock, Re as renderToMjml, M as renderUnrenderableBlock, J as resolveParagraphGap, q as richTextGapClass, V as toPaddingString };
|
|
615
613
|
|
|
616
|
-
//# sourceMappingURL=src-
|
|
614
|
+
//# sourceMappingURL=src-BMw3u-iV.js.map
|