@charisol/plexo-sdk 1.0.33 → 1.0.35

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.
@@ -53,6 +53,8 @@ export declare const ElementJSONSchema: z.ZodObject<{
53
53
  value: z.ZodString;
54
54
  }, z.core.$strip>>>;
55
55
  }, z.core.$catchall<z.ZodAny>>;
56
+ styleTablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
57
+ styleMobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
56
58
  }, z.core.$strip>;
57
59
  export declare const ColumnJSONSchema: z.ZodType<any>;
58
60
  export declare const RowJSONSchema: z.ZodType<any>;
@@ -152,6 +154,8 @@ interface SafeHTMLProps {
152
154
  className?: string;
153
155
  style?: React.CSSProperties;
154
156
  tag?: 'div' | 'span' | 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
157
+ /** Selector target for this element's own responsive override CSS — see collectResponsiveRule. */
158
+ dataPlexoId?: string;
155
159
  }
156
160
  /**
157
161
  * An isolated safe HTML renderer replacing insecure raw dangerouslySetInnerHTML calls.
@@ -627,9 +627,115 @@ function u(e) {
627
627
  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`;
628
628
  }
629
629
  //#endregion
630
+ //#region src/utilities/responsiveDefaults.ts
631
+ var d = {
632
+ tablet: {
633
+ thresholdPx: 24,
634
+ scale: .85,
635
+ floorPx: 16
636
+ },
637
+ mobile: {
638
+ thresholdPx: 20,
639
+ scale: .7,
640
+ floorPx: 14
641
+ }
642
+ }, f = {
643
+ tablet: {
644
+ thresholdPx: 320,
645
+ scale: .8,
646
+ floorPx: 200
647
+ },
648
+ mobile: {
649
+ thresholdPx: 240,
650
+ scale: .55,
651
+ floorPx: 140
652
+ }
653
+ }, p = {
654
+ tablet: {
655
+ thresholdPx: 48,
656
+ scale: .75,
657
+ floorPx: 24
658
+ },
659
+ mobile: {
660
+ thresholdPx: 32,
661
+ scale: .55,
662
+ floorPx: 16
663
+ }
664
+ }, m = {
665
+ tablet: {
666
+ thresholdPx: 500,
667
+ scale: 1,
668
+ floorPx: 0
669
+ },
670
+ mobile: {
671
+ thresholdPx: 320,
672
+ scale: 1,
673
+ floorPx: 0
674
+ }
675
+ }, h = ["fontSize"], g = [
676
+ "height",
677
+ "minHeight",
678
+ "maxHeight"
679
+ ], _ = [
680
+ "padding",
681
+ "paddingTop",
682
+ "paddingBottom",
683
+ "paddingLeft",
684
+ "paddingRight",
685
+ "margin",
686
+ "marginTop",
687
+ "marginBottom"
688
+ ], v = ["width", "maxWidth"];
689
+ function y(e) {
690
+ if (typeof e == "number" && Number.isFinite(e)) return e;
691
+ if (typeof e != "string") return null;
692
+ let t = e.trim().match(/^(-?\d+(?:\.\d+)?)px$/);
693
+ if (!t) return null;
694
+ let n = parseFloat(t[1]);
695
+ return Number.isFinite(n) ? n : null;
696
+ }
697
+ function b(e, t) {
698
+ return e < t.thresholdPx ? null : Math.max(Math.round(e * t.scale), t.floorPx);
699
+ }
700
+ function x(e, t) {
701
+ if (!e || typeof e != "object") return {};
702
+ let n = {};
703
+ for (let r of h) {
704
+ let i = y(e[r]);
705
+ if (i === null) continue;
706
+ let a = b(i, d[t]);
707
+ a !== null && (n[r] = `${a}px`);
708
+ }
709
+ for (let r of g) {
710
+ let i = y(e[r]);
711
+ if (i === null) continue;
712
+ let a = b(i, f[t]);
713
+ a !== null && (n[r] = `${a}px`);
714
+ }
715
+ for (let r of _) {
716
+ let i = y(e[r]);
717
+ if (i === null) continue;
718
+ let a = b(i, p[t]);
719
+ a !== null && (n[r] = `${a}px`);
720
+ }
721
+ for (let r of v) {
722
+ let i = y(e[r]);
723
+ i !== null && i >= m[t].thresholdPx && (n[r] = "100%");
724
+ }
725
+ return n;
726
+ }
727
+ function S(e, t, n) {
728
+ let r = e || {};
729
+ return n ? {
730
+ ...r,
731
+ ...x(r, n),
732
+ ...t || {}
733
+ } : r;
734
+ }
735
+ //#endregion
630
736
  //#region src/utilities/compiler.ts
631
- var d = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif";
632
- function f(e) {
737
+ var C = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif";
738
+ function w(e) {
633
739
  if (!e || typeof e != "object") return null;
634
740
  if (Array.isArray(e.columns) && e.columns.length > 0) return e;
635
741
  let t = (e.type || "").toLowerCase(), n = e.props || e.content || e.attributes || e.data || e.payload || e, r = e.style || {};
@@ -883,7 +989,7 @@ function f(e) {
883
989
  }
884
990
  }
885
991
  }
886
- var p = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter(([e, t]) => t != null && t !== "").map(([e, t]) => {
992
+ var T = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter(([e, t]) => t != null && t !== "").map(([e, t]) => {
887
993
  let n = e.replace(/([A-Z])/g, "-$1").toLowerCase(), r = t;
888
994
  return typeof t == "number" && [
889
995
  "padding",
@@ -894,7 +1000,25 @@ var p = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
894
1000
  "width",
895
1001
  "height"
896
1002
  ].some((t) => e.toLowerCase().includes(t)) && (r = `${t}px`), `${n}: ${r};`;
897
- }).join(" "), m = () => ({
1003
+ }).join(" "), E = (e = {}) => T(e).replace(/;(\s|$)/g, " !important;$1");
1004
+ function D(e) {
1005
+ if (typeof e != "string") return !1;
1006
+ let t = e.toLowerCase();
1007
+ return t.includes("javascript:") || t.includes("vbscript:") || t.includes("expression") || t.includes("url(") || t.includes("@import") || t.includes("-moz-binding") || t.includes("behavior") || t.includes("</style") || /\\/.test(e);
1008
+ }
1009
+ function O(e, t, n, r, i) {
1010
+ let a = {
1011
+ ...x(n, r),
1012
+ ...i || {}
1013
+ };
1014
+ for (let e of Object.keys(a)) D(a[e]) && delete a[e];
1015
+ if (Object.keys(a).length === 0) return;
1016
+ let o = E(a);
1017
+ if (!o) return;
1018
+ let s = String(t).replace(/["\\]/g, "");
1019
+ e[r].push(`[data-plexo-id="${s}"] { ${o} }`);
1020
+ }
1021
+ var k = () => ({
898
1022
  backgroundColor: "#ffffff",
899
1023
  borderRadius: "20px",
900
1024
  width: "100%",
@@ -917,11 +1041,11 @@ var p = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
917
1041
  buttonPaddingRight: "14px",
918
1042
  buttonFontSize: "13px",
919
1043
  buttonFontWeight: "700"
920
- }), h = (e) => (e || "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), g = (e, t) => {
1044
+ }), A = (e) => (e || "").replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), j = (e, t) => {
921
1045
  if (typeof t != "string") return "";
922
1046
  let n = t.trim();
923
- return n ? ` ${e}="${h(n)}"` : "";
924
- }, _ = [
1047
+ return n ? ` ${e}="${A(n)}"` : "";
1048
+ }, M = [
925
1049
  "fieldSpacing",
926
1050
  "buttonBackgroundColor",
927
1051
  "buttonTextColor",
@@ -934,54 +1058,54 @@ var p = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
934
1058
  "buttonFontWeight",
935
1059
  "buttonWidth",
936
1060
  "buttonAlign"
937
- ], v = (e) => {
1061
+ ], N = (e) => {
938
1062
  if (!e || typeof e != "object") return "";
939
- let t = e.kind || "text", n = h(e.name || e.label || "field"), r = e.required ? " required" : "", i = p({
1063
+ let t = e.kind || "text", n = A(e.name || e.label || "field"), r = e.required ? " required" : "", i = T({
940
1064
  fontSize: e.fontSize,
941
1065
  borderRadius: e.borderRadius,
942
- borderWidth: e.borderWidth,
943
- borderColor: e.borderColor,
1066
+ borderWidth: e.borderWidth || "1px",
1067
+ borderColor: e.borderColor || "#d1d5db",
944
1068
  borderStyle: "solid",
945
1069
  color: e.inputTextColor
946
1070
  }), a = e.showLabel === !1 ? "" : `<label style="display: block; margin-bottom: 4px; font-size: ${e.fontSize || "12px"}; font-weight: ${e.labelFontWeight || "700"}; color: ${e.labelColor || "inherit"};">${e.label || ""}${e.required ? " <span style=\"color:#e11d48;\">*</span>" : ""}</label>`;
947
- return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${h(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}></textarea>` : t === "select" ? `${a}<select name="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}>${(Array.isArray(e.options) ? e.options : []).map((e) => `<option value="${h(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>` : t === "radio" || t === "checkbox" ? `${a}<div style="display: flex; flex-wrap: wrap; gap: 8px;">${(Array.isArray(e.options) && e.options.length > 0 ? e.options : [{
1071
+ return t === "textarea" ? `${a}<textarea name="${n}" placeholder="${A(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}></textarea>` : t === "select" ? `${a}<select name="${n}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r}>${(Array.isArray(e.options) ? e.options : []).map((e) => `<option value="${A(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>` : t === "radio" || t === "checkbox" ? `${a}<div style="display: flex; flex-wrap: wrap; gap: 8px;">${(Array.isArray(e.options) && e.options.length > 0 ? e.options : [{
948
1072
  label: e.label || "Option",
949
1073
  value: e.name || "option"
950
- }]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${h(r?.value ?? "")}" />${r?.label ?? r?.value ?? ""}</label>`).join("")}</div>` : `${a}<input type="${h(t)}" name="${n}" placeholder="${h(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r} />`;
951
- }, y = (e) => {
1074
+ }]).map((r) => `<label style="display: inline-flex; align-items: center; gap: 6px; font-size: ${e.fontSize || "12px"};"><input type="${t}" name="${n}" value="${A(r?.value ?? "")}" />${r?.label ?? r?.value ?? ""}</label>`).join("")}</div>` : `${a}<input type="${A(t)}" name="${n}" placeholder="${A(e.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${i}"${r} />`;
1075
+ }, P = (e) => {
952
1076
  if (!e || typeof e != "object") return "";
953
- let t = e.style || {}, n = p(e.type === "form_container" ? {
954
- ...m(),
1077
+ let t = e.style || {}, n = T(e.type === "form_container" ? {
1078
+ ...k(),
955
1079
  ...t
956
- } : t), r = e.attributes || {};
1080
+ } : t), r = e.attributes || {}, i = ` data-plexo-id="${A(e.id)}"`;
957
1081
  switch (e.type) {
958
- case "heading": return `<h2 style="margin-top: 0; margin-bottom: 8px; ${n}">${r.text || "Heading"}</h2>`;
959
- case "paragraph": return `<p style="margin-top: 0; margin-bottom: 12px; ${n}">${r.text || "Paragraph text content."}</p>`;
960
- case "text": return `<div style="${n}">${r.text || ""}</div>`;
1082
+ case "heading": return `<h2${i} style="margin-top: 0; margin-bottom: 8px; ${n}">${r.text || "Heading"}</h2>`;
1083
+ case "paragraph": return `<p${i} style="margin-top: 0; margin-bottom: 12px; ${n}">${r.text || "Paragraph text content."}</p>`;
1084
+ case "text": return `<div${i} style="${n}">${r.text || ""}</div>`;
961
1085
  case "button": {
962
- let e = r.autoWidth === !1 ? t.width || "100%" : "auto", n = p({
1086
+ let e = r.autoWidth === !1 ? t.width || "100%" : "auto", n = T({
963
1087
  ...t,
964
1088
  width: e
965
1089
  });
966
- return `<div style="text-align: ${t.textAlign || "center"};"><a href="${r.href || "#"}" target="${r.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; ${n}">${r.text || "Button"}</a></div>`;
1090
+ return `<div style="text-align: ${t.textAlign || "center"};"><a${i} href="${r.href || "#"}" target="${r.openInNewTab ? "_blank" : "_self"}" style="display: inline-block; text-decoration: none; ${n}">${r.text || "Button"}</a></div>`;
967
1091
  }
968
1092
  case "image": {
969
1093
  let e = t.textAlign === "center" ? "margin: 0 auto; display: block;" : t.textAlign === "right" ? "margin-left: auto; display: block;" : "display: inline-block;";
970
- return `<img src="${r.src || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe"}" alt="${r.alt || ""}" style="${n} ${e}" />`;
1094
+ return `<img${i} src="${r.src || "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe"}" alt="${r.alt || ""}" style="${n} ${e}" />`;
971
1095
  }
972
- case "divider": return `<hr style="border: 0; border-top: ${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#334155"}; ${n}" />`;
973
- case "spacer": return `<div style="height: ${t.height || "24px"};"></div>`;
974
- case "card": return `<div style="${n}">
1096
+ case "divider": return `<hr${i} style="border: 0; border-top: ${t.borderWidth || "1px"} ${t.borderStyle || "solid"} ${t.borderColor || "#334155"}; ${n}" />`;
1097
+ case "spacer": return `<div${i} style="height: ${t.height || "24px"};"></div>`;
1098
+ case "card": return `<div${i} style="${n}">
975
1099
  <h3 style="margin-top: 0; margin-bottom: 8px; color: #ffffff;">${r.title || "Card Title"}</h3>
976
1100
  <p style="margin: 0; color: #94a3b8; font-size: 14px;">${r.description || "Card description."}</p>
977
1101
  </div>`;
978
1102
  case "form_container": {
979
1103
  let e = {
980
- ...m(),
1104
+ ...k(),
981
1105
  ...t
982
1106
  }, n = {};
983
- for (let t of Object.keys(e)) _.includes(t) || (n[t] = e[t]);
984
- let i = p(n), a = Array.isArray(r.fields) ? r.fields : [], o = e.fieldSpacing || "12px", s = a.map((e) => `<div style="margin-bottom: ${o};">${v(e)}</div>`).join(""), c = r.buttonAutoWidth === !1 ? e.buttonWidth || "100%" : "auto", l = e.buttonAlign === "left" ? "flex-start" : e.buttonAlign === "right" ? "flex-end" : "center", u = p({
1107
+ for (let t of Object.keys(e)) M.includes(t) || (n[t] = e[t]);
1108
+ let a = T(n), o = Array.isArray(r.fields) ? r.fields : [], s = e.fieldSpacing || "12px", c = o.map((e) => `<div style="margin-bottom: ${s};">${N(e)}</div>`).join(""), l = r.buttonAutoWidth === !1 ? e.buttonWidth || "100%" : "auto", u = e.buttonAlign === "left" ? "flex-start" : e.buttonAlign === "right" ? "flex-end" : "center", d = T({
985
1109
  backgroundColor: e.buttonBackgroundColor,
986
1110
  color: e.buttonTextColor,
987
1111
  borderRadius: e.buttonBorderRadius,
@@ -991,42 +1115,44 @@ var p = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
991
1115
  paddingRight: e.buttonPaddingRight,
992
1116
  fontSize: e.buttonFontSize,
993
1117
  fontWeight: e.buttonFontWeight,
994
- width: c
1118
+ width: l
995
1119
  });
996
- return `<form action="${h(r.actionUrl || r.action || "#")}" method="${h(r.method || "POST")}" style="${i}">${s}<div style="display: flex; width: 100%; justify-content: ${l};"><button type="submit" style="border: 0; cursor: pointer; ${u}">${r.submitLabel || "Submit"}</button></div></form>`;
1120
+ return `<form${i} action="${A(r.actionUrl || r.action || "#")}" method="${A(r.method || "POST")}" style="${a}">${c}<div style="display: flex; width: 100%; justify-content: ${u};"><button type="submit" style="border: 0; cursor: pointer; ${d}">${r.submitLabel || "Submit"}</button></div></form>`;
997
1121
  }
998
1122
  case "input": {
999
- let e = r.inputType || r.type || "text", t = h(r.name || r.fieldName || "field"), i = h(r.placeholder || ""), a = r.required ? " required" : "";
1000
- return `<input type="${h(e)}" name="${t}" placeholder="${i}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${n}"${a} />`;
1123
+ let e = r.inputType || r.type || "text", t = A(r.name || r.fieldName || "field"), a = A(r.placeholder || ""), o = r.required ? " required" : "";
1124
+ return `<input${i} type="${A(e)}" name="${t}" placeholder="${a}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; ${n}"${o} />`;
1001
1125
  }
1002
- case "textarea": return `<textarea name="${h(r.name || r.fieldName || "field")}" placeholder="${h(r.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${n}"${r.required ? " required" : ""}></textarea>`;
1003
- case "select": return `<select name="${h(r.name || r.fieldName || "field")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; ${n}"${r.required ? " required" : ""}>${(Array.isArray(r.options) ? r.options : []).map((e) => `<option value="${h(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
1004
- case "html": return `<div style="${n}">${r.htmlContent || r.text || ""}</div>`;
1126
+ case "textarea": return `<textarea${i} name="${A(r.name || r.fieldName || "field")}" placeholder="${A(r.placeholder || "")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; ${n}"${r.required ? " required" : ""}></textarea>`;
1127
+ case "select": return `<select${i} name="${A(r.name || r.fieldName || "field")}" style="width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; ${n}"${r.required ? " required" : ""}>${(Array.isArray(r.options) ? r.options : []).map((e) => `<option value="${A(e?.value ?? "")}">${e?.label ?? e?.value ?? ""}</option>`).join("")}</select>`;
1128
+ case "html": return `<div${i} style="${n}">${r.htmlContent || r.text || ""}</div>`;
1005
1129
  default: return `<!-- Unsupported block ${e.type} -->`;
1006
1130
  }
1007
- }, b = (e) => {
1131
+ }, F = (e, t) => {
1008
1132
  if (!e || typeof e != "object") return "";
1009
- let t = f(e);
1010
- if (!t) return `\n <!-- ROW SKIPPED (type="${typeof e.type == "string" ? e.type : "unknown"}"${e.id ? `, id="${e.id}"` : ""}): this row has no 'columns' array and its shorthand content (e.g. a list of items/links) can't be auto-converted without losing data. Provide a fully hydrated row with 'columns' and 'elements' instead. -->`;
1011
- let n = p(t.style || {}), r = g("id", t.htmlId), i = g("class", t.htmlClass), a = `\n <!-- ROW START: ${t.id || "row"} -->`;
1012
- a += `\n <div${r}${i} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${n}">`;
1013
- let o = Array.isArray(t.columns) ? t.columns : [];
1014
- for (let e of o) {
1133
+ let n = w(e);
1134
+ if (!n) return `\n <!-- ROW SKIPPED (type="${typeof e.type == "string" ? e.type : "unknown"}"${e.id ? `, id="${e.id}"` : ""}): this row has no 'columns' array and its shorthand content (e.g. a list of items/links) can't be auto-converted without losing data. Provide a fully hydrated row with 'columns' and 'elements' instead. -->`;
1135
+ let r = T(n.style || {}), i = j("id", n.htmlId), a = j("class", n.htmlClass), o = n.id || `row-${Math.random().toString(36).substring(2, 9)}`;
1136
+ O(t, o, n.style, "tablet", n.styleTablet), O(t, o, n.style, "mobile", n.styleMobile);
1137
+ let s = `\n <!-- ROW START: ${n.id || "row"} -->`;
1138
+ s += `\n <div data-plexo-id="${o}"${i}${a} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${r}">`;
1139
+ let c = Array.isArray(n.columns) ? n.columns : [];
1140
+ for (let e of c) {
1015
1141
  if (!e) continue;
1016
- let t = p(e.styles || e.style || {}), n = g("id", e.attrs?.htmlId), r = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "";
1017
- a += `\n <!-- COLUMN START: ${e.id || "col"} -->`, a += `\n <div${n} class="plexo-col${r}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; ${t}">`;
1018
- let i = Array.isArray(e.elements) ? e.elements : [];
1019
- for (let e of i) {
1142
+ let n = e.styles || e.style || {}, r = T(n), i = j("id", e.attrs?.htmlId), a = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", o = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
1143
+ O(t, o, n, "tablet", e.stylesTablet), O(t, o, n, "mobile", e.stylesMobile), s += `\n <!-- COLUMN START: ${e.id || "col"} -->`, s += `\n <div data-plexo-id="${o}"${i} class="plexo-col${a}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; ${r}">`;
1144
+ let c = Array.isArray(e.elements) ? e.elements : [];
1145
+ for (let e of c) {
1020
1146
  if (!e) continue;
1021
- let t = e.attributes || {}, n = typeof t.htmlClassNames == "string" ? t.htmlClassNames : typeof t.htmlClass == "string" ? t.htmlClass : typeof t.className == "string" ? t.className : "", r = g("id", t.htmlId), i = g("class", n), o = e.style?.display, s = o === "inline-block" || o === "inline" || o === "inline-flex" ? `margin-bottom: 16px; display: ${o}; vertical-align: top;` : "margin-bottom: 16px;";
1022
- a += `\n <div${r}${i} style="${s}">`, a += `\n ${y(e)}`, a += "\n </div>";
1147
+ let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "", i = j("id", n.htmlId), a = j("class", r), o = e.style?.display, c = o === "inline-block" || o === "inline" || o === "inline-flex" ? `margin-bottom: 16px; display: ${o}; vertical-align: top;` : "margin-bottom: 16px;";
1148
+ O(t, e.id, e.style, "tablet", e.styleTablet), O(t, e.id, e.style, "mobile", e.styleMobile), s += `\n <div${i}${a} style="${c}">`, s += `\n ${P(e)}`, s += "\n </div>";
1023
1149
  }
1024
- let o = Array.isArray(e.nestedRows) ? e.nestedRows : [];
1025
- for (let e of o) a += b(e);
1026
- a += "\n </div>";
1150
+ let l = Array.isArray(e.nestedRows) ? e.nestedRows : [];
1151
+ for (let e of l) s += F(e, t);
1152
+ s += "\n </div>";
1027
1153
  }
1028
- return a += "\n </div>", a;
1029
- }, x = (e) => {
1154
+ return s += "\n </div>", s;
1155
+ }, I = (e) => {
1030
1156
  if (!e || typeof e != "object") return "<!-- Empty template -->";
1031
1157
  let t = e.designJson || e.template || e, n = t.body || (Array.isArray(t.rows) ? {
1032
1158
  style: t.style || {},
@@ -1053,19 +1179,29 @@ var p = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
1053
1179
  "textColor"
1054
1180
  ], a = {};
1055
1181
  for (let e of Object.keys(r)) i.includes(e) || (a[e] = r[e]);
1056
- let o = p(a), s = typeof r.htmlTitle == "string" && r.htmlTitle.trim() ? r.htmlTitle.trim() : typeof e?.name == "string" && e.name.trim() ? e.name.trim() : "Plexo Rendered Page", c = g("id", r.htmlId), f = g("class", r.htmlClass), m = typeof r.customCss == "string" && r.customCss.trim() ? r.customCss.trim() : "", _ = typeof r.customJs == "string" && r.customJs.trim() ? r.customJs.trim() : "", v = Array.isArray(n.rows) ? n.rows : Array.isArray(t.rows) ? t.rows : Array.isArray(e.rows) ? e.rows : [], y = u(l(v, [r.fontFamily])), x = `<!DOCTYPE html>
1182
+ let o = T(a), s = typeof r.htmlTitle == "string" && r.htmlTitle.trim() ? r.htmlTitle.trim() : typeof e?.name == "string" && e.name.trim() ? e.name.trim() : "Plexo Rendered Page", c = j("id", r.htmlId), d = j("class", r.htmlClass), f = typeof r.customCss == "string" && r.customCss.trim() ? r.customCss.trim() : "", p = typeof r.customJs == "string" && r.customJs.trim() ? r.customJs.trim() : "", m = Array.isArray(n.rows) ? n.rows : Array.isArray(t.rows) ? t.rows : Array.isArray(e.rows) ? e.rows : [], h = u(l(m, [r.fontFamily])), g = {
1183
+ tablet: [],
1184
+ mobile: []
1185
+ }, _ = "";
1186
+ for (let e of m) _ += F(e, g);
1187
+ let v = g.tablet.length ? `\n ${g.tablet.join("\n ")}` : "", y = g.mobile.length ? `\n ${g.mobile.join("\n ")}` : "", b = `<!DOCTYPE html>
1057
1188
  <html>
1058
1189
  <head>
1059
1190
  <meta charset="utf-8">
1060
- <title>${h(s)}</title>
1191
+ <title>${A(s)}</title>
1061
1192
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
1062
- ${y ? `<link rel="stylesheet" href="${y}">` : ""}
1193
+ ${h ? `<link rel="stylesheet" href="${h}">` : ""}
1063
1194
  <style>
1064
- body { margin: 0; font-family: ${d}; }
1195
+ body { margin: 0; font-family: ${C}; }
1065
1196
  .plexo-row {
1066
1197
  display: flex;
1067
1198
  flex-wrap: wrap;
1068
1199
  }
1200
+ /* Tablet: auto-scaled fonts/heights/spacing (see utilities/responsiveDefaults.ts) and
1201
+ any explicit per-element styleTablet/stylesTablet override — columns stay side by
1202
+ side at this width. */
1203
+ @media (min-width: 769px) and (max-width: 1024px) {${v}
1204
+ }
1069
1205
  @media (max-width: 768px) {
1070
1206
  .plexo-row {
1071
1207
  flex-direction: column !important;
@@ -1074,27 +1210,26 @@ var p = (e = {}) => !e || typeof e != "object" ? "" : Object.entries(e).filter((
1074
1210
  width: 100% !important;
1075
1211
  max-width: 100% !important;
1076
1212
  margin-bottom: 16px;
1077
- }
1213
+ }${y}
1078
1214
  }
1079
1215
  </style>
1080
- ${m ? `<style>\n${m}\n </style>` : ""}
1216
+ ${f ? `<style>\n${f}\n </style>` : ""}
1081
1217
  </head>
1082
- <body${c}${f} style="${o}">
1218
+ <body${c}${d} style="${o}">
1083
1219
  <div style="max-width: 1200px; margin: 0 auto; width: 100%;">`;
1084
- for (let e of v) x += b(e);
1085
- return x += `\n </div>
1086
- ${_ ? ` <script>\n${_}\n <\/script>` : ""}
1220
+ return b += _, b += `\n </div>
1221
+ ${p ? ` <script>\n${p}\n <\/script>` : ""}
1087
1222
  </body>
1088
- </html>`, x = x.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1"), x;
1223
+ </html>`, b = b.replace(/<span[^>]*data-merge-val="([^"]*)"[^>]*>[\s\S]*?<\/span>/gi, "$1"), b;
1089
1224
  };
1090
- function S(e) {
1091
- return x(e).replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
1225
+ function L(e) {
1226
+ return I(e).replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
1092
1227
  }
1093
- function C(e) {
1094
- return x(e);
1228
+ function R(e) {
1229
+ return I(e);
1095
1230
  }
1096
- function w(e) {
1231
+ function z(e) {
1097
1232
  return e;
1098
1233
  }
1099
1234
  //#endregion
1100
- export { t as _, S as a, w as c, o as d, n as f, i as g, r as h, C as i, u as l, s as m, _ as n, f as o, a as p, x as r, m as s, d as t, l as u, e as v };
1235
+ export { s as _, R as a, t as b, k as c, S as d, u as f, a as g, n as h, I as i, E as l, o as m, M as n, L as o, l as p, O as r, w as s, C as t, z as u, r as v, e as x, i as y };
package/dist/compiler.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./compiler-CN9XQ7uV.js";
2
- export { s as DEFAULT_BODY_FONT_FAMILY, r as FORM_NON_CSS_STYLE_KEYS, a as compileToHTML, n as compileToHTMLWithStrataAuto, e as compileToPlainText, i as convertSectionRowToPlexoRow, o as getFormDefaultStyle, t as injectStrataBundle };
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c, u as l } from "./compiler-CZDi3u8S.js";
2
+ export { c as DEFAULT_BODY_FONT_FAMILY, i as FORM_NON_CSS_STYLE_KEYS, o as collectResponsiveRule, n as compileToHTML, e as compileToHTMLWithStrataAuto, a as compileToPlainText, s as convertSectionRowToPlexoRow, t as getFormDefaultStyle, r as getInlineStylesImportant, l as injectStrataBundle };