@charisol/plexo-sdk 1.4.5 → 1.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/PlexoRenderer.d.ts +7 -0
- package/dist/{compiler-Zh5KObm4.js → compiler-DFybM5XW.js} +270 -150
- package/dist/compiler.js +1 -1
- package/dist/compilerClient-DNKp-n6N.js +371 -0
- package/dist/compilerClient.js +1 -1
- package/dist/components/icons.d.ts +7 -0
- package/dist/components/properties/accordionSections/CommerceProductPropertiesAccordion.d.ts +10 -0
- package/dist/components/sidebarTabs/ContentTab.d.ts +6 -0
- package/dist/{iconSvgStatic-DEgDUD68.js → iconSvgStatic-CGue7nyp.js} +61 -660
- package/dist/index.js +15487 -14433
- package/dist/utilities/playground.helpers.d.ts +214 -0
- package/dist/utilities/playground.interfaces.d.ts +21 -0
- package/dist/utilities/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/compilerClient-BwRHkl-b.js +0 -254
- package/dist/utilities/googleFonts.d.ts +0 -17
package/dist/compiler.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./compiler-
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./compiler-DFybM5XW.js";
|
|
2
2
|
export { l as DEFAULT_BODY_FONT_FAMILY, a as FORM_NON_CSS_STYLE_KEYS, s as collectResponsiveRule, r as compileToHTML, e as compileToHTMLWithStrataAuto, o as compileToPlainText, c as convertSectionRowToPlexoRow, t as getFormDefaultStyle, i as getInlineStylesImportant, u as htmlToPlainText, n as injectStrataBundle };
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { d as e, f as t, g as n, h as r, m as i, o as a, p as o, t as s, u as c, x as l, y as u } from "./iconSvgStatic-CGue7nyp.js";
|
|
2
|
+
//#region src/utilities/instrumentation.ts
|
|
3
|
+
var d = "plexo-node", f = "plexo-row", p = "plexo-col";
|
|
4
|
+
function m(e) {
|
|
5
|
+
return `plexo-node-${e}`;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/utilities/compilerClient.ts
|
|
9
|
+
var h = /* @__PURE__ */ new Map([
|
|
10
|
+
["'Roboto', sans-serif", "Roboto"],
|
|
11
|
+
["'Open Sans', sans-serif", "Open Sans"],
|
|
12
|
+
["'Lato', sans-serif", "Lato"],
|
|
13
|
+
["'Montserrat', sans-serif", "Montserrat"],
|
|
14
|
+
["'Inter', sans-serif", "Inter"],
|
|
15
|
+
["'Poppins', sans-serif", "Poppins"],
|
|
16
|
+
["'Raleway', sans-serif", "Raleway"],
|
|
17
|
+
["'Nunito', sans-serif", "Nunito"],
|
|
18
|
+
["'Nunito Sans', sans-serif", "Nunito Sans"],
|
|
19
|
+
["'Ubuntu', sans-serif", "Ubuntu"],
|
|
20
|
+
["'Rubik', sans-serif", "Rubik"],
|
|
21
|
+
["'Plus Jakarta Sans', sans-serif", "Plus Jakarta Sans"],
|
|
22
|
+
["'DM Sans', sans-serif", "DM Sans"],
|
|
23
|
+
["'Outfit', sans-serif", "Outfit"],
|
|
24
|
+
["'Figtree', sans-serif", "Figtree"],
|
|
25
|
+
["'Karla', sans-serif", "Karla"],
|
|
26
|
+
["'Barlow', sans-serif", "Barlow"],
|
|
27
|
+
["'Work Sans', sans-serif", "Work Sans"],
|
|
28
|
+
["'Manrope', sans-serif", "Manrope"],
|
|
29
|
+
["'Jost', sans-serif", "Jost"],
|
|
30
|
+
["'Sora', sans-serif", "Sora"],
|
|
31
|
+
["'Be Vietnam Pro', sans-serif", "Be Vietnam Pro"],
|
|
32
|
+
["'Mulish', sans-serif", "Mulish"],
|
|
33
|
+
["'Noto Sans', sans-serif", "Noto Sans"],
|
|
34
|
+
["'Source Sans 3', sans-serif", "Source Sans 3"],
|
|
35
|
+
["'IBM Plex Sans', sans-serif", "IBM Plex Sans"],
|
|
36
|
+
["'Josefin Sans', sans-serif", "Josefin Sans"],
|
|
37
|
+
["'Quicksand', sans-serif", "Quicksand"],
|
|
38
|
+
["'Exo 2', sans-serif", "Exo 2"],
|
|
39
|
+
["'Titillium Web', sans-serif", "Titillium Web"],
|
|
40
|
+
["'Public Sans', sans-serif", "Public Sans"],
|
|
41
|
+
["'Merriweather', serif", "Merriweather"],
|
|
42
|
+
["'Fraunces', serif", "Fraunces"],
|
|
43
|
+
["'Playfair Display', serif", "Playfair Display"],
|
|
44
|
+
["'Lora', serif", "Lora"],
|
|
45
|
+
["'PT Serif', serif", "PT Serif"],
|
|
46
|
+
["'Noto Serif', serif", "Noto Serif"],
|
|
47
|
+
["'EB Garamond', serif", "EB Garamond"],
|
|
48
|
+
["'Libre Baskerville', serif", "Libre Baskerville"],
|
|
49
|
+
["'Cormorant Garamond', serif", "Cormorant Garamond"],
|
|
50
|
+
["'Crimson Text', serif", "Crimson Text"],
|
|
51
|
+
["'DM Serif Display', serif", "DM Serif Display"],
|
|
52
|
+
["'Domine', serif", "Domine"],
|
|
53
|
+
["'Bitter', serif", "Bitter"],
|
|
54
|
+
["'Spectral', serif", "Spectral"],
|
|
55
|
+
["'Cardo', serif", "Cardo"],
|
|
56
|
+
["'Gilda Display', serif", "Gilda Display"],
|
|
57
|
+
["'Roboto Mono', monospace", "Roboto Mono"],
|
|
58
|
+
["'Source Code Pro', monospace", "Source Code Pro"],
|
|
59
|
+
["'Fira Code', monospace", "Fira Code"],
|
|
60
|
+
["'JetBrains Mono', monospace", "JetBrains Mono"],
|
|
61
|
+
["'IBM Plex Mono', monospace", "IBM Plex Mono"],
|
|
62
|
+
["'Space Mono', monospace", "Space Mono"],
|
|
63
|
+
["'Inconsolata', monospace", "Inconsolata"],
|
|
64
|
+
["'Courier Prime', monospace", "Courier Prime"],
|
|
65
|
+
["'Oswald', sans-serif", "Oswald"],
|
|
66
|
+
["'Anton', sans-serif", "Anton"],
|
|
67
|
+
["'Bebas Neue', sans-serif", "Bebas Neue"],
|
|
68
|
+
["'Righteous', sans-serif", "Righteous"],
|
|
69
|
+
["'Russo One', sans-serif", "Russo One"],
|
|
70
|
+
["'Chakra Petch', sans-serif", "Chakra Petch"],
|
|
71
|
+
["'Orbitron', sans-serif", "Orbitron"],
|
|
72
|
+
["'Abril Fatface', serif", "Abril Fatface"],
|
|
73
|
+
["'Lobster', cursive", "Lobster"],
|
|
74
|
+
["'Alfa Slab One', serif", "Alfa Slab One"],
|
|
75
|
+
["'Archivo Black', sans-serif", "Archivo Black"],
|
|
76
|
+
["'Bangers', cursive", "Bangers"],
|
|
77
|
+
["'Boogaloo', cursive", "Boogaloo"],
|
|
78
|
+
["'Fredoka One', cursive", "Fredoka One"],
|
|
79
|
+
["'Permanent Marker', cursive", "Permanent Marker"],
|
|
80
|
+
["'Lilita One', cursive", "Lilita One"],
|
|
81
|
+
["'Dancing Script', cursive", "Dancing Script"],
|
|
82
|
+
["'Pacifico', cursive", "Pacifico"],
|
|
83
|
+
["'Satisfy', cursive", "Satisfy"],
|
|
84
|
+
["'Caveat', cursive", "Caveat"],
|
|
85
|
+
["'Indie Flower', cursive", "Indie Flower"],
|
|
86
|
+
["'Kalam', cursive", "Kalam"],
|
|
87
|
+
["'Shadows Into Light', cursive", "Shadows Into Light"],
|
|
88
|
+
["'Amatic SC', cursive", "Amatic SC"],
|
|
89
|
+
["'Courgette', cursive", "Courgette"],
|
|
90
|
+
["'Cookie', cursive", "Cookie"],
|
|
91
|
+
["'Great Vibes', cursive", "Great Vibes"]
|
|
92
|
+
]);
|
|
93
|
+
function g(e, t = []) {
|
|
94
|
+
let n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
95
|
+
if (!e) return;
|
|
96
|
+
let t = Array.isArray(e.columns) ? e.columns : [];
|
|
97
|
+
for (let e of t) {
|
|
98
|
+
if (!e) continue;
|
|
99
|
+
let t = Array.isArray(e.elements) ? e.elements : [];
|
|
100
|
+
for (let e of t) {
|
|
101
|
+
let t = e?.style?.fontFamily;
|
|
102
|
+
typeof t == "string" && t.trim() && n.add(t.trim());
|
|
103
|
+
}
|
|
104
|
+
(Array.isArray(e.nestedRows) ? e.nestedRows : []).forEach(r);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
(e || []).forEach(r);
|
|
108
|
+
for (let e of t) typeof e == "string" && e.trim() && n.add(e.trim());
|
|
109
|
+
return n;
|
|
110
|
+
}
|
|
111
|
+
function _(e) {
|
|
112
|
+
let t = /* @__PURE__ */ new Set();
|
|
113
|
+
for (let n of e) {
|
|
114
|
+
let e = h.get(n);
|
|
115
|
+
e && t.add(e);
|
|
116
|
+
}
|
|
117
|
+
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`;
|
|
118
|
+
}
|
|
119
|
+
var v = "https://cdn.jsdelivr.net/npm/@charisol/plexo-sdk@latest/dist/social-icons", y = /* @__PURE__ */ new Set([
|
|
120
|
+
"selectable",
|
|
121
|
+
"draggable",
|
|
122
|
+
"duplicatable",
|
|
123
|
+
"deletable",
|
|
124
|
+
"hideable",
|
|
125
|
+
"locked"
|
|
126
|
+
]), b = (e) => String(e ?? "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), x = (e = {}) => Object.entries(e).filter(([, e]) => e != null && String(e).trim() !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}:${String(t)};`).join(""), S = (...e) => e.map((e) => String(e ?? "").trim()).filter(Boolean).join(" "), C = (e, t, n, r) => n ? S(e, d, m(t), r) : e, w = (e, t, n) => {
|
|
127
|
+
let r = C("", e, t, n);
|
|
128
|
+
return r ? ` css-class="${b(r)}"` : "";
|
|
129
|
+
}, T = (e, t, n) => {
|
|
130
|
+
let r = C("", e, t, n);
|
|
131
|
+
return r ? ` class="${b(r)}"` : "";
|
|
132
|
+
}, E = (e, t) => {
|
|
133
|
+
let n = { ...e.attributes || {} };
|
|
134
|
+
if (t === "email") for (let e of y) delete n[e];
|
|
135
|
+
return n;
|
|
136
|
+
}, D = (e, t, n) => {
|
|
137
|
+
let r = E(e, t), i = x(e.style || {}), a = C(S(r.htmlClassNames, r.htmlClass, r.validationClass, r.validationClassName), e.id, t === "landing_page" && n), o = b(r.name || r.fieldName || "field"), s = b(r.placeholder || ""), c = r.required ? " required" : "";
|
|
138
|
+
if (t === "email") return `<mj-table${w(e.id, n)}><tr><td style="padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;${i}">${s || o}</td></tr></mj-table>`;
|
|
139
|
+
let l = b(r.inputType || r.type || (e.type === "input" ? r.kind || "text" : e.type)), u = r.htmlId ? ` id="${b(r.htmlId)}"` : "", d = a ? ` class="${b(a)}"` : "";
|
|
140
|
+
return e.type === "textarea" ? `<textarea${u}${d} name="${o}" placeholder="${s}" style="${i}"${c}>${b(r.value || "")}</textarea>` : e.type === "select" ? `<select${u}${d} name="${o}" style="${i}"${c}>${(r.options || []).map((e) => `<option value="${b(e.value)}">${b(e.label)}</option>`).join("")}</select>` : `<input${u}${d} type="${l}" name="${o}" placeholder="${s}" value="${b(r.value || "")}" style="${i}"${c} />`;
|
|
141
|
+
}, O = (e, t, n) => {
|
|
142
|
+
let r = E(e, t), i = x(e.style || {}), a = C(S(r.htmlClassNames, r.htmlClass), e.id, t === "landing_page" && n), o = r.htmlId ? ` id="${b(r.htmlId)}"` : "", s = a ? ` class="${b(a)}"` : "", c = b(r.actionUrl || r.action || "#"), l = b(r.method || "POST"), u = r.fields || [], d = b(r.submitLabel || "Submit");
|
|
143
|
+
return t === "email" ? `<mj-table${w(e.id, n)}><tr><td style="${i}"><table role="presentation" width="100%">${u.map((e) => `<tr><td style="padding:8px 0;font-family:Arial,sans-serif;color:#334155;"><strong>${b(e.label || e.name || "Field")}</strong><br/><span style="display:inline-block;margin-top:4px;padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;color:#64748b;">${b(e.placeholder || "") || " "}</span></td></tr>`).join("")}<tr><td style="padding-top:12px;"><a href="${b(r.href || r.submitHref || "#")}" style="display:inline-block;padding:10px 16px;background:#0f172a;color:#ffffff;text-decoration:none;border-radius:6px;">${d}</a></td></tr></table></td></tr></mj-table>` : `<form${o}${s} action="${c}" method="${l}" style="${i}">${u.map((t) => D({
|
|
144
|
+
id: `${e.id}-${String(t.name || t.label || "field")}`,
|
|
145
|
+
type: t.kind === "textarea" || t.kind === "select" ? t.kind : "input",
|
|
146
|
+
style: {
|
|
147
|
+
...e.style || {},
|
|
148
|
+
...t.style || {}
|
|
149
|
+
},
|
|
150
|
+
attributes: t
|
|
151
|
+
}, "landing_page", n)).join("")}<button type="submit">${d}</button></form>`;
|
|
152
|
+
}, k = [], A = !1, j = 148, M = [
|
|
153
|
+
["borderRadius", "border-radius"],
|
|
154
|
+
["borderWidth", "border-width"],
|
|
155
|
+
["borderStyle", "border-style"],
|
|
156
|
+
["borderColor", "border-color"],
|
|
157
|
+
["boxShadow", "box-shadow"]
|
|
158
|
+
], N = (e, t, n = []) => {
|
|
159
|
+
let r = [...M.filter(([t]) => e[t]).map(([t, n]) => `${n}: ${b(String(e[t]))}`), ...n];
|
|
160
|
+
if (r.length === 0) return "";
|
|
161
|
+
let i = `plexo-extra-style-${t}`;
|
|
162
|
+
return k.push(`.${i} { ${r.join("; ")}; }`), i;
|
|
163
|
+
}, P = (e = {}, t = {}) => {
|
|
164
|
+
let n = ["padding=\"0\""], r = e.fontSize || t.fontSize, i = e.fontWeight || t.fontWeight;
|
|
165
|
+
return r && n.push(`font-size="${b(String(r))}"`), i && n.push(`font-weight="${b(String(i))}"`), e.color && n.push(`color="${b(String(e.color))}"`), e.fontFamily && n.push(`font-family="${b(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${b(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${b(String(e.letterSpacing))}"`), n.join(" ");
|
|
166
|
+
}, F = (e = {}) => {
|
|
167
|
+
let t = e.backgroundColor || e.background;
|
|
168
|
+
return t ? ` background-color="${b(String(t))}"` : "";
|
|
169
|
+
}, I = (e, t, n) => {
|
|
170
|
+
if (e[t]) return String(e[t]);
|
|
171
|
+
let [r, i, a, o] = n;
|
|
172
|
+
if (e[r] || e[i] || e[a] || e[o]) return `${e[r] || "0px"} ${e[i] || "0px"} ${e[a] || "0px"} ${e[o] || "0px"}`;
|
|
173
|
+
}, L = (e = {}) => {
|
|
174
|
+
let t = [];
|
|
175
|
+
e.backgroundColor && t.push(`background-color="${b(String(e.backgroundColor))}"`), e.color && t.push(`color="${b(String(e.color))}"`), e.fontSize && t.push(`font-size="${b(String(e.fontSize))}"`), e.fontWeight && t.push(`font-weight="${b(String(e.fontWeight))}"`), e.fontFamily && t.push(`font-family="${b(String(e.fontFamily))}"`), e.lineHeight && t.push(`line-height="${b(String(e.lineHeight))}"`), e.letterSpacing && t.push(`letter-spacing="${b(String(e.letterSpacing))}"`), e.textAlign && t.push(`align="${b(String(e.textAlign))}"`);
|
|
176
|
+
let n = I(e, "borderRadius", [
|
|
177
|
+
"borderTopLeftRadius",
|
|
178
|
+
"borderTopRightRadius",
|
|
179
|
+
"borderBottomRightRadius",
|
|
180
|
+
"borderBottomLeftRadius"
|
|
181
|
+
]);
|
|
182
|
+
return n && t.push(`border-radius="${b(n)}"`), t.join(" ");
|
|
183
|
+
}, R = (l, d, f) => {
|
|
184
|
+
let p = E(l, d), m = x(l.style || {}), h = p.htmlId ? ` id="${b(p.htmlId)}"` : "", g = S(p.htmlClassNames, p.htmlClass, d === "landing_page" && p.hideOnMobile ? "hidden md:block" : ""), _ = d === "landing_page" ? C(g, l.id, f) : g, y = _ ? ` class="${b(_)}"` : "", A = typeof p.customCss == "string" && p.customCss.trim() ? p.customCss.trim() : "", j = A && d === "landing_page" ? `<style>${A}</style>` : "";
|
|
185
|
+
if (l.type === "form_container") return `${j}${O(l, d, f)}`;
|
|
186
|
+
if (l.type === "input" || l.type === "select" || l.type === "textarea") return `${j}${D(l, d, f)}`;
|
|
187
|
+
if (d === "email") {
|
|
188
|
+
if (l.type === "button") {
|
|
189
|
+
let e = b(p.href || "#"), t = b(p.text || "Button"), n = a(l).width, r = n === "auto" ? "" : ` width="${b(n)}"`, i = l.style || {}, o = L(i), s = I(i, "padding", [
|
|
190
|
+
"paddingTop",
|
|
191
|
+
"paddingRight",
|
|
192
|
+
"paddingBottom",
|
|
193
|
+
"paddingLeft"
|
|
194
|
+
]) || "10px 16px";
|
|
195
|
+
return `<mj-button href="${e}" css-class="${C(p.hideOnDesktop ? "desktop-hide" : "", l.id, f)}" padding="0" inner-padding="${b(s)}"${r}${o ? ` ${o}` : ""}>${t}</mj-button>`;
|
|
196
|
+
}
|
|
197
|
+
if (l.type === "image") {
|
|
198
|
+
let e = c(l), t = e.width && e.width !== "100%" ? ` width="${b(e.width)}"` : "", n = e.height && e.height !== "auto" ? ` height="${b(e.height)}"` : "", r = w(l.id, f);
|
|
199
|
+
return `<mj-image src="${b(p.src || "")}" alt="${b(p.alt || "")}"${t}${n}${r} />`;
|
|
200
|
+
}
|
|
201
|
+
if (l.type === "social") {
|
|
202
|
+
let e = t(l);
|
|
203
|
+
if (!e.length) return "";
|
|
204
|
+
let n = l.style || {}, r = n.textAlign === "center" ? "center" : n.textAlign === "right" ? "flex-end" : "flex-start", i = n.iconSpacing || "8px", a = I(n, "padding", [
|
|
205
|
+
"paddingTop",
|
|
206
|
+
"paddingRight",
|
|
207
|
+
"paddingBottom",
|
|
208
|
+
"paddingLeft"
|
|
209
|
+
]) || "8px", o = I(n, "margin", [
|
|
210
|
+
"marginTop",
|
|
211
|
+
"marginRight",
|
|
212
|
+
"marginBottom",
|
|
213
|
+
"marginLeft"
|
|
214
|
+
]), s = (e) => e === "square" ? "14px" : "9999px", c = e.map((e) => {
|
|
215
|
+
let t = `<img src="${`${v}/${u[e.provider] ? e.provider : "fallback"}.png`}" alt="" width="${parseInt(e.size, 10) || 36}" style="display:block;width:60%;height:60%;border:0;" />`;
|
|
216
|
+
return `<a href="${b(e.url)}" style="display:inline-flex;align-items:center;justify-content:center;width:${b(e.size)};height:${b(e.size)};background-color:${b(e.backgroundColor)};border-radius:${s(e.iconType)};text-decoration:none;">${t}</a>`;
|
|
217
|
+
}).join(""), d = `display:flex;flex-wrap:wrap;justify-content:${r};gap:${b(String(i))};padding:${b(a)};${o ? `margin:${b(o)};` : ""}`;
|
|
218
|
+
return `<mj-raw><tr><td style="font-size:16px;"><div${T(l.id, f)} style="${d}">${c}</div></td></tr></mj-raw>`;
|
|
219
|
+
}
|
|
220
|
+
if (l.type === "menu") {
|
|
221
|
+
let t = e(l);
|
|
222
|
+
return `<mj-navbar hamburger="hamburger"${w(l.id, f)}>${t.map((e) => `<mj-navbar-link href="${b(e.href)}">${b(e.label)}</mj-navbar-link>`).join("")}</mj-navbar>`;
|
|
223
|
+
}
|
|
224
|
+
if (l.type === "table") {
|
|
225
|
+
let e = o(l), t = l.style || {}, n = `${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#cbd5e1"}`, r = (r, i, a, o) => {
|
|
226
|
+
let s = o ? "th" : "td", c = o ? t.headerBgColor || "#f8fafc" : e.striped && i % 2 == 1 ? "#f8fafc" : t.contentBgColor || "#ffffff", u = o ? t.headerTextColor || "#1e293b" : t.contentTextColor || "#475569";
|
|
227
|
+
return `<tr>${r.map((e, r) => {
|
|
228
|
+
let i = f ? ` data-plexo-cell="${b(l.id)}|${a}-${r}"` : "";
|
|
229
|
+
return `<${s}${i} style="padding: ${t.cellPadding || "8px"}; border: ${n}; background-color: ${c}; color: ${u};">${b(e) || " "}</${s}>`;
|
|
230
|
+
}).join("")}</tr>`;
|
|
231
|
+
}, i = +!!e.enableHeader, a = e.enableFooter ? e.cells.length - 1 : e.cells.length, s = e.enableHeader && e.cells.length > 0 ? `<thead>${r(e.cells[0], 0, 0, !0)}</thead>` : "", c = e.cells.slice(i, Math.max(i, a)).map((e, t) => r(e, t, i + t, !1)).join(""), u = e.enableFooter && e.cells.length > i ? `<tfoot>${r(e.cells[e.cells.length - 1], e.cells.length - 1, e.cells.length - 1, !1)}</tfoot>` : "";
|
|
232
|
+
return `<mj-table${w(l.id, f)}><table role="presentation" style="border-collapse: collapse; width: 100%;">${s}<tbody>${c}</tbody>${u}</table></mj-table>`;
|
|
233
|
+
}
|
|
234
|
+
if (l.type === "video") {
|
|
235
|
+
let e = n(p.videoUrl), t = p.linkType === "email" ? `mailto:${p.href || ""}` : p.href || p.videoUrl || "#", r = w(l.id, f);
|
|
236
|
+
return `<mj-image src="${b(e.thumbnailUrl)}" href="${b(t)}" alt="${b(p.alt || "Video preview")}"${r} />`;
|
|
237
|
+
}
|
|
238
|
+
if (l.type === "timer") {
|
|
239
|
+
let e = r(p.targetDate, p.timezone), t = p.showLabels !== !1;
|
|
240
|
+
return `<mj-text align="center"${w(l.id, f)}><div style="font-size: 28px; font-weight: 800;">${e.days}d ${e.hours}h ${e.minutes}m ${e.seconds}s</div>${t ? `<div style="font-size: 12px; color: #64748b;">Countdown to ${b(p.targetDate || "")}</div>` : ""}</mj-text>`;
|
|
241
|
+
}
|
|
242
|
+
if (l.type === "carousel") {
|
|
243
|
+
let e = Array.isArray(p.images) ? p.images : [], t = w(l.id, f);
|
|
244
|
+
return e.length === 0 ? `<mj-text align="center"${t}>No images in carousel</mj-text>` : `<mj-carousel${t}>${e.map((e) => `<mj-carousel-image src="${b(e.src)}" alt="${b(e.alt || "")}" />`).join("")}</mj-carousel>`;
|
|
245
|
+
}
|
|
246
|
+
if (l.type === "icon") {
|
|
247
|
+
let e = parseInt(String(p.iconSize || 48), 10) || 48, t = l.style?.color || "#1e293b", n = s(p.iconName, e, t);
|
|
248
|
+
return `<mj-text align="center"${w(l.id, f)}>${n}</mj-text>`;
|
|
249
|
+
}
|
|
250
|
+
let d = C(p.hideOnDesktop ? "desktop-hide" : "", l.id, f);
|
|
251
|
+
if (l.type === "heading" || l.type === "paragraph" || l.type === "text") {
|
|
252
|
+
let e = l.type === "heading" ? {
|
|
253
|
+
fontSize: "24px",
|
|
254
|
+
fontWeight: "700"
|
|
255
|
+
} : { fontSize: "14px" }, t = l.style || {}, n = P(t, e), r = i(l).autoWidth, a = String(p.boxAlign || "left"), o = /* @__PURE__ */ new Set([
|
|
256
|
+
"fontSize",
|
|
257
|
+
"fontWeight",
|
|
258
|
+
"color",
|
|
259
|
+
"fontFamily",
|
|
260
|
+
"lineHeight",
|
|
261
|
+
"letterSpacing",
|
|
262
|
+
"textAlign"
|
|
263
|
+
]), s = Object.entries(t).filter(([e, t]) => !o.has(e) && e !== "width" && t != null && t !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${b(String(t))}`);
|
|
264
|
+
r ? s.push("display: inline-block") : t.width && s.push(`width: ${b(String(t.width))}`), t.height && s.push("overflow: hidden"), (t.textAlign || a !== "left") && s.push(`text-align: ${b(String(t.textAlign || "left"))} !important`);
|
|
265
|
+
let c = "";
|
|
266
|
+
s.length > 0 && (c = `plexo-textbox-${l.id}`, k.push(`.${c} > div { ${s.join("; ")}; }`));
|
|
267
|
+
let u = S(c, d);
|
|
268
|
+
return `<mj-text${n ? ` ${n}` : ""} align="${b(a)}" css-class="${u}">${p.text || ""}</mj-text>`;
|
|
269
|
+
}
|
|
270
|
+
if (l.type === "spacer") {
|
|
271
|
+
let e = l.style?.height || "24px", t = w(l.id, f);
|
|
272
|
+
return `<mj-spacer height="${b(String(e))}"${t} />`;
|
|
273
|
+
}
|
|
274
|
+
if (l.type === "divider") {
|
|
275
|
+
let e = l.style || {}, t = w(l.id, f);
|
|
276
|
+
return `<mj-divider border-width="${b(String(e.borderWidth || "1px"))}" border-style="${b(String(e.borderStyle || "solid"))}" border-color="${b(String(e.borderColor || "#334155"))}"${t} />`;
|
|
277
|
+
}
|
|
278
|
+
return l.type === "card" ? `<mj-text css-class="${d}"><strong style="display:block;margin-bottom:8px;">${b(p.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${b(p.description || "Card description.")}</span></mj-text>` : l.type === "html" ? `<mj-text css-class="${d}">${p.htmlContent || p.text || ""}</mj-text>` : `<mj-text${h}${y} css-class="${d}">${b(p.text || p.htmlContent || "")}</mj-text>`;
|
|
279
|
+
}
|
|
280
|
+
if (l.type === "heading" || l.type === "paragraph" || l.type === "text") {
|
|
281
|
+
let e = l.style || {}, t = i(l).autoWidth, n = String(p.boxAlign || "left"), r = x(t ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== "width")) : e), a = t || !!e.width, o = a ? "display:inline-block;" : "", s = l.type === "heading" ? "h2" : "p", c = l.type === "heading" ? "Heading" : "", u = `${j}<${s}${h}${y} style="${o}${r}">${b(p.text || c)}</${s}>`;
|
|
282
|
+
return a ? `<div style="text-align:${b(n)};">${u}</div>` : u;
|
|
283
|
+
}
|
|
284
|
+
switch (l.type) {
|
|
285
|
+
case "button": return `${j}<a${h}${y} href="${b(p.href || "#")}" style="${m}">${b(p.text || "Button")}</a>`;
|
|
286
|
+
case "image": return `${j}<img${h}${y} src="${b(p.src || "")}" alt="${b(p.alt || "")}" style="${m}" />`;
|
|
287
|
+
case "html": return `${j}<div${h}${y} style="${m}">${String(p.htmlContent || "")}</div>`;
|
|
288
|
+
case "social": {
|
|
289
|
+
let e = l.style || {}, n = t(l), r = e.textAlign === "center" ? "center" : e.textAlign === "right" ? "flex-end" : "flex-start";
|
|
290
|
+
return `${j}<div${h}${y} style="${x({
|
|
291
|
+
padding: e.padding,
|
|
292
|
+
margin: e.margin,
|
|
293
|
+
display: "flex",
|
|
294
|
+
flexWrap: "wrap",
|
|
295
|
+
gap: e.iconSpacing || "8px",
|
|
296
|
+
justifyContent: r
|
|
297
|
+
})}">${n.map((e) => {
|
|
298
|
+
let t = `${v}/${u[e.provider] ? e.provider : "fallback"}.png`, n = x({
|
|
299
|
+
width: e.size,
|
|
300
|
+
height: e.size,
|
|
301
|
+
padding: "8px",
|
|
302
|
+
borderRadius: e.iconType === "square" ? "14px" : "9999px",
|
|
303
|
+
backgroundColor: e.backgroundColor,
|
|
304
|
+
display: "inline-flex",
|
|
305
|
+
alignItems: "center",
|
|
306
|
+
justifyContent: "center",
|
|
307
|
+
overflow: "hidden"
|
|
308
|
+
}), r = `<img src="${b(t)}" alt="" width="${parseInt(e.size, 10) || 36}" style="display:block;width:60%;height:60%;border:0;" />`;
|
|
309
|
+
return `<a href="${b(e.url)}" style="${n}text-decoration:none;">${r}</a>`;
|
|
310
|
+
}).join("")}</div>`;
|
|
311
|
+
}
|
|
312
|
+
case "menu": {
|
|
313
|
+
let t = l.style || {}, n = e(l), r = t.textAlign === "center" ? "center" : t.textAlign === "right" ? "flex-end" : "flex-start";
|
|
314
|
+
return `${j}<div${h}${y} style="${x({
|
|
315
|
+
...t,
|
|
316
|
+
display: "flex",
|
|
317
|
+
flexWrap: "wrap",
|
|
318
|
+
gap: "16px",
|
|
319
|
+
justifyContent: r
|
|
320
|
+
})}">${n.map((e) => `<a href="${b(e.href)}" style="text-decoration:none;color:inherit;font-weight:${b(String(t.fontWeight || 600))};">${b(e.label)}</a>`).join("")}</div>`;
|
|
321
|
+
}
|
|
322
|
+
case "blog_title":
|
|
323
|
+
case "blog_content":
|
|
324
|
+
case "blog_featured_image":
|
|
325
|
+
case "blog_date":
|
|
326
|
+
case "blog_author":
|
|
327
|
+
case "blog_categories":
|
|
328
|
+
case "blog_comments":
|
|
329
|
+
case "blog_post_list": return `${j}<div${h}${y} data-plexo-blog-${l.type.replace(/^blog_/, "").replace(/_([a-z])/g, (e, t) => t.toUpperCase())}="true"${p.prefix ? ` data-plexo-blog-prefix="${b(p.prefix)}"` : ""} style="${m}"></div>`;
|
|
330
|
+
case "product":
|
|
331
|
+
case "booking":
|
|
332
|
+
case "shop_grid":
|
|
333
|
+
case "cart_summary":
|
|
334
|
+
case "checkout_flow":
|
|
335
|
+
case "order_confirmation":
|
|
336
|
+
case "order_tracking": return `${j}<div${h}${y} data-plexo-commerce-${l.type.replace(/_([a-z])/g, (e, t) => t.toUpperCase())}="true"${p.productId ? ` data-plexo-product-id="${b(p.productId)}"` : ""}${p.serviceId ? ` data-plexo-service-id="${b(p.serviceId)}"` : ""} style="${m}"></div>`;
|
|
337
|
+
default: return `${j}<div${h}${y} style="${m}">${b(p.text || "")}</div>`;
|
|
338
|
+
}
|
|
339
|
+
}, z = (e, t, n) => {
|
|
340
|
+
if (t === "email") {
|
|
341
|
+
let r = new Map(e.elements.map((e) => [e.id, e])), i = new Map((Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => [e.id, e])), a = l(e).map((e) => {
|
|
342
|
+
let a = r.get(e);
|
|
343
|
+
if (a) return R(a, t, n);
|
|
344
|
+
let o = i.get(e);
|
|
345
|
+
return o ? `<mj-raw><tr><td style="font-size:16px;">${B(o, "landing_page", n)}</td></tr></mj-raw>` : "";
|
|
346
|
+
}).join(""), o = F(e.styles || {}), s = e.elements.length === 0 && (!Array.isArray(e.nestedRows) || e.nestedRows.length === 0), c = S(A && s ? N({}, e.id, [`min-height: ${j}px`]) : "", C("", e.id, n, p)), u = c ? ` css-class="${b(c)}"` : "";
|
|
347
|
+
return `<mj-column width="${b(e.width || "100%")}" padding="0"${o}${u}>${a}</mj-column>`;
|
|
348
|
+
}
|
|
349
|
+
let r = x(e.styles || {}), i = new Map(e.elements.map((e) => [e.id, e])), a = new Map((Array.isArray(e.nestedRows) ? e.nestedRows : []).map((e) => [e.id, e])), o = l(e).map((e) => {
|
|
350
|
+
let r = i.get(e);
|
|
351
|
+
if (r) return R(r, t, n);
|
|
352
|
+
let o = a.get(e);
|
|
353
|
+
return o ? B(o, t, n) : "";
|
|
354
|
+
}).join(""), s = T(e.id, n, p), c = e.elements.length === 0 && (!Array.isArray(e.nestedRows) || e.nestedRows.length === 0), u = A && c ? `min-height: ${j}px;` : "";
|
|
355
|
+
return `<div${s} style="width:${b(e.width || "100%")};${u}${r}">${o}</div>`;
|
|
356
|
+
}, B = (e, t, n) => {
|
|
357
|
+
if (t === "email") return `<mj-section css-class="${C(e.style?.hideOnDesktop ? "desktop-hide" : "", e.id, n, f)}"${F(e.style || {})} padding="0">${e.columns.map((e) => z(e, t, n)).join("")}</mj-section>`;
|
|
358
|
+
let r = x(e.style || {}), i = e.columns.map((e) => z(e, t, n)).join("");
|
|
359
|
+
return `<section${T(e.id, n, f)} style="display:flex;flex-wrap:wrap;${r}">${i}</section>`;
|
|
360
|
+
}, V = (e, t, n) => {
|
|
361
|
+
let r = n?.instrument ?? !1;
|
|
362
|
+
k = [], A = n?.canvasEditorPadding ?? !1;
|
|
363
|
+
let i = (e.body?.rows || []).map((e) => B(e, t, r)).join(""), a = x(e.body?.style || {});
|
|
364
|
+
if (t === "email") {
|
|
365
|
+
let t = k.length > 0 ? ` ${k.join(" ")}` : "", n = _(g(e.body?.rows, [e.body?.style?.fontFamily]));
|
|
366
|
+
return `<mjml><mj-head>${n ? `<mj-font name="PlexoGoogleFonts" href="${b(n)}" />` : ""}<mj-style>.desktop-hide { display:none !important; max-height:0; overflow:hidden; }${t}</mj-style></mj-head><mj-body><mj-section><mj-column><mj-text css-class="preheader" padding="0" font-size="1px" color="#ffffff"> </mj-text></mj-column></mj-section>${i}</mj-body></mjml>`.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1");
|
|
367
|
+
}
|
|
368
|
+
return `<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /></head><body style="${a}"><main>${i}</main></body></html>`;
|
|
369
|
+
};
|
|
370
|
+
//#endregion
|
|
371
|
+
export { V as t };
|
package/dist/compilerClient.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./compilerClient-
|
|
1
|
+
import { t as e } from "./compilerClient-DNKp-n6N.js";
|
|
2
2
|
export { e as parseJsonToTargetFormat };
|
|
@@ -66,4 +66,11 @@ export declare const ICONS: {
|
|
|
66
66
|
blogCategories: import("react").JSX.Element;
|
|
67
67
|
blogComments: import("react").JSX.Element;
|
|
68
68
|
blogPostList: import("react").JSX.Element;
|
|
69
|
+
commerceProduct: import("react").JSX.Element;
|
|
70
|
+
commerceBooking: import("react").JSX.Element;
|
|
71
|
+
commerceShopGrid: import("react").JSX.Element;
|
|
72
|
+
commerceCart: import("react").JSX.Element;
|
|
73
|
+
commerceCheckout: import("react").JSX.Element;
|
|
74
|
+
commerceOrderConfirmation: import("react").JSX.Element;
|
|
75
|
+
commerceOrderTracking: import("react").JSX.Element;
|
|
69
76
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The one-click part of the `product`/`booking` marker blocks: a dropdown of this site's
|
|
4
|
+
* real, live products/services (fetched by PlexoBuilder.tsx into the `commerceProducts`
|
|
5
|
+
* prop the same way `sitePages` already is), setting attrs.productId/serviceId on
|
|
6
|
+
* selection. No id-copying, no snippet-pasting — pick a product, done. `product` only
|
|
7
|
+
* offers PHYSICAL/SERVICE items sold outright; `booking` only offers SERVICE items (a
|
|
8
|
+
* consultation), since a booking card doesn't make sense for a physical product.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CommerceProductPropertiesAccordion: React.FC<any>;
|
|
@@ -7,6 +7,12 @@ interface ContentTabProps {
|
|
|
7
7
|
templateKind?: "landing_page" | "email" | string;
|
|
8
8
|
/** Shows the "Blog" block group below the regular palette — see PlexoBuilderProps.isBlogLayout. */
|
|
9
9
|
isBlogLayout?: boolean;
|
|
10
|
+
/** Shows the "Commerce" block group below the regular palette — true whenever the host
|
|
11
|
+
* app's current site/org has Commerce enabled (see PlexoBuilderProps.commerceEnabled).
|
|
12
|
+
* Unlike isBlogLayout, this isn't tied to a special template type: a Product or Booking
|
|
13
|
+
* card is a reasonable thing to drop on any ordinary page, so the gate is "does this
|
|
14
|
+
* site sell anything," not "is this a special commerce-only template." */
|
|
15
|
+
commerceEnabled?: boolean;
|
|
10
16
|
onTapAdd?: (data: any) => void;
|
|
11
17
|
}
|
|
12
18
|
export declare const ContentTab: React.FC<ContentTabProps>;
|