@sharadox/email-web-library 0.5.0-standard-shape.13 → 0.6.0-development.29

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 ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ What changed in each version of `@sharadox/email-web-library`, newest first.
4
+
5
+ ## 0.6.0
6
+
7
+ - **Breaking:** one layout for every company, the same in every mail app: a centered column 600 pixels wide with 16 pixels around it and no background (the mail app's own shows). The logo, heading, values, company name and site are `#000000`, labels and the rest `#5E5E5E`; in dark themes, where the mail app honors the rules (`@media (prefers-color-scheme: dark)`, and `[data-ogsc]` for Outlook.com, the only styles not inline), `#FFFFFF` and `#A1A1A1`, with the white logo ("logo-dark") instead of the black one (which has a white outline for apps that darken on their own). Spaces are 4, 8, 16 or 32 pixels; Geist where the reader has it, the device's own sans otherwise. Dark designs no longer showed as designed in some apps (Proton Mail on Android).
8
+ - **Breaking:** `EmailDesign` is `{ name, logo?, wordmark?, signature? }`; `EmailContent` is `{ language, preview, eyebrow, heading, paragraphs?, rows?, closing? }`: rows take a list (`value: string[]`, a dot per line) or a text keeping its line breaks (`keepLines`), and `closing` signs off with the company's name in bold (the quote, button and small print are gone). `emailLayout`'s third argument takes `{ light, dark }` logos (or `true` for the black one only). New exports: `EMAIL_COLORS`, `EMAIL_FONT`, `EMAIL_SPACES`, `EmailLogos`.
9
+ - The lines between details are #5E5E5E in both themes.
package/README.md CHANGED
@@ -16,7 +16,7 @@ pnpm add @sharadox/email-web-library
16
16
  ## Use
17
17
 
18
18
  Import each part from its own path, like every Sharadox library (`@sharadox/email-web-library/email-sender`,
19
- `…/email-layout`, `…/email-server-configuration`, `…/email-message`, `…/email-address`, `…/email-error`). The root
19
+ `…/email-layout`, `…/email-server-configuration`, `…/email-message`, `…/email-address`, `…/email-error`, `…/inline-image`, which turns a base64 image such as a logo into one to send). The root
20
20
  import (`@sharadox/email-web-library`) still works in 0.5 and goes away in 0.6.
21
21
 
22
22
  Set the server in the environment:
@@ -63,56 +63,41 @@ await sender.send({
63
63
  });
64
64
  ```
65
65
 
66
- ### In the brand's design
66
+ ### In the company's layout
67
67
 
68
- `emailLayout(content, design, logo)` writes the html of an email in a brand's own look, so every email a company sends looks like its website. The design holds its colors, type, rules, header, button and signature. Fonts are stacks the reader's device already has: web fonts would tell a font service the email was opened. Everything given is escaped, and the layout is tables with inline styles, as email clients need; on phones, details stack under their labels.
68
+ `emailLayout(content, design, logos)` writes the html of an email that looks the same in every mail app: a centered column 600 pixels wide with 16 pixels around it, and no background (the mail app's own shows). The logo, the heading, the values, the company's name and its site are black (`#000000`), the labels and the rest gray (`#5E5E5E`); in a dark theme, where the mail app honors it (Apple Mail, Outlook on phones and Macs, Outlook.com and others), they turn white (`#FFFFFF`) and light gray (`#A1A1A1`) and the white logo shows instead. Mail apps that ignore it darken the email their own way. Spaces are 4, 8, 16 or 32 pixels. The font is Geist where the reader has it, the device's own sans otherwise (no web fonts, which would tell a font service the email was opened). Everything given is escaped.
69
69
 
70
70
  ```ts
71
- import { emailLayout, type EmailDesign } from "@sharadox/email-web-library";
71
+ import { emailLayout } from "@sharadox/email-web-library/email-layout";
72
+ import type { EmailDesign } from "@sharadox/email-web-library/email-layout/type";
72
73
 
73
74
  const design: EmailDesign = {
74
- name: "Sharadox",
75
- logo: { width: 30, height: 30 }, // shown size of the inline image "logo"
76
- wordmark: true, // the name beside the logo
77
- align: "left",
78
- colors: {
79
- page: "#000",
80
- card: "#000",
81
- edge: "#262626",
82
- text: "#fff",
83
- muted: "#a3a3a3",
84
- quiet: "#737373",
85
- rule: "#2e2e2e",
86
- accent: "#fff",
87
- box: "#0a0a0a",
88
- onAccent: "#000",
89
- },
90
- fonts: { heading: "Geist, sans-serif", body: "Geist, sans-serif", label: "'Geist Mono', monospace" },
91
- heading: { size: 34, weight: 600, letterSpacing: "-0.04em", lineHeight: 1.1 },
92
- label: { size: 11, letterSpacing: "0.06em" },
93
- rule: "dashed", // between details
94
- radius: 0,
95
- crosses: true, // a grid's frame, with "+" where its lines cross
96
- button: { radius: 999, uppercase: false, letterSpacing: "0" },
97
- signature: [{ text: "sharadox.com", href: "https://sharadox.com" }],
75
+ name: "Sharadox", // beside the logo with wordmark, and in the sign-off
76
+ logo: { width: 30, height: 30 }, // shown size of the inline images "logo" (black) and "logo-dark" (white)
77
+ wordmark: true,
78
+ signature: [{ text: "sharadox.com", href: "https://sharadox.com" }], // at the very end
98
79
  };
99
80
 
100
81
  const html = emailLayout(
101
82
  {
102
83
  language: "en",
103
- preview: "Ana sent a message",
84
+ preview: "Thank you, Ana.",
104
85
  eyebrow: "Contact",
105
- heading: "Ana Sousa",
106
- rows: [{ label: "Email", value: "ana@example.com", href: "mailto:ana@example.com" }],
107
- quote: { label: "Message", text: "Hello!" },
108
- button: { label: "Reply to Ana", href: "mailto:ana@example.com" },
86
+ heading: "Thank you, Ana.",
87
+ paragraphs: ["Your message has reached us…"],
88
+ rows: [
89
+ { label: "Email", value: "ana@example.com", href: "mailto:ana@example.com" },
90
+ { label: "Needs", value: ["Website", "Hosting"] }, // a list: one item per line after a dot
91
+ { label: "Message", value: "Hello!\nSee you.", keepLines: true },
92
+ ],
93
+ closing: "Best regards,", // then the company's name in bold
109
94
  },
110
95
  design,
111
- true, // the email carries the inline image "logo"
96
+ { light: true, dark: true }, // the logos the email carries: "logo" and "logo-dark" (true: "logo" only)
112
97
  );
113
98
  ```
