@charisol/plexo-sdk 1.1.16 → 1.2.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/PlexoRenderer.d.ts +8 -0
- package/dist/{compiler-Dr4lNAM3.js → compiler-nmaKKdLq.js} +194 -188
- package/dist/compiler.js +2 -2
- package/dist/compilerClient-DW7b0Ifk.js +215 -0
- package/dist/compilerClient.js +2 -168
- package/dist/components/CodeViewer.d.ts +7 -0
- package/dist/components/editor/frame/AccordionHeaderOverlay.d.ts +15 -0
- package/dist/components/editor/frame/CompiledCanvasEditorOverlay.d.ts +30 -0
- package/dist/components/editor/frame/CompiledCanvasFrame.d.ts +16 -0
- package/dist/components/editor/frame/DndOverlayNode.d.ts +59 -0
- package/dist/components/editor/frame/FrameTextToolbar.d.ts +29 -0
- package/dist/components/editor/frame/TableCellOverlay.d.ts +23 -0
- package/dist/components/editor/frame/useAccordionHeaderRects.d.ts +21 -0
- package/dist/components/editor/frame/useCanvasEngine.d.ts +25 -0
- package/dist/components/editor/frame/useCompiledCanvasHtml.d.ts +41 -0
- package/dist/components/editor/frame/useFrameNodeRects.d.ts +18 -0
- package/dist/components/editor/frame/useFrameTextEditing.d.ts +47 -0
- package/dist/components/editor/frame/useMeasuredFrameNodes.d.ts +13 -0
- package/dist/components/editor/frame/useTableCellRects.d.ts +29 -0
- package/dist/{iconSvgStatic-D04qA352.js → iconSvgStatic-CGue7nyp.js} +64 -48
- package/dist/index.d.ts +1 -0
- package/dist/index.js +47234 -46851
- package/dist/mjmlBrowser-DFgIYJ2a.js +39283 -0
- package/dist/plexo-sdk.css +1 -1
- package/dist/sanitize.js +2 -0
- package/dist/sanitizeCompiledHtml-C_sPjL3B.js +5079 -0
- package/dist/utilities/compiler.d.ts +4 -1
- package/dist/utilities/compilerClient.d.ts +4 -1
- package/dist/utilities/elementResolvers.d.ts +26 -7
- package/dist/utilities/instrumentation.d.ts +54 -0
- package/dist/utilities/mjmlBrowser.d.ts +19 -0
- package/dist/utilities/playground.helpers.d.ts +0 -18
- package/dist/utilities/playground.interfaces.d.ts +13 -0
- package/dist/utilities/sanitizeCompiledHtml.d.ts +10 -0
- package/dist/utilities/useApiKeyValidation.d.ts +6 -0
- package/package.json +17 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e, c as t,
|
|
1
|
+
import { a as e, c as t, d as n, f as r, g as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h, x as g, y as _ } from "./iconSvgStatic-CGue7nyp.js";
|
|
2
2
|
//#region src/utilities/playground.constants.ts
|
|
3
|
-
var
|
|
3
|
+
var v = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, y = [
|
|
4
4
|
{
|
|
5
5
|
id: "all",
|
|
6
6
|
label: "All sources"
|
|
@@ -17,7 +17,7 @@ var _ = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, v
|
|
|
17
17
|
id: "pixabay",
|
|
18
18
|
label: "Pixabay"
|
|
19
19
|
}
|
|
20
|
-
],
|
|
20
|
+
], b = [
|
|
21
21
|
{
|
|
22
22
|
id: "surface-book",
|
|
23
23
|
label: "Surface Book",
|
|
@@ -84,10 +84,10 @@ var _ = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, v
|
|
|
84
84
|
width: 375,
|
|
85
85
|
category: "mobile"
|
|
86
86
|
}
|
|
87
|
-
],
|
|
87
|
+
], x = 1280, S = Object.entries(_).map(([e, t]) => ({
|
|
88
88
|
id: e,
|
|
89
89
|
label: t.label
|
|
90
|
-
})),
|
|
90
|
+
})), C = [
|
|
91
91
|
{
|
|
92
92
|
label: "Text",
|
|
93
93
|
value: "text"
|
|
@@ -120,7 +120,7 @@ var _ = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, v
|
|
|
120
120
|
label: "Checkbox",
|
|
121
121
|
value: "checkbox"
|
|
122
122
|
}
|
|
123
|
-
],
|
|
123
|
+
], w = [
|
|
124
124
|
{
|
|
125
125
|
label: "1 Column",
|
|
126
126
|
widths: ["100%"],
|
|
@@ -169,7 +169,7 @@ var _ = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, v
|
|
|
169
169
|
"25%"
|
|
170
170
|
]
|
|
171
171
|
}
|
|
172
|
-
],
|
|
172
|
+
], T = [
|
|
173
173
|
{
|
|
174
174
|
label: "Roboto",
|
|
175
175
|
value: "'Roboto', sans-serif",
|
|
@@ -570,8 +570,8 @@ var _ = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, v
|
|
|
570
570
|
value: "'Great Vibes', cursive",
|
|
571
571
|
style: "handwriting"
|
|
572
572
|
}
|
|
573
|
-
],
|
|
574
|
-
function
|
|
573
|
+
], E = new Map(T.map((e) => [e.value, e.label]));
|
|
574
|
+
function D(e, t = []) {
|
|
575
575
|
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
576
576
|
if (!e) return;
|
|
577
577
|
let t = Array.isArray(e.columns) ? e.columns : [];
|
|
@@ -589,17 +589,17 @@ function E(e, t = []) {
|
|
|
589
589
|
for (let e of t) typeof e == "string" && e.trim() && n.add(e.trim());
|
|
590
590
|
return n;
|
|
591
591
|
}
|
|
592
|
-
function
|
|
592
|
+
function O(e) {
|
|
593
593
|
let t = /* @__PURE__ */ new Set();
|
|
594
594
|
for (let n of e) {
|
|
595
|
-
let e =
|
|
595
|
+
let e = E.get(n);
|
|
596
596
|
e && t.add(e);
|
|
597
597
|
}
|
|
598
598
|
return t.size === 0 ? null : `https://fonts.googleapis.com/css?family=${Array.from(t).map((e) => `${encodeURIComponent(e).replace(/%20/g, "+")}:400,700`).join("|")}&display=swap`;
|
|
599
599
|
}
|
|
600
600
|
//#endregion
|
|
601
601
|
//#region src/utilities/responsiveDefaults.ts
|
|
602
|
-
var
|
|
602
|
+
var k = {
|
|
603
603
|
tablet: {
|
|
604
604
|
thresholdPx: 24,
|
|
605
605
|
scale: .85,
|
|
@@ -610,7 +610,7 @@ var O = {
|
|
|
610
610
|
scale: .7,
|
|
611
611
|
floorPx: 14
|
|
612
612
|
}
|
|
613
|
-
},
|
|
613
|
+
}, A = {
|
|
614
614
|
tablet: {
|
|
615
615
|
thresholdPx: 320,
|
|
616
616
|
scale: .8,
|
|
@@ -621,7 +621,7 @@ var O = {
|
|
|
621
621
|
scale: .55,
|
|
622
622
|
floorPx: 140
|
|
623
623
|
}
|
|
624
|
-
},
|
|
624
|
+
}, j = {
|
|
625
625
|
tablet: {
|
|
626
626
|
thresholdPx: 48,
|
|
627
627
|
scale: .75,
|
|
@@ -632,7 +632,7 @@ var O = {
|
|
|
632
632
|
scale: .55,
|
|
633
633
|
floorPx: 16
|
|
634
634
|
}
|
|
635
|
-
},
|
|
635
|
+
}, M = {
|
|
636
636
|
tablet: {
|
|
637
637
|
thresholdPx: 500,
|
|
638
638
|
scale: 1,
|
|
@@ -643,7 +643,7 @@ var O = {
|
|
|
643
643
|
scale: 1,
|
|
644
644
|
floorPx: 0
|
|
645
645
|
}
|
|
646
|
-
},
|
|
646
|
+
}, ee = ["fontSize"], te = [
|
|
647
647
|
"height",
|
|
648
648
|
"minHeight",
|
|
649
649
|
"maxHeight"
|
|
@@ -671,27 +671,27 @@ function I(e, t) {
|
|
|
671
671
|
function L(e, t) {
|
|
672
672
|
if (!e || typeof e != "object") return {};
|
|
673
673
|
let n = {};
|
|
674
|
-
for (let r of
|
|
674
|
+
for (let r of ee) {
|
|
675
675
|
let i = F(e[r]);
|
|
676
676
|
if (i === null) continue;
|
|
677
|
-
let a = I(i,
|
|
677
|
+
let a = I(i, k[t]);
|
|
678
678
|
a !== null && (n[r] = `${a}px`);
|
|
679
679
|
}
|
|
680
|
-
for (let r of
|
|
680
|
+
for (let r of te) {
|
|
681
681
|
let i = F(e[r]);
|
|
682
682
|
if (i === null) continue;
|
|
683
|
-
let a = I(i,
|
|
683
|
+
let a = I(i, A[t]);
|
|
684
684
|
a !== null && (n[r] = `${a}px`);
|
|
685
685
|
}
|
|
686
686
|
for (let r of N) {
|
|
687
687
|
let i = F(e[r]);
|
|
688
688
|
if (i === null) continue;
|
|
689
|
-
let a = I(i,
|
|
689
|
+
let a = I(i, j[t]);
|
|
690
690
|
a !== null && (n[r] = `${a}px`);
|
|
691
691
|
}
|
|
692
692
|
for (let r of P) {
|
|
693
693
|
let i = F(e[r]);
|
|
694
|
-
i !== null && i >=
|
|
694
|
+
i !== null && i >= M[t].thresholdPx && (n[r] = "100%");
|
|
695
695
|
}
|
|
696
696
|
return n;
|
|
697
697
|
}
|
|
@@ -1044,7 +1044,7 @@ var K = () => ({
|
|
|
1044
1044
|
"buttonWidth",
|
|
1045
1045
|
"buttonHeight",
|
|
1046
1046
|
"buttonAlign"
|
|
1047
|
-
],
|
|
1047
|
+
], ne = (e) => {
|
|
1048
1048
|
if (!e || typeof e != "object") return "";
|
|
1049
1049
|
let t = e.kind || "text", n = q(e.name || e.id || "field"), r = e.required ? " required" : "", i = V({
|
|
1050
1050
|
fontSize: e.fontSize || "13px",
|
|
@@ -1059,14 +1059,14 @@ var K = () => ({
|
|
|
1059
1059
|
value: e.name || "option"
|
|
1060
1060
|
}]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${q(r?.value ?? "")}" />${r?.label ?? r?.value ?? ""}</label>`).join("")}</div>` : `${a}<input type="${q(t)}" name="${n}" placeholder="${q(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r} />`;
|
|
1061
1061
|
};
|
|
1062
|
-
function
|
|
1062
|
+
function re(e, t, n) {
|
|
1063
1063
|
if (e === "none") return "";
|
|
1064
1064
|
let r = q(t);
|
|
1065
1065
|
return e === "plus" ? `<span data-acc-icon style="font-size: 14px; line-height: 1; font-weight: 700; color: ${r};">${n ? "−" : "+"}</span>` : e === "arrow" ? `<span data-acc-icon style="font-size: 14px; line-height: 1; display: inline-block; color: ${r}; transform: ${n ? "rotate(90deg)" : "none"}; transition: transform 0.2s ease;">›</span>` : `<svg data-acc-icon width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="${r}" stroke-width="2.5" style="flex-shrink: 0; transform: ${n ? "rotate(180deg)" : "none"}; transition: transform 0.2s ease;"><path stroke-linecap="round" stroke-linejoin="round" d="M19.5 8.25l-7.5 7.5-7.5-7.5"/></svg>`;
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1068
|
-
return e.map((
|
|
1069
|
-
let
|
|
1067
|
+
function X(e, t, n, r, i = []) {
|
|
1068
|
+
return e.map((a, o) => {
|
|
1069
|
+
let s = [...i, o], c = o === e.length - 1, l = V({ borderBottom: n.showDividers && !c ? `1px solid ${t.dividerColor || "#e2e8f0"}` : void 0 }), u = V({
|
|
1070
1070
|
display: "flex",
|
|
1071
1071
|
alignItems: "center",
|
|
1072
1072
|
gap: "8px",
|
|
@@ -1075,71 +1075,71 @@ function Z(e, t, n) {
|
|
|
1075
1075
|
textAlign: "left",
|
|
1076
1076
|
flexDirection: n.iconOnLeft ? "row-reverse" : "row",
|
|
1077
1077
|
padding: t.padding || "14px",
|
|
1078
|
-
backgroundColor:
|
|
1079
|
-
color:
|
|
1078
|
+
backgroundColor: a.defaultOpen ? t.headerActiveBackgroundColor || t.headerBackgroundColor || "#ffffff" : t.headerBackgroundColor || "#ffffff",
|
|
1079
|
+
color: a.defaultOpen ? t.headerActiveTextColor || t.headerTextColor || "#0f172a" : t.headerTextColor || "#0f172a",
|
|
1080
1080
|
fontSize: t.headerFontSize || "14px",
|
|
1081
1081
|
fontWeight: t.headerFontWeight || 600,
|
|
1082
1082
|
fontFamily: t.headerFontFamily,
|
|
1083
1083
|
border: "none",
|
|
1084
1084
|
font: "inherit",
|
|
1085
1085
|
background: void 0
|
|
1086
|
-
}),
|
|
1086
|
+
}), d = V({
|
|
1087
1087
|
display: "grid",
|
|
1088
|
-
gridTemplateRows:
|
|
1088
|
+
gridTemplateRows: a.defaultOpen ? "1fr" : "0fr",
|
|
1089
1089
|
transition: n.animated ? "grid-template-rows 0.25s ease" : void 0,
|
|
1090
1090
|
backgroundColor: t.contentBackgroundColor || "#ffffff"
|
|
1091
|
-
}),
|
|
1091
|
+
}), f = V({
|
|
1092
1092
|
padding: t.contentPadding || "14px",
|
|
1093
1093
|
color: t.contentTextColor || "#475569",
|
|
1094
1094
|
fontSize: t.contentFontSize || "13px",
|
|
1095
1095
|
whiteSpace: "pre-wrap"
|
|
1096
|
-
}),
|
|
1097
|
-
return `<div class="plexo-acc-item" style="${
|
|
1096
|
+
}), p = re(n.iconStyle, t.iconColor || "#64748b", !!a.defaultOpen), m = q(a.title), h = q(a.content), g = a.children.length ? `<div class="plexo-acc-group" style="margin-top: 10px;">${X(a.children, t, n, r, s)}</div>` : "";
|
|
1097
|
+
return `<div class="plexo-acc-item" style="${l}"><button type="button"${` data-plexo-acc-item="${q(r)}|${s.join(".")}"`} data-acc-header data-acc-open="${a.defaultOpen ? "1" : "0"}" style="${u}"><span style="flex: 1;">${m}</span>${p}</button><div data-acc-panel style="${d}"><div style="overflow: hidden;"><div style="${f}">${h}${g}</div></div></div></div>`;
|
|
1098
1098
|
}).join("");
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1100
|
+
function ie(e) {
|
|
1101
1101
|
return `<!-- Unsupported block ${String(e)} -->`;
|
|
1102
1102
|
}
|
|
1103
|
-
var
|
|
1104
|
-
if (!
|
|
1105
|
-
let
|
|
1103
|
+
var ae = (g) => {
|
|
1104
|
+
if (!g || typeof g != "object") return "";
|
|
1105
|
+
let _ = g.style || {}, v = g.type === "heading" || g.type === "paragraph" || g.type === "text", y = v ? c(g).autoWidth : !1, b = y ? Object.fromEntries(Object.entries(_).filter(([e]) => e !== "width")) : _, x = V(g.type === "form_container" ? {
|
|
1106
1106
|
...K(),
|
|
1107
|
-
...
|
|
1108
|
-
} :
|
|
1109
|
-
switch (
|
|
1110
|
-
case "heading": return `<h2${
|
|
1111
|
-
case "paragraph": return `<p${
|
|
1112
|
-
case "text": return `<div${
|
|
1107
|
+
..._
|
|
1108
|
+
} : b), S = g.attributes || {}, C = ` data-plexo-id="${q(g.id)}"`, w = (e) => y ? `<div style="text-align: ${_.textAlign || "left"};">${e}</div>` : e, T = `${y ? "display: inline-block; " : ""}${v && _.height ? "overflow: hidden; " : ""}`;
|
|
1109
|
+
switch (g.type) {
|
|
1110
|
+
case "heading": return w(`<h2${C} style="margin-top: 0; margin-bottom: 8px; ${T}${x}">${S.text || "Heading"}</h2>`);
|
|
1111
|
+
case "paragraph": return w(`<p${C} style="margin-top: 0; margin-bottom: 12px; ${T}${x}">${S.text || "Paragraph text content."}</p>`);
|
|
1112
|
+
case "text": return w(`<div${C} style="${T}${x}">${S.text || ""}</div>`);
|
|
1113
1113
|
case "button": {
|
|
1114
|
-
let e =
|
|
1115
|
-
...
|
|
1114
|
+
let e = u(g), t = V({
|
|
1115
|
+
..._,
|
|
1116
1116
|
width: e.width,
|
|
1117
1117
|
height: e.height
|
|
1118
1118
|
});
|
|
1119
|
-
return `<div style="text-align: ${
|
|
1119
|
+
return `<div style="text-align: ${_.textAlign || "center"};"><a${C} href="${S.href || "#"}" target="${S.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; ${t}">${S.text || "Button"}</a></div>`;
|
|
1120
1120
|
}
|
|
1121
1121
|
case "image": {
|
|
1122
|
-
let e =
|
|
1123
|
-
...
|
|
1122
|
+
let e = h(g), t = _.textAlign === "center" ? "margin: 0 auto; display: block;" : _.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;", n = V({
|
|
1123
|
+
..._,
|
|
1124
1124
|
width: e.width,
|
|
1125
1125
|
height: e.height
|
|
1126
1126
|
});
|
|
1127
|
-
return `<img${
|
|
1127
|
+
return `<img${C} src="${S.src || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe"}" alt="${S.alt || ""}" style="${n} ${t}" />`;
|
|
1128
1128
|
}
|
|
1129
|
-
case "divider": return `<hr${
|
|
1130
|
-
case "spacer": return `<div${
|
|
1131
|
-
case "card": return `<div${
|
|
1132
|
-
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${
|
|
1133
|
-
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${
|
|
1129
|
+
case "divider": return `<hr${C} style="border: 0; border-top: ${_.borderWidth || "1px"} ${_.borderStyle || "solid"} ${_.borderColor || "#334155"}; ${x}" />`;
|
|
1130
|
+
case "spacer": return `<div${C} style="height: ${_.height || "24px"};"></div>`;
|
|
1131
|
+
case "card": return `<div${C} style="${x}">
|
|
1132
|
+
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${S.title || "Card Title"}</h3>
|
|
1133
|
+
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${S.description || "Card description."}</p>
|
|
1134
1134
|
</div>`;
|
|
1135
1135
|
case "form_container": {
|
|
1136
1136
|
let n = {
|
|
1137
1137
|
...K(),
|
|
1138
|
-
...
|
|
1138
|
+
..._
|
|
1139
1139
|
}, r = {};
|
|
1140
1140
|
for (let e of Object.keys(n)) Y.includes(e) || (r[e] = n[e]);
|
|
1141
|
-
r.height =
|
|
1142
|
-
let i = V(r), a =
|
|
1141
|
+
r.height = p(g);
|
|
1142
|
+
let i = V(r), a = l(t(Array.isArray(S.fields) ? S.fields : [])), o = n.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${ne(e)}</div>`).join(""), c = S.buttonAutoWidth === !1 ? n.buttonWidth || "100%" : "auto", u = n.buttonAlign === "left" ? "flex-start" : n.buttonAlign === "right" ? "flex-end" : "center", d = S.buttonAutoHeight === !1 && n.buttonHeight || "auto", f = V({
|
|
1143
1143
|
backgroundColor: n.buttonBackgroundColor,
|
|
1144
1144
|
color: n.buttonTextColor,
|
|
1145
1145
|
borderRadius: n.buttonBorderRadius,
|
|
@@ -1153,21 +1153,21 @@ var re = (h) => {
|
|
|
1153
1153
|
marginRight: e(n.buttonMarginRight, n.buttonMargin, "right"),
|
|
1154
1154
|
fontSize: n.buttonFontSize,
|
|
1155
1155
|
fontWeight: n.buttonFontWeight,
|
|
1156
|
-
width:
|
|
1156
|
+
width: c,
|
|
1157
1157
|
height: d
|
|
1158
1158
|
});
|
|
1159
|
-
return `<form${
|
|
1159
|
+
return `<form${C} action="${q(S.actionUrl || S.action || "#")}" method="${q(S.method || "POST")}" style="${i}">${s}<div style="display: flex; width: 100%; justify-content: ${u};"><button type="submit" style="border: 0; cursor: pointer; ${f}">${S.submitLabel || "Submit"}</button></div></form>`;
|
|
1160
1160
|
}
|
|
1161
1161
|
case "input": {
|
|
1162
|
-
let e =
|
|
1163
|
-
return `<input${
|
|
1162
|
+
let e = S.inputType || S.type || "text", t = q(S.name || S.fieldName || "field"), n = q(S.placeholder || ""), r = S.required ? " required" : "";
|
|
1163
|
+
return `<input${C} type="${q(e)}" name="${t}" placeholder="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${x}"${r} />`;
|
|
1164
1164
|
}
|
|
1165
|
-
case "textarea": return `<textarea${
|
|
1166
|
-
case "select": return `<select${
|
|
1167
|
-
case "html": return `<div${
|
|
1168
|
-
...
|
|
1169
|
-
height:
|
|
1170
|
-
})}">${
|
|
1165
|
+
case "textarea": return `<textarea${C} name="${q(S.name || S.fieldName || "field")}" placeholder="${q(S.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${x}"${S.required ? " required" : ""}></textarea>`;
|
|
1166
|
+
case "select": return `<select${C} name="${q(S.name || S.fieldName || "field")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${x}"${S.required ? " required" : ""}>${(Array.isArray(S.options) ? S.options : []).map((e) => `<option value="${q(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
|
|
1167
|
+
case "html": return `<div${C} style="${V({
|
|
1168
|
+
..._,
|
|
1169
|
+
height: s(g, "auto")
|
|
1170
|
+
})}">${S.htmlContent || S.text || ""}</div>`;
|
|
1171
1171
|
case "blog_title":
|
|
1172
1172
|
case "blog_content":
|
|
1173
1173
|
case "blog_featured_image":
|
|
@@ -1176,17 +1176,17 @@ var re = (h) => {
|
|
|
1176
1176
|
case "blog_categories":
|
|
1177
1177
|
case "blog_comments":
|
|
1178
1178
|
case "blog_post_list": {
|
|
1179
|
-
let e =
|
|
1180
|
-
return `<div${
|
|
1179
|
+
let e = g.type.replace(/^blog_/, "").replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t = V(_);
|
|
1180
|
+
return `<div${C} data-plexo-blog-${e}="true"${J("data-plexo-blog-prefix", S.prefix)} style="${t}"></div>`;
|
|
1181
1181
|
}
|
|
1182
1182
|
case "social": {
|
|
1183
|
-
let e =
|
|
1184
|
-
return `<div${
|
|
1185
|
-
padding:
|
|
1186
|
-
margin:
|
|
1183
|
+
let e = r(g), t = _.textAlign === "center" ? "center" : _.textAlign === "right" ? "flex-end" : "flex-start";
|
|
1184
|
+
return `<div${C} style="${V({
|
|
1185
|
+
padding: _.padding,
|
|
1186
|
+
margin: _.margin,
|
|
1187
1187
|
display: "flex",
|
|
1188
1188
|
flexWrap: "wrap",
|
|
1189
|
-
gap:
|
|
1189
|
+
gap: _.iconSpacing || "8px",
|
|
1190
1190
|
justifyContent: t
|
|
1191
1191
|
})}">${e.map((e) => {
|
|
1192
1192
|
let t = V({
|
|
@@ -1201,150 +1201,153 @@ var re = (h) => {
|
|
|
1201
1201
|
justifyContent: "center",
|
|
1202
1202
|
overflow: "hidden"
|
|
1203
1203
|
});
|
|
1204
|
-
return `<a href="${q(e.url)}" style="${t} text-decoration: none;">${
|
|
1204
|
+
return `<a href="${q(e.url)}" style="${t} text-decoration: none;">${f(e.provider, e.color)}</a>`;
|
|
1205
1205
|
}).join("")}</div>`;
|
|
1206
1206
|
}
|
|
1207
1207
|
case "menu": {
|
|
1208
|
-
let e = n(
|
|
1209
|
-
return `<div${
|
|
1210
|
-
...
|
|
1208
|
+
let e = n(g), t = _.textAlign === "center" ? "center" : _.textAlign === "right" ? "flex-end" : "flex-start";
|
|
1209
|
+
return `<div${C} style="${V({
|
|
1210
|
+
..._,
|
|
1211
1211
|
display: "flex",
|
|
1212
1212
|
flexWrap: "wrap",
|
|
1213
1213
|
gap: "16px",
|
|
1214
1214
|
justifyContent: t
|
|
1215
|
-
})}">${e.map((e) => `<a href="${q(e.href)}" style="text-decoration: none; color: inherit; font-weight: ${
|
|
1215
|
+
})}">${e.map((e) => `<a href="${q(e.href)}" style="text-decoration: none; color: inherit; font-weight: ${_.fontWeight || 600};">${q(e.label)}</a>`).join("")}</div>`;
|
|
1216
1216
|
}
|
|
1217
1217
|
case "icon": {
|
|
1218
|
-
let e =
|
|
1219
|
-
padding:
|
|
1220
|
-
margin:
|
|
1218
|
+
let e = _.fontSize || `${S.iconSize || 48}px`, t = _.color || "#1e293b", n = parseInt(String(e), 10) || 48, r = m(S.iconName, n, t), i = _.textAlign === "right" ? "flex-end" : _.textAlign === "left" ? "flex-start" : "center", a = V({
|
|
1219
|
+
padding: _.padding,
|
|
1220
|
+
margin: _.margin,
|
|
1221
1221
|
display: "flex",
|
|
1222
1222
|
justifyContent: i
|
|
1223
|
-
}), o = typeof
|
|
1224
|
-
return `<div style="${a}">${o ? `<a${
|
|
1223
|
+
}), o = typeof S.href == "string" ? S.href.trim() : "", s = `<span style="display: inline-flex; align-items: center; justify-content: center; color: ${t};">${r}</span>`;
|
|
1224
|
+
return `<div style="${a}">${o ? `<a${C} href="${q(o)}" target="${S.openInNewTab ? "_blank" : "_self"}" style="text-decoration: none;">${s}</a>` : `<span${C}>${s}</span>`}</div>`;
|
|
1225
1225
|
}
|
|
1226
1226
|
case "table": {
|
|
1227
|
-
let e =
|
|
1228
|
-
let
|
|
1229
|
-
return `<tr>${n.map((e) => {
|
|
1230
|
-
let
|
|
1231
|
-
padding:
|
|
1227
|
+
let e = d(g), t = `${_.borderWidth || "1px"} ${_.borderStyle || "solid"} ${_.borderColor || "#cbd5e1"}`, n = (n, r, i, a) => {
|
|
1228
|
+
let o = a ? "th" : "td", s = a ? _.headerBgColor || "#f8fafc" : e.striped && r % 2 == 1 ? "#f8fafc" : _.contentBgColor || "#ffffff", c = a ? _.headerTextColor || "#1e293b" : _.contentTextColor || "#475569", l = a ? _.headerTextAlign || "left" : _.contentTextAlign || "left";
|
|
1229
|
+
return `<tr>${n.map((e, n) => {
|
|
1230
|
+
let r = V({
|
|
1231
|
+
padding: _.cellPadding || "8px",
|
|
1232
1232
|
border: t,
|
|
1233
|
-
backgroundColor:
|
|
1234
|
-
color:
|
|
1235
|
-
textAlign:
|
|
1236
|
-
lineHeight:
|
|
1237
|
-
letterSpacing:
|
|
1238
|
-
fontWeight:
|
|
1239
|
-
})
|
|
1240
|
-
return `<${
|
|
1233
|
+
backgroundColor: s,
|
|
1234
|
+
color: c,
|
|
1235
|
+
textAlign: l,
|
|
1236
|
+
lineHeight: _.contentLineHeight,
|
|
1237
|
+
letterSpacing: _.contentLetterSpacing,
|
|
1238
|
+
fontWeight: a ? "700" : void 0
|
|
1239
|
+
}), u = ` data-plexo-cell="${q(g.id)}|${i}-${n}"`;
|
|
1240
|
+
return `<${o}${u} style="${r}">${e || " "}</${o}>`;
|
|
1241
1241
|
}).join("")}</tr>`;
|
|
1242
|
-
}, r = e.enableHeader && e.cells.length > 0 ? `<thead>${n(e.cells[0], 0, !0)}</thead>` : "", i = +!!e.enableHeader, a = e.enableFooter ? e.cells.length - 1 : e.cells.length, o = e.cells.slice(i, Math.max(i, a)).map((e, t) => n(e, t, !1)).join(""),
|
|
1242
|
+
}, r = e.enableHeader && e.cells.length > 0 ? `<thead>${n(e.cells[0], 0, 0, !0)}</thead>` : "", i = +!!e.enableHeader, a = e.enableFooter ? e.cells.length - 1 : e.cells.length, o = e.cells.slice(i, Math.max(i, a)).map((e, t) => n(e, t, i + t, !1)).join(""), s = e.enableFooter && e.cells.length > i ? `<tfoot>${n(e.cells[e.cells.length - 1], e.cells.length - 1, e.cells.length - 1, !1)}</tfoot>` : "", c = V({
|
|
1243
1243
|
borderCollapse: "collapse",
|
|
1244
1244
|
width: "100%"
|
|
1245
1245
|
});
|
|
1246
|
-
return `<div${
|
|
1247
|
-
padding:
|
|
1248
|
-
margin:
|
|
1246
|
+
return `<div${C} style="${V({
|
|
1247
|
+
padding: _.padding,
|
|
1248
|
+
margin: _.margin,
|
|
1249
1249
|
overflowX: "auto"
|
|
1250
|
-
})}"><table style="${
|
|
1250
|
+
})}"><table style="${c}">${r}<tbody>${o}</tbody>${s}</table></div>`;
|
|
1251
1251
|
}
|
|
1252
1252
|
case "video": {
|
|
1253
|
-
let e =
|
|
1254
|
-
return `<div${
|
|
1255
|
-
padding:
|
|
1256
|
-
margin:
|
|
1257
|
-
borderRadius:
|
|
1253
|
+
let e = i(S.videoUrl), t = S.linkType === "email" ? `mailto:${S.href || ""}` : S.href || S.videoUrl || "#", n = S.target || "_blank";
|
|
1254
|
+
return `<div${C} style="${V({
|
|
1255
|
+
padding: _.padding,
|
|
1256
|
+
margin: _.margin,
|
|
1257
|
+
borderRadius: _.borderRadius,
|
|
1258
1258
|
overflow: "hidden"
|
|
1259
|
-
})}"><a href="${q(t)}" target="${q(n)}" style="position: relative; display: block; text-decoration: none;"><img src="${q(e.thumbnailUrl)}" alt="${q(
|
|
1259
|
+
})}"><a href="${q(t)}" target="${q(n)}" style="position: relative; display: block; text-decoration: none;"><img src="${q(e.thumbnailUrl)}" alt="${q(S.alt || "Video preview")}" style="width: 100%; display: block;" /><span style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 9999px; background: rgba(15, 23, 42, 0.75); display: flex; align-items: center; justify-content: center;"><span style="width: 0; height: 0; border-top: 10px solid transparent; border-bottom: 10px solid transparent; border-left: 16px solid #ffffff; margin-left: 4px;"></span></span></a></div>`;
|
|
1260
1260
|
}
|
|
1261
1261
|
case "timer": {
|
|
1262
|
-
let e =
|
|
1263
|
-
fontFamily:
|
|
1264
|
-
fontSize:
|
|
1265
|
-
color:
|
|
1262
|
+
let e = S.showLabels !== !1, t = V({
|
|
1263
|
+
fontFamily: _.digitsFontFamily,
|
|
1264
|
+
fontSize: _.digitsFontSize || "40px",
|
|
1265
|
+
color: _.digitsColor || "#1e293b",
|
|
1266
1266
|
fontWeight: "800"
|
|
1267
1267
|
}), n = V({
|
|
1268
|
-
fontFamily:
|
|
1269
|
-
fontSize:
|
|
1270
|
-
color:
|
|
1268
|
+
fontFamily: _.labelsFontFamily,
|
|
1269
|
+
fontSize: _.labelsFontSize || "16px",
|
|
1270
|
+
color: _.labelsColor || "#64748b"
|
|
1271
1271
|
}), r = V({
|
|
1272
|
-
backgroundColor:
|
|
1273
|
-
borderRadius:
|
|
1274
|
-
padding:
|
|
1272
|
+
backgroundColor: _.backgroundColor || "#f8fafc",
|
|
1273
|
+
borderRadius: _.borderRadius || "8px",
|
|
1274
|
+
padding: _.padding || "16px",
|
|
1275
1275
|
textAlign: "center"
|
|
1276
|
-
}),
|
|
1277
|
-
return `<div${
|
|
1276
|
+
}), i = (r, i, a) => `<div style="display: inline-flex; flex-direction: column; align-items: center; padding: 0 10px;"><span data-unit="${r}" style="${t}">${a}</span>${e ? `<span style="${n}">${i}</span>` : ""}</div>`, o = a(S.targetDate, S.timezone), s = q(new Date(o.targetTimestamp).toISOString()), c = `<script>(function(){var wrap=document.querySelector(${JSON.stringify(`[data-plexo-id="${g.id}"]`)});if(!wrap)return;var target=new Date(wrap.getAttribute('data-plexo-target')).getTime();function pad(n){return String(n).padStart(2,'0');}function tick(){var diff=target-Date.now();var d=wrap.querySelector('[data-unit="days"]'),h=wrap.querySelector('[data-unit="hours"]'),m=wrap.querySelector('[data-unit="minutes"]'),s=wrap.querySelector('[data-unit="seconds"]');if(diff<=0){[d,h,m,s].forEach(function(n){if(n)n.textContent='00';});clearInterval(iv);return;}var total=Math.floor(diff/1000);if(d)d.textContent=pad(Math.floor(total/86400));if(h)h.textContent=pad(Math.floor(total%86400/3600));if(m)m.textContent=pad(Math.floor(total%3600/60));if(s)s.textContent=pad(total%60);}tick();var iv=setInterval(tick,1000);})();<\/script>`;
|
|
1277
|
+
return `<div${C} data-plexo-target="${s}" style="${r}"><div>${i("days", "Days", o.days)}${i("hours", "Hours", o.hours)}${i("minutes", "Mins", o.minutes)}${i("seconds", "Secs", o.seconds)}</div>${c}</div>`;
|
|
1278
1278
|
}
|
|
1279
1279
|
case "carousel": {
|
|
1280
|
-
let e = Array.isArray(
|
|
1281
|
-
padding:
|
|
1282
|
-
margin:
|
|
1283
|
-
backgroundColor:
|
|
1280
|
+
let e = Array.isArray(S.images) ? S.images : [], t = V({
|
|
1281
|
+
padding: _.padding || "10px",
|
|
1282
|
+
margin: _.margin,
|
|
1283
|
+
backgroundColor: _.backgroundColor,
|
|
1284
1284
|
position: "relative",
|
|
1285
1285
|
overflow: "hidden",
|
|
1286
1286
|
borderRadius: "12px"
|
|
1287
1287
|
});
|
|
1288
|
-
if (e.length === 0) return `<div${
|
|
1289
|
-
let n = Math.min(e.length - 1, Math.max(0, parseInt(String(
|
|
1290
|
-
return `<div${
|
|
1288
|
+
if (e.length === 0) return `<div${C} style="${t}"><div style="padding: 40px; text-align: center; color: #94a3b8;">No images in carousel</div></div>`;
|
|
1289
|
+
let n = Math.min(e.length - 1, Math.max(0, parseInt(String(S.activeIdx), 10) || 0)), r = e.map((e, t) => `<div data-slide-idx="${t}" style="display: ${t === n ? "block" : "none"};"><img src="${q(e.src)}" alt="${q(e.alt || e.caption || "")}" style="width: 100%; display: block;" />${e.caption ? `<div style="padding: 8px; text-align: center; background: rgba(15, 23, 42, 0.8); color: #fff; font-size: 12px; font-weight: 600;">${q(e.caption)}</div>` : ""}</div>`).join(""), i = e.length > 1 ? `<div style="display: flex; gap: 6px; justify-content: center; padding: 8px 0;">${e.map((e, t) => `<button type="button" data-dot-idx="${t}" style="width: 8px; height: 8px; border-radius: 9999px; border: none; background: ${t === n ? "#4f46e5" : "#cbd5e1"}; cursor: pointer;"></button>`).join("")}</div>` : "";
|
|
1290
|
+
return `<div${C} data-active-idx="${n}" style="${t}">${e.length > 1 ? "<button type=\"button\" data-nav=\"prev\" style=\"position: absolute; left: 8px; top: 40%; transform: translateY(-50%); border: none; background: rgba(15, 23, 42, 0.6); color: #fff; width: 28px; height: 28px; border-radius: 9999px; cursor: pointer;\">‹</button><button type=\"button\" data-nav=\"next\" style=\"position: absolute; right: 8px; top: 40%; transform: translateY(-50%); border: none; background: rgba(15, 23, 42, 0.6); color: #fff; width: 28px; height: 28px; border-radius: 9999px; cursor: pointer;\">›</button>" : ""}${r}${i}${`<script>(function(){var wrap=document.querySelector(${JSON.stringify(`[data-plexo-id="${g.id}"]`)});if(!wrap)return;var slides=wrap.querySelectorAll('[data-slide-idx]');var dots=wrap.querySelectorAll('[data-dot-idx]');function show(n){var idx=(n+slides.length)%slides.length;slides.forEach(function(s,i){s.style.display=i===idx?'block':'none';});dots.forEach(function(d,i){d.style.background=i===idx?'#4f46e5':'#cbd5e1';});wrap.setAttribute('data-active-idx',String(idx));}var prev=wrap.querySelector('[data-nav="prev"]');var next=wrap.querySelector('[data-nav="next"]');if(prev)prev.addEventListener('click',function(){show(parseInt(wrap.getAttribute('data-active-idx')||'0',10)-1);});if(next)next.addEventListener('click',function(){show(parseInt(wrap.getAttribute('data-active-idx')||'0',10)+1);});dots.forEach(function(d,i){d.addEventListener('click',function(){show(i);});});})();<\/script>`}</div>`;
|
|
1291
1291
|
}
|
|
1292
1292
|
case "accordion": {
|
|
1293
|
-
let e =
|
|
1294
|
-
border: `${
|
|
1295
|
-
borderRadius:
|
|
1293
|
+
let e = o(g), t = S.mode === "multi" ? "multi" : "single", n = S.iconStyle || "chevron", r = S.iconPosition === "left", i = S.showDividers !== !1, a = S.animation !== "none", s = V({
|
|
1294
|
+
border: `${_.borderWidth || "1px"} ${_.borderStyle || "solid"} ${_.borderColor || "#e2e8f0"}`,
|
|
1295
|
+
borderRadius: _.borderRadius || "10px",
|
|
1296
1296
|
overflow: "hidden",
|
|
1297
|
-
margin:
|
|
1297
|
+
margin: _.margin
|
|
1298
1298
|
});
|
|
1299
|
-
return e.length === 0 ? `<div${
|
|
1299
|
+
return e.length === 0 ? `<div${C} style="${s}"></div>` : `<div${C} data-acc-mode="${t}" data-acc-icon-style="${n}" style="${s}"><div class="plexo-acc-group">${X(e, _, {
|
|
1300
1300
|
iconStyle: n,
|
|
1301
1301
|
iconOnLeft: r,
|
|
1302
1302
|
showDividers: i,
|
|
1303
|
-
animated:
|
|
1304
|
-
})}</div>${`<script>(function(){var root=document.querySelector(${JSON.stringify(`[data-plexo-id="${
|
|
1303
|
+
animated: a
|
|
1304
|
+
}, g.id)}</div>${`<script>(function(){var root=document.querySelector(${JSON.stringify(`[data-plexo-id="${g.id}"]`)});if(!root)return;var mode=root.getAttribute('data-acc-mode')||'single';var iconStyle=root.getAttribute('data-acc-icon-style')||'chevron';function setIconState(icon,open){if(!icon)return;if(iconStyle==='plus'){icon.textContent=open?'−':'+';}else if(iconStyle==='arrow'){icon.style.transform=open?'rotate(90deg)':'';}else if(iconStyle==='chevron'){icon.style.transform=open?'rotate(180deg)':'';}}var headers=root.querySelectorAll('[data-acc-header]');headers.forEach(function(header){header.addEventListener('click',function(){var item=header.parentElement;var group=item.parentElement;var panel=item.children[1];var isOpen=header.getAttribute('data-acc-open')==='1';if(mode!=='multi'&&group){Array.prototype.forEach.call(group.children,function(sib){if(sib===item)return;var sh=sib.children[0];var sp=sib.children[1];if(sh){sh.setAttribute('data-acc-open','0');setIconState(sh.querySelector('[data-acc-icon]'),false);}if(sp)sp.style.gridTemplateRows='0fr';});}var next=!isOpen;header.setAttribute('data-acc-open',next?'1':'0');panel.style.gridTemplateRows=next?'1fr':'0fr';setIconState(header.querySelector('[data-acc-icon]'),next);});});})();<\/script>`}</div>`;
|
|
1305
1305
|
}
|
|
1306
|
-
default: return
|
|
1306
|
+
default: return ie(g.type);
|
|
1307
1307
|
}
|
|
1308
|
-
},
|
|
1308
|
+
}, Z = (e, t, n) => {
|
|
1309
1309
|
if (!e || typeof e != "object") return "";
|
|
1310
|
-
let
|
|
1311
|
-
if (!
|
|
1312
|
-
let
|
|
1313
|
-
W(t,
|
|
1314
|
-
let
|
|
1315
|
-
|
|
1316
|
-
let
|
|
1317
|
-
for (let e of
|
|
1310
|
+
let r = B(e);
|
|
1311
|
+
if (!r) return `\n <!-- ROW SKIPPED (type="${typeof e.type == "string" ? e.type : "unknown"}"${e.id ? `, id="${e.id}"` : ""}): this row has no 'columns' array and its shorthand content (e.g. a list of items/links) can't be auto-converted without losing data. Provide a fully hydrated row with 'columns' and 'elements' instead. -->`;
|
|
1312
|
+
let i = V(r.style || {}), a = J("id", r.htmlId), o = J("class", r.htmlClass), s = r.id || `row-${Math.random().toString(36).substring(2, 9)}`;
|
|
1313
|
+
W(t, s, r.style, "tablet", r.styleTablet), W(t, s, r.style, "mobile", r.styleMobile);
|
|
1314
|
+
let c = `\n <!-- ROW START: ${r.id || "row"} -->`;
|
|
1315
|
+
c += `\n <div data-plexo-id="${s}"${a}${o} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${i}">`;
|
|
1316
|
+
let l = Array.isArray(r.columns) ? r.columns : [];
|
|
1317
|
+
for (let e of l) {
|
|
1318
1318
|
if (!e) continue;
|
|
1319
|
-
let
|
|
1320
|
-
W(t,
|
|
1321
|
-
let
|
|
1322
|
-
|
|
1319
|
+
let r = e.styles || e.style || {}, i = V(r), a = r.gap || "16px", o = J("id", e.attrs?.htmlId), s = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", l = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
|
|
1320
|
+
W(t, l, r, "tablet", e.stylesTablet), W(t, l, r, "mobile", e.stylesMobile);
|
|
1321
|
+
let u = Array.isArray(e.elements) ? e.elements : [], d = Array.isArray(e.nestedRows) ? e.nestedRows : [], f = n && u.length === 0 && d.length === 0 ? "min-height: 148px; " : "";
|
|
1322
|
+
c += `\n <!-- COLUMN START: ${e.id || "col"} -->`, c += `\n <div data-plexo-id="${l}"${o} class="plexo-col${s}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; --plexo-col-gap: ${a}; ${f}${i}">`;
|
|
1323
|
+
let p = new Map(u.map((e) => [e.id, e])), m = new Map(d.map((e) => [e.id, e]));
|
|
1324
|
+
for (let r of g({
|
|
1323
1325
|
...e,
|
|
1324
|
-
elements:
|
|
1325
|
-
nestedRows:
|
|
1326
|
+
elements: u,
|
|
1327
|
+
nestedRows: d
|
|
1326
1328
|
})) {
|
|
1327
|
-
let e =
|
|
1329
|
+
let e = p.get(r);
|
|
1328
1330
|
if (e) {
|
|
1329
|
-
let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "",
|
|
1330
|
-
W(t, e.id, e.style, "tablet", G(e, e.styleTablet)), W(t, e.id, e.style, "mobile", G(e, e.styleMobile)),
|
|
1331
|
+
let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "", i = J("id", n.htmlId), o = J("class", r), s = e.style?.display, l = s === "inline-block" || s === "inline" || s === "inline-flex" ? `margin-bottom: ${a}; display: ${s}; vertical-align: top;` : `margin-bottom: ${a};`;
|
|
1332
|
+
W(t, e.id, e.style, "tablet", G(e, e.styleTablet)), W(t, e.id, e.style, "mobile", G(e, e.styleMobile)), c += `\n <div${i}${o} style="${l}">`, c += `\n ${ae(e)}`, c += "\n </div>";
|
|
1331
1333
|
continue;
|
|
1332
1334
|
}
|
|
1333
|
-
let
|
|
1334
|
-
|
|
1335
|
+
let i = m.get(r);
|
|
1336
|
+
i && (c += Z(i, t, n));
|
|
1335
1337
|
}
|
|
1336
|
-
|
|
1338
|
+
c += "\n </div>";
|
|
1337
1339
|
}
|
|
1338
|
-
return
|
|
1339
|
-
},
|
|
1340
|
+
return c += "\n </div>", c;
|
|
1341
|
+
}, Q = (e, t) => {
|
|
1342
|
+
let n = t?.canvasEditorPadding ?? !1;
|
|
1340
1343
|
if (!e || typeof e != "object") return "<!-- Empty template -->";
|
|
1341
|
-
let
|
|
1342
|
-
style:
|
|
1343
|
-
rows:
|
|
1344
|
+
let r = e.designJson || e.template || e, i = r.body || (Array.isArray(r.rows) ? {
|
|
1345
|
+
style: r.style || {},
|
|
1346
|
+
rows: r.rows
|
|
1344
1347
|
} : {
|
|
1345
1348
|
style: {},
|
|
1346
1349
|
rows: []
|
|
1347
|
-
}),
|
|
1350
|
+
}), a = { ...i.style || {} };
|
|
1348
1351
|
for (let e of [
|
|
1349
1352
|
"backgroundColor",
|
|
1350
1353
|
"background",
|
|
@@ -1352,9 +1355,9 @@ var re = (h) => {
|
|
|
1352
1355
|
"textColor",
|
|
1353
1356
|
"fontFamily",
|
|
1354
1357
|
"htmlTitle"
|
|
1355
|
-
])
|
|
1356
|
-
|
|
1357
|
-
let
|
|
1358
|
+
]) a[e] === void 0 && (i[e] === void 0 ? r[e] !== void 0 && (a[e] = r[e]) : a[e] = i[e]);
|
|
1359
|
+
a.backgroundColor && !a.background ? a.background = a.backgroundColor : a.background && !a.backgroundColor && (a.backgroundColor = a.background), a.textColor && !a.color && (a.color = a.textColor);
|
|
1360
|
+
let o = [
|
|
1358
1361
|
"htmlTitle",
|
|
1359
1362
|
"htmlId",
|
|
1360
1363
|
"htmlClass",
|
|
@@ -1362,21 +1365,21 @@ var re = (h) => {
|
|
|
1362
1365
|
"customJs",
|
|
1363
1366
|
"textColor",
|
|
1364
1367
|
"favicon"
|
|
1365
|
-
],
|
|
1366
|
-
for (let e of Object.keys(
|
|
1367
|
-
let
|
|
1368
|
+
], s = {};
|
|
1369
|
+
for (let e of Object.keys(a)) o.includes(e) || (s[e] = a[e]);
|
|
1370
|
+
let c = V(s), l = typeof a.htmlTitle == "string" && a.htmlTitle.trim() ? a.htmlTitle.trim() : typeof e?.name == "string" && e.name.trim() ? e.name.trim() : "Plexo Rendered Page", u = J("id", a.htmlId), d = J("class", a.htmlClass), f = typeof a.customCss == "string" && a.customCss.trim() ? a.customCss.trim() : "", p = typeof a.customJs == "string" && a.customJs.trim() ? a.customJs.trim() : "", m = typeof a.favicon == "string" && a.favicon.trim() ? a.favicon.trim() : "", h = Array.isArray(i.rows) ? i.rows : Array.isArray(r.rows) ? r.rows : Array.isArray(e.rows) ? e.rows : [], g = O(D(h, [a.fontFamily])), _ = {
|
|
1368
1371
|
tablet: [],
|
|
1369
1372
|
mobile: []
|
|
1370
|
-
},
|
|
1371
|
-
for (let e of
|
|
1372
|
-
let
|
|
1373
|
+
}, v = "";
|
|
1374
|
+
for (let e of h) v += Z(e, _, n);
|
|
1375
|
+
let y = _.tablet.length ? `\n ${_.tablet.join("\n ")}` : "", b = _.mobile.length ? `\n ${_.mobile.join("\n ")}` : "", x = `<!DOCTYPE html>
|
|
1373
1376
|
<html>
|
|
1374
1377
|
<head>
|
|
1375
1378
|
<meta charset="utf-8">
|
|
1376
|
-
<title>${q(
|
|
1377
|
-
${
|
|
1379
|
+
<title>${q(l)}</title>
|
|
1380
|
+
${m ? `<link rel="icon" href="${q(m)}">` : ""}
|
|
1378
1381
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1379
|
-
${
|
|
1382
|
+
${g ? `<link rel="stylesheet" href="${g}">` : ""}
|
|
1380
1383
|
<style>
|
|
1381
1384
|
body { margin: 0; font-family: ${z}; }
|
|
1382
1385
|
.plexo-row {
|
|
@@ -1386,7 +1389,7 @@ var re = (h) => {
|
|
|
1386
1389
|
/* Tablet: auto-scaled fonts/heights/spacing (see utilities/responsiveDefaults.ts) and
|
|
1387
1390
|
any explicit per-element styleTablet/stylesTablet override — columns stay side by
|
|
1388
1391
|
side at this width. */
|
|
1389
|
-
@media (min-width: 769px) and (max-width: 1024px) {${
|
|
1392
|
+
@media (min-width: 769px) and (max-width: 1024px) {${y}
|
|
1390
1393
|
}
|
|
1391
1394
|
@media (max-width: 768px) {
|
|
1392
1395
|
.plexo-row {
|
|
@@ -1396,26 +1399,29 @@ var re = (h) => {
|
|
|
1396
1399
|
width: 100% !important;
|
|
1397
1400
|
max-width: 100% !important;
|
|
1398
1401
|
margin-bottom: var(--plexo-col-gap, 16px);
|
|
1399
|
-
}${
|
|
1402
|
+
}${b}
|
|
1400
1403
|
}
|
|
1401
1404
|
</style>
|
|
1402
|
-
${
|
|
1405
|
+
${f ? `<style>\n${f}\n </style>` : ""}
|
|
1403
1406
|
</head>
|
|
1404
|
-
<body${
|
|
1407
|
+
<body${u}${d} style="${c}">
|
|
1405
1408
|
<div style="max-width: 1200px; margin: 0 auto; width: 100%;">`;
|
|
1406
|
-
return
|
|
1407
|
-
${
|
|
1409
|
+
return x += v, x += `\n </div>
|
|
1410
|
+
${p ? ` <script>\n${p}\n <\/script>` : ""}
|
|
1408
1411
|
</body>
|
|
1409
|
-
</html>`,
|
|
1412
|
+
</html>`, x = x.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1"), x;
|
|
1410
1413
|
};
|
|
1411
|
-
function
|
|
1412
|
-
return
|
|
1413
|
-
}
|
|
1414
|
-
function ae(e) {
|
|
1415
|
-
return $(e);
|
|
1414
|
+
function $(e) {
|
|
1415
|
+
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1416
1416
|
}
|
|
1417
1417
|
function oe(e) {
|
|
1418
|
+
return $(Q(e));
|
|
1419
|
+
}
|
|
1420
|
+
function se(e) {
|
|
1421
|
+
return Q(e);
|
|
1422
|
+
}
|
|
1423
|
+
function ce(e) {
|
|
1418
1424
|
return e;
|
|
1419
1425
|
}
|
|
1420
1426
|
//#endregion
|
|
1421
|
-
export {
|
|
1427
|
+
export { v as S, C as _, se as a, S as b, K as c, ce as d, R as f, b as g, w as h, Q as i, H as l, D as m, Y as n, oe as o, O as p, W as r, B as s, z as t, $ as u, T as v, y as x, x as y };
|