@charisol/plexo-sdk 2.0.2 → 2.0.4

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.
Files changed (32) hide show
  1. package/dist/{InlineColorPicker-8ewm1Asx.js → InlineColorPicker-BGyPZzyk.js} +326 -138
  2. package/dist/index.js +12669 -12857
  3. package/dist/plexo-sdk.css +1 -1
  4. package/dist/{legacy-B4E71HSa.js → v1-B92O2-af.js} +4069 -1601
  5. package/dist/v2/compile/build.d.ts +6 -0
  6. package/dist/v2/compile/extras.d.ts +19 -0
  7. package/dist/v2/compile/index.d.ts +3 -0
  8. package/dist/v2/compile/sanitizeHtml.d.ts +31 -0
  9. package/dist/v2/components/sidebar/ImagesPanel.d.ts +6 -0
  10. package/dist/v2/context/EditorContext.d.ts +3 -1
  11. package/dist/v2/data/insertableComponents.d.ts +1 -1
  12. package/dist/v2/host/HostContext.d.ts +6 -1
  13. package/dist/v2/index.d.ts +5 -0
  14. package/dist/v2/migrate/v1.d.ts +43 -0
  15. package/dist/v2/render/dynamicBlocks.d.ts +53 -0
  16. package/dist/v2/render/elementProps.d.ts +2 -1
  17. package/dist/v2/render/elements.d.ts +4 -0
  18. package/dist/v2/sections/catalog/blogArticle.d.ts +2 -0
  19. package/dist/v2/sections/catalog/blogList.d.ts +2 -0
  20. package/dist/v2/sections/catalog/cartCheckout.d.ts +2 -0
  21. package/dist/v2/sections/catalog/dynamicKit.d.ts +10 -0
  22. package/dist/v2/sections/catalog/funnelSignup.d.ts +2 -0
  23. package/dist/v2/sections/catalog/orderConfirmation.d.ts +2 -0
  24. package/dist/v2/sections/catalog/orderTracking.d.ts +2 -0
  25. package/dist/v2/sections/catalog/productPage.d.ts +2 -0
  26. package/dist/v2/sections/catalog/shop.d.ts +2 -0
  27. package/dist/v2/sections/types.d.ts +2 -2
  28. package/dist/v2/types/editor.d.ts +1 -1
  29. package/dist/v2-compile.js +19 -112
  30. package/dist/v2.js +3885 -3487
  31. package/package.json +1 -1
  32. package/dist/v2/components/sidebar/LibraryPanel.d.ts +0 -3
@@ -18,6 +18,12 @@ export interface CompileOptions extends FormDestinationConfig {
18
18
  now?: number;
19
19
  /** The site's design system — the colours, fonts and shapes the page's tokens resolve to. Defaults to the built-in one. */
20
20
  designSystem?: DesignSystem;
21
+ /**
22
+ * The site owner's own script (V1's "custom code"). Added as the last inline `<script>` of the document and appended to
23
+ * `script`; `</script` inside it is escaped and it is capped at MAX_CUSTOM_JS characters. Off by default. It is owner code the
24
+ * host chooses to pass — it is not sanitised, so only pass what the site's owner wrote, and add it AFTER `sanitizeV2Html`.
25
+ */
26
+ customJs?: string;
21
27
  }
