@gemboss/ui 0.63.0 → 0.65.0
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/CHANGELOG.md +98 -0
- package/README.md +98 -4
- package/catalog/editor.html +1 -1
- package/catalog/index.html +23 -20
- package/gemboss-ui.css +2 -2
- package/package.json +9 -1
- package/parts/components.css +1 -1
- package/parts/core.css +1 -1
- package/parts/shell.css +1 -1
- package/src/assistant/chat.tsx +67 -4
- package/src/assistant/dictation.ts +292 -0
- package/src/assistant/index.ts +4 -1
- package/src/audiences-table.css +1 -0
- package/src/audiences-table.tsx +167 -0
- package/src/chat-voice.css +1 -0
- package/src/editor/color-choices.ts +9 -0
- package/src/editor/controls.tsx +5 -2
- package/src/editor/field-control.tsx +453 -0
- package/src/editor/field-frame.tsx +182 -0
- package/src/editor/field-spec.ts +345 -0
- package/src/editor/index.ts +16 -0
- package/src/editor.css +1 -1
- package/src/email-editor/editor.tsx +462 -0
- package/src/email-editor/index.ts +16 -0
- package/src/email-editor/model.ts +361 -0
- package/src/email-editor/preview.tsx +208 -0
- package/src/email-editor.css +1 -0
- package/src/gem-at-work.css +1 -1
- package/src/gem-at-work.ts +273 -15
- package/src/index.ts +2 -1
- package/src/list-page.tsx +87 -4
- package/src/skill-feedback.css +1 -1
- package/src/skill-feedback.tsx +5 -1
- package/src/skill-history.tsx +2 -1
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
// The email editor's MODEL (05/11/2026, Chris approved canvas JQkjqVVb "Email editor"): what a mail is made of, the blocks the
|
|
2
|
+
// editor adds, and the pure functions the editor and its preview share. No React, no DOM: a test, a server and GemReach's admin
|
|
3
|
+
// read it as it is.
|
|
4
|
+
//
|
|
5
|
+
// ONE SHAPE WITH GEMREACH. GemReach keeps and sends the mail; GemBoss draws the screens (docs/funnel-loop.md, Chris 05/11/2026).
|
|
6
|
+
// So the body is GemReach's own block list (chriskoh26/gemreach src/templates/blocks.ts, read 05/11/2026 at a341451), field for
|
|
7
|
+
// field: a body saved here is a body GemReach renders, and wiring the editor to `PATCH /v1/templates/:id` later is a straight
|
|
8
|
+
// pass of `body`. Two blocks the funnel needs that GemReach does not have yet are added beside it and named as proposals:
|
|
9
|
+
// - `products`: the products of THIS person's order, cart or last views, filled when the mail is built (GemReach issue #106);
|
|
10
|
+
// - `review`: the GemReview ask (stars and a button to a page signed for the buyer).
|
|
11
|
+
// "Heading + text" is GemReach's `hero` with a title and a text and no picture: it renders as a heading over a paragraph there.
|
|
12
|
+
|
|
13
|
+
export type Align = "left" | "center" | "right";
|
|
14
|
+
/** The space above and below a block: S smaller, M the default, L wider (GemReach `Spacing`). */
|
|
15
|
+
export type Spacing = "s" | "m" | "l";
|
|
16
|
+
|
|
17
|
+
/** How a block is laid out, shared by every kind (GemReach `BlockStyle`). */
|
|
18
|
+
export type EmailBlockStyle = {
|
|
19
|
+
align?: Align;
|
|
20
|
+
spacing?: Spacing;
|
|
21
|
+
/** The band's colour (#hex). */
|
|
22
|
+
background?: string;
|
|
23
|
+
/** The button's colour (#hex) of a block with a button; unset = the brand kit's. */
|
|
24
|
+
color?: string;
|
|
25
|
+
/** Kept in the mail, never built or sent. */
|
|
26
|
+
hidden?: boolean;
|
|
27
|
+
/** Shown only when this variable has a value, or hidden when it has one. */
|
|
28
|
+
show_if?: string;
|
|
29
|
+
hide_if?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** One column of a two-column block (GemReach `Column`). */
|
|
33
|
+
export type EmailColumn = { image?: string; alt?: string; title?: string; text?: string; button?: string; url?: string };
|
|
34
|
+
|
|
35
|
+
/** GemReach's blocks as they are (src/templates/blocks.ts `Block`). Words understand `{{variable}}`, **bold**, _italic_, [text](link). */
|
|
36
|
+
export type GemReachBlock = EmailBlockStyle & (
|
|
37
|
+
| { type: "header"; href?: string }
|
|
38
|
+
| { type: "heading"; text: string; level?: 1 | 2 }
|
|
39
|
+
| { type: "paragraph"; text: string }
|
|
40
|
+
| { type: "button"; text: string; url: string }
|
|
41
|
+
| { type: "image"; src: string; alt?: string; width?: number; href?: string }
|
|
42
|
+
| { type: "hero"; title: string; text?: string; image?: string; alt?: string; button?: string; url?: string }
|
|
43
|
+
| { type: "columns"; columns: EmailColumn[] }
|
|
44
|
+
| { type: "product"; title: string; image?: string; alt?: string; price?: string; text?: string; button?: string; url?: string }
|
|
45
|
+
| { type: "testimonial"; quote: string; name?: string; role?: string; image?: string }
|
|
46
|
+
| { type: "cta"; title: string; text?: string; button: string; url: string }
|
|
47
|
+
| { type: "divider" }
|
|
48
|
+
| { type: "spacer"; height?: number }
|
|
49
|
+
| { type: "list"; items: string[]; ordered?: boolean }
|
|
50
|
+
| { type: "footer"; text?: string }
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/** Where a `products` block takes its products from, for each person when the mail is built. */
|
|
54
|
+
export type ProductsSource = "order" | "cart" | "viewed";
|
|
55
|
+
|
|
56
|
+
/** PROPOSED for GemReach (#106): the products of this person's order, cart or views, filled when the mail is built. */
|
|
57
|
+
export type ProductsBlock = EmailBlockStyle & { type: "products"; source: ProductsSource; count?: number; title?: string; button?: string; url?: string };
|
|
58
|
+
/** PROPOSED for GemReach: the GemReview ask. `url` is the review page signed for the buyer (`{{review_url}}`). */
|
|
59
|
+
export type ReviewBlock = EmailBlockStyle & { type: "review"; title: string; text?: string; button: string; url: string };
|
|
60
|
+
|
|
61
|
+
export type EmailBlock = GemReachBlock | ProductsBlock | ReviewBlock;
|
|
62
|
+
export type EmailBlockType = EmailBlock["type"];
|
|
63
|
+
|
|
64
|
+
/** The kinds GemReach renders today (its `BLOCK_TYPES`); the other two are this editor's proposals. */
|
|
65
|
+
export const GEMREACH_BLOCK_TYPES = [
|
|
66
|
+
"header", "heading", "paragraph", "button", "image", "hero", "columns", "product", "testimonial", "cta", "divider", "spacer", "list", "footer",
|
|
67
|
+
] as const satisfies readonly EmailBlockType[];
|
|
68
|
+
export const PROPOSED_BLOCK_TYPES = ["products", "review"] as const satisfies readonly EmailBlockType[];
|
|
69
|
+
|
|
70
|
+
/** A template version as GemReach holds one (its `TemplateVersion`, the fields a save writes), with the editor's name for it. */
|
|
71
|
+
export interface EmailDraft {
|
|
72
|
+
id: string;
|
|
73
|
+
/** The mail's own name in lists and on the funnel ("Time to refill"). */
|
|
74
|
+
name: string;
|
|
75
|
+
status: "draft" | "approved" | "retired";
|
|
76
|
+
version: number;
|
|
77
|
+
subject: string;
|
|
78
|
+
preheader: string;
|
|
79
|
+
/** Who it comes from: the store's name at its own domain (docs/funnel-loop.md: the store's domain from the first mail). */
|
|
80
|
+
from: { name: string; email: string };
|
|
81
|
+
body: EmailBlock[];
|
|
82
|
+
/** The variables the sender promises (GemReach `variables`); one used and not here is a red check. */
|
|
83
|
+
variables?: string[];
|
|
84
|
+
/** Values the preview and the checks use, never sent (GemReach `sample_data`). */
|
|
85
|
+
sample_data?: Record<string, unknown>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The brand the mail wears (GemReach `BrandKit`, the fields this editor reads). */
|
|
89
|
+
export interface EmailBrand {
|
|
90
|
+
name: string;
|
|
91
|
+
logo_url?: string | null;
|
|
92
|
+
/** The postal address every marketing mail carries (CAN-SPAM, GemReach's `postal_address` check). */
|
|
93
|
+
legal_address?: string | null;
|
|
94
|
+
footer_text?: string | null;
|
|
95
|
+
colors?: { text?: string; muted?: string; background?: string; surface?: string; border?: string; accent?: string; button?: string; button_text?: string } | null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** One person the preview is drawn for ("Anna · bought 23 days ago"): their values fill the variables and the products. */
|
|
99
|
+
export interface EmailPreviewPerson {
|
|
100
|
+
id: string;
|
|
101
|
+
label: string;
|
|
102
|
+
data: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** A product the preview shows in a `products` block (the person's order, cart or views). */
|
|
106
|
+
export interface EmailPreviewProduct { title: string; price?: string; note?: string; image?: string | null }
|
|
107
|
+
|
|
108
|
+
// ── the kinds the editor adds ───────────────────────────────────────────────────────────────────────────────────────────
|
|
109
|
+
|
|
110
|
+
/** What the "+" offers, in the board's order (canvas JQkjqVVb "Email editor"). */
|
|
111
|
+
export const ADD_KINDS = ["header", "image", "hero", "products", "button", "review", "footer"] as const satisfies readonly EmailBlockType[];
|
|
112
|
+
export type AddKind = (typeof ADD_KINDS)[number];
|
|
113
|
+
|
|
114
|
+
/** A block's name, as the Sections list and the picker say it. */
|
|
115
|
+
export const BLOCK_NAME: Record<EmailBlockType, string> = {
|
|
116
|
+
header: "Logo", heading: "Heading", paragraph: "Text", button: "Button", image: "Image", hero: "Heading + text", columns: "Two columns",
|
|
117
|
+
product: "Product", testimonial: "Quote", cta: "Call to action", divider: "Divider", spacer: "Space", list: "List", footer: "Footer",
|
|
118
|
+
products: "Products", review: "Review ask",
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** One line under each kind in the picker. */
|
|
122
|
+
export const BLOCK_HINT: Record<AddKind, string> = {
|
|
123
|
+
header: "The store's logo, from the brand kit",
|
|
124
|
+
image: "A photo, with words for people who cannot see it",
|
|
125
|
+
hero: "A heading and a paragraph, with variables",
|
|
126
|
+
products: "From this person's order or cart",
|
|
127
|
+
button: "Opens a page built for each person",
|
|
128
|
+
review: "Asks for stars through GemReview",
|
|
129
|
+
footer: "Postal address and unsubscribe",
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
/** The personal link GemReach signs when it builds the mail (docs/funnel-loop.md F4): one page for each person, 72 hours. */
|
|
133
|
+
export const PERSONAL_LINK = "{{funnel_url}}";
|
|
134
|
+
export const PERSONAL_LINK_HOURS = 72;
|
|
135
|
+
export const isPersonalLink = (url: string | undefined): boolean => /^\{\{\s*funnel_url\s*(\|[^}]*)?\}\}$/.test((url ?? "").trim());
|
|
136
|
+
/** The review page GemReview signs for the buyer. */
|
|
137
|
+
export const REVIEW_LINK = "{{review_url}}";
|
|
138
|
+
|
|
139
|
+
const SOURCE_LINE: Record<ProductsSource, string> = { order: "from this person's last order", cart: "from this person's cart", viewed: "from what this person viewed" };
|
|
140
|
+
export const PRODUCTS_SOURCE_NAME: Record<ProductsSource, string> = { order: "Their last order", cart: "Their cart", viewed: "What they viewed" };
|
|
141
|
+
|
|
142
|
+
/** A new block of a kind, filled with words a person would keep (never "Lorem ipsum"). */
|
|
143
|
+
export function newBlock(kind: AddKind): EmailBlock {
|
|
144
|
+
switch (kind) {
|
|
145
|
+
case "header": return { type: "header", align: "center" };
|
|
146
|
+
case "image": return { type: "image", src: "", alt: "" };
|
|
147
|
+
case "hero": return { type: "hero", title: "A heading", text: "A line or two, {{first_name | default:\"there\"}}." };
|
|
148
|
+
case "products": return { type: "products", source: "order", count: 2 };
|
|
149
|
+
case "button": return { type: "button", text: "Open my page", url: PERSONAL_LINK, align: "center" };
|
|
150
|
+
case "review": return { type: "review", title: "How is it going?", text: "Two taps: stars and, if you like, a few words.", button: "Leave a review", url: REVIEW_LINK };
|
|
151
|
+
case "footer": return { type: "footer" };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** The muted line under a block in Sections: what it holds, in a few words. */
|
|
156
|
+
export function blockLine(b: EmailBlock, opens?: string): string {
|
|
157
|
+
switch (b.type) {
|
|
158
|
+
case "header": return "from brand kit";
|
|
159
|
+
case "image": return b.alt?.trim() ? b.alt : b.src ? "a photo" : "no photo yet";
|
|
160
|
+
case "hero": {
|
|
161
|
+
const vars = variablesIn(`${b.title} ${b.text ?? ""}`);
|
|
162
|
+
return vars.length ? `uses ${vars.map((v) => `{{${v}}}`).join(", ")}` : b.title;
|
|
163
|
+
}
|
|
164
|
+
case "heading": return b.text;
|
|
165
|
+
case "paragraph": return b.text;
|
|
166
|
+
case "products": return SOURCE_LINE[b.source];
|
|
167
|
+
case "button": return isPersonalLink(b.url) ? `${b.text} → ${opens ?? "a page built for each person"}` : `${b.text} → ${b.url || "no link yet"}`;
|
|
168
|
+
case "review": return "stars and a few words, GemReview";
|
|
169
|
+
case "footer": return "address, unsubscribe";
|
|
170
|
+
case "cta": return b.title;
|
|
171
|
+
case "product": return b.title;
|
|
172
|
+
case "testimonial": return b.quote;
|
|
173
|
+
case "list": return `${b.items.length} lines`;
|
|
174
|
+
case "columns": return `${b.columns.length} columns`;
|
|
175
|
+
case "spacer": return `${b.height ?? 24}px`;
|
|
176
|
+
case "divider": return "a line";
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** The chip a row carries in Sections: what makes this block different from a plain one. */
|
|
181
|
+
export function blockTag(b: EmailBlock): string | null {
|
|
182
|
+
if (b.type === "products") return "Dynamic";
|
|
183
|
+
if (b.type === "button" && isPersonalLink(b.url)) return "Personal link";
|
|
184
|
+
if (b.type === "review") return "GemReview";
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// ── moving blocks ───────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
189
|
+
|
|
190
|
+
/** `body` with `block` at `index` (clamped to the ends). The footer stays last: a block added after it goes before it. */
|
|
191
|
+
export function insertBlock(body: readonly EmailBlock[], index: number, block: EmailBlock): EmailBlock[] {
|
|
192
|
+
const footerAt = body.findIndex((b) => b.type === "footer");
|
|
193
|
+
let at = Math.max(0, Math.min(index, body.length));
|
|
194
|
+
if (block.type !== "footer" && footerAt >= 0 && at > footerAt) at = footerAt;
|
|
195
|
+
if (block.type === "footer" && footerAt >= 0) return body.slice();
|
|
196
|
+
return [...body.slice(0, at), block, ...body.slice(at)];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** `body` with the block at `from` moved to `to`; out of range changes nothing. */
|
|
200
|
+
export function moveBlock(body: readonly EmailBlock[], from: number, to: number): EmailBlock[] {
|
|
201
|
+
if (from < 0 || from >= body.length || to < 0 || to >= body.length || from === to) return body.slice();
|
|
202
|
+
const next = body.slice();
|
|
203
|
+
const [b] = next.splice(from, 1);
|
|
204
|
+
next.splice(to, 0, b!);
|
|
205
|
+
return next;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function removeBlock(body: readonly EmailBlock[], index: number): EmailBlock[] {
|
|
209
|
+
return body.filter((_, i) => i !== index);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/** Where a block added from the "+" goes, said in words before it is added ("Goes below Button"). */
|
|
213
|
+
export function insertPlace(body: readonly EmailBlock[], index: number): string {
|
|
214
|
+
if (index <= 0) return "Goes at the top";
|
|
215
|
+
const before = body[Math.min(index, body.length) - 1];
|
|
216
|
+
if (index >= body.length || !before) return "Goes at the end";
|
|
217
|
+
return `Goes below ${BLOCK_NAME[before.type]}`;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// ── variables ───────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
221
|
+
|
|
222
|
+
const VAR = /\{\{\s*([A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z0-9_]+)*)\s*(?:\|\s*default\s*:\s*(?:"((?:[^"\\]|\\.)*)"|'((?:[^'\\]|\\.)*)'))?\s*\}\}/g;
|
|
223
|
+
|
|
224
|
+
/** The variables a string uses (`{{order.total | default:"0"}}` → `order.total`), GemReach's reading. */
|
|
225
|
+
export function variablesIn(s: string): string[] {
|
|
226
|
+
const out: string[] = [];
|
|
227
|
+
for (const m of s.matchAll(VAR)) out.push(m[1]!);
|
|
228
|
+
return out;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** Every string of a block (words and links), to find its variables (GemReach `stringsOf`, with the two proposals). */
|
|
232
|
+
export function stringsOf(b: EmailBlock): string[] {
|
|
233
|
+
switch (b.type) {
|
|
234
|
+
case "header": return [b.href ?? ""];
|
|
235
|
+
case "heading": case "paragraph": return [b.text];
|
|
236
|
+
case "button": return [b.text, b.url];
|
|
237
|
+
case "image": return [b.src, b.alt ?? "", b.href ?? ""];
|
|
238
|
+
case "hero": return [b.title, b.text ?? "", b.image ?? "", b.alt ?? "", b.button ?? "", b.url ?? ""];
|
|
239
|
+
case "product": return [b.title, b.image ?? "", b.alt ?? "", b.price ?? "", b.text ?? "", b.button ?? "", b.url ?? ""];
|
|
240
|
+
case "testimonial": return [b.quote, b.name ?? "", b.role ?? "", b.image ?? ""];
|
|
241
|
+
case "cta": return [b.title, b.text ?? "", b.button, b.url];
|
|
242
|
+
case "columns": return b.columns.flatMap((c) => [c.image ?? "", c.alt ?? "", c.title ?? "", c.text ?? "", c.button ?? "", c.url ?? ""]);
|
|
243
|
+
case "list": return b.items;
|
|
244
|
+
case "footer": return [b.text ?? ""];
|
|
245
|
+
case "products": return [b.title ?? "", b.button ?? "", b.url ?? ""];
|
|
246
|
+
case "review": return [b.title, b.text ?? "", b.button, b.url];
|
|
247
|
+
default: return [];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The value at a dotted path of the sample data, or undefined. */
|
|
252
|
+
function at(data: Record<string, unknown> | undefined, path: string): unknown {
|
|
253
|
+
let cur: unknown = data;
|
|
254
|
+
for (const k of path.split(".")) {
|
|
255
|
+
if (cur == null || typeof cur !== "object") return undefined;
|
|
256
|
+
cur = (cur as Record<string, unknown>)[k];
|
|
257
|
+
}
|
|
258
|
+
return cur;
|
|
259
|
+
}
|
|
260
|
+
const present = (v: unknown) => v !== undefined && v !== null && v !== "" && (typeof v === "string" || typeof v === "number" || typeof v === "boolean");
|
|
261
|
+
|
|
262
|
+
/** A piece of text with its variables filled for one person: the words, and the variables that had no value. */
|
|
263
|
+
export function fillVariables(s: string, data?: Record<string, unknown>): { text: string; missing: string[] } {
|
|
264
|
+
const missing: string[] = [];
|
|
265
|
+
const text = s.replace(VAR, (_m, path: string, d1?: string, d2?: string) => {
|
|
266
|
+
const v = at(data, path);
|
|
267
|
+
if (present(v)) return String(v);
|
|
268
|
+
const fallback = d1 ?? d2;
|
|
269
|
+
if (fallback !== undefined) return fallback.replace(/\\(.)/g, "$1");
|
|
270
|
+
missing.push(path);
|
|
271
|
+
return `{{${path}}}`;
|
|
272
|
+
});
|
|
273
|
+
return { text, missing };
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/** The variables a draft uses, subject and preheader included, without the two GemReach fills itself. */
|
|
277
|
+
export function usedVariables(d: Pick<EmailDraft, "subject" | "preheader" | "body">): string[] {
|
|
278
|
+
const all = [d.subject, d.preheader, ...d.body.flatMap(stringsOf)].flatMap(variablesIn);
|
|
279
|
+
return [...new Set(all)].filter((v) => !BUILT_IN_VARIABLES.includes(v)).sort();
|
|
280
|
+
}
|
|
281
|
+
/** Filled by GemReach for every person: the unsubscribe and preferences links, the signed links. */
|
|
282
|
+
export const BUILT_IN_VARIABLES: readonly string[] = ["unsubscribe_url", "preferences_url", "funnel_url", "review_url"];
|
|
283
|
+
|
|
284
|
+
// ── checks ──────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
285
|
+
|
|
286
|
+
/** One check, by GemReach's id and name (src/templates/check-ids.ts), so the pill and the server's report say the same thing. */
|
|
287
|
+
export interface EmailCheck {
|
|
288
|
+
id: string; label: string; ok: boolean; detail?: string;
|
|
289
|
+
/** The sender's word (GemReach): `error` stops the approval, `warning` is a look. Absent: a look (the editor's own checks). */
|
|
290
|
+
severity?: "error" | "warning";
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** Contrast between two #hex colours (WCAG, 1–21), GemReach's `contrast`. */
|
|
294
|
+
export function contrast(a: string, b: string): number {
|
|
295
|
+
const lum = (hex: string) => {
|
|
296
|
+
let h = hex.replace("#", "");
|
|
297
|
+
if (h.length === 3) h = h.replace(/./g, "$&$&");
|
|
298
|
+
const [r, g, bl] = [0, 2, 4].map((i) => {
|
|
299
|
+
const c = parseInt(h.slice(i, i + 2), 16) / 255;
|
|
300
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
301
|
+
}) as [number, number, number];
|
|
302
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * bl;
|
|
303
|
+
};
|
|
304
|
+
const [x, y] = [lum(a), lum(b)];
|
|
305
|
+
return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const LINK_OK = (u: string) => /^(https:\/\/|mailto:|tel:)/i.test(u.trim()) || /^\{\{\s*[A-Za-z_][\w.]*\s*(\|[^}]*)?\}\}$/.test(u.trim());
|
|
309
|
+
const CLAIMS = /\b(cures?|miracle|guaranteed results|risk[- ]free|clinically proven)\b/i;
|
|
310
|
+
const SPAMMY = /(!!+|\b[A-Z]{5,}\b|100% free|act now)/;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* The checks the editor can run on the draft before GemReach's own (the server's run when the editor is wired, and replace these
|
|
314
|
+
* through the editor's `checks` prop). Each is one of GemReach's checks with its name; one that cannot apply here is left out, so
|
|
315
|
+
* the count is honest ("18 of 18 checks pass" is eighteen things looked at).
|
|
316
|
+
*/
|
|
317
|
+
export function emailChecks(d: EmailDraft, brand: EmailBrand, data?: Record<string, unknown>): EmailCheck[] {
|
|
318
|
+
const shown = d.body.filter((b) => !b.hidden);
|
|
319
|
+
const words = shown.flatMap(stringsOf).join(" ");
|
|
320
|
+
const buttons = shown.flatMap((b) => (b.type === "button" ? [{ text: b.text, url: b.url }] : b.type === "cta" ? [{ text: b.button, url: b.url }]
|
|
321
|
+
: b.type === "review" ? [{ text: b.button, url: b.url }] : (b.type === "hero" || b.type === "product" || b.type === "products") && b.button ? [{ text: b.button, url: b.url ?? "" }] : []));
|
|
322
|
+
const images = shown.flatMap((b) => (b.type === "image" ? [{ src: b.src, alt: b.alt ?? "" }] : (b.type === "hero" || b.type === "product") && b.image ? [{ src: b.image, alt: b.alt ?? "" }] : []));
|
|
323
|
+
const empty = shown.filter((b) => (b.type === "hero" && !b.title.trim()) || ((b.type === "heading" || b.type === "paragraph") && !b.text.trim())
|
|
324
|
+
|| (b.type === "button" && !b.text.trim()) || (b.type === "review" && !b.title.trim()) || (b.type === "image" && !b.src.trim()));
|
|
325
|
+
const declared = new Set([...(d.variables ?? []), ...BUILT_IN_VARIABLES]);
|
|
326
|
+
const vars = usedVariables(d);
|
|
327
|
+
const unfilled = vars.filter((v) => !declared.has(v) && !declared.has(v.split(".")[0]!) && fillVariables(`{{${v}}}`, data ?? d.sample_data).missing.length > 0);
|
|
328
|
+
const badLinks = buttons.filter((b) => !LINK_OK(b.url));
|
|
329
|
+
const palette = { button: brand.colors?.button ?? "#1b1c1e", button_text: brand.colors?.button_text ?? "#ffffff" };
|
|
330
|
+
const subject = d.subject.trim();
|
|
331
|
+
const checks: EmailCheck[] = [
|
|
332
|
+
{ id: "render", label: "Renders", ok: empty.length === 0, detail: empty.length ? `${empty.length} block${empty.length === 1 ? " is" : "s are"} empty` : undefined },
|
|
333
|
+
{ id: "variables", label: "Variables", ok: unfilled.length === 0, detail: unfilled.length ? `No value for ${unfilled.join(", ")}` : undefined },
|
|
334
|
+
{ id: "links", label: "Links well-formed", ok: badLinks.length === 0, detail: badLinks.length ? `${badLinks.length} button${badLinks.length === 1 ? " has" : "s have"} no working link` : undefined },
|
|
335
|
+
{ id: "unsubscribe", label: "Unsubscribe + one-click", ok: shown.some((b) => b.type === "footer"), detail: "Add the Footer block" },
|
|
336
|
+
{ id: "postal_address", label: "Postal address", ok: !!brand.legal_address?.trim(), detail: "Add the store's postal address in Settings" },
|
|
337
|
+
{ id: "subject", label: "Subject length", ok: subject.length > 0 && subject.length <= 60, detail: subject ? `${subject.length} characters: phones cut at about 60` : "No subject yet" },
|
|
338
|
+
{ id: "spam", label: "Spam wording", ok: !SPAMMY.test(`${d.subject} ${words}`) },
|
|
339
|
+
{ id: "claims", label: "Banned claims", ok: !CLAIMS.test(`${d.subject} ${words}`) },
|
|
340
|
+
{ id: "contrast", label: "Button contrast", ok: contrast(palette.button, palette.button_text) >= 4.5 },
|
|
341
|
+
{ id: "length", label: "Size", ok: words.length <= 6000 },
|
|
342
|
+
{ id: "sender", label: "Honest sender", ok: !!d.from.name.trim() && /@/.test(d.from.email) },
|
|
343
|
+
{ id: "preheader", label: "Preheader", ok: d.preheader.trim().length > 0, detail: "Write the grey line after the subject" },
|
|
344
|
+
{ id: "plain_text", label: "Plain-text part", ok: true },
|
|
345
|
+
{ id: "images", label: "Images and alt", ok: images.every((i) => i.alt.trim().length > 0), detail: "Say what each photo shows" },
|
|
346
|
+
{ id: "link_domains", label: "Link domains", ok: buttons.every((b) => !/^http:\/\//i.test(b.url.trim())) },
|
|
347
|
+
{ id: "cta", label: "Buttons", ok: buttons.length >= 1 && buttons.length <= 3, detail: buttons.length ? `${buttons.length} buttons: keep it to 3` : "Add one button" },
|
|
348
|
+
{ id: "button_size", label: "Button size", ok: buttons.every((b) => b.text.trim().length <= 30) },
|
|
349
|
+
{ id: "dark_mode", label: "Text contrast", ok: true },
|
|
350
|
+
];
|
|
351
|
+
return checks.map((c) => (c.ok ? { id: c.id, label: c.label, ok: true } : c));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** "18 of 18 checks pass" / "2 of 18 checks need a look". */
|
|
355
|
+
export function checksLine(checks: readonly EmailCheck[]): { text: string; ok: boolean } {
|
|
356
|
+
const passed = checks.filter((c) => c.ok).length;
|
|
357
|
+
const failed = checks.length - passed;
|
|
358
|
+
return failed === 0
|
|
359
|
+
? { text: `${passed} of ${checks.length} checks pass`, ok: true }
|
|
360
|
+
: { text: `${failed} of ${checks.length} check${failed === 1 ? "s needs" : "s need"} a look`, ok: false };
|
|
361
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// The mail on the editor's stage (05/11/2026, canvas JQkjqVVb "Email editor"): the envelope (From, Subject, the grey line), then
|
|
2
|
+
// the blocks as one person would read them, their variables filled from that person. A block is picked by a click (or Enter on
|
|
3
|
+
// it); the picked one carries a "+" under it that adds the next block there. Nothing is dragged.
|
|
4
|
+
//
|
|
5
|
+
// A PREVIEW, NOT THE SENT MAIL. The mail GemReach sends is its own render (tables, inline styles, 600px; src/templates/render.ts)
|
|
6
|
+
// and the editor will show that render once it is wired (GemReach's preview route with the unsaved blocks). Until then this draws
|
|
7
|
+
// the same blocks in the same order, with the same words and the brand's colours, so what a person decides here holds there.
|
|
8
|
+
import "../email-editor.css";
|
|
9
|
+
import { Fragment } from "react";
|
|
10
|
+
import type React from "react";
|
|
11
|
+
import {
|
|
12
|
+
BLOCK_NAME, fillVariables, isPersonalLink, PRODUCTS_SOURCE_NAME,
|
|
13
|
+
type EmailBlock, type EmailBrand, type EmailDraft, type EmailPreviewProduct,
|
|
14
|
+
} from "./model";
|
|
15
|
+
|
|
16
|
+
export type EmailDevice = "desktop" | "mobile";
|
|
17
|
+
|
|
18
|
+
export interface EmailPreviewProps {
|
|
19
|
+
draft: EmailDraft;
|
|
20
|
+
brand: EmailBrand;
|
|
21
|
+
/** The person the mail is drawn for: their values fill the variables. */
|
|
22
|
+
data?: Record<string, unknown>;
|
|
23
|
+
/** The products a `products` block shows for that person (their order, cart or views). */
|
|
24
|
+
products?: readonly EmailPreviewProduct[];
|
|
25
|
+
device?: EmailDevice;
|
|
26
|
+
dark?: boolean;
|
|
27
|
+
/** The picked block, by index. */
|
|
28
|
+
selected?: number | null;
|
|
29
|
+
/** Pick a block (null: the envelope, the mail's own settings). Absent: a picture only. */
|
|
30
|
+
onSelect?: (index: number | null) => void;
|
|
31
|
+
/** "+" under the picked block: add a block after it. */
|
|
32
|
+
onAddAfter?: (index: number) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Words with **bold**, _italic_ and [text](link) as GemReach writes them, drawn (links are words here: a preview opens nothing). */
|
|
36
|
+
function Words({ text }: { text: string }) {
|
|
37
|
+
const out: React.ReactNode[] = [];
|
|
38
|
+
const re = /\*\*([^*]+)\*\*|_([^_]+)_|\[([^\]]+)\]\(([^)]+)\)/g;
|
|
39
|
+
let last = 0;
|
|
40
|
+
let k = 0;
|
|
41
|
+
for (const m of text.matchAll(re)) {
|
|
42
|
+
if (m.index! > last) out.push(text.slice(last, m.index));
|
|
43
|
+
if (m[1]) out.push(<strong key={k++}>{m[1]}</strong>);
|
|
44
|
+
else if (m[2]) out.push(<em key={k++}>{m[2]}</em>);
|
|
45
|
+
else out.push(<span key={k++} className="gb-email-link">{m[3]}</span>);
|
|
46
|
+
last = m.index! + m[0].length;
|
|
47
|
+
}
|
|
48
|
+
if (last < text.length) out.push(text.slice(last));
|
|
49
|
+
return <>{out}</>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A filled string, with a variable that has no value for this person shown as itself, marked. */
|
|
53
|
+
function Fill({ text, data }: { text: string; data?: Record<string, unknown> }) {
|
|
54
|
+
const { text: filled, missing } = fillVariables(text, data);
|
|
55
|
+
if (!missing.length) return <Words text={filled} />;
|
|
56
|
+
const parts = filled.split(/(\{\{[\w.]+\}\})/g);
|
|
57
|
+
return <>{parts.map((p, i) => (/^\{\{[\w.]+\}\}$/.test(p) ? <mark key={i} className="gb-email-var" title="No value for this person">{p}</mark> : <Words key={i} text={p} />))}</>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function Stars() {
|
|
61
|
+
return (
|
|
62
|
+
<span className="gb-email-stars" aria-label="Five stars to tap">
|
|
63
|
+
{[0, 1, 2, 3, 4].map((i) => (
|
|
64
|
+
<svg key={i} width="22" height="22" viewBox="0 0 20 20" aria-hidden="true"><path d="M10 1.8l2.5 5.3 5.8.7-4.3 4 1.1 5.7L10 14.7l-5.1 2.8 1.1-5.7-4.3-4 5.8-.7z" /></svg>
|
|
65
|
+
))}
|
|
66
|
+
</span>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const ALIGN_CLASS = { left: "gb-email-al-left", center: "gb-email-al-center", right: "gb-email-al-right" } as const;
|
|
71
|
+
|
|
72
|
+
function Block({ b, brand, data, products }: { b: EmailBlock; brand: EmailBrand; data?: Record<string, unknown>; products?: readonly EmailPreviewProduct[] }) {
|
|
73
|
+
// Each alignment's class written whole (a class built from a value is one no search finds).
|
|
74
|
+
const align = b.align ? ALIGN_CLASS[b.align] : "";
|
|
75
|
+
const with_ = (base: string, fallback = "") => [base, align || fallback].filter(Boolean).join(" ");
|
|
76
|
+
switch (b.type) {
|
|
77
|
+
case "header":
|
|
78
|
+
return <div className={with_("gb-email-logo", ALIGN_CLASS.center)}>{brand.logo_url ? <img src={brand.logo_url} alt={brand.name} /> : brand.name.toUpperCase()}</div>;
|
|
79
|
+
case "image":
|
|
80
|
+
return b.src
|
|
81
|
+
? <div className={with_("gb-email-img")}><img src={b.src} alt={b.alt ?? ""} /></div>
|
|
82
|
+
: <div className="gb-email-img is-empty">{b.alt?.trim() ? `[${b.alt}]` : "[A photo goes here]"}</div>;
|
|
83
|
+
case "hero":
|
|
84
|
+
return (
|
|
85
|
+
<div className={with_("gb-email-text")}>
|
|
86
|
+
{b.image ? <div className="gb-email-img"><img src={b.image} alt={b.alt ?? ""} /></div> : null}
|
|
87
|
+
<h2 className="gb-email-h"><Fill text={b.title} data={data} /></h2>
|
|
88
|
+
{b.text ? <p className="gb-email-p"><Fill text={b.text} data={data} /></p> : null}
|
|
89
|
+
{b.button ? <div className="gb-email-btnrow"><span className="gb-email-btn">{fillVariables(b.button, data).text}</span></div> : null}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
case "heading":
|
|
93
|
+
return <div className={with_("gb-email-text")}><h2 className="gb-email-h"><Fill text={b.text} data={data} /></h2></div>;
|
|
94
|
+
case "paragraph":
|
|
95
|
+
return <div className={with_("gb-email-text")}><p className="gb-email-p"><Fill text={b.text} data={data} /></p></div>;
|
|
96
|
+
case "products": {
|
|
97
|
+
const shown = (products ?? []).slice(0, Math.max(1, b.count ?? 2));
|
|
98
|
+
return (
|
|
99
|
+
<div className="gb-email-products">
|
|
100
|
+
{b.title ? <p className="gb-email-p gb-email-strong"><Fill text={b.title} data={data} /></p> : null}
|
|
101
|
+
<div className="gb-email-pgrid" data-count={shown.length || b.count || 2}>
|
|
102
|
+
{(shown.length ? shown : Array.from({ length: b.count ?? 2 }, () => null)).map((p, i) => (
|
|
103
|
+
<div key={i} className="gb-email-pcard">
|
|
104
|
+
<div className="gb-email-pimg">{p?.image ? <img src={p.image} alt="" /> : null}</div>
|
|
105
|
+
<div className="gb-email-pbody">
|
|
106
|
+
<b>{p?.title ?? `A product from ${PRODUCTS_SOURCE_NAME[b.source].toLowerCase()}`}</b>
|
|
107
|
+
{p ? <span>{[p.price, p.note].filter(Boolean).join(" · ")}</span> : <span>Filled for each person</span>}
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
))}
|
|
111
|
+
</div>
|
|
112
|
+
{b.button ? <div className="gb-email-btnrow"><span className="gb-email-btn">{b.button}</span></div> : null}
|
|
113
|
+
</div>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
case "button":
|
|
117
|
+
return (
|
|
118
|
+
<div className={with_("gb-email-btnrow", ALIGN_CLASS.center)}>
|
|
119
|
+
<span className={isPersonalLink(b.url) ? "gb-email-btn is-personal" : "gb-email-btn"}><Fill text={b.text} data={data} /></span>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
case "review":
|
|
123
|
+
return (
|
|
124
|
+
<div className="gb-email-review">
|
|
125
|
+
<p className="gb-email-p gb-email-strong"><Fill text={b.title} data={data} /></p>
|
|
126
|
+
{b.text ? <p className="gb-email-p gb-email-muted"><Fill text={b.text} data={data} /></p> : null}
|
|
127
|
+
<Stars />
|
|
128
|
+
<div className="gb-email-btnrow gb-email-al-center"><span className="gb-email-btn">{b.button}</span></div>
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
case "footer":
|
|
132
|
+
return (
|
|
133
|
+
<div className="gb-email-foot">
|
|
134
|
+
{b.text ? <p><Fill text={b.text} data={data} /></p> : null}
|
|
135
|
+
<p>{brand.name} · {brand.legal_address?.trim() ? brand.legal_address : <mark className="gb-email-var">[postal address]</mark>} · <u>Unsubscribe</u> · <u>Email preferences</u></p>
|
|
136
|
+
</div>
|
|
137
|
+
);
|
|
138
|
+
case "cta":
|
|
139
|
+
return (
|
|
140
|
+
<div className="gb-email-band">
|
|
141
|
+
<p className="gb-email-h"><Fill text={b.title} data={data} /></p>
|
|
142
|
+
{b.text ? <p className="gb-email-p"><Fill text={b.text} data={data} /></p> : null}
|
|
143
|
+
<div className="gb-email-btnrow gb-email-al-center"><span className="gb-email-btn">{b.button}</span></div>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
case "product":
|
|
147
|
+
return (
|
|
148
|
+
<div className="gb-email-pcard is-one">
|
|
149
|
+
<div className="gb-email-pimg">{b.image ? <img src={b.image} alt={b.alt ?? ""} /> : null}</div>
|
|
150
|
+
<div className="gb-email-pbody"><b>{b.title}</b>{b.price ? <span>{b.price}</span> : null}</div>
|
|
151
|
+
</div>
|
|
152
|
+
);
|
|
153
|
+
case "testimonial":
|
|
154
|
+
return <blockquote className="gb-email-quote"><Fill text={b.quote} data={data} />{b.name ? <cite>{b.name}</cite> : null}</blockquote>;
|
|
155
|
+
case "list":
|
|
156
|
+
return <ul className="gb-email-list">{b.items.map((it, i) => <li key={i}><Fill text={it} data={data} /></li>)}</ul>;
|
|
157
|
+
case "columns":
|
|
158
|
+
return <div className="gb-email-cols">{b.columns.map((c, i) => <div key={i}><b>{c.title}</b><p className="gb-email-p">{c.text}</p></div>)}</div>;
|
|
159
|
+
case "divider":
|
|
160
|
+
return <hr className="gb-email-rule" />;
|
|
161
|
+
case "spacer":
|
|
162
|
+
return <div style={{ height: b.height ?? 24 }} />;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** The envelope and the mail. */
|
|
167
|
+
export function EmailPreview({ draft, brand, data, products, device = "desktop", dark = false, selected = null, onSelect, onAddAfter }: EmailPreviewProps) {
|
|
168
|
+
const c = brand.colors ?? {};
|
|
169
|
+
const style = {
|
|
170
|
+
"--gb-email-bg": c.background, "--gb-email-ink": c.text, "--gb-email-muted": c.muted, "--gb-email-line": c.border,
|
|
171
|
+
"--gb-email-btn": c.button, "--gb-email-btn-ink": c.button_text,
|
|
172
|
+
} as React.CSSProperties;
|
|
173
|
+
const pick = (i: number | null) => (e: React.SyntheticEvent) => { e.stopPropagation(); onSelect?.(i); };
|
|
174
|
+
const keyPick = (i: number | null) => (e: React.KeyboardEvent) => {
|
|
175
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
176
|
+
e.preventDefault();
|
|
177
|
+
onSelect?.(i);
|
|
178
|
+
};
|
|
179
|
+
const subject = fillVariables(draft.subject, data).text;
|
|
180
|
+
const pre = fillVariables(draft.preheader, data).text;
|
|
181
|
+
return (
|
|
182
|
+
<div className={`gb-email-col${device === "mobile" ? " is-mobile" : ""}${dark ? " is-dark" : ""}`}>
|
|
183
|
+
<section className="gb-email-env" aria-label="Envelope"
|
|
184
|
+
{...(onSelect ? { role: "button", tabIndex: 0, onClick: pick(null), onKeyDown: keyPick(null), "aria-pressed": selected === null } : {})}>
|
|
185
|
+
<span><span className="gb-email-env-k">From</span> {draft.from.name} <{draft.from.email}></span>
|
|
186
|
+
<span><span className="gb-email-env-k">Subject</span> <b>{subject || "No subject yet"}</b></span>
|
|
187
|
+
<span className="gb-email-env-pre">{pre || "No preview line yet"}</span>
|
|
188
|
+
</section>
|
|
189
|
+
<article className="gb-email-mail" style={style} aria-label={`The email: ${draft.name}`}>
|
|
190
|
+
{draft.body.map((b, i) => (b.hidden ? null : (
|
|
191
|
+
<Fragment key={i}>
|
|
192
|
+
<div className={`gb-email-blk${selected === i ? " is-sel" : ""}`} data-block={i}
|
|
193
|
+
{...(onSelect ? { role: "button", tabIndex: 0, "aria-pressed": selected === i, "aria-label": BLOCK_NAME[b.type], onClick: pick(i), onKeyDown: keyPick(i) } : {})}>
|
|
194
|
+
<Block b={b} brand={brand} data={data} products={products} />
|
|
195
|
+
</div>
|
|
196
|
+
{/* Beside the block, not in it: a button inside a block that is itself pressed would be two controls in one. */}
|
|
197
|
+
{selected === i && onAddAfter ? (
|
|
198
|
+
<div className="gb-email-addrow">
|
|
199
|
+
<button type="button" className="gb-email-add" aria-label={`Add a block below ${BLOCK_NAME[b.type]}`} title="Add a block below this one"
|
|
200
|
+
onClick={() => onAddAfter(i)}>+</button>
|
|
201
|
+
</div>
|
|
202
|
+
) : null}
|
|
203
|
+
</Fragment>
|
|
204
|
+
)))}
|
|
205
|
+
</article>
|
|
206
|
+
</div>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.gb-emailed .gemboss-editor-tb-left{gap:8px;min-width:0}.gb-emailed-crumb{max-width:22ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gemboss-text-muted);font-weight:550}.gb-emailed-slash{color:var(--gemboss-divider)}.gb-emailed-name{max-width:28ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gemboss-text-strong)}.gb-emailed-chip,.gb-emailed-tag{flex:none;padding:1px 8px;border-radius:var(--gemboss-radius-sm);background:var(--gemboss-active-bg);font-size:var(--gemboss-fs-caption);font-weight:600;white-space:nowrap}.gb-emailed-tag{padding:1px 6px;background:var(--gemboss-accent-soft);color:var(--gemboss-accent-strong);font-size:var(--gemboss-fs-micro)}.gb-emailed-view{display:inline-flex;gap:6px}.gb-emailed-col{display:flex;flex-direction:column;min-height:0}.gb-emailed-chat{flex:1;min-height:0;display:flex;flex-direction:column}.gb-emailed-chat[hidden]{display:none}.gb-emailed-pane{flex:1;min-height:0;overflow:auto;padding:12px;display:flex;flex-direction:column;gap:8px}.gb-emailed-pane>.gemboss-ei-head{margin:-12px -12px 4px}.gb-emailed-blocks{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.gb-emailed-row{display:flex;align-items:stretch;border-radius:10px;box-shadow:inset 0 0 0 1px var(--gemboss-divider);background:var(--gemboss-surface)}.gb-emailed-row.is-sel{background:var(--gemboss-accent-soft);box-shadow:inset 0 0 0 1.5px var(--gemboss-accent)}.gb-emailed-row.is-hidden{opacity:.55}.gb-emailed-row-main{flex:1;min-width:0;display:flex;align-items:center;gap:8px;padding:8px 10px;border:0;background:none;font:inherit;color:var(--gemboss-text);text-align:left;cursor:pointer;border-radius:10px}.gb-emailed-row-main:focus-visible,.gb-emailed-row-acts button:focus-visible,.gb-emailed-addend:focus-visible,.gb-emailed-checks:focus-visible,.gb-email-blk:focus-visible,.gb-email-env:focus-visible,.gb-email-add:focus-visible{outline:2px solid var(--ui-focus);outline-offset:2px}.gb-emailed-row-t{flex:1;min-width:0;display:flex;flex-direction:column}.gb-emailed-row-t b{font-weight:550;color:var(--gemboss-text-strong)}.gb-emailed-row-t span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-emailed-row-acts{display:flex;align-items:center;gap:2px;padding-right:6px}.gb-emailed-row-acts button{width:26px;height:26px;border:0;border-radius:var(--gemboss-radius-sm);background:none;color:var(--gemboss-text-muted);font:inherit;cursor:pointer}.gb-emailed-row-acts button:hover:not(:disabled){background:var(--gemboss-hover);color:var(--gemboss-text)}.gb-emailed-row-acts button:disabled{opacity:.35;cursor:default}.gb-emailed-addend{min-height:36px;padding:0 12px;border:1.5px dashed var(--gemboss-divider);border-radius:10px;background:transparent;color:var(--gemboss-text);font:inherit;font-weight:550;cursor:pointer}.gb-emailed-addend:hover{border-color:var(--gemboss-accent);color:var(--gemboss-accent-strong)}.gb-emailed-addend span{color:var(--gemboss-text-muted);font-weight:450}.gb-emailed-sum{margin-top:4px;padding:12px;border-radius:10px;background:var(--gemboss-primary-soft);display:flex;flex-direction:column;gap:6px;align-items:flex-start}.gb-emailed-sum b{color:var(--gemboss-text-strong)}.gb-emailed-muted{margin:0;font-size:var(--gemboss-fs-caption);line-height:18px;color:var(--gemboss-text-muted)}.gb-emailed-pick{padding:10px;border-radius:12px;box-shadow:inset 0 0 0 1px var(--gemboss-divider);display:flex;flex-direction:column;gap:8px}.gb-emailed-pick-head{display:flex;align-items:center;gap:8px}.gb-emailed-pick-head span{flex:1;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption)}.gb-emailed-form{display:flex;flex-direction:column;gap:12px;padding-top:4px}.gb-emailed-area{min-height:88px}.gb-emailed-vars{display:flex;flex-wrap:wrap;gap:4px;margin-top:-6px}.gb-emailed-personal{padding:10px 12px;border-radius:10px;background:var(--gemboss-accent-wash);box-shadow:inset 0 0 0 1px var(--gemboss-accent-tint);display:flex;flex-direction:column;align-items:flex-start;gap:4px;font-size:var(--gemboss-fs-caption);color:var(--gemboss-text-muted)}.gb-emailed-personal b{font-size:var(--gemboss-fs-body);color:var(--gemboss-text-strong)}.gb-emailed-from{color:var(--gemboss-text-muted)}.gb-emailed-stage{background:var(--gemboss-preview-canvas)}.gb-emailed-scroll{flex:1;min-width:0;overflow:auto;padding:24px}.gb-emailed-meta,.gb-emailed-checklist{max-width:640px;margin:0 auto 12px;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px}.gb-emailed-checklist{display:block;padding:12px;border-radius:12px;background:var(--gemboss-surface)}.gb-emailed-checks,.gb-emailed-as,.gb-emailed-note{padding:4px 10px;border:0;border-radius:var(--gemboss-radius-full);background:var(--gemboss-warning-soft);color:var(--gemboss-warning);font:inherit;font-size:var(--gemboss-fs-caption);font-weight:600}.gb-emailed-checks{cursor:pointer}.gb-emailed-checks.is-ok{background:var(--gemboss-success-soft);color:var(--gemboss-success-strong)}.gb-emailed-as,.gb-emailed-note{background:var(--gemboss-surface);color:var(--gemboss-text);font-weight:450}.gb-emailed-addmail{display:block;max-width:640px;width:100%;margin:12px auto 0;background:var(--gemboss-surface)}.gb-emailed-sent{max-width:640px;margin:0 auto;display:flex;flex-direction:column;gap:8px}.gb-emailed-sent.is-mobile{max-width:375px}.gb-emailed-sent[aria-busy=true]{opacity:.6}.gb-emailed-sent-frame{display:block;width:100%;height:72vh;min-height:480px;border:0;border-radius:var(--gemboss-radius-md);background:var(--gemboss-surface)}.gb-emailed-sent-err{margin:0;color:var(--gemboss-text-muted);font-size:var(--gemboss-fs-caption)}.gb-email-col{max-width:640px;margin:0 auto;display:flex;flex-direction:column;gap:12px;color:var(--gemboss-text)}.gb-email-col.is-mobile{max-width:375px}.gb-email-env{padding:12px 16px;border-radius:12px;background:var(--gemboss-surface);display:flex;flex-direction:column;gap:2px;cursor:pointer}.gb-email-env[aria-pressed=true]{box-shadow:inset 0 0 0 1.5px var(--gemboss-accent)}.gb-email-env-k,.gb-email-env-pre{color:var(--gemboss-text-muted)}.gb-email-mail{--gb-ink: var(--gb-email-ink, var(--gemboss-text));--gb-muted: var(--gb-email-muted, var(--gemboss-text-muted));--gb-line: var(--gb-email-line, var(--gemboss-divider-soft));border-radius:12px;background:var(--gb-email-bg, var(--gemboss-surface));color:var(--gb-ink);overflow:hidden;display:flex;flex-direction:column}.is-dark>.gb-email-mail{--gb-ink: var(--gemboss-dark-text);--gb-muted: var(--gemboss-dark-muted);--gb-line: var(--gemboss-dark-divider);background:var(--gemboss-dark-surface)}.gb-email-blk{position:relative;cursor:pointer}.gb-email-blk:hover{box-shadow:inset 0 0 0 1px var(--gemboss-accent-mid)}.gb-email-blk.is-sel{box-shadow:inset 0 0 0 2px var(--gemboss-accent)}.gb-email-addrow{position:relative;height:0;display:flex;justify-content:center;z-index:1}.gb-email-add{position:absolute;top:-14px;width:28px;height:28px;border:0;border-radius:50%;background:var(--gemboss-accent);color:var(--gemboss-on-primary);font:inherit;font-size:18px;line-height:1;cursor:pointer;box-shadow:var(--gemboss-shadow-raised)}.gb-email-logo{height:56px;display:grid;place-items:center;border-bottom:1px solid var(--gb-line);font-weight:700;letter-spacing:.2em;color:var(--gb-ink)}.gb-email-logo img{max-height:32px}.gb-email-al-left{text-align:left;justify-content:flex-start}.gb-email-al-center{text-align:center;justify-content:center}.gb-email-al-right{text-align:right;justify-content:flex-end}.gb-email-img img{display:block;width:100%;height:auto}.gb-email-img.is-empty{height:150px;display:grid;place-items:center;background:var(--gemboss-warning-soft);color:var(--gb-muted);font-size:var(--gemboss-fs-caption)}.gb-email-text{padding:24px 32px 8px;display:flex;flex-direction:column;gap:8px}.gb-email-h{margin:0;font-size:22px;line-height:28px;font-weight:700;color:var(--gb-ink)}.gb-email-p{margin:0;line-height:20px;color:var(--gb-ink)}.gb-email-strong{font-weight:650}.gb-email-muted{color:var(--gb-muted)}.gb-email-link{text-decoration:underline}.gb-email-var{padding:0 2px;border-radius:3px;background:var(--gemboss-warning-soft);color:var(--gemboss-warning)}.gb-email-products,.gb-email-review,.gb-email-band{padding:8px 32px;display:flex;flex-direction:column;gap:10px}.gb-email-review{align-items:center;text-align:center;padding-block:16px}.gb-email-pgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.gb-email-pgrid[data-count="1"]{grid-template-columns:minmax(0,1fr)}.gb-email-pgrid[data-count="3"]{grid-template-columns:repeat(3,minmax(0,1fr))}.is-mobile .gb-email-pgrid{grid-template-columns:minmax(0,1fr)}.gb-email-pcard{border:1px solid var(--gb-line);border-radius:10px;overflow:hidden}.gb-email-pcard.is-one{margin:8px 32px;display:flex}.gb-email-pimg{height:80px;background:var(--gemboss-warning-soft)}.gb-email-pimg img{width:100%;height:100%;object-fit:cover}.gb-email-pbody{padding:8px 10px;display:flex;flex-direction:column}.gb-email-pbody span{color:var(--gb-muted)}.gb-email-btnrow{padding:12px 32px 24px;display:flex;justify-content:center}.gb-email-products .gb-email-btnrow,.gb-email-review .gb-email-btnrow,.gb-email-text .gb-email-btnrow,.gb-email-band .gb-email-btnrow{padding:4px 0 8px}.gb-email-btn{padding:12px 24px;border-radius:8px;background:var(--gb-email-btn, var(--gemboss-primary));color:var(--gb-email-btn-ink, var(--gemboss-on-primary));font-weight:600}.gb-email-stars{display:inline-flex;gap:4px;fill:none;stroke:var(--gemboss-warning);stroke-width:1.4}.gb-email-foot{padding:12px 32px 20px;border-top:1px solid var(--gb-line);text-align:center;font-size:var(--gemboss-fs-caption);color:var(--gb-muted)}.gb-email-foot p{margin:0 0 4px}.gb-email-quote{margin:8px 32px;padding:16px;border-radius:8px;background:var(--gemboss-primary-soft);font-style:italic}.gb-email-quote cite{display:block;margin-top:8px;font-style:normal;font-weight:600}.gb-email-list{margin:0;padding:8px 32px 8px 54px}.gb-email-cols{padding:8px 32px;display:grid;grid-template-columns:1fr 1fr;gap:16px}.gb-email-rule{margin:8px 32px;border:0;border-top:1px solid var(--gb-line)}.is-mobile .gb-email-text,.is-mobile .gb-email-products,.is-mobile .gb-email-review,.is-mobile .gb-email-btnrow,.is-mobile .gb-email-foot{padding-inline:20px}@media (max-width: 47.9975em){.gb-emailed-crumb,.gb-emailed-slash{display:none}.gb-emailed-scroll{padding:12px}.gb-email-pgrid{grid-template-columns:minmax(0,1fr)}.gb-emailed-row-main,.gb-emailed-addend,.gb-emailed-row-acts button{min-height:44px}.gb-emailed-row-acts button{min-width:44px}}
|
package/src/gem-at-work.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gb-gaw{position:absolute;left:0;top:0;width:0;height:0;overflow:visible;pointer-events:none;z-index:2147483000;--gb-gaw-ring: var(--gemboss-accent, #5661f5);--gb-gaw-bad: var(--gemboss-danger, #d72c0d);font:600 11px/1 -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.gb-gaw>*{position:absolute;box-sizing:border-box}.gb-gaw__cursor{left:0;top:0;width:14px;height:18px;z-index:2;will-change:transform}.gb-gaw__cursor svg{display:block;width:14px;height:18px;max-width:none;max-height:none;overflow:visible;filter:drop-shadow(0 1px 1px rgba(0,0,0,.28))}.gb-gaw__cursor path{fill:var(--c, var(--gb-gaw-ring));stroke:#fff;stroke-width:1.3;stroke-linejoin:round}.gb-gaw__tag{position:absolute;left:11px;top:15px;padding:4px 6px;border-radius:3px;background:var(--c, var(--gb-gaw-ring));color:var(--ink, #fff);white-space:nowrap;box-shadow:0 1px 2px #0003}.gb-gaw__cursor.is-failed path{fill:var(--gb-gaw-bad)}.gb-gaw__cursor.is-failed .gb-gaw__tag{background:var(--gb-gaw-bad);color:#fff}.gb-gaw__ring{border:1.5px solid var(--gb-gaw-ring);border-radius:2px}.gb-gaw__label{position:absolute;left:-2px;top:-21px;padding:5px 7px;border-radius:3px 3px 0 0;background:var(--gb-gaw-ring);color:#fff;white-space:nowrap}.gb-gaw__ring--slot{border-color:transparent}.gb-gaw__ring.is-applied .gb-gaw__label:after{content:" \2713"}.gb-gaw__ring.is-failed{border-color:var(--gb-gaw-bad)}.gb-gaw__ring.is-failed .gb-gaw__label{background:var(--gb-gaw-bad)}.gb-gaw__slot{min-height:120px;padding:18px 22px;border:1.5px dashed var(--gb-gaw-ring);border-radius:6px;background:var(--gemboss-accent-wash, #f7f8ff);box-shadow:0 6px 20px #1f1e1d14}.gb-gaw__slot--new{padding:26px 30px;border:0;border-radius:12px;background:var(--gemboss-accent-wash, #f7f8ff);box-shadow:0 1px 2px #1f1e1d0a,0 8px 24px #1f1e1d0f}.gb-gaw__ghost-h,.gb-gaw__ghost-p{width:fit-content;max-width:100%}.gb-gaw__ghost-h{margin:0 0 10px;color:#1b1c1e;font-size:28px;font-weight:600;line-height:1.2}.gb-gaw__ghost-p{margin:0 0 6px;color:#3d4250;font-size:16px;font-weight:400;line-height:1.5}.gb-gaw__sel{border:1px solid var(--gb-gaw-ring)}.gb-gaw__sel i{position:absolute;width:6px;height:6px;background:#fff;border:1px solid var(--gb-gaw-ring)}.gb-gaw__sel i:nth-child(1){left:-3.5px;top:-3.5px}.gb-gaw__sel i:nth-child(2){right:-3.5px;top:-3.5px}.gb-gaw__sel i:nth-child(3){left:-3.5px;bottom:-3.5px}.gb-gaw__sel i:nth-child(4){right:-3.5px;bottom:-3.5px}.gb-gaw__dim{position:absolute;left:-1px;top:calc(100% + 4px);padding:2px 4px;border-radius:2px;background:var(--gb-gaw-ring);color:#fff;font:600 9.5px/1 ui-monospace,SF Mono,Menlo,Consolas,monospace;white-space:nowrap}.gb-gaw__guide{background
|
|
1
|
+
.gb-gaw{position:absolute;left:0;top:0;width:0;height:0;overflow:visible;pointer-events:none;z-index:2147483000;--gb-gaw-ring: var(--gemboss-accent, #5661f5);--gb-gaw-bad: var(--gemboss-danger, #d72c0d);font:600 11px/1 -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif}.gb-gaw>*{position:absolute;box-sizing:border-box}.gb-gaw__cursor{left:0;top:0;width:14px;height:18px;z-index:2;will-change:transform}.gb-gaw__cursor svg{display:block;width:14px;height:18px;max-width:none;max-height:none;overflow:visible;filter:drop-shadow(0 1px 1px rgba(0,0,0,.28))}.gb-gaw__cursor path{fill:var(--c, var(--gb-gaw-ring));stroke:#fff;stroke-width:1.3;stroke-linejoin:round}.gb-gaw__tag{position:absolute;left:11px;top:15px;padding:4px 6px;border-radius:3px;background:var(--c, var(--gb-gaw-ring));color:var(--ink, #fff);white-space:nowrap;box-shadow:0 1px 2px #0003}.gb-gaw__cursor.is-left .gb-gaw__tag{left:auto;right:6px}.gb-gaw__cursor.is-failed path{fill:var(--gb-gaw-bad)}.gb-gaw__cursor.is-failed .gb-gaw__tag{background:var(--gb-gaw-bad);color:#fff}.gb-gaw__ring{border:1.5px solid var(--gb-gaw-ring);border-radius:2px}.gb-gaw__label{position:absolute;left:-2px;top:-21px;padding:5px 7px;border-radius:3px 3px 0 0;background:var(--gb-gaw-ring);color:#fff;white-space:nowrap}.gb-gaw__ring--slot{border-color:transparent}.gb-gaw__ring.is-applied .gb-gaw__label:after{content:" \2713"}.gb-gaw__ring.is-failed{border-color:var(--gb-gaw-bad)}.gb-gaw__ring.is-failed .gb-gaw__label{background:var(--gb-gaw-bad)}.gb-gaw__slot{min-height:120px;padding:18px 22px;border:1.5px dashed var(--gb-gaw-ring);border-radius:6px;background:var(--gemboss-accent-wash, #f7f8ff);box-shadow:0 6px 20px #1f1e1d14}.gb-gaw__slot--new{padding:26px 30px;border:0;border-radius:12px;background:var(--gemboss-accent-wash, #f7f8ff);box-shadow:0 1px 2px #1f1e1d0a,0 8px 24px #1f1e1d0f}.gb-gaw__ghost-h,.gb-gaw__ghost-p{width:fit-content;max-width:100%}.gb-gaw__ghost-h{margin:0 0 10px;color:#1b1c1e;font-size:28px;font-weight:600;line-height:1.2}.gb-gaw__ghost-p{margin:0 0 6px;color:#3d4250;font-size:16px;font-weight:400;line-height:1.5}.gb-gaw__sel{border:1px solid var(--gb-gaw-ring)}.gb-gaw__sel i{position:absolute;width:6px;height:6px;background:#fff;border:1px solid var(--gb-gaw-ring)}.gb-gaw__sel i:nth-child(1){left:-3.5px;top:-3.5px}.gb-gaw__sel i:nth-child(2){right:-3.5px;top:-3.5px}.gb-gaw__sel i:nth-child(3){left:-3.5px;bottom:-3.5px}.gb-gaw__sel i:nth-child(4){right:-3.5px;bottom:-3.5px}.gb-gaw__dim{position:absolute;left:-1px;top:calc(100% + 4px);padding:2px 4px;border-radius:2px;background:var(--gb-gaw-ring);color:#fff;font:600 9.5px/1 ui-monospace,SF Mono,Menlo,Consolas,monospace;white-space:nowrap}.gb-gaw__guide{background:#ff7a45;opacity:.75}.gb-gaw__caret{background:var(--gb-gaw-ring)}.gb-gaw__caret--inline{position:static;display:inline-block;width:2px;height:.9em;margin-left:2px;vertical-align:-.1em}.gb-gaw__veil{background:#a9b1fb;opacity:.92}.gb-gaw__scan{background:var(--gb-gaw-ring);box-shadow:0 0 14px 4px #5661f559}.gb-gaw__glow{border:2px solid var(--gb-gaw-ring);border-radius:2px;box-shadow:0 0 0 4px #5661f52e;opacity:0}@media (prefers-reduced-motion: reduce){.gb-gaw__cursor,.gb-gaw__scan,.gb-gaw__guide{display:none}}.gb-gaw-skip{position:fixed;right:16px;bottom:16px;z-index:2147483001;padding:7px 12px;border:0;border-radius:999px;background:#16171adb;color:#fff;font:600 12px/1 -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;cursor:pointer;box-shadow:0 2px 8px #0000002e}.gb-gaw-skip:focus-visible{outline:2px solid var(--ui-focus, #5661f5);outline-offset:2px}.gb-gaw__say,.gb-gaw-goal,.gb-gaw-count{z-index:2147483001;pointer-events:none;padding:6px 10px;border-radius:6px;background:#16171ae0;color:#fff;font:500 12px/1.35 system-ui,sans-serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:420px;box-shadow:0 2px 8px #0000002e}.gb-gaw__say{position:absolute;left:0;top:0}.gb-gaw-goal{position:fixed;left:16px;bottom:16px}.gb-gaw-goal i,.gb-gaw-count i{display:block;height:3px;margin-top:5px;border-radius:2px;background:var(--gemboss-accent, #5661f5);transform-origin:left}.gb-gaw__plus{color:#fff;background:var(--gb-gaw-ring);font:700 11px/12px monospace;text-align:center}.gb-gaw-ruler{position:fixed;left:0;right:0;height:14px;z-index:2147483000;pointer-events:none;background:repeating-linear-gradient(90deg,#fff 0 1px,transparent 1px 10px) bottom / 100% 4px no-repeat #16171a}.gb-gaw-ruler span{position:absolute;color:#fff;font:9px monospace}.gb-gaw-count{position:fixed;left:50%;bottom:16px;transform:translate(-50%)}.gb-gaw-count b{display:inline-block;width:8px;height:8px;border-radius:50%}
|