@charisol/plexo-sdk 1.4.19 → 1.4.21

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.
@@ -811,11 +811,11 @@ var q = (g) => {
811
811
  let r = Math.min(e.length - 1, Math.max(0, parseInt(String(S.activeIdx), 10) || 0)), i = e.map((t, n) => (n - r + e.length) % e.length), a = e.length * 5, o = .6, s = e.map((n, r) => {
812
812
  let o = i[r] * 5, s = e.length > 1 ? ` animation: ${t}-fade ${a}s ease-in-out infinite; animation-delay: ${o}s;` : "";
813
813
  return `<div data-slide-idx="${r}" style="opacity: ${e.length > 1 ? "0" : "1"};${s}"><img src="${B(n.src)}" alt="${B(n.alt || n.caption || "")}" style="width: 100%; height: 100%; object-fit: cover; display: block;" />${n.caption ? `<div class="${t}-caption" style="padding: 8px; text-align: center; background: rgba(15, 23, 42, 0.8); color: #fff; font-size: 12px; font-weight: 600;">${B(n.caption)}</div>` : ""}</div>`;
814
- }).join(""), c = e.length > 1 ? `<div class="${t}-dots" style="display: flex; gap: 6px; justify-content: center;">${e.map((e, n) => {
814
+ }).join(""), c = e.some((e) => !!e.caption) ? "38px" : "10px", l = e.length > 1 ? `<div class="${t}-dots" style="display: flex; gap: 6px; justify-content: center;">${e.map((e, n) => {
815
815
  let r = i[n] * 5;
816
816
  return `<span style="width: 6px; height: 6px; border-radius: 9999px; background: #cbd5e1; animation: ${t}-dot ${a}s ease-in-out infinite; animation-delay: ${r}s;"></span>`;
817
- }).join("")}</div>` : "", l = (5 - o) / a * 100, u = 5 / a * 100, d = o / a * 100;
818
- return `<div${C} class="${t}" style="${n}">${e.length > 1 ? `<style>.${t}{position:relative;}.${t} [data-slide-idx]{position:absolute;inset:0;}.${t}-caption{position:absolute;left:0;right:0;bottom:0;}.${t}-dots{position:absolute;left:0;right:0;bottom:10px;}@keyframes ${t}-fade{0%{opacity:0;}${d}%{opacity:1;}${l}%{opacity:1;}${u}%{opacity:0;}100%{opacity:0;}}@keyframes ${t}-dot{0%{background:#cbd5e1;}${d}%{background:#4f46e5;}${l}%{background:#4f46e5;}${u}%{background:#cbd5e1;}100%{background:#cbd5e1;}}</style>` : `<style>.${t}{position:relative;}.${t} [data-slide-idx]{position:absolute;inset:0;}.${t}-caption{position:absolute;left:0;right:0;bottom:0;}</style>`}${s}${c}</div>`;
817
+ }).join("")}</div>` : "", u = (5 - o) / a * 100, d = 5 / a * 100, f = o / a * 100;
818
+ return `<div${C} class="${t}" style="${n}">${e.length > 1 ? `<style>.${t}{position:relative;}.${t} [data-slide-idx]{position:absolute;inset:0;}.${t}-caption{position:absolute;left:0;right:0;bottom:0;}.${t}-dots{position:absolute;left:0;right:0;bottom:${c};}@keyframes ${t}-fade{0%{opacity:0;}${f}%{opacity:1;}${u}%{opacity:1;}${d}%{opacity:0;}100%{opacity:0;}}@keyframes ${t}-dot{0%{background:#cbd5e1;}${f}%{background:#4f46e5;}${u}%{background:#4f46e5;}${d}%{background:#cbd5e1;}100%{background:#cbd5e1;}}</style>` : `<style>.${t}{position:relative;}.${t} [data-slide-idx]{position:absolute;inset:0;}.${t}-caption{position:absolute;left:0;right:0;bottom:0;}</style>`}${s}${l}</div>`;
819
819
  }
820
820
  case "accordion": {
821
821
  let e = o(g), t = S.mode === "multi" ? "multi" : "single", n = S.iconStyle || "chevron", r = S.iconPosition === "left", i = S.showDividers !== !1, a = S.animation !== "none", s = P({
@@ -837,35 +837,37 @@ var q = (g) => {
837
837
  if (!e || typeof e != "object") return "";
838
838
  let r = A(e);
839
839
  if (!r) 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. -->`;
840
- let i = P(r.style || {}), a = V("id", r.htmlId), o = V("class", r.htmlClass), s = r.id || `row-${Math.random().toString(36).substring(2, 9)}`;
841
- L(t, s, r.style, "tablet", r.styleTablet), L(t, s, r.style, "mobile", r.styleMobile);
842
- let c = `\n <!-- ROW START: ${r.id || "row"} -->`;
843
- c += `\n <div data-plexo-id="${s}"${a}${o} class="plexo-row" style="display: flex; flex-wrap: wrap; margin-left: -8px; margin-right: -8px; ${i}">`;
844
- let l = Array.isArray(r.columns) ? r.columns : [];
845
- for (let e of l) {
840
+ let i = r.style?.columnGap, a = typeof i == "number" ? `${i}px` : typeof i == "string" ? i.trim() : "", o = a !== "" && a !== "0" && a !== "0px", s = { ...r.style || {} };
841
+ delete s.columnGap;
842
+ let c = P(s), l = V("id", r.htmlId), u = V("class", r.htmlClass), d = r.id || `row-${Math.random().toString(36).substring(2, 9)}`;
843
+ L(t, d, r.style, "tablet", r.styleTablet), L(t, d, r.style, "mobile", r.styleMobile);
844
+ let f = `\n <!-- ROW START: ${r.id || "row"} -->`, p = o ? `gap: ${a}; margin-left: 0; margin-right: 0;` : "margin-left: -8px; margin-right: -8px;";
845
+ f += `\n <div data-plexo-id="${d}"${l}${u} class="plexo-row" style="display: flex; flex-wrap: wrap; ${p} ${c}">`;
846
+ let m = Array.isArray(r.columns) ? r.columns : [], h = o && m.length > 1 ? `(${a} * ${m.length - 1} / ${m.length})` : "";
847
+ for (let e of m) {
846
848
  if (!e) continue;
847
- let r = e.styles || e.style || {}, i = P(r), a = r.gap || "16px", o = V("id", e.attrs?.htmlId), s = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", l = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
849
+ let r = e.styles || e.style || {}, i = P(r), a = r.gap || "16px", s = V("id", e.attrs?.htmlId), c = e.attrs?.htmlClass ? ` ${e.attrs.htmlClass}` : "", l = e.id || `col-${Math.random().toString(36).substring(2, 9)}`;
848
850
  L(t, l, r, "tablet", e.stylesTablet), L(t, l, r, "mobile", e.stylesMobile);
849
- let u = Array.isArray(e.elements) ? e.elements : [], d = Array.isArray(e.nestedRows) ? e.nestedRows : [], f = n && u.length === 0 && d.length === 0 ? "min-height: 148px; " : "";
850
- c += `\n <!-- COLUMN START: ${e.id || "col"} -->`, c += `\n <div data-plexo-id="${l}"${o} class="plexo-col${s}" style="box-sizing: border-box; padding-left: 8px; padding-right: 8px; width: ${e.width || "100%"}; --plexo-col-gap: ${a}; ${f}${i}">`;
851
- let p = new Map(u.map((e) => [e.id, e])), m = new Map(d.map((e) => [e.id, e]));
851
+ let u = Array.isArray(e.elements) ? e.elements : [], d = Array.isArray(e.nestedRows) ? e.nestedRows : [], p = n && u.length === 0 && d.length === 0 ? "min-height: 148px; " : "", m = e.width || "100%", _ = typeof m == "string" && /^\s*\d+(\.\d+)?\s*%\s*$/.test(m), v = o && _ && h ? `calc(${m.trim()} - ${h})` : m, y = o ? "padding-left: 0; padding-right: 0;" : "padding-left: 8px; padding-right: 8px;";
852
+ f += `\n <!-- COLUMN START: ${e.id || "col"} -->`, f += `\n <div data-plexo-id="${l}"${s} class="plexo-col${c}" style="box-sizing: border-box; ${y} width: ${v}; --plexo-col-gap: ${a}; ${p}${i}">`;
853
+ let b = new Map(u.map((e) => [e.id, e])), x = new Map(d.map((e) => [e.id, e]));
852
854
  for (let r of g({
853
855
  ...e,
854
856
  elements: u,
855
857
  nestedRows: d
856
858
  })) {
857
- let e = p.get(r);
859
+ let e = b.get(r);
858
860
  if (e) {
859
- let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "", i = V("id", n.htmlId), o = V("class", r), s = e.style?.display, l = s === "inline-block" || s === "inline" || s === "inline-flex" ? `margin-bottom: ${a}; display: ${s}; vertical-align: top;` : `margin-bottom: ${a};`;
860
- L(t, e.id, e.style, "tablet", R(e, e.styleTablet)), L(t, e.id, e.style, "mobile", R(e, e.styleMobile)), c += `\n <div${i}${o} style="${l}">`, c += `\n ${q(e)}`, c += "\n </div>";
861
+ let n = e.attributes || {}, r = typeof n.htmlClassNames == "string" ? n.htmlClassNames : typeof n.htmlClass == "string" ? n.htmlClass : typeof n.className == "string" ? n.className : "", i = V("id", n.htmlId), o = V("class", r), s = e.style?.display, c = s === "inline-block" || s === "inline" || s === "inline-flex" ? `margin-bottom: ${a}; display: ${s}; vertical-align: top;` : `margin-bottom: ${a};`;
862
+ L(t, e.id, e.style, "tablet", R(e, e.styleTablet)), L(t, e.id, e.style, "mobile", R(e, e.styleMobile)), f += `\n <div${i}${o} style="${c}">`, f += `\n ${q(e)}`, f += "\n </div>";
861
863
  continue;
862
864
  }
863
- let i = m.get(r);
864
- i && (c += J(i, t, n));
865
+ let i = x.get(r);
866
+ i && (f += J(i, t, n));
865
867
  }
866
- c += "\n </div>";
868
+ f += "\n </div>";
867
869
  }
868
- return c += "\n </div>", c;
870
+ return f += "\n </div>", f;
869
871
  }, Y = (e, t) => {
870
872
  let n = t?.canvasEditorPadding ?? !1;
871
873
  if (!e || typeof e != "object") return "<!-- Empty template -->";
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-BpDm3W8b.js";
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-sF2uR6Ky.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 };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { i as e, n as t, o as n, r, s as i, t as a } from "./sanitizeCompiledHtml-BDiv8Bkr.js";
1
+ import { i as e, n as t, o as n, r, s as i, t as a } from "./sanitizeCompiledHtml-fZlEh8q-.js";
2
2
  import { S as o, _ as s, a as c, b as l, c as u, f as d, h as f, i as p, l as m, o as h, p as g, s as _, u as v, x as y, y as b } from "./iconSvgStatic-CGue7nyp.js";
3
- import { a as x, d as S, f as C, i as ee, o as te, u as w } from "./compiler-BpDm3W8b.js";
3
+ import { a as x, d as S, f as C, i as ee, o as te, u as w } from "./compiler-sF2uR6Ky.js";
4
4
  import { t as ne } from "./compilerClient-BIrZIgfG.js";
5
5
  import T, { createContext as E, createElement as re, forwardRef as ie, useCallback as ae, useContext as oe, useEffect as D, useImperativeHandle as se, useMemo as O, useRef as k, useState as A } from "react";
6
6
  import { DndContext as ce, DragOverlay as le, MeasuringStrategy as ue, PointerSensor as de, TouchSensor as fe, pointerWithin as pe, rectIntersection as me, useDraggable as j, useDroppable as he, useSensor as M, useSensors as ge } from "@dnd-kit/core";
@@ -1895,7 +1895,7 @@ async function Tt(e, t) {
1895
1895
  let n = ne(e, "email", {
1896
1896
  instrument: !0,
1897
1897
  canvasEditorPadding: !0
1898
- }), { compileMjmlInBrowser: i } = await import("./mjmlBrowser-DQvN8hjF.js"), { html: a, errors: o } = i(n, { validationLevel: "soft" });
1898
+ }), { compileMjmlInBrowser: i } = await import("./mjmlBrowser-DLcLxc22.js"), { html: a, errors: o } = i(n, { validationLevel: "soft" });
1899
1899
  return {
1900
1900
  html: a,
1901
1901
  error: o.length > 0 ? o.map((e) => e.message ?? e.formattedMessage ?? "Unknown MJML error").join("; ") : null
@@ -60654,6 +60654,14 @@ var hK = (e) => ({ body: {
60654
60654
  max: 2e3,
60655
60655
  onChange: (e) => J("height", e)
60656
60656
  }),
60657
+ /* @__PURE__ */ P(zG, {
60658
+ label: "Column Gap",
60659
+ value: Q.columnGap || "0px",
60660
+ units: ["px"],
60661
+ min: 0,
60662
+ max: 200,
60663
+ onChange: (e) => J("columnGap", e)
60664
+ }),
60657
60665
  /* @__PURE__ */ F("div", {
60658
60666
  className: "flex items-center justify-between py-3 border-b border-slate-800/10 last:border-b-0",
60659
60667
  children: [/* @__PURE__ */ P("span", {
@@ -1,4 +1,4 @@
1
- import { a as e, s as t } from "./sanitizeCompiledHtml-BDiv8Bkr.js";
1
+ import { a as e, s as t } from "./sanitizeCompiledHtml-fZlEh8q-.js";
2
2
  //#endregion
3
3
  //#region src/utilities/mjmlBrowser.ts
4
4
  var n = /* @__PURE__ */ t((/* @__PURE__ */ e(((e, t) => {
package/dist/sanitize.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, r as t, t as n } from "./sanitizeCompiledHtml-BDiv8Bkr.js";
1
+ import { n as e, r as t, t as n } from "./sanitizeCompiledHtml-fZlEh8q-.js";
2
2
  export { n as ALLOWED_ATTR, e as ALLOWED_TAGS, t as sanitizeCompiledHtml };
@@ -5043,7 +5043,7 @@ function ir(e) {
5043
5043
  }
5044
5044
  return n.join("; ");
5045
5045
  }
5046
- var ar = /* @__PURE__ */ "html.head.body.title.meta.style.link.div.span.p.h1.h2.h3.h4.h5.h6.a.img.button.svg.path.table.thead.tbody.tr.th.td.hr.br.ul.ol.li.section.article.main.header.footer.aside.g.circle.rect.line.polyline.polygon.ellipse.defs.lineargradient.radialgradient.stop.clippath.use.text.tspan".split("."), or = /* @__PURE__ */ "href.src.alt.class.id.style.title.target.rel.width.height.align.valign.cellpadding.cellspacing.border.viewbox.fill.stroke.d.xmlns.charset.name.content.lang.property.cx.cy.r.rx.ry.x1.y1.x2.y2.points.transform.stroke-width.stroke-linecap.stroke-linejoin.stroke-dasharray.opacity.stop-color.stop-opacity.offset.clip-path.gradientunits.preserveaspectratio.text-anchor.dominant-baseline.font-size.letter-spacing.data-*".split("."), sr = [
5046
+ var ar = /* @__PURE__ */ "html.head.body.title.meta.style.link.div.span.p.h1.h2.h3.h4.h5.h6.a.img.button.svg.path.table.thead.tbody.tr.th.td.hr.br.ul.ol.li.section.article.main.header.footer.aside.g.circle.rect.line.polyline.polygon.ellipse.defs.lineargradient.radialgradient.stop.clippath.use.text.tspan.form.input.textarea.select.option.label".split("."), or = /* @__PURE__ */ "href.src.alt.class.id.style.title.target.rel.width.height.align.valign.cellpadding.cellspacing.border.viewbox.fill.stroke.d.xmlns.charset.name.content.lang.action.method.type.placeholder.required.value.property.cx.cy.r.rx.ry.x1.y1.x2.y2.points.transform.stroke-width.stroke-linecap.stroke-linejoin.stroke-dasharray.opacity.stop-color.stop-opacity.offset.clip-path.gradientunits.preserveaspectratio.text-anchor.dominant-baseline.font-size.letter-spacing.data-*".split("."), sr = [
5047
5047
  "javascript:",
5048
5048
  "vbscript:",
5049
5049
  "data:"
@@ -5059,7 +5059,11 @@ function cr(e) {
5059
5059
  let e = typeof n.href == "string" ? n.href.trim() : "";
5060
5060
  /^https?:\/\//i.test(e) && !n.target && (n.target = "_blank"), n.target === "_blank" && (n.rel = "noopener noreferrer");
5061
5061
  }
5062
- for (let e of ["href", "src"]) {
5062
+ for (let e of [
5063
+ "href",
5064
+ "src",
5065
+ "action"
5066
+ ]) {
5063
5067
  let t = n[e];
5064
5068
  if (typeof t == "string") {
5065
5069
  let r = t.trim().toLowerCase();
@@ -13,6 +13,11 @@ export interface RowStyles {
13
13
  backgroundColor?: string;
14
14
  padding?: string;
15
15
  margin?: string;
16
+ /** Space between this row's columns (e.g. '24px'). Unlike a raw CSS `gap` bolted onto a
17
+ * row whose percentage-width columns already sum to 100%, compileRowToHTML compensates
18
+ * each percentage column's width to absorb the gap, so setting this can never push the
19
+ * row's columns past 100% and force an unwanted flex-wrap. See compileRowToHTML. */
20
+ columnGap?: string;
16
21
  [key: string]: string | number | undefined;
17
22
  }
18
23
  export interface ElementStyles {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@charisol/plexo-sdk",
3
3
  "private": false,
4
- "version": "1.4.19",
4
+ "version": "1.4.21",
5
5
  "description": "Plexo visual email and landing page builder SDK — drag-and-drop template editor with AI integration.",
6
6
  "keywords": [
7
7
  "email-builder",