@charisol/plexo-sdk 2.0.11 → 2.0.13

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.
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { type AuditDecisions, type AuditReport } from '../../design';
3
3
  /** Nothing to tidy: say so, kindly. */
4
4
  export declare const TidyEmpty: React.FC;
5
- /** The card that offers the clean-up. */
5
+ /** The card that offers the clean-up. Once the values that matter are in the brand it says so (one-offs stay quietly available). */
6
6
  export declare const TidyCard: React.FC<{
7
7
  report: AuditReport;
8
8
  onOpen: () => void;
@@ -76,3 +76,17 @@ export declare function applyAuditFixes(pages: PageDefinition[], ds: DesignSyste
76
76
  pages: PageDefinition[];
77
77
  designSystem: DesignSystem;
78
78
  };
79
+ /**
80
+ * Hooks the page up to the brand wherever a colour or font is written out in full but is exactly a value the brand already
81
+ * holds (a template that wrote "#1C1B19" where the brand's own dark is "#1C1B19"). Nothing looks different, but from then on
82
+ * a quick look or a colour change moves those places too instead of leaving them behind. Returns the same pages when there
83
+ * was nothing to hook up.
84
+ */
85
+ export declare function linkExactValues(pages: PageDefinition[], ds: DesignSystem): PageDefinition[];
86
+ /**
87
+ * A template's own accent colours (its greens, golds, blues…) are written out in full, so a quick look would leave them
88
+ * untouched. This ties the page's two most used accent hues to the brand's Main and Accent colours (lighter and darker shades
89
+ * of the same hue follow Main's lighter and darker shades), so choosing a look really recolours the page. Greys, blacks,
90
+ * whites, photos and any third hue are left alone. Returns the same pages when there is nothing to tie.
91
+ */
92
+ export declare function linkAccentsToBrand(pages: PageDefinition[], ds: DesignSystem): PageDefinition[];
@@ -6,6 +6,12 @@ export declare function designSystemVars(ds: DesignSystem): Record<string, strin
6
6
  export declare function plexoVars(ds: DesignSystem, viewport: ViewportMode): Record<string, string>;
7
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
8
  export declare function frameVars(ds: DesignSystem, viewport: ViewportMode): Record<string, string>;
9
+ /**
10
+ * What the editor's frame for one screen size sets: Plexo's own variables, plus only the design-system tokens the page (and the
11
+ * editor's own chrome) actually use. Setting every token on the frame — fine for a few hundred — would be an element with
12
+ * thousands or millions of custom properties, which is what brings a browser to its knees on a very large brand.
13
+ */
14
+ export declare function frameVarsFor(ds: DesignSystem, viewport: ViewportMode, usedCss: string): Record<string, string>;
9
15
  /** Font families (Google or uploaded) a page needs: the families behind the font tokens it uses, minus system fonts. */
10
16
  export declare function fontsNeeded(ds: DesignSystem, css: string): string[];
11
17
  /**
@@ -4,11 +4,11 @@ export { tokenCssValue, ref, refKey, tokenMap, getToken, getValue, setToken, set
4
4
  export { deriveShades, readableOn, tint } from './shades';
5
5
  export { FONT_CHOICES, POPULAR_FONTS, primaryFamily, stackFor, findFont, isSystemFont, isLoadableFamily, weightsToLoad, googleFontsHrefs, googleFontPreviewHref, type FontChoice, type FontKind, type FontRequest } from './fonts';
6
6
  export { sanitizeCustomFonts, customFontFaceCss, addCustomFont, removeCustomFont, findCustomFont, customFontsOf, guessFontFromFile, isFontUrl, MAX_CUSTOM_FONTS, MAX_FONT_VARIANTS, MAX_FONT_FILE_BYTES, FONT_FILE_ACCEPT, WEIGHT_LABELS, type CustomFont, type CustomFontVariant, type CustomFontFormat } from './customFonts';
7
- 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 { THEME_PRESETS, applyTheme, setPrimaryColor, setSecondaryColor, setNeutralScale, setBrandSurfaces, previewSurfaces, neutralScaleOf, setRoundness, roundnessOf, setFonts, setStatusColor, setDensity, type StatusKind, type ThemePreset, type NeutralScale, type Roundness } from './themes';
8
8
  export { effectiveTypeMetrics, evalCssLength, textStyleOf, ROOT_FONT_PX, type TypeMetrics } from './typeScale';
9
9
  export { levelTextStyle, isHeadingTextStyle } from './textStyles';
10
10
  export { TEXT_STYLES, TEXT_STYLE_IDS, isTextStyle, textStyleDef, textStyleVars, textStyleCss, type TextStyleId, type TextStyleDef } from './textStyles';
11
- export { designSystemVars, plexoVars, frameVars, designSystemCss, fontsNeeded } from './css';
11
+ export { designSystemVars, plexoVars, frameVars, frameVarsFor, designSystemCss, fontsNeeded } from './css';
12
12
  export { componentStyle, componentVariants } from './components';
13
13
  export { lintDesignSystem, repairDesignSystem, type DesignSystemIssue, type IssueKind } from './lint';
14
- 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';
14
+ export { auditDesign, applyAuditFixes, linkExactValues, linkAccentsToBrand, describeAudit, suggestedDecisions, friendlyTokenName, colorDistance, AUDIT_KINDS, AUDIT_KIND_LABELS, type AuditKind, type AuditAction, type AuditFinding, type AuditReport, type AuditOptions, type AuditDecisions, type AuditMatch, type Closeness } from './audit';
@@ -21,3 +21,9 @@ export declare function accessibleTextOn(background: string, preferred?: string)
21
21
  export declare function withSaturation(hex: string, factor: number): string;
22
22
  /** Mixes a colour towards white (`amount` 0–1): the pale background that goes with a status colour. */
23
23
  export declare function tint(hex: string, amount: number): string;
24
+ /**
25
+ * A grey ramp tinted with the brand's hue, lightest to darkest (the 11 steps of the neutral scale): near-white tints for pages
26
+ * and cards, and a deep, saturated brand colour at the dark end, so a template's dark sections (its "ink") become the brand
27
+ * colour instead of a plain black. A brand with little colour of its own (grey, near-black) gets a quieter ramp.
28
+ */
29
+ export declare function brandNeutrals(hex: string): string[] | null;
@@ -1,5 +1,5 @@
1
1
  import type { DesignSystem } from './types';
2
- export type NeutralScale = 'cool' | 'warm' | 'dark';
2
+ export type NeutralScale = 'cool' | 'warm' | 'dark' | 'brand';
3
3
  export type Roundness = 'sharp' | 'soft' | 'round';
4
4
  /** A brand colour: sets 300/500/700, and keeps button text readable on it. */
5
5
  export declare function setPrimaryColor(ds: DesignSystem, hex: string): DesignSystem;
@@ -7,6 +7,17 @@ export declare function setSecondaryColor(ds: DesignSystem, hex: string): Design
7
7
  /** Which scale the neutrals currently are (so the panel can show it). */
8
8
  export declare function neutralScaleOf(ds: DesignSystem): NeutralScale;
9
9
  export declare function setNeutralScale(ds: DesignSystem, scale: NeutralScale): DesignSystem;
10
+ /**
11
+ * Colours the page's big dark sections with the brand: the greys are tinted with the brand colour, deepest at the dark end, so
12
+ * a template's "ink" sections become deep brand blue (or green, or whatever the brand is) and white pages stay clean. Turning it
13
+ * off goes back to the plain greys of the look that is applied.
14
+ */
15
+ export declare function setBrandSurfaces(ds: DesignSystem, on: boolean): DesignSystem;
16
+ /** The two surfaces a look gives a page, for its preview: the page itself, and a dark section on it. */
17
+ export declare function previewSurfaces(theme: ThemePreset, brandSurfaces: boolean): {
18
+ page: string;
19
+ section: string;
20
+ };
10
21
  export declare function setRoundness(ds: DesignSystem, roundness: Roundness): DesignSystem;
11
22
  export declare function roundnessOf(ds: DesignSystem): Roundness;
12
23
  export declare function setFonts(ds: DesignSystem, fonts: {
@@ -53,6 +53,8 @@ export interface DesignOptions {
53
53
  density?: 'compact' | 'comfortable' | 'spacious';
54
54
  /** The preset last applied, for showing which one is active. */
55
55
  themeId?: string;
56
+ /** The page's big dark sections wear the brand colour (the greys are tinted with it) instead of a plain black. */
57
+ brandSurfaces?: boolean;
56
58
  }
57
59
  /** Where this design system is linked in Strata, plus what both sides agreed on at the last sync. */
58
60
  export interface StrataLink {
@@ -1,4 +1,4 @@
1
- import { $ as e, A as t, C as n, Ct as r, Dt as i, E as a, Et as o, N as s, Ot as c, P as l, St as u, Tt as d, _ as f, a as p, at as m, c as h, d as g, et as _, f as v, g as y, gn as b, h as x, i as S, it as C, j as w, kt as T, l as E, m as D, n as O, nt as ee, o as k, on as A, ot as j, p as M, r as N, rt as P, s as F, sn as I, st as L, t as R, tt as z, u as B, v as V, vn as H, wt as U, xn as W, yn as G } from "./v1-IIzUA4pk.js";
1
+ import { A as e, At as t, C as n, Cn as r, Dt as i, E as a, En as o, Mt as s, N as c, Nt as l, Ot as u, P as d, Pt as f, _ as p, a as m, at as h, c as g, ct as _, d as v, dn as y, f as b, fn as x, g as S, h as C, i as w, it as T, j as E, jt as D, kt as O, l as ee, lt as k, m as A, n as j, nt as M, o as N, ot as P, p as F, r as I, rt as L, s as R, st as z, t as B, u as V, ut as H, v as U, wn as W, xn as G } from "./v1-CMpjMZtt.js";
2
2
  import { n as K, t as q } from "./lint-BWdiaRwp.js";
3
3
  //#region src/v2/compile/react.ts
4
4
  var J = /^[A-Z][A-Za-z0-9]*$/, Y = (e) => JSON.stringify(e);
@@ -6,7 +6,7 @@ function X(e) {
6
6
  let t = "";
7
7
  for (let [n, r] of Object.entries(e.attrs ?? {})) {
8
8
  if (r === void 0 || r === !1) continue;
9
- let e = I(n);
9
+ let e = x(n);
10
10
  r === !0 ? t += ` ${e}` : typeof r == "number" ? t += ` ${e}={${r}}` : t += ` ${e}={${Y(String(r))}}`;
11
11
  }
12
12
  return e.style && (t += ` style={${JSON.stringify(e.style)}}`), t;
@@ -15,7 +15,7 @@ function Z(e, t) {
15
15
  let n = " ".repeat(t);
16
16
  if (typeof e == "string") return `${n}{${Y(e)}}`;
17
17
  let r = X(e);
18
- return A.has(e.tag) || !e.children?.length ? `${n}<${e.tag}${r} />` : `${n}<${e.tag}${r}>\n${e.children.map((e) => Z(e, t + 1)).join("\n")}\n${n}</${e.tag}>`;
18
+ return y.has(e.tag) || !e.children?.length ? `${n}<${e.tag}${r} />` : `${n}<${e.tag}${r}>\n${e.children.map((e) => Z(e, t + 1)).join("\n")}\n${n}</${e.tag}>`;
19
19
  }
20
20
  function Q(e) {
21
21
  let t = e.replace(/[^A-Za-z0-9]+/g, " ").trim().split(" ").filter(Boolean).map((e) => e[0].toUpperCase() + e.slice(1)).join("");
@@ -23,14 +23,14 @@ function Q(e) {
23
23
  }
24
24
  function $(e, t) {
25
25
  if (!J.test(t.componentName)) throw Error(`"${t.componentName}" isn't a valid component name — use PascalCase letters and numbers.`);
26
- let n = V(e, t), r = t.runtime !== "none" && n.usesRuntime, i = n.fontLinks, a = "`" + n.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
26
+ let n = U(e, t), r = t.runtime !== "none" && n.usesRuntime, i = n.fontLinks, a = "`" + n.css.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${") + "`";
27
27
  return {
28
28
  code: `// Generated by Plexo from a visual design. Edit it visually in the app editor's Design view
29
29
  // (which regenerates this file), or turn it into regular code by editing here.
30
30
  ${r ? "// @ts-nocheck — the small runtime below is plain JavaScript.\nimport { useEffect, useRef } from \"react\";" : "import type { ReactElement } from \"react\";"}
31
31
 
32
32
  const CSS = ${a};
33
- ${i.length ? `const FONTS: string[] = ${JSON.stringify(i)};\n` : ""}${r ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${l};\n` : ""}
33
+ ${i.length ? `const FONTS: string[] = ${JSON.stringify(i)};\n` : ""}${r ? `\n/** Carousel autoplay, the live timer and in-page form sending. */\nconst plexoInit = ${d};\n` : ""}
34
34
  export default function ${t.componentName}()${r ? "" : ": ReactElement"} {
35
35
  ${r ? " const root = useRef<HTMLDivElement>(null);\n useEffect(() => (root.current ? plexoInit(root.current) : undefined), []);\n" : ""} return (
36
36
  <>
@@ -44,4 +44,4 @@ ${r ? Z(n.tree, 3).replace("<div", "<div ref={root}") : Z(n.tree, 3)}
44
44
  };
45
45
  }
46
46
  //#endregion
47
- export { D as EMAIL_WIDTH, H as FRAME_WIDTH, t as MAX_CUSTOM_JS, S as MAX_DEPTH, p as MAX_NODES, G as MEDIA_QUERY, r as PAGE_TEMPLATES, e as SOL_SYSTEM_PROMPT, R as V1_DYNAMIC_EQUIVALENTS, O as V2_DYNAMIC_READY, ee as applyCommands, g as blankEmailPages, m as blankPages, U as buildPageFromTemplate, d as buildTemplateSections, u as catalogSchema, M as compilePageToEmail, y as compilePageToHtml, $ as compilePageToReact, Q as componentNameFor, b as computePlacements, E as convertLegacyDesign, N as convertV1Design, W as createDefaultDesignSystem, _ as describeCommand, j as describeDesign, L as describeSection, x as emailIssues, o as getPageTemplate, B as isLegacyDesign, i as isPageEmpty, q as lintDesignSystem, c as listPageTemplates, k as parsePages, z as parseSolReply, a as parseVideoUrl, w as prepareCustomJs, f as printHtml, K as repairDesignSystem, n as resolveFormDestination, F as sanitizeCss, h as sanitizeV2Html, P as setPageTemplateResolver, C as solCommandSchema, v as starterEmailPages, T as templateSeed, s as validHtmlId };
47
+ export { A as EMAIL_WIDTH, r as FRAME_WIDTH, e as MAX_CUSTOM_JS, w as MAX_DEPTH, m as MAX_NODES, W as MEDIA_QUERY, u as PAGE_TEMPLATES, M as SOL_SYSTEM_PROMPT, B as V1_DYNAMIC_EQUIVALENTS, j as V2_DYNAMIC_READY, h as applyCommands, v as blankEmailPages, _ as blankPages, O as buildPageFromTemplate, t as buildTemplateSections, i as catalogSchema, F as compilePageToEmail, S as compilePageToHtml, $ as compilePageToReact, Q as componentNameFor, G as computePlacements, ee as convertLegacyDesign, I as convertV1Design, o as createDefaultDesignSystem, L as describeCommand, k as describeDesign, H as describeSection, C as emailIssues, D as getPageTemplate, V as isLegacyDesign, s as isPageEmpty, q as lintDesignSystem, l as listPageTemplates, N as parsePages, T as parseSolReply, a as parseVideoUrl, E as prepareCustomJs, p as printHtml, K as repairDesignSystem, n as resolveFormDestination, R as sanitizeCss, g as sanitizeV2Html, P as setPageTemplateResolver, z as solCommandSchema, b as starterEmailPages, f as templateSeed, c as validHtmlId };