@charisol/plexo-sdk 2.0.6 → 2.0.7

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,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare const field = "w-full bg-[#1F1F1F] border border-[#2C2C2C] rounded px-2 py-1.5 text-xs text-[#EDEDED] focus:outline-none focus:border-[#96F02E]";
2
+ export declare const field = "w-full bg-px-raised border border-px-line2 rounded px-2 py-1.5 text-xs text-px-text focus:outline-none focus:border-px-accent";
3
3
  export declare const Section: React.FC<{
4
4
  title: string;
5
5
  hint?: string;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { DocumentNode } from '../../types/editor';
3
+ /**
4
+ * The right-hand panel for one selected element: one panel with three friendly tabs.
5
+ * - Design: what it says and how it looks (text, colours, shadows, borders).
6
+ * - Layout: how it sits and is sized (flow, size, spacing, position, stacking).
7
+ * - Advanced: the technical extras (tag, id, classes, overflow, cursor, accessibility, transitions).
8
+ */
9
+ export declare const ElementInspector: React.FC<{
10
+ node: DocumentNode;
11
+ }>;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { DocumentNode } from '../../types/editor';
3
- export declare const input = "w-full bg-[#1F1F1F] border border-[#2C2C2C] rounded px-2 py-1 text-xs text-[#EDEDED] placeholder-[#6B7280] focus:outline-none focus:border-[#96F02E]";
4
- export declare const smallBtn = "w-6 h-6 rounded flex items-center justify-center text-[#9CA3AF] hover:text-white hover:bg-[#2A2A2A] disabled:opacity-30 disabled:hover:bg-transparent cursor-pointer";
3
+ export declare const input = "w-full bg-px-raised border border-px-line2 rounded px-2 py-1 text-xs text-px-text placeholder-px-faint focus:outline-none focus:border-px-accent";
4
+ export declare const smallBtn = "w-6 h-6 rounded flex items-center justify-center text-px-muted hover:text-white hover:bg-px-line2 disabled:opacity-30 disabled:hover:bg-transparent cursor-pointer";
5
5
  export declare const Group: React.FC<{
6
6
  title: string;
7
7
  children: React.ReactNode;
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ /** Small building blocks shared by the inspector's three tabs, so every control looks and behaves the same. */
3
+ export declare const inputCls = "w-full min-w-0 bg-px-raised border border-px-line2 rounded-lg px-2 py-1 text-xs text-px-text placeholder:text-px-faint focus:outline-none focus:border-px-accent/60";
4
+ /** A titled group of controls that can be folded away. Open by default so nothing is hidden from a first-time user. */
5
+ export declare const Group: React.FC<{
6
+ title: string;
7
+ defaultOpen?: boolean;
8
+ hint?: string;
9
+ children: React.ReactNode;
10
+ }>;
11
+ /** A label on the left, its control on the right. */
12
+ export declare const Field: React.FC<{
13
+ label: string;
14
+ children: React.ReactNode;
15
+ stack?: boolean;
16
+ }>;
17
+ /** A row of choices where exactly one is on (like Hug / Fill / Fixed). */
18
+ export declare function Choice<T extends string>({ options, value, onChange, label }: {
19
+ options: Array<{
20
+ id: T;
21
+ label: React.ReactNode;
22
+ title?: string;
23
+ }>;
24
+ value: T | undefined;
25
+ onChange: (id: T) => void;
26
+ label: string;
27
+ }): React.JSX.Element;
28
+ /** A number in pixels. Stores `"12px"`; empty means "not set". */
29
+ export declare const PxInput: React.FC<{
30
+ value: string | undefined;
31
+ onChange: (v: string | undefined) => void;
32
+ label: string;
33
+ placeholder?: string;
34
+ min?: number;
35
+ max?: number;
36
+ }>;
37
+ export declare const Hint: React.FC<{
38
+ children: React.ReactNode;
39
+ }>;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { PageDefinition } from '../types/editor';
3
3
  import type { StrataAdapter } from '../strata/types';
4
+ import type { V2Theme } from '../theme/theme';
4
5
  /**
5
6
  * What the app embedding the editor can plug in. Every field is optional: with no props the
6
7
  * editor is a complete, offline visual builder (blank page, embedded images, no AI). A field
@@ -162,6 +163,10 @@ export interface V2HostConfig {
162
163
  /** Clicking a node reports it via onRequestComment instead of selecting it. */
163
164
  commentMode?: boolean;
164
165
  onRequestComment?: (target: CommentTarget) => void;
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
+ pageSettings?: React.ReactNode;
168
+ /** The editor's colours: `{ accent, background, text }`, any of them. Absent → Plexo's own lime-on-black look. */
169
+ theme?: V2Theme;
165
170
  /** The host's pages (see PageSource). Absent → the editor keeps its own list. */
166
171
  pageSource?: PageSource;
167
172
  /** Way home + hiding the host's sidebar for more room (see HostShell). */
@@ -8,6 +8,7 @@
8
8
  */
9
9
  export { V2Editor } from './V2Editor';
10
10
  export type { V2EditorProps, V2EditorRef } from './V2Editor';
11
+ export type { V2Theme } from './theme/theme';
11
12
  export type { V2HostConfig, SaveState, StockImageProvider, StockImageResult, LibrarySection, MediaAsset, LinkTarget, CommentTarget, AskSolContext, PageSource, HostPage, HostShell, } from './host/HostContext';
12
13
  export type { DocumentNode, PageDefinition, NodeType, ElementStyles, ViewportMode, } from './types/editor';
13
14
  export { convertLegacyDesign, isLegacyDesign } from './migrate/legacy';
@@ -0,0 +1,2 @@
1
+ export declare const BOX_TAGS_BY_TYPE: Record<string, readonly string[]>;
2
+ export declare const DEFAULT_BOX_TAG: Record<string, string>;
@@ -1,10 +1,14 @@
1
1
  import type { DocumentNode, ElementStyles, ViewportMode } from '../types/editor';
2
+ /** `transition` for an element, from the allow-listed property / duration / easing choices (nothing otherwise). */
3
+ export declare function transitionCss(styles: ElementStyles): string | undefined;
2
4
  export type CssMap = Record<string, string | number | undefined>;
3
5
  export interface NodeCssOptions {
4
6
  viewport: ViewportMode;
5
7
  /** True when the parent lays its children out as a grid. */
6
8
  isGridChild: boolean;
7
9
  isRootPage: boolean;
10
+ /** True when building the published page. Cursor and transitions are for visitors; on the editing canvas they would fight dragging. */
11
+ forPublish?: boolean;
8
12
  }
9
13
  export interface NodeCss {
10
14
  css: CssMap;
@@ -0,0 +1,24 @@
1
+ import type { CSSProperties } from 'react';
2
+ /**
3
+ * The editor's colours. A host passes any of the three (the rest follow from them); nothing passed = Plexo's own look.
4
+ * <V2Editor theme={{ accent: '#96F02E', background: '#000000', text: '#ffffff' }} />
5
+ * Every shade the editor uses (panels, borders, hover states, muted text) is mixed from these three, so a host never
6
+ * has to list a palette, and a light background with dark text works just as well as a dark one.
7
+ */
8
+ export interface V2Theme {
9
+ /** The highlight colour: active tools, primary buttons, selections. Default #96F02E (lime). */
10
+ accent?: string;
11
+ /** The editor's own background. Default #101010. */
12
+ background?: string;
13
+ /** The main text colour. Default #EDEDED. */
14
+ text?: string;
15
+ }
16
+ /** The CSS variables for a theme, set on the editor's root element. */
17
+ export declare function themeVars(theme?: V2Theme): CSSProperties;
18
+ /** The three colours as hex, plus the panel colour — for controls that take colours as props instead of reading the variables. */
19
+ export declare const resolveTheme: (theme?: V2Theme) => {
20
+ accent: string;
21
+ background: string;
22
+ text: string;
23
+ surface: string;
24
+ };
@@ -109,6 +109,13 @@ export interface ElementStyles {
109
109
  underlineOnHover?: boolean;
110
110
  horizontalAlign?: 'left' | 'center' | 'right';
111
111
  customClasses?: string;
112
+ /** What the element animates when something about it changes (a hover colour, a screen-size change). Allow-listed; see render/nodeStyle. */
113
+ transitionProperty?: 'none' | 'all' | 'opacity' | 'transform' | 'colors';
114
+ /** Milliseconds, 0–2000. */
115
+ transitionDuration?: number;
116
+ transitionEasing?: 'ease' | 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
117
+ /** The mouse pointer over the element on the published page. */
118
+ cursor?: 'auto' | 'pointer' | 'default' | 'text' | 'grab' | 'not-allowed';
112
119
  }
113
120
  export interface ResponsiveOverrides {
114
121
  tablet?: Partial<ElementStyles>;
@@ -148,7 +155,7 @@ export interface PageDefinition {
148
155
  rootNode: DocumentNode;
149
156
  }
150
157
  export type ViewportMode = 'desktop' | 'tablet' | 'mobile';
151
- export type LeftSidebarTab = 'sections' | 'add' | 'layers' | 'pages' | 'strata' | 'library' | 'sol' | 'insert';
158
+ export type LeftSidebarTab = 'sections' | 'add' | 'layers' | 'pages' | 'strata' | 'library' | 'pageSettings' | 'sol' | 'insert';
152
159
  export type ViewMode = 'design' | 'code' | 'json' | 'html' | 'plaintext';
153
160
  export interface DragDropState {
154
161
  draggingNodeId: string | null;
@@ -1,21 +1,21 @@
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-C2tXaSOb.js";
1
+ import { $ as e, Ct as t, E as n, J as r, O as i, Q as a, St as o, T as s, X as c, Y as l, Z as u, _t as d, a as f, bt as p, c as m, d as h, en as g, et as _, f as v, fn as y, hn as b, i as x, k as S, l as C, n as w, nt as T, o as E, p as D, pn as O, r as k, s as A, t as j, tn as M, tt as N, u as P, un as F, v as I, vt as L, wt as R, x as z, xt as B, yt as V } from "./v1-iodIbfkY.js";
2
2
  import { n as H, t as U } from "./lint-CTTecyu_.js";
3
3
  //#region src/v2/compile/react.ts
4
4
  var W = /^[A-Z][A-Za-z0-9]*$/, G = (e) => JSON.stringify(e);
5
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))}}`;
6
+ let t = "";
7
+ for (let [n, r] of Object.entries(e.attrs ?? {})) {
8
+ if (r === void 0 || r === !1) continue;
9
+ let e = M(n);
10
+ r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${G(String(r))}}`;
11
11
  }
