@charisol/plexo-sdk 1.0.9 → 1.0.11
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.js +292 -216
- package/dist/components/SidebarContainer.d.ts +4 -0
- package/dist/components/sidebarTabs/BlocksTab.d.ts +1 -0
- package/dist/components/sidebarTabs/ContentTab.d.ts +1 -0
- package/dist/index.js +13552 -13367
- package/dist/plexo-sdk.css +1 -1
- package/dist/utilities/compiler.d.ts +6 -14
- package/dist/utilities/playground.interfaces.d.ts +4 -0
- package/dist/utilities/useViewportWidth.d.ts +14 -0
- package/package.json +1 -1
package/dist/compiler.js
CHANGED
|
@@ -1,49 +1,233 @@
|
|
|
1
1
|
//#region src/utilities/compiler.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
case "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (!e || typeof e != "object") return null;
|
|
4
|
+
if (Array.isArray(e.columns) && e.columns.length > 0) return e;
|
|
5
|
+
let t = (e.type || "").toLowerCase(), n = e.props || e.content || e.attributes || e.data || e.payload || e, r = e.style || {};
|
|
6
|
+
switch (t) {
|
|
7
|
+
case "hero": {
|
|
8
|
+
let t = n.headline || n.title || n.text || "Build faster. Scale smarter.", i = n.subheadline || n.description || n.subtitle || "", a = n.primaryButton || n.button || n.cta || "Get Started", o = n.secondaryButton || "", s = [{
|
|
9
|
+
type: "heading",
|
|
10
|
+
style: {
|
|
11
|
+
fontSize: "48px",
|
|
12
|
+
fontWeight: "800",
|
|
13
|
+
textAlign: "center",
|
|
14
|
+
marginBottom: "16px"
|
|
15
|
+
},
|
|
16
|
+
attributes: { text: t }
|
|
17
|
+
}];
|
|
18
|
+
return i && s.push({
|
|
19
|
+
type: "paragraph",
|
|
20
|
+
style: {
|
|
21
|
+
fontSize: "18px",
|
|
22
|
+
color: "#94a3b8",
|
|
23
|
+
textAlign: "center",
|
|
24
|
+
maxWidth: "700px",
|
|
25
|
+
margin: "0 auto 32px auto"
|
|
26
|
+
},
|
|
27
|
+
attributes: { text: i }
|
|
28
|
+
}), a && s.push({
|
|
29
|
+
type: "button",
|
|
30
|
+
style: {
|
|
31
|
+
textAlign: "center",
|
|
32
|
+
backgroundColor: "#8b5cf6",
|
|
33
|
+
color: "#ffffff",
|
|
34
|
+
borderRadius: "12px",
|
|
35
|
+
paddingTop: "14px",
|
|
36
|
+
paddingBottom: "14px",
|
|
37
|
+
paddingLeft: "28px",
|
|
38
|
+
paddingRight: "28px",
|
|
39
|
+
fontSize: "16px",
|
|
40
|
+
fontWeight: "600"
|
|
41
|
+
},
|
|
42
|
+
attributes: {
|
|
43
|
+
text: a,
|
|
44
|
+
href: "#signup"
|
|
45
|
+
}
|
|
46
|
+
}), o && s.push({
|
|
47
|
+
type: "button",
|
|
48
|
+
style: {
|
|
49
|
+
textAlign: "center",
|
|
50
|
+
backgroundColor: "rgba(255,255,255,0.1)",
|
|
51
|
+
color: "#ffffff",
|
|
52
|
+
borderRadius: "12px",
|
|
53
|
+
paddingTop: "14px",
|
|
54
|
+
paddingBottom: "14px",
|
|
55
|
+
paddingLeft: "28px",
|
|
56
|
+
paddingRight: "28px",
|
|
57
|
+
fontSize: "16px",
|
|
58
|
+
fontWeight: "600",
|
|
59
|
+
marginLeft: "12px"
|
|
60
|
+
},
|
|
61
|
+
attributes: {
|
|
62
|
+
text: o,
|
|
63
|
+
href: "#demo"
|
|
64
|
+
}
|
|
65
|
+
}), {
|
|
66
|
+
id: e.id || `row-hero-${Math.random().toString(36).substring(2, 7)}`,
|
|
67
|
+
style: {
|
|
68
|
+
paddingTop: "80px",
|
|
69
|
+
paddingBottom: "80px",
|
|
70
|
+
textAlign: "center",
|
|
71
|
+
...r
|
|
72
|
+
},
|
|
73
|
+
columns: [{
|
|
74
|
+
id: `col-hero-${Math.random().toString(36).substring(2, 7)}`,
|
|
75
|
+
width: "100%",
|
|
76
|
+
elements: s
|
|
77
|
+
}]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
case "features": {
|
|
81
|
+
let t = n.title || n.headline || "Features", i = Array.isArray(n.items) ? n.items : Array.isArray(n.features) ? n.features : [], a = [{
|
|
82
|
+
type: "heading",
|
|
83
|
+
style: {
|
|
84
|
+
fontSize: "32px",
|
|
85
|
+
fontWeight: "700",
|
|
86
|
+
textAlign: "center",
|
|
87
|
+
marginBottom: "40px"
|
|
88
|
+
},
|
|
89
|
+
attributes: { text: t }
|
|
90
|
+
}], o = [];
|
|
91
|
+
if (i.length > 0) {
|
|
92
|
+
let e = i.length === 2 ? "50%" : i.length >= 3 ? "33.33%" : "100%";
|
|
93
|
+
i.forEach((t, n) => {
|
|
94
|
+
let r = typeof t == "string" ? t : t.title || t.name || `Feature ${n + 1}`, i = typeof t == "string" ? "" : t.description || t.text || "";
|
|
95
|
+
o.push({
|
|
96
|
+
id: `col-feat-${n}`,
|
|
97
|
+
width: e,
|
|
98
|
+
elements: [{
|
|
99
|
+
type: "card",
|
|
100
|
+
style: {
|
|
101
|
+
backgroundColor: "#111827",
|
|
102
|
+
borderRadius: "16px",
|
|
103
|
+
padding: "24px",
|
|
104
|
+
borderWidth: "1px",
|
|
105
|
+
borderColor: "rgba(255,255,255,0.08)"
|
|
106
|
+
},
|
|
107
|
+
attributes: {
|
|
108
|
+
title: r,
|
|
109
|
+
description: i || "Powerful functionality built for performance and scale."
|
|
110
|
+
}
|
|
111
|
+
}]
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
id: e.id || `row-features-${Math.random().toString(36).substring(2, 7)}`,
|
|
117
|
+
style: {
|
|
118
|
+
paddingTop: "60px",
|
|
119
|
+
paddingBottom: "60px",
|
|
120
|
+
...r
|
|
121
|
+
},
|
|
122
|
+
columns: o.length > 0 ? o : [{
|
|
123
|
+
id: "col-feat-fallback",
|
|
124
|
+
width: "100%",
|
|
125
|
+
elements: a
|
|
126
|
+
}]
|
|
127
|
+
};
|
|
39
128
|
}
|
|
40
|
-
|
|
41
|
-
let
|
|
42
|
-
return
|
|
129
|
+
case "cta": {
|
|
130
|
+
let t = n.headline || n.title || "Ready to transform your workflow?", i = n.button || n.primaryButton || n.cta || "Get Started";
|
|
131
|
+
return {
|
|
132
|
+
id: e.id || `row-cta-${Math.random().toString(36).substring(2, 7)}`,
|
|
133
|
+
style: {
|
|
134
|
+
backgroundColor: "rgba(139, 92, 246, 0.12)",
|
|
135
|
+
borderRadius: "24px",
|
|
136
|
+
padding: "48px",
|
|
137
|
+
textAlign: "center",
|
|
138
|
+
marginTop: "40px",
|
|
139
|
+
marginBottom: "60px",
|
|
140
|
+
borderWidth: "1px",
|
|
141
|
+
borderColor: "rgba(139, 92, 246, 0.3)",
|
|
142
|
+
...r
|
|
143
|
+
},
|
|
144
|
+
columns: [{
|
|
145
|
+
id: `col-cta-${Math.random().toString(36).substring(2, 7)}`,
|
|
146
|
+
width: "100%",
|
|
147
|
+
elements: [{
|
|
148
|
+
type: "heading",
|
|
149
|
+
style: {
|
|
150
|
+
fontSize: "32px",
|
|
151
|
+
color: "#ffffff",
|
|
152
|
+
fontWeight: "700",
|
|
153
|
+
textAlign: "center",
|
|
154
|
+
marginBottom: "20px"
|
|
155
|
+
},
|
|
156
|
+
attributes: { text: t }
|
|
157
|
+
}, {
|
|
158
|
+
type: "button",
|
|
159
|
+
style: {
|
|
160
|
+
textAlign: "center",
|
|
161
|
+
backgroundColor: "#8b5cf6",
|
|
162
|
+
color: "#ffffff",
|
|
163
|
+
borderRadius: "12px",
|
|
164
|
+
paddingTop: "14px",
|
|
165
|
+
paddingBottom: "14px",
|
|
166
|
+
paddingLeft: "28px",
|
|
167
|
+
paddingRight: "28px",
|
|
168
|
+
fontWeight: "700"
|
|
169
|
+
},
|
|
170
|
+
attributes: {
|
|
171
|
+
text: i,
|
|
172
|
+
href: "#signup"
|
|
173
|
+
}
|
|
174
|
+
}]
|
|
175
|
+
}]
|
|
176
|
+
};
|
|
43
177
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
178
|
+
default: {
|
|
179
|
+
let t = n.headline || n.title || n.text || "", i = n.subheadline || n.description || n.subtitle || "", a = n.button || n.primaryButton || n.cta || "", o = [];
|
|
180
|
+
return t && o.push({
|
|
181
|
+
type: "heading",
|
|
182
|
+
style: {
|
|
183
|
+
fontSize: "32px",
|
|
184
|
+
fontWeight: "700",
|
|
185
|
+
marginBottom: "16px"
|
|
186
|
+
},
|
|
187
|
+
attributes: { text: t }
|
|
188
|
+
}), i && o.push({
|
|
189
|
+
type: "paragraph",
|
|
190
|
+
style: {
|
|
191
|
+
fontSize: "16px",
|
|
192
|
+
color: "#94a3b8",
|
|
193
|
+
marginBottom: "24px"
|
|
194
|
+
},
|
|
195
|
+
attributes: { text: i }
|
|
196
|
+
}), a && o.push({
|
|
197
|
+
type: "button",
|
|
198
|
+
style: {
|
|
199
|
+
backgroundColor: "#8b5cf6",
|
|
200
|
+
color: "#ffffff",
|
|
201
|
+
borderRadius: "12px",
|
|
202
|
+
paddingTop: "12px",
|
|
203
|
+
paddingBottom: "12px",
|
|
204
|
+
paddingLeft: "24px",
|
|
205
|
+
paddingRight: "24px"
|
|
206
|
+
},
|
|
207
|
+
attributes: {
|
|
208
|
+
text: a,
|
|
209
|
+
href: "#action"
|
|
210
|
+
}
|
|
211
|
+
}), {
|
|
212
|
+
id: e.id || `row-generic-${Math.random().toString(36).substring(2, 7)}`,
|
|
213
|
+
style: {
|
|
214
|
+
paddingTop: "40px",
|
|
215
|
+
paddingBottom: "40px",
|
|
216
|
+
...r
|
|
217
|
+
},
|
|
218
|
+
columns: [{
|
|
219
|
+
id: `col-generic-${Math.random().toString(36).substring(2, 7)}`,
|
|
220
|
+
width: "100%",
|
|
221
|
+
elements: o.length > 0 ? o : [{
|
|
222
|
+
type: "heading",
|
|
223
|
+
attributes: { text: "Section" }
|
|
224
|
+
}]
|
|
225
|
+
}]
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
var t = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter(([e, t]) => t != null && t !== "").map(([e, t]) => {
|
|
47
231
|
let n = e.replace(/([A-Z])/g, "-$1").toLowerCase(), r = t;
|
|
48
232
|
return typeof t == "number" && [
|
|
49
233
|
"padding",
|
|
@@ -54,7 +238,7 @@ var e = (e) => e === "twitter" ? "x" : e, t = (t, n = "currentColor") => {
|
|
|
54
238
|
"width",
|
|
55
239
|
"height"
|
|
56
240
|
].some((t) => e.toLowerCase().includes(t)) && (r = `${t}px`), `${n}: ${r};`;
|
|
57
|
-
}).join(" "),
|
|
241
|
+
}).join(" "), n = () => ({
|
|
58
242
|
backgroundColor: "#ffffff",
|
|
59
243
|
borderRadius: "20px",
|
|
60
244
|
width: "100%",
|
|
@@ -77,113 +261,66 @@ var e = (e) => e === "twitter" ? "x" : e, t = (t, n = "currentColor") => {
|
|
|
77
261
|
buttonPaddingRight: "14px",
|
|
78
262
|
buttonFontSize: "13px",
|
|
79
263
|
buttonFontWeight: "700"
|
|
80
|
-
}),
|
|
264
|
+
}), r = (e) => (e || "").replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), i = (e, t) => {
|
|
81
265
|
if (typeof t != "string") return "";
|
|
82
266
|
let n = t.trim();
|
|
83
|
-
return n ? ` ${e}="${
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
...
|
|
88
|
-
|
|
267
|
+
return n ? ` ${e}="${r(n)}"` : "";
|
|
268
|
+
}, a = (e) => {
|
|
269
|
+
if (!e || typeof e != "object") return "";
|
|
270
|
+
let r = e.style || {}, i = t(e.type === "form_container" ? {
|
|
271
|
+
...n(),
|
|
272
|
+
...r
|
|
273
|
+
} : r), a = e.attributes || {};
|
|
89
274
|
switch (e.type) {
|
|
90
|
-
case "heading": return `<h2 style="margin-top: 0; margin-bottom: 8px; ${
|
|
91
|
-
case "paragraph": return `<p style="margin-top: 0; margin-bottom: 12px; ${
|
|
92
|
-
case "text": return `<div style="${
|
|
93
|
-
case "button": return `<div style="text-align: ${
|
|
275
|
+
case "heading": return `<h2 style="margin-top: 0; margin-bottom: 8px; ${i}">${a.text || "Heading"}</h2>`;
|
|
276
|
+
case "paragraph": return `<p style="margin-top: 0; margin-bottom: 12px; ${i}">${a.text || "Paragraph text content."}</p>`;
|
|
277
|
+
case "text": return `<div style="${i}">${a.text || ""}</div>`;
|
|
278
|
+
case "button": return `<div style="text-align: ${r.textAlign || "center"};"><a href="${a.href || "#"}" target="${a.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; ${i}">${a.text || "Button"}</a></div>`;
|
|
94
279
|
case "image": {
|
|
95
|
-
let
|
|
96
|
-
return `<img src="${
|
|
97
|
-
}
|
|
98
|
-
case "divider": return `<hr style="border: 0; border-top: ${e.style.borderWidth || "1px"} ${e.style.borderStyle || "solid"} ${e.style.borderColor || "#334155"}; ${a}" />`;
|
|
99
|
-
case "spacer": return `<div style="height: ${e.style.height || "24px"};"></div>`;
|
|
100
|
-
case "card": return `<div style="${a}">
|
|
101
|
-
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${o.title || "Card Title"}</h3>
|
|
102
|
-
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${o.description || "Card description."}</p>
|
|
103
|
-
</div>`;
|
|
104
|
-
case "form_container": {
|
|
105
|
-
let t = o.fields || [], r = o.actionMode || "submit", i = r === "submit" && o.actionUrl || "#", s = o.method || "POST", c = r === "javascript" ? `onsubmit="${o.buttonFunction || "handleSubmit"}(event); return false;"` : r === "redirect" ? `onsubmit="window.location.href='${o.redirectUrl || "#"}'; return false;"` : "", l = n(t, "padding:8px 12px;border:1px solid #cbd5e1;border-radius:6px;font-size:13px;background:#fff;color:#1e293b;"), u = r === "submit" ? "submit" : "button", d = r === "javascript" ? `onclick="${o.buttonFunction || "handleSubmit"}(event)"` : r === "redirect" ? `onclick="window.location.href='${o.redirectUrl || "#"}'"` : "", f = [
|
|
106
|
-
"display: inline-block",
|
|
107
|
-
"border: none",
|
|
108
|
-
"cursor: pointer",
|
|
109
|
-
`background-color: ${e.style.buttonBackgroundColor || "#0f172a"}`,
|
|
110
|
-
`color: ${e.style.buttonTextColor || "#ffffff"}`,
|
|
111
|
-
`border-radius: ${e.style.buttonBorderRadius || "12px"}`,
|
|
112
|
-
`font-size: ${e.style.buttonFontSize || "13px"}`,
|
|
113
|
-
`font-weight: ${e.style.buttonFontWeight || "700"}`,
|
|
114
|
-
`padding-top: ${e.style.buttonPaddingTop || e.style.buttonPadding || "10px"}`,
|
|
115
|
-
`padding-bottom: ${e.style.buttonPaddingBottom || e.style.buttonPadding || "10px"}`,
|
|
116
|
-
`padding-left: ${e.style.buttonPaddingLeft || e.style.buttonPadding || "14px"}`,
|
|
117
|
-
`padding-right: ${e.style.buttonPaddingRight || e.style.buttonPadding || "14px"}`,
|
|
118
|
-
e.style.buttonMarginTop || e.style.buttonMargin ? `margin-top: ${e.style.buttonMarginTop || e.style.buttonMargin}` : "",
|
|
119
|
-
e.style.buttonMarginBottom || e.style.buttonMargin ? `margin-bottom: ${e.style.buttonMarginBottom || e.style.buttonMargin}` : "",
|
|
120
|
-
e.style.buttonMarginLeft || e.style.buttonMargin ? `margin-left: ${e.style.buttonMarginLeft || e.style.buttonMargin}` : "",
|
|
121
|
-
e.style.buttonMarginRight || e.style.buttonMargin ? `margin-right: ${e.style.buttonMarginRight || e.style.buttonMargin}` : "",
|
|
122
|
-
o.buttonAutoWidth === !1 ? `width: ${e.style.buttonWidth || "100%"}` : "width: auto",
|
|
123
|
-
o.buttonAutoHeight === !1 ? `height: ${e.style.buttonHeight || "auto"}` : ""
|
|
124
|
-
].filter(Boolean).join(";"), p = e.style.buttonAlign === "center" ? "center" : e.style.buttonAlign === "right" ? "right" : "left";
|
|
125
|
-
return `<form name="${o.formName || "form"}" action="${i}" method="${s}" ${c} style="${a}">${l}<div style="width:100%;text-align:${p};"><button type="${u}" ${d} style="${f}">${o.submitLabel || "Submit"}</button></div></form>`;
|
|
126
|
-
}
|
|
127
|
-
case "input": return `<div style="margin-bottom: 12px;"><label style="display: block; font-size: 12px; color: #94a3b8; margin-bottom: 4px;">${o.name || "Field"}${o.required ? " *" : ""}</label><input type="text" placeholder="${o.placeholder || ""}" ${o.required ? "required" : ""} style="width: 100%; box-sizing: border-box; ${a}" /></div>`;
|
|
128
|
-
case "textarea": return `<div style="margin-bottom: 12px;"><label style="display: block; font-size: 12px; color: #94a3b8; margin-bottom: 4px;">${o.name || "Field"}${o.required ? " *" : ""}</label><textarea placeholder="${o.placeholder || ""}" ${o.required ? "required" : ""} style="width: 100%; box-sizing: border-box; min-height: 80px; ${a}"></textarea></div>`;
|
|
129
|
-
case "select": {
|
|
130
|
-
let e = (o.options || []).map((e) => `<option value="${e.value}">${e.label}</option>`).join("");
|
|
131
|
-
return `<div style="margin-bottom: 12px;"><label style="display: block; font-size: 12px; color: #94a3b8; margin-bottom: 4px;">${o.name || "Dropdown"}</label><select style="width: 100%; box-sizing: border-box; ${a}">${e}</select></div>`;
|
|
132
|
-
}
|
|
133
|
-
case "menu": {
|
|
134
|
-
let t = (o.links || []).map((e) => `<a href="${e.href || "#"}" style="color: inherit; text-decoration: none; padding: 0 12px;">${e.label}</a>`).join("");
|
|
135
|
-
return `<div style="display: flex; flex-wrap: wrap; justify-content: ${e.style.textAlign === "center" ? "center" : e.style.textAlign === "right" ? "flex-end" : "flex-start"}; ${a}">${t}</div>`;
|
|
136
|
-
}
|
|
137
|
-
case "html": return o.htmlContent ? String(o.htmlContent) : "<!-- Raw HTML empty -->";
|
|
138
|
-
case "table": {
|
|
139
|
-
let t = Number(o.rowCount) || 2, n = Number(o.colCount) || 2, r = e.style.cellPadding || "8px", i = `${e.style.borderWidth || "1px"} ${e.style.borderStyle || "solid"} ${e.style.borderColor || "#334155"}`, s = "";
|
|
140
|
-
for (let e = 0; e < t; e++) {
|
|
141
|
-
let t = "";
|
|
142
|
-
for (let a = 0; a < n; a++) t += `<td style="padding: ${r}; border: ${i};">Cell ${e + 1}, ${a + 1}</td>`;
|
|
143
|
-
s += `<tr>${t}</tr>`;
|
|
144
|
-
}
|
|
145
|
-
return `<table style="width: 100%; border-collapse: collapse; border: ${i}; ${a}">${s}</table>`;
|
|
280
|
+
let e = r.textAlign === "center" ? "margin: 0 auto; display: block;" : r.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;";
|
|
281
|
+
return `<img src="${a.src || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe"}" alt="${a.alt || ""}" style="${i} ${e}" />`;
|
|
146
282
|
}
|
|
147
|
-
case "
|
|
148
|
-
|
|
283
|
+
case "divider": return `<hr style="border: 0; border-top: ${r.borderWidth || "1px"} ${r.borderStyle || "solid"} ${r.borderColor || "#334155"}; ${i}" />`;
|
|
284
|
+
case "spacer": return `<div style="height: ${r.height || "24px"};"></div>`;
|
|
285
|
+
case "card": return `<div style="${i}">
|
|
286
|
+
<h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${a.title || "Card Title"}</h3>
|
|
287
|
+
<p style="margin: 0; color: #94a3b8; font-size: 14px;">${a.description || "Card description."}</p>
|
|
149
288
|
</div>`;
|
|
150
|
-
case "video": return `<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; ${a}">
|
|
151
|
-
<iframe src="${o.videoUrl || "https://www.youtube.com/embed/dQw4w9WgXcQ"}" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;" allowfullscreen></iframe>
|
|
152
|
-
</div>`;
|
|
153
|
-
case "social": {
|
|
154
|
-
let n = (o.links || []).map((n) => {
|
|
155
|
-
let r = String(n.color || e.style.iconColor || "#475569"), i = String(n.backgroundColor || e.style.iconBackgroundColor || "#f8fafc"), a = String(n.size || e.style.iconSize || "32px");
|
|
156
|
-
return `<a href="${n.url || "#"}" style="display: inline-flex; align-items: center; justify-content: center; width: ${a}; height: ${a}; border-radius: ${(n.iconType || o.iconType) === "square" ? "10px" : "9999px"}; background: ${i}; color: ${r}; text-decoration: none;">${t(n.provider, r)}</a>`;
|
|
157
|
-
}).join("");
|
|
158
|
-
return `<div style="text-align: ${e.style.textAlign || "center"}; display:flex; flex-wrap:wrap; justify-content:${e.style.textAlign === "center" ? "center" : e.style.textAlign === "right" ? "flex-end" : "flex-start"}; gap:${e.style.iconSpacing || "8px"}; ${a}">${n}</div>`;
|
|
159
|
-
}
|
|
160
|
-
case "carousel": return `<div class="plexo-carousel" style="overflow: hidden;">${(o.images || []).map((e, t) => `<div style="display: ${t === 0 ? "block" : "none"}; text-align: center;"><img src="${e.src}" style="max-width: 100%; height: auto; ${a}" />${e.caption ? `<div style="font-size: 12px; margin-top: 4px;">${e.caption}</div>` : ""}</div>`).join("")}</div>`;
|
|
161
|
-
case "icon": {
|
|
162
|
-
let t = o.iconName || "star", n = e.style.fontSize || "48px", r = e.style.color || "#1e293b", i = o.href || "", a = !!o.openInNewTab, s = `text-align: ${e.style.textAlign || "center"}; padding: ${e.style.padding || "8px"}; margin: ${e.style.margin || "0px"};`, c = `https://cdn.jsdelivr.net/npm/lucide-static@0.415.0/icons/${t}.svg`, l = parseInt(n) || 48, u = `<img src="${c}" width="${l}" height="${l}" alt="${t}" style="${`display: inline-block; vertical-align: middle; fill: ${r}; color: ${r}; width: ${l}px; height: ${l}px;`}" />`;
|
|
163
|
-
return `<div style="${s}">${i ? `<a href="${i}" target="${a ? "_blank" : "_self"}" style="text-decoration: none;">${u}</a>` : u}</div>`;
|
|
164
|
-
}
|
|
165
289
|
default: return `<!-- Unsupported block ${e.type} -->`;
|
|
166
290
|
}
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
291
|
+
}, o = (n) => {
|
|
292
|
+
if (!n || typeof n != "object") return "";
|
|
293
|
+
let r = e(n);
|
|
294
|
+
if (!r) return "";
|
|
295
|
+
let o = t(r.style || {}), s = i("id", r.htmlId), c = i("class", r.htmlClass), l = `\n <!-- ROW START: ${r.id || "row"} -->`;
|
|
296
|
+
l += `\n <div${s}${c} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${o}">`;
|
|
297
|
+
let u = Array.isArray(r.columns) ? r.columns : [];
|
|
298
|
+
for (let e of u) {
|
|
299
|
+
if (!e) continue;
|
|
300
|
+
let n = t(e.styles || e.style || {}), r = i("id", e.attrs?.htmlId), o = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "";
|
|
301
|
+
l += `\n <!-- COLUMN START: ${e.id || "col"} -->`, l += `\n <div${r} class="plexo-col${o}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; ${n}">`;
|
|
302
|
+
let s = Array.isArray(e.elements) ? e.elements : [];
|
|
303
|
+
for (let e of s) {
|
|
304
|
+
if (!e) continue;
|
|
305
|
+
let t = e.attributes || {}, n = typeof t.htmlClassNames == "string" ? t.htmlClassNames : typeof t.htmlClass == "string" ? t.htmlClass : typeof t.className == "string" ? t.className : "", r = i("id", t.htmlId), o = i("class", n);
|
|
306
|
+
l += `\n <div${r}${o} style="margin-bottom: 16px;">`, l += `\n ${a(e)}`, l += "\n </div>";
|
|
176
307
|
}
|
|
177
|
-
|
|
178
|
-
a += "\n </div>";
|
|
308
|
+
l += "\n </div>";
|
|
179
309
|
}
|
|
180
|
-
return
|
|
181
|
-
},
|
|
182
|
-
|
|
310
|
+
return l += "\n </div>", l;
|
|
311
|
+
}, s = (e) => {
|
|
312
|
+
if (!e || typeof e != "object") return "<!-- Empty template -->";
|
|
313
|
+
let n = e.designJson || e.template || e, a = n.body || (Array.isArray(n.rows) ? {
|
|
314
|
+
style: n.style || {},
|
|
315
|
+
rows: n.rows
|
|
316
|
+
} : {
|
|
317
|
+
style: {},
|
|
318
|
+
rows: []
|
|
319
|
+
}), s = a.style || {}, c = t(s), l = typeof s.htmlTitle == "string" && s.htmlTitle.trim() ? s.htmlTitle.trim() : "Plexo Rendered Page", u = i("id", s.htmlId), d = i("class", s.htmlClass), f = typeof s.customCss == "string" && s.customCss.trim() ? s.customCss.trim() : "", p = typeof s.customJs == "string" && s.customJs.trim() ? s.customJs.trim() : "", m = `<!DOCTYPE html>
|
|
183
320
|
<html>
|
|
184
321
|
<head>
|
|
185
322
|
<meta charset="utf-8">
|
|
186
|
-
<title>${
|
|
323
|
+
<title>${r(l)}</title>
|
|
187
324
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
188
325
|
<style>
|
|
189
326
|
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
|
|
@@ -202,85 +339,24 @@ var e = (e) => e === "twitter" ? "x" : e, t = (t, n = "currentColor") => {
|
|
|
202
339
|
}
|
|
203
340
|
}
|
|
204
341
|
</style>
|
|
205
|
-
${
|
|
342
|
+
${f ? `<style>\n${f}\n </style>` : ""}
|
|
206
343
|
</head>
|
|
207
|
-
<body${
|
|
208
|
-
<div style="max-width: 1200px; margin: 0 auto; width: 100%;"
|
|
209
|
-
for (let
|
|
210
|
-
return
|
|
211
|
-
${
|
|
344
|
+
<body${u}${d} style="${c}">
|
|
345
|
+
<div style="max-width: 1200px; margin: 0 auto; width: 100%;">`, h = Array.isArray(a.rows) ? a.rows : Array.isArray(n.rows) ? n.rows : Array.isArray(e.rows) ? e.rows : [];
|
|
346
|
+
for (let e of h) m += o(e);
|
|
347
|
+
return m += `\n </div>
|
|
348
|
+
${p ? ` <script>\n${p}\n <\/script>` : ""}
|
|
212
349
|
</body>
|
|
213
|
-
</html>`,
|
|
214
|
-
}, u = (e) => {
|
|
215
|
-
let t = e.attributes || {};
|
|
216
|
-
switch (e.type) {
|
|
217
|
-
case "heading":
|
|
218
|
-
case "paragraph":
|
|
219
|
-
case "text": return t.text ? String(t.text) : "";
|
|
220
|
-
case "button": return `[ Button: ${t.text || "Button"} -> ${t.href || "#"} ]`;
|
|
221
|
-
case "image": return `[ Image: ${t.alt || "Unnamed Image"} (${t.src || ""}) ]`;
|
|
222
|
-
case "card": return `${t.title || "Card Title"}\n${t.description || ""}`;
|
|
223
|
-
case "form_container": return `[ Form: ${t.formName || "form"} (${t.actionUrl || ""}) ]`;
|
|
224
|
-
case "input":
|
|
225
|
-
case "textarea": return `${t.name || "Field"}: __________`;
|
|
226
|
-
case "select": {
|
|
227
|
-
let e = t.options || [];
|
|
228
|
-
return `${t.name || "Dropdown"}: [ ${e.map((e) => e.label).join(" | ")} ]`;
|
|
229
|
-
}
|
|
230
|
-
case "menu": return `Menu: ${(t.links || []).map((e) => e.label).join(" | ")}`;
|
|
231
|
-
case "html": return "[ Raw HTML Block ]";
|
|
232
|
-
case "table": return `[ Table of size ${Number(t.rowCount) || 2}x${Number(t.colCount) || 2} ]`;
|
|
233
|
-
case "timer": return `[ Countdown Timer target: ${t.targetDate || "Future Target"} ]`;
|
|
234
|
-
case "video": return `[ Video Link: ${t.videoUrl || ""} ]`;
|
|
235
|
-
case "social": return `Social Profiles: ${(t.links || []).map((e) => `${e.provider.toUpperCase()} (${e.url || ""})`).join(", ")}`;
|
|
236
|
-
default: return "";
|
|
237
|
-
}
|
|
238
|
-
}, d = (e) => {
|
|
239
|
-
let t = [], n = (e) => {
|
|
240
|
-
for (let r of e.columns) {
|
|
241
|
-
for (let e of r.elements) {
|
|
242
|
-
let n = u(e);
|
|
243
|
-
n && t.push(n);
|
|
244
|
-
}
|
|
245
|
-
if (r.nestedRows && r.nestedRows.length > 0) for (let e of r.nestedRows) n(e);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
for (let t of e.body.rows) n(t);
|
|
249
|
-
return t.join("\n\n");
|
|
250
|
-
}, f = (e) => {
|
|
251
|
-
let t = (e = {}) => Object.values(e).some((e) => typeof e == "string" && e.includes("var(--strata-") ? !0 : typeof e == "object" && t(e)), n = (e) => {
|
|
252
|
-
if (t(e.style)) return !0;
|
|
253
|
-
for (let r of e.columns) {
|
|
254
|
-
if (t(r.styles)) return !0;
|
|
255
|
-
for (let e of r.elements) if (t(e.style) || t(e.attributes)) return !0;
|
|
256
|
-
if (r.nestedRows && r.nestedRows.length > 0) {
|
|
257
|
-
for (let e of r.nestedRows) if (n(e)) return !0;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return !1;
|
|
261
|
-
};
|
|
262
|
-
if (t(e.body.style)) return !0;
|
|
263
|
-
for (let t of e.body.rows) if (n(t)) return !0;
|
|
264
|
-
return !1;
|
|
265
|
-
}, p = (e, t) => {
|
|
266
|
-
if (!t) return e;
|
|
267
|
-
let n = `
|
|
268
|
-
<!-- Strata Design System Web Components Bundle -->
|
|
269
|
-
<script defer src="https://cdn.strata.design/v1/strata-web-components.js"><\/script>
|
|
270
|
-
<link rel="stylesheet" href="https://cdn.strata.design/v1/strata-tokens-${t}.css">
|
|
271
|
-
<script>
|
|
272
|
-
// Initialize Strata components when DOM is ready
|
|
273
|
-
if (window.StrataWebComponents) {
|
|
274
|
-
window.StrataWebComponents.init({
|
|
275
|
-
projectId: '${t}',
|
|
276
|
-
syncEnabled: true
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
<\/script>`;
|
|
280
|
-
return e.includes("</head>") ? e.replace("</head>", ` ${n}\n</head>`) : e;
|
|
281
|
-
}, m = (e) => {
|
|
282
|
-
let t = l(e), n = e.body.strataConfig?.projectId;
|
|
283
|
-
return n && (t = p(t, n)), t;
|
|
350
|
+
</html>`, m;
|
|
284
351
|
};
|
|
352
|
+
function c(e) {
|
|
353
|
+
return s(e).replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
|
|
354
|
+
}
|
|
355
|
+
function l(e) {
|
|
356
|
+
return s(e);
|
|
357
|
+
}
|
|
358
|
+
function u(e) {
|
|
359
|
+
return e;
|
|
360
|
+
}
|
|
285
361
|
//#endregion
|
|
286
|
-
export {
|
|
362
|
+
export { s as compileToHTML, l as compileToHTMLWithStrataAuto, c as compileToPlainText, e as convertSectionRowToPlexoRow, u as injectStrataBundle };
|
|
@@ -11,6 +11,10 @@ interface SidebarContainerProps {
|
|
|
11
11
|
textColor: string;
|
|
12
12
|
};
|
|
13
13
|
children?: React.ReactNode;
|
|
14
|
+
/** Below the `xl` breakpoint the sidebar becomes an overlay drawer instead of a
|
|
15
|
+
* permanent panel; these control whether it's slid into view. Ignored at `xl`+. */
|
|
16
|
+
isMobileOpen?: boolean;
|
|
17
|
+
onCloseMobile?: () => void;
|
|
14
18
|
}
|
|
15
19
|
export declare const SidebarContainer: React.FC<SidebarContainerProps>;
|
|
16
20
|
export {};
|
|
@@ -5,6 +5,7 @@ interface ContentTabProps {
|
|
|
5
5
|
ICONS: Record<string, React.ReactNode>;
|
|
6
6
|
tierFeatures?: SdkTierFeatures;
|
|
7
7
|
templateKind?: 'landing_page' | 'email' | string;
|
|
8
|
+
onTapAdd?: (data: any) => void;
|
|
8
9
|
}
|
|
9
10
|
export declare const ContentTab: React.FC<ContentTabProps>;
|
|
10
11
|
export {};
|