@charisol/plexo-sdk 2.0.29 → 2.0.30

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.
@@ -1,4 +1,11 @@
1
1
  import React from 'react';
2
+ import type { PageDefinition } from '../../types/editor';
3
+ /** Runs a host callback (save/publish) and tracks its progress for the button label. */
4
+ export declare function useHostAction(fn?: (pages: PageDefinition[]) => void | Promise<void>): {
5
+ phase: "error" | "done" | "idle" | "working";
6
+ run: (pages: PageDefinition[]) => Promise<void>;
7
+ label: (idle: string, working: string, done: string, error: string) => string;
8
+ };
2
9
  /** How much room the bar has. It follows the editor's own width (not the browser window) because hosts embed it in narrower areas. */
3
10
  export type ToolbarTier = 'full' | 'compact' | 'tight';
4
11
  export declare const TIER_FULL_MIN = 1180;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ /** A short first-time guide, one step at a time. Can be skipped, and comes back with the "Help" button. */
3
+ export declare const SimpleCoach: React.FC<{
4
+ open: boolean;
5
+ onClose: () => void;
6
+ }>;
7
+ /** Whether the guide should open by itself (first visit only). */
8
+ export declare const guideNeverSeen: () => boolean;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ /** One line under the page that says what to do next, based on what is selected. */
3
+ export declare const SimpleHint: React.FC;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ /** The right side: only what applies to the thing clicked, in plain words. */
3
+ export declare const SimpleInspector: React.FC;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ /** The left side: your page, pictures, other pages, Ask SOL and the page's settings. Picking something to add swaps it for the section gallery. */
3
+ export declare const SimpleSidebar: React.FC;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ /** A short top bar: back, your page, undo, see it, publish. Nothing else. */
3
+ export declare const SimpleTopBar: React.FC<{
4
+ onHelp: () => void;
5
+ }>;
@@ -0,0 +1,12 @@
1
+ import type { DocumentNode } from '../../types/editor';
2
+ /** Everyday names for the ready-made parts (the editor's own labels are builder words: "Hero", "CTA", "Funnel"). */
3
+ export declare const EVERYDAY: Record<string, string>;
4
+ export declare const kindName: (kind: string, fallback: string) => string;
5
+ /** What a piece of the page is called in everyday words (never "node", "container" or "layer"). */
6
+ export declare function plainName(node: DocumentNode): string;
7
+ /** A few of the words a section says, so a list of sections can be told apart ("Hero — Build something great"). */
8
+ export declare function sectionHint(node: DocumentNode): string;
9
+ /** The top-level section a piece of the page belongs to (itself, when it is one). */
10
+ export declare function topSectionOf(root: DocumentNode, id: string | null): DocumentNode | null;
11
+ /** What a person can do with the thing they clicked, in one line each. */
12
+ export declare const TIPS: Record<string, string>;
@@ -1,3 +1,8 @@
1
1
  import type { PageDefinition } from '../types/editor';
2
2
  /** What an editor with no `pages` opens to: one empty page the user can start building on at once. */
3
3
  export declare function blankPages(): PageDefinition[];
4
+ /**
5
+ * What the beginner screen opens to when there is no page yet: a short, filled-in page (menu, main message, highlights, footer)
6
+ * so the first thing a new owner sees is something to change, not an empty canvas.
7
+ */
8
+ export declare function starterPages(): PageDefinition[];
@@ -125,7 +125,15 @@ export interface HostShell {
125
125
  hideLabel?: string;
126
126
  showLabel?: string;
127
127
  }