12
- return e.style && (n += ` style={${JSON.stringify(e.style)}}`), n;
12
+ return e.style && (t += ` style={${JSON.stringify(e.style)}}`), t;
13
13
  }
14
14
  function q(e, t) {
15
15
  let n = " ".repeat(t);
16
16
  if (typeof e == "string") return `${n}{${G(e)}}`;
17
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}>`;
18
+ return g.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}>`;
19
19
  }
20
20
  function J(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("");
@@ -23,19 +23,19 @@ function J(e) {
23
23
  }
24
24
  function Y(e, t) {
25
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, "\\${") + "`";
26
+ let n = D(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
- ${i ? "// @ts-nocheck — the small runtime below is plain JavaScript.\nimport { useEffect, useRef } from \"react\";" : "import type { ReactElement } from \"react\";"}
30
+ ${r ? "// @ts-nocheck — the small runtime below is plain JavaScript.\nimport { useEffect, useRef } from \"react\";" : "import type { ReactElement } from \"react\";"}
31
31
 
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 (
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 = ${S};\n` : ""}
34
+ export default function ${t.componentName}()${r ? "" : ": ReactElement"} {
35
+ ${r ? " const root = useRef<HTMLDivElement>(null);\n useEffect(() => (root.current ? plexoInit(root.current) : undefined), []);\n" : ""} return (
36
36
  <>
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)}
37
+ ${i.length ? " {FONTS.map((href) => <link key={href} rel=\"stylesheet\" href={href} />)}\n" : ""} <style>{CSS}</style>
38
+ ${r ? q(n.tree, 3).replace("<div", "<div ref={root}") : q(n.tree, 3)}
39
39
  </>
40
40
  );
41
41
  }
@@ -44,4 +44,4 @@ ${i ? q(n.tree, 3).replace("<div", "<div ref={root}") : q(n.tree, 3)}
44
44
  };
45
45
  }
46
46
  //#endregion
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 };
47
+ export { y as FRAME_WIDTH, s as MAX_CUSTOM_JS, x as MAX_DEPTH, f as MAX_NODES, O as MEDIA_QUERY, L as PAGE_TEMPLATES, r as SOL_SYSTEM_PROMPT, j as V1_DYNAMIC_EQUIVALENTS, w as V2_DYNAMIC_READY, u as applyCommands, _ as blankPages, V as buildPageFromTemplate, p as buildTemplateSections, d as catalogSchema, h as compilePageToHtml, Y as compilePageToReact, J as componentNameFor, F as computePlacements, C as convertLegacyDesign, k as convertV1Design, b as createDefaultDesignSystem, l as describeCommand, N as describeDesign, T as describeSection, B as getPageTemplate, P as isLegacyDesign, o as isPageEmpty, U as lintDesignSystem, t as listPageTemplates, E as parsePages, c as parseSolReply, z as parseVideoUrl, n as prepareCustomJs, v as printHtml, H as repairDesignSystem, I as resolveFormDestination, A as sanitizeCss, m as sanitizeV2Html, a as setPageTemplateResolver, e as solCommandSchema, R as templateSeed, i as validHtmlId };