@charisol/plexo-sdk 1.4.41 → 2.0.1
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 +72 -0
- package/dist/InlineColorPicker-8ewm1Asx.js +2912 -0
- package/dist/client-DlVJt_6V.js +339 -0
- package/dist/colorUtils-ohNG3v1i.js +222 -0
- package/dist/columnOrder-f5-VOg2T.js +11 -0
- package/dist/{compiler-BvseEhDC.js → compiler-Dhpsq71h.js} +121 -120
- package/dist/compiler.js +1 -1
- package/dist/{compilerClient-BIrZIgfG.js → compilerClient-BC4TGAr9.js} +93 -92
- package/dist/compilerClient.js +1 -1
- package/dist/components/SolMark.d.ts +8 -0
- package/dist/{iconSvgStatic-CGue7nyp.js → iconSvgStatic-Lnpg27U9.js} +66 -75
- package/dist/index.js +13129 -14500
- package/dist/legacy-71dHsiAM.js +16088 -0
- package/dist/lint-D-2x-Yeb.js +225 -0
- package/dist/{mjmlBrowser-DWk0mRD6.js → mjmlBrowser-wlHcAT8n.js} +2 -2
- package/dist/plexo-sdk.css +1 -1
- package/dist/rolldown-runtime-B1bRi_D7.js +27 -0
- package/dist/sanitize.js +1 -1
- package/dist/{sanitizeCompiledHtml-CNjUXlMK.js → sanitizeCompiledHtml-GgGsetm3.js} +673 -698
- package/dist/{zoom-in-DL4pfiLG.js → schemas-Bq5o5MfF.js} +916 -2120
- package/dist/utilities/aiHelper.d.ts +4 -0
- package/dist/utilities/colorUtils.d.ts +35 -0
- package/dist/utilities/playground.interfaces.d.ts +24 -1
- package/dist/v2/V2Editor.d.ts +25 -0
- package/dist/v2/compile/build.d.ts +38 -0
- package/dist/v2/compile/html.d.ts +18 -0
- package/dist/v2/compile/index.d.ts +28 -15
- package/dist/v2/compile/react.d.ts +17 -0
- package/dist/v2/compile/schema.d.ts +16 -0
- package/dist/v2/components/canvas/AlignmentGuidesOverlay.d.ts +7 -0
- package/dist/v2/components/canvas/CanvasArea.d.ts +2 -0
- package/dist/v2/components/canvas/CanvasControls.d.ts +2 -0
- package/dist/v2/components/canvas/ContextualToolbar.d.ts +7 -0
- package/dist/v2/components/canvas/DropIndicator.d.ts +6 -0
- package/dist/v2/components/canvas/IrView.d.ts +12 -0
- package/dist/v2/components/canvas/NodeRenderer.d.ts +12 -0
- package/dist/v2/components/canvas/PageFrame.d.ts +9 -0
- package/dist/v2/components/canvas/ResizeHandles.d.ts +8 -0
- package/dist/v2/components/canvas/SectionToolbar.d.ts +6 -0
- package/dist/v2/components/canvas/SpacingOverlay.d.ts +7 -0
- package/dist/v2/components/design/AutoUpdateWatcher.d.ts +7 -0
- package/dist/v2/components/design/DesignSystemPanel.d.ts +7 -0
- package/dist/v2/components/design/ReviewView.d.ts +7 -0
- package/dist/v2/components/design/StrataCard.d.ts +8 -0
- package/dist/v2/components/design/TidyView.d.ts +15 -0
- package/dist/v2/components/design/bits.d.ts +20 -0
- package/dist/v2/components/design/useStrataSync.d.ts +51 -0
- package/dist/v2/components/layout/ContextMenu.d.ts +2 -0
- package/dist/v2/components/layout/EditorShell.d.ts +2 -0
- package/dist/v2/components/layout/LeftToolRail.d.ts +2 -0
- package/dist/v2/components/layout/PreviewOverlay.d.ts +6 -0
- package/dist/v2/components/layout/TopToolbar.d.ts +2 -0
- package/dist/v2/components/modals/SettingsModal.d.ts +7 -0
- package/dist/v2/components/modals/ShortcutsModal.d.ts +7 -0
- package/dist/v2/components/properties/ColorField.d.ts +14 -0
- package/dist/v2/components/properties/ElementSettings.d.ts +39 -0
- package/dist/v2/components/properties/LinkField.d.ts +26 -0
- package/dist/v2/components/properties/PageInspector.d.ts +2 -0
- package/dist/v2/components/properties/PropertiesPanel.d.ts +2 -0
- package/dist/v2/components/properties/SectionSettings.d.ts +6 -0
- package/dist/v2/components/properties/sections/ConstraintsSection.d.ts +7 -0
- package/dist/v2/components/properties/sections/LayoutDiagnostics.d.ts +7 -0
- package/dist/v2/components/sections/BlockInspector.d.ts +9 -0
- package/dist/v2/components/sections/FieldForm.d.ts +14 -0
- package/dist/v2/components/sections/ManagedChildNotice.d.ts +7 -0
- package/dist/v2/components/sections/SectionThumb.d.ts +11 -0
- package/dist/v2/components/sidebar/FlyoutDrawer.d.ts +2 -0
- package/dist/v2/components/sidebar/InsertPanel.d.ts +2 -0
- package/dist/v2/components/sidebar/LayersPanel.d.ts +2 -0
- package/dist/v2/components/sidebar/LibraryPanel.d.ts +3 -0
- package/dist/v2/components/sidebar/PagesPanel.d.ts +2 -0
- package/dist/v2/components/sidebar/SectionsPanel.d.ts +6 -0
- package/dist/v2/components/sidebar/SolPanel.d.ts +3 -0
- package/dist/v2/components/sidebar/TemplateChooser.d.ts +13 -0
- package/dist/v2/context/BlockContext.d.ts +7 -0
- package/dist/v2/context/EditorContext.d.ts +213 -0
- package/dist/v2/context/FrameContext.d.ts +3 -0
- package/dist/v2/context/ParentLayoutContext.d.ts +10 -0
- package/dist/v2/context/PlacementContext.d.ts +4 -0
- package/dist/v2/data/blankPage.d.ts +3 -0
- package/dist/v2/data/insertableComponents.d.ts +17 -0
- package/dist/v2/data/samplePageData.d.ts +3 -0
- package/dist/v2/design/audit.d.ts +78 -0
- package/dist/v2/design/baseline.d.ts +3 -0
- package/dist/v2/design/baselineData.d.ts +3 -0
- package/dist/v2/design/components.d.ts +9 -0
- package/dist/v2/design/css.d.ts +16 -0
- package/dist/v2/design/fonts.d.ts +10 -0
- package/dist/v2/design/index.d.ts +11 -0
- package/dist/v2/design/lint.d.ts +22 -0
- package/dist/v2/design/shades.d.ts +15 -0
- package/dist/v2/design/textStyles.d.ts +29 -0
- package/dist/v2/design/themes.d.ts +35 -0
- package/dist/v2/design/tokens.d.ts +24 -0
- package/dist/v2/design/types.d.ts +81 -0
- package/dist/v2/host/HostContext.d.ts +176 -0
- package/dist/v2/host/SolMark.d.ts +8 -0
- package/dist/v2/index.d.ts +19 -10
- package/dist/v2/migrate/legacy.d.ts +26 -0
- package/dist/v2/render/adapt.d.ts +12 -0
- package/dist/v2/render/anchors.d.ts +7 -0
- package/dist/v2/render/elementCss.d.ts +7 -0
- package/dist/v2/render/elementProps.d.ts +92 -0
- package/dist/v2/render/elements.d.ts +32 -0
- package/dist/v2/render/formAction.d.ts +33 -0
- package/dist/v2/render/frames.d.ts +10 -0
- package/dist/v2/render/iconSet.d.ts +5 -0
- package/dist/v2/render/ir.d.ts +20 -0
- package/dist/v2/render/nodeStyle.d.ts +24 -0
- package/dist/v2/render/placement.d.ts +12 -0
- package/dist/v2/render/resolve.d.ts +3 -0
- package/dist/v2/render/runtime.d.ts +18 -0
- package/dist/v2/render/sanitize.d.ts +15 -0
- package/dist/v2/render/socialIcons.d.ts +83 -0
- package/dist/v2/sections/catalog/about.d.ts +2 -0
- package/dist/v2/sections/catalog/announcement.d.ts +2 -0
- package/dist/v2/sections/catalog/contact.d.ts +2 -0
- package/dist/v2/sections/catalog/cta.d.ts +2 -0
- package/dist/v2/sections/catalog/faq.d.ts +2 -0
- package/dist/v2/sections/catalog/features.d.ts +2 -0
- package/dist/v2/sections/catalog/footer.d.ts +5 -0
- package/dist/v2/sections/catalog/gallery.d.ts +2 -0
- package/dist/v2/sections/catalog/header.d.ts +2 -0
- package/dist/v2/sections/catalog/hero.d.ts +2 -0
- package/dist/v2/sections/catalog/logos.d.ts +2 -0
- package/dist/v2/sections/catalog/pricing.d.ts +2 -0
- package/dist/v2/sections/catalog/stats.d.ts +2 -0
- package/dist/v2/sections/catalog/steps.d.ts +2 -0
- package/dist/v2/sections/catalog/team.d.ts +2 -0
- package/dist/v2/sections/catalog/testimonials.d.ts +2 -0
- package/dist/v2/sections/catalog/video.d.ts +2 -0
- package/dist/v2/sections/kit.d.ts +64 -0
- package/dist/v2/sections/materialize.d.ts +72 -0
- package/dist/v2/sections/pageTemplates.d.ts +52 -0
- package/dist/v2/sections/registry.d.ts +5 -0
- package/dist/v2/sections/types.d.ts +103 -0
- package/dist/v2/sol/catalogSchema.d.ts +43 -0
- package/dist/v2/sol/commands.d.ts +21 -0
- package/dist/v2/sol/describe.d.ts +32 -0
- package/dist/v2/sol/index.d.ts +7 -0
- package/dist/v2/sol/parse.d.ts +10 -0
- package/dist/v2/sol/prompt.d.ts +5 -0
- package/dist/v2/sol/schema.d.ts +177 -0
- package/dist/v2/sol/summarize.d.ts +4 -0
- package/dist/v2/strata/autoUpdate.d.ts +37 -0
- package/dist/v2/strata/client.d.ts +38 -0
- package/dist/v2/strata/index.d.ts +8 -0
- package/dist/v2/strata/merge.d.ts +27 -0
- package/dist/v2/strata/types.d.ts +115 -0
- package/dist/v2/types/editor.d.ts +175 -0
- package/dist/v2/utils/css.d.ts +3 -0
- package/dist/v2/utils/id.d.ts +3 -0
- package/dist/v2-compile.js +138 -7
- package/dist/v2-strata.js +2 -0
- package/dist/v2.js +10979 -8145
- package/package.json +6 -1
- package/dist/toReact-BBzjWoFG.js +0 -595
- package/dist/v2/ai/commands.d.ts +0 -616
- package/dist/v2/ai/dispatch.d.ts +0 -24
- package/dist/v2/ai/nodeSchema.d.ts +0 -196
- package/dist/v2/brand/BrandColorSwatches.d.ts +0 -4
- package/dist/v2/brand/BrandPanel.d.ts +0 -4
- package/dist/v2/brand/ChangeSetGallery.d.ts +0 -10
- package/dist/v2/brand/StyleSetEditor.d.ts +0 -22
- package/dist/v2/canvas/CatalogDragContext.d.ts +0 -27
- package/dist/v2/canvas/ContextMenuContext.d.ts +0 -16
- package/dist/v2/canvas/DeviceModeContext.d.ts +0 -20
- package/dist/v2/canvas/DragEngineContext.d.ts +0 -13
- package/dist/v2/canvas/LayoutGuideContext.d.ts +0 -22
- package/dist/v2/canvas/PreviewModeContext.d.ts +0 -15
- package/dist/v2/canvas/SidebarContext.d.ts +0 -21
- package/dist/v2/canvas/StylePainterContext.d.ts +0 -19
- package/dist/v2/canvas/WorkspaceThemeContext.d.ts +0 -19
- package/dist/v2/canvas/aiTextTransforms.d.ts +0 -24
- package/dist/v2/canvas/animationPresets.d.ts +0 -12
- package/dist/v2/canvas/constants.d.ts +0 -6
- package/dist/v2/canvas/layoutRoles.d.ts +0 -12
- package/dist/v2/canvas/modelRect.d.ts +0 -4
- package/dist/v2/canvas/rectMath.d.ts +0 -34
- package/dist/v2/canvas/reorderMath.d.ts +0 -8
- package/dist/v2/canvas/resizeMath.d.ts +0 -16
- package/dist/v2/canvas/resolveBoxStyle.d.ts +0 -12
- package/dist/v2/canvas/resolveTargetSection.d.ts +0 -10
- package/dist/v2/canvas/sectionDividerShapes.d.ts +0 -12
- package/dist/v2/canvas/snapping.d.ts +0 -28
- package/dist/v2/canvas/useAlignNode.d.ts +0 -10
- package/dist/v2/canvas/useClipboardKeyBinding.d.ts +0 -7
- package/dist/v2/canvas/useDeleteKeyBinding.d.ts +0 -3
- package/dist/v2/canvas/useDragEngine.d.ts +0 -44
- package/dist/v2/canvas/useDraggableNode.d.ts +0 -30
- package/dist/v2/canvas/useInlineTextEdit.d.ts +0 -29
- package/dist/v2/canvas/usePointerEngine.d.ts +0 -22
- package/dist/v2/canvas/useResizeHandle.d.ts +0 -12
- package/dist/v2/canvas/useResolvedTextStyles.d.ts +0 -13
- package/dist/v2/canvas/useSelectionRects.d.ts +0 -13
- package/dist/v2/canvas/useUndoRedoKeyBinding.d.ts +0 -8
- package/dist/v2/catalog/elementCatalog.d.ts +0 -31
- package/dist/v2/catalog/imagePreset.d.ts +0 -7
- package/dist/v2/compile/toReact.d.ts +0 -32
- package/dist/v2/components/AdornmentLayer.d.ts +0 -20
- package/dist/v2/components/AskSolPanel.d.ts +0 -19
- package/dist/v2/components/CatalogDragGhost.d.ts +0 -6
- package/dist/v2/components/CellBoundary.d.ts +0 -14
- package/dist/v2/components/CenterCanvas.d.ts +0 -3
- package/dist/v2/components/ContentTabPanel.d.ts +0 -12
- package/dist/v2/components/ContextMenu.d.ts +0 -5
- package/dist/v2/components/ContextualToolbar.d.ts +0 -25
- package/dist/v2/components/ImagesTabPanel.d.ts +0 -15
- package/dist/v2/components/LayoutGuidePanel.d.ts +0 -10
- package/dist/v2/components/ManageLayersPanel.d.ts +0 -13
- package/dist/v2/components/NodeRenderer.d.ts +0 -8
- package/dist/v2/components/PreviewOverlay.d.ts +0 -11
- package/dist/v2/components/ResizeHandle.d.ts +0 -6
- package/dist/v2/components/RightRail.d.ts +0 -13
- package/dist/v2/components/SectionDividerOverlay.d.ts +0 -8
- package/dist/v2/components/SectionEdgeAddZone.d.ts +0 -17
- package/dist/v2/components/SectionGridOverlay.d.ts +0 -10
- package/dist/v2/components/SectionNamePill.d.ts +0 -6
- package/dist/v2/components/SectionNode.d.ts +0 -5
- package/dist/v2/components/SectionSideRail.d.ts +0 -17
- package/dist/v2/components/SelectionToolbar.d.ts +0 -11
- package/dist/v2/components/StylePainterToast.d.ts +0 -5
- package/dist/v2/components/V2Canvas.d.ts +0 -56
- package/dist/v2/components/nodes/ButtonNode.d.ts +0 -4
- package/dist/v2/components/nodes/ContainerNode.d.ts +0 -11
- package/dist/v2/components/nodes/EmbedNode.d.ts +0 -4
- package/dist/v2/components/nodes/ImageNode.d.ts +0 -4
- package/dist/v2/components/nodes/InputNode.d.ts +0 -4
- package/dist/v2/components/nodes/MenuNode.d.ts +0 -18
- package/dist/v2/components/nodes/TextNode.d.ts +0 -4
- package/dist/v2/inspector/AiQuickEditPanel.d.ts +0 -12
- package/dist/v2/inspector/AnimationPanel.d.ts +0 -11
- package/dist/v2/inspector/DesignAccordions.d.ts +0 -7
- package/dist/v2/inspector/FieldRenderer.d.ts +0 -9
- package/dist/v2/inspector/IconPopoverButton.d.ts +0 -9
- package/dist/v2/inspector/MenuIconPanel.d.ts +0 -7
- package/dist/v2/inspector/MenuManagePanel.d.ts +0 -8
- package/dist/v2/inspector/Popover.d.ts +0 -21
- package/dist/v2/inspector/SectionDividerPanel.d.ts +0 -9
- package/dist/v2/inspector/fieldStyles.d.ts +0 -15
- package/dist/v2/inspector/fields/ColorField.d.ts +0 -7
- package/dist/v2/inspector/fields/NumberField.d.ts +0 -7
- package/dist/v2/inspector/fields/SelectField.d.ts +0 -7
- package/dist/v2/inspector/fields/TextField.d.ts +0 -7
- package/dist/v2/inspector/fields/TextStyleField.d.ts +0 -11
- package/dist/v2/inspector/fields/TextareaField.d.ts +0 -7
- package/dist/v2/inspector/schema.d.ts +0 -25
- package/dist/v2/inspector/useFieldCommit.d.ts +0 -12
- package/dist/v2/store/brandDefaults.d.ts +0 -4
- package/dist/v2/store/brandTypes.d.ts +0 -40
- package/dist/v2/store/cloneSubtree.d.ts +0 -12
- package/dist/v2/store/createBrandStore.d.ts +0 -2
- package/dist/v2/store/createCanvasStore.d.ts +0 -2
- package/dist/v2/store/seed.d.ts +0 -17
- package/dist/v2/store/types.d.ts +0 -163
- package/dist/v2/ui/theme.d.ts +0 -85
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DesignSystem, DesignToken } from './types';
|
|
2
|
+
/** The CSS value of a token, following Strata's own rule: a unit is added to a plain number, never to a reference. */
|
|
3
|
+
export declare function tokenCssValue(t: Pick<DesignToken, 'value' | 'unit'>): string;
|
|
4
|
+
export declare const ref: (key: string) => string;
|
|
5
|
+
/** The token a value points at (`var(--x)` or `var(--x, fallback)`), or null for anything else. */
|
|
6
|
+
export declare function refKey(value: string): string | null;
|
|
7
|
+
export declare function tokenMap(ds: DesignSystem): Map<string, DesignToken>;
|
|
8
|
+
export declare function getToken(ds: DesignSystem, key: string): DesignToken | undefined;
|
|
9
|
+
/** The value a token holds (no unit added), or undefined. */
|
|
10
|
+
export declare function getValue(ds: DesignSystem, key: string): string | undefined;
|
|
11
|
+
/** A readable name from a key: `--color-brand-primary-500` → "Color Brand Primary 500". */
|
|
12
|
+
export declare const nameFromKey: (key: string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Sets a token's value, creating it if it doesn't exist (a new token is a brand-layer one, which Strata requires to be
|
|
15
|
+
* a raw value). Immutable: returns a new design system.
|
|
16
|
+
*/
|
|
17
|
+
export declare function setToken(ds: DesignSystem, key: string, value: string, init?: Partial<Omit<DesignToken, 'key' | 'value'>>): DesignSystem;
|
|
18
|
+
/** Several tokens at once (one new design system, not one per token). */
|
|
19
|
+
export declare function setTokens(ds: DesignSystem, values: Record<string, string>): DesignSystem;
|
|
20
|
+
export declare function removeToken(ds: DesignSystem, key: string): DesignSystem;
|
|
21
|
+
/** Follows references down to a concrete value (`var(--a)` → `var(--b)` → `#266DDC`). Unresolvable values come back as they were. */
|
|
22
|
+
export declare function resolveValue(ds: DesignSystem | Map<string, DesignToken>, value: string, depth?: number): string;
|
|
23
|
+
/** The concrete CSS value of a token key, references resolved. */
|
|
24
|
+
export declare function resolveKey(ds: DesignSystem, key: string): string | undefined;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The design system: a Strata-shaped document. Its tokens and components use Strata's own names and structure
|
|
3
|
+
* (`--color-action-primary-bg`, the Button/Alert/Badge/Card/Input/Typography components), so a design system made in
|
|
4
|
+
* Plexo, one made in Strata, the CSS Strata exports, and every Plexo page all speak the same language — and syncing
|
|
5
|
+
* between them is a plain key-for-key exchange.
|
|
6
|
+
*/
|
|
7
|
+
/** Strata's layers: raw brand values, semantic meaning that points at them, and per-component tokens. */
|
|
8
|
+
export type TokenLayer = 'brand' | 'semantic' | 'component';
|
|
9
|
+
export interface DesignToken {
|
|
10
|
+
/** The CSS variable name, e.g. `--color-brand-primary-500`. Unique within a design system. */
|
|
11
|
+
key: string;
|
|
12
|
+
name: string;
|
|
13
|
+
/** Raw value (`#266DDC`, `0.75`) or a reference (`var(--color-brand-primary-500)`). */
|
|
14
|
+
value: string;
|
|
15
|
+
/** Strata's token type: `color`, `dimension`, `font family`, `font weight`, `number`, `string`… */
|
|
16
|
+
type: string;
|
|
17
|
+
/** Appended to a plain numeric value (`rem`, `px`); ignored for references. */
|
|
18
|
+
unit: string | null;
|
|
19
|
+
layer: TokenLayer;
|
|
20
|
+
comment: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface StrataProperty {
|
|
23
|
+
value: string;
|
|
24
|
+
type?: string;
|
|
25
|
+
unit?: string | null;
|
|
26
|
+
comment?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface StrataNode {
|
|
29
|
+
tag: string;
|
|
30
|
+
role: string;
|
|
31
|
+
styles?: Record<string, string>;
|
|
32
|
+
/** CSS-like properties (kebab-case) whose values reference tokens. */
|
|
33
|
+
properties?: Record<string, StrataProperty>;
|
|
34
|
+
/** Per-variant overrides of `properties`. */
|
|
35
|
+
variants?: Record<string, {
|
|
36
|
+
properties?: Record<string, StrataProperty>;
|
|
37
|
+
linkedElement?: unknown;
|
|
38
|
+
}>;
|
|
39
|
+
children?: StrataNode[];
|
|
40
|
+
linkedElement?: unknown;
|
|
41
|
+
textContent?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface DesignComponent {
|
|
44
|
+
name: string;
|
|
45
|
+
variant: string;
|
|
46
|
+
props?: Record<string, unknown>;
|
|
47
|
+
nodes: StrataNode[];
|
|
48
|
+
[extra: string]: unknown;
|
|
49
|
+
}
|
|
50
|
+
/** Plexo-only settings. They shape Plexo pages but have no Strata equivalent, so they are never synced. */
|
|
51
|
+
export interface DesignOptions {
|
|
52
|
+
/** How much air sections get: compact, comfortable, or spacious. */
|
|
53
|
+
density?: 'compact' | 'comfortable' | 'spacious';
|
|
54
|
+
/** The preset last applied, for showing which one is active. */
|
|
55
|
+
themeId?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Where this design system is linked in Strata, plus what both sides agreed on at the last sync. */
|
|
58
|
+
export interface StrataLink {
|
|
59
|
+
projectId: string;
|
|
60
|
+
projectName?: string;
|
|
61
|
+
/** ISO time of the last successful sync (either direction). */
|
|
62
|
+
syncedAt?: string;
|
|
63
|
+
/** Keep this site up to date with Strata on its own: safe changes are applied (and the published site updated) without asking. Default false. */
|
|
64
|
+
autoUpdate?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The values both sides had at the last sync — the common ancestor for a three-way merge, which is what lets a sync tell
|
|
67
|
+
* "changed in Plexo" from "changed in Strata" from "changed in both".
|
|
68
|
+
*/
|
|
69
|
+
base?: {
|
|
70
|
+
tokens: Record<string, string>;
|
|
71
|
+
components: Record<string, string>;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface DesignSystem {
|
|
75
|
+
version: 1;
|
|
76
|
+
name?: string;
|
|
77
|
+
tokens: DesignToken[];
|
|
78
|
+
components: DesignComponent[];
|
|
79
|
+
options?: DesignOptions;
|
|
80
|
+
strata?: StrataLink;
|
|
81
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PageDefinition } from '../types/editor';
|
|
3
|
+
import type { StrataAdapter } from '../strata/types';
|
|
4
|
+
/**
|
|
5
|
+
* What the app embedding the editor can plug in. Every field is optional: with no props the
|
|
6
|
+
* editor is a complete, offline visual builder (blank page, embedded images, no AI). A field
|
|
7
|
+
* is only needed when the feature depends on something the SDK can't own — the host's server,
|
|
8
|
+
* storage, accounts, or secrets. Like V1, no provider key ever lives in the browser: AI and
|
|
9
|
+
* stock-image search go through the host (or Plexo's API), never straight from the SDK.
|
|
10
|
+
*
|
|
11
|
+
* Rule for what is a prop vs. an SDK default:
|
|
12
|
+
* - SDK default: anything that is pure editing behaviour or pure rendering (UI, undo, snapping,
|
|
13
|
+
* breakpoints, frame clipping, the compile step).
|
|
14
|
+
* - Host prop: persistence, identity, files, AI/credits, brand data, permissions.
|
|
15
|
+
*/
|
|
16
|
+
export type SaveState = 'idle' | 'dirty' | 'saving' | 'saved' | 'error';
|
|
17
|
+
export interface StockImageProvider {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}
|
|
21
|
+
export interface StockImageResult {
|
|
22
|
+
id: string;
|
|
23
|
+
src: string;
|
|
24
|
+
alt?: string;
|
|
25
|
+
credit?: string;
|
|
26
|
+
provider?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface LibrarySection {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
thumbnail?: string;
|
|
33
|
+
build: () => PageDefinition['rootNode'];
|
|
34
|
+
}
|
|
35
|
+
export interface MediaAsset {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
url: string;
|
|
39
|
+
}
|
|
40
|
+
export interface LinkTarget {
|
|
41
|
+
label: string;
|
|
42
|
+
href: string;
|
|
43
|
+
}
|
|
44
|
+
export interface CommentTarget {
|
|
45
|
+
nodeId: string;
|
|
46
|
+
nodeType: string;
|
|
47
|
+
clientX: number;
|
|
48
|
+
clientY: number;
|
|
49
|
+
}
|
|
50
|
+
export interface AskSolContext {
|
|
51
|
+
nodeId?: string;
|
|
52
|
+
nodeType?: string;
|
|
53
|
+
pageId: string;
|
|
54
|
+
/** The site as it is right now (pages, sections in order, brand): hand it to the AI with `SOL_SYSTEM_PROMPT`. */
|
|
55
|
+
design?: import('../sol/describe').SolDesignSummary;
|
|
56
|
+
/** Every kind of section the AI can add or change, with layouts and fields. */
|
|
57
|
+
catalog?: import('../sol/catalogSchema').SolCatalog;
|
|
58
|
+
}
|
|
59
|
+
/** A page as the host knows it. */
|
|
60
|
+
export interface HostPage {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string; /** Where it lives on the site, e.g. "/about" — shown beside the name. */
|
|
63
|
+
route?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Pages belong to the host: only the host knows how a page is stored, named and addressed, and whether a site has one page or many.
|
|
67
|
+
* Plexo web is the reference — it keeps the list, opens one page per editor, and creates pages from the SDK's page templates.
|
|
68
|
+
* With a `pageSource` the editor shows the host's pages (switcher in the top bar and Pages panel) and asks the host to switch,
|
|
69
|
+
* create, rename or delete; without it the editor manages its own simple list, which is right for a standalone editor.
|
|
70
|
+
*/
|
|
71
|
+
export interface PageSource {
|
|
72
|
+
pages: HostPage[];
|
|
73
|
+
/** The page being edited (the one the editor was opened on). */
|
|
74
|
+
currentId?: string;
|
|
75
|
+
onSelect: (id: string) => void | Promise<void>;
|
|
76
|
+
/** Absent → no "New page". `templateId` is one of `listPageTemplates()` ('blank' for an empty page). */
|
|
77
|
+
onCreate?: (request: {
|
|
78
|
+
name: string;
|
|
79
|
+
templateId: string;
|
|
80
|
+
}) => void | Promise<void>;
|
|
81
|
+
onRename?: (id: string, name: string) => void | Promise<void>;
|
|
82
|
+
onDelete?: (id: string) => void | Promise<void>;
|
|
83
|
+
/** Replaces the built-in switcher entirely (the host brings its own picker). */
|
|
84
|
+
render?: (api: {
|
|
85
|
+
pages: HostPage[];
|
|
86
|
+
currentId?: string;
|
|
87
|
+
select: (id: string) => void;
|
|
88
|
+
}) => React.ReactNode;
|
|
89
|
+
}
|
|
90
|
+
/** How the editor sits inside the host's own app shell (its sidebar, its home). */
|
|
91
|
+
export interface HostShell {
|
|
92
|
+
/** Shows a "back" button at the far left of the top bar — the way home. */
|
|
93
|
+
onExit?: () => void;
|
|
94
|
+
/** Button text, e.g. "Back to dashboard". Default "Back". */
|
|
95
|
+
exitLabel?: string;
|
|
96
|
+
/** Whether the host's sidebar is currently hidden, and how to toggle it. With onToggleSidebar the top bar gets a "More space" button. */
|
|
97
|
+
sidebarHidden?: boolean;
|
|
98
|
+
onToggleSidebar?: () => void;
|
|
99
|
+
/** Button texts for that toggle, in the host's own words (e.g. "Full screen" / "Show chat"). Defaults "More space" / "Show menu". */
|
|
100
|
+
hideLabel?: string;
|
|
101
|
+
showLabel?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface V2HostConfig {
|
|
104
|
+
/** Same convention as V1: "workspace-internal" inside the Plexo dashboard (same-origin, nothing to configure),
|
|
105
|
+
* or a Plexo API key for a third-party app. Absent → fully standalone. */
|
|
106
|
+
apiKey?: string;
|
|
107
|
+
/** The Plexo template/site being edited. Inside Plexo this completes the form inbox address, so forms work with no setup. */
|
|
108
|
+
templateId?: string;
|
|
109
|
+
/** Where forms in the design submit to, for any host: `(formId) => url`. Beats Plexo's default; a form's own address beats both. */
|
|
110
|
+
formAction?: (formId: string) => string | undefined;
|
|
111
|
+
/** May an HTML embed run scripts (still inside its own sandbox)? Default true; hosts that forbid scripts on published pages set false. */
|
|
112
|
+
allowEmbedScripts?: boolean;
|
|
113
|
+
/** Save button + autosave target. Absent → no Save button (the host reads edits via onChange / the ref). */
|
|
114
|
+
onSave?: (pages: PageDefinition[]) => void | Promise<void>;
|
|
115
|
+
/** Publish button. Absent → no Publish button; publishing is a host/product concern. */
|
|
116
|
+
onPublish?: (pages: PageDefinition[]) => void | Promise<void>;
|
|
117
|
+
/** Shown beside Save. The editor tracks its own saving/saved/error around onSave; pass this to override. */
|
|
118
|
+
saveState?: SaveState;
|
|
119
|
+
/** Calls onSave this long after the last edit. Default off. */
|
|
120
|
+
autoSave?: boolean;
|
|
121
|
+
/** Autosave debounce in ms (default 3000, as V1). */
|
|
122
|
+
autoSaveDuration?: number;
|
|
123
|
+
/** Upload an image, return its public URL. Absent → small images are embedded in the design. */
|
|
124
|
+
onUpload?: (file: File) => Promise<string> | string;
|
|
125
|
+
/** Stock photo search, brokered by the host so API keys stay server-side. */
|
|
126
|
+
stockImages?: {
|
|
127
|
+
providers: StockImageProvider[];
|
|
128
|
+
search: (query: string, providerId: string) => Promise<StockImageResult[]>;
|
|
129
|
+
};
|
|
130
|
+
/** The host's own media library (previously uploaded images). */
|
|
131
|
+
media?: MediaAsset[];
|
|
132
|
+
/** Powers SOL / Ask-AI. Absent → the SOL tab is hidden (no AI, no credits, nothing fake). */
|
|
133
|
+
onAskSol?: (question: string, context: AskSolContext) => Promise<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Keeps the site's design system in step with Strata (signing in, choosing or creating a project, getting updates, sending
|
|
136
|
+
* changes). Absent → the design system lives only in this editor, and the Strata card isn't shown.
|
|
137
|
+
*/
|
|
138
|
+
strata?: StrataAdapter;
|
|
139
|
+
/** Extra ready-made sections shown in Library → Sections (the built-in blocks are always there). */
|
|
140
|
+
sections?: LibrarySection[];
|
|
141
|
+
/** Brand/theme colours offered in every colour picker (e.g. the site's palette). */
|
|
142
|
+
colors?: string[];
|
|
143
|
+
/** Pages/anchors the link picker offers (the host knows its routes). */
|
|
144
|
+
linkTargets?: LinkTarget[];
|
|
145
|
+
/** Viewer/commenter role: no editing, no property panels, no Save. */
|
|
146
|
+
readOnly?: boolean;
|
|
147
|
+
/** Clicking a node reports it via onRequestComment instead of selecting it. */
|
|
148
|
+
commentMode?: boolean;
|
|
149
|
+
onRequestComment?: (target: CommentTarget) => void;
|
|
150
|
+
/** The host's pages (see PageSource). Absent → the editor keeps its own list. */
|
|
151
|
+
pageSource?: PageSource;
|
|
152
|
+
/** Way home + hiding the host's sidebar for more room (see HostShell). */
|
|
153
|
+
shell?: HostShell;
|
|
154
|
+
/** Slots in the top bar (page picker, "View in app", …). */
|
|
155
|
+
headerLeft?: React.ReactNode;
|
|
156
|
+
headerRight?: React.ReactNode;
|
|
157
|
+
/** Turn built-in panels off (e.g. a landing-page-only host hides code view). All on by default except SOL (needs onAskSol). */
|
|
158
|
+
features?: {
|
|
159
|
+
pages?: boolean; /** The Branding panel (design system + Strata). */
|
|
160
|
+
branding?: boolean; /** @deprecated use `branding` */
|
|
161
|
+
strata?: boolean;
|
|
162
|
+
library?: boolean;
|
|
163
|
+
codeView?: boolean;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
export declare const HostProvider: React.FC<{
|
|
167
|
+
value: V2HostConfig;
|
|
168
|
+
children: React.ReactNode;
|
|
169
|
+
}>;
|
|
170
|
+
export declare const useHost: () => V2HostConfig;
|
|
171
|
+
/** Largest image the editor will embed in the design itself when the host gave no onUpload. */
|
|
172
|
+
export declare const MAX_EMBED_BYTES = 1500000;
|
|
173
|
+
/** Turns a chosen file into a URL: the host's upload when provided, else an embedded data URL. */
|
|
174
|
+
export declare function resolveUpload(file: File, onUpload?: V2HostConfig['onUpload']): Promise<string>;
|
|
175
|
+
/** What shows where an image has no source yet — never a remote photo (it would be hotlinked on the published page). */
|
|
176
|
+
export declare const IMAGE_PLACEHOLDER: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SOL's mark — Plexo's AI. The Plexo shield with a small accent inside, the same mark the
|
|
3
|
+
* Plexo dashboard uses for SOL, so every AI action in the builder reads as SOL.
|
|
4
|
+
*/
|
|
5
|
+
export declare function SolMark({ className, size }: {
|
|
6
|
+
className?: string;
|
|
7
|
+
size?: number;
|
|
8
|
+
}): import("react").JSX.Element;
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public entry for the V2
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Public entry for the V2 editor: `@charisol/plexo-sdk/v2`.
|
|
3
|
+
*
|
|
4
|
+
* <V2Editor pages={…} onChange={…} onSave={…} onUpload={…} onAskSol={…} />
|
|
5
|
+
*
|
|
6
|
+
* Every prop is optional — see V2HostConfig for what is a host concern vs. an SDK default.
|
|
7
|
+
* Pages are plain JSON trees (PageDefinition); `@charisol/plexo-sdk/v2/compile` turns them into HTML or React.
|
|
6
8
|
*/
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export type {
|
|
11
|
-
export
|
|
12
|
-
export
|
|
9
|
+
export { V2Editor } from './V2Editor';
|
|
10
|
+
export type { V2EditorProps, V2EditorRef } from './V2Editor';
|
|
11
|
+
export type { V2HostConfig, SaveState, StockImageProvider, StockImageResult, LibrarySection, MediaAsset, LinkTarget, CommentTarget, AskSolContext, PageSource, HostPage, HostShell, } from './host/HostContext';
|
|
12
|
+
export type { DocumentNode, PageDefinition, NodeType, ElementStyles, ViewportMode, } from './types/editor';
|
|
13
|
+
export { convertLegacyDesign, isLegacyDesign } from './migrate/legacy';
|
|
14
|
+
export type { LegacyDesign } from './migrate/legacy';
|
|
15
|
+
export * from './design';
|
|
16
|
+
export type { DesignSystem } from './design/types';
|
|
17
|
+
export { blankPages } from './data/blankPage';
|
|
18
|
+
export { PAGE_TEMPLATES, listPageTemplates, buildPageFromTemplate, buildTemplateSections, templateSeed, getPageTemplate, isPageEmpty } from './sections/pageTemplates';
|
|
19
|
+
export type { PageTemplate, PageTemplateSection, PageTemplateSummary } from './sections/pageTemplates';
|
|
20
|
+
export { catalogSchema, describeDesign, applyCommands, parseSolReply, describeCommand, setPageTemplateResolver, SOL_SYSTEM_PROMPT, solCommandSchema } from './sol';
|
|
21
|
+
export type { SolCatalog, SolKind, SolField, SolVariant, SolDesignSummary, SolSectionSummary, SolCommand, SolCommandOp, CommandResult, ParsedSolReply, ApplyOptions, ApplyResult, PageTemplateResolver } from './sol';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PageDefinition } from '../types/editor';
|
|
2
|
+
interface LegacyNode {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
parentId: string | null;
|
|
6
|
+
children: string[];
|
|
7
|
+
styles: Record<string, string | number | undefined>;
|
|
8
|
+
props: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface LegacyDesign {
|
|
11
|
+
nodes: Record<string, LegacyNode>;
|
|
12
|
+
pageOrder: string[];
|
|
13
|
+
/** What a host stored beside the canvas (Plexo's app builder keeps these in the same file). Not used by the conversion. */
|
|
14
|
+
name?: string;
|
|
15
|
+
route?: string;
|
|
16
|
+
generatedSha?: string;
|
|
17
|
+
updatedAt?: string;
|
|
18
|
+
format?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const isLegacyDesign: (doc: unknown) => doc is LegacyDesign;
|
|
21
|
+
export declare function convertLegacyDesign(doc: LegacyDesign, meta: {
|
|
22
|
+
name: string;
|
|
23
|
+
slug: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
}): PageDefinition;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DocumentNode, ViewportMode } from '../types/editor';
|
|
2
|
+
type Screen = Exclude<ViewportMode, 'desktop'>;
|
|
3
|
+
/**
|
|
4
|
+
* Fits the desktop design onto a smaller screen nobody has designed yet, so nothing is left outside it. A starting
|
|
5
|
+
* point, not a finished layout.
|
|
6
|
+
* - tablet: the layout is scaled to the screen's width;
|
|
7
|
+
* - mobile: each section becomes a single column, its elements stacked in reading order at full width — scaling
|
|
8
|
+
* positions can't work on a phone, because things like a form or an accordion keep their natural height.
|
|
9
|
+
* It only fills in what the owner hasn't already set for that screen and never overwrites an override. Pure.
|
|
10
|
+
*/
|
|
11
|
+
export declare function adaptToScreen(root: DocumentNode, screen: Screen): DocumentNode;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocumentNode } from '../types/editor';
|
|
2
|
+
/**
|
|
3
|
+
* The address of each section inside its page (`#about`), so a menu item or button can scroll to it. Taken from the section's
|
|
4
|
+
* own name ("About us" → about-us), made unique when two sections share a name, and identical wherever it's asked — the
|
|
5
|
+
* editor's link picker and both compilers use this one function, so a saved link keeps working after publishing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sectionAnchors(root: DocumentNode): Map<string, string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The look of the nine rich elements. One stylesheet, used by the editor canvas and by published pages, so they
|
|
3
|
+
* match. Everything is scoped under `.plx-el` and reads colour from the element's own text colour, so a
|
|
4
|
+
* designer's colour choices flow through. Responsive rules use a container query on the page (`plx-page`), which
|
|
5
|
+
* means "mobile" is the width of the page being shown — the mobile frame in the editor, the window when published.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ELEMENT_CSS: string;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { NodeType } from '../types/editor';
|
|
2
|
+
import type { SocialNetwork } from './socialIcons';
|
|
3
|
+
export interface CarouselSlide {
|
|
4
|
+
src: string;
|
|
5
|
+
alt?: string;
|
|
6
|
+
caption?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CarouselProps {
|
|
10
|
+
slides: CarouselSlide[];
|
|
11
|
+
showArrows?: boolean;
|
|
12
|
+
showDots?: boolean;
|
|
13
|
+
autoplay?: boolean; /** seconds per slide */
|
|
14
|
+
interval?: number;
|
|
15
|
+
}
|
|
16
|
+
export type VideoRatio = '16:9' | '4:3' | '1:1' | '9:16';
|
|
17
|
+
export interface VideoProps {
|
|
18
|
+
url: string;
|
|
19
|
+
poster?: string;
|
|
20
|
+
ratio?: VideoRatio;
|
|
21
|
+
autoplay?: boolean;
|
|
22
|
+
loop?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type SocialShape = 'circle' | 'square' | 'plain';
|
|
25
|
+
export interface SocialLink {
|
|
26
|
+
network: SocialNetwork;
|
|
27
|
+
url: string;
|
|
28
|
+
}
|
|
29
|
+
export interface SocialProps {
|
|
30
|
+
links: SocialLink[];
|
|
31
|
+
size?: number;
|
|
32
|
+
shape?: SocialShape;
|
|
33
|
+
colorMode?: 'brand' | 'mono';
|
|
34
|
+
}
|
|
35
|
+
export interface MenuLink {
|
|
36
|
+
label: string;
|
|
37
|
+
href: string;
|
|
38
|
+
}
|
|
39
|
+
export interface MenuProps {
|
|
40
|
+
links: MenuLink[];
|
|
41
|
+
layout?: 'horizontal' | 'vertical';
|
|
42
|
+
mobile?: 'hamburger' | 'expanded';
|
|
43
|
+
}
|
|
44
|
+
export interface HtmlProps {
|
|
45
|
+
code: string;
|
|
46
|
+
title?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface TableProps {
|
|
49
|
+
rows: string[][];
|
|
50
|
+
headerRow?: boolean;
|
|
51
|
+
striped?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface TimerProps {
|
|
54
|
+
target: string;
|
|
55
|
+
expiredMessage?: string;
|
|
56
|
+
showLabels?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export type FormFieldType = 'text' | 'email' | 'tel' | 'textarea' | 'select' | 'checkbox';
|
|
59
|
+
export interface FormField {
|
|
60
|
+
id: string;
|
|
61
|
+
label: string;
|
|
62
|
+
type: FormFieldType;
|
|
63
|
+
placeholder?: string;
|
|
64
|
+
required?: boolean;
|
|
65
|
+
options?: string[];
|
|
66
|
+
}
|
|
67
|
+
export interface FormProps {
|
|
68
|
+
fields: FormField[];
|
|
69
|
+
submitLabel?: string;
|
|
70
|
+
/** Where submissions are sent. Empty → the host's form endpoint (see compile options). */
|
|
71
|
+
action?: string;
|
|
72
|
+
successMessage?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface AccordionItem {
|
|
75
|
+
title: string;
|
|
76
|
+
content: string;
|
|
77
|
+
}
|
|
78
|
+
export interface AccordionProps {
|
|
79
|
+
items: AccordionItem[];
|
|
80
|
+
allowMultiple?: boolean;
|
|
81
|
+
openFirst?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export interface IconProps {
|
|
84
|
+
iconName: string;
|
|
85
|
+
strokeWidth?: number; /** Read aloud by screen readers; empty = decorative. */
|
|
86
|
+
label?: string;
|
|
87
|
+
}
|
|
88
|
+
export declare const RICH_ELEMENT_TYPES: readonly ["icon", "carousel", "video", "social", "menu", "html", "table", "timer", "form", "accordion"];
|
|
89
|
+
export type RichElementType = (typeof RICH_ELEMENT_TYPES)[number];
|
|
90
|
+
export declare const isRichElement: (t: NodeType) => t is RichElementType;
|
|
91
|
+
/** What a freshly added element starts with — real, editable content, never an empty box. */
|
|
92
|
+
export declare function defaultElementProps(type: RichElementType): Record<string, unknown>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DocumentNode } from '../types/editor';
|
|
2
|
+
import { type HNode } from './ir';
|
|
3
|
+
import { escapeAttr, safeColor } from './sanitize';
|
|
4
|
+
export interface ElementContext {
|
|
5
|
+
/** Safe, page-unique id prefix for anchors and groups inside this element. */
|
|
6
|
+
uid: string;
|
|
7
|
+
/** True on the editor canvas, false in published output. */
|
|
8
|
+
editing: boolean;
|
|
9
|
+
/** Where a form without its own destination posts — the host's endpoint (undefined → none). */
|
|
10
|
+
formAction?: (formId: string) => string | undefined;
|
|
11
|
+
/** May an HTML embed run scripts (inside its own sandbox)? Hosts that forbid scripts set false. */
|
|
12
|
+
allowEmbedScripts: boolean;
|
|
13
|
+
/** Clock for the timer's first paint (ms). */
|
|
14
|
+
now: number;
|
|
15
|
+
}
|
|
16
|
+
/** Same name the host's form handler checks as its spam trap (a visitor never sees or fills it). */
|
|
17
|
+
export declare const FORM_HONEYPOT_FIELD_NAME = "_hp_field";
|
|
18
|
+
/** Turns a pasted video link into something safe to embed (YouTube/Vimeo player, or a plain video file). */
|
|
19
|
+
export declare function parseVideoUrl(raw: string): {
|
|
20
|
+
kind: 'iframe' | 'file';
|
|
21
|
+
src: string;
|
|
22
|
+
} | null;
|
|
23
|
+
export declare function remaining(targetIso: string, now: number): {
|
|
24
|
+
done: boolean;
|
|
25
|
+
d: number;
|
|
26
|
+
h: number;
|
|
27
|
+
m: number;
|
|
28
|
+
s: number;
|
|
29
|
+
};
|
|
30
|
+
/** The markup for one of the nine rich elements (null for plain types, which the page renders itself). */
|
|
31
|
+
export declare function buildElement(node: DocumentNode, c: ElementContext): HNode | null;
|
|
32
|
+
export { escapeAttr, safeColor };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** What decides where a form sends its submissions. All three are optional; see resolveFormAction. */
|
|
2
|
+
export interface FormDestinationConfig {
|
|
3
|
+
/** Plexo API key, or "workspace-internal" when the editor runs inside the Plexo dashboard (as in V1). */
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
/** The Plexo template/site being edited — completes Plexo's own form address. */
|
|
6
|
+
templateId?: string;
|
|
7
|
+
/** The host's own destination. Wins over Plexo's default, so any app can send forms to its own server. */
|
|
8
|
+
formAction?: (formId: string) => string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export type FormDestination = {
|
|
11
|
+
kind: 'custom';
|
|
12
|
+
url: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'host';
|
|
15
|
+
url: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'plexo';
|
|
18
|
+
url: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'none';
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Where a form's submissions go, most specific first:
|
|
24
|
+
* 1. the form's own address (the owner typed one),
|
|
25
|
+
* 2. the host app's `formAction` (any app can point forms at its own server),
|
|
26
|
+
* 3. inside Plexo ("workspace-internal"), Plexo's own form inbox — nothing to set up,
|
|
27
|
+
* 4. nothing: the form has no destination and the editor says so.
|
|
28
|
+
* A third-party app with a real Plexo key doesn't get (3): Plexo's endpoint finds the site from the page's own
|
|
29
|
+
* domain, so it only works for pages Plexo publishes.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveFormDestination(ownAction: string | undefined, formId: string, cfg: FormDestinationConfig): FormDestination;
|
|
32
|
+
/** The `formAction` shape the element builders take, built from the same config. */
|
|
33
|
+
export declare const formActionFor: (cfg: FormDestinationConfig) => (formId: string) => string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ViewportMode } from '../types/editor';
|
|
2
|
+
/**
|
|
3
|
+
* The visible canvas of each screen. A frame is the contract between the editor and the published
|
|
4
|
+
* page: what is inside it is the page at that screen size, and what is outside it is working area
|
|
5
|
+
* that shows only while editing.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FRAME_WIDTH: Record<ViewportMode, number>;
|
|
8
|
+
/** Published pages switch layout at these widths (the tablet/mobile frames sit comfortably inside them). */
|
|
9
|
+
export declare const MEDIA_QUERY: Record<Exclude<ViewportMode, 'desktop'>, string>;
|
|
10
|
+
export declare const VIEWPORTS: ViewportMode[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type IconShape = [tag: 'path' | 'circle' | 'rect' | 'line' | 'polyline' | 'polygon' | 'ellipse', attrs: Record<string, string>];
|
|
2
|
+
export declare const ICONS: Record<string, IconShape[]>;
|
|
3
|
+
/** Icon names in the order the picker shows them, by theme. */
|
|
4
|
+
export declare const ICON_GROUPS: Record<string, string[]>;
|
|
5
|
+
export declare const ICON_NAMES: string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tiny element tree — the one description of a page's markup. The editor renders it as React,
|
|
3
|
+
* the HTML compiler prints it as markup, and the React compiler prints it as JSX, so a published page
|
|
4
|
+
* and the canvas can't drift apart. It has no DOM, no React: it is plain data.
|
|
5
|
+
*/
|
|
6
|
+
export type HAttrValue = string | number | boolean | undefined;
|
|
7
|
+
export type HAttrs = Record<string, HAttrValue>;
|
|
8
|
+
export interface HNode {
|
|
9
|
+
tag: string;
|
|
10
|
+
attrs?: HAttrs;
|
|
11
|
+
/** Inline style, limited to values the builders have already made safe. */
|
|
12
|
+
style?: Record<string, string>;
|
|
13
|
+
children?: HChild[];
|
|
14
|
+
}
|
|
15
|
+
export type HChild = HNode | string;
|
|
16
|
+
type Maybe = HChild | null | false | undefined;
|
|
17
|
+
export declare function h(tag: string, attrs?: HAttrs | null, ...children: Array<Maybe | Maybe[]>): HNode;
|
|
18
|
+
export declare const VOID_TAGS: Set<string>;
|
|
19
|
+
export declare const reactAttrName: (name: string) => string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DocumentNode, ElementStyles, ViewportMode } from '../types/editor';
|
|
2
|
+
export type CssMap = Record<string, string | number | undefined>;
|
|
3
|
+
export interface NodeCssOptions {
|
|
4
|
+
viewport: ViewportMode;
|
|
5
|
+
/** True when the parent lays its children out as a grid. */
|
|
6
|
+
isGridChild: boolean;
|
|
7
|
+
isRootPage: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface NodeCss {
|
|
10
|
+
css: CssMap;
|
|
11
|
+
/** Pieces of the `transform` (centering constraints) — the editor appends drag offsets to these. */
|
|
12
|
+
transformParts: string[];
|
|
13
|
+
hConstraint: NonNullable<ElementStyles['horizontalConstraint']>;
|
|
14
|
+
vConstraint: NonNullable<ElementStyles['verticalConstraint']>;
|
|
15
|
+
hasFreeCoords: boolean;
|
|
16
|
+
isFreeContainer: boolean;
|
|
17
|
+
isGridContainer: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Turns a node's resolved styles (see resolveNodeStyles) into the CSS the page uses for it. This is the
|
|
21
|
+
* single source of truth for layout: the editor canvas and the HTML/React compilers both call it, so a
|
|
22
|
+
* published page is the design, not an approximation of it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function computeNodeCss(node: DocumentNode, styles: ElementStyles, o: NodeCssOptions): NodeCss;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DocumentNode, ElementStyles, ViewportMode } from '../types/editor';
|
|
2
|
+
/** Where an element sits relative to the visible canvas of one screen. */
|
|
3
|
+
export type Placement = 'inside' | 'partial' | 'outside';
|
|
4
|
+
export declare const isFreePositioned: (s: ElementStyles) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* For every free-positioned element on the page, whether it is inside, partly inside, or entirely
|
|
7
|
+
* outside the visible canvas of `viewport`. The compiler drops 'outside' elements from that screen and
|
|
8
|
+
* clips 'partial' ones at the section edge; the editor uses the same answer to dim and count them.
|
|
9
|
+
*
|
|
10
|
+
* Only what can be measured is judged: a box whose size depends on content is never called 'outside'.
|
|
11
|
+
*/
|
|
12
|
+
export declare function computePlacements(root: DocumentNode, viewport: ViewportMode): Map<string, Placement>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { DocumentNode, ElementStyles, ViewportMode } from '../types/editor';
|
|
2
|
+
/** A node's styles at one screen size: desktop is the base, tablet overrides it, mobile overrides tablet. */
|
|
3
|
+
export declare function resolveStyles(node: DocumentNode, viewport: ViewportMode): ElementStyles;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional runtime. Everything in the nine elements works without it — links, menus, accordions, tables, video,
|
|
3
|
+
* social and forms are plain HTML — and this adds the finishing touches that need a script: carousel autoplay and
|
|
4
|
+
* the active dot, the timer ticking, and sending a form without leaving the page.
|
|
5
|
+
*
|
|
6
|
+
* It is ONE function, self-contained (no imports, nothing from outside), because it is used three ways: the editor
|
|
7
|
+
* calls it directly in preview, the HTML compiler prints its source into a <script>, and the React compiler prints
|
|
8
|
+
* it into the generated component. Hosts that don't allow scripts on published pages just leave it out.
|
|
9
|
+
*/
|
|
10
|
+
export declare function plexoInit(root: ParentNode): () => void;
|
|
11
|
+
/**
|
|
12
|
+
* The runtime as source text, ready to drop into a <script> or a generated component.
|
|
13
|
+
*
|
|
14
|
+
* Some toolchains (esbuild's keep-names, used by tsx and some test runners) wrap functions in a `__name(...)` helper that
|
|
15
|
+
* doesn't exist on a published page. The function is defined with that helper available, so the script runs wherever it
|
|
16
|
+
* was built.
|
|
17
|
+
*/
|
|
18
|
+
export declare const RUNTIME_SOURCE: string;
|