@charisol/plexo-sdk 2.0.6 → 2.0.8
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 +8 -0
- package/dist/plexo-sdk.css +1 -1
- package/dist/{v1-C2tXaSOb.js → v1-BCCIC3DR.js} +1303 -1149
- package/dist/v2/components/design/bits.d.ts +1 -1
- package/dist/v2/components/layout/TopToolbar.d.ts +2 -0
- package/dist/v2/components/properties/ElementInspector.d.ts +11 -0
- package/dist/v2/components/properties/ElementSettings.d.ts +2 -2
- package/dist/v2/components/properties/inspectorBits.d.ts +39 -0
- package/dist/v2/host/HostContext.d.ts +5 -0
- package/dist/v2/index.d.ts +1 -0
- package/dist/v2/render/boxTags.d.ts +2 -0
- package/dist/v2/render/nodeStyle.d.ts +12 -0
- package/dist/v2/theme/theme.d.ts +24 -0
- package/dist/v2/types/editor.d.ts +14 -1
- package/dist/v2-compile.js +17 -17
- package/dist/v2.js +5610 -4966
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const field = "w-full bg-
|
|
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;
|
|
@@ -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;
|
|
@@ -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-
|
|
4
|
-
export declare const smallBtn = "w-6 h-6 rounded flex items-center justify-center text-
|
|
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). */
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -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';
|
|
@@ -1,10 +1,22 @@
|
|
|
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;
|
|
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;
|
|
2
12
|
export type CssMap = Record<string, string | number | undefined>;
|
|
3
13
|
export interface NodeCssOptions {
|
|
4
14
|
viewport: ViewportMode;
|
|
5
15
|
/** True when the parent lays its children out as a grid. */
|
|
6
16
|
isGridChild: boolean;
|
|
7
17
|
isRootPage: boolean;
|
|
18
|
+
/** True when building the published page. Cursor and transitions are for visitors; on the editing canvas they would fight dragging. */
|
|
19
|
+
forPublish?: boolean;
|
|
8
20
|
}
|
|
9
21
|
export interface NodeCss {
|
|
10
22
|
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,19 @@ 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
|
+
/** 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;
|
|
123
|
+
/** The mouse pointer over the element on the published page. */
|
|
124
|
+
cursor?: 'auto' | 'pointer' | 'default' | 'text' | 'grab' | 'not-allowed';
|
|
112
125
|
}
|
|
113
126
|
export interface ResponsiveOverrides {
|
|
114
127
|
tablet?: Partial<ElementStyles>;
|
|
@@ -148,7 +161,7 @@ export interface PageDefinition {
|
|
|
148
161
|
rootNode: DocumentNode;
|
|
149
162
|
}
|
|
150
163
|
export type ViewportMode = 'desktop' | 'tablet' | 'mobile';
|
|
151
|
-
export type LeftSidebarTab = 'sections' | 'add' | 'layers' | 'pages' | 'strata' | 'library' | 'sol' | 'insert';
|
|
164
|
+
export type LeftSidebarTab = 'sections' | 'add' | 'layers' | 'pages' | 'strata' | 'library' | 'pageSettings' | 'sol' | 'insert';
|
|
152
165
|
export type ViewMode = 'design' | 'code' | 'json' | 'html' | 'plaintext';
|
|
153
166
|
export interface DragDropState {
|
|
154
167
|
draggingNodeId: string | null;
|
package/dist/v2-compile.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { $ as e,
|
|
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-BCCIC3DR.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
|
|
7
|
-
for (let [
|
|
8
|
-
if (
|
|
9
|
-
let e =
|
|
10
|
-
|
|
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 && (
|
|
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
|
|
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 =
|
|
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
|
-
${
|
|
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 = ${
|
|
33
|
-
${
|
|
34
|
-
export default function ${t.componentName}()${
|
|
35
|
-
${
|
|
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
|
-
${
|
|
38
|
-
${
|
|
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 {
|
|
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 };
|