@charisol/plexo-sdk 1.0.41 → 1.0.43
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-DDrxFhGt.js → compiler-BEQo1civ.js} +155 -143
- package/dist/compiler.js +1 -1
- package/dist/compilerClient.js +16 -16
- package/dist/components/editor/dnd/DragOverContext.d.ts +14 -0
- package/dist/{iconSvgStatic-DOyb-nIf.js → iconSvgStatic-DubpApuZ.js} +62 -46
- package/dist/index.js +14149 -14109
- package/dist/utilities/dndCollision.d.ts +18 -0
- package/dist/utilities/elementResolvers.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e,
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, m as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./iconSvgStatic-DubpApuZ.js";
|
|
2
2
|
//#region src/utilities/playground.constants.ts
|
|
3
|
-
var
|
|
3
|
+
var p = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, m = [
|
|
4
4
|
{
|
|
5
5
|
id: "all",
|
|
6
6
|
label: "All sources"
|
|
@@ -17,7 +17,7 @@ var f = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, p
|
|
|
17
17
|
id: "pixabay",
|
|
18
18
|
label: "Pixabay"
|
|
19
19
|
}
|
|
20
|
-
],
|
|
20
|
+
], h = [
|
|
21
21
|
{
|
|
22
22
|
id: "surface-book",
|
|
23
23
|
label: "Surface Book",
|
|
@@ -84,7 +84,7 @@ var f = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, p
|
|
|
84
84
|
width: 375,
|
|
85
85
|
category: "mobile"
|
|
86
86
|
}
|
|
87
|
-
],
|
|
87
|
+
], g = 1280, _ = [
|
|
88
88
|
{
|
|
89
89
|
id: "facebook",
|
|
90
90
|
label: "Facebook"
|
|
@@ -117,7 +117,7 @@ var f = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, p
|
|
|
117
117
|
id: "tiktok",
|
|
118
118
|
label: "TikTok"
|
|
119
119
|
}
|
|
120
|
-
],
|
|
120
|
+
], v = [
|
|
121
121
|
{
|
|
122
122
|
label: "Text",
|
|
123
123
|
value: "text"
|
|
@@ -150,7 +150,7 @@ var f = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, p
|
|
|
150
150
|
label: "Checkbox",
|
|
151
151
|
value: "checkbox"
|
|
152
152
|
}
|
|
153
|
-
],
|
|
153
|
+
], y = [
|
|
154
154
|
{
|
|
155
155
|
label: "1 Column",
|
|
156
156
|
widths: ["100%"],
|
|
@@ -199,7 +199,7 @@ var f = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, p
|
|
|
199
199
|
"25%"
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
|
-
],
|
|
202
|
+
], b = [
|
|
203
203
|
{
|
|
204
204
|
label: "Roboto",
|
|
205
205
|
value: "'Roboto', sans-serif",
|
|
@@ -600,8 +600,8 @@ var f = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, p
|
|
|
600
600
|
value: "'Great Vibes', cursive",
|
|
601
601
|
style: "handwriting"
|
|
602
602
|
}
|
|
603
|
-
],
|
|
604
|
-
function
|
|
603
|
+
], x = new Map(b.map((e) => [e.value, e.label]));
|
|
604
|
+
function S(e, t = []) {
|
|
605
605
|
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
606
606
|
if (!e) return;
|
|
607
607
|
let t = Array.isArray(e.columns) ? e.columns : [];
|
|
@@ -619,17 +619,17 @@ function x(e, t = []) {
|
|
|
619
619
|
for (let e of t) typeof e == "string" && e.trim() && n.add(e.trim());
|
|
620
620
|
return n;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function C(e) {
|
|
623
623
|
let t = /* @__PURE__ */ new Set();
|
|
624
624
|
for (let n of e) {
|
|
625
|
-
let e =
|
|
625
|
+
let e = x.get(n);
|
|
626
626
|
e && t.add(e);
|
|
627
627
|
}
|
|
628
628
|
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`;
|
|
629
629
|
}
|
|
630
630
|
//#endregion
|
|
631
631
|
//#region src/utilities/responsiveDefaults.ts
|
|
632
|
-
var
|
|
632
|
+
var w = {
|
|
633
633
|
tablet: {
|
|
634
634
|
thresholdPx: 24,
|
|
635
635
|
scale: .85,
|
|
@@ -640,7 +640,7 @@ var C = {
|
|
|
640
640
|
scale: .7,
|
|
641
641
|
floorPx: 14
|
|
642
642
|
}
|
|
643
|
-
},
|
|
643
|
+
}, T = {
|
|
644
644
|
tablet: {
|
|
645
645
|
thresholdPx: 320,
|
|
646
646
|
scale: .8,
|
|
@@ -651,7 +651,7 @@ var C = {
|
|
|
651
651
|
scale: .55,
|
|
652
652
|
floorPx: 140
|
|
653
653
|
}
|
|
654
|
-
},
|
|
654
|
+
}, E = {
|
|
655
655
|
tablet: {
|
|
656
656
|
thresholdPx: 48,
|
|
657
657
|
scale: .75,
|
|
@@ -662,7 +662,7 @@ var C = {
|
|
|
662
662
|
scale: .55,
|
|
663
663
|
floorPx: 16
|
|
664
664
|
}
|
|
665
|
-
},
|
|
665
|
+
}, D = {
|
|
666
666
|
tablet: {
|
|
667
667
|
thresholdPx: 500,
|
|
668
668
|
scale: 1,
|
|
@@ -673,11 +673,11 @@ var C = {
|
|
|
673
673
|
scale: 1,
|
|
674
674
|
floorPx: 0
|
|
675
675
|
}
|
|
676
|
-
},
|
|
676
|
+
}, O = ["fontSize"], k = [
|
|
677
677
|
"height",
|
|
678
678
|
"minHeight",
|
|
679
679
|
"maxHeight"
|
|
680
|
-
],
|
|
680
|
+
], A = [
|
|
681
681
|
"padding",
|
|
682
682
|
"paddingTop",
|
|
683
683
|
"paddingBottom",
|
|
@@ -686,8 +686,8 @@ var C = {
|
|
|
686
686
|
"margin",
|
|
687
687
|
"marginTop",
|
|
688
688
|
"marginBottom"
|
|
689
|
-
],
|
|
690
|
-
function
|
|
689
|
+
], j = ["width", "maxWidth"];
|
|
690
|
+
function M(e) {
|
|
691
691
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
692
692
|
if (typeof e != "string") return null;
|
|
693
693
|
let t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/);
|
|
@@ -695,48 +695,48 @@ function j(e) {
|
|
|
695
695
|
let n = parseFloat(t[1]);
|
|
696
696
|
return Number.isFinite(n) ? n : null;
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function N(e, t) {
|
|
699
699
|
return e < t.thresholdPx ? null : Math.max(Math.round(e * t.scale), t.floorPx);
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function P(e, t) {
|
|
702
702
|
if (!e || typeof e != "object") return {};
|
|
703
703
|
let n = {};
|
|
704
|
-
for (let r of D) {
|
|
705
|
-
let i = j(e[r]);
|
|
706
|
-
if (i === null) continue;
|
|
707
|
-
let a = M(i, C[t]);
|
|
708
|
-
a !== null && (n[r] = `${a}px`);
|
|
709
|
-
}
|
|
710
704
|
for (let r of O) {
|
|
711
|
-
let i =
|
|
705
|
+
let i = M(e[r]);
|
|
712
706
|
if (i === null) continue;
|
|
713
|
-
let a =
|
|
707
|
+
let a = N(i, w[t]);
|
|
714
708
|
a !== null && (n[r] = `${a}px`);
|
|
715
709
|
}
|
|
716
710
|
for (let r of k) {
|
|
717
|
-
let i =
|
|
711
|
+
let i = M(e[r]);
|
|
718
712
|
if (i === null) continue;
|
|
719
|
-
let a =
|
|
713
|
+
let a = N(i, T[t]);
|
|
720
714
|
a !== null && (n[r] = `${a}px`);
|
|
721
715
|
}
|
|
722
716
|
for (let r of A) {
|
|
723
|
-
let i =
|
|
724
|
-
i
|
|
717
|
+
let i = M(e[r]);
|
|
718
|
+
if (i === null) continue;
|
|
719
|
+
let a = N(i, E[t]);
|
|
720
|
+
a !== null && (n[r] = `${a}px`);
|
|
721
|
+
}
|
|
722
|
+
for (let r of j) {
|
|
723
|
+
let i = M(e[r]);
|
|
724
|
+
i !== null && i >= D[t].thresholdPx && (n[r] = "100%");
|
|
725
725
|
}
|
|
726
726
|
return n;
|
|
727
727
|
}
|
|
728
|
-
function
|
|
728
|
+
function F(e, t, n) {
|
|
729
729
|
let r = e || {};
|
|
730
730
|
return n ? {
|
|
731
731
|
...r,
|
|
732
|
-
...
|
|
732
|
+
...P(r, n),
|
|
733
733
|
...t || {}
|
|
734
734
|
} : r;
|
|
735
735
|
}
|
|
736
736
|
//#endregion
|
|
737
737
|
//#region src/utilities/compiler.ts
|
|
738
|
-
var
|
|
739
|
-
switch (
|
|
738
|
+
var I = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", L = (e) => e === "twitter" ? "x" : e, ee = (e, t = "currentColor") => {
|
|
739
|
+
switch (L(e)) {
|
|
740
740
|
case "facebook": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${t}" d="M14 8h2V4h-2c-2.2 0-4 1.8-4 4v2H8v4h2v6h4v-6h2.5l.5-4H14V8c0-.55.45-1 1-1Z"/></svg>`;
|
|
741
741
|
case "instagram": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><rect x="4" y="4" width="16" height="16" rx="5" ry="5" fill="none" stroke="${t}" stroke-width="2"/><circle cx="12" cy="12" r="3.5" fill="none" stroke="${t}" stroke-width="2"/><circle cx="17" cy="7" r="1" fill="${t}"/></svg>`;
|
|
742
742
|
case "linkedin": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><circle cx="8" cy="9" r="1.25" fill="${t}"/><path fill="${t}" d="M7 11h2v6H7zM11 11h2v.9c.5-.7 1.34-1.15 2.4-1.15 2 0 3.1 1.25 3.1 3.6V17h-2v-2.2c0-1.3-.45-2.05-1.55-2.05-1.2 0-1.85.8-1.85 2.05V17h-2z"/></svg>`;
|
|
@@ -1021,7 +1021,7 @@ function V(e) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
function H(e, t, n, r, i) {
|
|
1023
1023
|
let a = {
|
|
1024
|
-
...
|
|
1024
|
+
...P(n, r),
|
|
1025
1025
|
...i || {}
|
|
1026
1026
|
};
|
|
1027
1027
|
for (let e of Object.keys(a)) V(a[e]) && delete a[e];
|
|
@@ -1063,13 +1063,20 @@ var U = () => ({
|
|
|
1063
1063
|
"buttonBackgroundColor",
|
|
1064
1064
|
"buttonTextColor",
|
|
1065
1065
|
"buttonBorderRadius",
|
|
1066
|
+
"buttonPadding",
|
|
1066
1067
|
"buttonPaddingTop",
|
|
1067
1068
|
"buttonPaddingBottom",
|
|
1068
1069
|
"buttonPaddingLeft",
|
|
1069
1070
|
"buttonPaddingRight",
|
|
1071
|
+
"buttonMargin",
|
|
1072
|
+
"buttonMarginTop",
|
|
1073
|
+
"buttonMarginBottom",
|
|
1074
|
+
"buttonMarginLeft",
|
|
1075
|
+
"buttonMarginRight",
|
|
1070
1076
|
"buttonFontSize",
|
|
1071
1077
|
"buttonFontWeight",
|
|
1072
1078
|
"buttonWidth",
|
|
1079
|
+
"buttonHeight",
|
|
1073
1080
|
"buttonAlign"
|
|
1074
1081
|
], q = (e) => {
|
|
1075
1082
|
if (!e || typeof e != "object") return "";
|
|
@@ -1127,77 +1134,82 @@ function Y(e, t, n) {
|
|
|
1127
1134
|
function X(e) {
|
|
1128
1135
|
return `<!-- Unsupported block ${String(e)} -->`;
|
|
1129
1136
|
}
|
|
1130
|
-
var Z = (
|
|
1131
|
-
if (!
|
|
1132
|
-
let
|
|
1137
|
+
var Z = (p) => {
|
|
1138
|
+
if (!p || typeof p != "object") return "";
|
|
1139
|
+
let m = p.style || {}, h = z(p.type === "form_container" ? {
|
|
1133
1140
|
...U(),
|
|
1134
|
-
...
|
|
1135
|
-
} :
|
|
1136
|
-
switch (
|
|
1137
|
-
case "heading": return `<h2${
|
|
1138
|
-
case "paragraph": return `<p${
|
|
1139
|
-
case "text": return `<div${
|
|
1141
|
+
...m
|
|
1142
|
+
} : m), g = p.attributes || {}, _ = ` data-plexo-id="${W(p.id)}"`;
|
|
1143
|
+
switch (p.type) {
|
|
1144
|
+
case "heading": return `<h2${_} style="margin-top: 0; margin-bottom: 8px; ${h}">${g.text || "Heading"}</h2>`;
|
|
1145
|
+
case "paragraph": return `<p${_} style="margin-top: 0; margin-bottom: 12px; ${h}">${g.text || "Paragraph text content."}</p>`;
|
|
1146
|
+
case "text": return `<div${_} style="${h}">${g.text || ""}</div>`;
|
|
1140
1147
|
case "button": {
|
|
1141
|
-
let e =
|
|
1142
|
-
...
|
|
1148
|
+
let e = i(p), t = z({
|
|
1149
|
+
...m,
|
|
1143
1150
|
width: e.width,
|
|
1144
1151
|
height: e.height
|
|
1145
1152
|
});
|
|
1146
|
-
return `<div style="text-align: ${
|
|
1153
|
+
return `<div style="text-align: ${m.textAlign || "center"};"><a${_} href="${g.href || "#"}" target="${g.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; ${t}">${g.text || "Button"}</a></div>`;
|
|
1147
1154
|
}
|
|
1148
1155
|
case "image": {
|
|
1149
|
-
let e =
|
|
1150
|
-
...
|
|
1156
|
+
let e = t(p), n = m.textAlign === "center" ? "margin: 0 auto; display: block;" : m.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;", r = z({
|
|
1157
|
+
...m,
|
|
1151
1158
|
width: e.width,
|
|
1152
1159
|
height: e.height
|
|
1153
1160
|
});
|
|
1154
|
-
return `<img${
|
|
1161
|
+
return `<img${_} src="${g.src || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe"}" alt="${g.alt || ""}" style="${r} ${n}" />`;
|
|
1155
1162
|
}
|
|
1156
|
-
case "divider": return `<hr${
|
|
1157
|
-
case "spacer": return `<div${
|
|
1158
|
-
case "card": return `<div${
|
|
1159
|
-
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${
|
|
1160
|
-
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${
|
|
1163
|
+
case "divider": return `<hr${_} style="border: 0; border-top: ${m.borderWidth || "1px"} ${m.borderStyle || "solid"} ${m.borderColor || "#334155"}; ${h}" />`;
|
|
1164
|
+
case "spacer": return `<div${_} style="height: ${m.height || "24px"};"></div>`;
|
|
1165
|
+
case "card": return `<div${_} style="${h}">
|
|
1166
|
+
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${g.title || "Card Title"}</h3>
|
|
1167
|
+
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${g.description || "Card description."}</p>
|
|
1161
1168
|
</div>`;
|
|
1162
1169
|
case "form_container": {
|
|
1163
1170
|
let t = {
|
|
1164
1171
|
...U(),
|
|
1165
|
-
...
|
|
1172
|
+
...m
|
|
1166
1173
|
}, n = {};
|
|
1167
1174
|
for (let e of Object.keys(t)) K.includes(e) || (n[e] = t[e]);
|
|
1168
|
-
n.height =
|
|
1169
|
-
let
|
|
1175
|
+
n.height = e(p);
|
|
1176
|
+
let r = z(n), i = s(Array.isArray(g.fields) ? g.fields : []), a = t.fieldSpacing || "12px", o = i.map((e) => `<div style="margin-bottom: ${a};">${q(e)}</div>`).join(""), c = g.buttonAutoWidth === !1 ? t.buttonWidth || "100%" : "auto", u = t.buttonAlign === "left" ? "flex-start" : t.buttonAlign === "right" ? "flex-end" : "center", d = g.buttonAutoHeight === !1 && t.buttonHeight || "auto", f = z({
|
|
1170
1177
|
backgroundColor: t.buttonBackgroundColor,
|
|
1171
1178
|
color: t.buttonTextColor,
|
|
1172
1179
|
borderRadius: t.buttonBorderRadius,
|
|
1173
|
-
paddingTop: t.buttonPaddingTop,
|
|
1174
|
-
paddingBottom: t.buttonPaddingBottom,
|
|
1175
|
-
paddingLeft: t.buttonPaddingLeft,
|
|
1176
|
-
paddingRight: t.buttonPaddingRight,
|
|
1180
|
+
paddingTop: l(t.buttonPaddingTop, t.buttonPadding, "top", "10px"),
|
|
1181
|
+
paddingBottom: l(t.buttonPaddingBottom, t.buttonPadding, "bottom", "10px"),
|
|
1182
|
+
paddingLeft: l(t.buttonPaddingLeft, t.buttonPadding, "left", "14px"),
|
|
1183
|
+
paddingRight: l(t.buttonPaddingRight, t.buttonPadding, "right", "14px"),
|
|
1184
|
+
marginTop: l(t.buttonMarginTop, t.buttonMargin, "top"),
|
|
1185
|
+
marginBottom: l(t.buttonMarginBottom, t.buttonMargin, "bottom"),
|
|
1186
|
+
marginLeft: l(t.buttonMarginLeft, t.buttonMargin, "left"),
|
|
1187
|
+
marginRight: l(t.buttonMarginRight, t.buttonMargin, "right"),
|
|
1177
1188
|
fontSize: t.buttonFontSize,
|
|
1178
1189
|
fontWeight: t.buttonFontWeight,
|
|
1179
|
-
width: c
|
|
1190
|
+
width: c,
|
|
1191
|
+
height: d
|
|
1180
1192
|
});
|
|
1181
|
-
return `<form${
|
|
1193
|
+
return `<form${_} action="${W(g.actionUrl || g.action || "#")}" method="${W(g.method || "POST")}" style="${r}">${o}<div style="display: flex; width: 100%; justify-content: ${u};"><button type="submit" style="border: 0; cursor: pointer; ${f}">${g.submitLabel || "Submit"}</button></div></form>`;
|
|
1182
1194
|
}
|
|
1183
1195
|
case "input": {
|
|
1184
|
-
let e =
|
|
1185
|
-
return `<input${
|
|
1196
|
+
let e = g.inputType || g.type || "text", t = W(g.name || g.fieldName || "field"), n = W(g.placeholder || ""), r = g.required ? " required" : "";
|
|
1197
|
+
return `<input${_} type="${W(e)}" name="${t}" placeholder="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${h}"${r} />`;
|
|
1186
1198
|
}
|
|
1187
|
-
case "textarea": return `<textarea${
|
|
1188
|
-
case "select": return `<select${
|
|
1189
|
-
case "html": return `<div${
|
|
1190
|
-
...
|
|
1191
|
-
height:
|
|
1192
|
-
})}">${
|
|
1199
|
+
case "textarea": return `<textarea${_} name="${W(g.name || g.fieldName || "field")}" placeholder="${W(g.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${h}"${g.required ? " required" : ""}></textarea>`;
|
|
1200
|
+
case "select": return `<select${_} name="${W(g.name || g.fieldName || "field")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #334155; ${h}"${g.required ? " required" : ""}>${(Array.isArray(g.options) ? g.options : []).map((e) => `<option value="${W(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
|
|
1201
|
+
case "html": return `<div${_} style="${z({
|
|
1202
|
+
...m,
|
|
1203
|
+
height: u(p, "auto")
|
|
1204
|
+
})}">${g.htmlContent || g.text || ""}</div>`;
|
|
1193
1205
|
case "social": {
|
|
1194
|
-
let e =
|
|
1195
|
-
return `<div${
|
|
1196
|
-
padding:
|
|
1197
|
-
margin:
|
|
1206
|
+
let e = n(p), t = m.textAlign === "center" ? "center" : m.textAlign === "right" ? "flex-end" : "flex-start";
|
|
1207
|
+
return `<div${_} style="${z({
|
|
1208
|
+
padding: m.padding,
|
|
1209
|
+
margin: m.margin,
|
|
1198
1210
|
display: "flex",
|
|
1199
1211
|
flexWrap: "wrap",
|
|
1200
|
-
gap:
|
|
1212
|
+
gap: m.iconSpacing || "8px",
|
|
1201
1213
|
justifyContent: t
|
|
1202
1214
|
})}">${e.map((e) => {
|
|
1203
1215
|
let t = z({
|
|
@@ -1212,109 +1224,109 @@ var Z = (f) => {
|
|
|
1212
1224
|
justifyContent: "center",
|
|
1213
1225
|
overflow: "hidden"
|
|
1214
1226
|
});
|
|
1215
|
-
return `<a href="${W(e.url)}" style="${t} text-decoration: none;">${
|
|
1227
|
+
return `<a href="${W(e.url)}" style="${t} text-decoration: none;">${ee(e.provider, e.color)}</a>`;
|
|
1216
1228
|
}).join("")}</div>`;
|
|
1217
1229
|
}
|
|
1218
1230
|
case "menu": {
|
|
1219
|
-
let e =
|
|
1220
|
-
return `<div${
|
|
1221
|
-
...
|
|
1231
|
+
let e = f(p), t = m.textAlign === "center" ? "center" : m.textAlign === "right" ? "flex-end" : "flex-start";
|
|
1232
|
+
return `<div${_} style="${z({
|
|
1233
|
+
...m,
|
|
1222
1234
|
display: "flex",
|
|
1223
1235
|
flexWrap: "wrap",
|
|
1224
1236
|
gap: "16px",
|
|
1225
1237
|
justifyContent: t
|
|
1226
|
-
})}">${e.map((e) => `<a href="${W(e.href)}" style="text-decoration: none; color: inherit; font-weight: ${
|
|
1238
|
+
})}">${e.map((e) => `<a href="${W(e.href)}" style="text-decoration: none; color: inherit; font-weight: ${m.fontWeight || 600};">${W(e.label)}</a>`).join("")}</div>`;
|
|
1227
1239
|
}
|
|
1228
1240
|
case "icon": {
|
|
1229
|
-
let e =
|
|
1230
|
-
padding:
|
|
1231
|
-
margin:
|
|
1241
|
+
let e = m.fontSize || `${g.iconSize || 48}px`, t = m.color || "#1e293b", n = parseInt(String(e), 10) || 48, r = d(g.iconName, n, t), i = m.textAlign === "right" ? "flex-end" : m.textAlign === "left" ? "flex-start" : "center", a = z({
|
|
1242
|
+
padding: m.padding,
|
|
1243
|
+
margin: m.margin,
|
|
1232
1244
|
display: "flex",
|
|
1233
1245
|
justifyContent: i
|
|
1234
|
-
}), o = typeof
|
|
1235
|
-
return `<div style="${a}">${o ? `<a${
|
|
1246
|
+
}), o = typeof g.href == "string" ? g.href.trim() : "", s = `<span style="display: inline-flex; align-items: center; justify-content: center; color: ${t};">${r}</span>`;
|
|
1247
|
+
return `<div style="${a}">${o ? `<a${_} href="${W(o)}" target="${g.openInNewTab ? "_blank" : "_self"}" style="text-decoration: none;">${s}</a>` : `<span${_}>${s}</span>`}</div>`;
|
|
1236
1248
|
}
|
|
1237
1249
|
case "table": {
|
|
1238
|
-
let e =
|
|
1239
|
-
let a = i ? "th" : "td", o = i ?
|
|
1240
|
-
return `<tr>${
|
|
1241
|
-
let
|
|
1242
|
-
padding:
|
|
1243
|
-
border:
|
|
1250
|
+
let e = r(p), t = `${m.borderWidth || "1px"} ${m.borderStyle || "solid"} ${m.borderColor || "#cbd5e1"}`, n = (n, r, i) => {
|
|
1251
|
+
let a = i ? "th" : "td", o = i ? m.headerBgColor || "#f8fafc" : e.striped && r % 2 == 1 ? "#f8fafc" : m.contentBgColor || "#ffffff", s = i ? m.headerTextColor || "#1e293b" : m.contentTextColor || "#475569", c = i ? m.headerTextAlign || "left" : m.contentTextAlign || "left";
|
|
1252
|
+
return `<tr>${n.map((e) => {
|
|
1253
|
+
let n = z({
|
|
1254
|
+
padding: m.cellPadding || "8px",
|
|
1255
|
+
border: t,
|
|
1244
1256
|
backgroundColor: o,
|
|
1245
1257
|
color: s,
|
|
1246
1258
|
textAlign: c,
|
|
1247
|
-
lineHeight:
|
|
1248
|
-
letterSpacing:
|
|
1259
|
+
lineHeight: m.contentLineHeight,
|
|
1260
|
+
letterSpacing: m.contentLetterSpacing,
|
|
1249
1261
|
fontWeight: i ? "700" : void 0
|
|
1250
1262
|
});
|
|
1251
|
-
return `<${a} style="${
|
|
1263
|
+
return `<${a} style="${n}">${e || " "}</${a}>`;
|
|
1252
1264
|
}).join("")}</tr>`;
|
|
1253
|
-
}, i = e.enableHeader && e.cells.length > 0 ? `<thead>${
|
|
1265
|
+
}, i = e.enableHeader && e.cells.length > 0 ? `<thead>${n(e.cells[0], 0, !0)}</thead>` : "", a = +!!e.enableHeader, o = e.enableFooter ? e.cells.length - 1 : e.cells.length, s = e.cells.slice(a, Math.max(a, o)).map((e, t) => n(e, t, !1)).join(""), c = e.enableFooter && e.cells.length > a ? `<tfoot>${n(e.cells[e.cells.length - 1], e.cells.length - 1, !1)}</tfoot>` : "", l = z({
|
|
1254
1266
|
borderCollapse: "collapse",
|
|
1255
1267
|
width: "100%"
|
|
1256
1268
|
});
|
|
1257
|
-
return `<div${
|
|
1258
|
-
padding:
|
|
1259
|
-
margin:
|
|
1269
|
+
return `<div${_} style="${z({
|
|
1270
|
+
padding: m.padding,
|
|
1271
|
+
margin: m.margin,
|
|
1260
1272
|
overflowX: "auto"
|
|
1261
1273
|
})}"><table style="${l}">${i}<tbody>${s}</tbody>${c}</table></div>`;
|
|
1262
1274
|
}
|
|
1263
1275
|
case "video": {
|
|
1264
|
-
let e =
|
|
1265
|
-
return `<div${
|
|
1266
|
-
padding:
|
|
1267
|
-
margin:
|
|
1268
|
-
borderRadius:
|
|
1276
|
+
let e = a(g.videoUrl), t = g.linkType === "email" ? `mailto:${g.href || ""}` : g.href || g.videoUrl || "#", n = g.target || "_blank";
|
|
1277
|
+
return `<div${_} style="${z({
|
|
1278
|
+
padding: m.padding,
|
|
1279
|
+
margin: m.margin,
|
|
1280
|
+
borderRadius: m.borderRadius,
|
|
1269
1281
|
overflow: "hidden"
|
|
1270
|
-
})}"><a href="${W(t)}" target="${W(n)}" style="position: relative; display: block; text-decoration: none;"><img src="${W(e.thumbnailUrl)}" alt="${W(
|
|
1282
|
+
})}"><a href="${W(t)}" target="${W(n)}" style="position: relative; display: block; text-decoration: none;"><img src="${W(e.thumbnailUrl)}" alt="${W(g.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>`;
|
|
1271
1283
|
}
|
|
1272
1284
|
case "timer": {
|
|
1273
|
-
let e =
|
|
1274
|
-
fontFamily:
|
|
1275
|
-
fontSize:
|
|
1276
|
-
color:
|
|
1285
|
+
let e = g.showLabels !== !1, t = z({
|
|
1286
|
+
fontFamily: m.digitsFontFamily,
|
|
1287
|
+
fontSize: m.digitsFontSize || "40px",
|
|
1288
|
+
color: m.digitsColor || "#1e293b",
|
|
1277
1289
|
fontWeight: "800"
|
|
1290
|
+
}), n = z({
|
|
1291
|
+
fontFamily: m.labelsFontFamily,
|
|
1292
|
+
fontSize: m.labelsFontSize || "16px",
|
|
1293
|
+
color: m.labelsColor || "#64748b"
|
|
1278
1294
|
}), r = z({
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
}), i = z({
|
|
1283
|
-
backgroundColor: p.backgroundColor || "#f8fafc",
|
|
1284
|
-
borderRadius: p.borderRadius || "8px",
|
|
1285
|
-
padding: p.padding || "16px",
|
|
1295
|
+
backgroundColor: m.backgroundColor || "#f8fafc",
|
|
1296
|
+
borderRadius: m.borderRadius || "8px",
|
|
1297
|
+
padding: m.padding || "16px",
|
|
1286
1298
|
textAlign: "center"
|
|
1287
|
-
}),
|
|
1288
|
-
return `<div${
|
|
1299
|
+
}), 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>`, a = c(g.targetDate), o = W(g.targetDate || "2026-12-31T23:59:59"), s = `<script>(function(){var wrap=document.querySelector(${JSON.stringify(`[data-plexo-id="${p.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>`;
|
|
1300
|
+
return `<div${_} data-plexo-target="${o}" style="${r}"><div>${i("days", "Days", a.days)}${i("hours", "Hours", a.hours)}${i("minutes", "Mins", a.minutes)}${i("seconds", "Secs", a.seconds)}</div>${s}</div>`;
|
|
1289
1301
|
}
|
|
1290
1302
|
case "carousel": {
|
|
1291
|
-
let e = Array.isArray(
|
|
1292
|
-
padding:
|
|
1293
|
-
margin:
|
|
1294
|
-
backgroundColor:
|
|
1303
|
+
let e = Array.isArray(g.images) ? g.images : [], t = z({
|
|
1304
|
+
padding: m.padding || "10px",
|
|
1305
|
+
margin: m.margin,
|
|
1306
|
+
backgroundColor: m.backgroundColor,
|
|
1295
1307
|
position: "relative",
|
|
1296
1308
|
overflow: "hidden",
|
|
1297
1309
|
borderRadius: "12px"
|
|
1298
1310
|
});
|
|
1299
|
-
if (e.length === 0) return `<div${
|
|
1300
|
-
let n = Math.min(e.length - 1, Math.max(0, parseInt(String(
|
|
1301
|
-
return `<div${
|
|
1311
|
+
if (e.length === 0) return `<div${_} style="${t}"><div style="padding: 40px; text-align: center; color: #94a3b8;">No images in carousel</div></div>`;
|
|
1312
|
+
let n = Math.min(e.length - 1, Math.max(0, parseInt(String(g.activeIdx), 10) || 0)), r = e.map((e, t) => `<div data-slide-idx="${t}" style="display: ${t === n ? "block" : "none"};"><img src="${W(e.src)}" alt="${W(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;">${W(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>` : "";
|
|
1313
|
+
return `<div${_} 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="${p.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>`;
|
|
1302
1314
|
}
|
|
1303
1315
|
case "accordion": {
|
|
1304
|
-
let e =
|
|
1305
|
-
border: `${
|
|
1306
|
-
borderRadius:
|
|
1316
|
+
let e = o(p), t = g.mode === "multi" ? "multi" : "single", n = g.iconStyle || "chevron", r = g.iconPosition === "left", i = g.showDividers !== !1, a = g.animation !== "none", s = z({
|
|
1317
|
+
border: `${m.borderWidth || "1px"} ${m.borderStyle || "solid"} ${m.borderColor || "#e2e8f0"}`,
|
|
1318
|
+
borderRadius: m.borderRadius || "10px",
|
|
1307
1319
|
overflow: "hidden",
|
|
1308
|
-
margin:
|
|
1320
|
+
margin: m.margin
|
|
1309
1321
|
});
|
|
1310
|
-
return e.length === 0 ? `<div${
|
|
1322
|
+
return e.length === 0 ? `<div${_} style="${s}"></div>` : `<div${_} data-acc-mode="${t}" data-acc-icon-style="${n}" style="${s}"><div class="plexo-acc-group">${Y(e, m, {
|
|
1311
1323
|
iconStyle: n,
|
|
1312
1324
|
iconOnLeft: r,
|
|
1313
1325
|
showDividers: i,
|
|
1314
|
-
animated:
|
|
1315
|
-
})}</div>${`<script>(function(){var root=document.querySelector(${JSON.stringify(`[data-plexo-id="${
|
|
1326
|
+
animated: a
|
|
1327
|
+
})}</div>${`<script>(function(){var root=document.querySelector(${JSON.stringify(`[data-plexo-id="${p.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>`;
|
|
1316
1328
|
}
|
|
1317
|
-
default: return X(
|
|
1329
|
+
default: return X(p.type);
|
|
1318
1330
|
}
|
|
1319
1331
|
}, Q = (e, t) => {
|
|
1320
1332
|
if (!e || typeof e != "object") return "";
|
|
@@ -1368,7 +1380,7 @@ var Z = (f) => {
|
|
|
1368
1380
|
"favicon"
|
|
1369
1381
|
], a = {};
|
|
1370
1382
|
for (let e of Object.keys(r)) i.includes(e) || (a[e] = r[e]);
|
|
1371
|
-
let o = z(a), s = typeof r.htmlTitle == "string" && r.htmlTitle.trim() ? r.htmlTitle.trim() : typeof e?.name == "string" && e.name.trim() ? e.name.trim() : "Plexo Rendered Page", c = G("id", r.htmlId), l = G("class", r.htmlClass), u = typeof r.customCss == "string" && r.customCss.trim() ? r.customCss.trim() : "", d = typeof r.customJs == "string" && r.customJs.trim() ? r.customJs.trim() : "", f = typeof r.favicon == "string" && r.favicon.trim() ? r.favicon.trim() : "", p = Array.isArray(n.rows) ? n.rows : Array.isArray(t.rows) ? t.rows : Array.isArray(e.rows) ? e.rows : [], m = S(
|
|
1383
|
+
let o = z(a), s = typeof r.htmlTitle == "string" && r.htmlTitle.trim() ? r.htmlTitle.trim() : typeof e?.name == "string" && e.name.trim() ? e.name.trim() : "Plexo Rendered Page", c = G("id", r.htmlId), l = G("class", r.htmlClass), u = typeof r.customCss == "string" && r.customCss.trim() ? r.customCss.trim() : "", d = typeof r.customJs == "string" && r.customJs.trim() ? r.customJs.trim() : "", f = typeof r.favicon == "string" && r.favicon.trim() ? r.favicon.trim() : "", p = Array.isArray(n.rows) ? n.rows : Array.isArray(t.rows) ? t.rows : Array.isArray(e.rows) ? e.rows : [], m = C(S(p, [r.fontFamily])), h = {
|
|
1372
1384
|
tablet: [],
|
|
1373
1385
|
mobile: []
|
|
1374
1386
|
}, g = "";
|
|
@@ -1382,7 +1394,7 @@ var Z = (f) => {
|
|
|
1382
1394
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1383
1395
|
${m ? `<link rel="stylesheet" href="${m}">` : ""}
|
|
1384
1396
|
<style>
|
|
1385
|
-
body { margin: 0; font-family: ${
|
|
1397
|
+
body { margin: 0; font-family: ${I}; }
|
|
1386
1398
|
.plexo-row {
|
|
1387
1399
|
display: flex;
|
|
1388
1400
|
flex-wrap: wrap;
|
|
@@ -1412,14 +1424,14 @@ ${d ? ` <script>\n${d}\n <\/script>` : ""}
|
|
|
1412
1424
|
</body>
|
|
1413
1425
|
</html>`, y = y.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1"), y;
|
|
1414
1426
|
};
|
|
1415
|
-
function
|
|
1427
|
+
function te(e) {
|
|
1416
1428
|
return $(e).replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1417
1429
|
}
|
|
1418
|
-
function
|
|
1430
|
+
function ne(e) {
|
|
1419
1431
|
return $(e);
|
|
1420
1432
|
}
|
|
1421
|
-
function
|
|
1433
|
+
function re(e) {
|
|
1422
1434
|
return e;
|
|
1423
1435
|
}
|
|
1424
1436
|
//#endregion
|
|
1425
|
-
export {
|
|
1437
|
+
export { b as _, ne as a, m as b, U as c, F as d, C as f, v as g, h, $ as i, B as l, y as m, K as n, te as o, S as p, H as r, R as s, I as t, re as u, g as v, p as x, _ as y };
|
package/dist/compiler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./compiler-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./compiler-BEQo1civ.js";
|
|
2
2
|
export { c as DEFAULT_BODY_FONT_FAMILY, i as FORM_NON_CSS_STYLE_KEYS, o as collectResponsiveRule, n as compileToHTML, e as compileToHTMLWithStrataAuto, a as compileToPlainText, s as convertSectionRowToPlexoRow, t as getFormDefaultStyle, r as getInlineStylesImportant, l as injectStrataBundle };
|