114
99
 
115
- Optional touches: `colors.accentGradient` (a shiny accent where the device shows gradients), `colors.headerRule` (the line under the header), `eyebrowLine` (a short line before the eyebrow) and `quoteBar` (an accent bar beside a quoted text).
100
+ The black logo should carry a thin white outline: it stays visible where a mail app darkens the email itself. `EMAIL_COLORS` holds both palettes, `EMAIL_SPACES` the spaces and `EMAIL_FONT` the font stack.
116
101
 
117
102
  `sender.verify()` logs in without sending, handy for a health check. `checkEmailMessage` and `checkEmailAddress` are exported for validating input before you get as far as sending.
118
103
 
@@ -1,13 +1,41 @@
1
- import type { EmailContent, EmailDesign } from "@sharadox/email-web-library/email-layout/type";
1
+ import type { EmailContent, EmailDesign, EmailLogos } from "@sharadox/email-web-library/email-layout/type";
2
2
  /**
3
- * An email in a brand's design, the same in every inbox: its logo (and name), a rule in its color, an eyebrow and a
4
- * heading, then paragraphs, details, a quoted text and one button, small print, and the company's signature. Built
5
- * from tables with inline styles, as email clients need; everything given is escaped. `logo` says whether the email
6
- * carries the inline image "logo".
3
+ * The colors every email is drawn in, with no background (the mail app's own shows): `strong` for the logo, the
4
+ * heading, the values, the company's name and its site; `soft` for labels and the rest of the text; `line` between
5
+ * details. Each in a light theme and a dark one.
6
+ */
7
+ export declare const EMAIL_COLORS: {
8
+ readonly light: {
9
+ readonly strong: "#000000";
10
+ readonly soft: "#5E5E5E";
11
+ readonly line: "#5E5E5E";
12
+ };
13
+ readonly dark: {
14
+ readonly strong: "#FFFFFF";
15
+ readonly soft: "#A1A1A1";
16
+ readonly line: "#5E5E5E";
17
+ };
18
+ };
19
+ /** Geist where the reader has it, the device's own sans otherwise. */
20
+ export declare const EMAIL_FONT = "Geist, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
21
+ /** The only spaces between things, in pixels: 4, 8, 16 (the usual one) and 32. */
22
+ export declare const EMAIL_SPACES: {
23
+ readonly tiny: 4;
24
+ readonly small: 8;
25
+ readonly normal: 16;
26
+ readonly large: 32;
27
+ };
28
+ /**
29
+ * An email that looks the same in every inbox, in a centered column 600 pixels wide: the logo, an eyebrow and a
30
+ * heading, paragraphs, the details (each label over its value, lines between them), a sign-off with the company's
31
+ * name, and its site. No background: the mail app's own shows; the text is black and gray, white and light gray in
32
+ * dark themes where the mail app honors them (the only styles not inline). Spaces are 4, 8, 16 or 32 pixels. Geist
33
+ * where the reader has it, the device's own sans otherwise. Everything given is escaped. `logos` says which logo
34
+ * images the email carries (`true`: the black one only).
7
35
  *
8
36
  * @example
9
- * emailLayout({ language: "en", preview: "Ana sent a message", eyebrow: "Contact", heading: "Ana",
10
- * rows: [{ label: "Email", value: "ana@example.com" }] }, SHARADOX_EMAIL, true);
37
+ * emailLayout({ language: "en", preview: "Ana sent a message", eyebrow: "Contact", heading: "Thank you, Ana.",
38
+ * rows: [{ label: "Email", value: "ana@example.com" }], closing: "Best regards," }, { name: "Acme" }, false);
11
39
  */
12
- export declare function emailLayout(content: EmailContent, design: EmailDesign, logo: boolean): string;
40
+ export declare function emailLayout(content: EmailContent, design: EmailDesign, logos: EmailLogos | boolean): string;
13
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/email-layout/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAY,MAAM,+CAA+C,CAAC;AAiGzG;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CA0C7F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/email-layout/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAY,MAAM,+CAA+C,CAAC;AAErH;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;CAGf,CAAC;AAEX,sEAAsE;AACtE,eAAO,MAAM,UAAU,+FAA+F,CAAC;AAEvH,kFAAkF;AAClF,eAAO,MAAM,YAAY;;;;;CAAwD,CAAC;AA6ElF;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,CAyC3G"}
@@ -1,102 +1,106 @@
1
1
  import { escapeHtml } from "@sharadox/web-library/html/escape";
2
2
  /**
3
- * On phones, where the email app reads it (Apple Mail, the Gmail apps): narrower sides, and each detail's label over
4
- * its value, so values keep the whole width.
3
+ * The colors every email is drawn in, with no background (the mail app's own shows): `strong` for the logo, the
4
+ * heading, the values, the company's name and its site; `soft` for labels and the rest of the text; `line` between
5
+ * details. Each in a light theme and a dark one.
5
6
  */
