@sharadox/email-web-library 0.6.0-polish.22 → 0.6.0-polish.24
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 +2 -3
- package/README.md +8 -24
- package/distribution/email-layout/index.d.ts +20 -13
- package/distribution/email-layout/index.d.ts.map +1 -1
- package/distribution/email-layout/index.js +60 -127
- package/distribution/email-layout/index.js.map +1 -1
- package/distribution/email-layout/type.d.ts +19 -71
- package/distribution/email-layout/type.d.ts.map +1 -1
- package/distribution/index.d.ts +1 -1
- package/distribution/index.d.ts.map +1 -1
- package/distribution/index.js +1 -1
- package/distribution/index.js.map +1 -1
- package/llms.txt +1 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,5 @@ What changed in each version of `@sharadox/email-web-library`, newest first.
|
|
|
4
4
|
|
|
5
5
|
## 0.6.0
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- A
|
|
9
|
-
- Pure neutral colors (black, white, greys) are nudged by 2/255, which no eye can tell (`ownColor`): Proton Mail on Android swaps such colors for its own theme's, so a black design lost its backgrounds, lines and white button there.
|
|
7
|
+
- **Breaking:** one simple layout for every brand, the same in every mail app. Black on white with every style inline: no `<style>`, no dark-mode rules, no backgrounds but the button's and no gradients, so a mail app in dark mode darkens it as it darkens any email instead of recoloring parts of it (dark designs lost their backgrounds, lines and buttons in Proton Mail on Android). The logo sits at the top left; details stack each label over its value on every screen. `EmailDesign` is now `{ name, logo?, wordmark?, color, onColor?, fonts?, signature? }`: the brand brings its logo, its color (eyebrow, headings, a quoted text's label and bar, button) and its fonts. New exports: `EMAIL_COLORS`, `SYSTEM_FONT`.
|
|
8
|
+
- A quoted text's label ("Your message") is in the brand's color too.
|
package/README.md
CHANGED
|
@@ -65,35 +65,18 @@ await sender.send({
|
|
|
65
65
|
|
|
66
66
|
### In the brand's design
|
|
67
67
|
|
|
68
|
-
`emailLayout(content, design, logo)` writes the html of an email in
|
|
68
|
+
`emailLayout(content, design, logo)` writes the html of an email that looks the same in every mail app: one simple layout, black on white, with every style inline and nothing for a mail app to drop or recolor its own way (no dark-mode rules, no backgrounds but the button's, no gradients). In dark mode the mail app darkens it as it darkens any email. A brand brings only what makes it its own: the logo at the top left (the real logo, without a background), its color on the eyebrow, the headings, the bar beside a quoted text and the button, and its fonts. Fonts are stacks the reader's device already has: web fonts would tell a font service the email was opened. Everything given is escaped; details stack each label over its value, the same on a phone and a computer.
|
|
69
69
|
|
|
70
70
|
```ts
|
|
71
|
-
import { emailLayout
|
|
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
75
|
name: "Sharadox",
|
|
75
76
|
logo: { width: 30, height: 30 }, // shown size of the inline image "logo"
|
|
76
77
|
wordmark: true, // the name beside the logo
|
|
77
|
-
|
|
78
|
-
|
|
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" },
|
|
78
|
+
color: "#000000", // the brand's color, dark enough to read on white (black for a white brand)
|
|
79
|
+
fonts: { heading: "Geist, Helvetica, Arial, sans-serif" }, // the body's font and the device's own sans otherwise
|
|
97
80
|
signature: [{ text: "sharadox.com", href: "https://sharadox.com" }],
|
|
98
81
|
};
|
|
99
82
|
|
|
@@ -102,17 +85,18 @@ const html = emailLayout(
|
|
|
102
85
|
language: "en",
|
|
103
86
|
preview: "Ana sent a message",
|
|
104
87
|
eyebrow: "Contact",
|
|
105
|
-
heading: "Ana
|
|
88
|
+
heading: "Ana (Villa Mar)",
|
|
106
89
|
rows: [{ label: "Email", value: "ana@example.com", href: "mailto:ana@example.com" }],
|
|
107
90
|
quote: { label: "Message", text: "Hello!" },
|
|
108
91
|
button: { label: "Reply to Ana", href: "mailto:ana@example.com" },
|
|
92
|
+
footer: [{ label: "Sent", value: "2026-11-21 14:29 UTC" }],
|
|
109
93
|
},
|
|
110
94
|
design,
|
|
111
95
|
true, // the email carries the inline image "logo"
|
|
112
96
|
);
|
|
113
97
|
```
|
|
114
98
|
|
|
115
|
-
|
|
99
|
+
`EMAIL_COLORS` is the shared palette (background, text, muted, quiet, line) and `SYSTEM_FONT` the default font stack.
|
|
116
100
|
|
|
117
101
|
`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
102
|
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import type { EmailContent, EmailDesign } from "@sharadox/email-web-library/email-layout/type";
|
|
2
|
+
/** The one palette every email is drawn in: black on white, which every mail app darkens well on its own. */
|
|
3
|
+
export declare const EMAIL_COLORS: {
|
|
4
|
+
readonly background: "#ffffff";
|
|
5
|
+
readonly text: "#000000";
|
|
6
|
+
/** Paragraphs. */
|
|
7
|
+
readonly muted: "#3f3f46";
|
|
8
|
+
/** Labels and small print. */
|
|
9
|
+
readonly quiet: "#71717a";
|
|
10
|
+
/** Lines between details. */
|
|
11
|
+
readonly line: "#e4e4e7";
|
|
12
|
+
};
|
|
13
|
+
/** The device's own sans: what every font stack falls back to. */
|
|
14
|
+
export declare const SYSTEM_FONT = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
|
|
2
15
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* button
|
|
7
|
-
|
|
8
|
-
export declare function ownColor(hex: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* 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
|
|
11
|
-
* heading, then paragraphs, details, a quoted text and one button, small print, and the company's signature. Built
|
|
12
|
-
* from tables with inline styles, as email clients need; everything given is escaped. `logo` says whether the email
|
|
13
|
-
* carries the inline image "logo".
|
|
16
|
+
* An email in a brand's design, the same in every inbox: the logo at the top left, an eyebrow and a heading in the
|
|
17
|
+
* brand's color, then paragraphs, details (each label over its value), a quoted text under a label in the brand's color, one button, small print,
|
|
18
|
+
* and the company's signature. Black on white with every style inline, no dark-mode rules and no backgrounds but the
|
|
19
|
+
* button's: what mail apps change, they change the same way everywhere. `logo` says whether the email carries the
|
|
20
|
+
* inline image "logo"; everything given is escaped.
|
|
14
21
|
*
|
|
15
22
|
* @example
|
|
16
23
|
* emailLayout({ language: "en", preview: "Ana sent a message", eyebrow: "Contact", heading: "Ana",
|
|
17
|
-
* rows: [{ label: "Email", value: "ana@example.com" }] },
|
|
24
|
+
* rows: [{ label: "Email", value: "ana@example.com" }] }, { name: "Acme", color: "#000000" }, false);
|
|
18
25
|
*/
|
|
19
|
-
export declare function emailLayout(content: EmailContent,
|
|
26
|
+
export declare function emailLayout(content: EmailContent, design: EmailDesign, logo: boolean): string;
|
|
20
27
|
//# 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/email-layout/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,6GAA6G;AAC7G,eAAO,MAAM,YAAY;;;IAGvB,kBAAkB;;IAElB,8BAA8B;;IAE9B,6BAA6B;;CAErB,CAAC;AAEX,kEAAkE;AAClE,eAAO,MAAM,WAAW,wFAAwF,CAAC;AA6BjH;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAyE7F"}
|
|
@@ -1,147 +1,80 @@
|
|
|
1
1
|
import { escapeHtml } from "@sharadox/web-library/html/escape";
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
* tell apart. Some mail apps in dark mode (Proton Mail on Android) take pure neutral colors for the email's default
|
|
16
|
-
* styling and swap them for their own theme's, so a black design lost its backgrounds, its grey lines and its white
|
|
17
|
-
* button; colors with any tint are kept as they are.
|
|
18
|
-
*/
|
|
19
|
-
export function ownColor(hex) {
|
|
20
|
-
const match = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hex);
|
|
21
|
-
if (!match ||
|
|
22
|
-
match[1].toLowerCase() !== match[2].toLowerCase() ||
|
|
23
|
-
match[2].toLowerCase() !== match[3].toLowerCase())
|
|
24
|
-
return hex;
|
|
25
|
-
const level = Number.parseInt(match[1], 16);
|
|
26
|
-
const blue = level > 253 ? level - 2 : level + 2;
|
|
27
|
-
return `#${match[1]}${match[2]}${blue.toString(16).padStart(2, "0")}`.toLowerCase();
|
|
28
|
-
}
|
|
29
|
-
/** Every pure neutral color in a CSS value (a color or a gradient), made the email's own (`ownColor`). */
|
|
30
|
-
const ownColors = (value) => value.replace(/#[0-9a-f]{6}\b/gi, ownColor);
|
|
31
|
-
/** A design whose every color is its own: what the reader sees is the same, what mail apps recolor isn't. */
|
|
32
|
-
const owned = (design) => ({
|
|
33
|
-
...design,
|
|
34
|
-
colors: Object.fromEntries(Object.entries(design.colors)
|
|
35
|
-
.filter((entry) => entry[1] !== undefined)
|
|
36
|
-
.map(([name, value]) => [name, ownColors(value)])),
|
|
37
|
-
});
|
|
2
|
+
/** The one palette every email is drawn in: black on white, which every mail app darkens well on its own. */
|
|
3
|
+
export const EMAIL_COLORS = {
|
|
4
|
+
background: "#ffffff",
|
|
5
|
+
text: "#000000",
|
|
6
|
+
/** Paragraphs. */
|
|
7
|
+
muted: "#3f3f46",
|
|
8
|
+
/** Labels and small print. */
|
|
9
|
+
quiet: "#71717a",
|
|
10
|
+
/** Lines between details. */
|
|
11
|
+
line: "#e4e4e7",
|
|
12
|
+
};
|
|
13
|
+
/** The device's own sans: what every font stack falls back to. */
|
|
14
|
+
export const SYSTEM_FONT = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif";
|
|
38
15
|
/** A table that's only there for layout, as email clients need. */
|
|
39
|
-
const table = (style, rows, width) => `<table role="presentation" cellpadding="0" cellspacing="0" border="0"${width ? ` width="${width}"` : ""} style="border-collapse:
|
|
40
|
-
/**
|
|
41
|
-
const
|
|
42
|
-
/**
|
|
43
|
-
* The line under the header: its own color or gradient (over a plain color, for clients that drop gradients), or the
|
|
44
|
-
* accent.
|
|
45
|
-
*/
|
|
46
|
-
function headerRule(design) {
|
|
47
|
-
const { headerRule: rule, headerRuleColor, accent } = design.colors;
|
|
48
|
-
if (!rule)
|
|
49
|
-
return accentBackground(design);
|
|
50
|
-
return rule.includes("gradient(")
|
|
51
|
-
? `background-color:${headerRuleColor ?? accent};background-image:${rule};`
|
|
52
|
-
: `background-color:${rule};`;
|
|
53
|
-
}
|
|
54
|
-
/** Text in the label style: small, spaced capitals. */
|
|
55
|
-
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}`;
|
|
16
|
+
const table = (style, rows, width) => `<table role="presentation" cellpadding="0" cellspacing="0" border="0"${width ? ` width="${width}"` : ""} style="border-collapse:collapse;${style}">${rows}</table>`;
|
|
17
|
+
/** Small spaced capitals: eyebrows and labels. */
|
|
18
|
+
const capitals = (font, color) => `font-family:${font};font-size:12px;font-weight:600;line-height:1.5;letter-spacing:0.08em;text-transform:uppercase;color:${color}`;
|
|
56
19
|
/** A value, as a link when it has one. */
|
|
57
20
|
const value = ({ value: text, href }, color) => href
|
|
58
|
-
? `<a href="${escapeHtml(href)}" style="color:${color};text-decoration:underline
|
|
21
|
+
? `<a href="${escapeHtml(href)}" style="color:${color};text-decoration:underline">${escapeHtml(text)}</a>`
|
|
59
22
|
: escapeHtml(text);
|
|
60
|
-
/** The logo, and the company's name beside it with `wordmark
|
|
61
|
-
function header(design, logo) {
|
|
62
|
-
const { colors, fonts } = design;
|
|
23
|
+
/** The logo at the top left, and the company's name beside it with `wordmark` (or alone, without a logo). */
|
|
24
|
+
function header(design, logo, font) {
|
|
63
25
|
const mark = logo && design.logo
|
|
64
|
-
? `<td style="vertical-align:middle;padding:0${design.wordmark ? "
|
|
26
|
+
? `<td style="vertical-align:middle;padding:0${design.wordmark ? " 10px 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>`
|
|
65
27
|
: "";
|
|
66
28
|
const name = design.wordmark || !mark
|
|
67
|
-
? `<td style="vertical-align:middle;font-family:${
|
|
29
|
+
? `<td style="vertical-align:middle;font-family:${font};font-size:19px;font-weight:700;letter-spacing:-0.01em;color:${design.color}">${escapeHtml(design.name)}</td>`
|
|
68
30
|
: "";
|
|
69
|
-
return table(
|
|
31
|
+
return table("", `<tr>${mark}${name}</tr>`);
|
|
70
32
|
}
|
|
71
|
-
/** The details, one per line: the label above or beside its value, rules between them. */
|
|
72
|
-
function details(design, rows) {
|
|
73
|
-
const { colors, fonts } = design;
|
|
74
|
-
const line = `border-top:1px ${design.rule} ${colors.rule}`;
|
|
75
|
-
return table("width:100%;margin:28px 0 0", rows
|
|
76
|
-
.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>`)
|
|
77
|
-
.join("") + `<tr><td colspan="2" style="${line};font-size:0;line-height:0"> </td></tr>`);
|
|
78
|
-
}
|
|
79
|
-
/** A longer text in its own box, keeping its line breaks. */
|
|
80
|
-
function quoted(design, quote) {
|
|
81
|
-
const { colors, fonts } = design;
|
|
82
|
-
const bar = design.quoteBar ? `border-left:2px solid ${colors.accent};` : "";
|
|
83
|
-
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>`)}`;
|
|
84
|
-
}
|
|
85
|
-
/** The one thing to do next, as a button that works in every email client (a padded link). */
|
|
86
|
-
function action(design, button) {
|
|
87
|
-
const { colors, fonts } = design;
|
|
88
|
-
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>`);
|
|
89
|
-
}
|
|
90
|
-
/** A "+" where two of the frame's lines cross, centered on them (it spans two half cells each way). */
|
|
91
|
-
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>`;
|
|
92
33
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const half = (style = "") => `<td width="6" style="width:6px;padding:0;font-size:0;line-height:0;${style}"> </td>`;
|
|
99
|
-
const across = (style) => `<td style="height:6px;padding:0;font-size:0;line-height:0;${style}"> </td>`;
|
|
100
|
-
return table("width:100%;max-width:612px", `<tr>${cross(design)}${across(`border-bottom:${line}`)}${cross(design)}</tr><tr>${across("")}</tr>
|
|
101
|
-
<tr>${half(`border-right:${line}`)}${half()}<td style="padding:0;background-color:${design.colors.card}">${card}</td>${half(`border-right:${line}`)}${half()}</tr>
|
|
102
|
-
<tr>${cross(design)}${across(`border-bottom:${line}`)}${cross(design)}</tr><tr>${across("")}</tr>`, 612);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* 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
|
|
106
|
-
* heading, then paragraphs, details, a quoted text and one button, small print, and the company's signature. Built
|
|
107
|
-
* from tables with inline styles, as email clients need; everything given is escaped. `logo` says whether the email
|
|
108
|
-
* carries the inline image "logo".
|
|
34
|
+
* An email in a brand's design, the same in every inbox: the logo at the top left, an eyebrow and a heading in the
|
|
35
|
+
* brand's color, then paragraphs, details (each label over its value), a quoted text under a label in the brand's color, one button, small print,
|
|
36
|
+
* and the company's signature. Black on white with every style inline, no dark-mode rules and no backgrounds but the
|
|
37
|
+
* button's: what mail apps change, they change the same way everywhere. `logo` says whether the email carries the
|
|
38
|
+
* inline image "logo"; everything given is escaped.
|
|
109
39
|
*
|
|
110
40
|
* @example
|
|
111
41
|
* emailLayout({ language: "en", preview: "Ana sent a message", eyebrow: "Contact", heading: "Ana",
|
|
112
|
-
* rows: [{ label: "Email", value: "ana@example.com" }] },
|
|
42
|
+
* rows: [{ label: "Email", value: "ana@example.com" }] }, { name: "Acme", color: "#000000" }, false);
|
|
113
43
|
*/
|
|
114
|
-
export function emailLayout(content,
|
|
115
|
-
const design = owned(given);
|
|
116
|
-
const { colors, fonts } = design;
|
|
44
|
+
export function emailLayout(content, design, logo) {
|
|
117
45
|
const { language, preview, eyebrow, heading, paragraphs = [], rows = [], quote, button, footer = [] } = content;
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
: "";
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
46
|
+
const { background, text, muted, quiet, line } = EMAIL_COLORS;
|
|
47
|
+
const body = design.fonts?.body ?? SYSTEM_FONT;
|
|
48
|
+
const headings = design.fonts?.heading ?? body;
|
|
49
|
+
const block = (style, inside) => `<tr><td style="${style}">${inside}</td></tr>`;
|
|
50
|
+
const parts = [
|
|
51
|
+
block("padding:0 0 36px", header(design, logo, headings)),
|
|
52
|
+
block("padding:0 0 10px", `<div style="${capitals(body, design.color)}">${escapeHtml(eyebrow)}</div>`),
|
|
53
|
+
block("padding:0", `<h1 style="margin:0;font-family:${headings};font-size:30px;font-weight:700;line-height:1.2;letter-spacing:-0.01em;color:${design.color}">${escapeHtml(heading)}</h1>`),
|
|
54
|
+
...paragraphs.map((paragraph) => block("padding:16px 0 0", `<p style="margin:0;font-family:${body};font-size:16px;line-height:1.6;color:${muted}">${escapeHtml(paragraph)}</p>`)),
|
|
55
|
+
rows.length
|
|
56
|
+
? block("padding:28px 0 0", table("width:100%", rows
|
|
57
|
+
.map((row) => `<tr><td style="padding:14px 0;border-top:1px solid ${line};font-family:${body};word-break:break-word"><div style="${capitals(body, quiet)}">${escapeHtml(row.label)}</div><div style="padding-top:4px;font-size:16px;line-height:1.5;color:${text}">${value(row, text)}</div></td></tr>`)
|
|
58
|
+
.join("") + `<tr><td style="border-top:1px solid ${line};font-size:0;line-height:0"> </td></tr>`))
|
|
59
|
+
: "",
|
|
60
|
+
quote
|
|
61
|
+
? block("padding:28px 0 0", `<div style="${capitals(body, design.color)}">${escapeHtml(quote.label)}</div>${table("width:100%;margin-top:10px", `<tr><td style="padding:2px 0 2px 16px;border-left:3px solid ${design.color};font-family:${body};font-size:16px;line-height:1.6;color:${text};white-space:pre-wrap;word-break:break-word">${escapeHtml(quote.text)}</td></tr>`)}`)
|
|
62
|
+
: "",
|
|
63
|
+
button
|
|
64
|
+
? block("padding:32px 0 0", table("", `<tr><td style="background-color:${design.color};border-radius:8px"><a href="${escapeHtml(button.href)}" style="display:inline-block;padding:14px 26px;font-family:${body};font-size:15px;font-weight:600;color:${design.onColor ?? "#ffffff"};text-decoration:none;border-radius:8px">${escapeHtml(button.label)}</a></td></tr>`))
|
|
65
|
+
: "",
|
|
66
|
+
footer.length
|
|
67
|
+
? block("padding:36px 0 0", `<div style="padding-top:20px;border-top:1px solid ${line};font-family:${body};font-size:13px;line-height:1.6;color:${quiet}">${footer
|
|
68
|
+
.map((row) => `${escapeHtml(row.label)}: ${value(row, quiet)}`)
|
|
69
|
+
.join("<br>")}</div>`)
|
|
70
|
+
: "",
|
|
71
|
+
design.signature?.length
|
|
72
|
+
? block(`padding:${footer.length ? 16 : 36}px 0 0;font-family:${body};font-size:13px;line-height:1.6;color:${quiet}`, design.signature.map((signed) => value({ value: signed.text, href: signed.href }, quiet)).join(" · "))
|
|
73
|
+
: "",
|
|
74
|
+
];
|
|
75
|
+
return `<!doctype html><html lang="${escapeHtml(language)}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${escapeHtml(heading)}</title></head><body style="margin:0;padding:0;background-color:${background}">
|
|
141
76
|
<div style="display:none;max-height:0;overflow:hidden;opacity:0">${escapeHtml(preview)}</div>
|
|
142
|
-
${table(`width:100%;
|
|
143
|
-
? framed(design, table("width:100%", card))
|
|
144
|
-
: 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>`)}
|
|
77
|
+
${table(`width:100%;background-color:${background}`, `<tr><td style="padding:32px 24px 40px">${table("width:100%;max-width:560px", parts.join("\n"), 560)}</td></tr>`)}
|
|
145
78
|
</body></html>`;
|
|
146
79
|
}
|
|
147
80
|
//# 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
|
|
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,6GAA6G;AAC7G,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,SAAS;IACf,kBAAkB;IAClB,KAAK,EAAE,SAAS;IAChB,8BAA8B;IAC9B,KAAK,EAAE,SAAS;IAChB,6BAA6B;IAC7B,IAAI,EAAE,SAAS;CACP,CAAC;AAEX,kEAAkE;AAClE,MAAM,CAAC,MAAM,WAAW,GAAG,qFAAqF,CAAC;AAEjH,mEAAmE;AACnE,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,KAA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C,EAAE,CAAC;iBAC9D,IAAI,CAAC,MAAM,CAAC,QAAQ,CACxB;YACH,CAAC,CAAC,EAAE;QACN,MAAM,CAAC,SAAS,EAAE,MAAM;YACtB,CAAC,CAAC,KAAK,CACH,WAAW,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,sBAAsB,IAAI,yCAAyC,KAAK,EAAE,EAC5G,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAC7G;YACH,CAAC,CAAC,EAAE;KACP,CAAC;IACF,OAAO,8BAA8B,UAAU,CAAC,QAAQ,CAAC,2GAA2G,UAAU,CAAC,OAAO,CAAC,mEAAmE,UAAU;mEACnM,UAAU,CAAC,OAAO,CAAC;EACpF,KAAK,CACL,+BAA+B,UAAU,EAAE,EAC3C,0CAA0C,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,YAAY,CACjH;eACc,CAAC;AAChB,CAAC"}
|
|
@@ -5,85 +5,33 @@ export interface EmailRow {
|
|
|
5
5
|
href?: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* What makes an email a brand's. Every email shares one simple layout, black on white, that every mail app shows the
|
|
9
|
+
* same way and darkens on its own in dark mode; a brand only brings its logo, its color and its type. Fonts are font
|
|
10
|
+
* stacks the reader's device already has (no web fonts, which would tell a font service the email was opened).
|
|
10
11
|
*/
|
|
11
12
|
export interface EmailDesign {
|
|
12
13
|
/** The company: the logo's description, and its name beside the logo with `wordmark`. */
|
|
13
14
|
name: string;
|
|
14
|
-
/** The size the inline image "logo" is shown at, when the email carries one. */
|
|
15
|
+
/** The size the inline image "logo" is shown at, when the email carries one: the real logo, without a background. */
|
|
15
16
|
logo?: {
|
|
16
17
|
width: number;
|
|
17
18
|
height: number;
|
|
18
19
|
};
|
|
19
20
|
/** Whether the company's name is written beside the logo. */
|
|
20
|
-
wordmark
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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, a color or a CSS gradient, when it isn't the accent (a hairline fading at its ends). */
|
|
43
|
-
headerRule?: string;
|
|
44
|
-
/**
|
|
45
|
-
* The header line's plain color, under its gradient: what clients that drop gradients (some privacy-minded ones)
|
|
46
|
-
* show instead; the accent by default.
|
|
47
|
-
*/
|
|
48
|
-
headerRuleColor?: string;
|
|
49
|
-
/** Behind a quoted text. */
|
|
50
|
-
box: string;
|
|
51
|
-
/** The button's words. */
|
|
52
|
-
onAccent: string;
|
|
53
|
-
};
|
|
54
|
-
fonts: {
|
|
55
|
-
heading: string;
|
|
56
|
-
body: string;
|
|
57
|
-
/** Eyebrows, labels and small print. */
|
|
58
|
-
label: string;
|
|
59
|
-
};
|
|
60
|
-
heading: {
|
|
61
|
-
size: number;
|
|
62
|
-
weight: number;
|
|
63
|
-
letterSpacing: string;
|
|
64
|
-
lineHeight: number;
|
|
65
|
-
};
|
|
66
|
-
/** Eyebrows and labels in capitals, spaced. */
|
|
67
|
-
label: {
|
|
68
|
-
size: number;
|
|
69
|
-
letterSpacing: string;
|
|
70
|
-
};
|
|
71
|
-
/** The rules between details: solid, or dashed like the brand's grid. */
|
|
72
|
-
rule: "solid" | "dashed";
|
|
73
|
-
/** The card's corners (0 for square). */
|
|
74
|
-
radius: number;
|
|
75
|
-
/** "+" marks at the card's corners, where a grid's lines would cross. */
|
|
76
|
-
crosses?: boolean;
|
|
77
|
-
/** A short line before the eyebrow. */
|
|
78
|
-
eyebrowLine?: boolean;
|
|
79
|
-
/** A bar in the accent at the left of a quoted text. */
|
|
80
|
-
quoteBar?: boolean;
|
|
81
|
-
button: {
|
|
82
|
-
radius: number;
|
|
83
|
-
uppercase: boolean;
|
|
84
|
-
letterSpacing: string;
|
|
21
|
+
wordmark?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The brand's color, dark enough to read on white: the logo, the eyebrow, the headings, a quoted text's label and
|
|
24
|
+
* bar, and the button. Black when the brand's own color is white.
|
|
25
|
+
*/
|
|
26
|
+
color: string;
|
|
27
|
+
/** The button's words, on the brand's color: white by default. */
|
|
28
|
+
onColor?: string;
|
|
29
|
+
/** The headings' font stack, and the rest's; the device's own sans by default. */
|
|
30
|
+
fonts?: {
|
|
31
|
+
heading?: string;
|
|
32
|
+
body?: string;
|
|
85
33
|
};
|
|
86
|
-
/** The company's lines at the very bottom of every email (its
|
|
34
|
+
/** The company's lines at the very bottom of every email (its site). */
|
|
87
35
|
signature?: readonly {
|
|
88
36
|
text: string;
|
|
89
37
|
href?: string;
|
|
@@ -100,9 +48,9 @@ export interface EmailContent {
|
|
|
100
48
|
heading: string;
|
|
101
49
|
/** Paragraphs under the heading. */
|
|
102
50
|
paragraphs?: readonly string[];
|
|
103
|
-
/** The details
|
|
51
|
+
/** The details, each label over its value. */
|
|
104
52
|
rows?: readonly EmailRow[];
|
|
105
|
-
/** A longer text
|
|
53
|
+
/** A longer text keeping its line breaks (a visitor's message), with its label. */
|
|
106
54
|
quote?: {
|
|
107
55
|
label: string;
|
|
108
56
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/email-layout/type.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/email-layout/type.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,qHAAqH;IACrH,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,KAAK,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,wEAAwE;IACxE,SAAS,CAAC,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACxD;AAED,kDAAkD;AAClD,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,8CAA8C;IAC9C,IAAI,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC3B,mFAAmF;IACnF,KAAK,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,iEAAiE;IACjE,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACzC,wDAAwD;IACxD,MAAM,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC9B"}
|
package/distribution/index.d.ts
CHANGED
|
@@ -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";
|
|
23
|
+
export { EMAIL_COLORS, emailLayout, SYSTEM_FONT } from "@sharadox/email-web-library/email-layout";
|
|
24
24
|
export type { EmailContent, EmailDesign, 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,cA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AAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC"}
|
package/distribution/index.js
CHANGED
|
@@ -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, emailLayout, SYSTEM_FONT } 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,WAAW,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC"}
|
package/llms.txt
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
- /inline-image: inlineImage(id, { filename, contentType, content (base64) }) → InlineImage with the bytes decoded (a library's logo kept as base64 text)
|
|
9
9
|
- /email-address: checkEmailAddress(value, field) → the address, or EmailError("invalid-message"); EmailAddress = string | { name, address }
|
|
10
10
|
- /email-error: EmailError(code: "configuration" | "invalid-message" | "delivery", message, options?)
|
|
11
|
-
- /email-layout: emailLayout(content, design, logo) → HTML
|
|
11
|
+
- /email-layout: emailLayout(content, design, logo) → HTML the same in every mail app: black on white (EMAIL_COLORS), styles inline, no <style>/dark-mode rules/gradients, the app darkens it itself; logo top left; EmailDesign { name, logo? {width,height}, wordmark?, color (brand color on eyebrow, headings, quote bar, button; black for a white brand), onColor? (#ffffff), fonts? { heading?, body? } (SYSTEM_FONT), signature? }, EmailContent (language, preview, eyebrow, heading, paragraphs, rows (label over value), quote, button, footer)
|
|
12
12
|
- Root import (all of the above) kept in 0.5 for compatibility, removed in 0.6.
|
|
13
13
|
- License: Sharadox Open Source License 0.1.0
|
|
14
|
-
- Dark mode: every email declares its colors as its own (meta color-scheme + supported-color-schemes, :root color-scheme, a prefers-color-scheme:dark rule with the same page color), its <style> repeated inside <body>; colors.headerRuleColor is the plain color under a gradient headerRule
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharadox/email-web-library",
|
|
3
|
-
"version": "0.6.0-polish.
|
|
3
|
+
"version": "0.6.0-polish.24",
|
|
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>",
|