@charisol/plexo-sdk 1.0.42 → 1.0.44
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-BEQo1civ.js → compiler-Do7SiKdp.js} +85 -78
- package/dist/compiler.js +1 -1
- package/dist/compilerClient.js +78 -73
- package/dist/{iconSvgStatic-DubpApuZ.js → iconSvgStatic-DKNX8fUj.js} +69 -59
- package/dist/index.js +14418 -14337
- package/dist/plexo-sdk.css +1 -1
- package/dist/store.d.ts +1 -1
- package/dist/utilities/columnOrder.d.ts +17 -0
- package/dist/utilities/dndCollision.d.ts +0 -16
- package/dist/utilities/types.d.ts +10 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i,
|
|
1
|
+
import { a as e, c as t, d as n, f as r, g as i, i as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "./iconSvgStatic-DKNX8fUj.js";
|
|
2
2
|
//#region src/utilities/playground.constants.ts
|
|
3
|
-
var
|
|
3
|
+
var m = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, h = [
|
|
4
4
|
{
|
|
5
5
|
id: "all",
|
|
6
6
|
label: "All sources"
|
|
@@ -17,7 +17,7 @@ var p = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, m
|
|
|
17
17
|
id: "pixabay",
|
|
18
18
|
label: "Pixabay"
|
|
19
19
|
}
|
|
20
|
-
],
|
|
20
|
+
], g = [
|
|
21
21
|
{
|
|
22
22
|
id: "surface-book",
|
|
23
23
|
label: "Surface Book",
|
|
@@ -84,7 +84,7 @@ var p = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, m
|
|
|
84
84
|
width: 375,
|
|
85
85
|
category: "mobile"
|
|
86
86
|
}
|
|
87
|
-
],
|
|
87
|
+
], _ = 1280, v = [
|
|
88
88
|
{
|
|
89
89
|
id: "facebook",
|
|
90
90
|
label: "Facebook"
|
|
@@ -117,7 +117,7 @@ var p = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, m
|
|
|
117
117
|
id: "tiktok",
|
|
118
118
|
label: "TikTok"
|
|
119
119
|
}
|
|
120
|
-
],
|
|
120
|
+
], y = [
|
|
121
121
|
{
|
|
122
122
|
label: "Text",
|
|
123
123
|
value: "text"
|
|
@@ -150,7 +150,7 @@ var p = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, m
|
|
|
150
150
|
label: "Checkbox",
|
|
151
151
|
value: "checkbox"
|
|
152
152
|
}
|
|
153
|
-
],
|
|
153
|
+
], b = [
|
|
154
154
|
{
|
|
155
155
|
label: "1 Column",
|
|
156
156
|
widths: ["100%"],
|
|
@@ -199,7 +199,7 @@ var p = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, m
|
|
|
199
199
|
"25%"
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
|
-
],
|
|
202
|
+
], x = [
|
|
203
203
|
{
|
|
204
204
|
label: "Roboto",
|
|
205
205
|
value: "'Roboto', sans-serif",
|
|
@@ -600,8 +600,8 @@ var p = (e) => `https://picsum.photos/seed/${encodeURIComponent(e)}/1200/800`, m
|
|
|
600
600
|
value: "'Great Vibes', cursive",
|
|
601
601
|
style: "handwriting"
|
|
602
602
|
}
|
|
603
|
-
],
|
|
604
|
-
function
|
|
603
|
+
], S = new Map(x.map((e) => [e.value, e.label]));
|
|
604
|
+
function C(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 S(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 w(e) {
|
|
623
623
|
let t = /* @__PURE__ */ new Set();
|
|
624
624
|
for (let n of e) {
|
|
625
|
-
let e =
|
|
625
|
+
let e = S.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 T = {
|
|
633
633
|
tablet: {
|
|
634
634
|
thresholdPx: 24,
|
|
635
635
|
scale: .85,
|
|
@@ -640,7 +640,7 @@ var w = {
|
|
|
640
640
|
scale: .7,
|
|
641
641
|
floorPx: 14
|
|
642
642
|
}
|
|
643
|
-
},
|
|
643
|
+
}, ee = {
|
|
644
644
|
tablet: {
|
|
645
645
|
thresholdPx: 320,
|
|
646
646
|
scale: .8,
|
|
@@ -704,13 +704,13 @@ function P(e, t) {
|
|
|
704
704
|
for (let r of O) {
|
|
705
705
|
let i = M(e[r]);
|
|
706
706
|
if (i === null) continue;
|
|
707
|
-
let a = N(i,
|
|
707
|
+
let a = N(i, T[t]);
|
|
708
708
|
a !== null && (n[r] = `${a}px`);
|
|
709
709
|
}
|
|
710
710
|
for (let r of k) {
|
|
711
711
|
let i = M(e[r]);
|
|
712
712
|
if (i === null) continue;
|
|
713
|
-
let a = N(i,
|
|
713
|
+
let a = N(i, ee[t]);
|
|
714
714
|
a !== null && (n[r] = `${a}px`);
|
|
715
715
|
}
|
|
716
716
|
for (let r of A) {
|
|
@@ -735,8 +735,8 @@ function F(e, t, n) {
|
|
|
735
735
|
}
|
|
736
736
|
//#endregion
|
|
737
737
|
//#region src/utilities/compiler.ts
|
|
738
|
-
var I = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif",
|
|
739
|
-
switch (
|
|
738
|
+
var I = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", te = (e) => e === "twitter" ? "x" : e, L = (e, t = "currentColor") => {
|
|
739
|
+
switch (te(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>`;
|
|
@@ -1134,18 +1134,18 @@ function Y(e, t, n) {
|
|
|
1134
1134
|
function X(e) {
|
|
1135
1135
|
return `<!-- Unsupported block ${String(e)} -->`;
|
|
1136
1136
|
}
|
|
1137
|
-
var Z = (
|
|
1138
|
-
if (!
|
|
1139
|
-
let m =
|
|
1137
|
+
var Z = (i) => {
|
|
1138
|
+
if (!i || typeof i != "object") return "";
|
|
1139
|
+
let m = i.style || {}, h = z(i.type === "form_container" ? {
|
|
1140
1140
|
...U(),
|
|
1141
1141
|
...m
|
|
1142
|
-
} : m), g =
|
|
1143
|
-
switch (
|
|
1142
|
+
} : m), g = i.attributes || {}, _ = ` data-plexo-id="${W(i.id)}"`;
|
|
1143
|
+
switch (i.type) {
|
|
1144
1144
|
case "heading": return `<h2${_} style="margin-top: 0; margin-bottom: 8px; ${h}">${g.text || "Heading"}</h2>`;
|
|
1145
1145
|
case "paragraph": return `<p${_} style="margin-top: 0; margin-bottom: 12px; ${h}">${g.text || "Paragraph text content."}</p>`;
|
|
1146
1146
|
case "text": return `<div${_} style="${h}">${g.text || ""}</div>`;
|
|
1147
1147
|
case "button": {
|
|
1148
|
-
let e = i
|
|
1148
|
+
let e = a(i), t = z({
|
|
1149
1149
|
...m,
|
|
1150
1150
|
width: e.width,
|
|
1151
1151
|
height: e.height
|
|
@@ -1153,7 +1153,7 @@ var Z = (p) => {
|
|
|
1153
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>`;
|
|
1154
1154
|
}
|
|
1155
1155
|
case "image": {
|
|
1156
|
-
let e = t(
|
|
1156
|
+
let e = t(i), n = m.textAlign === "center" ? "margin: 0 auto; display: block;" : m.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;", r = z({
|
|
1157
1157
|
...m,
|
|
1158
1158
|
width: e.width,
|
|
1159
1159
|
height: e.height
|
|
@@ -1172,25 +1172,25 @@ var Z = (p) => {
|
|
|
1172
1172
|
...m
|
|
1173
1173
|
}, n = {};
|
|
1174
1174
|
for (let e of Object.keys(t)) K.includes(e) || (n[e] = t[e]);
|
|
1175
|
-
n.height = e(
|
|
1176
|
-
let r = z(n),
|
|
1175
|
+
n.height = e(i);
|
|
1176
|
+
let r = z(n), a = c(Array.isArray(g.fields) ? g.fields : []), o = t.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${q(e)}</div>`).join(""), l = g.buttonAutoWidth === !1 ? t.buttonWidth || "100%" : "auto", d = t.buttonAlign === "left" ? "flex-start" : t.buttonAlign === "right" ? "flex-end" : "center", f = g.buttonAutoHeight === !1 && t.buttonHeight || "auto", p = z({
|
|
1177
1177
|
backgroundColor: t.buttonBackgroundColor,
|
|
1178
1178
|
color: t.buttonTextColor,
|
|
1179
1179
|
borderRadius: t.buttonBorderRadius,
|
|
1180
|
-
paddingTop:
|
|
1181
|
-
paddingBottom:
|
|
1182
|
-
paddingLeft:
|
|
1183
|
-
paddingRight:
|
|
1184
|
-
marginTop:
|
|
1185
|
-
marginBottom:
|
|
1186
|
-
marginLeft:
|
|
1187
|
-
marginRight:
|
|
1180
|
+
paddingTop: u(t.buttonPaddingTop, t.buttonPadding, "top", "10px"),
|
|
1181
|
+
paddingBottom: u(t.buttonPaddingBottom, t.buttonPadding, "bottom", "10px"),
|
|
1182
|
+
paddingLeft: u(t.buttonPaddingLeft, t.buttonPadding, "left", "14px"),
|
|
1183
|
+
paddingRight: u(t.buttonPaddingRight, t.buttonPadding, "right", "14px"),
|
|
1184
|
+
marginTop: u(t.buttonMarginTop, t.buttonMargin, "top"),
|
|
1185
|
+
marginBottom: u(t.buttonMarginBottom, t.buttonMargin, "bottom"),
|
|
1186
|
+
marginLeft: u(t.buttonMarginLeft, t.buttonMargin, "left"),
|
|
1187
|
+
marginRight: u(t.buttonMarginRight, t.buttonMargin, "right"),
|
|
1188
1188
|
fontSize: t.buttonFontSize,
|
|
1189
1189
|
fontWeight: t.buttonFontWeight,
|
|
1190
|
-
width:
|
|
1191
|
-
height:
|
|
1190
|
+
width: l,
|
|
1191
|
+
height: f
|
|
1192
1192
|
});
|
|
1193
|
-
return `<form${_} action="${W(g.actionUrl || g.action || "#")}" method="${W(g.method || "POST")}" style="${r}">${
|
|
1193
|
+
return `<form${_} action="${W(g.actionUrl || g.action || "#")}" method="${W(g.method || "POST")}" style="${r}">${s}<div style="display: flex; width: 100%; justify-content: ${d};"><button type="submit" style="border: 0; cursor: pointer; ${p}">${g.submitLabel || "Submit"}</button></div></form>`;
|
|
1194
1194
|
}
|
|
1195
1195
|
case "input": {
|
|
1196
1196
|
let e = g.inputType || g.type || "text", t = W(g.name || g.fieldName || "field"), n = W(g.placeholder || ""), r = g.required ? " required" : "";
|
|
@@ -1200,10 +1200,10 @@ var Z = (p) => {
|
|
|
1200
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
1201
|
case "html": return `<div${_} style="${z({
|
|
1202
1202
|
...m,
|
|
1203
|
-
height:
|
|
1203
|
+
height: d(i, "auto")
|
|
1204
1204
|
})}">${g.htmlContent || g.text || ""}</div>`;
|
|
1205
1205
|
case "social": {
|
|
1206
|
-
let e = n(
|
|
1206
|
+
let e = n(i), t = m.textAlign === "center" ? "center" : m.textAlign === "right" ? "flex-end" : "flex-start";
|
|
1207
1207
|
return `<div${_} style="${z({
|
|
1208
1208
|
padding: m.padding,
|
|
1209
1209
|
margin: m.margin,
|
|
@@ -1224,11 +1224,11 @@ var Z = (p) => {
|
|
|
1224
1224
|
justifyContent: "center",
|
|
1225
1225
|
overflow: "hidden"
|
|
1226
1226
|
});
|
|
1227
|
-
return `<a href="${W(e.url)}" style="${t} text-decoration: none;">${
|
|
1227
|
+
return `<a href="${W(e.url)}" style="${t} text-decoration: none;">${L(e.provider, e.color)}</a>`;
|
|
1228
1228
|
}).join("")}</div>`;
|
|
1229
1229
|
}
|
|
1230
1230
|
case "menu": {
|
|
1231
|
-
let e =
|
|
1231
|
+
let e = p(i), t = m.textAlign === "center" ? "center" : m.textAlign === "right" ? "flex-end" : "flex-start";
|
|
1232
1232
|
return `<div${_} style="${z({
|
|
1233
1233
|
...m,
|
|
1234
1234
|
display: "flex",
|
|
@@ -1238,7 +1238,7 @@ var Z = (p) => {
|
|
|
1238
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>`;
|
|
1239
1239
|
}
|
|
1240
1240
|
case "icon": {
|
|
1241
|
-
let e = m.fontSize || `${g.iconSize || 48}px`, t = m.color || "#1e293b", n = parseInt(String(e), 10) || 48, r =
|
|
1241
|
+
let e = m.fontSize || `${g.iconSize || 48}px`, t = m.color || "#1e293b", n = parseInt(String(e), 10) || 48, r = f(g.iconName, n, t), i = m.textAlign === "right" ? "flex-end" : m.textAlign === "left" ? "flex-start" : "center", a = z({
|
|
1242
1242
|
padding: m.padding,
|
|
1243
1243
|
margin: m.margin,
|
|
1244
1244
|
display: "flex",
|
|
@@ -1247,7 +1247,7 @@ var Z = (p) => {
|
|
|
1247
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>`;
|
|
1248
1248
|
}
|
|
1249
1249
|
case "table": {
|
|
1250
|
-
let e = r(
|
|
1250
|
+
let e = r(i), t = `${m.borderWidth || "1px"} ${m.borderStyle || "solid"} ${m.borderColor || "#cbd5e1"}`, n = (n, r, i) => {
|
|
1251
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
1252
|
return `<tr>${n.map((e) => {
|
|
1253
1253
|
let n = z({
|
|
@@ -1262,7 +1262,7 @@ var Z = (p) => {
|
|
|
1262
1262
|
});
|
|
1263
1263
|
return `<${a} style="${n}">${e || " "}</${a}>`;
|
|
1264
1264
|
}).join("")}</tr>`;
|
|
1265
|
-
},
|
|
1265
|
+
}, a = e.enableHeader && e.cells.length > 0 ? `<thead>${n(e.cells[0], 0, !0)}</thead>` : "", o = +!!e.enableHeader, s = e.enableFooter ? e.cells.length - 1 : e.cells.length, c = e.cells.slice(o, Math.max(o, s)).map((e, t) => n(e, t, !1)).join(""), l = e.enableFooter && e.cells.length > o ? `<tfoot>${n(e.cells[e.cells.length - 1], e.cells.length - 1, !1)}</tfoot>` : "", u = z({
|
|
1266
1266
|
borderCollapse: "collapse",
|
|
1267
1267
|
width: "100%"
|
|
1268
1268
|
});
|
|
@@ -1270,10 +1270,10 @@ var Z = (p) => {
|
|
|
1270
1270
|
padding: m.padding,
|
|
1271
1271
|
margin: m.margin,
|
|
1272
1272
|
overflowX: "auto"
|
|
1273
|
-
})}"><table style="${
|
|
1273
|
+
})}"><table style="${u}">${a}<tbody>${c}</tbody>${l}</table></div>`;
|
|
1274
1274
|
}
|
|
1275
1275
|
case "video": {
|
|
1276
|
-
let e =
|
|
1276
|
+
let e = o(g.videoUrl), t = g.linkType === "email" ? `mailto:${g.href || ""}` : g.href || g.videoUrl || "#", n = g.target || "_blank";
|
|
1277
1277
|
return `<div${_} style="${z({
|
|
1278
1278
|
padding: m.padding,
|
|
1279
1279
|
margin: m.margin,
|
|
@@ -1296,8 +1296,8 @@ var Z = (p) => {
|
|
|
1296
1296
|
borderRadius: m.borderRadius || "8px",
|
|
1297
1297
|
padding: m.padding || "16px",
|
|
1298
1298
|
textAlign: "center"
|
|
1299
|
-
}),
|
|
1300
|
-
return `<div${_} data-plexo-target="${
|
|
1299
|
+
}), a = (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 = l(g.targetDate), s = W(g.targetDate || "2026-12-31T23:59:59"), c = `<script>(function(){var wrap=document.querySelector(${JSON.stringify(`[data-plexo-id="${i.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="${s}" style="${r}"><div>${a("days", "Days", o.days)}${a("hours", "Hours", o.hours)}${a("minutes", "Mins", o.minutes)}${a("seconds", "Secs", o.seconds)}</div>${c}</div>`;
|
|
1301
1301
|
}
|
|
1302
1302
|
case "carousel": {
|
|
1303
1303
|
let e = Array.isArray(g.images) ? g.images : [], t = z({
|
|
@@ -1309,49 +1309,56 @@ var Z = (p) => {
|
|
|
1309
1309
|
borderRadius: "12px"
|
|
1310
1310
|
});
|
|
1311
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(""),
|
|
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}${
|
|
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(""), a = 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}${a}${`<script>(function(){var wrap=document.querySelector(${JSON.stringify(`[data-plexo-id="${i.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>`;
|
|
1314
1314
|
}
|
|
1315
1315
|
case "accordion": {
|
|
1316
|
-
let e =
|
|
1316
|
+
let e = s(i), t = g.mode === "multi" ? "multi" : "single", n = g.iconStyle || "chevron", r = g.iconPosition === "left", a = g.showDividers !== !1, o = g.animation !== "none", c = z({
|
|
1317
1317
|
border: `${m.borderWidth || "1px"} ${m.borderStyle || "solid"} ${m.borderColor || "#e2e8f0"}`,
|
|
1318
1318
|
borderRadius: m.borderRadius || "10px",
|
|
1319
1319
|
overflow: "hidden",
|
|
1320
1320
|
margin: m.margin
|
|
1321
1321
|
});
|
|
1322
|
-
return e.length === 0 ? `<div${_} style="${
|
|
1322
|
+
return e.length === 0 ? `<div${_} style="${c}"></div>` : `<div${_} data-acc-mode="${t}" data-acc-icon-style="${n}" style="${c}"><div class="plexo-acc-group">${Y(e, m, {
|
|
1323
1323
|
iconStyle: n,
|
|
1324
1324
|
iconOnLeft: r,
|
|
1325
|
-
showDividers:
|
|
1326
|
-
animated:
|
|
1327
|
-
})}</div>${`<script>(function(){var root=document.querySelector(${JSON.stringify(`[data-plexo-id="${
|
|
1325
|
+
showDividers: a,
|
|
1326
|
+
animated: o
|
|
1327
|
+
})}</div>${`<script>(function(){var root=document.querySelector(${JSON.stringify(`[data-plexo-id="${i.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>`;
|
|
1328
1328
|
}
|
|
1329
|
-
default: return X(
|
|
1329
|
+
default: return X(i.type);
|
|
1330
1330
|
}
|
|
1331
1331
|
}, Q = (e, t) => {
|
|
1332
1332
|
if (!e || typeof e != "object") return "";
|
|
1333
1333
|
let n = R(e);
|
|
1334
1334
|
if (!n) 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. -->`;
|
|
1335
|
-
let r = z(n.style || {}),
|
|
1336
|
-
H(t,
|
|
1337
|
-
let
|
|
1338
|
-
|
|
1339
|
-
let
|
|
1340
|
-
for (let e of
|
|
1335
|
+
let r = z(n.style || {}), a = G("id", n.htmlId), o = G("class", n.htmlClass), s = n.id || `row-${Math.random().toString(36).substring(2, 9)}`;
|
|
1336
|
+
H(t, s, n.style, "tablet", n.styleTablet), H(t, s, n.style, "mobile", n.styleMobile);
|
|
1337
|
+
let c = `\n <!-- ROW START: ${n.id || "row"} -->`;
|
|
1338
|
+
c += `\n <div data-plexo-id="${s}"${a}${o} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${r}">`;
|
|
1339
|
+
let l = Array.isArray(n.columns) ? n.columns : [];
|
|
1340
|
+
for (let e of l) {
|
|
1341
1341
|
if (!e) continue;
|
|
1342
|
-
let n = e.styles || e.style || {}, r = z(n),
|
|
1343
|
-
H(t,
|
|
1344
|
-
let
|
|
1345
|
-
for (let
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1342
|
+
let n = e.styles || e.style || {}, r = z(n), a = G("id", e.attrs?.htmlId), o = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", s = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
|
|
1343
|
+
H(t, s, n, "tablet", e.stylesTablet), H(t, s, n, "mobile", e.stylesMobile), c += `\n <!-- COLUMN START: ${e.id || "col"} -->`, c += `\n <div data-plexo-id="${s}"${a} class="plexo-col${o}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; ${r}">`;
|
|
1344
|
+
let l = Array.isArray(e.elements) ? e.elements : [], u = Array.isArray(e.nestedRows) ? e.nestedRows : [], d = new Map(l.map((e) => [e.id, e])), f = new Map(u.map((e) => [e.id, e]));
|
|
1345
|
+
for (let n of i({
|
|
1346
|
+
...e,
|
|
1347
|
+
elements: l,
|
|
1348
|
+
nestedRows: u
|
|
1349
|
+
})) {
|
|
1350
|
+
let e = d.get(n);
|
|
1351
|
+
if (e) {
|
|
1352
|
+
let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "", i = G("id", n.htmlId), a = G("class", r), o = e.style?.display, s = o === "inline-block" || o === "inline" || o === "inline-flex" ? `margin-bottom: 16px; display: ${o}; vertical-align: top;` : "margin-bottom: 16px;";
|
|
1353
|
+
H(t, e.id, e.style, "tablet", e.styleTablet), H(t, e.id, e.style, "mobile", e.styleMobile), c += `\n <div${i}${a} style="${s}">`, c += `\n ${Z(e)}`, c += "\n </div>";
|
|
1354
|
+
continue;
|
|
1355
|
+
}
|
|
1356
|
+
let r = f.get(n);
|
|
1357
|
+
r && (c += Q(r, t));
|
|
1349
1358
|
}
|
|
1350
|
-
|
|
1351
|
-
for (let e of l) s += Q(e, t);
|
|
1352
|
-
s += "\n </div>";
|
|
1359
|
+
c += "\n </div>";
|
|
1353
1360
|
}
|
|
1354
|
-
return
|
|
1361
|
+
return c += "\n </div>", c;
|
|
1355
1362
|
}, $ = (e) => {
|
|
1356
1363
|
if (!e || typeof e != "object") return "<!-- Empty template -->";
|
|
1357
1364
|
let t = e.designJson || e.template || e, n = t.body || (Array.isArray(t.rows) ? {
|
|
@@ -1380,7 +1387,7 @@ var Z = (p) => {
|
|
|
1380
1387
|
"favicon"
|
|
1381
1388
|
], a = {};
|
|
1382
1389
|
for (let e of Object.keys(r)) i.includes(e) || (a[e] = r[e]);
|
|
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(
|
|
1390
|
+
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 = w(C(p, [r.fontFamily])), h = {
|
|
1384
1391
|
tablet: [],
|
|
1385
1392
|
mobile: []
|
|
1386
1393
|
}, g = "";
|
|
@@ -1424,14 +1431,14 @@ ${d ? ` <script>\n${d}\n <\/script>` : ""}
|
|
|
1424
1431
|
</body>
|
|
1425
1432
|
</html>`, y = y.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1"), y;
|
|
1426
1433
|
};
|
|
1427
|
-
function
|
|
1434
|
+
function ne(e) {
|
|
1428
1435
|
return $(e).replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
1429
1436
|
}
|
|
1430
|
-
function
|
|
1437
|
+
function re(e) {
|
|
1431
1438
|
return $(e);
|
|
1432
1439
|
}
|
|
1433
|
-
function
|
|
1440
|
+
function ie(e) {
|
|
1434
1441
|
return e;
|
|
1435
1442
|
}
|
|
1436
1443
|
//#endregion
|
|
1437
|
-
export {
|
|
1444
|
+
export { x as _, re as a, h as b, U as c, F as d, w as f, y as g, g as h, $ as i, B as l, b as m, K as n, ne as o, C as p, H as r, R as s, I as t, ie as u, _ as v, m as x, v 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-Do7SiKdp.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 };
|