@charisol/plexo-sdk 2.0.26 → 2.0.28

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.
@@ -24,6 +24,12 @@ export interface CompileOptions extends FormDestinationConfig {
24
24
  * host chooses to pass — it is not sanitised, so only pass what the site's owner wrote, and add it AFTER `sanitizeV2Html`.
25
25
  */
26
26
  customJs?: string;
27
+ /**
28
+ * Where the design system's values go. 'root' (default): on `:where(:root)` at zero specificity, so a hosted brand sheet
29
+ * (`brandStylesheet`, served by the host and linked from the page) overrides them live without a recompile. 'page': on
30
+ * `.plx-page` (the old behaviour) — only for a host that puts several pages with DIFFERENT brands in one document.
31
+ */
32
+ tokenScope?: 'root' | 'page';
27
33
  }
28
34
  export interface BuiltPage {
29
35
  tree: HNode;
@@ -40,14 +46,6 @@ export interface BuiltPage {
40
46
  * gradient needs, with nothing that could fetch a file or end the declaration, and balanced brackets.
41
47
  */
42
48
  export declare function safeGradient(v: string): boolean;
43
- /**
44
- * Turns one page into markup and CSS. This is the single compile step both outputs share (HTML and React print the
45
- * same tree), and it is where the visible canvas of each screen is enforced:
46
- * - an element that sits completely outside a screen's frame is not shown on that screen (and is left out of the
47
- * page entirely if no screen shows it), so working-area content never reaches a visitor;
48
- * - an element partly outside is clipped at its section's edge;
49
- * - the same box model and constraints the editor uses (computeNodeCss) decide where everything lands.
50
- */
51
49
  export declare function buildPage(pageIn: PageDefinition, opts?: CompileOptions): BuiltPage;
52
50
  /** @deprecated use `BuiltPage.fontLinks` (one address per family group, with the right weights). Kept for older callers: the first Google Fonts address, or null. */
53
51
  export declare function googleFontsHref(fonts: string[]): string | null;
@@ -21,10 +21,13 @@ export { resolveFormDestination, type FormDestination, type FormDestinationConfi
21
21
  export { convertLegacyDesign, isLegacyDesign, type LegacyDesign } from '../migrate/legacy';
22
22
  export { blankPages } from '../data/blankPage';
23
23
  export { createDefaultDesignSystem, repairDesignSystem, lintDesignSystem, type DesignSystem, type DesignSystemIssue } from '../design';
24
+ export { brandStylesheet, brandComponentCss, brandDerivedVars, brandFontFamilies, onAccentColor, type BrandStylesheetOptions } from '../design';
24
25
  export { parseVideoUrl } from '../render/elements';
25
26
  export type { DocumentNode, PageDefinition, ElementStyles, ViewportMode } from '../types/editor';
26
- export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplateSections, templateSeed, getPageTemplate, isPageEmpty } from '../sections/pageTemplates';
27
- export type { PageTemplate, PageTemplateSection, PageTemplateSummary } from '../sections/pageTemplates';
27
+ export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplateSections, templateSeed, getPageTemplate, isPageTemplateId, isPageEmpty, SITE_ONLY_TEMPLATE_IDS } from '../sections/pageTemplates';
28
+ export type { PageTemplate, PageTemplateSection, PageTemplateSummary, BuildTemplateOptions } from '../sections/pageTemplates';
29
+ export { PAGE_RECIPES, SITE_PAGE_TYPES, PAGE_TYPE_DEFAULTS, recipesFor, getPageRecipe, listPageRecipes, pickRecipe, detectIndustry, detectStyle, briefHash, parseBriefColor, brandChoicesFromBrief, designSystemFromBrief, siteNavLinks, chromeContentFor, buildSitePage, suggestSitePages, fitText } from '../sections/siteKit';
30
+ export type { SiteBrief, SitePageSpec, SectionContentMap, BuildSitePageOptions, BuiltSitePage, BrandChoices, NavLink, PageRecipeSummary, PageRecipe, SiteIndustry, SitePageType, SiteStyle } from '../sections/siteKit';
28
31
  export { catalogSchema, describeDesign, describeSection, applyCommands, setPageTemplateResolver, solCommandSchema, parseSolReply, describeCommand, SOL_SYSTEM_PROMPT } from '../sol';
29
32
  export type { SolCatalog, SolDesignSummary, SolCommand, CommandResult, ApplyResult, ParsedSolReply } from '../sol';
30
33
  export { sanitizeV2Html, sanitizeCss, type SanitizeV2Options } from './sanitizeHtml';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /**
3
+ * Draws its children on top of everything (modals, pop-up menus) while staying inside the editor's own `.plexo-editor` root.
4
+ * The editor's styles and theme colours only apply inside that root, so a pop-up portalled straight into `document.body`
5
+ * would show up unstyled — no backdrop, no surface, transparent. Falls back to `document.body` only if there is no editor root.
6
+ */
7
+ export declare const EditorPortal: React.FC<{
8
+ children: React.ReactNode;
9
+ }>;
@@ -6,8 +6,9 @@ interface Props {
6
6
  onClose: () => void;
7
7
  }
8
8
  /**
9
- * "Start from a template": complete, ready-made pages to begin from, each shown as a little preview of the sections it
10
- * contains. Shared by the Pages panel (adding a page) and the empty-page card on the canvas (filling this page).
9
+ * "Add a page": start blank, or start from a ready-made design (each shown as a real preview in the site's brand). Shared by the
10
+ * Pages panel, the page picker in the top bar (adding a page) and the empty-page card on the canvas (filling this page).
11
+ * Esc or a click outside closes it.
11
12
  */
12
13
  export declare const TemplateChooser: React.FC<Props>;
13
14
  export {};
@@ -54,7 +54,10 @@ interface EditorContextType {
54
54
  marquee: MarqueeState;
55
55
  setMarquee: React.Dispatch<React.SetStateAction<MarqueeState>>;
56
56
  editingNodeId: string | null;
57
- startInlineEditing: (nodeId: string) => void;
57
+ /** Starts typing into a text element. `caret` says where the cursor goes: at a character (where it was clicked), around all of the text, or at the end (default). */
58
+ startInlineEditing: (nodeId: string, caret?: EditCaret) => void;
59
+ /** Where the cursor should go in the text that just started editing (read once, by the text element itself). */
60
+ takeEditCaret: (nodeId: string) => EditCaret | undefined;
58
61
  stopInlineEditing: () => void;
59
62
  dragState: DragDropState;
60
63
  setDragState: (state: Partial<DragDropState>) => void;
@@ -233,6 +236,10 @@ export interface EditorProviderProps {
233
236
  /** Fires (debounced) with the design system after each change. */
234
237
  onDesignSystemChange?: (designSystem: DesignSystem) => void;
235
238
  }
239
+ /** Where the cursor goes when text starts editing. */
240
+ export type EditCaret = 'end' | 'all' | {
241
+ offset: number;
242
+ };
236
243
  export declare const EditorProvider: React.FC<EditorProviderProps>;
237
244
  export declare const useEditor: () => EditorContextType;
238
245
  export {};
@@ -0,0 +1,44 @@
1
+ import type { DesignSystem, DesignToken } from './types';
2
+ /**
3
+ * The brand as ONE hosted stylesheet — the single source of truth a host serves next to its pages so a brand change reaches
4
+ * every page at once, with no recompile:
5
+ *
6
+ * - every token as a custom property on `selector` (default `:root`, specificity 0,1,0) — which beats the defaults compiled
7
+ * pages carry on `:where(:root)` (specificity 0), so the hosted sheet always wins and the compiled values are only a
8
+ * fallback for when it can't load;
9
+ * - Plexo's value-derived variables (`--plx-on-accent`: readable text on the brand's button colour), worked out here and
10
+ * not at compile time;
11
+ * - the brand's web fonts (`@import` of Google Fonts, `@font-face` for uploaded ones), so a new heading font loads too;
12
+ * - the brand's components as Plexo's own prefixed classes (`.plx-brand-button`, `.plx-brand-button--secondary`,
13
+ * `.plx-brand-card__title`), never Strata's unprefixed ones, so a customer's own `.button` is never touched;
14
+ * - optionally a dark set: token overrides applied for `prefers-color-scheme: dark` (unless the page opts out with
15
+ * `data-theme="light"`) and for `[data-theme="dark"]`.
16
+ *
17
+ * Pure and React-free: a server writes it to storage; Plexo's own dashboard can use the same function for its own brand.
18
+ * Untrusted input: keys and values that could break out of a declaration are dropped.
19
+ */
20
+ export interface BrandStylesheetOptions {
21
+ /** Where the variables go. Default `:root`. Anything else (`.plexo-app`) scopes the whole sheet to that element. */
22
+ selector?: string;
23
+ /** Token overrides for dark mode: a key→value map, a token list, or a whole design system (its tokens are used). */
24
+ dark?: Record<string, string> | DesignToken[] | Pick<DesignSystem, 'tokens'>;
25
+ /** Component classes (default true). */
26
+ components?: boolean;
27
+ /** Prefix for component classes. Default `plx-brand`. */
28
+ classPrefix?: string;
29
+ /** Load the brand's fonts from the sheet (default true). */
30
+ fonts?: boolean;
31
+ /** A comment line at the top (e.g. the revision), for whoever opens the file. Stripped of anything that could end it. */
32
+ banner?: string;
33
+ }
34
+ /** A value that can't end the declaration, open a block, fetch something or run script. */
35
+ export declare function safeBrandValue(value: unknown): string | null;
36
+ /** Text that reads on the brand's main button colour: the brand's own button text if it has enough contrast, else white or near-black. */
37
+ export declare function onAccentColor(ds: Pick<DesignSystem, 'tokens'>): string;
38
+ /** Plexo's variables that are worked out from token VALUES (so they must be recomputed whenever the brand changes). */
39
+ export declare function brandDerivedVars(ds: Pick<DesignSystem, 'tokens'>): Record<string, string>;
40
+ /** The font families (Google-loadable, not uploaded) behind the brand's font tokens. */
41
+ export declare function brandFontFamilies(ds: Pick<DesignSystem, 'tokens' | 'fonts'>): string[];
42
+ /** The brand's components as prefixed classes. */
43
+ export declare function brandComponentCss(ds: Pick<DesignSystem, 'components'>, prefix?: string, scope?: string): string;
44
+ export declare function brandStylesheet(ds: DesignSystem, opts?: BrandStylesheetOptions): string;
@@ -16,7 +16,11 @@ export declare function frameVarsFor(ds: DesignSystem, viewport: ViewportMode, u
16
16
  export declare function fontsNeeded(ds: DesignSystem, css: string): string[];
17
17
  /**
18
18
  * The design system as CSS for a published page: only the variables the page uses (a page doesn't ship Strata's whole
19
- * token set), on the page root; and text sizes that step down at tablet and phone widths. Container queries can't restyle
20
- * their own container, so the step-downs are set on the root's children and inherited from there.
19
+ * token set), and text sizes that step down at tablet and phone widths. Container queries can't restyle their own
20
+ * container, so the step-downs are set on the root's children and inherited from there.
21
+ *
22
+ * The values are DEFAULTS: they sit on `:where(:root)` (specificity 0) so a hosted brand sheet (`brandStylesheet`, on
23
+ * `:root`) always wins without a recompile — the page carries var() references, and the compiled values only show if that
24
+ * sheet can't load. (They used to sit on `.plx-page`, where they beat anything inherited from the document root.)
21
25
  */
22
- export declare function designSystemCss(ds: DesignSystem, pageCss: string): string;
26
+ export declare function designSystemCss(ds: DesignSystem, pageCss: string, scope?: 'root' | 'page'): string;
@@ -12,3 +12,4 @@ export { designSystemVars, plexoVars, frameVars, frameVarsFor, designSystemCss,
12
12
  export { componentStyle, componentVariants } from './components';
13
13
  export { lintDesignSystem, repairDesignSystem, type DesignSystemIssue, type IssueKind } from './lint';
14
14
  export { auditDesign, applyAuditFixes, linkExactValues, linkAccentsToBrand, describeAudit, suggestedDecisions, friendlyTokenName, colorDistance, AUDIT_KINDS, AUDIT_KIND_LABELS, type AuditKind, type AuditAction, type AuditFinding, type AuditReport, type AuditOptions, type AuditDecisions, type AuditMatch, type Closeness } from './audit';
15
+ export { brandStylesheet, brandComponentCss, brandDerivedVars, brandFontFamilies, onAccentColor, safeBrandValue, type BrandStylesheetOptions } from './brandSheet';
@@ -226,7 +226,8 @@ export interface V2HostConfig {
226
226
  codeView?: boolean; /** The page picker in the top bar (the Pages panel stays). Default on. */
227
227
  pageSwitcher?: boolean; /** The Design | Code switch in the top bar. Default on. */
228
228
  viewSwitch?: boolean; /** The SOL button in the top bar (SOL stays in the left rail). Default on. */
229
- headerSol?: boolean;
229
+ 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;
230
231
  };
231
232
  }
232
233
  export declare const HostProvider: React.FC<{
@@ -17,8 +17,10 @@ export * from './design';
17
17
  export type { DesignSystem } from './design/types';
18
18
  export { blankPages } from './data/blankPage';
19
19
  export { stripWorkspace, pageChildren, isWorkspaceNode, workspaceOf, ensureWorkspace, WORKSPACE_ID } from './workspace';
20
- export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplateSections, templateSeed, getPageTemplate, isPageEmpty } from './sections/pageTemplates';
21
- export type { PageTemplate, PageTemplateSection, PageTemplateSummary } from './sections/pageTemplates';
20
+ export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplateSections, templateSeed, getPageTemplate, isPageTemplateId, isPageEmpty, SITE_ONLY_TEMPLATE_IDS } from './sections/pageTemplates';
21
+ export type { PageTemplate, PageTemplateSection, PageTemplateSummary, BuildTemplateOptions } from './sections/pageTemplates';
22
+ export { PAGE_RECIPES, SITE_PAGE_TYPES, PAGE_TYPE_DEFAULTS, recipesFor, getPageRecipe, listPageRecipes, pickRecipe, detectIndustry, detectStyle, briefHash, parseBriefColor, brandChoicesFromBrief, designSystemFromBrief, siteNavLinks, chromeContentFor, buildSitePage, suggestSitePages, fitText } from './sections/siteKit';
23
+ export type { SiteBrief, SitePageSpec, SectionContentMap, BuildSitePageOptions, BuiltSitePage, BrandChoices, NavLink, PageRecipeSummary, PageRecipe, SiteIndustry, SitePageType, SiteStyle } from './sections/siteKit';
22
24
  export { catalogSchema, describeDesign, applyCommands, parseSolReply, readStreamingSolReply, describeCommand, setPageTemplateResolver, SOL_SYSTEM_PROMPT, solCommandSchema } from './sol';
23
25
  export type { SolCatalog, SolKind, SolField, SolVariant, SolDesignSummary, SolSectionSummary, SolCommand, SolCommandOp, CommandResult, ParsedSolReply, ApplyOptions, ApplyResult, PageTemplateResolver } from './sol';
24
26
  export { sanitizeV2Html, sanitizeCss } from './compile/sanitizeHtml';
@@ -0,0 +1,26 @@
1
+ import type { PageTemplateSection } from './pageTemplates';
2
+ /**
3
+ * Page recipes: several ready-made section lists for each kind of page ("home", "store", "blog"…), each with a style and
4
+ * the kinds of business it suits. A site builder (or an AI) picks the recipe that fits the brief instead of giving every
5
+ * business the same layout — a bakery's home page opens differently from a software company's.
6
+ *
7
+ * Data only (no functions, no runtime imports) so pageTemplates.ts can read it without an import cycle. siteKit.ts holds the
8
+ * logic that chooses between recipes and builds pages from them.
9
+ */
10
+ /** What a page is for. `blog` and `blogPost` are the blog's own listing and article layouts. */
11
+ export type SitePageType = 'home' | 'landing' | 'about' | 'services' | 'pricing' | 'contact' | 'store' | 'product' | 'blog' | 'blogPost' | 'faq' | 'gallery' | 'team' | 'menu' | 'testimonials';
12
+ /** The feel a recipe is designed for. */
13
+ export type SiteStyle = 'bold' | 'elegant' | 'playful' | 'minimal' | 'warm' | 'corporate' | 'dark' | 'editorial';
14
+ /** Broad kinds of business, used to pick recipes and colours. `general` fits anything. */
15
+ export type SiteIndustry = 'restaurant' | 'beauty' | 'fitness' | 'health' | 'tech' | 'creative' | 'professional' | 'retail' | 'education' | 'nonprofit' | 'realestate' | 'events' | 'travel' | 'homeservices' | 'general';
16
+ export interface PageRecipe {
17
+ id: string;
18
+ pageType: SitePageType;
19
+ name: string;
20
+ description: string;
21
+ styles: SiteStyle[];
22
+ /** The kinds of business it suits best; `general` = a safe fit for anyone. */
23
+ industries: SiteIndustry[];
24
+ sections: PageTemplateSection[];
25
+ }
26
+ export declare const PAGE_RECIPES: PageRecipe[];
@@ -21,7 +21,11 @@ export interface PageTemplate {
21
21
  sections: PageTemplateSection[];
22
22
  }
23
23
  export declare const PAGE_TEMPLATES: PageTemplate[];
24
+ /** Templates whose pages show a Plexo site's own shop, blog or products — they only work on a Plexo-hosted site, not in a React app. */
25
+ export declare const SITE_ONLY_TEMPLATE_IDS: ReadonlySet<string>;
24
26
  export declare const getPageTemplate: (id: string) => PageTemplate;
27
+ /** True for a page template id or a page recipe id. */
28
+ export declare const isPageTemplateId: (id: string) => boolean;
25
29
  /** What to show on a template card: name, one line, and the section names as a little preview strip. */
26
30
  export interface PageTemplateSummary {
27
31
  id: string;
@@ -36,11 +40,23 @@ export declare function listPageTemplates(): PageTemplateSummary[];
36
40
  * the same request always yields the same page (safe to retry on the server).
37
41
  */
38
42
  export declare const templateSeed: (templateId: string) => string;
39
- /** The sections of a template as ready-built nodes (menu and footer included), ids derived from `seed`. */
40
- export declare function buildTemplateSections(templateId: string, opts?: {
43
+ export interface BuildTemplateOptions {
41
44
  seed?: string;
42
45
  designSystem?: DesignSystem;
43
- }): DocumentNode[];
46
+ /** False leaves out the menu and footer (a site with a shared header/footer brings its own). Default true. */
47
+ chrome?: boolean;
48
+ /** The site's name for the menu and footer (default: the design system's name). */
49
+ brand?: string;
50
+ /** Overrides for the menu (kind `header`) and footer (kind `footer`) content, e.g. the site's real page links. */
51
+ chromeContent?: {
52
+ header?: Record<string, unknown>;
53
+ footer?: Record<string, unknown>;
54
+ };
55
+ /** Replaces the template's own section list (an AI or a site plan choosing its own sections). */
56
+ sections?: PageTemplateSection[];
57
+ }
58
+ /** The sections of a template as ready-built nodes (menu and footer included), ids derived from `seed`. */
59
+ export declare function buildTemplateSections(templateId: string, opts?: BuildTemplateOptions): DocumentNode[];
44
60
  /** True when a page has nothing on it yet (no sections, or only the empty placeholder section a new page starts with). */
45
61
  export declare function isPageEmpty(root: DocumentNode): boolean;
46
62
  /** A full page from a template. Pass `seed` to make its ids unique among a site's pages (see templateSeed). */
@@ -49,4 +65,4 @@ export declare function buildPageFromTemplate(templateId: string, opts: {
49
65
  designSystem?: DesignSystem;
50
66
  seed?: string;
51
67
  slug?: string;
52
- }): PageDefinition;
68
+ } & Omit<BuildTemplateOptions, 'seed' | 'designSystem'>): PageDefinition;
@@ -0,0 +1,144 @@
1
+ import type { PageDefinition } from '../types/editor';
2
+ import type { DesignSystem } from '../design/types';
3
+ import { type NeutralScale, type Roundness } from '../design/themes';
4
+ import { type PageRecipe, type SiteIndustry, type SitePageType, type SiteStyle } from './pageRecipes';
5
+ import { type PageTemplateSection } from './pageTemplates';
6
+ /**
7
+ * Site kit: turns a short brief ("a cosy bakery in Lagos called Crumbs, warm and friendly, sells cakes online") into a
8
+ * fitting brand and a set of fitting pages — the same building blocks the editor uses, so everything stays editable.
9
+ * Pure and React-free (servers and AIs call it). Nothing here is random: the same brief always gives the same site, and
10
+ * different briefs give genuinely different sites (layouts, colours, fonts, corners).
11
+ */
12
+ export type { SiteIndustry, SitePageType, SiteStyle, PageRecipe } from './pageRecipes';
13
+ export { PAGE_RECIPES } from './pageRecipes';
14
+ export interface SiteBrief {
15
+ /** The business's name. */
16
+ name?: string;
17
+ /** What they do, who for — a sentence or two. Used for opening copy and the footer. */
18
+ about?: string;
19
+ /** A short promise for the opening headline. */
20
+ tagline?: string;
21
+ /** Free text ("bakery", "law firm") or one of the SiteIndustry ids. */
22
+ industry?: string;
23
+ /** Free text ("warm and friendly", "luxury", "bold") or one of the SiteStyle ids. */
24
+ tone?: string;
25
+ /** Brand colours, most important first (hex like #1D4ED8, or a plain colour name like "navy"). */
26
+ colors?: string[];
27
+ fonts?: {
28
+ heading?: string;
29
+ body?: string;
30
+ };
31
+ logoUrl?: string;
32
+ contact?: {
33
+ email?: string;
34
+ phone?: string;
35
+ address?: string;
36
+ hours?: string;
37
+ };
38
+ socials?: Array<{
39
+ network: string;
40
+ url: string;
41
+ }>;
42
+ }
43
+ /** The kind of business a brief describes (its industry field first, then what it says about itself). */
44
+ export declare function detectIndustry(brief?: Pick<SiteBrief, 'industry' | 'about' | 'name'>): SiteIndustry;
45
+ /** The feel a brief asks for (its tone, else what suits its industry). */
46
+ export declare function detectStyle(brief?: Pick<SiteBrief, 'tone' | 'industry' | 'about' | 'name'>): SiteStyle;
47
+ /** A small, stable number from text — the tie-breaker that keeps two different businesses from getting identical sites. */
48
+ export declare function briefHash(text: string): number;
49
+ export interface PageRecipeSummary {
50
+ id: string;
51
+ pageType: SitePageType;
52
+ name: string;
53
+ description: string;
54
+ styles: SiteStyle[];
55
+ industries: SiteIndustry[];
56
+ sections: string[];
57
+ }
58
+ export declare const recipesFor: (pageType: SitePageType) => PageRecipe[];
59
+ export declare const getPageRecipe: (id: string) => PageRecipe | undefined;
60
+ export declare const SITE_PAGE_TYPES: SitePageType[];
61
+ export declare function listPageRecipes(pageType?: SitePageType): PageRecipeSummary[];
62
+ /**
63
+ * The recipe that best fits a page type for this brief: its industry counts most, then its style; ties go to a choice
64
+ * that depends on the business's name, so two businesses of the same kind still get different layouts.
65
+ */
66
+ export declare function pickRecipe(pageType: SitePageType, brief?: SiteBrief): PageRecipe;
67
+ /** A colour from a brief: a hex, or a plain colour name. Null when it can't be used. */
68
+ export declare function parseBriefColor(raw: string): string | null;
69
+ export interface BrandChoices {
70
+ industry: SiteIndustry;
71
+ style: SiteStyle;
72
+ primary: string;
73
+ secondary: string;
74
+ neutrals: NeutralScale;
75
+ roundness: Roundness;
76
+ headingFont: string;
77
+ bodyFont: string;
78
+ }
79
+ /** The brand decisions for a brief, before they become a design system (handy to show or explain). */
80
+ export declare function brandChoicesFromBrief(brief?: SiteBrief): BrandChoices;
81
+ /** A whole brand (colours, background feel, corners, fonts) chosen for the brief — not the default blue. */
82
+ export declare function designSystemFromBrief(brief?: SiteBrief, base?: DesignSystem): {
83
+ designSystem: DesignSystem;
84
+ choices: BrandChoices;
85
+ };
86
+ export interface NavLink {
87
+ label: string;
88
+ href: string;
89
+ }
90
+ /** Where each kind of page lives and what it is called by default. */
91
+ export declare const PAGE_TYPE_DEFAULTS: Record<SitePageType, {
92
+ name: string;
93
+ slug: string;
94
+ nav: boolean;
95
+ }>;
96
+ /** Menu links from a site's real pages: home first, contact last, at most `max`. */
97
+ export declare function siteNavLinks(pages: Array<{
98
+ name: string;
99
+ path: string;
100
+ }>, max?: number): NavLink[];
101
+ /** Shortens text to fit a field: at a sentence end if one fits, else at a word. */
102
+ export declare function fitText(text: string, max?: number): string;
103
+ /** Content per kind ("hero", "features"…), or per occurrence ("hero#2" for a page's second hero). */
104
+ export type SectionContentMap = Record<string, Record<string, unknown>>;
105
+ export interface SitePageSpec {
106
+ pageType: SitePageType;
107
+ name?: string;
108
+ slug?: string;
109
+ /** A specific recipe id; otherwise the best fit for the brief. */
110
+ recipeId?: string;
111
+ /** Replaces the recipe's sections entirely ({kind, variant?, content?, background?}). */
112
+ sections?: PageTemplateSection[];
113
+ /** The business's own words, merged over the recipe's starting words. */
114
+ content?: SectionContentMap;
115
+ }
116
+ export interface BuildSitePageOptions {
117
+ brief?: SiteBrief;
118
+ designSystem?: DesignSystem;
119
+ seed?: string;
120
+ /** Whether the page brings its own menu and footer (false when the site shares one). Default true. */
121
+ chrome?: boolean;
122
+ /** The site's menu links (for the page's own menu/footer). */
123
+ nav?: NavLink[];
124
+ /** The menu's button, e.g. { label: "Shop now", href: "/store" }. */
125
+ navCta?: NavLink;
126
+ }
127
+ export interface BuiltSitePage {
128
+ page: PageDefinition;
129
+ recipeId: string;
130
+ warnings: string[];
131
+ }
132
+ /** Menu and footer content for a site from its brief and its menu links. */
133
+ export declare function chromeContentFor(brief?: SiteBrief, nav?: NavLink[], navCta?: NavLink): {
134
+ header: Record<string, unknown>;
135
+ footer: Record<string, unknown>;
136
+ };
137
+ /**
138
+ * A finished page for a site: the recipe that fits (or the one asked for), the brand, the site's menu and footer (unless
139
+ * the site shares them), anything the brief says filled in, then the business's own words on top. Invalid content is
140
+ * dropped with a plain-English warning instead of failing the page.
141
+ */
142
+ export declare function buildSitePage(spec: SitePageSpec, opts?: BuildSitePageOptions): BuiltSitePage;
143
+ /** Which pages suit a goal, when the owner hasn't said. */
144
+ export declare function suggestSitePages(goal: string | undefined, brief?: SiteBrief): SitePageType[];
@@ -42,6 +42,12 @@ export interface BlockSpec {
42
42
  style?: BlockStyle;
43
43
  /** Per-element tweaks, keyed by the element's slot (its id without the section prefix). */
44
44
  overrides?: Record<string, NodeOverride>;
45
+ /**
46
+ * Slots of text the owner emptied by typing on the page. Empty text is normally not drawn at all; these stay in the
47
+ * editor (as a "Type something…" placeholder) so the element and its section never vanish under the cursor. Only an
48
+ * explicit delete removes them, and the published page leaves empty text out.
49
+ */
50
+ kept?: string[];
45
51
  }
46
52
  /** What a person edits. Drives the content form, validation, and the schema an AI works against. */
47
53
  export type FieldType = 'text' | 'longtext' | 'image' | 'link' | 'button' | 'icon' | 'toggle' | 'select' | 'list' | 'product';
@@ -67,6 +73,8 @@ export interface BuildCtx {
67
73
  style: Required<Pick<BlockStyle, 'align' | 'spacing'>> & BlockStyle;
68
74
  /** The colours text should use on this section's background. */
69
75
  tone: Tone;
76
+ /** True for an element slot (e.g. `headline`, `items-2-title`) the owner emptied on the page: it is drawn even when empty. */
77
+ keepEmpty?: (slot: string) => boolean;
70
78
  }
71
79
  export interface Tone {
72
80
  heading: string;
@@ -1,5 +1,6 @@
1
1
  import type { DocumentNode, PageDefinition } from '../types/editor';
2
2
  import type { DesignSystem } from '../design/types';
3
+ import type { BlockSpec } from '../sections/types';
3
4
  import { type CommandResult } from './schema';
4
5
  export type { CommandResult, SolCommand } from './schema';
5
6
  /** Builds the starting sections for a named page template, or null if there is no such template. */
@@ -14,6 +15,8 @@ export interface ApplyResult {
14
15
  designSystem: DesignSystem;
15
16
  results: CommandResult[];
16
17
  }
18
+ /** Checks a content patch (keys may be paths like `items.0.title`) against a kind's fields. Returns a plain-English problem, or null. */
19
+ export declare function checkContent(kind: BlockSpec['kind'], patch: Record<string, unknown>): string | null;
17
20
  /** Exported for the commands' plain-language summary. */
18
21
  export declare function elementLabel(pages: PageDefinition[], nodeId: string): {
19
22
  label: string;
@@ -1,12 +1,12 @@
1
- import { A as e, An as t, At as n, C as r, Dn as i, E as a, Fn as o, Ft as ee, Ln as te, Mn as s, Mt as c, N as l, Nn as u, Nt as d, On as f, Ot as p, P as m, Pn as h, Pt as g, Tn as _, _ as v, a as y, c as b, ct as x, d as S, dt as C, f as w, g as T, gn as E, h as D, hn as O, i as k, it as A, j as ne, jn as j, jt as M, kt as N, l as P, lt as F, m as I, n as L, nt as R, o as z, ot as B, p as V, r as H, rt as U, s as W, st as G, t as K, u as q, ut as J, v as Y } from "./v1-CvbzlaB_.js";
2
- import { a as X, i as Z } from "./brandGuide-DgoZ7spo.js";
1
+ import { $n as e, $t as t, A as n, At as r, C as i, Ct as ee, D as a, Dt as te, E as ne, Et as o, G as s, Hn as c, M as l, Mt as u, Nt as d, O as f, Pt as p, Qt as m, S as h, St as g, T as _, Tt as v, U as y, Vn as b, W as x, Zn as S, Zt as C, _ as w, a as T, an as E, ar as D, at as O, b as k, bt as A, c as j, ct as M, d as N, dt as P, en as F, er as I, f as L, g as R, h as z, i as B, in as V, ir as H, it as U, j as W, jt as G, k as re, kt as K, l as q, lr as J, m as Y, n as X, nn as ie, nr as ae, nt as oe, o as se, on as ce, or as le, p as ue, r as de, rn as fe, rr as pe, rt as me, s as he, sn as ge, sr as _e, t as ve, tn as ye, tt as be, u as xe, v as Se, w as Z, x as Ce, y as we, yt as Te } from "./v1-Cz7qypQd.js";
2
+ import { a as Ee, i as De } from "./brandGuide-DgoZ7spo.js";
3
3
  //#region src/v2/compile/react.ts
4
- var re = /^[A-Z][A-Za-z0-9]*$/, Q = (e) => JSON.stringify(e);
5
- function ie(e) {
4
+ var Oe = /^[A-Z][A-Za-z0-9]*$/, Q = (e) => JSON.stringify(e);
5
+ function ke(e) {
6
6
  let t = "";
7
7
  for (let [n, r] of Object.entries(e.attrs ?? {})) {
8
8
  if (r === void 0 || r === !1) continue;
9
- let e = E(n);
9
+ let e = c(n);
10
10
  r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${Q(String(r))}}`;
11
11
  }
12
12
  return e.style && (t += ` style={${JSON.stringify(e.style)}}`), t;
@@ -14,23 +14,23 @@ function ie(e) {
14
14
  function $(e, t) {
15
15
  let n = " ".repeat(t);
16
16
  if (typeof e == "string") return `${n}{${Q(e)}}`;
17
- let r = ie(e);
18
- return O.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}>`;
17
+ let r = ke(e);
18
+ return b.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
19
  }
20
- function ae(e) {
20
+ function Ae(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("");
22
22
  return /^[A-Z]/.test(t) ? t : `Design${t}`;
23
23
  }
24
- function oe(e, t) {
25
- if (!re.test(t.componentName)) throw Error(`"${t.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
26
- let n = Y(e, t), r = t.runtime !== "none" && n.usesRuntime, i = n.fontLinks, a = "`" + n.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
24
+ function je(e, t) {
25
+ if (!Oe.test(t.componentName)) throw Error(`"${t.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
26
+ let n = s(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
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 = ${m};\n` : ""}
33
+ ${i.length ? `const FONTS: string[] = ${JSON.stringify(i)};\n` : ""}${r ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${ee};\n` : ""}
34
34
  export default function ${t.componentName}()${r ? "" : ": ReactElement"} {
35
35
  ${r ? " const root = useRef<HTMLDivElement>(null);\n useEffect(() => (root.current ? plexoInit(root.current) : undefined), []);\n" : ""} return (
36
36
  <>
@@ -44,4 +44,4 @@ ${r ? $(n.tree, 3).replace("<div", "<div ref={root}") : $(n.tree, 3)}
44
44
  };
45
45
  }
46
46
  //#endregion
47
- export { I as EMAIL_WIDTH, h as FRAME_WIDTH, e as MAX_CUSTOM_JS, k as MAX_DEPTH, y as MAX_NODES, o as MEDIA_QUERY, N as PAGE_TEMPLATES, R as SOL_SYSTEM_PROMPT, K as V1_DYNAMIC_EQUIVALENTS, L as V2_DYNAMIC_READY, i as WORKSPACE_ID, B as applyCommands, S as blankEmailPages, F as blankPages, n as buildPageFromTemplate, M as buildTemplateSections, p as catalogSchema, V as compilePageToEmail, T as compilePageToHtml, oe as compilePageToReact, ae as componentNameFor, _ as computePlacements, P as convertLegacyDesign, H as convertV1Design, te as createDefaultDesignSystem, U as describeCommand, J as describeDesign, C as describeSection, D as emailIssues, f as ensureWorkspace, c as getPageTemplate, q as isLegacyDesign, d as isPageEmpty, t as isWorkspaceNode, Z as lintDesignSystem, g as listPageTemplates, j as pageChildren, z as parsePages, A as parseSolReply, a as parseVideoUrl, ne as prepareCustomJs, v as printHtml, X as repairDesignSystem, r as resolveFormDestination, W as sanitizeCss, b as sanitizeV2Html, G as setPageTemplateResolver, x as solCommandSchema, w as starterEmailPages, s as stripWorkspace, ee as templateSeed, l as validHtmlId, u as workspaceOf };
47
+ export { W as EMAIL_WIDTH, le as FRAME_WIDTH, Te as MAX_CUSTOM_JS, B as MAX_DEPTH, T as MAX_NODES, _e as MEDIA_QUERY, ge as PAGE_RECIPES, m as PAGE_TEMPLATES, q as PAGE_TYPE_DEFAULTS, t as SITE_ONLY_TEMPLATE_IDS, xe as SITE_PAGE_TYPES, v as SOL_SYSTEM_PROMPT, ve as V1_DYNAMIC_EQUIVALENTS, X as V2_DYNAMIC_READY, e as WORKSPACE_ID, K as applyCommands, f as blankEmailPages, u as blankPages, N as brandChoicesFromBrief, be as brandComponentCss, oe as brandDerivedVars, me as brandFontFamilies, U as brandStylesheet, L as briefHash, F as buildPageFromTemplate, ue as buildSitePage, ye as buildTemplateSections, C as catalogSchema, Y as chromeContentFor, n as compilePageToEmail, y as compilePageToHtml, je as compilePageToReact, Ae as componentNameFor, S as computePlacements, ne as convertLegacyDesign, de as convertV1Design, J as createDefaultDesignSystem, o as describeCommand, d as describeDesign, p as describeSection, z as designSystemFromBrief, R as detectIndustry, w as detectStyle, l as emailIssues, I as ensureWorkspace, Se as fitText, we as getPageRecipe, ie as getPageTemplate, a as isLegacyDesign, fe as isPageEmpty, V as isPageTemplateId, ae as isWorkspaceNode, De as lintDesignSystem, k as listPageRecipes, E as listPageTemplates, O as onAccentColor, pe as pageChildren, Ce as parseBriefColor, se as parsePages, te as parseSolReply, P as parseVideoUrl, h as pickRecipe, A as prepareCustomJs, x as printHtml, i as recipesFor, Ee as repairDesignSystem, M as resolveFormDestination, he as sanitizeCss, j as sanitizeV2Html, r as setPageTemplateResolver, Z as siteNavLinks, G as solCommandSchema, re as starterEmailPages, H as stripWorkspace, _ as suggestSitePages, ce as templateSeed, g as validHtmlId, D as workspaceOf };