@charisol/plexo-sdk 2.0.5 → 2.0.6

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.
@@ -9,6 +9,14 @@ export declare function deriveShades(hex: string): {
9
9
  } | null;
10
10
  /** White or near-black, whichever reads better on `background`. */
11
11
  export declare function readableOn(background: string): '#FFFFFF' | '#111827';
12
+ /** WCAG contrast ratio between two colours (1 to 21), or null if either can't be read as a plain colour. */
13
+ export declare function contrastRatio(a: string, b: string): number | null;
14
+ /**
15
+ * The text colour (white or near-black) that reads best on `background` — whichever has the higher contrast, so a
16
+ * light fill like brass or lime gets dark text. If `preferred` (say the design system's own "text on buttons" colour)
17
+ * already meets AA (4.5:1) on it, that wins.
18
+ */
19
+ export declare function accessibleTextOn(background: string, preferred?: string): string | null;
12
20
  /** A brand colour with its saturation nudged — used to keep derived tints from looking washed out. */
13
21
  export declare function withSaturation(hex: string, factor: number): string;
14
22
  /** Mixes a colour towards white (`amount` 0–1): the pale background that goes with a status colour. */
@@ -18,6 +18,19 @@ interface Ctx {
18
18
  export declare function evalCssLength(input: string, ctx: Pick<Ctx, 'width' | 'fontPx'> & {
19
19
  tokens?: Map<string, DesignToken>;
20
20
  }): number | null;
21
+ /**
22
+ * Big sizes set directly on an element (a 96px number, a 4.5rem headline) would otherwise stay that big on a phone. Text that
23
+ * follows a text style already steps down; this does the same for explicit sizes: anything over 40px shrinks (to 80% on a
24
+ * tablet, 60% on a phone) but never below 40px, and nothing at or under 40px changes. An element that sets its own size for
25
+ * a screen keeps it — this only fills the gap when the owner hasn't chosen one.
26
+ */
27
+ export declare const STEP_DOWN: Record<'tablet' | 'mobile', number>;
28
+ /** Does this element take its font size from a bigger screen (so it should be stepped down), rather than choosing its own for `viewport`? */
29
+ export declare function fontSizeSteps(node: Pick<DocumentNode, 'responsive'>, viewport: ViewportMode): viewport is 'tablet' | 'mobile';
30
+ /** The size in pixels after stepping down (see STEP_DOWN). */
31
+ export declare function stepDownPx(px: number, viewport: 'tablet' | 'mobile'): number;
32
+ /** The same step-down for a CSS size value. Plain px/rem sizes are worked out; token and calc() sizes become a CSS max()/min() so they follow the design system. Anything else is left alone. */
33
+ export declare function stepDownFontSize(value: string, viewport: 'tablet' | 'mobile'): string;
21
34
  export interface TypeMetrics {
22
35
  /** Real size in pixels (rounded to 0.1). */
23
36
  fontSize: number;
@@ -39,5 +52,5 @@ export interface TypeMetrics {
39
52
  /** The text style a node follows: its own, or for a heading with none, the style for its level. */
40
53
  export declare function textStyleOf(node: Pick<DocumentNode, 'type' | 'props'>, styles: ElementStyles): TextStyleId | null;
41
54
  /** Works out what the text really looks like on one screen — what the Typography panel shows. */
42
- export declare function effectiveTypeMetrics(node: Pick<DocumentNode, 'type' | 'props'>, styles: ElementStyles, ds: DesignSystem, viewport: ViewportMode): TypeMetrics;
55
+ export declare function effectiveTypeMetrics(node: Pick<DocumentNode, 'type' | 'props'> & Partial<Pick<DocumentNode, 'responsive'>>, styles: ElementStyles, ds: DesignSystem, viewport: ViewportMode): TypeMetrics;
43
56
  export {};
@@ -71,6 +71,12 @@ export interface FormProps {
71
71
  /** Where submissions are sent. Empty → the host's form endpoint (see compile options). */
72
72
  action?: string;
73
73
  successMessage?: string;
74
+ /** The send button's fill (a colour or a design-system colour like `var(--color-brand-primary-500)`). Empty → the site's main colour. */
75
+ buttonColor?: string;
76
+ /** The send button's label colour. Empty → picked automatically so it stays readable on the fill. */
77
+ buttonTextColor?: string;
78
+ /** The send button's corners: `0px`, `8px`, `999px`… (or a design-system radius). Empty → the default. */
79
+ buttonRadius?: string;
74
80
  }
75
81
  export interface AccordionItem {
76
82
  title: string;
@@ -3,3 +3,7 @@ export declare const ICONS: Record<string, IconShape[]>;
3
3
  /** Icon names in the order the picker shows them, by theme. */
4
4
  export declare const ICON_GROUPS: Record<string, string[]>;
5
5
  export declare const ICON_NAMES: string[];
6
+ /** What an icon name we don't have draws: a plain ring, so a mistyped name looks neutral rather than like a star. */
7
+ export declare const FALLBACK_ICON: IconShape[];
8
+ /** The shapes for an icon name. No name at all is the star (the default icon); a name we don't have is a plain ring. */
9
+ export declare function iconShapes(name: unknown): IconShape[];
@@ -4,8 +4,19 @@ export declare const escapeAttr: (s: string) => string;
4
4
  export declare function safeHref(value: unknown): string;
5
5
  /** An image address: http(s), relative, or an embedded raster/SVG image. Empty/unsafe → '' (the builders show a placeholder). */
6
6
  export declare function safeImageSrc(value: unknown): string;
7
+ /**
8
+ * The address inside a section/element `backgroundImage` value. Accepts a plain address (`https://…/a.jpg`, `/a.jpg`) or the
9
+ * standard CSS form `url("…")` / `url('…')` / `url(…)`, and returns just the address — or '' when it isn't a safe image address
10
+ * (only https/http, site-relative and embedded `data:image` are allowed; no `javascript:`, no other schemes, and no `;`, braces,
11
+ * angle brackets or backslashes in an ordinary address).
12
+ */
13
+ export declare function backgroundImageAddress(value: unknown): string;
7
14
  /** A CSS colour: hex, rgb()/hsl() with plain numbers, or a named colour. Otherwise undefined. */
8
15
  export declare function safeColor(value: unknown): string | undefined;
16
+ /** A colour, or one design-system colour reference (`var(--color-brand-primary-500)`) — what a style value that may point at a token can be. */
17
+ export declare function safeColorOrToken(value: unknown): string | undefined;
18
+ /** A corner radius: a length (`12px`, `0.5rem`, `999px`) or a design-system radius reference. */
19
+ export declare function safeRadius(value: unknown): string | undefined;
9
20
  /** Space-separated class names made only of letters, digits and `_ - : / [ ] . % # !` — enough for utility classes, no quotes or spaces inside a token. */
10
21
  export declare function safeClassList(value: unknown): string;
11
22
  /** An identifier safe for ids, form field names and class suffixes. */
@@ -4,6 +4,8 @@ export type SizingMode = 'hug' | 'fill' | 'fixed';
4
4
  export type LayoutMode = 'flow' | 'grid' | 'free';
5
5
  export type HorizontalConstraint = 'left' | 'right' | 'center' | 'stretch' | 'scale';
6
6
  export type VerticalConstraint = 'top' | 'bottom' | 'center' | 'stretch' | 'scale';
7
+ /** Cross-axis alignment values (`start`/`end` follow reading direction; `baseline` lines text up). */
8
+ export type AlignValue = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'start' | 'end' | 'baseline';
7
9
  export interface ElementStyles {
8
10
  layoutMode?: LayoutMode;
9
11
  position?: 'static' | 'relative' | 'absolute';
@@ -40,12 +42,17 @@ export interface ElementStyles {
40
42
  display?: 'block' | 'flex' | 'grid' | 'inline-block' | 'inline-flex';
41
43
  flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
42
44
  justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around';
43
- alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch';
45
+ alignItems?: AlignValue;
46
+ /** Where rows of a wrapped or grid layout sit when the box is taller than they need: `start` keeps them together at the top. */
47
+ alignContent?: 'start' | 'center' | 'end' | 'stretch' | 'space-between' | 'flex-start' | 'flex-end';
48
+ /** How this one element lines up inside a flex or grid parent, overriding the parent's `alignItems`. */
49
+ alignSelf?: AlignValue;
44
50
  gap?: string;
45
51
  width?: string;
46
52
  customWidth?: string;
47
53
  isFullWidth?: boolean;
48
54
  maxWidth?: string;
55
+ minWidth?: string;
49
56
  height?: string;
50
57
  minHeight?: string;
51
58
  maxHeight?: string;
@@ -88,6 +95,14 @@ export interface ElementStyles {
88
95
  borderStyle?: 'solid' | 'dashed' | 'dotted' | 'none';
89
96
  borderColor?: string;
90
97
  boxShadow?: string;
98
+ /** What happens to content that spills out of the box. */
99
+ overflow?: 'hidden' | 'visible' | 'auto' | 'clip';
100
+ /** `nowrap` keeps a line of text on one line. */
101
+ whiteSpace?: 'normal' | 'nowrap';
102
+ /** Which part of a picture stays in view when it is cropped to fit: `center`, `top`, `20% 30%`… */
103
+ objectPosition?: string;
104
+ /** Frosted-glass blur behind the box, in px (0 to 40) — for a translucent header or card over a picture. */
105
+ backdropFilter?: number;
91
106
  linkColor?: string;
92
107
  linkHoverColor?: string;
93
108
  underlineLinks?: boolean;
@@ -1,4 +1,4 @@
1
- import { $ as e, $t as t, C as n, D as r, E as i, J as a, K as o, Q as s, Qt as c, St as l, X as u, Y as d, Z as f, _t as p, a as m, bt as h, c as g, cn as _, d as v, dn as y, et as b, f as x, g as S, gt as C, ht as w, i as T, l as E, n as D, o as O, p as k, pn as A, q as j, r as M, s as N, t as P, u as F, un as I, vt as L, w as R, xt as z, y as B, yt as V } from "./v1-DgwxU8IH.js";
1
+ import { $ as e, $t as t, C as n, D as r, E as i, J as a, K as o, Q as s, Qt as c, St as l, X as u, Y as d, Z as f, _t as p, a as m, bt as h, c as g, cn as _, d as v, dn as y, et as b, f as x, g as S, gt as C, ht as w, i as T, l as E, n as D, o as O, p as k, pn as A, q as j, r as M, s as N, t as P, u as F, un as I, vt as L, w as R, xt as z, y as B, yt as V } from "./v1-C2tXaSOb.js";
2
2
  import { n as H, t as U } from "./lint-CTTecyu_.js";
3
3
  //#region src/v2/compile/react.ts
4
4
  var W = /^[A-Z][A-Za-z0-9]*$/, G = (e) => JSON.stringify(e);
package/dist/v2.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as _, I as v, It as y, J as b, Jt as x, K as S, Kt as C, L as w, Lt as T, M as E, Mt as D, N as O, Nt as k, O as A, Ot as j, P as ee, Pt as M, Q as te, Qt as ne, R as N, Rt as re, S as ie, St as P, T as ae, Tt as oe, U as se, Ut as ce, V as le, Vt as F, W as ue, Wt as I, X as de, Xt as fe, Y as pe, Yt as L, Z as me, Zt as he, _ as ge, _t as _e, a as ve, at as ye, b as be, bt as xe, c as Se, ct as Ce, d as we, dt as Te, en as Ee, et as De, f as Oe, ft as ke, g as Ae, gt as je, h as Me, ht as Ne, i as Pe, in as Fe, it as Ie, j as Le, jt as Re, k as ze, kt as Be, l as Ve, lt as He, m as Ue, mt as We, nn as Ge, nt as Ke, o as qe, ot as R, p as Je, pt as Ye, q as z, qt as Xe, r as Ze, rn as Qe, rt as $e, s as et, st as tt, t as nt, tn as rt, tt as it, u as at, ut as ot, v as st, vt as ct, w as lt, wt as ut, x as dt, xt as ft, y as pt, yt as mt, z as ht, zt as gt } from "./InlineColorPicker-BGyPZzyk.js";
2
2
  import { a as _t, i as vt } from "./colorUtils-ohNG3v1i.js";
3
- import { $ as yt, $t as bt, A as xt, At as St, B as Ct, Bt as wt, C as Tt, Ct as Et, Dt, E as Ot, Et as kt, F as At, Ft as jt, G as Mt, Gt as Nt, H as Pt, Ht as Ft, I as It, It as Lt, J as Rt, Jt as zt, K as Bt, Kt as Vt, L as Ht, Lt as Ut, M as Wt, Mt as Gt, N as Kt, Nt as qt, O as Jt, Ot as Yt, P as Xt, Pt as Zt, Q as Qt, R as $t, Rt as en, S as tn, St as nn, T as rn, Tt as an, U as on, Ut as sn, V as cn, Vt as ln, W as un, Wt as dn, X as fn, Xt as pn, Y as mn, Yt as hn, Z as gn, Zt as _n, _ as vn, _t as yn, an as bn, at as xn, b as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dt as On, en as kn, fn as An, ft as jn, g as Mn, gt as Nn, h as Pn, ht as Fn, in as In, it as Ln, j as Rn, jt as zn, k as Bn, kt as Vn, l as Hn, ln as Un, lt as Wn, m as Gn, mn as Kn, mt as qn, n as Jn, nn as Yn, nt as Xn, on as Zn, ot as Qn, pn as $n, pt as er, q as tr, qt as nr, r as rr, rn as ir, rt as ar, s as or, sn as sr, st as cr, t as lr, tn as ur, tt as dr, u as fr, un as pr, ut as mr, v as hr, vt as gr, w as _r, wt as vr, x as yr, xt as br, y as xr, yt as Sr, z as Cr, zt as wr } from "./v1-DgwxU8IH.js";
3
+ import { $ as yt, $t as bt, A as xt, At as St, B as Ct, Bt as wt, C as Tt, Ct as Et, Dt, E as Ot, Et as kt, F as At, Ft as jt, G as Mt, Gt as Nt, H as Pt, Ht as Ft, I as It, It as Lt, J as Rt, Jt as zt, K as Bt, Kt as Vt, L as Ht, Lt as Ut, M as Wt, Mt as Gt, N as Kt, Nt as qt, O as Jt, Ot as Yt, P as Xt, Pt as Zt, Q as Qt, R as $t, Rt as en, S as tn, St as nn, T as rn, Tt as an, U as on, Ut as sn, V as cn, Vt as ln, W as un, Wt as dn, X as fn, Xt as pn, Y as mn, Yt as hn, Z as gn, Zt as _n, _ as vn, _t as yn, an as bn, at as xn, b as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dt as On, en as kn, fn as An, ft as jn, g as Mn, gt as Nn, h as Pn, ht as Fn, in as In, it as Ln, j as Rn, jt as zn, k as Bn, kt as Vn, l as Hn, ln as Un, lt as Wn, m as Gn, mn as Kn, mt as qn, n as Jn, nn as Yn, nt as Xn, on as Zn, ot as Qn, pn as $n, pt as er, q as tr, qt as nr, r as rr, rn as ir, rt as ar, s as or, sn as sr, st as cr, t as lr, tn as ur, tt as dr, u as fr, un as pr, ut as mr, v as hr, vt as gr, w as _r, wt as vr, x as yr, xt as br, y as xr, yt as Sr, z as Cr, zt as wr } from "./v1-C2tXaSOb.js";
4
4
  import { A as Tr, C as Er, D as Dr, E as Or, F as kr, I as Ar, L as jr, M as Mr, N as Nr, O as Pr, P as Fr, S as Ir, T as Lr, _ as Rr, a as zr, b as Br, c as Vr, d as Hr, f as Ur, g as Wr, h as Gr, i as Kr, j as qr, k as Jr, l as Yr, m as Xr, n as Zr, o as Qr, p as $r, r as ei, s as ti, t as ni, u as ri, v as ii, w as ai, x as oi, y as si } from "./lint-CTTecyu_.js";
5
5
  import { d as ci, o as li, s as ui, t as di, u as fi } from "./client-CAWtj9sV.js";
6
6
  import pi, { createContext as mi, forwardRef as hi, useCallback as B, useContext as gi, useDeferredValue as _i, useEffect as V, useImperativeHandle as vi, useLayoutEffect as yi, useMemo as H, useRef as U, useState as W } from "react";
@@ -9403,6 +9403,69 @@ var ns = ({ value: e, onChange: t }) => {
9403
9403
  })
9404
9404
  })]
9405
9405
  }),
