@charisol/plexo-sdk 1.4.18 → 1.4.20
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.
|
@@ -804,17 +804,18 @@ var q = (g) => {
|
|
|
804
804
|
backgroundColor: _.backgroundColor,
|
|
805
805
|
overflow: "hidden",
|
|
806
806
|
borderRadius: _.borderRadius || "12px",
|
|
807
|
+
width: _.width || "100%",
|
|
807
808
|
height: _.height || "360px"
|
|
808
809
|
});
|
|
809
810
|
if (e.length === 0) return `<div${C} style="${n}"><div style="padding: 40px; text-align: center; color: #94a3b8;">No images in carousel</div></div>`;
|
|
810
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) => {
|
|
811
812
|
let o = i[r] * 5, s = e.length > 1 ? ` animation: ${t}-fade ${a}s ease-in-out infinite; animation-delay: ${o}s;` : "";
|
|
812
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>`;
|
|
813
|
-
}).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) => {
|
|
814
815
|
let r = i[n] * 5;
|
|
815
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>`;
|
|
816
|
-
}).join("")}</div>` : "",
|
|
817
|
-
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
|
|
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>`;
|
|
818
819
|
}
|
|
819
820
|
case "accordion": {
|
|
820
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({
|
|
@@ -836,35 +837,37 @@ var q = (g) => {
|
|
|
836
837
|
if (!e || typeof e != "object") return "";
|
|
837
838
|
let r = A(e);
|
|
838
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. -->`;
|
|
839
|
-
let i =
|
|
840
|
-
|
|
841
|
-
let c =
|
|
842
|
-
|
|
843
|
-
let
|
|
844
|
-
|
|
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) {
|
|
845
848
|
if (!e) continue;
|
|
846
|
-
let r = e.styles || e.style || {}, i = P(r), a = r.gap || "16px",
|
|
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)}`;
|
|
847
850
|
L(t, l, r, "tablet", e.stylesTablet), L(t, l, r, "mobile", e.stylesMobile);
|
|
848
|
-
let u = Array.isArray(e.elements) ? e.elements : [], d = Array.isArray(e.nestedRows) ? e.nestedRows : [],
|
|
849
|
-
|
|
850
|
-
let
|
|
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]));
|
|
851
854
|
for (let r of g({
|
|
852
855
|
...e,
|
|
853
856
|
elements: u,
|
|
854
857
|
nestedRows: d
|
|
855
858
|
})) {
|
|
856
|
-
let e =
|
|
859
|
+
let e = b.get(r);
|
|
857
860
|
if (e) {
|
|
858
|
-
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,
|
|
859
|
-
L(t, e.id, e.style, "tablet", R(e, e.styleTablet)), L(t, e.id, e.style, "mobile", R(e, e.styleMobile)),
|
|
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>";
|
|
860
863
|
continue;
|
|
861
864
|
}
|
|
862
|
-
let i =
|
|
863
|
-
i && (
|
|
865
|
+
let i = x.get(r);
|
|
866
|
+
i && (f += J(i, t, n));
|
|
864
867
|
}
|
|
865
|
-
|
|
868
|
+
f += "\n </div>";
|
|
866
869
|
}
|
|
867
|
-
return
|
|
870
|
+
return f += "\n </div>", f;
|
|
868
871
|
}, Y = (e, t) => {
|
|
869
872
|
let n = t?.canvasEditorPadding ?? !1;
|
|
870
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-
|
|
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
1
|
import { i as e, n as t, o as n, r, s as i, t as a } from "./sanitizeCompiledHtml-BDiv8Bkr.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-
|
|
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";
|
|
@@ -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", {
|
|
@@ -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