6
- const PHONE = "@media (max-width:520px){.side{padding-left:22px!important;padding-right:22px!important}.label,.value{display:block!important;width:auto!important}.label{padding:14px 0 2px!important}.value{border-top:0!important;padding:0 0 12px!important}}";
7
+ export const EMAIL_COLORS = {
8
+ light: { strong: "#000000", soft: "#5E5E5E", line: "#5E5E5E" },
9
+ dark: { strong: "#FFFFFF", soft: "#A1A1A1", line: "#5E5E5E" },
10
+ };
11
+ /** Geist where the reader has it, the device's own sans otherwise. */
12
+ export const EMAIL_FONT = "Geist, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
13
+ /** The only spaces between things, in pixels: 4, 8, 16 (the usual one) and 32. */
14
+ export const EMAIL_SPACES = { tiny: 4, small: 8, normal: 16, large: 32 };
15
+ const { light, dark } = EMAIL_COLORS;
16
+ const { tiny, small, normal, large } = EMAIL_SPACES;
17
+ /** The dark theme's rules, one class per role. */
18
+ const DARK = `.strong{color:${dark.strong}!important}.soft{color:${dark.soft}!important}.line{border-color:${dark.line}!important}.logo-light{display:none!important}.logo-dark{display:block!important;max-height:none!important;overflow:visible!important}`;
19
+ /**
20
+ * The dark theme, for mail apps that honor it (Apple Mail, Outlook on phones and Macs, and others): white and light
21
+ * gray text, dark lines, and the white logo instead of the black one. Said again for Outlook.com, which marks its dark
22
+ * theme with a `data-ogsc` attribute. Mail apps that ignore it darken the email their own way, which the black
23
+ * logo's white outline survives.
24
+ */
25
+ const DARK_RULES = `@media (prefers-color-scheme:dark){${DARK}}${DARK.replace(/(^|\})\./g, "$1[data-ogsc] .")}`;
26
+ /** The font, on everything. */
27
+ const FONT = `font-family:${EMAIL_FONT}`;
7
28
  /** A table that's only there for layout, as email clients need. */
