@charisol/plexo-sdk 2.0.28 → 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.
- package/README.md +324 -0
- package/dist/{InlineColorPicker-BYcOgLVc.js → InlineColorPicker-Cb9p4I_m.js} +395 -114
- package/dist/{v1-Cz7qypQd.js → blank-Dg8GIfQP.js} +4681 -10906
- package/dist/brandGuide-Dd4fqVjS.js +33 -0
- package/dist/{client-DUSU8g5z.js → client-CWui0-3q.js} +1 -1
- package/dist/codeEditor-Cux0ud2j.js +205 -0
- package/dist/files-Bjoz1wCf.js +2182 -0
- package/dist/id-CR6Y8qD6.js +8 -0
- package/dist/index.js +12754 -13035
- package/dist/{brandGuide-DgoZ7spo.js → lint-CV3DmM0X.js} +78 -109
- package/dist/pdfImport-BOev0Pc1.js +262 -0
- package/dist/plexo-sdk.css +1 -1
- package/dist/v1-B6QkDh9R.js +6253 -0
- package/dist/v2/CanvasEditor.d.ts +25 -0
- package/dist/v2/V2Editor.d.ts +15 -20
- package/dist/v2/compile/build.d.ts +5 -0
- package/dist/v2/components/layout/TopToolbar.d.ts +7 -0
- package/dist/v2/components/properties/PropertiesPanel.d.ts +1 -0
- package/dist/v2/components/simple/SimpleCoach.d.ts +8 -0
- package/dist/v2/components/simple/SimpleHint.d.ts +3 -0
- package/dist/v2/components/simple/SimpleInspector.d.ts +3 -0
- package/dist/v2/components/simple/SimpleSidebar.d.ts +3 -0
- package/dist/v2/components/simple/SimpleTopBar.d.ts +5 -0
- package/dist/v2/components/simple/words.d.ts +12 -0
- package/dist/v2/data/blankPage.d.ts +5 -0
- package/dist/v2/files/aiPicture.d.ts +85 -0
- package/dist/v2/files/build.d.ts +49 -0
- package/dist/v2/files/capture.d.ts +52 -0
- package/dist/v2/files/convert.d.ts +24 -0
- package/dist/v2/files/docx.d.ts +1 -0
- package/dist/v2/files/engine.d.ts +2 -0
- package/dist/v2/files/export.d.ts +97 -0
- package/dist/v2/files/import.d.ts +34 -0
- package/dist/v2/files/index.d.ts +16 -0
- package/dist/v2/files/pdf.d.ts +15 -0
- package/dist/v2/files/pdfImport.d.ts +28 -0
- package/dist/v2/files/sheet.d.ts +16 -0
- package/dist/v2/files/text.d.ts +8 -0
- package/dist/v2/files/types.d.ts +96 -0
- package/dist/v2/files/ui/ExportDock.d.ts +11 -0
- package/dist/v2/files/ui/ExportMenu.d.ts +5 -0
- package/dist/v2/files/ui/ExportPanel.d.ts +17 -0
- package/dist/v2/files/ui/FileEditor.d.ts +14 -0
- package/dist/v2/files/ui/HtmlWorkbench.d.ts +15 -0
- package/dist/v2/files/ui/codeEditor.d.ts +12 -0
- package/dist/v2/files/ui/editors.d.ts +28 -0
- package/dist/v2/files/vector.d.ts +19 -0
- package/dist/v2/files/zip.d.ts +10 -0
- package/dist/v2/host/HostContext.d.ts +20 -3
- package/dist/v2/index.d.ts +7 -2
- package/dist/v2-compile.js +20 -19
- package/dist/v2-files.js +3 -0
- package/dist/v2-strata.js +2 -2
- package/dist/v2.js +5434 -2713
- package/package.json +18 -3
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { PageDefinition } from '../types/editor';
|
|
2
|
+
import type { ExportFormat } from './export';
|
|
3
|
+
/**
|
|
4
|
+
* What kind of file is being made or edited.
|
|
5
|
+
* - design: a page built on the visual canvas (HTML) · email: the same, as an email
|
|
6
|
+
* - document: written text with headings, lists and pictures (Word-style) · text: plain text · markdown
|
|
7
|
+
* - sheet: a spreadsheet grid
|
|
8
|
+
*/
|
|
9
|
+
export type FileKind = 'design' | 'email' | 'html' | 'document' | 'text' | 'markdown' | 'sheet';
|
|
10
|
+
/** A file's content in the form the editor works with, so a host can store it and open it again later. */
|
|
11
|
+
export type FileSource = {
|
|
12
|
+
kind: 'design' | 'email';
|
|
13
|
+
name: string;
|
|
14
|
+
content: PageDefinition[];
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'html' | 'document' | 'text' | 'markdown';
|
|
17
|
+
name: string;
|
|
18
|
+
content: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'sheet';
|
|
21
|
+
name: string;
|
|
22
|
+
content: string[][];
|
|
23
|
+
};
|
|
24
|
+
/** What the editor hands the host when the person saves. */
|
|
25
|
+
export interface FileSaveResult {
|
|
26
|
+
kind: FileKind;
|
|
27
|
+
/** The name the person gave it, without extension. */
|
|
28
|
+
name: string;
|
|
29
|
+
/** The format the person chose to save in. */
|
|
30
|
+
format: ExportFormat;
|
|
31
|
+
/** The finished file in that format — upload it or store it. */
|
|
32
|
+
blob: Blob;
|
|
33
|
+
/** `name.ext`, ready to use as a file name. */
|
|
34
|
+
filename: string;
|
|
35
|
+
/** The editable source, so the host can open this file in the editor again (`file={result.source}`). */
|
|
36
|
+
source: FileSource;
|
|
37
|
+
/** Anything worth telling the person (e.g. a picture that couldn't be included). */
|
|
38
|
+
warnings: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface ImageToDesignInput {
|
|
41
|
+
dataUrl: string;
|
|
42
|
+
name: string;
|
|
43
|
+
width: number;
|
|
44
|
+
height: number;
|
|
45
|
+
}
|
|
46
|
+
export interface FileEditorConfig {
|
|
47
|
+
/** Open this file: a File/Blob (an image, .html, .md, .txt, .csv, .docx, .xlsx) or a source the editor gave you earlier. Absent → the person picks what to create. */
|
|
48
|
+
file?: File | Blob | FileSource;
|
|
49
|
+
/** Name to use when `file` is an unnamed Blob. */
|
|
50
|
+
fileName?: string;
|
|
51
|
+
/** Start a new file of this kind. Default: ask, offering Design (HTML) first. */
|
|
52
|
+
kind?: FileKind;
|
|
53
|
+
/** Which kinds to offer. Default: design, document, text, markdown, sheet (plus email in hybrid mode). */
|
|
54
|
+
kinds?: FileKind[];
|
|
55
|
+
/** Formats offered under "Save as". Default: the sensible ones for the kind. */
|
|
56
|
+
saveFormats?: ExportFormat[];
|
|
57
|
+
/** The format the Save button uses until the person picks another (e.g. the format this file was last saved in). Default: the first of `saveFormats`. */
|
|
58
|
+
defaultSaveFormat?: import('./export').ExportFormat;
|
|
59
|
+
/** Called when the person saves — send the file back to your app. Absent → no Save button; Export (a download) is always there. */
|
|
60
|
+
onSaveFile?: (result: FileSaveResult) => void | Promise<void>;
|
|
61
|
+
/** The back/close button. Absent → no back button. */
|
|
62
|
+
onClose?: () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Rebuild a picture as an editable design (text as text, boxes as boxes, photos cut out). Inside the Plexo dashboard
|
|
65
|
+
* (`apiKey="workspace-internal"`) this is built in and uses the account's AI credits, so there is nothing to pass. Elsewhere, pass your
|
|
66
|
+
* own: either a full replacement that returns pages, or — simpler — `imageAi`, which only has to send the picture to a vision model and
|
|
67
|
+
* return its JSON description (see `IMAGE_TO_DESIGN_PROMPT`). With neither, a picture is placed on the canvas as one image.
|
|
68
|
+
*/
|
|
69
|
+
onConvertImage?: (image: ImageToDesignInput) => Promise<PageDefinition[]>;
|
|
70
|
+
imageAi?: import('./aiPicture').ImageAiTransport;
|
|
71
|
+
/** Turn the built-in AI picture conversion off (a picture is then just placed on the canvas). */
|
|
72
|
+
aiConversion?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Show the Design | HTML | Document… switch at the top, so the person can change what they are making. Default true. Set false when
|
|
75
|
+
* your own screen decides the type and it shouldn't change (the file's type is then fixed to `kind` / the opened file).
|
|
76
|
+
*/
|
|
77
|
+
showTypeSwitcher?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Our "What would you like to make?" screen, shown when neither `file` nor `kind` is given. Default true. Set false to use your own
|
|
80
|
+
* chooser: with nothing given the editor then opens a new file of the first of `kinds` instead of asking.
|
|
81
|
+
*/
|
|
82
|
+
startScreen?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Drive the file editor from the host's own screens (`ref` on `<V2Editor mode="file">` or `<FileEditor>`). */
|
|
85
|
+
export interface FileEditorRef {
|
|
86
|
+
/** Open a file (File/Blob of any supported type, or a source saved before), replacing what is open. */
|
|
87
|
+
open: (file: File | Blob | FileSource) => Promise<void>;
|
|
88
|
+
/** Start a new, empty file of this kind, replacing what is open. */
|
|
89
|
+
create: (kind: FileKind, name?: string) => void;
|
|
90
|
+
/** What is open now, as a source the host can store and reopen (null before anything is open). */
|
|
91
|
+
getSource: () => FileSource | null;
|
|
92
|
+
/** Make the finished file in a format without saving it anywhere (to upload or download it yourself). */
|
|
93
|
+
exportAs: (format: import('./export').ExportFormat, opts?: Omit<import('./export').ExportOptions, 'format'>) => Promise<import('./export').ExportResult>;
|
|
94
|
+
/** Save in a format through `onSaveFile` (the first of the offered formats when omitted). */
|
|
95
|
+
save: (format?: import('./export').ExportFormat) => Promise<void>;
|
|
96
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExportSource } from '../export';
|
|
3
|
+
/** What the Export controls will export right now: the selection, or the whole page when nothing (or only the page) is selected. */
|
|
4
|
+
export declare function useExportTarget(): {
|
|
5
|
+
nodeIds: string[];
|
|
6
|
+
name: string;
|
|
7
|
+
note: string;
|
|
8
|
+
getSource: () => ExportSource;
|
|
9
|
+
};
|
|
10
|
+
/** The Export section pinned to the bottom of the right-hand panel, like Figma's. Opens with ⇧⌘E. */
|
|
11
|
+
export declare const ExportDock: React.FC;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ExportFormat, type ExportSource } from '../export';
|
|
3
|
+
export interface ExportPanelProps {
|
|
4
|
+
/** What is being exported, for the button and the file name — "Home", "Hero section", "3 elements". */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Formats to offer. Default: PNG, JPG, PDF, SVG. */
|
|
7
|
+
formats?: ExportFormat[];
|
|
8
|
+
/** Called when the person presses Export, so it always reflects the latest edits. */
|
|
9
|
+
getSource: () => ExportSource | Promise<ExportSource>;
|
|
10
|
+
/** Say what is being exported ("The selected element") above the rows. */
|
|
11
|
+
scopeNote?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Figma-style export: one or more rows (size + format), one button. One row saves the file; several are zipped together.
|
|
15
|
+
* Everything that can go wrong (a picture that couldn't be copied, a selection that isn't on this screen size) is said in plain words.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ExportPanel: React.FC<ExportPanelProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type V2CanvasEditorProps } from '../../CanvasEditor';
|
|
3
|
+
import type { DesignSystem } from '../../design/types';
|
|
4
|
+
import type { FileEditorRef } from '../types';
|
|
5
|
+
export type FileEditorProps = Omit<V2CanvasEditorProps, 'pages' | 'initialPageId' | 'onChange' | 'children'> & {
|
|
6
|
+
designSystem?: DesignSystem;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The file editor: make or open a design (HTML), document, plain text, Markdown or spreadsheet — or a picture to edit — switch
|
|
10
|
+
* between visual / HTML / text views, preview it as an image, export it in many formats, and send it back to the host app.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FileEditor: React.ForwardRefExoticComponent<Omit<V2CanvasEditorProps, "children" | "onChange" | "pages" | "initialPageId"> & {
|
|
13
|
+
designSystem?: DesignSystem;
|
|
14
|
+
} & React.RefAttributes<FileEditorRef>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** A code editor for HTML (syntax colours, auto-closing tags, indent, folding, search). Loads its engine on first use. */
|
|
3
|
+
export declare const HtmlCodeEditor: React.FC<{
|
|
4
|
+
value: string;
|
|
5
|
+
onChange?: (v: string) => void;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/** HTML as code on the left and the page, live, on the right. What shows is what Export draws. */
|
|
10
|
+
export declare const HtmlWorkbench: React.FC<{
|
|
11
|
+
value: string;
|
|
12
|
+
onChange: (v: string) => void;
|
|
13
|
+
width: number;
|
|
14
|
+
onWidth: (w: number) => void;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CodeEditorHandle {
|
|
2
|
+
/** Replaces the whole text (without reporting it back as a change). */
|
|
3
|
+
setValue: (value: string) => void;
|
|
4
|
+
getValue: () => string;
|
|
5
|
+
focus: () => void;
|
|
6
|
+
destroy: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function mountHtmlEditor(parent: HTMLElement, value: string, opts: {
|
|
9
|
+
onChange?: (value: string) => void;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
}): CodeEditorHandle;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Grid } from '../sheet';
|
|
3
|
+
/** Plain text: a page to type on and nothing else — no formatting, no design tools. */
|
|
4
|
+
export declare const TextEditor: React.FC<{
|
|
5
|
+
value: string;
|
|
6
|
+
onChange: (v: string) => void;
|
|
7
|
+
readOnly?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
/** What the page looks like as styled text, drawn from the Markdown (safe by construction: the converter escapes everything). */
|
|
10
|
+
export declare const MarkdownPreview: React.FC<{
|
|
11
|
+
markdown: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const MarkdownEditor: React.FC<{
|
|
14
|
+
value: string;
|
|
15
|
+
onChange: (v: string) => void;
|
|
16
|
+
}>;
|
|
17
|
+
/** Removes anything that could run code (scripts, event handlers, javascript: links) from written content. */
|
|
18
|
+
export declare function cleanHtml(html: string): string;
|
|
19
|
+
/** Written content with headings, lists, links and pictures — a Word-style page. */
|
|
20
|
+
export declare const DocumentEditor: React.FC<{
|
|
21
|
+
value: string;
|
|
22
|
+
onChange: (html: string) => void;
|
|
23
|
+
onUpload?: (file: File) => Promise<string> | string;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const SheetEditor: React.FC<{
|
|
26
|
+
value: Grid;
|
|
27
|
+
onChange: (g: Grid) => void;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Draws a laid-out page as a true vector SVG — rectangles, rounded corners, borders, shadows, gradients, pictures and lines of
|
|
3
|
+
* text — so it opens (and can be edited) in design tools, unlike an SVG that only wraps the browser's own drawing.
|
|
4
|
+
* It reads the browser's computed layout, so it matches what is on screen. Handled: transforms (rotate, scale, skew, translate),
|
|
5
|
+
* linear / radial / conic gradients, several and inset shadows, text shadows, gradient text, filters and blend modes, background
|
|
6
|
+
* size / position / repeat, form fields, list bullets and video frames.
|
|
7
|
+
* Not possible in an SVG, and reported when present: frosted-glass blur behind a box, and live embeds (maps, video players).
|
|
8
|
+
*/
|
|
9
|
+
interface Rect {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function domToVectorSvg(doc: Document, crop: Rect, roots: Element[], css: string, fullDocument?: boolean): {
|
|
16
|
+
svg: string;
|
|
17
|
+
warnings: string[];
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** A tiny "store only" zip writer — enough for .docx and .xlsx, which are zip files of small XML parts. No dependencies. */
|
|
2
|
+
export declare function crc32(data: Uint8Array): number;
|
|
3
|
+
export declare const utf8: (s: string) => Uint8Array;
|
|
4
|
+
export interface ZipEntry {
|
|
5
|
+
name: string;
|
|
6
|
+
data: string | Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
/** Builds the zip's bytes. Files are stored uncompressed, which every reader accepts. */
|
|
9
|
+
export declare function zipBytes(entries: ZipEntry[]): Uint8Array;
|
|
10
|
+
export declare const zipBlob: (entries: ZipEntry[], mime: string) => Blob;
|
|
@@ -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;
|
|
@@ -206,8 +214,10 @@ export interface V2HostConfig {
|
|
|
206
214
|
onRequestComment?: (target: CommentTarget) => void;
|
|
207
215
|
/** 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. */
|
|
208
216
|
pageSettings?: React.ReactNode;
|
|
209
|
-
/** 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). */
|
|
210
|
-
mode?: 'page' | 'email';
|
|
217
|
+
/** What is being designed. 'page' (default) is a website page. 'file' opens the file editor instead: create or edit a design (HTML), document, plain text, Markdown or spreadsheet, or open a picture to edit it, switch between visual / HTML / text views and export to PNG, JPG, PDF, SVG and more. 'hybrid' is the file editor with the full page and email builders inside it. '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). */
|
|
218
|
+
mode?: 'page' | 'email' | 'file' | 'hybrid';
|
|
219
|
+
/** Used when `mode` is 'file' or 'hybrid': which file to open or create, and how saving works (see FileEditorConfig). */
|
|
220
|
+
files?: import('../files/types').FileEditorConfig;
|
|
211
221
|
/** The editor's colours: `{ accent, background, text }`, any of them. Absent → Plexo's own lime-on-black look. */
|
|
212
222
|
theme?: V2Theme;
|
|
213
223
|
/** The host's pages (see PageSource). Absent → the editor keeps its own list. */
|
|
@@ -217,6 +227,12 @@ export interface V2HostConfig {
|
|
|
217
227
|
/** Slots in the top bar (page picker, "View in app", …). */
|
|
218
228
|
headerLeft?: React.ReactNode;
|
|
219
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';
|
|
220
236
|
/** Turn built-in panels off (e.g. a landing-page-only host hides code view). All on by default except SOL (needs onAskSol). */
|
|
221
237
|
features?: {
|
|
222
238
|
pages?: boolean; /** The Branding panel (design system + Strata). */
|
|
@@ -227,7 +243,8 @@ export interface V2HostConfig {
|
|
|
227
243
|
pageSwitcher?: boolean; /** The Design | Code switch in the top bar. Default on. */
|
|
228
244
|
viewSwitch?: boolean; /** The SOL button in the top bar (SOL stays in the left rail). Default on. */
|
|
229
245
|
headerSol?: boolean; /** The left panel open when the editor starts. Default 'add' (the things to add to the page); null starts with it closed. */
|
|
230
|
-
initialLeftPanel?: import('../types/editor').LeftSidebarTab | null;
|
|
246
|
+
initialLeftPanel?: import('../types/editor').LeftSidebarTab | null; /** The Export button in the top bar (the Export section under the right-hand panel stays). Default on. */
|
|
247
|
+
exportMenu?: boolean;
|
|
231
248
|
};
|
|
232
249
|
}
|
|
233
250
|
export declare const HostProvider: React.FC<{
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
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 {
|
|
10
|
+
export type { V2Experience } from './host/HostContext';
|
|
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';
|
|
13
14
|
export type { DocumentNode, PageDefinition, NodeType, ElementStyles, ViewportMode, } from './types/editor';
|
|
@@ -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';
|
|
@@ -33,3 +34,7 @@ export type { CompileEmailOptions, CompiledEmail } from './email/compile';
|
|
|
33
34
|
export { emailIssues, EMAIL_WIDTH } from './email/support';
|
|
34
35
|
export type { EmailIssue } from './email/support';
|
|
35
36
|
export { blankEmailPages, starterEmailPages } from './email/blank';
|
|
37
|
+
export { FileEditor } from './files/ui/FileEditor';
|
|
38
|
+
export type { FileEditorProps } from './files/ui/FileEditor';
|
|
39
|
+
export { ExportPanel } from './files/ui/ExportPanel';
|
|
40
|
+
export * from './files';
|
package/dist/v2-compile.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import {
|
|
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
|
+
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-B6QkDh9R.js";
|
|
3
4
|
//#region src/v2/compile/react.ts
|
|
4
5
|
var Oe = /^[A-Z][A-Za-z0-9]*$/, Q = (e) => JSON.stringify(e);
|
|
5
6
|
function ke(e) {
|
|
6
7
|
let t = "";
|
|
7
|
-
for (let [
|
|
8
|
-
if (
|
|
9
|
-
let e =
|
|
10
|
-
|
|
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))}}`;
|
|
11
12
|
}
|
|
12
13
|
return e.style && (t += ` style={${JSON.stringify(e.style)}}`), t;
|
|
13
14
|
}
|
|
@@ -15,33 +16,33 @@ function $(e, t) {
|
|
|
15
16
|
let n = " ".repeat(t);
|
|
16
17
|
if (typeof e == "string") return `${n}{${Q(e)}}`;
|
|
17
18
|
let r = ke(e);
|
|
18
|
-
return
|
|
19
|
+
return te.has(e.tag) || !e.children?.length ? `${n}<${e.tag}${r} />` : `${n}<${e.tag}${r}>\n${e.children.map((e) => $(e, t + 1)).join("\n")}\n${n}</${e.tag}>`;
|
|
19
20
|
}
|
|
20
21
|
function Ae(e) {
|
|
21
22
|
let t = e.replace(/[^A-Za-z0-9]+/g, " ").trim().split(" ").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join("");
|
|
22
23
|
return /^[A-Z]/.test(t) ? t : `Design${t}`;
|
|
23
24
|
}
|
|
24
|
-
function je(e,
|
|
25
|
-
if (!Oe.test(
|
|
26
|
-
let
|
|
25
|
+
function je(e, n) {
|
|
26
|
+
if (!Oe.test(n.componentName)) throw Error(`"${n.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
|
|
27
|
+
let r = h(e, n), i = n.runtime !== "none" && r.usesRuntime, a = r.fontLinks, o = "`" + r.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
|
|
27
28
|
return {
|
|
28
29
|
code: `// Generated by Plexo from a visual design. Edit it visually in the app editor's Design view
|
|
29
30
|
// (which regenerates this file), or turn it into regular code by editing here.
|
|
30
|
-
${
|
|
31
|
+
${i ? "// @ts-nocheck — the small runtime below is plain JavaScript.\nimport { useEffect, useRef } from \"react\";" : "import type { ReactElement } from \"react\";"}
|
|
31
32
|
|
|
32
|
-
const CSS = ${
|
|
33
|
-
${
|
|
34
|
-
export default function ${
|
|
35
|
-
${
|
|
33
|
+
const CSS = ${o};
|
|
34
|
+
${a.length ? `const FONTS: string[] = ${JSON.stringify(a)};\n` : ""}${i ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${t};\n` : ""}
|
|
35
|
+
export default function ${n.componentName}()${i ? "" : ": ReactElement"} {
|
|
36
|
+
${i ? " const root = useRef<HTMLDivElement>(null);\n useEffect(() => (root.current ? plexoInit(root.current) : undefined), []);\n" : ""} return (
|
|
36
37
|
<>
|
|
37
|
-
${
|
|
38
|
-
${
|
|
38
|
+
${a.length ? " {FONTS.map((href) => <link key={href} rel=\"stylesheet\" href={href} />)}\n" : ""} <style>{CSS}</style>
|
|
39
|
+
${i ? $(r.tree, 3).replace("<div", "<div ref={root}") : $(r.tree, 3)}
|
|
39
40
|
</>
|
|
40
41
|
);
|
|
41
42
|
}
|
|
42
43
|
`,
|
|
43
|
-
warnings:
|
|
44
|
+
warnings: r.warnings
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
//#endregion
|
|
47
|
-
export {
|
|
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
ADDED
|
@@ -0,0 +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-Bjoz1wCf.js";
|
|
2
|
+
import { n as D, r as O } from "./pdfImport-BOev0Pc1.js";
|
|
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 };
|
package/dist/v2-strata.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "./brandGuide-
|
|
2
|
-
import { a as r, c as i, d as a, i as o, l as s, n as c, o as l, r as u, s as d, t as f, u as p } from "./client-
|
|
1
|
+
import { n as e, r as t, t as n } from "./brandGuide-Dd4fqVjS.js";
|
|
2
|
+
import { a as r, c as i, d as a, i as o, l as s, n as c, o as l, r as u, s as d, t as f, u as p } from "./client-CWui0-3q.js";
|
|
3
3
|
export { f as StrataError, d as applySync, i as baseOf, n as brandCss, e as brandGuidelines, t as brandScss, c as componentFromStrata, u as createStrataClient, s as hasAnything, l as planAutoUpdate, p as planSync, o as projectFromStrata, a as summarize, r as tokenFromStrata };
|