@charisol/plexo-sdk 2.0.3 → 2.0.5
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/README.md +2 -2
- package/dist/{InlineColorPicker-8ewm1Asx.js → InlineColorPicker-BGyPZzyk.js} +326 -138
- package/dist/{client-DlVJt_6V.js → client-CAWtj9sV.js} +1 -1
- package/dist/index.js +12669 -12857
- package/dist/lint-CTTecyu_.js +429 -0
- package/dist/plexo-sdk.css +1 -1
- package/dist/{legacy-B4E71HSa.js → v1-DgwxU8IH.js} +4295 -1654
- package/dist/v2/compile/build.d.ts +15 -0
- package/dist/v2/compile/extras.d.ts +19 -0
- package/dist/v2/compile/html.d.ts +8 -0
- package/dist/v2/compile/index.d.ts +3 -0
- package/dist/v2/compile/sanitizeHtml.d.ts +37 -0
- package/dist/v2/components/fonts/EditorFonts.d.ts +2 -0
- package/dist/v2/components/fonts/FontPicker.d.ts +15 -0
- package/dist/v2/components/fonts/fontLoader.d.ts +13 -0
- package/dist/v2/components/properties/TypeControls.d.ts +10 -0
- package/dist/v2/components/sidebar/ImagesPanel.d.ts +6 -0
- package/dist/v2/context/EditorContext.d.ts +3 -1
- package/dist/v2/data/insertableComponents.d.ts +1 -1
- package/dist/v2/design/css.d.ts +1 -1
- package/dist/v2/design/customFonts.d.ts +49 -0
- package/dist/v2/design/fonts.d.ts +36 -2
- package/dist/v2/design/googleFontsData.d.ts +1 -0
- package/dist/v2/design/index.d.ts +4 -1
- package/dist/v2/design/textStyles.d.ts +6 -2
- package/dist/v2/design/typeScale.d.ts +43 -0
- package/dist/v2/design/types.d.ts +2 -0
- package/dist/v2/host/HostContext.d.ts +15 -0
- package/dist/v2/index.d.ts +5 -0
- package/dist/v2/migrate/v1.d.ts +43 -0
- package/dist/v2/render/dynamicBlocks.d.ts +53 -0
- package/dist/v2/render/elementProps.d.ts +2 -1
- package/dist/v2/render/elements.d.ts +4 -0
- package/dist/v2/sections/catalog/blogArticle.d.ts +2 -0
- package/dist/v2/sections/catalog/blogList.d.ts +2 -0
- package/dist/v2/sections/catalog/cartCheckout.d.ts +2 -0
- package/dist/v2/sections/catalog/dynamicKit.d.ts +10 -0
- package/dist/v2/sections/catalog/funnelSignup.d.ts +2 -0
- package/dist/v2/sections/catalog/orderConfirmation.d.ts +2 -0
- package/dist/v2/sections/catalog/orderTracking.d.ts +2 -0
- package/dist/v2/sections/catalog/productPage.d.ts +2 -0
- package/dist/v2/sections/catalog/shop.d.ts +2 -0
- package/dist/v2/sections/materialize.d.ts +7 -0
- package/dist/v2/sections/types.d.ts +6 -2
- package/dist/v2/types/editor.d.ts +1 -1
- package/dist/v2-compile.js +26 -119
- package/dist/v2-strata.js +1 -1
- package/dist/v2.js +4473 -3593
- package/package.json +1 -1
- package/dist/lint-D-2x-Yeb.js +0 -225
- package/dist/v2/components/sidebar/LibraryPanel.d.ts +0 -3
|
@@ -70,3 +70,10 @@ export declare function applyBlockTweak(root: DocumentNode, nodeId: string, patc
|
|
|
70
70
|
export declare const isManagedChild: (root: DocumentNode, nodeId: string) => boolean;
|
|
71
71
|
/** Swaps a managed section for another node (same position). */
|
|
72
72
|
export declare function replaceNodeById(root: DocumentNode, id: string, next: DocumentNode): DocumentNode;
|
|
73
|
+
/**
|
|
74
|
+
* Changes a heading's level (H1–H6). The level is the heading's meaning (and its tag on the published page); unless the
|
|
75
|
+
* heading has a size of its own, it also moves to the new level's text style, so an H2 really is the design system's H2 size.
|
|
76
|
+
* Inside a ready-made section the change is kept as a tweak, so it survives edits to the section's words and a change of layout.
|
|
77
|
+
* Returns the new tree (the same one if nothing changes).
|
|
78
|
+
*/
|
|
79
|
+
export declare function setHeadingLevel(root: DocumentNode, nodeId: string, level: number): DocumentNode;
|
|
@@ -5,7 +5,7 @@ import type { DocumentNode } from '../types/editor';
|
|
|
5
5
|
* the layout keeps the words, editing is a plain form (or typing right on the page), the section is responsive by
|
|
6
6
|
* construction, and an AI can change one safely by editing its content instead of guessing at layout.
|
|
7
7
|
*/
|
|
8
|
-
export type SectionKind = 'announcement' | 'header' | 'hero' | 'logos' | 'features' | 'about' | 'stats' | 'steps' | 'gallery' | 'video' | 'testimonials' | 'pricing' | 'team' | 'faq' | 'cta' | 'contact' | 'footer';
|
|
8
|
+
export type SectionKind = 'announcement' | 'header' | 'hero' | 'logos' | 'features' | 'about' | 'stats' | 'steps' | 'gallery' | 'video' | 'testimonials' | 'pricing' | 'team' | 'faq' | 'cta' | 'contact' | 'footer' | 'blogList' | 'blogArticle' | 'shop' | 'productPage' | 'cartCheckout' | 'orderConfirmation' | 'orderTracking' | 'funnelSignup';
|
|
9
9
|
export type SectionBackground = 'canvas' | 'surface' | 'sunken' | 'primary' | 'inverted' | 'gradient' | 'image';
|
|
10
10
|
export interface BlockStyle {
|
|
11
11
|
/** Which of the brand's surfaces the section sits on. */
|
|
@@ -30,6 +30,10 @@ export interface NodeOverride {
|
|
|
30
30
|
};
|
|
31
31
|
responsiveVisibility?: import('../types/editor').ResponsiveVisibility;
|
|
32
32
|
hidden?: boolean;
|
|
33
|
+
/** Settings of the element itself that a person can change on the page: a heading's level (H1–H6). */
|
|
34
|
+
props?: {
|
|
35
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
36
|
+
};
|
|
33
37
|
}
|
|
34
38
|
export interface BlockSpec {
|
|
35
39
|
kind: SectionKind;
|
|
@@ -93,7 +97,7 @@ export interface KindDef {
|
|
|
93
97
|
label: string;
|
|
94
98
|
description: string;
|
|
95
99
|
/** Groups the gallery. */
|
|
96
|
-
group: 'Navigation' | 'Intro' | 'Content' | 'Proof' | 'Convert' | 'Footer';
|
|
100
|
+
group: 'Navigation' | 'Intro' | 'Content' | 'Proof' | 'Convert' | 'Footer' | 'Blog' | 'Store' | 'Funnel';
|
|
97
101
|
/** Slim vertical padding (headers, bars, footers) instead of a full section's. */
|
|
98
102
|
compact?: boolean;
|
|
99
103
|
fields: FieldDef[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TextStyleId } from '../design/textStyles';
|
|
2
|
-
export type NodeType = 'page' | 'section' | 'container' | 'columns' | 'column' | 'heading' | 'paragraph' | 'button' | 'image' | 'badge' | 'divider' | 'spacer' | 'card' | 'icon' | 'carousel' | 'video' | 'social' | 'menu' | 'html' | 'table' | 'timer' | 'form' | 'accordion';
|
|
2
|
+
export type NodeType = 'page' | 'section' | 'container' | 'columns' | 'column' | 'heading' | 'paragraph' | 'button' | 'image' | 'badge' | 'divider' | 'spacer' | 'card' | 'icon' | 'carousel' | 'video' | 'social' | 'menu' | 'html' | 'table' | 'timer' | 'form' | 'accordion' | 'blogTitle' | 'blogContent' | 'blogFeaturedImage' | 'blogDate' | 'blogAuthor' | 'blogCategories' | 'blogComments' | 'blogPostList' | 'shopGrid' | 'product' | 'booking' | 'cart' | 'checkout' | 'orderConfirmation' | 'orderTracking' | 'signupForm';
|
|
3
3
|
export type SizingMode = 'hug' | 'fill' | 'fixed';
|
|
4
4
|
export type LayoutMode = 'flow' | 'grid' | 'free';
|
|
5
5
|
export type HorizontalConstraint = 'left' | 'right' | 'center' | 'stretch' | 'scale';
|
package/dist/v2-compile.js
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as z, t as B } from "./lint-D-2x-Yeb.js";
|
|
1
|
+
import { $ as e, $t as t, C as n, D as r, E as i, J as a, K as o, Q as s, Qt as c, St as l, X as u, Y as d, Z as f, _t as p, a as m, bt as h, c as g, cn as _, d as v, dn as y, et as b, f as x, g as S, gt as C, ht as w, i as T, l as E, n as D, o as O, p as k, pn as A, q as j, r as M, s as N, t as P, u as F, un as I, vt as L, w as R, xt as z, y as B, yt as V } from "./v1-DgwxU8IH.js";
|
|
2
|
+
import { n as H, t as U } from "./lint-CTTecyu_.js";
|
|
4
3
|
//#region src/v2/compile/react.ts
|
|
5
|
-
var
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
for (let [
|
|
9
|
-
if (
|
|
10
|
-
let e =
|
|
11
|
-
|
|
4
|
+
var W = /^[A-Z][A-Za-z0-9]*$/, G = (e) => JSON.stringify(e);
|
|
5
|
+
function K(e) {
|
|
6
|
+
let n = "";
|
|
7
|
+
for (let [r, i] of Object.entries(e.attrs ?? {})) {
|
|
8
|
+
if (i === void 0 || i === !1) continue;
|
|
9
|
+
let e = t(r);
|
|
10
|
+
i === !0 ? n += ` ${e}` : typeof i == "number" ? n += ` ${e}={${i}}` : n += ` ${e}={${G(String(i))}}`;
|
|
12
11
|
}
|
|
13
|
-
return e.style && (
|
|
12
|
+
return e.style && (n += ` style={${JSON.stringify(e.style)}}`), n;
|
|
14
13
|
}
|
|
15
|
-
function
|
|
14
|
+
function q(e, t) {
|
|
16
15
|
let n = " ".repeat(t);
|
|
17
|
-
if (typeof e == "string") return `${n}{${
|
|
18
|
-
let r =
|
|
19
|
-
return
|
|
16
|
+
if (typeof e == "string") return `${n}{${G(e)}}`;
|
|
17
|
+
let r = K(e);
|
|
18
|
+
return c.has(e.tag) || !e.children?.length ? `${n}<${e.tag}${r} />` : `${n}<${e.tag}${r}>\n${e.children.map((e) => q(e, t + 1)).join("\n")}\n${n}</${e.tag}>`;
|
|
20
19
|
}
|
|
21
|
-
function
|
|
20
|
+
function J(e) {
|
|
22
21
|
let t = e.replace(/[^A-Za-z0-9]+/g, " ").trim().split(" ").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join("");
|
|
23
22
|
return /^[A-Z]/.test(t) ? t : `Design${t}`;
|
|
24
23
|
}
|
|
25
|
-
function
|
|
26
|
-
if (!
|
|
27
|
-
let n =
|
|
24
|
+
function Y(e, t) {
|
|
25
|
+
if (!W.test(t.componentName)) throw Error(`"${t.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
|
|
26
|
+
let n = k(e, t), i = t.runtime !== "none" && n.usesRuntime, a = n.fontLinks, o = "`" + n.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
|
|
28
27
|
return {
|
|
29
28
|
code: `// Generated by Plexo from a visual design. Edit it visually in the app editor's Design view
|
|
30
29
|
// (which regenerates this file), or turn it into regular code by editing here.
|
|
31
|
-
${
|
|
30
|
+
${i ? "// @ts-nocheck — the small runtime below is plain JavaScript.\nimport { useEffect, useRef } from \"react\";" : "import type { ReactElement } from \"react\";"}
|
|
32
31
|
|
|
33
|
-
const CSS = ${
|
|
34
|
-
${
|
|
35
|
-
export default function ${t.componentName}()${
|
|
36
|
-
${
|
|
32
|
+
const CSS = ${o};
|
|
33
|
+
${a.length ? `const FONTS: string[] = ${JSON.stringify(a)};\n` : ""}${i ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${r};\n` : ""}
|
|
34
|
+
export default function ${t.componentName}()${i ? "" : ": ReactElement"} {
|
|
35
|
+
${i ? " const root = useRef<HTMLDivElement>(null);\n useEffect(() => (root.current ? plexoInit(root.current) : undefined), []);\n" : ""} return (
|
|
37
36
|
<>
|
|
38
|
-
${
|
|
39
|
-
${
|
|
37
|
+
${a.length ? " {FONTS.map((href) => <link key={href} rel=\"stylesheet\" href={href} />)}\n" : ""} <style>{CSS}</style>
|
|
38
|
+
${i ? q(n.tree, 3).replace("<div", "<div ref={root}") : q(n.tree, 3)}
|
|
40
39
|
</>
|
|
41
40
|
);
|
|
42
41
|
}
|
|
@@ -45,96 +44,4 @@ ${r ? W(n.tree, 3).replace("<div", "<div ref={root}") : W(n.tree, 3)}
|
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
46
|
//#endregion
|
|
48
|
-
|
|
49
|
-
var q = 5e3, J = 40, Y = [
|
|
50
|
-
"page",
|
|
51
|
-
"section",
|
|
52
|
-
"container",
|
|
53
|
-
"columns",
|
|
54
|
-
"column",
|
|
55
|
-
"heading",
|
|
56
|
-
"paragraph",
|
|
57
|
-
"button",
|
|
58
|
-
"image",
|
|
59
|
-
"badge",
|
|
60
|
-
"divider",
|
|
61
|
-
"spacer",
|
|
62
|
-
"card",
|
|
63
|
-
"icon",
|
|
64
|
-
"carousel",
|
|
65
|
-
"video",
|
|
66
|
-
"social",
|
|
67
|
-
"menu",
|
|
68
|
-
"html",
|
|
69
|
-
"table",
|
|
70
|
-
"timer",
|
|
71
|
-
"form",
|
|
72
|
-
"accordion"
|
|
73
|
-
], X = n([
|
|
74
|
-
t().max(2e3),
|
|
75
|
-
e(),
|
|
76
|
-
r()
|
|
77
|
-
]), Z = l(t(), X.optional()), Q = a(() => i({
|
|
78
|
-
id: t().min(1).max(200),
|
|
79
|
-
type: c(Y),
|
|
80
|
-
name: t().max(300),
|
|
81
|
-
content: t().max(1e5).optional(),
|
|
82
|
-
props: l(t(), o()).optional(),
|
|
83
|
-
styles: Z,
|
|
84
|
-
responsive: i({
|
|
85
|
-
tablet: Z.optional(),
|
|
86
|
-
mobile: Z.optional()
|
|
87
|
-
}).optional(),
|
|
88
|
-
responsiveVisibility: i({
|
|
89
|
-
hideOnDesktop: r().optional(),
|
|
90
|
-
hideOnTablet: r().optional(),
|
|
91
|
-
hideOnMobile: r().optional()
|
|
92
|
-
}).optional(),
|
|
93
|
-
children: s(Q).optional(),
|
|
94
|
-
locked: r().optional(),
|
|
95
|
-
hidden: r().optional()
|
|
96
|
-
})), re = i({
|
|
97
|
-
id: t().min(1).max(200),
|
|
98
|
-
name: t().max(300),
|
|
99
|
-
slug: t().max(300),
|
|
100
|
-
isHome: r().optional(),
|
|
101
|
-
rootNode: Q
|
|
102
|
-
});
|
|
103
|
-
function $(e, t, n) {
|
|
104
|
-
if (n.n += 1, n.n > 5e3) return `This design is too large (more than ${q} elements).`;
|
|
105
|
-
if (t > 40) return "This design is nested too deeply.";
|
|
106
|
-
if (n.ids.has(e.id)) return `Two elements share the same id ("${e.id}"). Each element needs its own.`;
|
|
107
|
-
n.ids.add(e.id);
|
|
108
|
-
for (let r of e.children ?? []) {
|
|
109
|
-
let e = $(r, t + 1, n);
|
|
110
|
-
if (e) return e;
|
|
111
|
-
}
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
function ie(e) {
|
|
115
|
-
let t = s(re).min(1, "A design needs at least one page.").safeParse(e);
|
|
116
|
-
if (!t.success) {
|
|
117
|
-
let e = t.error.issues[0], n = e.path.length ? ` (at ${e.path.filter((e) => typeof e == "string" && e !== "children" && e !== "rootNode").join(" › ") || "the design"})` : "";
|
|
118
|
-
return {
|
|
119
|
-
ok: !1,
|
|
120
|
-
error: `This design can't be opened: ${e.message}${n}.`
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
let n = t.data;
|
|
124
|
-
for (let e of n) {
|
|
125
|
-
let t = $(e.rootNode, 0, {
|
|
126
|
-
n: 0,
|
|
127
|
-
ids: /* @__PURE__ */ new Set()
|
|
128
|
-
});
|
|
129
|
-
if (t) return {
|
|
130
|
-
ok: !1,
|
|
131
|
-
error: t
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
ok: !0,
|
|
136
|
-
pages: n
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
export { v as FRAME_WIDTH, J as MAX_DEPTH, q as MAX_NODES, f as MEDIA_QUERY, P as PAGE_TEMPLATES, h as SOL_SYSTEM_PROMPT, m as applyCommands, u as blankPages, x as buildPageFromTemplate, O as buildTemplateSections, j as catalogSchema, N as compilePageToHtml, K as compilePageToReact, G as componentNameFor, te as computePlacements, F as convertLegacyDesign, ne as createDefaultDesignSystem, d as describeCommand, _ as describeDesign, ee as describeSection, I as getPageTemplate, k as isLegacyDesign, S as isPageEmpty, B as lintDesignSystem, w as listPageTemplates, ie as parsePages, p as parseSolReply, C as parseVideoUrl, E as printHtml, z as repairDesignSystem, D as resolveFormDestination, g as setPageTemplateResolver, R as solCommandSchema, M as templateSeed };
|
|
47
|
+
export { I as FRAME_WIDTH, n as MAX_CUSTOM_JS, T as MAX_DEPTH, m as MAX_NODES, y as MEDIA_QUERY, C as PAGE_TEMPLATES, o as SOL_SYSTEM_PROMPT, P as V1_DYNAMIC_EQUIVALENTS, D as V2_DYNAMIC_READY, d as applyCommands, s as blankPages, p as buildPageFromTemplate, L as buildTemplateSections, w as catalogSchema, v as compilePageToHtml, Y as compilePageToReact, J as componentNameFor, _ as computePlacements, E as convertLegacyDesign, M as convertV1Design, A as createDefaultDesignSystem, j as describeCommand, e as describeDesign, b as describeSection, V as getPageTemplate, F as isLegacyDesign, h as isPageEmpty, U as lintDesignSystem, z as listPageTemplates, O as parsePages, a as parseSolReply, B as parseVideoUrl, R as prepareCustomJs, x as printHtml, H as repairDesignSystem, S as resolveFormDestination, N as sanitizeCss, g as sanitizeV2Html, u as setPageTemplateResolver, f as solCommandSchema, l as templateSeed, i as validHtmlId };
|
package/dist/v2-strata.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 "./client-
|
|
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 "./client-CAWtj9sV.js";
|
|
2
2
|
export { l as StrataError, c as applySync, t as baseOf, a as componentFromStrata, s as createStrataClient, i as hasAnything, o as planAutoUpdate, u as planSync, r as projectFromStrata, n as summarize, e as tokenFromStrata };
|