@charisol/plexo-sdk 1.4.36 → 1.4.38
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-BOsCUhY-.js → compiler-BvseEhDC.js} +66 -66
- package/dist/compiler.js +2 -2
- package/dist/index.js +10038 -10021
- package/dist/{mjmlBrowser-zNNbjrDQ.js → mjmlBrowser-DWk0mRD6.js} +1 -1
- package/dist/sanitize.js +1 -1
- package/dist/{sanitizeCompiledHtml-D3k1f2jT.js → sanitizeCompiledHtml-CNjUXlMK.js} +22 -14
- package/dist/utilities/compiler.d.ts +1 -0
- package/package.json +1 -1
|
@@ -484,24 +484,24 @@ var P = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
|
|
|
484
484
|
"height"
|
|
485
485
|
].some((t) => e.toLowerCase().includes(t)) && (r = `${t}px`), `${n}: ${r};`;
|
|
486
486
|
}).join(" "), F = (e = {}) => P(e).replace(/;(\s|$)/g, " !important;$1");
|
|
487
|
-
function
|
|
487
|
+
function te(e) {
|
|
488
488
|
if (typeof e != "string") return !1;
|
|
489
489
|
let t = e.toLowerCase();
|
|
490
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);
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function I(e, t, n, r, i) {
|
|
493
493
|
let a = {
|
|
494
494
|
...O(n, r),
|
|
495
495
|
...i || {}
|
|
496
496
|
};
|
|
497
|
-
for (let e of Object.keys(a))
|
|
497
|
+
for (let e of Object.keys(a)) te(a[e]) && delete a[e];
|
|
498
498
|
if (Object.keys(a).length === 0) return;
|
|
499
499
|
let o = F(a);
|
|
500
500
|
if (!o) return;
|
|
501
501
|
let s = String(t).replace(/["\\]/g, "");
|
|
502
502
|
e[r].push(`[data-plexo-id="${s}"] { ${o} }`);
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function L(e, t) {
|
|
505
505
|
if (e.type !== "menu" || !t || t.textAlign === void 0) return t;
|
|
506
506
|
let n = t.textAlign === "center" ? "center" : t.textAlign === "right" ? "flex-end" : "flex-start";
|
|
507
507
|
return {
|
|
@@ -509,16 +509,16 @@ function R(e, t) {
|
|
|
509
509
|
justifyContent: n
|
|
510
510
|
};
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function R(e, t, n, r) {
|
|
513
513
|
if (!r || r.textAlign === void 0 || t.type !== "button" && t.type !== "icon") return;
|
|
514
514
|
let i = `${t.id}-align`;
|
|
515
515
|
if (t.type === "button") {
|
|
516
|
-
|
|
516
|
+
I(e, i, void 0, n, { textAlign: r.textAlign });
|
|
517
517
|
return;
|
|
518
518
|
}
|
|
519
|
-
|
|
519
|
+
I(e, i, void 0, n, { justifyContent: r.textAlign === "right" ? "flex-end" : r.textAlign === "left" ? "flex-start" : "center" });
|
|
520
520
|
}
|
|
521
|
-
var
|
|
521
|
+
var z = () => ({
|
|
522
522
|
backgroundColor: "#ffffff",
|
|
523
523
|
borderRadius: "20px",
|
|
524
524
|
width: "100%",
|
|
@@ -541,11 +541,11 @@ var B = () => ({
|
|
|
541
541
|
buttonPaddingRight: "14px",
|
|
542
542
|
buttonFontSize: "13px",
|
|
543
543
|
buttonFontWeight: "700"
|
|
544
|
-
}),
|
|
544
|
+
}), B = (e) => (e || "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), V = (e, t) => {
|
|
545
545
|
if (typeof t != "string") return "";
|
|
546
546
|
let n = t.trim();
|
|
547
|
-
return n ? ` ${e}="${
|
|
548
|
-
}, U = [
|
|
547
|
+
return n ? ` ${e}="${B(n)}"` : "";
|
|
548
|
+
}, H = "_hp_field", U = [
|
|
549
549
|
"fieldSpacing",
|
|
550
550
|
"buttonBackgroundColor",
|
|
551
551
|
"buttonTextColor",
|
|
@@ -566,7 +566,7 @@ var B = () => ({
|
|
|
566
566
|
"buttonHeight",
|
|
567
567
|
"buttonAlign"
|
|
568
568
|
], W = "#cbd5e1", G = "#e2e8f0", K = "#1e293b", q = "#64748b", J = (e) => `<span style="display:block;font-family:monospace;font-size:10px;letter-spacing:0.06em;text-transform:uppercase;color:#94a3b8;margin-bottom:8px;">${e} (live once published)</span>`, Y = (e, t = G, n = "8px") => `<div style="width:${e};height:${n};background:${t};border-radius:3px;"></div>`;
|
|
569
|
-
function
|
|
569
|
+
function ne(e) {
|
|
570
570
|
let t = (e = "90px") => `<div style="width:100%;height:${e};background:linear-gradient(135deg,${G},${W});border-radius:6px;"></div>`, n = () => `<div style="flex:1;display:flex;flex-direction:column;gap:6px;">${t("64px")}${Y("75%")}${Y("40%", W)}</div>`;
|
|
571
571
|
switch (e) {
|
|
572
572
|
case "product": return `${J("Product")}<div style="display:flex;flex-direction:column;gap:8px;">${t()}<div style="font-weight:600;font-size:14px;color:${K};">Sample Product Name</div><div style="font-size:13px;color:${q};">$29.99</div><div style="background:${K};color:#fff;text-align:center;padding:8px;border-radius:6px;font-size:13px;font-weight:600;">Add to Cart</div></div>`;
|
|
@@ -592,9 +592,9 @@ function te(e) {
|
|
|
592
592
|
default: return "";
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
var
|
|
595
|
+
var re = (e) => {
|
|
596
596
|
if (!e || typeof e != "object") return "";
|
|
597
|
-
let t = e.kind || "text", n =
|
|
597
|
+
let t = e.kind || "text", n = B(e.name || e.id || "field"), r = e.required ? " required" : "", i = P({
|
|
598
598
|
fontSize: e.fontSize || "13px",
|
|
599
599
|
borderRadius: e.borderRadius || "12px",
|
|
600
600
|
borderWidth: e.borderWidth || "1px",
|
|
@@ -602,14 +602,14 @@ var ne = (e) => {
|
|
|
602
602
|
borderStyle: "solid",
|
|
603
603
|
color: e.inputTextColor
|
|
604
604
|
}), 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>`;
|
|
605
|
-
return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${
|
|
605
|
+
return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${B(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="${B(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 : [{
|
|
606
606
|
label: e.label || "Option",
|
|
607
607
|
value: e.name || "option"
|
|
608
|
-
}]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${
|
|
608
|
+
}]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${B(r?.value ?? "")}" />${r?.label ?? r?.value ?? ""}</label>`).join("")}</div>` : `${a}<input type="${B(t)}" name="${n}" placeholder="${B(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r} />`;
|
|
609
609
|
};
|
|
610
|
-
function
|
|
610
|
+
function ie(e, t, n) {
|
|
611
611
|
if (e === "none") return "";
|
|
612
|
-
let r =
|
|
612
|
+
let r = B(t);
|
|
613
613
|
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>`;
|
|
614
614
|
}
|
|
615
615
|
function X(e, t, n, r, i = []) {
|
|
@@ -641,19 +641,19 @@ function X(e, t, n, r, i = []) {
|
|
|
641
641
|
color: t.contentTextColor || "#475569",
|
|
642
642
|
fontSize: t.contentFontSize || "13px",
|
|
643
643
|
whiteSpace: "pre-wrap"
|
|
644
|
-
}), p =
|
|
645
|
-
return `<div class="plexo-acc-item" style="${l}"><button type="button"${` data-plexo-acc-item="${
|
|
644
|
+
}), p = ie(n.iconStyle, t.iconColor || "#64748b", !!a.defaultOpen), m = B(a.title), h = B(a.content), g = a.children.length ? `<div class="plexo-acc-group" style="margin-top: 10px;">${X(a.children, t, n, r, s)}</div>` : "";
|
|
645
|
+
return `<div class="plexo-acc-item" style="${l}"><button type="button"${` data-plexo-acc-item="${B(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>`;
|
|
646
646
|
}).join("");
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function ae(e) {
|
|
649
649
|
return `<!-- Unsupported block ${String(e)} -->`;
|
|
650
650
|
}
|
|
651
|
-
var
|
|
651
|
+
var oe = (g, _ = !1) => {
|
|
652
652
|
if (!g || typeof g != "object") return "";
|
|
653
653
|
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 = P(g.type === "form_container" ? {
|
|
654
|
-
...
|
|
654
|
+
...z(),
|
|
655
655
|
...v
|
|
656
|
-
} : x), C = g.attributes || {}, w = ` data-plexo-id="${
|
|
656
|
+
} : x), C = g.attributes || {}, w = ` data-plexo-id="${B(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; " : ""}`;
|
|
657
657
|
switch (g.type) {
|
|
658
658
|
case "heading": return D(`<h2${w} style="margin-top: 0; margin-bottom: 8px; ${O}${S}">${C.text || "Heading"}</h2>`);
|
|
659
659
|
case "paragraph": return D(`<p${w} style="margin-top: 0; margin-bottom: 12px; ${O}${S}">${C.text || "Paragraph text content."}</p>`);
|
|
@@ -664,7 +664,7 @@ var ae = (g, _ = !1) => {
|
|
|
664
664
|
width: e.width,
|
|
665
665
|
height: e.height
|
|
666
666
|
});
|
|
667
|
-
return `<div data-plexo-id="${
|
|
667
|
+
return `<div data-plexo-id="${B(String(g.id))}-align" style="text-align: ${v.textAlign || "center"};"><a${w} href="${C.href || "#"}" target="${C.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; box-sizing: border-box; ${t}">${C.text || "Button"}</a></div>`;
|
|
668
668
|
}
|
|
669
669
|
case "image": {
|
|
670
670
|
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 = P({
|
|
@@ -682,19 +682,19 @@ var ae = (g, _ = !1) => {
|
|
|
682
682
|
</div>`;
|
|
683
683
|
case "form_container": {
|
|
684
684
|
if (C.provider === "maildrip" && typeof C.maildripPageId == "string" && C.maildripPageId.trim()) {
|
|
685
|
-
let e =
|
|
685
|
+
let e = B(C.maildripPageId.trim());
|
|
686
686
|
return `<div${w} style="${P({
|
|
687
687
|
...v,
|
|
688
688
|
height: p(g)
|
|
689
689
|
})}"><opt-in-embed-form page-id="${e}"></opt-in-embed-form></div>`;
|
|
690
690
|
}
|
|
691
691
|
let n = {
|
|
692
|
-
...
|
|
692
|
+
...z(),
|
|
693
693
|
...v
|
|
694
694
|
}, r = {};
|
|
695
695
|
for (let e of Object.keys(n)) U.includes(e) || (r[e] = n[e]);
|
|
696
696
|
r.height = p(g);
|
|
697
|
-
let i = P(r), a = l(t(Array.isArray(C.fields) ? C.fields : [])), o = n.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${
|
|
697
|
+
let i = P(r), a = l(t(Array.isArray(C.fields) ? C.fields : [])), o = n.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${re(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 = P({
|
|
698
698
|
backgroundColor: n.buttonBackgroundColor,
|
|
699
699
|
color: n.buttonTextColor,
|
|
700
700
|
borderRadius: n.buttonBorderRadius,
|
|
@@ -710,15 +710,15 @@ var ae = (g, _ = !1) => {
|
|
|
710
710
|
fontWeight: n.buttonFontWeight,
|
|
711
711
|
width: c,
|
|
712
712
|
height: d
|
|
713
|
-
});
|
|
714
|
-
return `<form${w} action="${
|
|
713
|
+
}), m = B(C.actionUrl || C.action || "#"), h = B(C.method || "POST"), _ = C.submitLabel || "Submit";
|
|
714
|
+
return `<form${w} action="${m}" method="${h}" style="${i}">${s}${`<div style="opacity: 0; height: 0; width: 0; overflow: hidden;"><label>Leave this field blank</label><input type="text" name="${H}" tabindex="-1" autocomplete="off" /></div>`}<div style="display: flex; width: 100%; justify-content: ${u};"><button type="submit" style="border: 0; cursor: pointer; ${f}">${_}</button></div></form>`;
|
|
715
715
|
}
|
|
716
716
|
case "input": {
|
|
717
|
-
let e = C.inputType || C.type || "text", t =
|
|
718
|
-
return `<input${w} type="${
|
|
717
|
+
let e = C.inputType || C.type || "text", t = B(C.name || C.fieldName || "field"), n = B(C.placeholder || ""), r = C.required ? " required" : "";
|
|
718
|
+
return `<input${w} type="${B(e)}" name="${t}" placeholder="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${r} />`;
|
|
719
719
|
}
|
|
720
|
-
case "textarea": return `<textarea${w} name="${
|
|
721
|
-
case "select": return `<select${w} name="${
|
|
720
|
+
case "textarea": return `<textarea${w} name="${B(C.name || C.fieldName || "field")}" placeholder="${B(C.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${S}"${C.required ? " required" : ""}></textarea>`;
|
|
721
|
+
case "select": return `<select${w} name="${B(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="${B(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
|
|
722
722
|
case "html": return `<div${w} style="${P({
|
|
723
723
|
...v,
|
|
724
724
|
height: s(g, "auto")
|
|
@@ -732,7 +732,7 @@ var ae = (g, _ = !1) => {
|
|
|
732
732
|
case "blog_comments":
|
|
733
733
|
case "blog_post_list": {
|
|
734
734
|
let e = g.type.replace(/^blog_/, "").replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t = P(v);
|
|
735
|
-
return `<div${w} data-plexo-blog-${e}="true"${
|
|
735
|
+
return `<div${w} data-plexo-blog-${e}="true"${V("data-plexo-blog-prefix", C.prefix)} style="${t}"></div>`;
|
|
736
736
|
}
|
|
737
737
|
case "product":
|
|
738
738
|
case "booking":
|
|
@@ -742,7 +742,7 @@ var ae = (g, _ = !1) => {
|
|
|
742
742
|
case "order_confirmation":
|
|
743
743
|
case "order_tracking": {
|
|
744
744
|
let e = g.type.replace(/_([a-z])/g, (e, t) => t.toUpperCase()), t = P(v);
|
|
745
|
-
return `<div${w} data-plexo-commerce-${e}="true"${
|
|
745
|
+
return `<div${w} data-plexo-commerce-${e}="true"${V("data-plexo-product-id", C.productId)}${V("data-plexo-service-id", C.serviceId)}${V("data-plexo-commerce-mode", C.mode)}${C.storeMode === !1 ? " data-plexo-commerce-store-mode=\"false\"" : ""}${V("data-plexo-commerce-limit", C.limit)}${V("data-plexo-commerce-category", C.category)}${V("data-plexo-commerce-sort", C.sort)}${V("data-plexo-commerce-items-per-row", C.itemsPerRow)}${V("data-plexo-commerce-items-per-page", C.itemsPerPage)}${C.paginated ? " data-plexo-commerce-paginated=\"true\"" : ""} style="${t}">${_ ? `<div style="padding: 12px; box-sizing: border-box; height: 100%;">${ne(g.type)}</div>` : ""}</div>`;
|
|
746
746
|
}
|
|
747
747
|
case "social": {
|
|
748
748
|
let e = r(g), t = v.textAlign === "center" ? "center" : v.textAlign === "right" ? "flex-end" : "flex-start";
|
|
@@ -766,7 +766,7 @@ var ae = (g, _ = !1) => {
|
|
|
766
766
|
justifyContent: "center",
|
|
767
767
|
overflow: "hidden"
|
|
768
768
|
});
|
|
769
|
-
return `<a href="${
|
|
769
|
+
return `<a href="${B(e.url)}" style="${t} text-decoration: none;">${f(e.provider, e.color)}</a>`;
|
|
770
770
|
}).join("")}</div>`;
|
|
771
771
|
}
|
|
772
772
|
case "menu": {
|
|
@@ -777,7 +777,7 @@ var ae = (g, _ = !1) => {
|
|
|
777
777
|
flexWrap: "wrap",
|
|
778
778
|
gap: "16px",
|
|
779
779
|
justifyContent: t
|
|
780
|
-
})}">${e.map((e) => `<a href="${
|
|
780
|
+
})}">${e.map((e) => `<a href="${B(e.href)}" style="text-decoration: none; color: inherit; font-weight: ${v.fontWeight || 600};">${B(e.label)}</a>`).join("")}</div>`;
|
|
781
781
|
}
|
|
782
782
|
case "icon": {
|
|
783
783
|
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 = P({
|
|
@@ -785,8 +785,8 @@ var ae = (g, _ = !1) => {
|
|
|
785
785
|
margin: v.margin,
|
|
786
786
|
display: "flex",
|
|
787
787
|
justifyContent: i
|
|
788
|
-
}), o = typeof C.href == "string" ? C.href.trim() : "", s = `<span style="display: inline-flex; align-items: center; justify-content: center; color: ${t};">${r}</span>`, c = o ? `<a${w} href="${
|
|
789
|
-
return `<div data-plexo-id="${
|
|
788
|
+
}), o = typeof C.href == "string" ? C.href.trim() : "", s = `<span style="display: inline-flex; align-items: center; justify-content: center; color: ${t};">${r}</span>`, c = o ? `<a${w} href="${B(o)}" target="${C.openInNewTab ? "_blank" : "_self"}" style="text-decoration: none;">${s}</a>` : `<span${w}>${s}</span>`;
|
|
789
|
+
return `<div data-plexo-id="${B(String(g.id))}-align" style="${a}">${c}</div>`;
|
|
790
790
|
}
|
|
791
791
|
case "table": {
|
|
792
792
|
let e = d(g), t = `${v.borderWidth || "1px"} ${v.borderStyle || "solid"} ${v.borderColor || "#cbd5e1"}`, n = (n, r, i, a) => {
|
|
@@ -801,7 +801,7 @@ var ae = (g, _ = !1) => {
|
|
|
801
801
|
lineHeight: v.contentLineHeight,
|
|
802
802
|
letterSpacing: v.contentLetterSpacing,
|
|
803
803
|
fontWeight: a ? "700" : void 0
|
|
804
|
-
}), u = ` data-plexo-cell="${
|
|
804
|
+
}), u = ` data-plexo-cell="${B(g.id)}|${i}-${n}"`;
|
|
805
805
|
return `<${o}${u} style="${r}">${e || " "}</${o}>`;
|
|
806
806
|
}).join("")}</tr>`;
|
|
807
807
|
}, 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 = P({
|
|
@@ -821,7 +821,7 @@ var ae = (g, _ = !1) => {
|
|
|
821
821
|
margin: v.margin,
|
|
822
822
|
borderRadius: v.borderRadius,
|
|
823
823
|
overflow: "hidden"
|
|
824
|
-
})}"><a href="${
|
|
824
|
+
})}"><a href="${B(t)}" target="${B(n)}" style="position: relative; display: block; text-decoration: none;"><img src="${B(e.thumbnailUrl)}" alt="${B(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>`;
|
|
825
825
|
}
|
|
826
826
|
case "timer": {
|
|
827
827
|
let e = C.showLabels !== !1, t = P({
|
|
@@ -838,7 +838,7 @@ var ae = (g, _ = !1) => {
|
|
|
838
838
|
borderRadius: v.borderRadius || "8px",
|
|
839
839
|
padding: v.padding || "16px",
|
|
840
840
|
textAlign: "center"
|
|
841
|
-
}), 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 =
|
|
841
|
+
}), 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 = B(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>`;
|
|
842
842
|
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>`;
|
|
843
843
|
}
|
|
844
844
|
case "carousel": {
|
|
@@ -854,7 +854,7 @@ var ae = (g, _ = !1) => {
|
|
|
854
854
|
if (e.length === 0) return `<div${w} style="${n}"><div style="padding: 40px; text-align: center; color: #94a3b8;">No images in carousel</div></div>`;
|
|
855
855
|
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) => {
|
|
856
856
|
let o = i[r] * 5, s = e.length > 1 ? ` animation: ${t}-fade ${a}s ease-in-out infinite; animation-delay: ${o}s;` : "";
|
|
857
|
-
return `<div data-slide-idx="${r}" style="opacity: ${e.length > 1 ? "0" : "1"};${s}"><img src="${
|
|
857
|
+
return `<div data-slide-idx="${r}" style="opacity: ${e.length > 1 ? "0" : "1"};${s}"><img src="${B(n.src)}" alt="${B(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;">${B(n.caption)}</div>` : ""}</div>`;
|
|
858
858
|
}).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) => {
|
|
859
859
|
let r = i[n] * 5;
|
|
860
860
|
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>`;
|
|
@@ -875,7 +875,7 @@ var ae = (g, _ = !1) => {
|
|
|
875
875
|
animated: a
|
|
876
876
|
}, 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>`;
|
|
877
877
|
}
|
|
878
|
-
default: return
|
|
878
|
+
default: return ae(g.type);
|
|
879
879
|
}
|
|
880
880
|
}, Z = (e, t, n) => {
|
|
881
881
|
if (!e || typeof e != "object") return "";
|
|
@@ -883,15 +883,15 @@ var ae = (g, _ = !1) => {
|
|
|
883
883
|
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. -->`;
|
|
884
884
|
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?.gap, c = typeof s == "number" ? `${s}px` : typeof s == "string" ? s.trim() : "", l = c !== "" && c !== "0" && c !== "0px", u = { ...r.style || {} };
|
|
885
885
|
delete u.columnGap;
|
|
886
|
-
let d = P(u), f =
|
|
887
|
-
|
|
886
|
+
let d = P(u), f = V("id", r.htmlId), p = V("class", r.htmlClass), m = r.id || `row-${Math.random().toString(36).substring(2, 9)}`;
|
|
887
|
+
I(t, m, r.style, "tablet", r.styleTablet), I(t, m, r.style, "mobile", r.styleMobile), (o || l) && t.mobile.push(`[data-plexo-id="${m}"] > .plexo-col { margin-bottom: 0; }`);
|
|
888
888
|
let h = `\n <!-- ROW START: ${r.id || "row"} -->`, _ = o ? `gap: ${a}; margin-left: 0; margin-right: 0;` : "margin-left: -8px; margin-right: -8px;";
|
|
889
889
|
h += `\n <div data-plexo-id="${m}"${f}${p} class="plexo-row" style="display: flex; flex-wrap: wrap; ${_} ${d}">`;
|
|
890
890
|
let v = Array.isArray(r.columns) ? r.columns : [], y = o && v.length > 1 ? `(${a} * ${v.length - 1} / ${v.length})` : "";
|
|
891
891
|
for (let e of v) {
|
|
892
892
|
if (!e) continue;
|
|
893
|
-
let r = e.styles || e.style || {}, i = P(r), a = r.gap || "16px", s =
|
|
894
|
-
|
|
893
|
+
let r = e.styles || e.style || {}, i = P(r), a = r.gap || "16px", s = V("id", e.attrs?.htmlId), c = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", l = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
|
|
894
|
+
I(t, l, r, "tablet", e.stylesTablet), I(t, l, r, "mobile", e.stylesMobile);
|
|
895
895
|
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; " : "", p = e.width || "100%", m = typeof p == "string" && /^\s*\d+(\.\d+)?\s*%\s*$/.test(p), _ = o && m && y ? `calc(${p.trim()} - ${y})` : p, v = o ? "padding-left: 0; padding-right: 0;" : "padding-left: 8px; padding-right: 8px;";
|
|
896
896
|
h += `\n <!-- COLUMN START: ${e.id || "col"} -->`, h += `\n <div data-plexo-id="${l}"${s} class="plexo-col${c}" style="box-sizing: border-box; ${v} width: ${_}; --plexo-col-gap: ${a}; ${f}${i}">`;
|
|
897
897
|
let b = new Map(u.map((e) => [e.id, e])), x = new Map(d.map((e) => [e.id, e])), S = g({
|
|
@@ -902,8 +902,8 @@ var ae = (g, _ = !1) => {
|
|
|
902
902
|
for (let e of S) {
|
|
903
903
|
let r = b.get(e);
|
|
904
904
|
if (r) {
|
|
905
|
-
let i = r.attributes || {}, o = typeof i.htmlClassNames == "string" ? i.htmlClassNames : typeof i.htmlClass == "string" ? i.htmlClass : typeof i.className == "string" ? i.className : "", s =
|
|
906
|
-
|
|
905
|
+
let i = r.attributes || {}, o = typeof i.htmlClassNames == "string" ? i.htmlClassNames : typeof i.htmlClass == "string" ? i.htmlClass : typeof i.className == "string" ? i.className : "", s = V("id", i.htmlId), c = V("class", o), l = r.style?.display, u = l === "inline-block" || l === "inline" || l === "inline-flex", d = e === C ? "" : `margin-bottom: ${a};`, f = u ? `${d}${d ? " " : ""}display: ${l}; vertical-align: top;` : d;
|
|
906
|
+
I(t, r.id, r.style, "tablet", L(r, r.styleTablet)), I(t, r.id, r.style, "mobile", L(r, r.styleMobile)), R(t, r, "tablet", r.styleTablet), R(t, r, "mobile", r.styleMobile), h += `\n <div${s}${c} style="${f}">`, h += `\n ${oe(r, n)}`, h += "\n </div>";
|
|
907
907
|
continue;
|
|
908
908
|
}
|
|
909
909
|
let i = x.get(e);
|
|
@@ -913,7 +913,7 @@ var ae = (g, _ = !1) => {
|
|
|
913
913
|
}
|
|
914
914
|
return h += "\n </div>", h;
|
|
915
915
|
};
|
|
916
|
-
function
|
|
916
|
+
function se(e) {
|
|
917
917
|
let t = /* @__PURE__ */ new Set(), n = 0, r = (e) => {
|
|
918
918
|
let r;
|
|
919
919
|
do
|
|
@@ -980,7 +980,7 @@ var Q = (e, t) => {
|
|
|
980
980
|
"ogImageUrl"
|
|
981
981
|
], s = {};
|
|
982
982
|
for (let e of Object.keys(a)) o.includes(e) || (s[e] = a[e]);
|
|
983
|
-
let c = P(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 =
|
|
983
|
+
let c = P(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 = V("id", a.htmlId), d = V("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() : "", v = typeof a.contentMaxWidth == "string" && a.contentMaxWidth.trim() ? a.contentMaxWidth.trim() : "1200px", y = se(Array.isArray(i.rows) ? i.rows : Array.isArray(r.rows) ? r.rows : Array.isArray(e.rows) ? e.rows : []), b = N(M(y, [a.fontFamily])), x = {
|
|
984
984
|
tablet: [],
|
|
985
985
|
mobile: []
|
|
986
986
|
}, S = "";
|
|
@@ -989,17 +989,17 @@ var Q = (e, t) => {
|
|
|
989
989
|
<html>
|
|
990
990
|
<head>
|
|
991
991
|
<meta charset="utf-8">
|
|
992
|
-
<title>${
|
|
993
|
-
${h ? `<meta name="description" content="${
|
|
994
|
-
${m ? `<link rel="icon" href="${
|
|
992
|
+
<title>${B(l)}</title>
|
|
993
|
+
${h ? `<meta name="description" content="${B(h)}">` : ""}
|
|
994
|
+
${m ? `<link rel="icon" href="${B(m)}">` : ""}
|
|
995
995
|
<meta property="og:type" content="website">
|
|
996
|
-
<meta property="og:title" content="${
|
|
997
|
-
${h ? `<meta property="og:description" content="${
|
|
998
|
-
${g ? `<meta property="og:image" content="${
|
|
996
|
+
<meta property="og:title" content="${B(l)}">
|
|
997
|
+
${h ? `<meta property="og:description" content="${B(h)}">` : ""}
|
|
998
|
+
${g ? `<meta property="og:image" content="${B(g)}">` : ""}
|
|
999
999
|
<meta name="twitter:card" content="${g ? "summary_large_image" : "summary"}">
|
|
1000
|
-
<meta name="twitter:title" content="${
|
|
1001
|
-
${h ? `<meta name="twitter:description" content="${
|
|
1002
|
-
${g ? `<meta name="twitter:image" content="${
|
|
1000
|
+
<meta name="twitter:title" content="${B(l)}">
|
|
1001
|
+
${h ? `<meta name="twitter:description" content="${B(h)}">` : ""}
|
|
1002
|
+
${g ? `<meta name="twitter:image" content="${B(g)}">` : ""}
|
|
1003
1003
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1004
1004
|
${b ? `<link rel="stylesheet" href="${b}">` : ""}
|
|
1005
1005
|
${S.includes("<opt-in-embed-form") ? `<script type="module" src="${_}"><\/script>` : ""}
|
|
@@ -1067,14 +1067,14 @@ ${p ? ` <script>\n${p}\n <\/script>` : ""}
|
|
|
1067
1067
|
function $(e) {
|
|
1068
1068
|
return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function ce(e) {
|
|
1071
1071
|
return $(Q(e));
|
|
1072
1072
|
}
|
|
1073
|
-
function
|
|
1073
|
+
function le(e) {
|
|
1074
1074
|
return Q(e);
|
|
1075
1075
|
}
|
|
1076
|
-
function
|
|
1076
|
+
function ue(e) {
|
|
1077
1077
|
return e;
|
|
1078
1078
|
}
|
|
1079
1079
|
//#endregion
|
|
1080
|
-
export {
|
|
1080
|
+
export { Q as a, j as c, $ as d, ue as f, I as i, z as l, H as n, le as o, k as p, U as r, ce as s, A as t, F as u };
|
package/dist/compiler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n,
|
|
2
|
-
export {
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./compiler-BvseEhDC.js";
|
|
2
|
+
export { u as DEFAULT_BODY_FONT_FAMILY, o as FORM_HONEYPOT_FIELD_NAME, c as FORM_NON_CSS_STYLE_KEYS, i as collectResponsiveRule, e as compileToHTML, s as compileToHTMLWithStrataAuto, l as compileToPlainText, t as convertSectionRowToPlexoRow, a as getFormDefaultStyle, d as getInlineStylesImportant, n as htmlToPlainText, r as injectStrataBundle };
|