@charisol/plexo-sdk 2.0.7 → 2.0.9
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 +11 -0
- package/dist/{v1-iodIbfkY.js → v1-DTtcJDF-.js} +2888 -1905
- package/dist/v2/compile/index.d.ts +3 -0
- package/dist/v2/components/layout/TopToolbar.d.ts +2 -0
- package/dist/v2/components/properties/inspectorBits.d.ts +2 -1
- package/dist/v2/data/insertableComponents.d.ts +2 -0
- package/dist/v2/email/blank.d.ts +5 -0
- package/dist/v2/email/compile.d.ts +26 -0
- package/dist/v2/email/insertables.d.ts +5 -0
- package/dist/v2/email/support.d.ts +20 -0
- package/dist/v2/host/HostContext.d.ts +2 -0
- package/dist/v2/index.d.ts +5 -0
- package/dist/v2/render/nodeStyle.d.ts +8 -0
- package/dist/v2/sections/catalog/email.d.ts +3 -0
- package/dist/v2/sections/registry.d.ts +3 -0
- package/dist/v2/sections/types.d.ts +2 -2
- package/dist/v2/types/editor.d.ts +6 -0
- package/dist/v2-compile.js +17 -17
- package/dist/v2.js +3979 -3550
- package/package.json +1 -1
|
@@ -29,3 +29,6 @@ export type { SolCatalog, SolDesignSummary, SolCommand, CommandResult, ApplyResu
|
|
|
29
29
|
export { sanitizeV2Html, sanitizeCss, type SanitizeV2Options } from './sanitizeHtml';
|
|
30
30
|
export { MAX_CUSTOM_JS, validHtmlId, prepareCustomJs } from './extras';
|
|
31
31
|
export { convertV1Design, V1_DYNAMIC_EQUIVALENTS, V2_DYNAMIC_READY, type ConvertV1Options, type ConvertV1Result, type ConvertV1Fidelity } from '../migrate/v1';
|
|
32
|
+
export { compilePageToEmail, type CompileEmailOptions, type CompiledEmail } from '../email/compile';
|
|
33
|
+
export { emailIssues, EMAIL_WIDTH, type EmailIssue } from '../email/support';
|
|
34
|
+
export { blankEmailPages, starterEmailPages } from '../email/blank';
|
|
@@ -4,5 +4,7 @@ export type ToolbarTier = 'full' | 'compact' | 'tight';
|
|
|
4
4
|
export declare const TIER_FULL_MIN = 1180;
|
|
5
5
|
export declare const TIER_COMPACT_MIN = 860;
|
|
6
6
|
export declare const CRAMPED_MAX = 760;
|
|
7
|
+
/** From this width the bar is split into equal halves around the middle group, so undo/redo, screen sizes and Design/Code sit in the exact centre. Narrower, every side takes only what it needs. */
|
|
8
|
+
export declare const CENTERED_MIN = 1240;
|
|
7
9
|
export declare const tierForWidth: (w: number) => ToolbarTier;
|
|
8
10
|
export declare const TopToolbar: React.FC;
|
|
@@ -5,7 +5,8 @@ export declare const inputCls = "w-full min-w-0 bg-px-raised border border-px-li
|
|
|
5
5
|
export declare const Group: React.FC<{
|
|
6
6
|
title: string;
|
|
7
7
|
defaultOpen?: boolean;
|
|
8
|
-
hint?: string;
|
|
8
|
+
hint?: string; /** Not offered here (e.g. shadows when designing an email). */
|
|
9
|
+
hide?: boolean;
|
|
9
10
|
children: React.ReactNode;
|
|
10
11
|
}>;
|
|
11
12
|
/** A label on the left, its control on the right. */
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PageDefinition } from '../types/editor';
|
|
2
|
+
/** An empty email: one 600px column to put things in. */
|
|
3
|
+
export declare function blankEmailPages(): PageDefinition[];
|
|
4
|
+
/** A finished-looking starting email: header, main message, highlights, a button and a footer. */
|
|
5
|
+
export declare function starterEmailPages(): PageDefinition[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PageDefinition } from '../types/editor';
|
|
2
|
+
import type { DesignSystem } from '../design/types';
|
|
3
|
+
export interface CompileEmailOptions {
|
|
4
|
+
/** The design system the email's colours and fonts come from (the brand). */
|
|
5
|
+
designSystem?: DesignSystem;
|
|
6
|
+
title?: string;
|
|
7
|
+
lang?: string;
|
|
8
|
+
/** The grey line shown beside the subject in an inbox. Hidden in the email itself. */
|
|
9
|
+
preheader?: string;
|
|
10
|
+
/** Set a different width (default 600). */
|
|
11
|
+
width?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface CompiledEmail {
|
|
14
|
+
/** The whole document, ready to hand to an email sender. */
|
|
15
|
+
html: string;
|
|
16
|
+
/** A plain-text version for the apps and filters that want one. */
|
|
17
|
+
text: string;
|
|
18
|
+
warnings: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Writes a page as an email: nested tables with the styling inline, which is the one thing every email app understands.
|
|
22
|
+
* Boxes become tables (a row of children is one table row, a column is a stack of rows), text and buttons sit in cells, and
|
|
23
|
+
* on a phone the columns stack. Anything an email can't show is left out and reported in `warnings`, never half-drawn.
|
|
24
|
+
* The design is untrusted input: text and addresses are escaped and colours / lengths are checked.
|
|
25
|
+
*/
|
|
26
|
+
export declare function compilePageToEmail(page: PageDefinition, opts?: CompileEmailOptions): CompiledEmail;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DocumentNode } from '../types/editor';
|
|
2
|
+
import type { InsertableComponentItem } from '../data/insertableComponents';
|
|
3
|
+
export declare const EMAIL_INSERTABLES: InsertableComponentItem[];
|
|
4
|
+
/** The element an email "Add" item creates (with a starting look in the brand), or null when the id isn't an email item. */
|
|
5
|
+
export declare function buildEmailNode(componentId: string, id: string): DocumentNode | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ElementStyles, NodeType, PageDefinition } from '../types/editor';
|
|
2
|
+
/**
|
|
3
|
+
* What an email can be made of. Email apps (Gmail, Outlook, Apple Mail…) draw a small, old subset of the web, so the email
|
|
4
|
+
* editor only offers what they can draw, and the email compiler only writes what they can draw: boxes laid out in rows and
|
|
5
|
+
* columns, text, buttons, pictures, dividers and spacing. No free positioning, grids, animation, shadows, scripts or forms.
|
|
6
|
+
*/
|
|
7
|
+
export declare const EMAIL_BOX_TYPES: ReadonlySet<NodeType>;
|
|
8
|
+
export declare const EMAIL_LEAF_TYPES: ReadonlySet<NodeType>;
|
|
9
|
+
export declare const isEmailType: (t: NodeType) => boolean;
|
|
10
|
+
/** The width every email is built to (a phone shows it full width). */
|
|
11
|
+
export declare const EMAIL_WIDTH = 600;
|
|
12
|
+
/** Style settings that have no effect in an email. They are ignored when it is written, and the editor doesn't offer them. */
|
|
13
|
+
export declare const EMAIL_UNSUPPORTED_STYLES: ReadonlyArray<keyof ElementStyles>;
|
|
14
|
+
export interface EmailIssue {
|
|
15
|
+
nodeId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
/** Everything in a design an email app can't show, in plain words. Empty means it will look the way it does here. */
|
|
20
|
+
export declare function emailIssues(page: PageDefinition): EmailIssue[];
|
|
@@ -165,6 +165,8 @@ export interface V2HostConfig {
|
|
|
165
165
|
onRequestComment?: (target: CommentTarget) => void;
|
|
166
166
|
/** The host's own settings for the page being edited (name, address, search and sharing details…). Shown in a "Page settings" panel in the left rail, so it needs no button in the top bar. */
|
|
167
167
|
pageSettings?: React.ReactNode;
|
|
168
|
+
/** What is being designed. 'page' (default) is a website page. 'email' is an email: only what email apps can draw is offered (text, buttons, pictures, columns, spacing), sections are email-ready, and Preview shows the email as it will be sent (use `compilePageToEmail` to send it). */
|
|
169
|
+
mode?: 'page' | 'email';
|
|
168
170
|
/** The editor's colours: `{ accent, background, text }`, any of them. Absent → Plexo's own lime-on-black look. */
|
|
169
171
|
theme?: V2Theme;
|
|
170
172
|
/** The host's pages (see PageSource). Absent → the editor keeps its own list. */
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -25,3 +25,8 @@ export type { SanitizeV2Options } from './compile/sanitizeHtml';
|
|
|
25
25
|
export { MAX_CUSTOM_JS, validHtmlId, prepareCustomJs } from './compile/extras';
|
|
26
26
|
export { convertV1Design, V1_DYNAMIC_EQUIVALENTS, V2_DYNAMIC_READY } from './migrate/v1';
|
|
27
27
|
export type { ConvertV1Options, ConvertV1Result, ConvertV1Fidelity } from './migrate/v1';
|
|
28
|
+
export { compilePageToEmail } from './email/compile';
|
|
29
|
+
export type { CompileEmailOptions, CompiledEmail } from './email/compile';
|
|
30
|
+
export { emailIssues, EMAIL_WIDTH } from './email/support';
|
|
31
|
+
export type { EmailIssue } from './email/support';
|
|
32
|
+
export { blankEmailPages, starterEmailPages } from './email/blank';
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { DocumentNode, ElementStyles, ViewportMode } from '../types/editor';
|
|
2
2
|
/** `transition` for an element, from the allow-listed property / duration / easing choices (nothing otherwise). */
|
|
3
3
|
export declare function transitionCss(styles: ElementStyles): string | undefined;
|
|
4
|
+
/** The CSS for an element while it is pointed at, from the allow-listed choice only. */
|
|
5
|
+
export declare function hoverCss(styles: ElementStyles): Record<string, string | number> | undefined;
|
|
6
|
+
/** The kinds of entrance and how long to wait: what the published page's small script and stylesheet understand. */
|
|
7
|
+
export declare const ENTRANCES: readonly ["fade", "slide-up", "slide-left", "slide-right", "zoom"];
|
|
8
|
+
export declare function entranceOf(styles: ElementStyles): {
|
|
9
|
+
kind: (typeof ENTRANCES)[number];
|
|
10
|
+
delay: number;
|
|
11
|
+
} | undefined;
|
|
4
12
|
export type CssMap = Record<string, string | number | undefined>;
|
|
5
13
|
export interface NodeCssOptions {
|
|
6
14
|
viewport: ViewportMode;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { EMAIL_KINDS } from './catalog/email';
|
|
1
2
|
import type { KindDef, SectionKind } from './types';
|
|
2
3
|
/** Every kind of section, in the order the gallery shows them. */
|
|
3
4
|
export declare const KINDS: KindDef[];
|
|
5
|
+
/** The sections that suit an email (see catalog/email.ts). Kept apart from KINDS so pages and the AI catalog never offer them. */
|
|
6
|
+
export { EMAIL_KINDS };
|
|
4
7
|
export declare function getKind(kind: SectionKind): KindDef;
|
|
5
8
|
export declare const hasKind: (kind: string) => kind is SectionKind;
|
|
@@ -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' | 'blogList' | 'blogArticle' | 'shop' | 'productPage' | 'cartCheckout' | 'orderConfirmation' | 'orderTracking' | 'funnelSignup';
|
|
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' | 'emailHeader' | 'emailHero' | 'emailText' | 'emailFeatures' | 'emailCta' | 'emailImage' | 'emailFooter';
|
|
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. */
|
|
@@ -97,7 +97,7 @@ export interface KindDef {
|
|
|
97
97
|
label: string;
|
|
98
98
|
description: string;
|
|
99
99
|
/** Groups the gallery. */
|
|
100
|
-
group: 'Navigation' | 'Intro' | 'Content' | 'Proof' | 'Convert' | 'Footer' | 'Blog' | 'Store' | 'Funnel';
|
|
100
|
+
group: 'Navigation' | 'Intro' | 'Content' | 'Proof' | 'Convert' | 'Footer' | 'Blog' | 'Store' | 'Funnel' | 'Email';
|
|
101
101
|
/** Slim vertical padding (headers, bars, footers) instead of a full section's. */
|
|
102
102
|
compact?: boolean;
|
|
103
103
|
fields: FieldDef[];
|
|
@@ -114,6 +114,12 @@ export interface ElementStyles {
|
|
|
114
114
|
/** Milliseconds, 0–2000. */
|
|
115
115
|
transitionDuration?: number;
|
|
116
116
|
transitionEasing?: 'ease' | 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
117
|
+
/** What happens when a visitor points at the element (desktop): it lifts, grows, fades or glows. */
|
|
118
|
+
hoverEffect?: 'none' | 'lift' | 'grow' | 'fade' | 'glow';
|
|
119
|
+
/** How the element arrives as the visitor scrolls it into view. */
|
|
120
|
+
entrance?: 'none' | 'fade' | 'slide-up' | 'slide-left' | 'slide-right' | 'zoom';
|
|
121
|
+
/** Milliseconds to wait before the entrance starts, 0–1500 (so a row of cards can arrive one after another). */
|
|
122
|
+
entranceDelay?: number;
|
|
117
123
|
/** The mouse pointer over the element on the published page. */
|
|
118
124
|
cursor?: 'auto' | 'pointer' | 'default' | 'text' | 'grab' | 'not-allowed';
|
|
119
125
|
}
|
package/dist/v2-compile.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { $ as e,
|
|
2
|
-
import { n as
|
|
1
|
+
import { $ as e, A as t, C as n, Ct as r, Dt as i, E as a, Et as o, N as s, Ot as c, P as l, St as u, Tt as d, _ as f, a as p, at as m, c as h, d as g, et as _, f as v, g as y, gn as b, h as x, i as S, it as C, j as w, kt as T, l as E, m as D, n as O, nt as ee, o as k, on as A, ot as j, p as M, r as N, rt as P, s as F, sn as I, st as L, t as R, tt as z, u as B, v as V, vn as H, wt as U, xn as W, yn as G } from "./v1-DTtcJDF-.js";
|
|
2
|
+
import { n as K, t as q } from "./lint-CTTecyu_.js";
|
|
3
3
|
//#region src/v2/compile/react.ts
|
|
4
|
-
var
|
|
5
|
-
function
|
|
4
|
+
var J = /^[A-Z][A-Za-z0-9]*$/, Y = (e) => JSON.stringify(e);
|
|
5
|
+
function X(e) {
|
|
6
6
|
let t = "";
|
|
7
7
|
for (let [n, r] of Object.entries(e.attrs ?? {})) {
|
|
8
8
|
if (r === void 0 || r === !1) continue;
|
|
9
|
-
let e =
|
|
10
|
-
r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${
|
|
9
|
+
let e = I(n);
|
|
10
|
+
r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${Y(String(r))}}`;
|
|
11
11
|
}
|
|
12
12
|
return e.style && (t += ` style={${JSON.stringify(e.style)}}`), t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function Z(e, t) {
|
|
15
15
|
let n = " ".repeat(t);
|
|
16
|
-
if (typeof e == "string") return `${n}{${
|
|
17
|
-
let r =
|
|
18
|
-
return
|
|
16
|
+
if (typeof e == "string") return `${n}{${Y(e)}}`;
|
|
17
|
+
let r = X(e);
|
|
18
|
+
return A.has(e.tag) || !e.children?.length ? `${n}<${e.tag}${r} />` : `${n}<${e.tag}${r}>\n${e.children.map((e) => Z(e, t + 1)).join("\n")}\n${n}</${e.tag}>`;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function Q(e) {
|
|
21
21
|
let t = e.replace(/[^A-Za-z0-9]+/g, " ").trim().split(" ").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join("");
|
|
22
22
|
return /^[A-Z]/.test(t) ? t : `Design${t}`;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
if (!
|
|
26
|
-
let n =
|
|
24
|
+
function $(e, t) {
|
|
25
|
+
if (!J.test(t.componentName)) throw Error(`"${t.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
|
|
26
|
+
let n = V(e, t), r = t.runtime !== "none" && n.usesRuntime, i = n.fontLinks, a = "`" + n.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
|
|
27
27
|
return {
|
|
28
28
|
code: `// Generated by Plexo from a visual design. Edit it visually in the app editor's Design view
|
|
29
29
|
// (which regenerates this file), or turn it into regular code by editing here.
|
|
30
30
|
${r ? "// @ts-nocheck — the small runtime below is plain JavaScript.\nimport { useEffect, useRef } from \"react\";" : "import type { ReactElement } from \"react\";"}
|
|
31
31
|
|
|
32
32
|
const CSS = ${a};
|
|
33
|
-
${i.length ? `const FONTS: string[] = ${JSON.stringify(i)};\n` : ""}${r ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${
|
|
33
|
+
${i.length ? `const FONTS: string[] = ${JSON.stringify(i)};\n` : ""}${r ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${l};\n` : ""}
|
|
34
34
|
export default function ${t.componentName}()${r ? "" : ": ReactElement"} {
|
|
35
35
|
${r ? " const root = useRef<HTMLDivElement>(null);\n useEffect(() => (root.current ? plexoInit(root.current) : undefined), []);\n" : ""} return (
|
|
36
36
|
<>
|
|
37
37
|
${i.length ? " {FONTS.map((href) => <link key={href} rel=\"stylesheet\" href={href} />)}\n" : ""} <style>{CSS}</style>
|
|
38
|
-
${r ?
|
|
38
|
+
${r ? Z(n.tree, 3).replace("<div", "<div ref={root}") : Z(n.tree, 3)}
|
|
39
39
|
</>
|
|
40
40
|
);
|
|
41
41
|
}
|
|
@@ -44,4 +44,4 @@ ${r ? q(n.tree, 3).replace("<div", "<div ref={root}") : q(n.tree, 3)}
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
-
export {
|
|
47
|
+
export { D as EMAIL_WIDTH, H as FRAME_WIDTH, t as MAX_CUSTOM_JS, S as MAX_DEPTH, p as MAX_NODES, G as MEDIA_QUERY, r as PAGE_TEMPLATES, e as SOL_SYSTEM_PROMPT, R as V1_DYNAMIC_EQUIVALENTS, O as V2_DYNAMIC_READY, ee as applyCommands, g as blankEmailPages, m as blankPages, U as buildPageFromTemplate, d as buildTemplateSections, u as catalogSchema, M as compilePageToEmail, y as compilePageToHtml, $ as compilePageToReact, Q as componentNameFor, b as computePlacements, E as convertLegacyDesign, N as convertV1Design, W as createDefaultDesignSystem, _ as describeCommand, j as describeDesign, L as describeSection, x as emailIssues, o as getPageTemplate, B as isLegacyDesign, i as isPageEmpty, q as lintDesignSystem, c as listPageTemplates, k as parsePages, z as parseSolReply, a as parseVideoUrl, w as prepareCustomJs, f as printHtml, K as repairDesignSystem, n as resolveFormDestination, F as sanitizeCss, h as sanitizeV2Html, P as setPageTemplateResolver, C as solCommandSchema, v as starterEmailPages, T as templateSeed, s as validHtmlId };
|