@charisol/plexo-sdk 1.4.20 → 1.4.22
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/{compiler-sF2uR6Ky.js → compiler-dVsQwify.js} +190 -182
- package/dist/compiler.js +1 -1
- package/dist/index.js +1571 -1470
- package/dist/maildripEmbed-CfjDAP8i.js +4 -0
- package/dist/{mjmlBrowser-DQvN8hjF.js → mjmlBrowser-zNNbjrDQ.js} +1 -1
- package/dist/sanitize.js +1 -1
- package/dist/{sanitizeCompiledHtml-BDiv8Bkr.js → sanitizeCompiledHtml-D3k1f2jT.js} +8 -2
- package/dist/utilities/maildripEmbed.d.ts +1 -0
- package/dist/utilities/playground.interfaces.d.ts +15 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
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 } from "./iconSvgStatic-CGue7nyp.js";
|
|
2
|
+
import { t as _ } from "./maildripEmbed-CfjDAP8i.js";
|
|
2
3
|
//#region src/utilities/responsiveDefaults.ts
|
|
3
|
-
var
|
|
4
|
+
var v = {
|
|
4
5
|
tablet: {
|
|
5
6
|
thresholdPx: 24,
|
|
6
7
|
scale: .85,
|
|
@@ -11,7 +12,7 @@ var _ = {
|
|
|
11
12
|
scale: .7,
|
|
12
13
|
floorPx: 14
|
|
13
14
|
}
|
|
14
|
-
},
|
|
15
|
+
}, y = {
|
|
15
16
|
tablet: {
|
|
16
17
|
thresholdPx: 320,
|
|
17
18
|
scale: .8,
|
|
@@ -22,7 +23,7 @@ var _ = {
|
|
|
22
23
|
scale: .55,
|
|
23
24
|
floorPx: 140
|
|
24
25
|
}
|
|
25
|
-
},
|
|
26
|
+
}, b = {
|
|
26
27
|
tablet: {
|
|
27
28
|
thresholdPx: 48,
|
|
28
29
|
scale: .75,
|
|
@@ -33,7 +34,7 @@ var _ = {
|
|
|
33
34
|
scale: .55,
|
|
34
35
|
floorPx: 16
|
|
35
36
|
}
|
|
36
|
-
},
|
|
37
|
+
}, x = {
|
|
37
38
|
tablet: {
|
|
38
39
|
thresholdPx: 500,
|
|
39
40
|
scale: 1,
|
|
@@ -44,11 +45,11 @@ var _ = {
|
|
|
44
45
|
scale: 1,
|
|
45
46
|
floorPx: 0
|
|
46
47
|
}
|
|
47
|
-
},
|
|
48
|
+
}, S = ["fontSize"], C = [
|
|
48
49
|
"height",
|
|
49
50
|
"minHeight",
|
|
50
51
|
"maxHeight"
|
|
51
|
-
],
|
|
52
|
+
], w = [
|
|
52
53
|
"padding",
|
|
53
54
|
"paddingTop",
|
|
54
55
|
"paddingBottom",
|
|
@@ -57,8 +58,8 @@ var _ = {
|
|
|
57
58
|
"margin",
|
|
58
59
|
"marginTop",
|
|
59
60
|
"marginBottom"
|
|
60
|
-
],
|
|
61
|
-
function
|
|
61
|
+
], T = ["width", "maxWidth"];
|
|
62
|
+
function E(e) {
|
|
62
63
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
63
64
|
if (typeof e != "string") return null;
|
|
64
65
|
let t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/);
|
|
@@ -66,48 +67,48 @@ function T(e) {
|
|
|
66
67
|
let n = parseFloat(t[1]);
|
|
67
68
|
return Number.isFinite(n) ? n : null;
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
+
function D(e, t) {
|
|
70
71
|
return e < t.thresholdPx ? null : Math.max(Math.round(e * t.scale), t.floorPx);
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
+
function O(e, t) {
|
|
73
74
|
if (!e || typeof e != "object") return {};
|
|
74
75
|
let n = {};
|
|
75
|
-
for (let r of x) {
|
|
76
|
-
let i = T(e[r]);
|
|
77
|
-
if (i === null) continue;
|
|
78
|
-
let a = E(i, _[t]);
|
|
79
|
-
a !== null && (n[r] = `${a}px`);
|
|
80
|
-
}
|
|
81
76
|
for (let r of S) {
|
|
82
|
-
let i =
|
|
77
|
+
let i = E(e[r]);
|
|
83
78
|
if (i === null) continue;
|
|
84
|
-
let a =
|
|
79
|
+
let a = D(i, v[t]);
|
|
85
80
|
a !== null && (n[r] = `${a}px`);
|
|
86
81
|
}
|
|
87
82
|
for (let r of C) {
|
|
88
|
-
let i =
|
|
83
|
+
let i = E(e[r]);
|
|
89
84
|
if (i === null) continue;
|
|
90
|
-
let a =
|
|
85
|
+
let a = D(i, y[t]);
|
|
91
86
|
a !== null && (n[r] = `${a}px`);
|
|
92
87
|
}
|
|
93
88
|
for (let r of w) {
|
|
94
|
-
let i =
|
|
95
|
-
i
|
|
89
|
+
let i = E(e[r]);
|
|
90
|
+
if (i === null) continue;
|
|
91
|
+
let a = D(i, b[t]);
|
|
92
|
+
a !== null && (n[r] = `${a}px`);
|
|
93
|
+
}
|
|
94
|
+
for (let r of T) {
|
|
95
|
+
let i = E(e[r]);
|
|
96
|
+
i !== null && i >= x[t].thresholdPx && (n[r] = "100%");
|
|
96
97
|
}
|
|
97
98
|
return n;
|
|
98
99
|
}
|
|
99
|
-
function
|
|
100
|
+
function k(e, t, n) {
|
|
100
101
|
let r = e || {};
|
|
101
102
|
return n ? {
|
|
102
103
|
...r,
|
|
103
|
-
...
|
|
104
|
+
...O(r, n),
|
|
104
105
|
...t || {}
|
|
105
106
|
} : r;
|
|
106
107
|
}
|
|
107
108
|
//#endregion
|
|
108
109
|
//#region src/utilities/compiler.ts
|
|
109
|
-
var
|
|
110
|
-
function
|
|
110
|
+
var A = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif";
|
|
111
|
+
function j(e) {
|
|
111
112
|
if (!e || typeof e != "object") return null;
|
|
112
113
|
if (Array.isArray(e.columns) && e.columns.length > 0) return e;
|
|
113
114
|
let t = (e.type || "").toLowerCase(), n = e.props || e.content || e.attributes || e.data || e.payload || e, r = e.style || {};
|
|
@@ -361,7 +362,7 @@ function A(e) {
|
|
|
361
362
|
}
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
|
-
var
|
|
365
|
+
var M = /* @__PURE__ */ new Map([
|
|
365
366
|
["'Roboto', sans-serif", "Roboto"],
|
|
366
367
|
["'Open Sans', sans-serif", "Open Sans"],
|
|
367
368
|
["'Lato', sans-serif", "Lato"],
|
|
@@ -445,7 +446,7 @@ var j = /* @__PURE__ */ new Map([
|
|
|
445
446
|
["'Cookie', cursive", "Cookie"],
|
|
446
447
|
["'Great Vibes', cursive", "Great Vibes"]
|
|
447
448
|
]);
|
|
448
|
-
function
|
|
449
|
+
function N(e, t = []) {
|
|
449
450
|
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
450
451
|
if (!e) return;
|
|
451
452
|
let t = Array.isArray(e.columns) ? e.columns : [];
|
|
@@ -463,15 +464,15 @@ function M(e, t = []) {
|
|
|
463
464
|
for (let e of t) typeof e == "string" && e.trim() && n.add(e.trim());
|
|
464
465
|
return n;
|
|
465
466
|
}
|
|
466
|
-
function
|
|
467
|
+
function P(e) {
|
|
467
468
|
let t = /* @__PURE__ */ new Set();
|
|
468
469
|
for (let n of e) {
|
|
469
|
-
let e =
|
|
470
|
+
let e = M.get(n);
|
|
470
471
|
e && t.add(e);
|
|
471
472
|
}
|
|
472
473
|
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`;
|
|
473
474
|
}
|
|
474
|
-
var
|
|
475
|
+
var F = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter(([e, t]) => t != null && t !== "").map(([e, t]) => {
|
|
475
476
|
let n = e.replace(/([A-Z])/g, "-$1").toLowerCase(), r = t;
|
|
476
477
|
return typeof t == "number" && [
|
|
477
478
|
"padding",
|
|
@@ -482,25 +483,25 @@ var P = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
|
|
|
482
483
|
"width",
|
|
483
484
|
"height"
|
|
484
485
|
].some((t) => e.toLowerCase().includes(t)) && (r = `${t}px`), `${n}: ${r};`;
|
|
485
|
-
}).join(" "),
|
|
486
|
-
function
|
|
486
|
+
}).join(" "), I = (e = {}) => F(e).replace(/;(\s|$)/g, " !important;$1");
|
|
487
|
+
function L(e) {
|
|
487
488
|
if (typeof e != "string") return !1;
|
|
488
489
|
let t = e.toLowerCase();
|
|
489
490
|
return t.includes("javascript:") || t.includes("vbscript:") || t.includes("expression") || t.includes("url(") || t.includes("@import") || t.includes("-moz-binding") || t.includes("behavior") || t.includes("</style") || /\\/.test(e);
|
|
490
491
|
}
|
|
491
|
-
function
|
|
492
|
+
function R(e, t, n, r, i) {
|
|
492
493
|
let a = {
|
|
493
|
-
...
|
|
494
|
+
...O(n, r),
|
|
494
495
|
...i || {}
|
|
495
496
|
};
|
|
496
|
-
for (let e of Object.keys(a))
|
|
497
|
+
for (let e of Object.keys(a)) L(a[e]) && delete a[e];
|
|
497
498
|
if (Object.keys(a).length === 0) return;
|
|
498
|
-
let o =
|
|
499
|
+
let o = I(a);
|
|
499
500
|
if (!o) return;
|
|
500
501
|
let s = String(t).replace(/["\\]/g, "");
|
|
501
502
|
e[r].push(`[data-plexo-id="${s}"] { ${o} }`);
|
|
502
503
|
}
|
|
503
|
-
function
|
|
504
|
+
function z(e, t) {
|
|
504
505
|
if (e.type !== "menu" || !t || t.textAlign === void 0) return t;
|
|
505
506
|
let n = t.textAlign === "center" ? "center" : t.textAlign === "right" ? "flex-end" : "flex-start";
|
|
506
507
|
return {
|
|
@@ -508,7 +509,7 @@ function R(e, t) {
|
|
|
508
509
|
justifyContent: n
|
|
509
510
|
};
|
|
510
511
|
}
|
|
511
|
-
var
|
|
512
|
+
var B = () => ({
|
|
512
513
|
backgroundColor: "#ffffff",
|
|
513
514
|
borderRadius: "20px",
|
|
514
515
|
width: "100%",
|
|
@@ -531,11 +532,11 @@ var z = () => ({
|
|
|
531
532
|
buttonPaddingRight: "14px",
|
|
532
533
|
buttonFontSize: "13px",
|
|
533
534
|
buttonFontWeight: "700"
|
|
534
|
-
}),
|
|
535
|
+
}), V = (e) => (e || "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), H = (e, t) => {
|
|
535
536
|
if (typeof t != "string") return "";
|
|
536
537
|
let n = t.trim();
|
|
537
|
-
return n ? ` ${e}="${
|
|
538
|
-
},
|
|
538
|
+
return n ? ` ${e}="${V(n)}"` : "";
|
|
539
|
+
}, U = [
|
|
539
540
|
"fieldSpacing",
|
|
540
541
|
"buttonBackgroundColor",
|
|
541
542
|
"buttonTextColor",
|
|
@@ -555,9 +556,9 @@ var z = () => ({
|
|
|
555
556
|
"buttonWidth",
|
|
556
557
|
"buttonHeight",
|
|
557
558
|
"buttonAlign"
|
|
558
|
-
],
|
|
559
|
+
], W = (e) => {
|
|
559
560
|
if (!e || typeof e != "object") return "";
|
|
560
|
-
let t = e.kind || "text", n =
|
|
561
|
+
let t = e.kind || "text", n = V(e.name || e.id || "field"), r = e.required ? " required" : "", i = F({
|
|
561
562
|
fontSize: e.fontSize || "13px",
|
|
562
563
|
borderRadius: e.borderRadius || "12px",
|
|
563
564
|
borderWidth: e.borderWidth || "1px",
|
|
@@ -565,19 +566,19 @@ var z = () => ({
|
|
|
565
566
|
borderStyle: "solid",
|
|
566
567
|
color: e.inputTextColor
|
|
567
568
|
}), a = e.showLabel === !1 ? "" : `<label style="display: block; margin-bottom: 4px; font-size: ${e.fontSize || "12px"}; font-weight: ${e.labelFontWeight || "700"}; color: ${e.labelColor || "inherit"};">${e.label || ""}${e.required ? " <span style=\"color:#e11d48;\">*</span>" : ""}</label>`;
|
|
568
|
-
return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${
|
|
569
|
+
return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${V(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}></textarea>` : t === "select" ? `${a}<select name="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}>${(Array.isArray(e.options) ? e.options : []).map((e) => `<option value="${V(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>` : t === "radio" || t === "checkbox" ? `${a}<div style="display: flex; flex-wrap: wrap; gap: 8px;">${(Array.isArray(e.options) && e.options.length > 0 ? e.options : [{
|
|
569
570
|
label: e.label || "Option",
|
|
570
571
|
value: e.name || "option"
|
|
571
|
-
}]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${
|
|
572
|
+
}]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${V(r?.value ?? "")}" />${r?.label ?? r?.value ?? ""}</label>`).join("")}</div>` : `${a}<input type="${V(t)}" name="${n}" placeholder="${V(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r} />`;
|
|
572
573
|
};
|
|
573
|
-
function
|
|
574
|
+
function G(e, t, n) {
|
|
574
575
|
if (e === "none") return "";
|
|
575
|
-
let r =
|
|
576
|
+
let r = V(t);
|
|
576
577
|
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>`;
|
|
577
578
|
}
|
|
578
|
-
function
|
|
579
|
+
function K(e, t, n, r, i = []) {
|
|
579
580
|
return e.map((a, o) => {
|
|
580
|
-
let s = [...i, o], c = o === e.length - 1, l =
|
|
581
|
+
let s = [...i, o], c = o === e.length - 1, l = F({ borderBottom: n.showDividers && !c ? `1px solid ${t.dividerColor || "#e2e8f0"}` : void 0 }), u = F({
|
|
581
582
|
display: "flex",
|
|
582
583
|
alignItems: "center",
|
|
583
584
|
gap: "8px",
|
|
@@ -594,63 +595,70 @@ function G(e, t, n, r, i = []) {
|
|
|
594
595
|
border: "none",
|
|
595
596
|
font: "inherit",
|
|
596
597
|
background: void 0
|
|
597
|
-
}), d =
|
|
598
|
+
}), d = F({
|
|
598
599
|
display: "grid",
|
|
599
600
|
gridTemplateRows: a.defaultOpen ? "1fr" : "0fr",
|
|
600
601
|
transition: n.animated ? "grid-template-rows 0.25s ease" : void 0,
|
|
601
602
|
backgroundColor: t.contentBackgroundColor || "#ffffff"
|
|
602
|
-
}), f =
|
|
603
|
+
}), f = F({
|
|
603
604
|
padding: t.contentPadding || "14px",
|
|
604
605
|
color: t.contentTextColor || "#475569",
|
|
605
606
|
fontSize: t.contentFontSize || "13px",
|
|
606
607
|
whiteSpace: "pre-wrap"
|
|
607
|
-
}), p =
|
|
608
|
-
return `<div class="plexo-acc-item" style="${l}"><button type="button"${` data-plexo-acc-item="${
|
|
608
|
+
}), p = G(n.iconStyle, t.iconColor || "#64748b", !!a.defaultOpen), m = V(a.title), h = V(a.content), g = a.children.length ? `<div class="plexo-acc-group" style="margin-top: 10px;">${K(a.children, t, n, r, s)}</div>` : "";
|
|
609
|
+
return `<div class="plexo-acc-item" style="${l}"><button type="button"${` data-plexo-acc-item="${V(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>`;
|
|
609
610
|
}).join("");
|
|
610
611
|
}
|
|
611
|
-
function
|
|
612
|
+
function q(e) {
|
|
612
613
|
return `<!-- Unsupported block ${String(e)} -->`;
|
|
613
614
|
}
|
|
614
|
-
var
|
|
615
|
+
var J = (g) => {
|
|
615
616
|
if (!g || typeof g != "object") return "";
|
|
616
|
-
let
|
|
617
|
-
...
|
|
618
|
-
...
|
|
619
|
-
} :
|
|
617
|
+
let v = g.style || {}, y = g.type === "heading" || g.type === "paragraph" || g.type === "text", b = y ? c(g).autoWidth : !1, x = b ? Object.fromEntries(Object.entries(v).filter(([e]) => e !== "width")) : v, S = F(g.type === "form_container" ? {
|
|
618
|
+
...B(),
|
|
619
|
+
...v
|
|
620
|
+
} : x), C = g.attributes || {}, w = ` data-plexo-id="${V(g.id)}"`, T = String(C.boxAlign || "left"), E = y && (b || !!v.width), D = (e) => E ? `<div style="text-align: ${T};">${e}</div>` : e, O = `${E ? "display: inline-block; " : ""}${y && v.height ? "overflow: hidden; " : ""}`;
|
|
620
621
|
switch (g.type) {
|
|
621
|
-
case "heading": return
|
|
622
|
-
case "paragraph": return
|
|
623
|
-
case "text": return
|
|
622
|
+
case "heading": return D(`<h2${w} style="margin-top: 0; margin-bottom: 8px; ${O}${S}">${C.text || "Heading"}</h2>`);
|
|
623
|
+
case "paragraph": return D(`<p${w} style="margin-top: 0; margin-bottom: 12px; ${O}${S}">${C.text || "Paragraph text content."}</p>`);
|
|
624
|
+
case "text": return D(`<div${w} style="${O}${S}">${C.text || ""}</div>`);
|
|
624
625
|
case "button": {
|
|
625
|
-
let e = u(g), t =
|
|
626
|
-
...
|
|
626
|
+
let e = u(g), t = F({
|
|
627
|
+
...v,
|
|
627
628
|
width: e.width,
|
|
628
629
|
height: e.height
|
|
629
630
|
});
|
|
630
|
-
return `<div style="text-align: ${
|
|
631
|
+
return `<div style="text-align: ${v.textAlign || "center"};"><a${w} href="${C.href || "#"}" target="${C.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; ${t}">${C.text || "Button"}</a></div>`;
|
|
631
632
|
}
|
|
632
633
|
case "image": {
|
|
633
|
-
let e = h(g), t =
|
|
634
|
-
...
|
|
634
|
+
let e = h(g), t = v.textAlign === "center" ? "margin: 0 auto; display: block;" : v.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;", n = F({
|
|
635
|
+
...v,
|
|
635
636
|
width: e.width,
|
|
636
637
|
height: e.height
|
|
637
638
|
});
|
|
638
|
-
return `<img${
|
|
639
|
+
return `<img${w} src="${C.src || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe"}" alt="${C.alt || ""}" style="${n} ${t}" />`;
|
|
639
640
|
}
|
|
640
|
-
case "divider": return `<hr${
|
|
641
|
-
case "spacer": return `<div${
|
|
642
|
-
case "card": return `<div${
|
|
643
|
-
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${
|
|
644
|
-
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${
|
|
641
|
+
case "divider": return `<hr${w} style="border: 0; border-top: ${v.borderWidth || "1px"} ${v.borderStyle || "solid"} ${v.borderColor || "#334155"}; ${S}" />`;
|
|
642
|
+
case "spacer": return `<div${w} style="height: ${v.height || "24px"};"></div>`;
|
|
643
|
+
case "card": return `<div${w} style="${S}">
|
|
644
|
+
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${C.title || "Card Title"}</h3>
|
|
645
|
+
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${C.description || "Card description."}</p>
|
|
645
646
|
</div>`;
|
|
646
647
|
case "form_container": {
|
|
648
|
+
if (C.provider === "maildrip" && typeof C.maildripPageId == "string" && C.maildripPageId.trim()) {
|
|
649
|
+
let e = V(C.maildripPageId.trim());
|
|
650
|
+
return `<div${w} style="${F({
|
|
651
|
+
...v,
|
|
652
|
+
height: p(g)
|
|
653
|
+
})}"><script type="module" src="${_}"><\/script><opt-in-embed-form page-id="${e}"></opt-in-embed-form></div>`;
|
|
654
|
+
}
|
|
647
655
|
let n = {
|
|
648
|
-
...
|
|
649
|
-
...
|
|
656
|
+
...B(),
|
|
657
|
+
...v
|
|
650
658
|
}, r = {};
|
|
651
|
-
for (let e of Object.keys(n))
|
|
659
|
+
for (let e of Object.keys(n)) U.includes(e) || (r[e] = n[e]);
|
|
652
660
|
r.height = p(g);
|
|
653
|
-
let i =
|
|
661
|
+
let i = F(r), a = l(t(Array.isArray(C.fields) ? C.fields : [])), o = n.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${W(e)}</div>`).join(""), c = C.buttonAutoWidth === !1 ? n.buttonWidth || "100%" : "auto", u = n.buttonAlign === "left" ? "flex-start" : n.buttonAlign === "right" ? "flex-end" : "center", d = C.buttonAutoHeight === !1 && n.buttonHeight || "auto", f = F({
|
|
654
662
|
backgroundColor: n.buttonBackgroundColor,
|
|
655
663
|
color: n.buttonTextColor,
|
|
656
664
|
borderRadius: n.buttonBorderRadius,
|
|
@@ -667,18 +675,18 @@ var q = (g) => {
|
|
|
667
675
|
width: c,
|
|
668
676
|
height: d
|
|
669
677
|
});
|
|
670
|
-
return `<form${
|
|
678
|
+
return `<form${w} action="${V(C.actionUrl || C.action || "#")}" method="${V(C.method || "POST")}" style="${i}">${s}<div style="display: flex; width: 100%; justify-content: ${u};"><button type="submit" style="border: 0; cursor: pointer; ${f}">${C.submitLabel || "Submit"}</button></div></form>`;
|
|
671
679
|
}
|
|
672
680
|
case "input": {
|
|
673
|
-
let e =
|
|
674
|
-
return `<input${
|
|
681
|
+
let e = C.inputType || C.type || "text", t = V(C.name || C.fieldName || "field"), n = V(C.placeholder || ""), r = C.required ? " required" : "";
|
|
682
|
+
return `<input${w} type="${V(e)}" name="${t}" placeholder="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${r} />`;
|
|
675
683
|
}
|
|
676
|
-
case "textarea": return `<textarea${
|
|
677
|
-
case "select": return `<select${
|
|
678
|
-
case "html": return `<div${
|
|
679
|
-
...
|
|
684
|
+
case "textarea": return `<textarea${w} name="${V(C.name || C.fieldName || "field")}" placeholder="${V(C.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${C.required ? " required" : ""}></textarea>`;
|
|
685
|
+
case "select": return `<select${w} name="${V(C.name || C.fieldName || "field")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${C.required ? " required" : ""}>${(Array.isArray(C.options) ? C.options : []).map((e) => `<option value="${V(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
|
|
686
|
+
case "html": return `<div${w} style="${F({
|
|
687
|
+
...v,
|
|
680
688
|
height: s(g, "auto")
|
|
681
|
-
})}">${
|
|
689
|
+
})}">${C.htmlContent || C.text || ""}</div>`;
|
|
682
690
|
case "blog_title":
|
|
683
691
|
case "blog_content":
|
|
684
692
|
case "blog_featured_image":
|
|
@@ -687,8 +695,8 @@ var q = (g) => {
|
|
|
687
695
|
case "blog_categories":
|
|
688
696
|
case "blog_comments":
|
|
689
697
|
case "blog_post_list": {
|
|
690
|
-
let e = g.type.replace(/^blog_/, "").replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t =
|
|
691
|
-
return `<div${
|
|
698
|
+
let e = g.type.replace(/^blog_/, "").replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t = F(v);
|
|
699
|
+
return `<div${w} data-plexo-blog-${e}="true"${H("data-plexo-blog-prefix", C.prefix)} style="${t}"></div>`;
|
|
692
700
|
}
|
|
693
701
|
case "product":
|
|
694
702
|
case "booking":
|
|
@@ -697,20 +705,20 @@ var q = (g) => {
|
|
|
697
705
|
case "checkout_flow":
|
|
698
706
|
case "order_confirmation":
|
|
699
707
|
case "order_tracking": {
|
|
700
|
-
let e = g.type.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t =
|
|
701
|
-
return `<div${
|
|
708
|
+
let e = g.type.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t = F(v);
|
|
709
|
+
return `<div${w} data-plexo-commerce-${e}="true"${H("data-plexo-product-id", C.productId)}${H("data-plexo-service-id", C.serviceId)}${H("data-plexo-commerce-mode", C.mode)}${C.storeMode === !1 ? " data-plexo-commerce-store-mode=\"false\"" : ""}${H("data-plexo-commerce-limit", C.limit)}${H("data-plexo-commerce-category", C.category)}${H("data-plexo-commerce-sort", C.sort)}${H("data-plexo-commerce-items-per-row", C.itemsPerRow)}${H("data-plexo-commerce-items-per-page", C.itemsPerPage)}${C.paginated ? " data-plexo-commerce-paginated=\"true\"" : ""} style="${t}"></div>`;
|
|
702
710
|
}
|
|
703
711
|
case "social": {
|
|
704
|
-
let e = r(g), t =
|
|
705
|
-
return `<div${
|
|
706
|
-
padding:
|
|
707
|
-
margin:
|
|
712
|
+
let e = r(g), t = v.textAlign === "center" ? "center" : v.textAlign === "right" ? "flex-end" : "flex-start";
|
|
713
|
+
return `<div${w} style="${F({
|
|
714
|
+
padding: v.padding,
|
|
715
|
+
margin: v.margin,
|
|
708
716
|
display: "flex",
|
|
709
717
|
flexWrap: "wrap",
|
|
710
|
-
gap:
|
|
718
|
+
gap: v.iconSpacing || "8px",
|
|
711
719
|
justifyContent: t
|
|
712
720
|
})}">${e.map((e) => {
|
|
713
|
-
let t =
|
|
721
|
+
let t = F({
|
|
714
722
|
width: e.size,
|
|
715
723
|
height: e.size,
|
|
716
724
|
padding: "8px",
|
|
@@ -722,132 +730,132 @@ var q = (g) => {
|
|
|
722
730
|
justifyContent: "center",
|
|
723
731
|
overflow: "hidden"
|
|
724
732
|
});
|
|
725
|
-
return `<a href="${
|
|
733
|
+
return `<a href="${V(e.url)}" style="${t} text-decoration: none;">${f(e.provider, e.color)}</a>`;
|
|
726
734
|
}).join("")}</div>`;
|
|
727
735
|
}
|
|
728
736
|
case "menu": {
|
|
729
|
-
let e = n(g), t =
|
|
730
|
-
return `<div${
|
|
731
|
-
...
|
|
737
|
+
let e = n(g), t = v.textAlign === "center" ? "center" : v.textAlign === "right" ? "flex-end" : "flex-start";
|
|
738
|
+
return `<div${w} style="${F({
|
|
739
|
+
...v,
|
|
732
740
|
display: "flex",
|
|
733
741
|
flexWrap: "wrap",
|
|
734
742
|
gap: "16px",
|
|
735
743
|
justifyContent: t
|
|
736
|
-
})}">${e.map((e) => `<a href="${
|
|
744
|
+
})}">${e.map((e) => `<a href="${V(e.href)}" style="text-decoration: none; color: inherit; font-weight: ${v.fontWeight || 600};">${V(e.label)}</a>`).join("")}</div>`;
|
|
737
745
|
}
|
|
738
746
|
case "icon": {
|
|
739
|
-
let e =
|
|
740
|
-
padding:
|
|
741
|
-
margin:
|
|
747
|
+
let e = v.fontSize || `${C.iconSize || 48}px`, t = v.color || "#1e293b", n = parseInt(String(e), 10) || 48, r = m(C.iconName, n, t), i = v.textAlign === "right" ? "flex-end" : v.textAlign === "left" ? "flex-start" : "center", a = F({
|
|
748
|
+
padding: v.padding,
|
|
749
|
+
margin: v.margin,
|
|
742
750
|
display: "flex",
|
|
743
751
|
justifyContent: i
|
|
744
|
-
}), o = typeof
|
|
745
|
-
return `<div style="${a}">${o ? `<a${
|
|
752
|
+
}), o = typeof C.href == "string" ? C.href.trim() : "", s = `<span style="display: inline-flex; align-items: center; justify-content: center; color: ${t};">${r}</span>`;
|
|
753
|
+
return `<div style="${a}">${o ? `<a${w} href="${V(o)}" target="${C.openInNewTab ? "_blank" : "_self"}" style="text-decoration: none;">${s}</a>` : `<span${w}>${s}</span>`}</div>`;
|
|
746
754
|
}
|
|
747
755
|
case "table": {
|
|
748
|
-
let e = d(g), t = `${
|
|
749
|
-
let o = a ? "th" : "td", s = a ?
|
|
756
|
+
let e = d(g), t = `${v.borderWidth || "1px"} ${v.borderStyle || "solid"} ${v.borderColor || "#cbd5e1"}`, n = (n, r, i, a) => {
|
|
757
|
+
let o = a ? "th" : "td", s = a ? v.headerBgColor || "#f8fafc" : e.striped && r % 2 == 1 ? "#f8fafc" : v.contentBgColor || "#ffffff", c = a ? v.headerTextColor || "#1e293b" : v.contentTextColor || "#475569", l = a ? v.headerTextAlign || "left" : v.contentTextAlign || "left";
|
|
750
758
|
return `<tr>${n.map((e, n) => {
|
|
751
|
-
let r =
|
|
752
|
-
padding:
|
|
759
|
+
let r = F({
|
|
760
|
+
padding: v.cellPadding || "8px",
|
|
753
761
|
border: t,
|
|
754
762
|
backgroundColor: s,
|
|
755
763
|
color: c,
|
|
756
764
|
textAlign: l,
|
|
757
|
-
lineHeight:
|
|
758
|
-
letterSpacing:
|
|
765
|
+
lineHeight: v.contentLineHeight,
|
|
766
|
+
letterSpacing: v.contentLetterSpacing,
|
|
759
767
|
fontWeight: a ? "700" : void 0
|
|
760
|
-
}), u = ` data-plexo-cell="${
|
|
768
|
+
}), u = ` data-plexo-cell="${V(g.id)}|${i}-${n}"`;
|
|
761
769
|
return `<${o}${u} style="${r}">${e || " "}</${o}>`;
|
|
762
770
|
}).join("")}</tr>`;
|
|
763
|
-
}, 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 =
|
|
771
|
+
}, 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 = F({
|
|
764
772
|
borderCollapse: "collapse",
|
|
765
773
|
width: "100%"
|
|
766
774
|
});
|
|
767
|
-
return `<div${
|
|
768
|
-
padding:
|
|
769
|
-
margin:
|
|
775
|
+
return `<div${w} style="${F({
|
|
776
|
+
padding: v.padding,
|
|
777
|
+
margin: v.margin,
|
|
770
778
|
overflowX: "auto"
|
|
771
779
|
})}"><table style="${c}">${r}<tbody>${o}</tbody>${s}</table></div>`;
|
|
772
780
|
}
|
|
773
781
|
case "video": {
|
|
774
|
-
let e = i(
|
|
775
|
-
return `<div${
|
|
776
|
-
padding:
|
|
777
|
-
margin:
|
|
778
|
-
borderRadius:
|
|
782
|
+
let e = i(C.videoUrl), t = C.linkType === "email" ? `mailto:${C.href || ""}` : C.href || C.videoUrl || "#", n = C.target || "_blank";
|
|
783
|
+
return `<div${w} style="${F({
|
|
784
|
+
padding: v.padding,
|
|
785
|
+
margin: v.margin,
|
|
786
|
+
borderRadius: v.borderRadius,
|
|
779
787
|
overflow: "hidden"
|
|
780
|
-
})}"><a href="${
|
|
788
|
+
})}"><a href="${V(t)}" target="${V(n)}" style="position: relative; display: block; text-decoration: none;"><img src="${V(e.thumbnailUrl)}" alt="${V(C.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>`;
|
|
781
789
|
}
|
|
782
790
|
case "timer": {
|
|
783
|
-
let e =
|
|
784
|
-
fontFamily:
|
|
785
|
-
fontSize:
|
|
786
|
-
color:
|
|
791
|
+
let e = C.showLabels !== !1, t = F({
|
|
792
|
+
fontFamily: v.digitsFontFamily,
|
|
793
|
+
fontSize: v.digitsFontSize || "40px",
|
|
794
|
+
color: v.digitsColor || "#1e293b",
|
|
787
795
|
fontWeight: "800"
|
|
788
|
-
}), n =
|
|
789
|
-
fontFamily:
|
|
790
|
-
fontSize:
|
|
791
|
-
color:
|
|
792
|
-
}), r =
|
|
793
|
-
backgroundColor:
|
|
794
|
-
borderRadius:
|
|
795
|
-
padding:
|
|
796
|
+
}), n = F({
|
|
797
|
+
fontFamily: v.labelsFontFamily,
|
|
798
|
+
fontSize: v.labelsFontSize || "16px",
|
|
799
|
+
color: v.labelsColor || "#64748b"
|
|
800
|
+
}), r = F({
|
|
801
|
+
backgroundColor: v.backgroundColor || "#f8fafc",
|
|
802
|
+
borderRadius: v.borderRadius || "8px",
|
|
803
|
+
padding: v.padding || "16px",
|
|
796
804
|
textAlign: "center"
|
|
797
|
-
}), 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(
|
|
798
|
-
return `<div${
|
|
805
|
+
}), 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(C.targetDate, C.timezone), s = V(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>`;
|
|
806
|
+
return `<div${w} 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>`;
|
|
799
807
|
}
|
|
800
808
|
case "carousel": {
|
|
801
|
-
let e = Array.isArray(
|
|
802
|
-
padding:
|
|
803
|
-
margin:
|
|
804
|
-
backgroundColor:
|
|
809
|
+
let e = Array.isArray(C.images) ? C.images : [], t = `plexo-carousel-${g.id}`, n = F({
|
|
810
|
+
padding: v.padding || "10px",
|
|
811
|
+
margin: v.margin,
|
|
812
|
+
backgroundColor: v.backgroundColor,
|
|
805
813
|
overflow: "hidden",
|
|
806
|
-
borderRadius:
|
|
807
|
-
width:
|
|
808
|
-
height:
|
|
814
|
+
borderRadius: v.borderRadius || "12px",
|
|
815
|
+
width: v.width || "100%",
|
|
816
|
+
height: v.height || "360px"
|
|
809
817
|
});
|
|
810
|
-
if (e.length === 0) return `<div${
|
|
811
|
-
let r = Math.min(e.length - 1, Math.max(0, parseInt(String(
|
|
818
|
+
if (e.length === 0) return `<div${w} style="${n}"><div style="padding: 40px; text-align: center; color: #94a3b8;">No images in carousel</div></div>`;
|
|
819
|
+
let r = Math.min(e.length - 1, Math.max(0, parseInt(String(C.activeIdx), 10) || 0)), i = e.map((t, n) => (n - r + e.length) % e.length), a = e.length * 5, o = .6, s = e.map((n, r) => {
|
|
812
820
|
let o = i[r] * 5, s = e.length > 1 ? ` animation: ${t}-fade ${a}s ease-in-out infinite; animation-delay: ${o}s;` : "";
|
|
813
|
-
return `<div data-slide-idx="${r}" style="opacity: ${e.length > 1 ? "0" : "1"};${s}"><img src="${
|
|
821
|
+
return `<div data-slide-idx="${r}" style="opacity: ${e.length > 1 ? "0" : "1"};${s}"><img src="${V(n.src)}" alt="${V(n.alt || n.caption || "")}" style="width: 100%; height: 100%; object-fit: cover; display: block;" />${n.caption ? `<div class="${t}-caption" style="padding: 8px; text-align: center; background: rgba(15, 23, 42, 0.8); color: #fff; font-size: 12px; font-weight: 600;">${V(n.caption)}</div>` : ""}</div>`;
|
|
814
822
|
}).join(""), c = e.some((e) => !!e.caption) ? "38px" : "10px", l = e.length > 1 ? `<div class="${t}-dots" style="display: flex; gap: 6px; justify-content: center;">${e.map((e, n) => {
|
|
815
823
|
let r = i[n] * 5;
|
|
816
824
|
return `<span style="width: 6px; height: 6px; border-radius: 9999px; background: #cbd5e1; animation: ${t}-dot ${a}s ease-in-out infinite; animation-delay: ${r}s;"></span>`;
|
|
817
825
|
}).join("")}</div>` : "", u = (5 - o) / a * 100, d = 5 / a * 100, f = o / a * 100;
|
|
818
|
-
return `<div${
|
|
826
|
+
return `<div${w} class="${t}" style="${n}">${e.length > 1 ? `<style>.${t}{position:relative;}.${t} [data-slide-idx]{position:absolute;inset:0;}.${t}-caption{position:absolute;left:0;right:0;bottom:0;}.${t}-dots{position:absolute;left:0;right:0;bottom:${c};}@keyframes ${t}-fade{0%{opacity:0;}${f}%{opacity:1;}${u}%{opacity:1;}${d}%{opacity:0;}100%{opacity:0;}}@keyframes ${t}-dot{0%{background:#cbd5e1;}${f}%{background:#4f46e5;}${u}%{background:#4f46e5;}${d}%{background:#cbd5e1;}100%{background:#cbd5e1;}}</style>` : `<style>.${t}{position:relative;}.${t} [data-slide-idx]{position:absolute;inset:0;}.${t}-caption{position:absolute;left:0;right:0;bottom:0;}</style>`}${s}${l}</div>`;
|
|
819
827
|
}
|
|
820
828
|
case "accordion": {
|
|
821
|
-
let e = o(g), t =
|
|
822
|
-
border: `${
|
|
823
|
-
borderRadius:
|
|
829
|
+
let e = o(g), t = C.mode === "multi" ? "multi" : "single", n = C.iconStyle || "chevron", r = C.iconPosition === "left", i = C.showDividers !== !1, a = C.animation !== "none", s = F({
|
|
830
|
+
border: `${v.borderWidth || "1px"} ${v.borderStyle || "solid"} ${v.borderColor || "#e2e8f0"}`,
|
|
831
|
+
borderRadius: v.borderRadius || "10px",
|
|
824
832
|
overflow: "hidden",
|
|
825
|
-
margin:
|
|
833
|
+
margin: v.margin
|
|
826
834
|
});
|
|
827
|
-
return e.length === 0 ? `<div${
|
|
835
|
+
return e.length === 0 ? `<div${w} style="${s}"></div>` : `<div${w} data-acc-mode="${t}" data-acc-icon-style="${n}" style="${s}"><div class="plexo-acc-group">${K(e, v, {
|
|
828
836
|
iconStyle: n,
|
|
829
837
|
iconOnLeft: r,
|
|
830
838
|
showDividers: i,
|
|
831
839
|
animated: a
|
|
832
840
|
}, 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>`;
|
|
833
841
|
}
|
|
834
|
-
default: return
|
|
842
|
+
default: return q(g.type);
|
|
835
843
|
}
|
|
836
|
-
},
|
|
844
|
+
}, Y = (e, t, n) => {
|
|
837
845
|
if (!e || typeof e != "object") return "";
|
|
838
|
-
let r =
|
|
846
|
+
let r = j(e);
|
|
839
847
|
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. -->`;
|
|
840
848
|
let i = r.style?.columnGap, a = typeof i == "number" ? `${i}px` : typeof i == "string" ? i.trim() : "", o = a !== "" && a !== "0" && a !== "0px", s = { ...r.style || {} };
|
|
841
849
|
delete s.columnGap;
|
|
842
|
-
let c =
|
|
843
|
-
|
|
850
|
+
let c = F(s), l = H("id", r.htmlId), u = H("class", r.htmlClass), d = r.id || `row-${Math.random().toString(36).substring(2, 9)}`;
|
|
851
|
+
R(t, d, r.style, "tablet", r.styleTablet), R(t, d, r.style, "mobile", r.styleMobile);
|
|
844
852
|
let f = `\n <!-- ROW START: ${r.id || "row"} -->`, p = o ? `gap: ${a}; margin-left: 0; margin-right: 0;` : "margin-left: -8px; margin-right: -8px;";
|
|
845
853
|
f += `\n <div data-plexo-id="${d}"${l}${u} class="plexo-row" style="display: flex; flex-wrap: wrap; ${p} ${c}">`;
|
|
846
854
|
let m = Array.isArray(r.columns) ? r.columns : [], h = o && m.length > 1 ? `(${a} * ${m.length - 1} / ${m.length})` : "";
|
|
847
855
|
for (let e of m) {
|
|
848
856
|
if (!e) continue;
|
|
849
|
-
let r = e.styles || e.style || {}, i =
|
|
850
|
-
|
|
857
|
+
let r = e.styles || e.style || {}, i = F(r), a = r.gap || "16px", s = H("id", e.attrs?.htmlId), c = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", l = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
|
|
858
|
+
R(t, l, r, "tablet", e.stylesTablet), R(t, l, r, "mobile", e.stylesMobile);
|
|
851
859
|
let u = Array.isArray(e.elements) ? e.elements : [], d = Array.isArray(e.nestedRows) ? e.nestedRows : [], p = n && u.length === 0 && d.length === 0 ? "min-height: 148px; " : "", m = e.width || "100%", _ = typeof m == "string" && /^\s*\d+(\.\d+)?\s*%\s*$/.test(m), v = o && _ && h ? `calc(${m.trim()} - ${h})` : m, y = o ? "padding-left: 0; padding-right: 0;" : "padding-left: 8px; padding-right: 8px;";
|
|
852
860
|
f += `\n <!-- COLUMN START: ${e.id || "col"} -->`, f += `\n <div data-plexo-id="${l}"${s} class="plexo-col${c}" style="box-sizing: border-box; ${y} width: ${v}; --plexo-col-gap: ${a}; ${p}${i}">`;
|
|
853
861
|
let b = new Map(u.map((e) => [e.id, e])), x = new Map(d.map((e) => [e.id, e]));
|
|
@@ -858,17 +866,17 @@ var q = (g) => {
|
|
|
858
866
|
})) {
|
|
859
867
|
let e = b.get(r);
|
|
860
868
|
if (e) {
|
|
861
|
-
let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "", i =
|
|
862
|
-
|
|
869
|
+
let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "", i = H("id", n.htmlId), o = H("class", r), s = e.style?.display, c = s === "inline-block" || s === "inline" || s === "inline-flex" ? `margin-bottom: ${a}; display: ${s}; vertical-align: top;` : `margin-bottom: ${a};`;
|
|
870
|
+
R(t, e.id, e.style, "tablet", z(e, e.styleTablet)), R(t, e.id, e.style, "mobile", z(e, e.styleMobile)), f += `\n <div${i}${o} style="${c}">`, f += `\n ${J(e)}`, f += "\n </div>";
|
|
863
871
|
continue;
|
|
864
872
|
}
|
|
865
873
|
let i = x.get(r);
|
|
866
|
-
i && (f +=
|
|
874
|
+
i && (f += Y(i, t, n));
|
|
867
875
|
}
|
|
868
876
|
f += "\n </div>";
|
|
869
877
|
}
|
|
870
878
|
return f += "\n </div>", f;
|
|
871
|
-
},
|
|
879
|
+
}, X = (e, t) => {
|
|
872
880
|
let n = t?.canvasEditorPadding ?? !1;
|
|
873
881
|
if (!e || typeof e != "object") return "<!-- Empty template -->";
|
|
874
882
|
let r = e.designJson || e.template || e, i = r.body || (Array.isArray(r.rows) ? {
|
|
@@ -900,26 +908,26 @@ var q = (g) => {
|
|
|
900
908
|
"ogImageUrl"
|
|
901
909
|
], s = {};
|
|
902
910
|
for (let e of Object.keys(a)) o.includes(e) || (s[e] = a[e]);
|
|
903
|
-
let c =
|
|
911
|
+
let c = F(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 = H("id", a.htmlId), d = H("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 = typeof a.metaDescription == "string" && a.metaDescription.trim() ? a.metaDescription.trim() : "", g = typeof a.ogImageUrl == "string" && a.ogImageUrl.trim() ? a.ogImageUrl.trim() : "", _ = typeof a.contentMaxWidth == "string" && a.contentMaxWidth.trim() ? a.contentMaxWidth.trim() : "1200px", v = Array.isArray(i.rows) ? i.rows : Array.isArray(r.rows) ? r.rows : Array.isArray(e.rows) ? e.rows : [], y = P(N(v, [a.fontFamily])), b = {
|
|
904
912
|
tablet: [],
|
|
905
913
|
mobile: []
|
|
906
914
|
}, x = "";
|
|
907
|
-
for (let e of v) x +=
|
|
915
|
+
for (let e of v) x += Y(e, b, n);
|
|
908
916
|
let S = b.tablet.length ? `\n ${b.tablet.join("\n ")}` : "", C = b.mobile.length ? `\n ${b.mobile.join("\n ")}` : "", w = `<!DOCTYPE html>
|
|
909
917
|
<html>
|
|
910
918
|
<head>
|
|
911
919
|
<meta charset="utf-8">
|
|
912
|
-
<title>${
|
|
913
|
-
${h ? `<meta name="description" content="${
|
|
914
|
-
${m ? `<link rel="icon" href="${
|
|
920
|
+
<title>${V(l)}</title>
|
|
921
|
+
${h ? `<meta name="description" content="${V(h)}">` : ""}
|
|
922
|
+
${m ? `<link rel="icon" href="${V(m)}">` : ""}
|
|
915
923
|
<meta property="og:type" content="website">
|
|
916
|
-
<meta property="og:title" content="${
|
|
917
|
-
${h ? `<meta property="og:description" content="${
|
|
918
|
-
${g ? `<meta property="og:image" content="${
|
|
924
|
+
<meta property="og:title" content="${V(l)}">
|
|
925
|
+
${h ? `<meta property="og:description" content="${V(h)}">` : ""}
|
|
926
|
+
${g ? `<meta property="og:image" content="${V(g)}">` : ""}
|
|
919
927
|
<meta name="twitter:card" content="${g ? "summary_large_image" : "summary"}">
|
|
920
|
-
<meta name="twitter:title" content="${
|
|
921
|
-
${h ? `<meta name="twitter:description" content="${
|
|
922
|
-
${g ? `<meta name="twitter:image" content="${
|
|
928
|
+
<meta name="twitter:title" content="${V(l)}">
|
|
929
|
+
${h ? `<meta name="twitter:description" content="${V(h)}">` : ""}
|
|
930
|
+
${g ? `<meta name="twitter:image" content="${V(g)}">` : ""}
|
|
923
931
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
924
932
|
${y ? `<link rel="stylesheet" href="${y}">` : ""}
|
|
925
933
|
<style>
|
|
@@ -930,7 +938,7 @@ var q = (g) => {
|
|
|
930
938
|
margin entirely, so the same -8px bleed would otherwise show as a permanent ~8px
|
|
931
939
|
horizontal scrollbar with nothing to absorb it. Scoped to body, not any inner element,
|
|
932
940
|
so it only ever suppresses that specific layout overflow -- never clips real content. */
|
|
933
|
-
body { margin: 0; overflow-x: hidden; font-family: ${
|
|
941
|
+
body { margin: 0; overflow-x: hidden; font-family: ${A}; }
|
|
934
942
|
.plexo-row {
|
|
935
943
|
display: flex;
|
|
936
944
|
flex-wrap: wrap;
|
|
@@ -960,17 +968,17 @@ ${p ? ` <script>\n${p}\n <\/script>` : ""}
|
|
|
960
968
|
</body>
|
|
961
969
|
</html>`, w = w.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1"), w;
|
|
962
970
|
};
|
|
963
|
-
function X(e) {
|
|
964
|
-
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
965
|
-
}
|
|
966
971
|
function Z(e) {
|
|
967
|
-
return
|
|
972
|
+
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
968
973
|
}
|
|
969
974
|
function Q(e) {
|
|
970
|
-
return
|
|
975
|
+
return Z(X(e));
|
|
971
976
|
}
|
|
972
977
|
function $(e) {
|
|
978
|
+
return X(e);
|
|
979
|
+
}
|
|
980
|
+
function ee(e) {
|
|
973
981
|
return e;
|
|
974
982
|
}
|
|
975
983
|
//#endregion
|
|
976
|
-
export {
|
|
984
|
+
export { $ as a, B as c, ee as d, k as f, X as i, I as l, U as n, Q as o, R as r, j as s, A as t, Z as u };
|