9406
+ /* @__PURE__ */ q(Q, {
9407
+ title: "Send button look",
9408
+ children: [
9409
+ /* @__PURE__ */ K($, {
9410
+ label: "Colour",
9411
+ children: /* @__PURE__ */ q("span", {
9412
+ className: "flex items-center gap-2",
9413
+ children: [/* @__PURE__ */ K("input", {
9414
+ type: "color",
9415
+ "aria-label": "Button colour",
9416
+ className: "h-7 w-10 cursor-pointer rounded border border-[#2C2C2C] bg-transparent p-0",
9417
+ value: /^#[0-9a-f]{6}$/i.test(t.buttonColor ?? "") ? t.buttonColor : "#111827",
9418
+ onChange: (e) => n({
9419
+ buttonColor: e.target.value,
9420
+ buttonTextColor: void 0
9421
+ })
9422
+ }), t.buttonColor && /* @__PURE__ */ K("button", {
9423
+ type: "button",
9424
+ className: "text-[11px] text-[#9CA3AF] underline",
9425
+ onClick: () => n({
9426
+ buttonColor: void 0,
9427
+ buttonTextColor: void 0
9428
+ }),
9429
+ children: "Use site colour"
9430
+ })]
9431
+ })
9432
+ }),
9433
+ /* @__PURE__ */ K("p", {
9434
+ className: "text-[10px] text-[#6B7280] pl-[72px]",
9435
+ children: "The label turns light or dark by itself so it stays easy to read."
9436
+ }),
9437
+ /* @__PURE__ */ K($, {
9438
+ label: "Corners",
9439
+ children: /* @__PURE__ */ q("select", {
9440
+ className: Z,
9441
+ value: t.buttonRadius ?? "",
9442
+ onChange: (e) => n({ buttonRadius: e.target.value || void 0 }),
9443
+ children: [
9444
+ /* @__PURE__ */ K("option", {
9445
+ value: "",
9446
+ children: "Default"
9447
+ }),
9448
+ /* @__PURE__ */ K("option", {
9449
+ value: "0px",
9450
+ children: "Square"
9451
+ }),
9452
+ /* @__PURE__ */ K("option", {
9453
+ value: "6px",
9454
+ children: "Slightly soft"
9455
+ }),
9456
+ /* @__PURE__ */ K("option", {
9457
+ value: "14px",
9458
+ children: "Soft"
9459
+ }),
9460
+ /* @__PURE__ */ K("option", {
9461
+ value: "999px",
9462
+ children: "Pill"
9463
+ })
9464
+ ]
9465
+ })
9466
+ })
9467
+ ]
9468
+ }),
9406
9469
  /* @__PURE__ */ q(Q, {
9407
9470
  title: "Where messages go",
9408
9471
  children: [/* @__PURE__ */ K("p", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@charisol/plexo-sdk",
3
3
  "private": false,
4
- "version": "2.0.5",
4
+ "version": "2.0.6",
5
5
  "description": "Plexo visual email and landing page builder SDK — drag-and-drop template editor with AI integration.",
6
6
  "keywords": [
7
7
  "email-builder",