22
28
  export interface BuiltPage {
23
29
  tree: HNode;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Small, shared rules for the two owner-facing publishing extras: an element's anchor name (`props.htmlId`) and the
3
+ * site's own custom script (`CompileOptions.customJs`).
4
+ */
5
+ /** Longest custom script accepted, in characters. Anything longer is left out with a warning (never silently cut mid-statement). */
6
+ export declare const MAX_CUSTOM_JS = 100000;
7
+ /** An anchor name a person can type: starts with a letter, then letters, digits, `-` or `_` (up to 64). */
8
+ export declare const validHtmlId: (value: unknown) => string | null;
9
+ /** Turns what a person typed into a usable anchor name ("My Pricing" → "My-Pricing"), or '' when nothing usable is left. */
10
+ export declare const toHtmlId: (typed: string) => string;
11
+ /**
12
+ * The owner's custom script, made safe to sit inside a `<script>` element: trimmed, with `</script` and `<!--` unable to end or
13
+ * confuse the element. This is OWNER-authored code that the host explicitly passes (the same trust as V1's custom code box) —
14
+ * it is not sanitised, only contained. Returns '' for empty input or input over the size cap, and says why in `warning`.
15
+ */
16
+ export declare function prepareCustomJs(source: unknown): {
17
+ code: string;
18
+ warning?: string;
19
+ };
@@ -26,3 +26,6 @@ export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplate
26
26
  export type { PageTemplate, PageTemplateSection, PageTemplateSummary } from '../sections/pageTemplates';
27
27
  export { catalogSchema, describeDesign, describeSection, applyCommands, setPageTemplateResolver, solCommandSchema, parseSolReply, describeCommand, SOL_SYSTEM_PROMPT } from '../sol';
28
28
  export type { SolCatalog, SolDesignSummary, SolCommand, CommandResult, ApplyResult, ParsedSolReply } from '../sol';
29
+ export { sanitizeV2Html, sanitizeCss, type SanitizeV2Options } from './sanitizeHtml';
30
+ export { MAX_CUSTOM_JS, validHtmlId, prepareCustomJs } from './extras';
31
+ export { convertV1Design, V1_DYNAMIC_EQUIVALENTS, V2_DYNAMIC_READY, type ConvertV1Options, type ConvertV1Result, type ConvertV1Fidelity } from '../migrate/v1';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * `sanitizeV2Html` — an allow-list sanitizer for what the V2 HTML compiler emits (a fragment or a whole document).
3
+ *
4
+ * The compilers already make every value safe as they print it. This is the second layer for the serving path: whatever
5
+ * is stored or travels between the compiler and a visitor's browser is run through it again, so a tampered or
6
+ * hand-edited page can't smuggle script in. It is dependency-free and DOM-free (a small tokenizer, not a parser), so it
7
+ * runs on a server. Unlike a generic HTML sanitizer it knows V2's own vocabulary and keeps all of it:
8
+ * `<details>/<summary>` accordions, YouTube/Vimeo video iframes, sandboxed embed iframes, `<figure>`, inline SVG icons,
9
+ * forms, `data-plx-*`/`data-plexo-*` hooks, the compiler's stylesheet, and the compiler's own runtime `<script>` (only
10
+ * when its text is byte-identical to the one the compiler prints).
11
+ *
12
+ * What it removes: every other `<script>` (the owner's custom code is added by the host AFTER sanitising — see
13
+ * `allowedScripts` if you want it kept), `on*` attributes, `javascript:`/`vbscript:`/`data:` addresses (a raster/SVG
14
+ * `data:image` is fine in `<img>` and CSS `url()`), iframes to anywhere but YouTube/Vimeo that aren't sandboxed,
15
+ * `<object>/<embed>/<base>/<meta http-equiv>/<template>/<math>`, comments, CSS `@import`, `expression()`, `behavior`,
16
+ * `-moz-binding`, and `url()` to anything that isn't http(s), a relative path or an image `data:`. Unknown tags are
17
+ * dropped and their text kept. The output is idempotent: sanitising it again changes nothing.
18
+ */
19
+ export interface SanitizeV2Options {
20
+ /** May an HTML embed's sandbox allow scripts (inside its own origin-less sandbox)? Default true. */
21
+ allowEmbedScripts?: boolean;
22
+ /** Extra inline `<script>` bodies to keep, matched byte for byte (e.g. the owner's custom code the host vetted). */
23
+ allowedScripts?: string[];
24
+ }
25
+ /**
26
+ * Keeps the parts of a stylesheet (or a `style=""` declaration list) that are safe, and everything else byte for byte.
27
+ * Rules and declarations that could run script or fetch from somewhere strange are removed whole.
28
+ */
29
+ export declare function sanitizeCss(css: string): string;
30
+ /** Sanitises V2 compiler output (a fragment or a whole document) with an allow-list. See the file header. */
31
+ export declare function sanitizeV2Html(html: string, opts?: SanitizeV2Options): string;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * Pictures for the page: free stock photos (when the host connects a photo service) and the images already uploaded to the project.
4
+ * Clicking a picture fills the selected image, or adds a new image to the page.
5
+ */
6
+ export declare const ImagesPanel: React.FC;
@@ -123,7 +123,9 @@ interface EditorContextType {
123
123
  deleteNodes: (nodeIds: string[]) => void;
124
124
  duplicateNode: (nodeId: string) => void;
125
125
  /** Returns the new element's id (undefined if the component is unknown). */
126
- insertComponent: (parentId: string | null, componentId: string) => string | undefined;
126
+ insertComponent: (parentId: string | null, componentId: string, overrides?: {
127
+ props?: Record<string, unknown>;
128
+ }) => string | undefined;
127
129
  /** Adds a ready-made section (e.g. from the host's library) to the page, with fresh ids. */
128
130
  insertNodeTree: (tree: DocumentNode) => void;
129
131
  /** Moves elements that sit outside a screen's visible canvas back inside it (one undo step). */
@@ -4,7 +4,7 @@ export interface InsertableComponentItem {
4
4
  name: string;
5
5
  type: NodeType;
6
6
  icon: string;
7
- category: 'layout' | 'typography' | 'media' | 'interactive';
7
+ category: 'layout' | 'typography' | 'media' | 'interactive' | 'blog' | 'store' | 'funnel';
8
8
  badge?: string;
9
9
  /** Not built yet — it would publish as an empty box, so the Add panel doesn't offer it. */
10
10
  unavailable?: boolean;
@@ -129,6 +129,8 @@ export interface V2HostConfig {
129
129
  };
130
130
  /** The host's own media library (previously uploaded images). */
131
131
  media?: MediaAsset[];
132
+ /** Loads the project's uploaded images when the Images panel opens (use instead of, or alongside, `media`, so the list is always fresh). */
133
+ loadMedia?: () => Promise<MediaAsset[]>;
132
134
  /** Powers SOL / Ask-AI. Absent → the SOL tab is hidden (no AI, no credits, nothing fake). */
133
135
  onAskSol?: (question: string, context: AskSolContext) => Promise<string>;
134
136
  /**
@@ -160,7 +162,10 @@ export interface V2HostConfig {
160
162
  branding?: boolean; /** @deprecated use `branding` */
161
163
  strata?: boolean;
162
164
  library?: boolean;
163
- codeView?: boolean;
165
+ codeView?: boolean; /** The page picker in the top bar (the Pages panel stays). Default on. */
166
+ pageSwitcher?: boolean; /** The Design | Code switch in the top bar. Default on. */
167
+ viewSwitch?: boolean; /** The SOL button in the top bar (SOL stays in the left rail). Default on. */
168
+ headerSol?: boolean;
164
169
  };
165
170
  }
166
171
  export declare const HostProvider: React.FC<{
@@ -19,3 +19,8 @@ export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplate
19
19
  export type { PageTemplate, PageTemplateSection, PageTemplateSummary } from './sections/pageTemplates';
20
20
  export { catalogSchema, describeDesign, applyCommands, parseSolReply, describeCommand, setPageTemplateResolver, SOL_SYSTEM_PROMPT, solCommandSchema } from './sol';
21
21
  export type { SolCatalog, SolKind, SolField, SolVariant, SolDesignSummary, SolSectionSummary, SolCommand, SolCommandOp, CommandResult, ParsedSolReply, ApplyOptions, ApplyResult, PageTemplateResolver } from './sol';
22
+ export { sanitizeV2Html, sanitizeCss } from './compile/sanitizeHtml';
23
+ export type { SanitizeV2Options } from './compile/sanitizeHtml';
24
+ export { MAX_CUSTOM_JS, validHtmlId, prepareCustomJs } from './compile/extras';
25
+ export { convertV1Design, V1_DYNAMIC_EQUIVALENTS, V2_DYNAMIC_READY } from './migrate/v1';
26
+ export type { ConvertV1Options, ConvertV1Result, ConvertV1Fidelity } from './migrate/v1';
@@ -0,0 +1,43 @@
1
+ import type { PageDefinition } from '../types/editor';
2
+ /**
3
+ * Converts the safe subset of a V1 design (`TemplateJSON`: `body.rows[].columns[].elements / nestedRows / childOrder`) into a
4
+ * V2 page, so a site built in the old builder can be opened, edited and published with V2.
5
+ *
6
+ * Mapping, in one breath: a row becomes a section (with its anchor name, background and spacing); its columns become a grid
7
+ * whose shares follow the V1 column widths and which stacks on phones; every element type V2 has a twin for (heading, text,
8
+ * button, image, divider, spacer, card, icon, carousel, video, social, menu, html, table, timer, accordion) maps one to one with
9
+ * its styling (colours, fonts, sizes, spacing, corners, borders, backgrounds, alignment, per-screen overrides); form fields become
10
+ * one V2 form. Custom script is handed back in `extras.customJs` — the host decides whether to run it.
11
+ *
12
+ * It never throws. Anything it can't carry over is named in `warnings` in plain words, and `fidelity` says how much to trust the
13
+ * result: 'exact' only when nothing was lost or approximated, 'approximate' when everything is there but some looks or behaviours
14
+ * differ (rich text simplified, a V1 embed now sandboxed…), 'partial' when whole blocks had to be left out.
15
+ */
16
+ export interface ConvertV1Options {
17
+ /** Id for the new page (default `v1-page`). */
18
+ id?: string;
19
+ name?: string;
20
+ slug?: string;
21
+ isHome?: boolean;
22
+ }
23
+ export type ConvertV1Fidelity = 'exact' | 'approximate' | 'partial';
24
+ export interface ConvertV1Result {
25
+ page: PageDefinition;
26
+ warnings: string[];
27
+ fidelity: ConvertV1Fidelity;
28
+ /** What isn't a design but came with it. `customJs` is the owner's script from the old Settings tab (not sanitised — the host decides). */
29
+ extras: {
30
+ customJs?: string;
31
+ };
32
+ }
33
+ /**
34
+ * V1's blog / commerce / funnel blocks and the V2 block that replaces each. They are opaque placeholders in V1 (the host splices
35
+ * real data into them), so each needs a real V2 node to land on.
36
+ *
37
+ * Each lands on the V2 dynamic block of the same job (see render/dynamicBlocks.ts). MailDrip sign-up forms have no equivalent and
38
+ * are dropped with a warning, because `parsePages` would reject a type it doesn't know.
39
+ */
40
+ export declare const V1_DYNAMIC_EQUIVALENTS: Readonly<Record<string, string | null>>;
41
+ export declare const V2_DYNAMIC_READY = true;
42
+ /** See the file header. */
43
+ export declare function convertV1Design(v1: unknown, opts?: ConvertV1Options): ConvertV1Result;
@@ -0,0 +1,53 @@
1
+ import type { DocumentNode } from '../types/editor';
2
+ import { type HNode } from './ir';
3
+ import type { ElementContext } from './elements';
4
+ /**
5
+ * Dynamic blocks: places on a page where the Plexo server fills in live content (a blog post, the shop, a cart, an order).
6
+ *
7
+ * A published dynamic block is an EMPTY marker `<div data-plexo-…="true"></div>`. The server finds the marker in the
8
+ * compiled HTML and renders the real thing into it (lib/pub/blogLayoutRender.ts for the blog, public/commerce.js for the
9
+ * store, public/lms-signup.js for funnel sign-up). The marker names and attributes below are therefore a contract with the
10
+ * server, identical to what the V1 builder's compiler prints — change them only together with the server.
11
+ *
12
+ * In the editor the same block draws a labelled placeholder with sample rows, so a designer can see where it goes and how
13
+ * big it is without any data existing yet.
14
+ */
15
+ export declare const DYNAMIC_ELEMENT_TYPES: readonly ["blogTitle", "blogContent", "blogFeaturedImage", "blogDate", "blogAuthor", "blogCategories", "blogComments", "blogPostList", "shopGrid", "product", "booking", "cart", "checkout", "orderConfirmation", "orderTracking", "signupForm"];
16
+ export type DynamicElementType = (typeof DYNAMIC_ELEMENT_TYPES)[number];
17
+ export declare const isDynamicElement: (t: string) => t is DynamicElementType;
18
+ /** Every setting a dynamic block can carry. Each type reads only the ones that apply to it (see SPECS). */
19
+ export interface DynamicProps {
20
+ /** Text shown before the date / author / categories ("Written by "). */
21
+ prefix?: string;
22
+ /** product: which product to show (empty on a product page, which shows whichever one the visitor opened). */
23
+ productId?: string;
24
+ /** booking: which service to book. */
25
+ serviceId?: string;
26
+ /** product: 'detail' (a full product page), 'bare' (just the buy button); shopGrid: 'dark' cards. */
27
+ mode?: string;
28
+ /** shopGrid: false → a small curated grid instead of the full searchable store. */
29
+ storeMode?: boolean;
30
+ /** shopGrid (curated): how many products. */
31
+ limit?: number | string;
32
+ /** shopGrid (curated): 'best_seller', 'most_recent' or a category's name. */
33
+ category?: string;
34
+ sort?: string;
35
+ itemsPerRow?: number | string;
36
+ itemsPerPage?: number | string;
37
+ paginated?: boolean;
38
+ /** signupForm: which funnel the form belongs to (defaults to the one being compiled). */
39
+ templateId?: string;
40
+ }
41
+ type Group = 'Blog' | 'Store' | 'Funnel';
42
+ export declare const dynamicLabel: (t: DynamicElementType) => string;
43
+ export declare const dynamicGroup: (t: DynamicElementType) => Group;
44
+ /** Does this type read the given setting? Drives which controls the editor shows. */
45
+ export declare const dynamicUses: (t: DynamicElementType, key: keyof DynamicProps) => boolean;
46
+ /** What a freshly added block starts with. */
47
+ export declare function defaultDynamicProps(type: DynamicElementType): Record<string, unknown>;
48
+ /**
49
+ * The markup for a dynamic block. Published: just the empty marker (the server fills it). In the editor
50
+ * (`placeholders`): the marker around a labelled placeholder, so the page shows where the live content will go.
51
+ */
52
+ export declare function buildDynamic(node: DocumentNode, c: ElementContext): HNode | null;
53
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { NodeType } from '../types/editor';
2
2
  import type { SocialNetwork } from './socialIcons';
3
+ export type { DynamicProps, DynamicElementType } from './dynamicBlocks';
3
4
  export interface CarouselSlide {
4
5
  src: string;
5
6
  alt?: string;
@@ -85,7 +86,7 @@ export interface IconProps {
85
86
  strokeWidth?: number; /** Read aloud by screen readers; empty = decorative. */
86
87
  label?: string;
87
88
  }
88
- export declare const RICH_ELEMENT_TYPES: readonly ["icon", "carousel", "video", "social", "menu", "html", "table", "timer", "form", "accordion"];
89
+ export declare const RICH_ELEMENT_TYPES: readonly ["icon", "carousel", "video", "social", "menu", "html", "table", "timer", "form", "accordion", "blogTitle", "blogContent", "blogFeaturedImage", "blogDate", "blogAuthor", "blogCategories", "blogComments", "blogPostList", "shopGrid", "product", "booking", "cart", "checkout", "orderConfirmation", "orderTracking", "signupForm"];
89
90
  export type RichElementType = (typeof RICH_ELEMENT_TYPES)[number];
90
91
  export declare const isRichElement: (t: NodeType) => t is RichElementType;
91
92
  /** What a freshly added element starts with — real, editable content, never an empty box. */
@@ -12,6 +12,10 @@ export interface ElementContext {
12
12
  allowEmbedScripts: boolean;
13
13
  /** Clock for the timer's first paint (ms). */
14
14
  now: number;
15
+ /** Draw labelled placeholders inside dynamic blocks (the editor does; published pages print only the empty marker). */
16
+ placeholders?: boolean;
17
+ /** The funnel/site this page belongs to — what a sign-up form connects to when it isn't given its own. */
18
+ templateId?: string;
15
19
  }
16
20
  /** Same name the host's form handler checks as its spam trap (a visitor never sees or fills it). */
17
21
  export declare const FORM_HONEYPOT_FIELD_NAME = "_hp_field";
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const blogArticle: KindDef;
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const blogList: KindDef;
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const cartCheckout: KindDef;
@@ -0,0 +1,10 @@
1
+ import type { DocumentNode, ElementStyles } from '../../types/editor';
2
+ import { type DynamicElementType } from '../../render/dynamicBlocks';
3
+ import type { Kit } from '../kit';
4
+ import type { BuildCtx } from '../types';
5
+ /** A dynamic block (blog, store or funnel content the server fills in) placed inside a section. */
6
+ export declare const dyn: (k: Kit, slot: string, type: DynamicElementType, props?: Record<string, unknown>, styles?: Partial<ElementStyles>) => DocumentNode;
7
+ /** The usual eyebrow + heading + paragraph, aligned like the rest of the section. */
8
+ export declare const intro: (k: Kit, c: BuildCtx["content"], o?: {
9
+ maxWidth?: string;
10
+ }) => DocumentNode | null;
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const funnelSignup: KindDef;
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const orderConfirmation: KindDef;
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const orderTracking: KindDef;
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const productPage: KindDef;
@@ -0,0 +1,2 @@
1
+ import type { KindDef } from '../types';
2
+ export declare const shop: KindDef;
@@ -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';
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';
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. */
@@ -93,7 +93,7 @@ export interface KindDef {
93
93
  label: string;
94
94
  description: string;
95
95
  /** Groups the gallery. */
96
- group: 'Navigation' | 'Intro' | 'Content' | 'Proof' | 'Convert' | 'Footer';
96
+ group: 'Navigation' | 'Intro' | 'Content' | 'Proof' | 'Convert' | 'Footer' | 'Blog' | 'Store' | 'Funnel';
97
97
  /** Slim vertical padding (headers, bars, footers) instead of a full section's. */
98
98
  compact?: boolean;
99
99
  fields: FieldDef[];
@@ -1,5 +1,5 @@
1
1
  import type { TextStyleId } from '../design/textStyles';
2
- export type NodeType = 'page' | 'section' | 'container' | 'columns' | 'column' | 'heading' | 'paragraph' | 'button' | 'image' | 'badge' | 'divider' | 'spacer' | 'card' | 'icon' | 'carousel' | 'video' | 'social' | 'menu' | 'html' | 'table' | 'timer' | 'form' | 'accordion';
2
+ export type NodeType = 'page' | 'section' | 'container' | 'columns' | 'column' | 'heading' | 'paragraph' | 'button' | 'image' | 'badge' | 'divider' | 'spacer' | 'card' | 'icon' | 'carousel' | 'video' | 'social' | 'menu' | 'html' | 'table' | 'timer' | 'form' | 'accordion' | 'blogTitle' | 'blogContent' | 'blogFeaturedImage' | 'blogDate' | 'blogAuthor' | 'blogCategories' | 'blogComments' | 'blogPostList' | 'shopGrid' | 'product' | 'booking' | 'cart' | 'checkout' | 'orderConfirmation' | 'orderTracking' | 'signupForm';
3
3
  export type SizingMode = 'hug' | 'fill' | 'fixed';
4
4
  export type LayoutMode = 'flow' | 'grid' | 'free';
5
5
  export type HorizontalConstraint = 'left' | 'right' | 'center' | 'stretch' | 'scale';
@@ -1,42 +1,41 @@
1
- import { c as e, d as t, f as n, i as r, l as i, o as a, p as o, r as s, t as c, u as l } from "./schemas-Bq5o5MfF.js";
2
- import { B as u, F as d, Gt as f, H as ee, Ht as te, I as p, L as m, P as h, R as g, V as _, Wt as v, a as y, b, ct as x, dt as S, f as C, ft as w, g as T, i as E, l as D, lt as O, n as k, o as A, ot as j, pt as M, qt as ne, r as N, st as P, t as F, ut as I, y as L, z as R } from "./legacy-B4E71HSa.js";
3
- import { n as z, t as B } from "./lint-D-2x-Yeb.js";
1
+ import { D as e, G as t, J as n, K as r, O as i, Qt as a, St as o, T as s, U as c, W as l, X as u, Y as d, Z as f, Zt as p, _ as m, _t as h, a as g, an as _, b as v, bt as y, c as b, cn as x, d as S, f as C, gt as w, ht as T, i as E, l as D, m as O, n as k, o as A, p as j, q as M, r as N, s as P, sn as F, t as I, u as L, un as R, vt as z, w as B, xt as V, yt as H } from "./v1-B92O2-af.js";
2
+ import { n as U, t as W } from "./lint-D-2x-Yeb.js";
4
3
  //#region src/v2/compile/react.ts
5
- var V = /^[A-Z][A-Za-z0-9]*$/, H = (e) => JSON.stringify(e);
6
- function U(e) {
4
+ var G = /^[A-Z][A-Za-z0-9]*$/, K = (e) => JSON.stringify(e);
5
+ function q(e) {
7
6
  let t = "";
8
7
  for (let [n, r] of Object.entries(e.attrs ?? {})) {
9
8
  if (r === void 0 || r === !1) continue;
10
- let e = b(n);
11
- r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${H(String(r))}}`;
9
+ let e = a(n);
10
+ r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${K(String(r))}}`;
12
11
  }
13
12
  return e.style && (t += ` style={${JSON.stringify(e.style)}}`), t;
14
13
  }
15
- function W(e, t) {
14
+ function J(e, t) {
16
15
  let n = " ".repeat(t);
17
- if (typeof e == "string") return `${n}{${H(e)}}`;
18
- let r = U(e);
19
- return L.has(e.tag) || !e.children?.length ? `${n}<${e.tag}${r} />` : `${n}<${e.tag}${r}>\n${e.children.map((e) => W(e, t + 1)).join("\n")}\n${n}</${e.tag}>`;
16
+ if (typeof e == "string") return `${n}{${K(e)}}`;
17
+ let r = q(e);
18
+ return p.has(e.tag) || !e.children?.length ? `${n}<${e.tag}${r} />` : `${n}<${e.tag}${r}>\n${e.children.map((e) => J(e, t + 1)).join("\n")}\n${n}</${e.tag}>`;
20
19
  }
21
- function G(e) {
20
+ function Y(e) {
22
21
  let t = e.replace(/[^A-Za-z0-9]+/g, " ").trim().split(" ").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join("");
23
22
  return /^[A-Z]/.test(t) ? t : `Design${t}`;
24
23
  }
25
- function K(e, t) {
26
- if (!V.test(t.componentName)) throw Error(`"${t.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
27
- let n = y(e, t), r = t.runtime !== "none" && n.usesRuntime, i = A(n.fonts), a = "`" + n.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
24
+ function X(e, t) {
25
+ if (!G.test(t.componentName)) throw Error(`"${t.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
26
+ let n = j(e, t), r = t.runtime !== "none" && n.usesRuntime, a = O(n.fonts), o = "`" + n.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
28
27
  return {
29
28
  code: `// Generated by Plexo from a visual design. Edit it visually in the app editor's Design view
30
29
  // (which regenerates this file), or turn it into regular code by editing here.
31
30
  ${r ? "// @ts-nocheck — the small runtime below is plain JavaScript.\nimport { useEffect, useRef } from \"react\";" : "import type { ReactElement } from \"react\";"}
32
31
 
33
- const CSS = ${a};
34
- ${i ? `const FONTS = ${H(i)};\n` : ""}${r ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${T};\n` : ""}
32
+ const CSS = ${o};
33
+ ${a ? `const FONTS = ${K(a)};\n` : ""}${r ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${i};\n` : ""}
35
34
  export default function ${t.componentName}()${r ? "" : ": ReactElement"} {
36
35
  ${r ? " const root = useRef<HTMLDivElement>(null);\n useEffect(() => (root.current ? plexoInit(root.current) : undefined), []);\n" : ""} return (
37
36
  <>
38
- ${i ? " <link rel=\"stylesheet\" href={FONTS} />\n" : ""} <style>{CSS}</style>
39
- ${r ? W(n.tree, 3).replace("<div", "<div ref={root}") : W(n.tree, 3)}
37
+ ${a ? " <link rel=\"stylesheet\" href={FONTS} />\n" : ""} <style>{CSS}</style>
38
+ ${r ? J(n.tree, 3).replace("<div", "<div ref={root}") : J(n.tree, 3)}
40
39
  </>
41
40
  );
42
41
  }
@@ -45,96 +44,4 @@ ${r ? W(n.tree, 3).replace("<div", "<div ref={root}") : W(n.tree, 3)}
45
44
  };
46
45
  }
47
46
  //#endregion
48
- //#region src/v2/compile/schema.ts
49
- var q = 5e3, J = 40, Y = [
50
- "page",
51
- "section",
52
- "container",
53
- "columns",
54
- "column",
55
- "heading",
56
- "paragraph",
57
- "button",
58
- "image",
59
- "badge",
60
- "divider",
61
- "spacer",
62
- "card",
63
- "icon",
64
- "carousel",
65
- "video",
66
- "social",
67
- "menu",
68
- "html",
69
- "table",
70
- "timer",
71
- "form",
72
- "accordion"
73
- ], X = n([
74
- t().max(2e3),
75
- e(),
76
- r()
77
- ]), Z = l(t(), X.optional()), Q = a(() => i({
78
- id: t().min(1).max(200),
79
- type: c(Y),
80
- name: t().max(300),
81
- content: t().max(1e5).optional(),
82
- props: l(t(), o()).optional(),
83
- styles: Z,
84
- responsive: i({
85
- tablet: Z.optional(),
86
- mobile: Z.optional()
87
- }).optional(),
88
- responsiveVisibility: i({
89
- hideOnDesktop: r().optional(),
90
- hideOnTablet: r().optional(),
91
- hideOnMobile: r().optional()
92
- }).optional(),
93
- children: s(Q).optional(),
94
- locked: r().optional(),
95
- hidden: r().optional()
96
- })), re = i({
97
- id: t().min(1).max(200),
98
- name: t().max(300),
99
- slug: t().max(300),
100
- isHome: r().optional(),
101
- rootNode: Q
102
- });
103
- function $(e, t, n) {
104
- if (n.n += 1, n.n > 5e3) return `This design is too large (more than ${q} elements).`;
105
- if (t > 40) return "This design is nested too deeply.";
106
- if (n.ids.has(e.id)) return `Two elements share the same id ("${e.id}"). Each element needs its own.`;
107
- n.ids.add(e.id);
108
- for (let r of e.children ?? []) {
109
- let e = $(r, t + 1, n);
110
- if (e) return e;
111
- }
112
- return null;
113
- }
114
- function ie(e) {
115
- let t = s(re).min(1, "A design needs at least one page.").safeParse(e);
116
- if (!t.success) {
117
- let e = t.error.issues[0], n = e.path.length ? ` (at ${e.path.filter((e) => typeof e == "string" && e !== "children" && e !== "rootNode").join(" › ") || "the design"})` : "";
118
- return {
119
- ok: !1,
120
- error: `This design can't be opened: ${e.message}${n}.`
121
- };
122
- }
123
- let n = t.data;
124
- for (let e of n) {
125
- let t = $(e.rootNode, 0, {
126
- n: 0,
127
- ids: /* @__PURE__ */ new Set()
128
- });
129
- if (t) return {
130
- ok: !1,
131
- error: t
132
- };
133
- }
134
- return {
135
- ok: !0,
136
- pages: n
137
- };
138
- }
139
- //#endregion
140
- export { v as FRAME_WIDTH, J as MAX_DEPTH, q as MAX_NODES, f as MEDIA_QUERY, P as PAGE_TEMPLATES, h as SOL_SYSTEM_PROMPT, m as applyCommands, u as blankPages, x as buildPageFromTemplate, O as buildTemplateSections, j as catalogSchema, N as compilePageToHtml, K as compilePageToReact, G as componentNameFor, te as computePlacements, F as convertLegacyDesign, ne as createDefaultDesignSystem, d as describeCommand, _ as describeDesign, ee as describeSection, I as getPageTemplate, k as isLegacyDesign, S as isPageEmpty, B as lintDesignSystem, w as listPageTemplates, ie as parsePages, p as parseSolReply, C as parseVideoUrl, E as printHtml, z as repairDesignSystem, D as resolveFormDestination, g as setPageTemplateResolver, R as solCommandSchema, M as templateSeed };
47
+ export { F as FRAME_WIDTH, B as MAX_CUSTOM_JS, E as MAX_DEPTH, g as MAX_NODES, x as MEDIA_QUERY, w as PAGE_TEMPLATES, c as SOL_SYSTEM_PROMPT, I as V1_DYNAMIC_EQUIVALENTS, k as V2_DYNAMIC_READY, r as applyCommands, d as blankPages, h as buildPageFromTemplate, z as buildTemplateSections, T as catalogSchema, S as compilePageToHtml, X as compilePageToReact, Y as componentNameFor, _ as computePlacements, D as convertLegacyDesign, N as convertV1Design, R as createDefaultDesignSystem, l as describeCommand, u as describeDesign, f as describeSection, H as getPageTemplate, L as isLegacyDesign, y as isPageEmpty, W as lintDesignSystem, V as listPageTemplates, A as parsePages, t as parseSolReply, v as parseVideoUrl, s as prepareCustomJs, C as printHtml, U as repairDesignSystem, m as resolveFormDestination, P as sanitizeCss, b as sanitizeV2Html, M as setPageTemplateResolver, n as solCommandSchema, o as templateSeed, e as validHtmlId };