128
+ /**
129
+ * How much of the editor to show. 'beginner' is a completely different, much simpler screen: your page as a short list of
130
+ * sections (move, copy, delete, add), a plain-words panel for whatever you click, hints and a short guide — no layers, no
131
+ * pixel controls, nothing to learn first. 'pro' (the default) is the full editor.
132
+ */
133
+ export type V2Experience = 'beginner' | 'pro';
128
134
  export interface V2HostConfig {
135
+ /** Who is using the editor. Plexo passes the owner's own choice, so a beginner gets the simple screen and a pro the full one. Default 'pro'. */
136
+ experience?: V2Experience;
129
137
  /** Same convention as V1: "workspace-internal" inside the Plexo dashboard (same-origin, nothing to configure),
130
138
  * or a Plexo API key for a third-party app. Absent → fully standalone. */
131
139
  apiKey?: string;
@@ -219,6 +227,12 @@ export interface V2HostConfig {
219
227
  /** Slots in the top bar (page picker, "View in app", …). */
220
228
  headerLeft?: React.ReactNode;
221
229
  headerRight?: React.ReactNode;
230
+ /**
231
+ * Optional. `'editor'` restyles the plain links and buttons you put in `headerRight` to match the editor's own buttons
232
+ * (same height, border, text size, colours); add `data-primary` to one for the highlighted look. Default `'host'`: your
233
+ * content is shown exactly as you styled it. For single buttons you can also add the `plexo-header-button` class yourself.
234
+ */
235
+ headerSlotStyle?: 'host' | 'editor';
222
236
  /** Turn built-in panels off (e.g. a landing-page-only host hides code view). All on by default except SOL (needs onAskSol). */
223
237
  features?: {
224
238
  pages?: boolean; /** The Branding panel (design system + Strata). */
@@ -7,6 +7,7 @@
7
7
  * Pages are plain JSON trees (PageDefinition); `@charisol/plexo-sdk/v2/compile` turns them into HTML or React.
8
8
  */
9
9
  export { V2Editor } from './V2Editor';
10
+ export type { V2Experience } from './host/HostContext';
10
11
  export type { V2EditorProps, V2EditorRef, V2EditorHandle } from './V2Editor';
11
12
  export type { V2Theme } from './theme/theme';
12
13
  export type { V2HostConfig, SaveState, StockImageProvider, StockImageResult, LibrarySection, MediaAsset, LinkTarget, ProductChoice, CommentTarget, AskSolContext, AskSolIo, PageSource, HostPage, HostShell, } from './host/HostContext';
@@ -15,7 +16,7 @@ export { convertLegacyDesign, isLegacyDesign } from './migrate/legacy';
15
16
  export type { LegacyDesign } from './migrate/legacy';
16
17
  export * from './design';
17
18
  export type { DesignSystem } from './design/types';
18
- export { blankPages } from './data/blankPage';
19
+ export { blankPages, starterPages } from './data/blankPage';
19
20
  export { stripWorkspace, pageChildren, isWorkspaceNode, workspaceOf, ensureWorkspace, WORKSPACE_ID } from './workspace';
20
21
  export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplateSections, templateSeed, getPageTemplate, isPageTemplateId, isPageEmpty, SITE_ONLY_TEMPLATE_IDS } from './sections/pageTemplates';
21
22
  export type { PageTemplate, PageTemplateSection, PageTemplateSummary, BuildTemplateOptions } from './sections/pageTemplates';
@@ -1,14 +1,14 @@
1
- import { $t as e, B as t, Gt as n, H as r, I as i, Jt as a, Kt as o, L as ee, Nt as te, O as ne, Pt as s, Qt as c, S as l, T as u, Ut as d, Xt as f, Yt as p, Zt as m, a as h, b as g, c as _, i as v, n as y, o as b, r as x, s as S, t as C, tn as w, v as T, x as E, y as D, z as O } from "./blank-BEl6CY5C.js";
1
+ import { $t as e, B as t, Ft as n, H as r, I as i, Kt as a, L as o, O as ee, Pt as te, Qt as ne, S as s, T as c, Wt as l, Xt as u, Yt as d, Zt as f, a as p, b as m, c as h, en as g, i as _, n as v, nn as y, o as b, qt as x, r as S, s as C, t as w, v as T, x as E, y as D, z as O } from "./blank-Dg8GIfQP.js";
2
2
  import { n as k, t as A } from "./lint-CV3DmM0X.js";
3
- import { B as j, C as M, D as N, E as P, G as F, H as I, K as L, R, S as z, T as B, U as V, W as H, _ as U, a as W, b as G, c as K, ct as re, d as q, dt as J, f as Y, ft as X, g as ie, gt as ae, h as oe, ht as se, i as ce, l as le, lt as ue, m as de, mt as fe, n as pe, o as me, ot as he, p as ge, pt as _e, r as ve, s as ye, st as be, t as xe, u as Se, ut as Z, v as Ce, w as we, x as Te, y as Ee, z as De } from "./v1-Cn7SGvZk.js";
3
+ import { B as j, C as M, D as N, E as P, G as F, H as I, K as L, R, S as z, T as B, U as V, W as H, _ as U, a as W, b as G, c as K, ct as re, d as q, dt as J, f as Y, ft as X, g as ie, gt as ae, h as oe, ht as se, i as ce, l as le, lt as ue, m as de, mt as fe, n as pe, o as me, ot as he, p as ge, pt as _e, r as ve, s as ye, st as be, t as xe, u as Se, ut as Z, v as Ce, w as we, x as Te, y as Ee, z as De } from "./v1-B6QkDh9R.js";
4
4
  //#region src/v2/compile/react.ts
5
5
  var Oe = /^[A-Z][A-Za-z0-9]*$/, Q = (e) => JSON.stringify(e);
6
6
  function ke(e) {
7
7
  let t = "";
8
- for (let [n, r] of Object.entries(e.attrs ?? {})) {
9
- if (r === void 0 || r === !1) continue;
10
- let e = s(n);
11
- r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${Q(String(r))}}`;
8
+ for (let [r, i] of Object.entries(e.attrs ?? {})) {
9
+ if (i === void 0 || i === !1) continue;
10
+ let e = n(r);
11
+ i === !0 ? t += ` ${e}` : typeof i == "number" ? t += ` ${e}={${i}}` : t += ` ${e}={${Q(String(i))}}`;
12
12
  }
13
13
  return e.style && (t += ` style={${JSON.stringify(e.style)}}`), t;
14
14
  }
@@ -24,7 +24,7 @@ function Ae(e) {
24
24
  }
25
25
  function je(e, n) {
26
26
  if (!Oe.test(n.componentName)) throw Error(`"${n.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
27
- let r = _(e, n), i = n.runtime !== "none" && r.usesRuntime, a = r.fontLinks, o = "`" + r.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
27
+ let r = h(e, n), i = n.runtime !== "none" && r.usesRuntime, a = r.fontLinks, o = "`" + r.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
28
28
  return {
29
29
  code: `// Generated by Plexo from a visual design. Edit it visually in the app editor's Design view
30
30
  // (which regenerates this file), or turn it into regular code by editing here.
@@ -45,4 +45,4 @@ ${i ? $(r.tree, 3).replace("<div", "<div ref={root}") : $(r.tree, 3)}
45
45
  };
46
46
  }
47
47
  //#endregion
48
- export { v as EMAIL_WIDTH, c as FRAME_WIDTH, i as MAX_CUSTOM_JS, ce as MAX_DEPTH, W as MAX_NODES, e as MEDIA_QUERY, ae as PAGE_RECIPES, be as PAGE_TEMPLATES, le as PAGE_TYPE_DEFAULTS, re as SITE_ONLY_TEMPLATE_IDS, Se as SITE_PAGE_TYPES, R as SOL_SYSTEM_PROMPT, xe as V1_DYNAMIC_EQUIVALENTS, pe as V2_DYNAMIC_READY, n as WORKSPACE_ID, I as applyCommands, C as blankEmailPages, r as blankPages, q as brandChoicesFromBrief, T as brandComponentCss, D as brandDerivedVars, g as brandFontFamilies, E as brandStylesheet, Y as briefHash, ue as buildPageFromTemplate, ge as buildSitePage, Z as buildTemplateSections, he as catalogSchema, de as chromeContentFor, x as compilePageToEmail, b as compilePageToHtml, je as compilePageToReact, Ae as componentNameFor, d as computePlacements, P as convertLegacyDesign, ve as convertV1Design, w as createDefaultDesignSystem, De as describeCommand, F as describeDesign, L as describeSection, oe as designSystemFromBrief, ie as detectIndustry, U as detectStyle, h as emailIssues, o as ensureWorkspace, Ce as fitText, Ee as getPageRecipe, J as getPageTemplate, N as isLegacyDesign, X as isPageEmpty, _e as isPageTemplateId, a as isWorkspaceNode, A as lintDesignSystem, G as listPageRecipes, fe as listPageTemplates, l as onAccentColor, p as pageChildren, Te as parseBriefColor, me as parsePages, j as parseSolReply, ne as parseVideoUrl, z as pickRecipe, ee as prepareCustomJs, S as printHtml, M as recipesFor, k as repairDesignSystem, u as resolveFormDestination, ye as sanitizeCss, K as sanitizeV2Html, V as setPageTemplateResolver, we as siteNavLinks, H as solCommandSchema, y as starterEmailPages, f as stripWorkspace, B as suggestSitePages, se as templateSeed, O as validHtmlId, m as workspaceOf };
48
+ export { _ as EMAIL_WIDTH, e as FRAME_WIDTH, i as MAX_CUSTOM_JS, ce as MAX_DEPTH, W as MAX_NODES, g as MEDIA_QUERY, ae as PAGE_RECIPES, be as PAGE_TEMPLATES, le as PAGE_TYPE_DEFAULTS, re as SITE_ONLY_TEMPLATE_IDS, Se as SITE_PAGE_TYPES, R as SOL_SYSTEM_PROMPT, xe as V1_DYNAMIC_EQUIVALENTS, pe as V2_DYNAMIC_READY, a as WORKSPACE_ID, I as applyCommands, w as blankEmailPages, r as blankPages, q as brandChoicesFromBrief, T as brandComponentCss, D as brandDerivedVars, m as brandFontFamilies, E as brandStylesheet, Y as briefHash, ue as buildPageFromTemplate, ge as buildSitePage, Z as buildTemplateSections, he as catalogSchema, de as chromeContentFor, S as compilePageToEmail, b as compilePageToHtml, je as compilePageToReact, Ae as componentNameFor, l as computePlacements, P as convertLegacyDesign, ve as convertV1Design, y as createDefaultDesignSystem, De as describeCommand, F as describeDesign, L as describeSection, oe as designSystemFromBrief, ie as detectIndustry, U as detectStyle, p as emailIssues, x as ensureWorkspace, Ce as fitText, Ee as getPageRecipe, J as getPageTemplate, N as isLegacyDesign, X as isPageEmpty, _e as isPageTemplateId, d as isWorkspaceNode, A as lintDesignSystem, G as listPageRecipes, fe as listPageTemplates, s as onAccentColor, u as pageChildren, Te as parseBriefColor, me as parsePages, j as parseSolReply, ee as parseVideoUrl, z as pickRecipe, o as prepareCustomJs, C as printHtml, M as recipesFor, k as repairDesignSystem, c as resolveFormDestination, ye as sanitizeCss, K as sanitizeV2Html, V as setPageTemplateResolver, we as siteNavLinks, H as solCommandSchema, v as starterEmailPages, f as stripWorkspace, B as suggestSitePages, se as templateSeed, O as validHtmlId, ne as workspaceOf };
package/dist/v2-files.js CHANGED
@@ -1,3 +1,3 @@
1
- import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, P as s, S as c, T as l, _ as u, a as d, b as f, c as p, g as m, h, i as g, k as _, m as v, n as y, r as b, s as x, t as S, u as C, v as w, w as T, y as E } from "./files-Df6FY0HK.js";
1
+ import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, P as s, S as c, T as l, _ as u, a as d, b as f, c as p, g as m, h, i as g, k as _, m as v, n as y, r as b, s as x, t as S, u as C, v as w, w as T, y as E } from "./files-Bjoz1wCf.js";
2
2
  import { n as D, r as O } from "./pdfImport-BOev0Pc1.js";
3
3
  export { c as EXPORT_FORMATS, S as IMAGE_TO_DESIGN_PROMPT, x as KIND_LABEL, t as PICTURE_FORMATS, p as blankContent, C as convertContent, y as convertPictureWithAi, v as docxToHtml, T as downloadResult, i as evaluateGrid, l as exportSource, h as htmlToDesign, n as htmlToMarkdown, o as htmlToText, m as imageToDesign, u as markdownToDesign, _ as markdownToHtml, w as openFile, a as parseCsv, b as parseImageSpec, D as pdfToPages, g as plexoImageAi, O as readPdf, d as specToPage, E as textToDesign, e as textToHtml, s as toCsv, r as wrapHtmlDocument, f as xlsxToGrid };