@charisol/plexo-sdk 1.3.0 → 1.4.0
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-nmaKKdLq.js → compiler-JKW4O9Mv.js} +9 -9
- package/dist/compiler.js +1 -1
- package/dist/{compilerClient-DW7b0Ifk.js → compilerClient-Bjf4DbNx.js} +12 -11
- package/dist/compilerClient.js +1 -1
- package/dist/components/CodeViewer.d.ts +3 -0
- package/dist/components/ImportModal.d.ts +3 -0
- package/dist/index.js +30 -9
- package/dist/utilities/playground.interfaces.d.ts +4 -0
- package/package.json +1 -1
|
@@ -643,11 +643,11 @@ var k = {
|
|
|
643
643
|
scale: 1,
|
|
644
644
|
floorPx: 0
|
|
645
645
|
}
|
|
646
|
-
},
|
|
646
|
+
}, N = ["fontSize"], ee = [
|
|
647
647
|
"height",
|
|
648
648
|
"minHeight",
|
|
649
649
|
"maxHeight"
|
|
650
|
-
],
|
|
650
|
+
], te = [
|
|
651
651
|
"padding",
|
|
652
652
|
"paddingTop",
|
|
653
653
|
"paddingBottom",
|
|
@@ -671,19 +671,19 @@ function I(e, t) {
|
|
|
671
671
|
function L(e, t) {
|
|
672
672
|
if (!e || typeof e != "object") return {};
|
|
673
673
|
let n = {};
|
|
674
|
-
for (let r of
|
|
674
|
+
for (let r of N) {
|
|
675
675
|
let i = F(e[r]);
|
|
676
676
|
if (i === null) continue;
|
|
677
677
|
let a = I(i, k[t]);
|
|
678
678
|
a !== null && (n[r] = `${a}px`);
|
|
679
679
|
}
|
|
680
|
-
for (let r of
|
|
680
|
+
for (let r of ee) {
|
|
681
681
|
let i = F(e[r]);
|
|
682
682
|
if (i === null) continue;
|
|
683
683
|
let a = I(i, A[t]);
|
|
684
684
|
a !== null && (n[r] = `${a}px`);
|
|
685
685
|
}
|
|
686
|
-
for (let r of
|
|
686
|
+
for (let r of te) {
|
|
687
687
|
let i = F(e[r]);
|
|
688
688
|
if (i === null) continue;
|
|
689
689
|
let a = I(i, j[t]);
|
|
@@ -1105,11 +1105,11 @@ var ae = (g) => {
|
|
|
1105
1105
|
let _ = g.style || {}, v = g.type === "heading" || g.type === "paragraph" || g.type === "text", y = v ? c(g).autoWidth : !1, b = y ? Object.fromEntries(Object.entries(_).filter(([e]) => e !== "width")) : _, x = V(g.type === "form_container" ? {
|
|
1106
1106
|
...K(),
|
|
1107
1107
|
..._
|
|
1108
|
-
} : b), S = g.attributes || {}, C = ` data-plexo-id="${q(g.id)}"`, w = (e) =>
|
|
1108
|
+
} : b), S = g.attributes || {}, C = ` data-plexo-id="${q(g.id)}"`, w = String(S.boxAlign || "left"), T = v && (y || !!_.width), E = (e) => T ? `<div style="text-align: ${w};">${e}</div>` : e, D = `${T ? "display: inline-block; " : ""}${v && _.height ? "overflow: hidden; " : ""}`;
|
|
1109
1109
|
switch (g.type) {
|
|
1110
|
-
case "heading": return
|
|
1111
|
-
case "paragraph": return
|
|
1112
|
-
case "text": return
|
|
1110
|
+
case "heading": return E(`<h2${C} style="margin-top: 0; margin-bottom: 8px; ${D}${x}">${S.text || "Heading"}</h2>`);
|
|
1111
|
+
case "paragraph": return E(`<p${C} style="margin-top: 0; margin-bottom: 12px; ${D}${x}">${S.text || "Paragraph text content."}</p>`);
|
|
1112
|
+
case "text": return E(`<div${C} style="${D}${x}">${S.text || ""}</div>`);
|
|
1113
1113
|
case "button": {
|
|
1114
1114
|
let e = u(g), t = V({
|
|
1115
1115
|
..._,
|
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-JKW4O9Mv.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 };
|
|
@@ -52,7 +52,7 @@ var p = "https://cdn.jsdelivr.net/npm/@charisol/plexo-sdk@latest/dist/social-ico
|
|
|
52
52
|
return w.push(`.${i} { ${r.join("; ")}; }`), i;
|
|
53
53
|
}, k = (e = {}, t = {}) => {
|
|
54
54
|
let n = ["padding=\"0\""], r = e.fontSize || t.fontSize, i = e.fontWeight || t.fontWeight;
|
|
55
|
-
return r && n.push(`font-size="${h(String(r))}"`), i && n.push(`font-weight="${h(String(i))}"`), e.color && n.push(`color="${h(String(e.color))}"`), e.fontFamily && n.push(`font-family="${h(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${h(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${h(String(e.letterSpacing))}"`),
|
|
55
|
+
return r && n.push(`font-size="${h(String(r))}"`), i && n.push(`font-weight="${h(String(i))}"`), e.color && n.push(`color="${h(String(e.color))}"`), e.fontFamily && n.push(`font-family="${h(String(e.fontFamily))}"`), e.lineHeight && n.push(`line-height="${h(String(e.lineHeight))}"`), e.letterSpacing && n.push(`letter-spacing="${h(String(e.letterSpacing))}"`), n.join(" ");
|
|
56
56
|
}, A = (e = {}) => {
|
|
57
57
|
let t = e.backgroundColor || e.background;
|
|
58
58
|
return t ? ` background-color="${h(String(t))}"` : "";
|
|
@@ -142,7 +142,7 @@ var p = "https://cdn.jsdelivr.net/npm/@charisol/plexo-sdk@latest/dist/social-ico
|
|
|
142
142
|
let e = l.type === "heading" ? {
|
|
143
143
|
fontSize: "24px",
|
|
144
144
|
fontWeight: "700"
|
|
145
|
-
} : { fontSize: "14px" }, t = l.style || {}, n = k(t, e), r = i(l).autoWidth, a = /* @__PURE__ */ new Set([
|
|
145
|
+
} : { fontSize: "14px" }, t = l.style || {}, n = k(t, e), r = i(l).autoWidth, a = String(m.boxAlign || "left"), o = /* @__PURE__ */ new Set([
|
|
146
146
|
"fontSize",
|
|
147
147
|
"fontWeight",
|
|
148
148
|
"color",
|
|
@@ -150,12 +150,12 @@ var p = "https://cdn.jsdelivr.net/npm/@charisol/plexo-sdk@latest/dist/social-ico
|
|
|
150
150
|
"lineHeight",
|
|
151
151
|
"letterSpacing",
|
|
152
152
|
"textAlign"
|
|
153
|
-
]),
|
|
154
|
-
r ?
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
let
|
|
158
|
-
return `<mj-text${n ? ` ${n}` : ""} css-class="${
|
|
153
|
+
]), s = Object.entries(t).filter(([e, t]) => !o.has(e) && e !== "width" && t != null && t !== "").map(([e, t]) => `${e.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${h(String(t))}`);
|
|
154
|
+
r ? s.push("display: inline-block") : t.width && s.push(`width: ${h(String(t.width))}`), t.height && s.push("overflow: hidden"), (t.textAlign || a !== "left") && s.push(`text-align: ${h(String(t.textAlign || "left"))} !important`);
|
|
155
|
+
let c = "";
|
|
156
|
+
s.length > 0 && (c = `plexo-textbox-${l.id}`, w.push(`.${c} > div { ${s.join("; ")}; }`));
|
|
157
|
+
let u = _(c, d);
|
|
158
|
+
return `<mj-text${n ? ` ${n}` : ""} align="${h(a)}" css-class="${u}">${m.text || ""}</mj-text>`;
|
|
159
159
|
}
|
|
160
160
|
if (l.type === "spacer") {
|
|
161
161
|
let e = l.style?.height || "24px", t = y(l.id, f);
|
|
@@ -167,10 +167,11 @@ var p = "https://cdn.jsdelivr.net/npm/@charisol/plexo-sdk@latest/dist/social-ico
|
|
|
167
167
|
}
|
|
168
168
|
return l.type === "card" ? `<mj-text css-class="${d}"><strong style="display:block;margin-bottom:8px;">${h(m.title || "Card Title")}</strong><span style="font-size:14px;color:#64748b;">${h(m.description || "Card description.")}</span></mj-text>` : l.type === "html" ? `<mj-text css-class="${d}">${m.htmlContent || m.text || ""}</mj-text>` : `<mj-text${E}${A} css-class="${d}">${h(m.text || m.htmlContent || "")}</mj-text>`;
|
|
169
169
|
}
|
|
170
|
+
if (l.type === "heading" || l.type === "paragraph" || l.type === "text") {
|
|
171
|
+
let e = l.style || {}, t = i(l).autoWidth, n = String(m.boxAlign || "left"), r = g(t ? Object.fromEntries(Object.entries(e).filter(([e]) => e !== "width")) : e), a = t || !!e.width, o = a ? "display:inline-block;" : "", s = l.type === "heading" ? "h2" : "p", c = l.type === "heading" ? "Heading" : "", u = `${P}<${s}${E}${A} style="${o}${r}">${h(m.text || c)}</${s}>`;
|
|
172
|
+
return a ? `<div style="text-align:${h(n)};">${u}</div>` : u;
|
|
173
|
+
}
|
|
170
174
|
switch (l.type) {
|
|
171
|
-
case "heading": return `${P}<h2${E}${A} style="${T}">${h(m.text || "Heading")}</h2>`;
|
|
172
|
-
case "paragraph":
|
|
173
|
-
case "text": return `${P}<p${E}${A} style="${T}">${h(m.text || "")}</p>`;
|
|
174
175
|
case "button": return `${P}<a${E}${A} href="${h(m.href || "#")}" style="${T}">${h(m.text || "Button")}</a>`;
|
|
175
176
|
case "image": return `${P}<img${E}${A} src="${h(m.src || "")}" alt="${h(m.alt || "")}" style="${T}" />`;
|
|
176
177
|
case "html": return `${P}<div${E}${A} style="${T}">${String(m.htmlContent || "")}</div>`;
|
package/dist/compilerClient.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./compilerClient-
|
|
1
|
+
import { t as e } from "./compilerClient-Bjf4DbNx.js";
|
|
2
2
|
export { e as parseJsonToTargetFormat };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as e, n as t, r as n, t as r } from "./sanitizeCompiledHtml-C_sPjL3B.js";
|
|
2
2
|
import { S as i, _ as a, a as o, b as s, c, f as l, h as u, i as d, l as f, o as p, p as m, s as h, u as g, x as _, y as v } from "./iconSvgStatic-CGue7nyp.js";
|
|
3
|
-
import { S as y, _ as b, a as x, b as S, d as C, f as ee, g as te, h as w, i as T, m as ne, o as re, p as ie, u as ae, v as oe, x as se } from "./compiler-
|
|
4
|
-
import { t as ce } from "./compilerClient-
|
|
3
|
+
import { S as y, _ as b, a as x, b as S, d as C, f as ee, g as te, h as w, i as T, m as ne, o as re, p as ie, u as ae, v as oe, x as se } from "./compiler-JKW4O9Mv.js";
|
|
4
|
+
import { t as ce } from "./compilerClient-Bjf4DbNx.js";
|
|
5
5
|
import le, { createContext as E, createElement as ue, forwardRef as de, useCallback as fe, useContext as pe, useEffect as D, useImperativeHandle as me, useMemo as he, useRef as O, useState as k } from "react";
|
|
6
6
|
import { DndContext as A, DragOverlay as ge, MeasuringStrategy as _e, PointerSensor as ve, TouchSensor as j, pointerWithin as ye, rectIntersection as be, useDraggable as xe, useDroppable as Se, useSensor as Ce, useSensors as we } from "@dnd-kit/core";
|
|
7
7
|
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
@@ -7860,9 +7860,10 @@ var Pu = ({ activeTab: e, setActiveTab: t, showSaveButton: n, isSavingLayout: r,
|
|
|
7860
7860
|
rows: 10,
|
|
7861
7861
|
className: "w-full rounded border p-2.5 font-mono text-xs outline-none resize-y",
|
|
7862
7862
|
style: {
|
|
7863
|
-
backgroundColor: "#000000",
|
|
7864
|
-
borderColor: s?.borderColor || "#334155",
|
|
7865
|
-
color: s?.textColor || "#e2e8f0"
|
|
7863
|
+
backgroundColor: s?.inputBackground || "#000000",
|
|
7864
|
+
borderColor: s?.inputBorder || s?.borderColor || "#334155",
|
|
7865
|
+
color: s?.inputText || s?.textColor || "#e2e8f0",
|
|
7866
|
+
caretColor: s?.inputText || s?.textColor || "#e2e8f0"
|
|
7866
7867
|
}
|
|
7867
7868
|
}),
|
|
7868
7869
|
u && /* @__PURE__ */ N("div", {
|
|
@@ -50433,6 +50434,16 @@ var sW = (e) => {
|
|
|
50433
50434
|
max: 2e3,
|
|
50434
50435
|
onChange: (e) => s("width", e)
|
|
50435
50436
|
}),
|
|
50437
|
+
(n.autoWidth === !0 || !!r.width) && /* @__PURE__ */ N(f, {
|
|
50438
|
+
label: "Justify",
|
|
50439
|
+
value: n.boxAlign || "left",
|
|
50440
|
+
onChange: (e) => o("boxAlign", e),
|
|
50441
|
+
options: [
|
|
50442
|
+
"left",
|
|
50443
|
+
"center",
|
|
50444
|
+
"right"
|
|
50445
|
+
]
|
|
50446
|
+
}),
|
|
50436
50447
|
/* @__PURE__ */ P("div", {
|
|
50437
50448
|
className: "flex items-center justify-between py-2 border-b border-slate-800/10",
|
|
50438
50449
|
children: [/* @__PURE__ */ N("span", {
|
|
@@ -50792,6 +50803,16 @@ var lW = (e) => {
|
|
|
50792
50803
|
max: 2e3,
|
|
50793
50804
|
onChange: (e) => s("width", e)
|
|
50794
50805
|
}),
|
|
50806
|
+
(n.autoWidth === !0 || !!r.width) && /* @__PURE__ */ N(d, {
|
|
50807
|
+
label: "Justify",
|
|
50808
|
+
value: n.boxAlign || "left",
|
|
50809
|
+
onChange: (e) => o("boxAlign", e),
|
|
50810
|
+
options: [
|
|
50811
|
+
"left",
|
|
50812
|
+
"center",
|
|
50813
|
+
"right"
|
|
50814
|
+
]
|
|
50815
|
+
}),
|
|
50795
50816
|
/* @__PURE__ */ P("div", {
|
|
50796
50817
|
className: "flex items-center justify-between py-2 border-b border-slate-800/10",
|
|
50797
50818
|
children: [/* @__PURE__ */ N("span", {
|
|
@@ -56351,8 +56372,8 @@ var ZW = ({ label: e, value: t, unit: n = "px", units: r, min: i = 0, max: a = 5
|
|
|
56351
56372
|
menuClassName: "min-w-[190px]",
|
|
56352
56373
|
align: "right"
|
|
56353
56374
|
})]
|
|
56354
|
-
}), $W = ({ label: e, value: t, onChange: n }) => {
|
|
56355
|
-
let
|
|
56375
|
+
}), $W = ({ label: e, value: t, onChange: n, options: r }) => {
|
|
56376
|
+
let i = [
|
|
56356
56377
|
{
|
|
56357
56378
|
value: "left",
|
|
56358
56379
|
icon: z.alignLeft,
|
|
@@ -56373,7 +56394,7 @@ var ZW = ({ label: e, value: t, unit: n = "px", units: r, min: i = 0, max: a = 5
|
|
|
56373
56394
|
icon: z.alignJustify,
|
|
56374
56395
|
label: "Justify"
|
|
56375
56396
|
}
|
|
56376
|
-
];
|
|
56397
|
+
], a = r ? i.filter((e) => r.includes(e.value)) : i;
|
|
56377
56398
|
return /* @__PURE__ */ P("div", {
|
|
56378
56399
|
className: "flex items-center justify-between py-3 border-b border-slate-800/10 last:border-b-0",
|
|
56379
56400
|
children: [/* @__PURE__ */ N("span", {
|
|
@@ -56381,7 +56402,7 @@ var ZW = ({ label: e, value: t, unit: n = "px", units: r, min: i = 0, max: a = 5
|
|
|
56381
56402
|
children: e
|
|
56382
56403
|
}), /* @__PURE__ */ N("div", {
|
|
56383
56404
|
className: "flex bg-slate-950 border border-slate-800/50 p-0.5",
|
|
56384
|
-
children:
|
|
56405
|
+
children: a.map((e) => /* @__PURE__ */ N("button", {
|
|
56385
56406
|
onClick: () => n(e.value),
|
|
56386
56407
|
className: `w-7 h-7 flex items-center justify-center transition ${t === e.value ? "bg-indigo-650 text-white shadow-sm" : "text-slate-500 hover:text-slate-250"}`,
|
|
56387
56408
|
title: e.label,
|
|
@@ -299,6 +299,10 @@ export interface InlineAlignmentProps {
|
|
|
299
299
|
label: string;
|
|
300
300
|
value: string;
|
|
301
301
|
onChange: (val: string) => void;
|
|
302
|
+
/** Restricts which alignment icons render -- e.g. box-position controls have no
|
|
303
|
+
* meaningful "justify" (a single box can't justify itself the way wrapped text can).
|
|
304
|
+
* Defaults to all four when omitted, preserving every existing caller's behavior. */
|
|
305
|
+
options?: Array<'left' | 'center' | 'right' | 'justify'>;
|
|
302
306
|
}
|
|
303
307
|
export interface InlineTextInputProps {
|
|
304
308
|
label: string;
|
package/package.json
CHANGED