@charisol/plexo-sdk 2.0.12 → 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.
- package/dist/plexo-sdk.css +1 -1
- package/dist/{v1-CvwbXOzF.js → v1-CMpjMZtt.js} +1551 -1470
- package/dist/v2/design/css.d.ts +6 -0
- package/dist/v2/design/index.d.ts +2 -2
- package/dist/v2/design/shades.d.ts +6 -0
- package/dist/v2/design/themes.d.ts +12 -1
- package/dist/v2/design/types.d.ts +2 -0
- package/dist/v2-compile.js +6 -6
- package/dist/v2.js +1015 -980
- package/package.json +1 -1
package/dist/v2/design/css.d.ts
CHANGED
|
@@ -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
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 {
|
package/dist/v2-compile.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, At as t, C as n, Cn as r, Dt as i, E as a,
|
|
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 =
|
|
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
|
|
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 =
|
|
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 = ${
|
|
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 {
|
|
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 };
|