@charisol/plexo-sdk 1.4.42 → 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/{iconSvgStatic-CGue7nyp.js → iconSvgStatic-Lnpg27U9.js} +66 -75
- package/dist/index.js +14042 -15423
- 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/colorUtils.d.ts +35 -0
- package/dist/utilities/playground.interfaces.d.ts +19 -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 -11
- 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 +10993 -8186
- 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 -25
- 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 -59
- 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,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FieldDef } from '../../sections/types';
|
|
3
|
+
type Value = any;
|
|
4
|
+
/**
|
|
5
|
+
* A form for a section's content, built from its fields — so every section is edited the same plain way: fill in boxes,
|
|
6
|
+
* pick a picture, add or reorder items. `get`/`put` read and write by field key, which lets the same form serve the
|
|
7
|
+
* section's top level and the items inside a list.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FieldForm: React.FC<{
|
|
10
|
+
fields: FieldDef[];
|
|
11
|
+
get: (key: string) => Value;
|
|
12
|
+
put: (key: string, value: Value) => void;
|
|
13
|
+
}>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DocumentNode } from '../../types/editor';
|
|
3
|
+
/** Shown on a piece of a ready-made section: it can be styled freely, and says what happens to those changes. */
|
|
4
|
+
export declare const ManagedChildNotice: React.FC<{
|
|
5
|
+
section: DocumentNode;
|
|
6
|
+
nodeId: string;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BlockSpec } from '../../sections/types';
|
|
3
|
+
/**
|
|
4
|
+
* A live picture of a section in the site's own brand: the real section, drawn small. It is built only once it scrolls into
|
|
5
|
+
* view (a gallery has dozens), and follows the design system, so changing the brand changes every preview.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SectionThumb: React.FC<{
|
|
8
|
+
block: BlockSpec;
|
|
9
|
+
height?: number;
|
|
10
|
+
label: string;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* "Sections": the way to build a page. Pick a layout and it's added below the section you've selected, already filled
|
|
4
|
+
* with sample words in your brand — then click any text to change it. Everything about it can be changed afterwards.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SectionsPanel: React.FC;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** `new` makes a page (asks for its name); `fill` fills the empty page that is open (no blank card, no name). */
|
|
4
|
+
mode: 'new' | 'fill';
|
|
5
|
+
onPick: (templateId: string, name: string) => void;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
}
|
|
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).
|
|
11
|
+
*/
|
|
12
|
+
export declare const TemplateChooser: React.FC<Props>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Set around the contents of a ready-made section: its elements keep the layout's positions (they can be tweaked, not dragged). */
|
|
2
|
+
export declare const BlockContext: import("react").Context<{
|
|
3
|
+
sectionId: string;
|
|
4
|
+
} | null>;
|
|
5
|
+
export declare const useBlock: () => {
|
|
6
|
+
sectionId: string;
|
|
7
|
+
} | null;
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DocumentNode, PageDefinition, ViewportMode, LeftSidebarTab, ViewMode, ElementStyles, DragDropState, ResponsiveVisibility, CanvasToolMode, CanvasViewMode, LayoutMode, AlignmentGuide, ContextMenuState, MarqueeState } from '../types/editor';
|
|
3
|
+
import type { DesignSystem } from '../design/types';
|
|
4
|
+
import type { BlockSpec, BlockStyle } from '../sections/types';
|
|
5
|
+
import { type CommandResult } from '../sol';
|
|
6
|
+
export interface FreeMovementCommit {
|
|
7
|
+
updates: Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
styles: Partial<ElementStyles>;
|
|
10
|
+
}>;
|
|
11
|
+
parentLock?: {
|
|
12
|
+
parentId: string;
|
|
13
|
+
styles: Partial<ElementStyles>;
|
|
14
|
+
};
|
|
15
|
+
spacer?: {
|
|
16
|
+
parentId: string;
|
|
17
|
+
index: number;
|
|
18
|
+
spacerNode: DocumentNode;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface EditorContextType {
|
|
22
|
+
pages: PageDefinition[];
|
|
23
|
+
/** Every page with the open page's latest edits — what to save or hand to a compiler. */
|
|
24
|
+
getPages: () => PageDefinition[];
|
|
25
|
+
/** The site's design system: the colours, fonts, shapes and components every page draws from. */
|
|
26
|
+
designSystem: DesignSystem;
|
|
27
|
+
/** Replace the design system (or derive the next one from the current). Each call is one undoable step. */
|
|
28
|
+
setDesignSystem: (next: DesignSystem | ((prev: DesignSystem) => DesignSystem), coalesceKey?: string) => void;
|
|
29
|
+
undoDesignSystem: () => void;
|
|
30
|
+
canUndoDesignSystem: boolean;
|
|
31
|
+
getDesignSystem: () => DesignSystem;
|
|
32
|
+
/** Changes every page and the design system together as one undoable step (used by "Tidy up my design"). */
|
|
33
|
+
applyDesignTidy: (fn: (pages: PageDefinition[], designSystem: DesignSystem) => {
|
|
34
|
+
pages: PageDefinition[];
|
|
35
|
+
designSystem: DesignSystem;
|
|
36
|
+
}) => void;
|
|
37
|
+
/** True while the last tidy-up is still the latest change, so undoing it can't discard later work. */
|
|
38
|
+
canUndoDesignTidy: boolean;
|
|
39
|
+
undoDesignTidy: () => void;
|
|
40
|
+
currentPageId: string;
|
|
41
|
+
currentPage: PageDefinition;
|
|
42
|
+
setCurrentPageId: (id: string) => void;
|
|
43
|
+
documentTree: DocumentNode;
|
|
44
|
+
selectedNodeId: string | null;
|
|
45
|
+
selectedNodeIds: string[];
|
|
46
|
+
selectedNode: DocumentNode | null;
|
|
47
|
+
selectNode: (id: string | null) => void;
|
|
48
|
+
selectNodes: (ids: string[]) => void;
|
|
49
|
+
toggleNodeSelection: (id: string) => void;
|
|
50
|
+
selectAll: () => void;
|
|
51
|
+
hoveredNodeId: string | null;
|
|
52
|
+
setHoveredNodeId: (id: string | null) => void;
|
|
53
|
+
selectParentNode: (nodeId?: string) => void;
|
|
54
|
+
marquee: MarqueeState;
|
|
55
|
+
setMarquee: React.Dispatch<React.SetStateAction<MarqueeState>>;
|
|
56
|
+
editingNodeId: string | null;
|
|
57
|
+
startInlineEditing: (nodeId: string) => void;
|
|
58
|
+
stopInlineEditing: () => void;
|
|
59
|
+
dragState: DragDropState;
|
|
60
|
+
setDragState: (state: Partial<DragDropState>) => void;
|
|
61
|
+
clearDragState: () => void;
|
|
62
|
+
handleDrop: () => void;
|
|
63
|
+
moveNode: (sourceId: string, targetParentId: string, targetIndex: number) => void;
|
|
64
|
+
moveNodeUp: (nodeId: string) => void;
|
|
65
|
+
moveNodeDown: (nodeId: string) => void;
|
|
66
|
+
viewportMode: ViewportMode;
|
|
67
|
+
setViewportMode: (mode: ViewportMode) => void;
|
|
68
|
+
viewMode: ViewMode;
|
|
69
|
+
setViewMode: (mode: ViewMode) => void;
|
|
70
|
+
isPreviewMode: boolean;
|
|
71
|
+
setIsPreviewMode: (preview: boolean) => void;
|
|
72
|
+
canvasZoom: number;
|
|
73
|
+
setCanvasZoom: (zoom: number | ((prev: number) => number)) => void;
|
|
74
|
+
isFitMode: boolean;
|
|
75
|
+
setIsFitMode: (fit: boolean) => void;
|
|
76
|
+
canvasPan: {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
};
|
|
80
|
+
setCanvasPan: React.Dispatch<React.SetStateAction<{
|
|
81
|
+
x: number;
|
|
82
|
+
y: number;
|
|
83
|
+
}>>;
|
|
84
|
+
canvasTool: CanvasToolMode;
|
|
85
|
+
setCanvasTool: (tool: CanvasToolMode) => void;
|
|
86
|
+
canvasViewMode: CanvasViewMode;
|
|
87
|
+
setCanvasViewMode: (mode: CanvasViewMode) => void;
|
|
88
|
+
setContainerSize: (size: {
|
|
89
|
+
width: number;
|
|
90
|
+
height: number;
|
|
91
|
+
}) => void;
|
|
92
|
+
zoomIn: (centerX?: number, centerY?: number) => void;
|
|
93
|
+
zoomOut: (centerX?: number, centerY?: number) => void;
|
|
94
|
+
setZoomCentered: (zoom: number, centerX?: number, centerY?: number) => void;
|
|
95
|
+
resetZoom100: (containerW?: number, containerH?: number) => void;
|
|
96
|
+
fitToPage: (containerW?: number, containerH?: number) => void;
|
|
97
|
+
fitAllFrames: (containerW?: number, containerH?: number) => void;
|
|
98
|
+
canvasCustomWidth: number | null;
|
|
99
|
+
setCanvasCustomWidth: (width: number | null) => void;
|
|
100
|
+
activeSidebarTab: LeftSidebarTab | null;
|
|
101
|
+
setActiveSidebarTab: (tab: LeftSidebarTab | null) => void;
|
|
102
|
+
toggleSidebarTab: (tab: LeftSidebarTab) => void;
|
|
103
|
+
isInspectorOpen: boolean;
|
|
104
|
+
setIsInspectorOpen: (open: boolean | ((prev: boolean) => boolean)) => void;
|
|
105
|
+
toggleInspector: () => void;
|
|
106
|
+
canUndo: boolean;
|
|
107
|
+
canRedo: boolean;
|
|
108
|
+
undo: () => void;
|
|
109
|
+
redo: () => void;
|
|
110
|
+
commitHistory: () => void;
|
|
111
|
+
resolveStyles: (node: DocumentNode) => ElementStyles;
|
|
112
|
+
isOverridden: (node: DocumentNode, propKey: keyof ElementStyles) => boolean;
|
|
113
|
+
getInheritedStyle: (node: DocumentNode, propKey: keyof ElementStyles) => any;
|
|
114
|
+
updateNodeStyles: (nodeId: string, styles: Partial<ElementStyles>) => void;
|
|
115
|
+
updateNodeStylesLive: (nodeId: string, styles: Partial<ElementStyles>) => void;
|
|
116
|
+
commitFreeMovement: (commit: FreeMovementCommit) => void;
|
|
117
|
+
resetResponsiveStyle: (nodeId: string, propKey: keyof ElementStyles) => void;
|
|
118
|
+
resetAllResponsiveOverrides: (nodeId: string) => void;
|
|
119
|
+
updateNodeResponsiveVisibility: (nodeId: string, visibility: Partial<ResponsiveVisibility>) => void;
|
|
120
|
+
updateNodeContent: (nodeId: string, content: string) => void;
|
|
121
|
+
updateNodeProps: (nodeId: string, props: Record<string, any>) => void;
|
|
122
|
+
deleteNode: (nodeId: string) => void;
|
|
123
|
+
deleteNodes: (nodeIds: string[]) => void;
|
|
124
|
+
duplicateNode: (nodeId: string) => void;
|
|
125
|
+
/** Returns the new element's id (undefined if the component is unknown). */
|
|
126
|
+
insertComponent: (parentId: string | null, componentId: string) => string | undefined;
|
|
127
|
+
/** Adds a ready-made section (e.g. from the host's library) to the page, with fresh ids. */
|
|
128
|
+
insertNodeTree: (tree: DocumentNode) => void;
|
|
129
|
+
/** Moves elements that sit outside a screen's visible canvas back inside it (one undo step). */
|
|
130
|
+
bringNodesIntoView: (ids: string[], viewport: ViewportMode) => void;
|
|
131
|
+
/** Adds a ready-made section (after `afterId`, else after the selected section, else at the end) and selects it. Returns its id. */
|
|
132
|
+
addBlockSection: (block: BlockSpec, afterId?: string) => string;
|
|
133
|
+
/** Where the next section from the Sections panel will land: after this section (`afterId`), or at the very top (`null`). `undefined` = after the selected section, else the end. */
|
|
134
|
+
sectionInsert: {
|
|
135
|
+
afterId: string | null;
|
|
136
|
+
} | null;
|
|
137
|
+
/** Opens the Sections panel remembering where to put what the person picks (`null` = at the top of the page). */
|
|
138
|
+
openSectionPicker: (afterId: string | null) => void;
|
|
139
|
+
/** Adds a new page built from a page template (SDK-owned pages only) and opens it. */
|
|
140
|
+
addPageFromTemplate: (templateId: string, name?: string) => string;
|
|
141
|
+
/** Fills the open (empty) page with a page template. One undo step. */
|
|
142
|
+
applyTemplateToPage: (templateId: string) => void;
|
|
143
|
+
/** Changes a section's layout, keeping its words. */
|
|
144
|
+
setSectionVariant: (sectionId: string, variant: string) => void;
|
|
145
|
+
setSectionContent: (sectionId: string, path: string, value: unknown) => void;
|
|
146
|
+
setSectionContentMany: (sectionId: string, patch: Record<string, unknown>) => void;
|
|
147
|
+
setSectionStyle: (sectionId: string, patch: Partial<BlockStyle>) => void;
|
|
148
|
+
/** Turns a ready-made section into ordinary elements that can be placed and styled freely. */
|
|
149
|
+
detachSection: (sectionId: string) => void;
|
|
150
|
+
/** Forgets the tweaks made to a section's elements (or one element), putting it back as designed. */
|
|
151
|
+
resetSectionTweaks: (sectionId: string, nodeId?: string) => void;
|
|
152
|
+
/** Applies changes SOL suggested (sections, pages, brand) as one undoable step, and reports what worked. */
|
|
153
|
+
applySolCommands: (commands: unknown[]) => CommandResult[];
|
|
154
|
+
/** Scales the desktop layout onto a tablet/mobile screen (keeping anything already placed by hand there). One undo step. */
|
|
155
|
+
adaptToScreen: (screen: 'tablet' | 'mobile') => void;
|
|
156
|
+
addSection: (name?: string) => void;
|
|
157
|
+
toggleNodeVisibility: (nodeId: string) => void;
|
|
158
|
+
toggleNodeLock: (nodeId: string) => void;
|
|
159
|
+
setContainerLayoutMode: (containerId: string, mode: LayoutMode) => void;
|
|
160
|
+
alignNodeInParent: (nodeId: string, alignment: 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom', parentWidth?: number, parentHeight?: number, nodeWidth?: number, nodeHeight?: number) => void;
|
|
161
|
+
bringForward: (nodeId: string) => void;
|
|
162
|
+
sendBackward: (nodeId: string) => void;
|
|
163
|
+
bringToFront: (nodeId: string) => void;
|
|
164
|
+
sendToBack: (nodeId: string) => void;
|
|
165
|
+
groupSelectedNodes: (nodeIds: string[]) => void;
|
|
166
|
+
ungroupNode: (containerId: string) => void;
|
|
167
|
+
snapToGrid: boolean;
|
|
168
|
+
setSnapToGrid: (snap: boolean) => void;
|
|
169
|
+
snapToElements: boolean;
|
|
170
|
+
setSnapToElements: (snap: boolean) => void;
|
|
171
|
+
gridSnapSize: number;
|
|
172
|
+
setGridSnapSize: (size: number) => void;
|
|
173
|
+
activeAlignmentGuides: AlignmentGuide[];
|
|
174
|
+
setActiveAlignmentGuides: (guides: AlignmentGuide[]) => void;
|
|
175
|
+
detachElementToFreePosition: (nodeId: string, renderedRect?: {
|
|
176
|
+
x: number;
|
|
177
|
+
y: number;
|
|
178
|
+
width?: number;
|
|
179
|
+
height?: number;
|
|
180
|
+
}) => void;
|
|
181
|
+
returnElementToStructuredLayout: (nodeId: string, targetIndex?: number) => void;
|
|
182
|
+
alignSelectedNodes: (alignment: 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom') => void;
|
|
183
|
+
distributeSelectedNodes: (axis: 'horizontal' | 'vertical') => void;
|
|
184
|
+
nudgeSelectedNodes: (direction: 'up' | 'down' | 'left' | 'right', isLarge: boolean) => void;
|
|
185
|
+
contextMenu: ContextMenuState;
|
|
186
|
+
openContextMenu: (nodeId: string | null, x: number, y: number) => void;
|
|
187
|
+
closeContextMenu: () => void;
|
|
188
|
+
}
|
|
189
|
+
export declare function findNode(root: DocumentNode, id: string): DocumentNode | null;
|
|
190
|
+
export declare function findParentNode(root: DocumentNode, childId: string): {
|
|
191
|
+
parent: DocumentNode;
|
|
192
|
+
index: number;
|
|
193
|
+
} | null;
|
|
194
|
+
export declare function isDescendant(root: DocumentNode, ancestorId: string, testChildId: string): boolean;
|
|
195
|
+
export declare function resolveNodeStyles(node: DocumentNode, viewport: ViewportMode): ElementStyles;
|
|
196
|
+
export declare function checkIsOverridden(node: DocumentNode, viewport: ViewportMode, propKey: keyof ElementStyles): boolean;
|
|
197
|
+
export declare function getInheritedValue(node: DocumentNode, viewport: ViewportMode, propKey: keyof ElementStyles): any;
|
|
198
|
+
export interface EditorProviderProps {
|
|
199
|
+
children: React.ReactNode;
|
|
200
|
+
/** The design to edit. Read once on mount; the editor owns the live copy after that. */
|
|
201
|
+
pages?: PageDefinition[];
|
|
202
|
+
/** Which page opens first (defaults to the home page, else the first). */
|
|
203
|
+
initialPageId?: string;
|
|
204
|
+
/** Fires (debounced) with every page, including unsaved edits on the open page. */
|
|
205
|
+
onChange?: (pages: PageDefinition[]) => void;
|
|
206
|
+
/** The site's design system. Read once on mount; the editor owns the live copy after that. Defaults to a built-in one. */
|
|
207
|
+
designSystem?: DesignSystem;
|
|
208
|
+
/** Fires (debounced) with the design system after each change. */
|
|
209
|
+
onDesignSystemChange?: (designSystem: DesignSystem) => void;
|
|
210
|
+
}
|
|
211
|
+
export declare const EditorProvider: React.FC<EditorProviderProps>;
|
|
212
|
+
export declare const useEditor: () => EditorContextType;
|
|
213
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type LayoutMode } from '../types/editor';
|
|
2
|
+
interface ParentLayoutContextValue {
|
|
3
|
+
layoutMode: LayoutMode;
|
|
4
|
+
parentId: string;
|
|
5
|
+
parentWidth?: number;
|
|
6
|
+
parentHeight?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const ParentLayoutContext: import("react").Context<ParentLayoutContextValue>;
|
|
9
|
+
export declare const useParentLayout: () => ParentLayoutContextValue;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Placement } from '../render/placement';
|
|
2
|
+
/** Which elements sit outside the visible canvas of the screen a frame shows (see render/placement). */
|
|
3
|
+
export declare const PlacementContext: import("react").Context<ReadonlyMap<string, Placement>>;
|
|
4
|
+
export declare const usePlacement: (id: string) => Placement | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type NodeType, type ElementStyles } from '../types/editor';
|
|
2
|
+
export interface InsertableComponentItem {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: NodeType;
|
|
6
|
+
icon: string;
|
|
7
|
+
category: 'layout' | 'typography' | 'media' | 'interactive';
|
|
8
|
+
badge?: string;
|
|
9
|
+
/** Not built yet — it would publish as an empty box, so the Add panel doesn't offer it. */
|
|
10
|
+
unavailable?: boolean;
|
|
11
|
+
defaultContent?: string;
|
|
12
|
+
defaultStyles: ElementStyles;
|
|
13
|
+
defaultProps?: Record<string, any>;
|
|
14
|
+
/** Fresh starter content each time (so a new timer counts down from now, not from when the app loaded). */
|
|
15
|
+
buildProps?: () => Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export declare const insertableComponents: InsertableComponentItem[];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { PageDefinition } from '../types/editor';
|
|
2
|
+
import type { DesignSystem, DesignToken } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* The design audit: finds every hard-coded colour, font, text size, line spacing, corner, shadow and spacing on the pages
|
|
5
|
+
* that the brand doesn't own yet, and offers to bring each one in (as a new brand value) or swap it for the closest value
|
|
6
|
+
* the brand already has. Pure and React-free, so a host or an AI can run it too.
|
|
7
|
+
*/
|
|
8
|
+
export type AuditKind = 'color' | 'font' | 'fontSize' | 'lineHeight' | 'radius' | 'shadow' | 'spacing';
|
|
9
|
+
export declare const AUDIT_KINDS: AuditKind[];
|
|
10
|
+
/** Plain words for each kind: `one`, `many`, and what a new one is called ("Accent 1"). */
|
|
11
|
+
export declare const AUDIT_KIND_LABELS: Record<AuditKind, {
|
|
12
|
+
one: string;
|
|
13
|
+
many: string;
|
|
14
|
+
nearest: string;
|
|
15
|
+
}>;
|
|
16
|
+
export type AuditAction = 'add' | 'match' | 'keep';
|
|
17
|
+
export type Closeness = 'almost identical' | 'very close' | 'close';
|
|
18
|
+
export interface AuditMatch {
|
|
19
|
+
tokenKey: string;
|
|
20
|
+
/** What to call it to a person ("Primary", "Neutral 900"). */
|
|
21
|
+
name: string;
|
|
22
|
+
closeness: Closeness;
|
|
23
|
+
}
|
|
24
|
+
export interface AuditFinding {
|
|
25
|
+
/** Stable for the same value, so a decision survives re-running the audit. */
|
|
26
|
+
id: string;
|
|
27
|
+
kind: AuditKind;
|
|
28
|
+
/** How the value is written on the page (the most used spelling). */
|
|
29
|
+
value: string;
|
|
30
|
+
/** Every spelling that was grouped into this finding. */
|
|
31
|
+
variants: string[];
|
|
32
|
+
uses: number;
|
|
33
|
+
/** Names of the pages it appears on. */
|
|
34
|
+
pages: string[];
|
|
35
|
+
/** One-offs (few uses) — worth a look, but not worth nagging about. */
|
|
36
|
+
minor: boolean;
|
|
37
|
+
/** The closest value the brand already has, when there is one close enough to swap in. */
|
|
38
|
+
match?: AuditMatch;
|
|
39
|
+
/** What "Add to my brand" would create. */
|
|
40
|
+
add: {
|
|
41
|
+
key: string;
|
|
42
|
+
name: string;
|
|
43
|
+
};
|
|
44
|
+
/** What we recommend. */
|
|
45
|
+
suggestion: {
|
|
46
|
+
action: 'add' | 'match';
|
|
47
|
+
plain: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface AuditReport {
|
|
51
|
+
findings: AuditFinding[];
|
|
52
|
+
byKind: Record<AuditKind, AuditFinding[]>;
|
|
53
|
+
counts: Record<AuditKind, number>;
|
|
54
|
+
total: number;
|
|
55
|
+
minorCount: number;
|
|
56
|
+
}
|
|
57
|
+
export interface AuditOptions {
|
|
58
|
+
/** Values used fewer times than this are marked `minor`. Default 2. */
|
|
59
|
+
minorBelow?: number;
|
|
60
|
+
}
|
|
61
|
+
export type AuditDecisions = Record<string, AuditAction>;
|
|
62
|
+
/** "Brand Primary 500" -> "Primary": what a person would call it. */
|
|
63
|
+
export declare function friendlyTokenName(t: Pick<DesignToken, 'name' | 'key'>): string;
|
|
64
|
+
export declare function colorDistance(a: string, b: string): number;
|
|
65
|
+
export declare function auditDesign(pages: PageDefinition[], ds: DesignSystem, options?: AuditOptions): AuditReport;
|
|
66
|
+
/** "3 colours, 1 font and 2 text sizes" — or an empty string when there is nothing. */
|
|
67
|
+
export declare function describeAudit(report: AuditReport): string;
|
|
68
|
+
/** What we'd do for each finding if the person just says "apply all": add the busy ones, swap near-misses, leave one-offs. */
|
|
69
|
+
export declare function suggestedDecisions(report: AuditReport): AuditDecisions;
|
|
70
|
+
/**
|
|
71
|
+
* Carries out the person's choices. `add` creates the value in the brand and points every use at it (the page looks the
|
|
72
|
+
* same); `match` points uses at the closest existing value (it looks nearly the same); `keep` leaves it. Immutable, and
|
|
73
|
+
* running it again changes nothing, because what's been fixed is no longer hard-coded.
|
|
74
|
+
*/
|
|
75
|
+
export declare function applyAuditFixes(pages: PageDefinition[], ds: DesignSystem, decisions: AuditDecisions, options?: AuditOptions): {
|
|
76
|
+
pages: PageDefinition[];
|
|
77
|
+
designSystem: DesignSystem;
|
|
78
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type BaselineToken = [key: string, name: string, value: string, type: string, unit: string | null, layer: 'brand' | 'semantic' | 'component', comment: string | null];
|
|
2
|
+
export declare const BASELINE_TOKENS: BaselineToken[];
|
|
3
|
+
export declare const BASELINE_COMPONENTS: Array<Record<string, unknown>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DesignSystem } from './types';
|
|
2
|
+
/** The variants a component defines (e.g. Alert → info, success, warning, error). */
|
|
3
|
+
export declare function componentVariants(ds: DesignSystem, name: string, role?: string): string[];
|
|
4
|
+
/**
|
|
5
|
+
* The CSS a design-system component gives one of its parts, in a given variant — values still reference tokens
|
|
6
|
+
* (`var(--color-state-info-bg)`), so they follow the brand. This is how Plexo's alerts, buttons and badges stay the same
|
|
7
|
+
* as Strata's: they are read from it, not copied.
|
|
8
|
+
*/
|
|
9
|
+
export declare function componentStyle(ds: DesignSystem, name: string, variant?: string, role?: string): Record<string, string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ViewportMode } from '../types/editor';
|
|
2
|
+
import type { DesignSystem } from './types';
|
|
3
|
+
/** Every token as a CSS custom property, exactly as Strata exports it. */
|
|
4
|
+
export declare function designSystemVars(ds: DesignSystem): Record<string, string>;
|
|
5
|
+
/** Plexo's own derived variables for one screen size: text styles, and how much air sections get. */
|
|
6
|
+
export declare function plexoVars(ds: DesignSystem, viewport: ViewportMode): Record<string, string>;
|
|
7
|
+
/** What the editor's frame for one screen size sets, so every element on it resolves tokens the way the published page will. */
|
|
8
|
+
export declare function frameVars(ds: DesignSystem, viewport: ViewportMode): Record<string, string>;
|
|
9
|
+
/** Google Fonts a page needs: the families behind the font tokens it uses, minus system fonts. */
|
|
10
|
+
export declare function fontsNeeded(ds: DesignSystem, css: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* The design system as CSS for a published page: only the variables the page uses (a page doesn't ship Strata's whole
|
|
13
|
+
* token set), on the page root; and text sizes that step down at tablet and phone widths. Container queries can't restyle
|
|
14
|
+
* their own container, so the step-downs are set on the root's children and inherited from there.
|
|
15
|
+
*/
|
|
16
|
+
export declare function designSystemCss(ds: DesignSystem, pageCss: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Fonts offered in the picker: a short, good list, each with a sensible fallback stack. */
|
|
2
|
+
export interface FontChoice {
|
|
3
|
+
name: string;
|
|
4
|
+
kind: 'sans' | 'serif' | 'display' | 'mono';
|
|
5
|
+
stack: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const FONT_CHOICES: FontChoice[];
|
|
8
|
+
/** The first family of a font stack, unquoted ("'Plus Jakarta Sans', ui-sans-serif…" → "Plus Jakarta Sans"). */
|
|
9
|
+
export declare function primaryFamily(stack: string): string;
|
|
10
|
+
export declare const stackFor: (name: string) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type { DesignSystem, DesignToken, DesignComponent, DesignOptions, StrataLink, TokenLayer, StrataNode, StrataProperty } from './types';
|
|
2
|
+
export { createDefaultDesignSystem } from './baseline';
|
|
3
|
+
export { tokenCssValue, ref, refKey, tokenMap, getToken, getValue, setToken, setTokens, removeToken, resolveValue, resolveKey, nameFromKey } from './tokens';
|
|
4
|
+
export { deriveShades, readableOn, tint } from './shades';
|
|
5
|
+
export { FONT_CHOICES, primaryFamily, stackFor, type FontChoice } from './fonts';
|
|
6
|
+
export { THEME_PRESETS, applyTheme, setPrimaryColor, setSecondaryColor, setNeutralScale, neutralScaleOf, setRoundness, roundnessOf, setFonts, setStatusColor, setDensity, type StatusKind, type ThemePreset, type NeutralScale, type Roundness } from './themes';
|
|
7
|
+
export { TEXT_STYLES, TEXT_STYLE_IDS, isTextStyle, textStyleDef, textStyleVars, textStyleCss, type TextStyleId, type TextStyleDef } from './textStyles';
|
|
8
|
+
export { designSystemVars, plexoVars, frameVars, designSystemCss, fontsNeeded } from './css';
|
|
9
|
+
export { componentStyle, componentVariants } from './components';
|
|
10
|
+
export { lintDesignSystem, repairDesignSystem, type DesignSystemIssue, type IssueKind } from './lint';
|
|
11
|
+
export { auditDesign, applyAuditFixes, 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';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DesignSystem } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks a design system against what CSS custom properties and design-token practice actually require, so a problem is
|
|
4
|
+
* found and fixed at its source instead of being copied from one system to the next. Every issue says, in plain words,
|
|
5
|
+
* what is wrong and what to do.
|
|
6
|
+
*/
|
|
7
|
+
export type IssueKind = 'dangling-reference' | 'unit-on-reference' | 'brand-references-token' | 'circular-reference' | 'duplicate-key' | 'invalid-color' | 'bad-key';
|
|
8
|
+
export interface DesignSystemIssue {
|
|
9
|
+
kind: IssueKind;
|
|
10
|
+
key: string;
|
|
11
|
+
message: string;
|
|
12
|
+
/** Can `repairDesignSystem` fix it without asking? */
|
|
13
|
+
fixable: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function lintDesignSystem(ds: DesignSystem): DesignSystemIssue[];
|
|
16
|
+
/**
|
|
17
|
+
* Fixes what can be fixed without asking: drops units from tokens that point at other tokens, drops duplicate keys (the
|
|
18
|
+
* first wins), gives brand tokens real values instead of references, defines the heading/body font tokens that semantic
|
|
19
|
+
* font tokens point at, and renames tokens older design systems got wrong. Returns the same object when nothing needed
|
|
20
|
+
* fixing, so it is safe to run on every load.
|
|
21
|
+
*/
|
|
22
|
+
export declare function repairDesignSystem(ds: DesignSystem): DesignSystem;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The light and dark shades Strata keeps beside a brand colour (300 and 700), worked out from the one colour a person
|
|
3
|
+
* picks — so choosing "primary" is enough and every hover, tint and border follows.
|
|
4
|
+
*/
|
|
5
|
+
export declare function deriveShades(hex: string): {
|
|
6
|
+
light: string;
|
|
7
|
+
base: string;
|
|
8
|
+
dark: string;
|
|
9
|
+
} | null;
|
|
10
|
+
/** White or near-black, whichever reads better on `background`. */
|
|
11
|
+
export declare function readableOn(background: string): '#FFFFFF' | '#111827';
|
|
12
|
+
/** A brand colour with its saturation nudged — used to keep derived tints from looking washed out. */
|
|
13
|
+
export declare function withSaturation(hex: string, factor: number): string;
|
|
14
|
+
/** Mixes a colour towards white (`amount` 0–1): the pale background that goes with a status colour. */
|
|
15
|
+
export declare function tint(hex: string, amount: number): string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ViewportMode } from '../types/editor';
|
|
2
|
+
/**
|
|
3
|
+
* Text styles: named, token-driven typography ("Heading 1", "Body") that elements point at, instead of carrying their own
|
|
4
|
+
* font sizes. Change the design system's fonts or sizes and every piece of text follows; on a phone the big ones step down
|
|
5
|
+
* on their own. They are derived from the tokens, so there is nothing extra to keep in sync with Strata.
|
|
6
|
+
*/
|
|
7
|
+
export type TextStyleId = 'display' | 'h1' | 'h2' | 'h3' | 'h4' | 'lead' | 'body' | 'small' | 'eyebrow';
|
|
8
|
+
export interface TextStyleDef {
|
|
9
|
+
id: TextStyleId;
|
|
10
|
+
label: string;
|
|
11
|
+
hint: string;
|
|
12
|
+
/** Desktop, tablet, mobile font size as CSS over Strata's size tokens. */
|
|
13
|
+
size: Record<ViewportMode, string>;
|
|
14
|
+
weight: string;
|
|
15
|
+
line: string;
|
|
16
|
+
family: 'heading' | 'body';
|
|
17
|
+
letterSpacing?: string;
|
|
18
|
+
textTransform?: string;
|
|
19
|
+
/** The HTML heading level text with this style should use, if any. */
|
|
20
|
+
tag?: 1 | 2 | 3 | 4;
|
|
21
|
+
}
|
|
22
|
+
export declare const TEXT_STYLES: TextStyleDef[];
|
|
23
|
+
export declare const TEXT_STYLE_IDS: TextStyleId[];
|
|
24
|
+
export declare const isTextStyle: (v: unknown) => v is TextStyleId;
|
|
25
|
+
export declare const textStyleDef: (id: TextStyleId) => TextStyleDef;
|
|
26
|
+
/** The CSS custom properties that define every text style for one screen size. */
|
|
27
|
+
export declare function textStyleVars(viewport: ViewportMode): Record<string, string>;
|
|
28
|
+
/** What a style sets on an element — all by reference to the variables above. */
|
|
29
|
+
export declare function textStyleCss(id: TextStyleId): Record<string, string>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { DesignSystem } from './types';
|
|
2
|
+
export type NeutralScale = 'cool' | 'warm' | 'dark';
|
|
3
|
+
export type Roundness = 'sharp' | 'soft' | 'round';
|
|
4
|
+
/** A brand colour: sets 300/500/700, and keeps button text readable on it. */
|
|
5
|
+
export declare function setPrimaryColor(ds: DesignSystem, hex: string): DesignSystem;
|
|
6
|
+
export declare function setSecondaryColor(ds: DesignSystem, hex: string): DesignSystem;
|
|
7
|
+
/** Which scale the neutrals currently are (so the panel can show it). */
|
|
8
|
+
export declare function neutralScaleOf(ds: DesignSystem): NeutralScale;
|
|
9
|
+
export declare function setNeutralScale(ds: DesignSystem, scale: NeutralScale): DesignSystem;
|
|
10
|
+
export declare function setRoundness(ds: DesignSystem, roundness: Roundness): DesignSystem;
|
|
11
|
+
export declare function roundnessOf(ds: DesignSystem): Roundness;
|
|
12
|
+
export declare function setFonts(ds: DesignSystem, fonts: {
|
|
13
|
+
heading?: string;
|
|
14
|
+
body?: string;
|
|
15
|
+
}): DesignSystem;
|
|
16
|
+
export interface ThemePreset {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
primary: string;
|
|
21
|
+
secondary: string;
|
|
22
|
+
neutrals: NeutralScale;
|
|
23
|
+
roundness: Roundness;
|
|
24
|
+
fonts: {
|
|
25
|
+
heading: string;
|
|
26
|
+
body: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare const THEME_PRESETS: ThemePreset[];
|
|
30
|
+
/** One click restyles the whole site: colours, neutrals, corners and fonts together. */
|
|
31
|
+
export declare function applyTheme(ds: DesignSystem, theme: ThemePreset): DesignSystem;
|
|
32
|
+
export type StatusKind = 'success' | 'warning' | 'error' | 'info';
|
|
33
|
+
/** A status colour (used by alerts and badges): the strong colour, and its pale background worked out from it. */
|
|
34
|
+
export declare function setStatusColor(ds: DesignSystem, kind: StatusKind, hex: string): DesignSystem;
|
|
35
|
+
export declare function setDensity(ds: DesignSystem, density: 'compact' | 'comfortable' | 'spacious'): DesignSystem;
|
|
@@ -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;
|