8
- const table = (style, rows, width) => `<table role="presentation" cellpadding="0" cellspacing="0" border="0"${width ? ` width="${width}"` : ""} style="border-collapse:separate;${style}">${rows}</table>`;
9
- /** The accent as a background: the gradient where the reader's device shows one, the plain color otherwise. */
10
- const accentBackground = ({ colors }) => `background-color:${colors.accent};${colors.accentGradient ? `background-image:${colors.accentGradient};` : ""}`;
11
- /** Text in the label style: small, spaced capitals. */
12
- const labelStyle = (design, color) => `font-family:${design.fonts.label};font-size:${design.label.size}px;line-height:1.5;letter-spacing:${design.label.letterSpacing};text-transform:uppercase;color:${color}`;
13
- /** A value, as a link when it has one. */
14
- const value = ({ value: text, href }, color) => href
15
- ? `<a href="${escapeHtml(href)}" style="color:${color};text-decoration:underline;text-underline-offset:3px">${escapeHtml(text)}</a>`
16
- : escapeHtml(text);
17
- /** The logo, and the company's name beside it with `wordmark`. */
18
- function header(design, logo) {
19
- const { colors, fonts } = design;
20
- const mark = logo && design.logo
21
- ? `<td style="vertical-align:middle;padding:0${design.wordmark ? " 12px 0 0" : ""}"><img src="cid:logo" width="${design.logo.width}" height="${design.logo.height}" alt="${escapeHtml(design.name)}" style="display:block;width:${design.logo.width}px;height:${design.logo.height}px;border:0"></td>`
22
- : "";
23
- const name = design.wordmark || !mark
24
- ? `<td style="vertical-align:middle;font-family:${fonts.body};font-size:19px;font-weight:600;letter-spacing:-0.02em;color:${colors.text}">${escapeHtml(design.name)}</td>`
25
- : "";
26
- return table(design.align === "center" ? "margin:0 auto" : "", `<tr>${mark}${name}</tr>`);
27
- }
28
- /** The details, one per line: the label above or beside its value, rules between them. */
29
- function details(design, rows) {
30
- const { colors, fonts } = design;
31
- const line = `border-top:1px ${design.rule} ${colors.rule}`;
32
- return table("width:100%;margin:28px 0 0", rows
33
- .map((row) => `<tr><td class="label" style="${line};padding:14px 16px 14px 0;width:136px;vertical-align:top;${labelStyle(design, colors.quiet)}">${escapeHtml(row.label)}</td><td class="value" style="${line};padding:12px 0;vertical-align:top;font-family:${fonts.body};font-size:15px;line-height:1.55;color:${colors.text};word-break:break-word">${value(row, colors.text)}</td></tr>`)
34
- .join("") + `<tr><td colspan="2" style="${line};font-size:0;line-height:0">&nbsp;</td></tr>`);
29
+ const table = (style, rows, attributes = "") => `<table role="presentation" cellpadding="0" cellspacing="0" border="0"${attributes} style="border-collapse:collapse;${style}">${rows}</table>`;
30
+ /** Text in one of the two colors. */
31
+ const colored = (role, style) => `class="${role}" style="${FONT};${style};color:${light[role]}"`;
32
+ /** Small spaced capitals: the eyebrow and the labels. */
33
+ const CAPITALS = colored("soft", "font-size:12px;font-weight:600;line-height:16px;letter-spacing:0.08em;text-transform:uppercase");
34
+ /** A detail's value: text, a link, or a list of items, one per line after a dot. */
35
+ function value(row) {
36
+ if (typeof row.value !== "string")
37
+ return row.value.map((item) => `&bull;&nbsp;${escapeHtml(item)}`).join("<br>");
38
+ const text = escapeHtml(row.value);
39
+ return row.href
40
+ ? `<a class="strong" href="${escapeHtml(row.href)}" style="color:${light.strong};text-decoration:underline">${text}</a>`
41
+ : text;
35
42
  }
36
- /** A longer text in its own box, keeping its line breaks. */
37
- function quoted(design, quote) {
38
- const { colors, fonts } = design;
39
- const bar = design.quoteBar ? `border-left:2px solid ${colors.accent};` : "";
40
- return `<p style="margin:32px 0 10px;${labelStyle(design, colors.quiet)}">${escapeHtml(quote.label)}</p>${table("width:100%", `<tr><td style="${bar}padding:20px 22px;background-color:${colors.box};border:1px solid ${colors.edge};border-radius:${Math.min(design.radius, 14)}px;font-family:${fonts.body};font-size:15px;line-height:1.7;color:${colors.text};white-space:pre-wrap;word-break:break-word">${escapeHtml(quote.text)}</td></tr>`)}`;
43
+ /** The logo: the black one, and the white one for dark themes, hidden unless a dark theme shows it. */
44
+ function mark(design, logos) {
45
+ if (!logos.light || !design.logo)
46
+ return "";
47
+ const { width, height } = design.logo;
48
+ const image = (id) => `<img src="cid:${id}" width="${width}" height="${height}" alt="${escapeHtml(design.name)}" style="display:block;width:${width}px;height:${height}px;border:0">`;
49
+ const darkLogo = logos.dark
50
+ ? `<div class="logo-dark" style="display:none;max-height:0;overflow:hidden;mso-hide:all">${image("logo-dark")}</div>`
51
+ : "";
52
+ return `<td style="vertical-align:middle;padding:0${design.wordmark ? ` ${small}px 0 0` : ""}"><div class="logo-light">${image("logo")}</div>${darkLogo}</td>`;
41
53
  }
42
- /** The one thing to do next, as a button that works in every email client (a padded link). */
43
- function action(design, button) {
44
- const { colors, fonts } = design;
45
- return table(`margin:32px ${design.align === "center" ? "auto" : "0"} 0`, `<tr><td style="${accentBackground(design)}border-radius:${design.button.radius}px"><a href="${escapeHtml(button.href)}" style="display:inline-block;padding:14px 28px;font-family:${fonts.body};font-size:14px;font-weight:600;letter-spacing:${design.button.letterSpacing};${design.button.uppercase ? "text-transform:uppercase;" : ""}color:${colors.onAccent};text-decoration:none;border-radius:${design.button.radius}px">${escapeHtml(button.label)}</a></td></tr>`);
54
+ /** The logo at the top, and the company's name beside it with `wordmark` (or alone, without a logo). */
55
+ function header(design, logos) {
56
+ const logo = mark(design, logos);
57
+ const name = design.wordmark || !logo
58
+ ? `<td ${colored("strong", "vertical-align:middle;font-size:19px;font-weight:700;letter-spacing:-0.01em")}>${escapeHtml(design.name)}</td>`
59
+ : "";
60
+ return table("", `<tr>${logo}${name}</tr>`);
46
61
  }
47
- /** A "+" where two of the frame's lines cross, centered on them (it spans two half cells each way). */
48
- const cross = ({ fonts, colors }) => `<td colspan="2" rowspan="2" width="12" height="12" align="center" valign="middle" style="width:12px;height:12px;padding:0;font-family:${fonts.label};font-size:19px;line-height:12px;color:${colors.quiet}">+</td>`;
49
- /**
50
- * The card inside a grid's frame, drawn from table cells so it holds in every email client: lines along its four
51
- * sides, each through the middle of a pair of half cells, and a "+" where they cross at each corner.
52
- */
53
- function framed(design, card) {
54
- const line = `1px solid ${design.colors.edge}`;
55
- const half = (style = "") => `<td width="6" style="width:6px;padding:0;font-size:0;line-height:0;${style}">&nbsp;</td>`;
56
- const across = (style) => `<td style="height:6px;padding:0;font-size:0;line-height:0;${style}">&nbsp;</td>`;
57
- return table("width:100%;max-width:612px", `<tr>${cross(design)}${across(`border-bottom:${line}`)}${cross(design)}</tr><tr>${across("")}</tr>
58
- <tr>${half(`border-right:${line}`)}${half()}<td style="padding:0;background-color:${design.colors.card}">${card}</td>${half(`border-right:${line}`)}${half()}</tr>
59
- <tr>${cross(design)}${across(`border-bottom:${line}`)}${cross(design)}</tr><tr>${across("")}</tr>`, 612);
62
+ /** The details, each label over its value, a line between each and the next. */
63
+ function details(rows) {
64
+ return table("width:100%", rows
65
+ .map((row, index) => `<tr><td class="line" style="padding:${normal}px 0;${index ? `border-top:1px solid ${light.line};` : ""}word-break:break-word"><div ${CAPITALS}>${escapeHtml(row.label)}</div><div ${colored("strong", `padding-top:${tiny}px;font-size:16px;line-height:24px${row.keepLines ? ";white-space:pre-wrap" : ""}`)}>${value(row)}</div></td></tr>`)
66
+ .join(""));
60
67
  }
61
68
  /**
62
- * An email in a brand's design, the same in every inbox: its logo (and name), a rule in its color, an eyebrow and a
63
- * heading, then paragraphs, details, a quoted text and one button, small print, and the company's signature. Built
64
- * from tables with inline styles, as email clients need; everything given is escaped. `logo` says whether the email
65
- * carries the inline image "logo".
69
+ * An email that looks the same in every inbox, in a centered column 600 pixels wide: the logo, an eyebrow and a
70
+ * heading, paragraphs, the details (each label over its value, lines between them), a sign-off with the company's
71
+ * name, and its site. No background: the mail app's own shows; the text is black and gray, white and light gray in
72
+ * dark themes where the mail app honors them (the only styles not inline). Spaces are 4, 8, 16 or 32 pixels. Geist
73
+ * where the reader has it, the device's own sans otherwise. Everything given is escaped. `logos` says which logo
74
+ * images the email carries (`true`: the black one only).
66
75
  *
67
76
  * @example
68
- * emailLayout({ language: "en", preview: "Ana sent a message", eyebrow: "Contact", heading: "Ana",
69
- * rows: [{ label: "Email", value: "ana@example.com" }] }, SHARADOX_EMAIL, true);
77
+ * emailLayout({ language: "en", preview: "Ana sent a message", eyebrow: "Contact", heading: "Thank you, Ana.",
78
+ * rows: [{ label: "Email", value: "ana@example.com" }], closing: "Best regards," }, { name: "Acme" }, false);
70
79
  */
71
- export function emailLayout(content, design, logo) {
72
- const { colors, fonts } = design;
73
- const { language, preview, eyebrow, heading, paragraphs = [], rows = [], quote, button, footer = [] } = content;
74
- const centered = design.align === "center";
75
- const eyebrowLine = design.eyebrowLine
76
- ? `<span style="display:inline-block;width:28px;height:1px;${accentBackground(design)}vertical-align:middle;margin:0 12px 2px 0"></span>`
77
- : "";
78
- const small = footer.length
79
- ? `<tr><td class="side" style="padding:22px 36px;border-top:1px ${design.rule} ${colors.rule};${labelStyle(design, colors.quiet)};text-transform:none;letter-spacing:0">${footer
80
- .map((row) => `${escapeHtml(row.label)}: ${value(row, colors.muted)}`)
81
- .join("<br>")}</td></tr>`
82
- : "";
83
- const signature = design.signature?.length
84
- ? `<tr><td align="center" style="padding:24px 12px 0;${labelStyle(design, colors.quiet)}">${design.signature
85
- .map((line) => `<span style="white-space:nowrap">${value({ value: line.text, href: line.href }, colors.quiet)}</span>`)
86
- .join(`<span style="padding:0 10px">&middot;</span>`)}</td></tr>`
87
- : "";
88
- const card = `<tr><td class="side" style="padding:32px 36px 0;text-align:${design.align}">${header(design, logo)}</td></tr>
89
- <tr><td class="side" style="padding:24px 36px 0"><div style="height:1px;line-height:1px;font-size:0;${colors.headerRule ? `background:${colors.headerRule};` : accentBackground(design)}">&nbsp;</div></td></tr>
90
- <tr><td class="side" style="padding:32px 36px 36px">
91
- <p style="margin:0 0 14px;text-align:${design.align};${labelStyle(design, colors.accent)}">${eyebrowLine}${escapeHtml(eyebrow)}</p>
92
- <h1 style="margin:0;text-align:${design.align};font-family:${fonts.heading};font-size:${design.heading.size}px;font-weight:${design.heading.weight};line-height:${design.heading.lineHeight};letter-spacing:${design.heading.letterSpacing};color:${colors.text}">${escapeHtml(heading)}</h1>
93
- ${paragraphs.map((paragraph) => `<p style="margin:18px 0 0;text-align:${centered ? "center" : "left"};font-family:${fonts.body};font-size:15px;line-height:1.7;color:${colors.muted}">${escapeHtml(paragraph)}</p>`).join("")}${rows.length ? details(design, rows) : ""}${quote ? quoted(design, quote) : ""}${button ? action(design, button) : ""}
94
- </td></tr>${small}`;
95
- return `<!doctype html><html lang="${escapeHtml(language)}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark"><meta name="supported-color-schemes" content="light dark"><title>${escapeHtml(heading)}</title><style>${PHONE}</style></head><body style="margin:0;padding:0;background-color:${colors.page}">
80
+ export function emailLayout(content, design, logos) {
81
+ const carried = typeof logos === "boolean" ? { light: logos, dark: false } : logos;
82
+ const { language, preview, eyebrow, heading, paragraphs = [], rows = [], closing } = content;
83
+ const block = (top, inside) => `<tr><td style="padding:${top}px 0 0">${inside}</td></tr>`;
84
+ const parts = [
85
+ `<tr><td style="padding:0">${header(design, carried)}</td></tr>`,
86
+ block(large, `<div ${CAPITALS}>${escapeHtml(eyebrow)}</div>`),
87
+ block(small, `<h1 ${colored("strong", "margin:0;font-size:28px;font-weight:700;line-height:32px;letter-spacing:-0.01em")}>${escapeHtml(heading)}</h1>`),
88
+ ...paragraphs.map((paragraph, index) => block(index ? small : normal, `<p ${colored("soft", "margin:0;font-size:16px;line-height:24px")}>${escapeHtml(paragraph)}</p>`)),
89
+ rows.length ? block(large - normal, details(rows)) : "",
90
+ closing
91
+ ? block(rows.length ? large - normal : large, `<p ${colored("soft", "margin:0;font-size:16px;line-height:24px")}>${escapeHtml(closing)}<br><b class="strong" style="color:${light.strong}">${escapeHtml(design.name)}</b>.</p>`)
92
+ : "",
93
+ design.signature?.length
94
+ ? block(large, `<div ${colored("strong", "font-size:14px;line-height:20px")}>${design.signature
95
+ .map((signed) => signed.href
96
+ ? `<a class="strong" href="${escapeHtml(signed.href)}" style="color:${light.strong};text-decoration:underline">${escapeHtml(signed.text)}</a>`
97
+ : escapeHtml(signed.text))
98
+ .join(" &middot; ")}</div>`)
99
+ : "",
100
+ ];
101
+ return `<!doctype html><html lang="${escapeHtml(language)}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark"><meta name="supported-color-schemes" content="light dark"><title>${escapeHtml(heading)}</title><style>:root{color-scheme:light dark;supported-color-schemes:light dark}${DARK_RULES}</style></head><body style="margin:0;padding:0">
96
102
  <div style="display:none;max-height:0;overflow:hidden;opacity:0">${escapeHtml(preview)}</div>
97
- ${table(`width:100%;background-color:${colors.page}`, `<tr><td align="center" style="padding:28px 8px 40px">${design.crosses
98
- ? framed(design, table("width:100%", card))
99
- : table(`width:100%;max-width:600px;background-color:${colors.card};border:1px solid ${colors.edge};border-radius:${design.radius}px`, card, 600)}${signature ? table("width:100%;max-width:600px", signature) : ""}</td></tr>`)}
103
+ ${table("width:100%", `<tr><td align="center" style="padding:0">${table(`width:100%;max-width:600px;margin:0 auto`, `<tr><td style="padding:${normal}px">${table("width:100%", parts.join("\n"))}</td></tr>`, ' width="600" align="center"')}</td></tr>`)}
100
104
  </body></html>`;
101
105
  }
102
106
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/email-layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAG/D;;;GAGG;AACH,MAAM,KAAK,GACT,mPAAmP,CAAC;AAEtP,mEAAmE;AACnE,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,KAAc,EAAE,EAAE,CAC5D,wEAAwE,KAAK,CAAC,CAAC,CAAC,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,oCAAoC,KAAK,KAAK,IAAI,UAAU,CAAC;AAEvK,+GAA+G;AAC/G,MAAM,gBAAgB,GAAG,CAAC,EAAE,MAAM,EAAe,EAAE,EAAE,CACnD,oBAAoB,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,oBAAoB,MAAM,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC,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I,UAAU,CAAC,OAAO,CAAC,sCAAsC,KAAK,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAClL;YACH,CAAC,CAAC,EAAE;QACN,MAAM,CAAC,SAAS,EAAE,MAAM;YACtB,CAAC,CAAC,KAAK,CACH,KAAK,EACL,QAAQ,OAAO,CAAC,QAAQ,EAAE,iCAAiC,CAAC,IAAI,MAAM,CAAC,SAAS;iBAC7E,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CACd,MAAM,CAAC,IAAI;gBACT,CAAC,CAAC,2BAA2B,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,MAAM,+BAA+B,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;gBAC9I,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAC5B;iBACA,IAAI,CAAC,YAAY,CAAC,QAAQ,CAC9B;YACH,CAAC,CAAC,EAAE;KACP,CAAC;IACF,OAAO,8BAA8B,UAAU,CAAC,QAAQ,CAAC,oNAAoN,UAAU,CAAC,OAAO,CAAC,mFAAmF,UAAU;mEAC5T,UAAU,CAAC,OAAO,CAAC;EACpF,KAAK,CAAC,YAAY,EAAE,4CAA4C,KAAK,CAAC,0CAA0C,EAAE,0BAA0B,MAAM,OAAO,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,6BAA6B,CAAC,YAAY,CAAC;eAC1O,CAAC;AAChB,CAAC"}
@@ -1,90 +1,45 @@
1
- /** One line of a details table or of the small print: a label and its value (plain text, or a link with `href`). */
1
+ /**
2
+ * One detail: a label and its value, which is plain text (a link with `href`, its line breaks kept with
3
+ * `keepLines`) or a list of items, one per line after a dot.
4
+ */
2
5
  export interface EmailRow {
3
6
  label: string;
4
- value: string;
7
+ value: string | readonly string[];
5
8
  href?: string;
9
+ /** Keeps the value's line breaks (a visitor's message). */
10
+ keepLines?: boolean;
6
11
  }
7
12
  /**
8
- * A brand's look for its emails: colors, type and details, so every email it sends looks like its website. Fonts are
9
- * font stacks the reader's device already has (no web fonts, which would tell a font service the email was opened).
13
+ * What makes an email a company's. Every email shares one layout: no background (the mail app's own shows), black
14
+ * and gray text that turns white and light gray in dark themes, Geist where the reader has it; a company only brings
15
+ * its logo, its name and its site.
10
16
  */
11
17
  export interface EmailDesign {
12
- /** The company: the logo's description, and its name beside the logo with `wordmark`. */
18
+ /** The company: the logo's description, its name beside the logo with `wordmark`, and the sign-off's name. */
13
19
  name: string;
14
- /** The size the inline image "logo" is shown at, when the email carries one. */
20
+ /**
21
+ * The size the logo is shown at, when the email carries it: the inline image "logo" (the real logo in black, with
22
+ * a thin white outline that keeps it visible where a mail app darkens the email itself), and, for mail apps in
23
+ * dark mode, "logo-dark" (the same in white).
24
+ */
15
25
  logo?: {
16
26
  width: number;
17
27
  height: number;
18
28
  };
19
29
  /** Whether the company's name is written beside the logo. */
20
- wordmark: boolean;
21
- /** Where the header and the heading sit. */
22
- align: "left" | "center";
23
- colors: {
24
- /** Around the card. */
25
- page: string;
26
- /** The card itself. */
27
- card: string;
28
- /** The card's edge. */
29
- edge: string;
30
- /** Headings and values. */
31
- text: string;
32
- /** Paragraphs. */
33
- muted: string;
34
- /** Labels and small print. */
35
- quiet: string;
36
- /** Rules between details. */
37
- rule: string;
38
- /** The brand's color: the eyebrow, the rule under the header, the button. */
39
- accent: string;
40
- /** A CSS gradient over the accent where the reader's device shows one (shiny gold). */
41
- accentGradient?: string;
42
- /** The line under the header, as a CSS background, when it isn't the accent (a hairline fading at its ends). */
43
- headerRule?: string;
44
- /** Behind a quoted text. */
45
- box: string;
46
- /** The button's words. */
47
- onAccent: string;
48
- };
49
- fonts: {
50
- heading: string;
51
- body: string;
52
- /** Eyebrows, labels and small print. */
53
- label: string;
54
- };
55
- heading: {
56
- size: number;
57
- weight: number;
58
- letterSpacing: string;
59
- lineHeight: number;
60
- };
61
- /** Eyebrows and labels in capitals, spaced. */
62
- label: {
63
- size: number;
64
- letterSpacing: string;
65
- };
66
- /** The rules between details: solid, or dashed like the brand's grid. */
67
- rule: "solid" | "dashed";
68
- /** The card's corners (0 for square). */
69
- radius: number;
70
- /** "+" marks at the card's corners, where a grid's lines would cross. */
71
- crosses?: boolean;
72
- /** A short line before the eyebrow. */
73
- eyebrowLine?: boolean;
74
- /** A bar in the accent at the left of a quoted text. */
75
- quoteBar?: boolean;
76
- button: {
77
- radius: number;
78
- uppercase: boolean;
79
- letterSpacing: string;
80
- };
81
- /** The company's lines at the very bottom of every email (its slogan, its site). */
30
+ wordmark?: boolean;
31
+ /** The company's lines at the very end of every email (its site). */
82
32
  signature?: readonly {
83
33
  text: string;
84
34
  href?: string;
85
35
  }[];
86
36
  }
87
- /** What one email says, in the brand's design. */
37
+ /** Which logo images an email carries, as inline images "logo" and "logo-dark". */
38
+ export interface EmailLogos {
39
+ light: boolean;
40
+ dark: boolean;
41
+ }
42
+ /** What one email says. */
88
43
  export interface EmailContent {
89
44
  /** The language of the email, for the html's `lang`. */
90
45
  language: string;
@@ -95,19 +50,9 @@ export interface EmailContent {
95
50
  heading: string;
96
51
  /** Paragraphs under the heading. */
97
52
  paragraphs?: readonly string[];
98
- /** The details table. */
53
+ /** The details, each label over its value, lines between them. */
99
54
  rows?: readonly EmailRow[];
100
- /** A longer text in its own box, keeping its line breaks (a visitor's message), with its label. */
101
- quote?: {
102
- label: string;
103
- text: string;
104
- };
105
- /** The one thing to do next, as a button: reply, call, visit. */
106
- button?: {
107
- label: string;
108
- href: string;
109
- };
110
- /** Small print: where it came from, when, and so on. */
111
- footer?: readonly EmailRow[];
55
+ /** The sign-off before the company's name: "Best regards,". */
56
+ closing?: string;
112
57
  }
113
58
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/email-layout/type.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,MAAM,WAAW,QAA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S,QAAQ,EAAE,CAAC;CAC9B"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/email-layout/type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,8GAA8G;IAC9G,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxD;AAED,mFAAmF;AACnF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf;AAED,2BAA2B;AAC3B,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,OAAO,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,kEAAkE;IAClE,IAAI,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC3B,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -20,6 +20,6 @@ export { createEmailSender } from "@sharadox/email-web-library/email-sender";
20
20
  export type { EmailReceipt, EmailSender } from "@sharadox/email-web-library/email-sender/type";
21
21
  export { readEmailServerConfiguration } from "@sharadox/email-web-library/email-server-configuration";
22
22
  export type { EmailServerConfiguration, EmailServerSecurity, } from "@sharadox/email-web-library/email-server-configuration/type";
23
- export { emailLayout } from "@sharadox/email-web-library/email-layout";
24
- export type { EmailContent, EmailDesign, EmailRow } from "@sharadox/email-web-library/email-layout/type";
23
+ export { EMAIL_COLORS, EMAIL_FONT, EMAIL_SPACES, emailLayout } from "@sharadox/email-web-library/email-layout";
24
+ export type { EmailContent, EmailDesign, EmailLogos, EmailRow } from "@sharadox/email-web-library/email-layout/type";
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,YAAY,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC9G,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,YAAY,EACV,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,YAAY,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC9G,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,YAAY,EACV,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC/G,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC"}
@@ -15,5 +15,5 @@ export { EmailError } from "@sharadox/email-web-library/email-error";
15
15
  export { checkEmailMessage, RECIPIENT_LIMIT, SUBJECT_LIMIT } from "@sharadox/email-web-library/email-message";
16
16
  export { createEmailSender } from "@sharadox/email-web-library/email-sender";
17
17
  export { readEmailServerConfiguration } from "@sharadox/email-web-library/email-server-configuration";
18
- export { emailLayout } from "@sharadox/email-web-library/email-layout";
18
+ export { EMAIL_COLORS, EMAIL_FONT, EMAIL_SPACES, emailLayout } from "@sharadox/email-web-library/email-layout";
19
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE9G,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AAKtG,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAErE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE9G,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AAKtG,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { InlineImage } from "@sharadox/email-web-library/email-message/type";
2
+ /**
3
+ * An image to send inside an email from one kept as base64 text (as a library ships its logo): its bytes decoded,
4
+ * with the id its html refers to (`cid:<id>`).
5
+ *
6
+ * @example
7
+ * inlineImage("logo", { filename: "logo.png", contentType: "image/png", content: "iVBORw0KGgo…" });
8
+ */
9
+ export declare function inlineImage(id: string, image: {
10
+ filename: string;
11
+ contentType: string;
12
+ content: string;
13
+ }): InlineImage;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/inline-image/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gDAAgD,CAAC;AAElF;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAChE,WAAW,CAOb"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * An image to send inside an email from one kept as base64 text (as a library ships its logo): its bytes decoded,
3
+ * with the id its html refers to (`cid:<id>`).
4
+ *
5
+ * @example
6
+ * inlineImage("logo", { filename: "logo.png", contentType: "image/png", content: "iVBORw0KGgo…" });
7
+ */
8
+ export function inlineImage(id, image) {
9
+ return {
10
+ id,
11
+ filename: image.filename,
12
+ contentType: image.contentType,
13
+ content: Buffer.from(image.content, "base64"),
14
+ };
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/inline-image/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,EAAU,EACV,KAAiE;IAEjE,OAAO;QACL,EAAE;QACF,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC9C,CAAC;AACJ,CAAC"}
package/llms.txt CHANGED
@@ -5,8 +5,9 @@
5
5
  - /email-server-configuration: readEmailServerConfiguration(environment = process.env) → { host, port (587), username, password, security ("starttls" | "tls" on 465 | "none"), timeout? } from EMAIL_SERVER_HOST, _PORT, _USERNAME, _PASSWORD, _SECURITY; throws EmailError("configuration") naming what's missing
6
6
  - /email-sender: createEmailSender(configuration) → { send(message) → { messageId, accepted, rejected }, verify() }; one short connection per send (serverless); refused recipients reported, all refused or any server failure → EmailError("delivery") without the password or message content
7
7
  - /email-message: checkEmailMessage(message) (valid addresses, one-line subject, at most RECIPIENT_LIMIT recipients, SUBJECT_LIMIT characters); EmailMessage { from, to, cc?, bcc?, replyTo?, subject, text, html?, inlineImages? [{ id, filename, contentType, content }] }
8
+ - /inline-image: inlineImage(id, { filename, contentType, content (base64) }) → InlineImage with the bytes decoded (a library's logo kept as base64 text)
8
9
  - /email-address: checkEmailAddress(value, field) → the address, or EmailError("invalid-message"); EmailAddress = string | { name, address }
9
10
  - /email-error: EmailError(code: "configuration" | "invalid-message" | "delivery", message, options?)
10
- - /email-layout: emailLayout(content, design, logo) → HTML that works in email clients, light and dark; EmailDesign (name, logo?, wordmark, align, colors, fonts, heading, label, rule, radius, button, signature…), EmailContent (language, preview, eyebrow, heading, paragraphs, rows, quote, button, footer)
11
+ - /email-layout: emailLayout(content, design, logos: { light, dark } | boolean) → HTML the same in every mail app: centered 600px column, 16px around, no background; strong #000000 (logo, heading, values, company name, site) and soft #5E5E5E (labels, other text), dark theme #FFFFFF/#A1A1A1 via @media prefers-color-scheme and [data-ogsc] (the only <style>), white logo "logo-dark" shown there; spaces 4/8/16/32 (EMAIL_SPACES); Geist else system sans (EMAIL_FONT); EmailDesign { name, logo? {width,height}, wordmark?, signature? }; EmailContent { language, preview, eyebrow, heading, paragraphs?, rows? [{ label, value: string | string[] (dotted list), href?, keepLines? }], closing? ("Best regards," then the company name in bold) }
11
12
  - Root import (all of the above) kept in 0.5 for compatibility, removed in 0.6.
12
13
  - License: Sharadox Open Source License 0.1.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharadox/email-web-library",
3
- "version": "0.5.0-standard-shape.13",
3
+ "version": "0.6.0-development.29",
4
4
  "description": "Send email from web applications through any SMTP server, with message checks and clear errors.",
5
5
  "license": "SEE LICENSE IN LICENCA.md",
6
6
  "author": "Sharadox <contact@sharadox.com>",
@@ -41,7 +41,8 @@
41
41
  "LICENCA.md",
42
42
  "LICENSE.md",
43
43
  "NOTICE.md",
44
- "llms.txt"
44
+ "llms.txt",
45
+ "CHANGELOG.md"
45
46
  ],
46
47
  "sideEffects": false,
47
48
  "engines": {
@@ -59,16 +60,16 @@
59
60
  "*.{json,md,yml,yaml}": "prettier --write"
60
61
  },
61
62
  "dependencies": {
62
- "@sharadox/web-library": "^0.8.0",
63
+ "@sharadox/web-library": "^0.10.0",
63
64
  "nodemailer": "^10.1.4"
64
65
  },
65
66
  "devDependencies": {
66
67
  "@sharadox/es-lint-configuration-web-library": "^0.1.2",
67
- "@sharadox/library-build-web-library": "^0.1.2",
68
+ "@sharadox/library-build-web-library": "^0.2.0",
68
69
  "@sharadox/prettier-configuration-web-library": "^0.1.1",
69
- "@sharadox/turborepo-configuration-web-library": "^0.1.1",
70
- "@sharadox/type-script-configuration-web-library": "^0.2.1",
71
- "@sharadox/vitest-configuration-web-library": "^0.1.4",
70
+ "@sharadox/turborepo-configuration-web-library": "^0.1.3",
71
+ "@sharadox/type-script-configuration-web-library": "^0.2.2",
72
+ "@sharadox/vitest-configuration-web-library": "^0.2.0",
72
73
  "@types/node": "^24.19.2",
73
74
  "@types/nodemailer": "^8.0.2",
74
75
  "@types/smtp-server": "^3.5.13",