@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 CHANGED
@@ -1,49 +1,233 @@
1
1
  //#region src/utilities/compiler.ts
2
- var e = (e) => e === "twitter" ? "x" : e, t = (t, n = "currentColor") => {
3
- switch (e(t)) {
4
- case "facebook": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${n}" d="M14 8h2V4h-2c-2.2 0-4 1.8-4 4v2H8v4h2v6h4v-6h2.5l.5-4H14V8c0-.55.45-1 1-1Z"/></svg>`;
5
- 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="${n}" stroke-width="2"/><circle cx="12" cy="12" r="3.5" fill="none" stroke="${n}" stroke-width="2"/><circle cx="17" cy="7" r="1" fill="${n}"/></svg>`;
6
- 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="${n}"/><path fill="${n}" 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>`;
7
- case "x": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${n}" d="M6 5h3.1l3 4.2L15.7 5H18l-4.8 5.5L18.4 18h-3.1l-3.3-4.7L8 18H5.6l5-5.8z"/></svg>`;
8
- case "youtube": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><rect x="3" y="6.5" width="18" height="11" rx="3" fill="${n}"/><path fill="#fff" d="m10 9 5 3-5 3z"/></svg>`;
9
- case "pinterest": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${n}" d="M12 4a8 8 0 0 0-2.9 15.46c-.04-1.17 0-2.58.3-3.82l1.1-4.6s-.27-.56-.27-1.4c0-1.3.75-2.27 1.68-2.27.8 0 1.18.6 1.18 1.3 0 .8-.5 2-.77 3.12-.22.94.47 1.7 1.4 1.7 1.67 0 2.8-2.15 2.8-4.7 0-1.93-1.3-3.37-3.67-3.37-2.68 0-4.35 2-4.35 4.23 0 .77.23 1.34.6 1.77.17.2.2.29.13.53l-.2.8c-.07.25-.3.34-.56.25-1.55-.63-2.27-2.32-2.27-4.22 0-3.14 2.64-6.9 7.89-6.9 4.21 0 6.98 3.05 6.98 6.32 0 4.32-2.4 7.54-5.93 7.54-1.18 0-2.28-.64-2.65-1.37l-.73 2.78c-.26.95-.77 2.14-1.22 2.96A8 8 0 1 0 12 4Z"/></svg>`;
10
- case "whatsapp": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${n}" d="M12 4a8 8 0 0 0-6.9 12.04L4 20l4.11-1.06A8 8 0 1 0 12 4Zm4.55 11.36c-.2.56-1.14 1.04-1.57 1.1-.4.06-.92.09-1.48-.08-.34-.11-.78-.25-1.35-.5-2.37-1.03-3.92-3.45-4.04-3.6-.11-.15-.96-1.27-.96-2.42s.6-1.72.8-1.96c.2-.24.45-.3.6-.3h.43c.14 0 .33-.05.51.38.2.48.7 1.67.75 1.79.06.12.1.26.02.42-.07.15-.11.26-.22.39-.11.13-.23.29-.33.39-.11.11-.22.23-.1.45.11.22.52.86 1.11 1.39.76.68 1.4.89 1.62.99.22.11.35.09.48-.06.13-.15.56-.65.72-.88.15-.22.31-.18.52-.11.22.08 1.36.64 1.6.76.23.11.38.17.44.27.06.1.06.61-.14 1.17Z"/></svg>`;
11
- case "tiktok": return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><path fill="${n}" d="M14.4 4c.24 1.12.9 2.08 1.86 2.67.7.42 1.52.64 2.35.63V10a6.5 6.5 0 0 1-4.2-1.52v5.24A4.72 4.72 0 1 1 9.7 9v2.6a2.12 2.12 0 1 0 2.1 2.12V4z"/></svg>`;
12
- default: return `<svg viewBox="0 0 24 24" width="16" height="16" aria-hidden="true"><circle cx="12" cy="12" r="4" fill="${n}"/></svg>`;
13
- }
14
- }, n = (e, t) => {
15
- let n = null;
16
- return e.map((e) => {
17
- let r = e.inheritStylesFromPrevious && n ? {
18
- ...e,
19
- fontSize: n.fontSize,
20
- borderRadius: n.borderRadius,
21
- borderWidth: n.borderWidth,
22
- borderColor: n.borderColor,
23
- labelColor: n.labelColor,
24
- inputTextColor: n.inputTextColor,
25
- placeholderColor: n.placeholderColor
26
- } : e;
27
- n = r;
28
- let i = r.required ? "required" : "", a = r.labelColor || "#94a3b8", o = `<label style="display:block;font-size:${r.fontSize || "12px"};color:${a};margin-bottom:4px;">${r.label || r.name || "Field"}${r.required ? " *" : ""}</label>`, s = `${t};${[
29
- `border-radius: ${r.borderRadius || "12px"}`,
30
- `border-width: ${r.borderWidth || "1px"}`,
31
- `border-color: ${r.borderColor || "#cbd5e1"}`,
32
- `color: ${r.inputTextColor || "#1e293b"}`,
33
- `font-size: ${r.fontSize || "13px"}`
34
- ].join(";")}`;
35
- if (r.kind === "textarea") return `<div style="margin-bottom:12px;">${o}<textarea name="${r.name || ""}" placeholder="${r.placeholder || ""}" ${i} style="width:100%;box-sizing:border-box;min-height:80px;${s}"></textarea></div>`;
36
- if (r.kind === "select") {
37
- let e = (r.options || []).map((e) => `<option value="${e.value}">${e.label}</option>`).join("");
38
- return `<div style="margin-bottom:12px;">${o}<select name="${r.name || ""}" ${i} style="width:100%;box-sizing:border-box;${s}">${e}</select></div>`;
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
- if (r.kind === "radio" || r.kind === "checkbox") {
41
- let e = r.kind;
42
- return `<div style="margin-bottom:12px;">${o}<div>${(r.options || []).map((t) => `<label style="display:inline-flex;align-items:center;gap:8px;margin:0 12px 8px 0;font-size:12px;color:${r.inputTextColor || "#475569"};"><input type="${e}" name="${r.name || ""}" value="${t.value}" ${i} />${t.label}</label>`).join("")}</div></div>`;
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
- return `<div style="margin-bottom:12px;">${o}<input type="${r.kind === "email" ? "email" : "text"}" name="${r.name || ""}" placeholder="${r.placeholder || ""}" ${i} style="width:100%;box-sizing:border-box;${s}" /></div>`;
45
- }).join("");
46
- }, r = (e = {}) => Object.entries(e).filter(([e, t]) => t != null && t !== "").map(([e, t]) => {
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(" "), i = () => ({
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
- }), a = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), o = (e, t) => {
264
+ }), r = (e) => (e || "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), i = (e, t) => {
81
265
  if (typeof t != "string") return "";
82
266
  let n = t.trim();
83
- return n ? ` ${e}="${a(n)}"` : "";
84
- }, s = (e) => {
85
- let a = r(e.type === "form_container" ? {
86
- ...i(),
87
- ...e.style || {}
88
- } : e.style), o = e.attributes || {};
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; ${a}">${o.text || "Heading"}</h2>`;
91
- case "paragraph": return `<p style="margin-top: 0; margin-bottom: 12px; ${a}">${o.text || "Paragraph text content."}</p>`;
92
- case "text": return `<div style="${a}">${o.text || ""}</div>`;
93
- case "button": return `<div style="text-align: ${e.style.textAlign || "center"};"><a href="${o.href || "#"}" target="${o.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; ${a}">${o.text || "Button"}</a></div>`;
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 t = e.style.textAlign === "center" ? "margin: 0 auto; display: block;" : e.style.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;";
96
- return `<img src="${o.src || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe"}" alt="${o.alt || ""}" style="${a} ${t}" />`;
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 "timer": return `<div style="text-align: center; ${a}">
148
- <span style="font-size: 1.5em; font-weight: bold;">[Countdown Timer to ${o.targetDate || "Future Target"}]</span>
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
- }, c = (e) => {
168
- let t = r(e.style), n = o("id", e.htmlId), i = o("class", e.htmlClass), a = `\n <!-- ROW START: ${e.id} -->`;
169
- a += `\n <div${n}${i} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${t}">`;
170
- for (let t of e.columns) {
171
- let e = r(t.styles), n = o("id", t.attrs?.htmlId), i = t.attrs?.htmlClass ? ` ${t.attrs.htmlClass}` : "";
172
- a += `\n <!-- COLUMN START: ${t.id} -->`, a += `\n <div${n} class="plexo-col${i}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${t.width}; ${e}">`;
173
- for (let e of t.elements) {
174
- let t = e.attributes || {}, n = typeof t.htmlClassNames == "string" ? t.htmlClassNames : typeof t.htmlClass == "string" ? t.htmlClass : typeof t.className == "string" ? t.className : "", r = o("id", t.htmlId), i = o("class", n);
175
- a += `\n <div${r}${i} style="margin-bottom: 16px;">`, a += `\n ${s(e)}`, a += "\n </div>";
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
- if (t.nestedRows && t.nestedRows.length > 0) for (let e of t.nestedRows) a += c(e);
178
- a += "\n </div>";
308
+ l += "\n </div>";
179
309
  }
180
- return a += "\n </div>", a;
181
- }, l = (e) => {
182
- let t = r(e.body.style), n = typeof e.body.style?.htmlTitle == "string" && e.body.style.htmlTitle.trim() ? e.body.style.htmlTitle.trim() : "Plexo Rendered Page", i = o("id", e.body.style?.htmlId), s = o("class", e.body.style?.htmlClass), l = typeof e.body.style?.customCss == "string" && e.body.style.customCss.trim() ? e.body.style.customCss.trim() : "", u = typeof e.body.style?.customJs == "string" && e.body.style.customJs.trim() ? e.body.style.customJs.trim() : "", d = `<!DOCTYPE html>
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>${a(n)}</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
- ${l ? `<style>\n${l}\n </style>` : ""}
342
+ ${f ? `<style>\n${f}\n </style>` : ""}
206
343
  </head>
207
- <body${i}${s} style="${t}">
208
- <div style="max-width: 1200px; margin: 0 auto; width: 100%;">`;
209
- for (let t of e.body.rows) d += c(t);
210
- return d += `\n </div>
211
- ${u ? ` <script>\n${u}\n <\/script>` : ""}
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>`, d;
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 { l as compileToHTML, m as compileToHTMLWithStrataAuto, d as compileToPlainText, f as detectStrataUsage, p as injectStrataBundle };
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 {};
@@ -7,6 +7,7 @@ interface BlocksTabProps {
7
7
  percentages: string[];
8
8
  }>;
9
9
  tierFeatures?: SdkTierFeatures;
10
+ onTapAdd?: (data: any) => void;
10
11
  }
11
12
  export declare const BlocksTab: React.FC<BlocksTabProps>;
12
13
  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 {};