@tonycodes-ui/mortar 0.13.0 → 0.15.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.
@@ -0,0 +1,355 @@
1
+ /* Email templates for @tonycodes-ui/mortar/email: the transactional emails
2
+ most products send, composed only from the email components. Copy follows
3
+ docs/auth-flows.md: say why the email came and what to do if it wasn't
4
+ expected, and never reveal more than the link or code needs. */
5
+
6
+ import type { ReactNode } from "react";
7
+ import type { EmailTheme } from "./email-theme.js";
8
+ import {
9
+ EmailButton,
10
+ EmailCallout,
11
+ EmailCode,
12
+ EmailHeading,
13
+ EmailLink,
14
+ EmailShell,
15
+ EmailSummary,
16
+ EmailText,
17
+ type EmailLogo,
18
+ type EmailSummaryItem,
19
+ } from "./email-components.js";
20
+
21
+ /** Props every template takes. */
22
+ export interface EmailTemplateProps {
23
+ /** Your product, as the person knows it. */
24
+ productName: string;
25
+ /** From `emailTheme(brand)`; Mortar's neutral theme by default. */
26
+ theme?: EmailTheme;
27
+ logo?: EmailLogo;
28
+ /** Replaces the template's footer, which says why the email was sent. */
29
+ footer?: ReactNode;
30
+ lang?: string;
31
+ dir?: "ltr" | "rtl";
32
+ }
33
+
34
+ /* The main action, then its URL for clients that block buttons. */
35
+ function Action({ href, label }: { href: string; label: string }) {
36
+ return (
37
+ <>
38
+ <EmailButton href={href}>{label}</EmailButton>
39
+ <EmailText tone="muted" size="sm">
40
+ If the button doesn't work, paste this link into your browser:{" "}
41
+ <EmailLink href={href} />
42
+ </EmailText>
43
+ </>
44
+ );
45
+ }
46
+
47
+ function Detail({ children }: { children: ReactNode }) {
48
+ return (
49
+ <EmailText tone="muted" size="sm">
50
+ {children}
51
+ </EmailText>
52
+ );
53
+ }
54
+
55
+ export interface VerifyEmailProps extends EmailTemplateProps {
56
+ /** A one-time code to type in, shown large. */
57
+ code?: string;
58
+ /** A confirmation link, shown as a button. Give `code`, `href` or both. */
59
+ href?: string;
60
+ /** The address being confirmed. */
61
+ recipient?: string;
62
+ /** Preformatted, e.g. "10 minutes". */
63
+ expiresIn?: string;
64
+ }
65
+ /**
66
+ * Confirms an email address with a code, a link or both: the email for the
67
+ * auth flow's verify-email step.
68
+ */
69
+ export function VerifyEmail({
70
+ productName,
71
+ code,
72
+ href,
73
+ recipient,
74
+ expiresIn,
75
+ footer,
76
+ ...shell
77
+ }: VerifyEmailProps) {
78
+ if (!code && !href)
79
+ throw new Error("Mortar VerifyEmail needs a `code`, an `href` or both.");
80
+ const address = recipient ?? "your email address";
81
+ return (
82
+ <EmailShell
83
+ {...shell}
84
+ preview={`Confirm your email address for ${productName}`}
85
+ footer={
86
+ footer ??
87
+ `You received this email because this address was used to sign up for ${productName}. If that wasn't you, you can ignore it.`
88
+ }
89
+ >
90
+ <EmailHeading>Confirm your email address</EmailHeading>
91
+ {code && (
92
+ <>
93
+ <EmailText>
94
+ Enter this code in {productName} to confirm {address}:
95
+ </EmailText>
96
+ <EmailCode code={code} />
97
+ </>
98
+ )}
99
+ {href && (
100
+ <>
101
+ <EmailText>
102
+ {code
103
+ ? "Or confirm with one click:"
104
+ : `Confirm ${address} to finish setting up your ${productName} account.`}
105
+ </EmailText>
106
+ <Action href={href} label="Confirm email address" />
107
+ </>
108
+ )}
109
+ {expiresIn && (
110
+ <Detail>
111
+ {code && href
112
+ ? `This code and link expire in ${expiresIn}.`
113
+ : `This ${code ? "code" : "link"} expires in ${expiresIn}.`}
114
+ </Detail>
115
+ )}
116
+ </EmailShell>
117
+ );
118
+ }
119
+
120
+ export interface MagicLinkProps extends EmailTemplateProps {
121
+ /** The sign-in link. */
122
+ href: string;
123
+ /** Preformatted, e.g. "15 minutes". */
124
+ expiresIn?: string;
125
+ /** Where the request came from, e.g. "Chrome on macOS, near London". */
126
+ requestedFrom?: string;
127
+ }
128
+ /** A passwordless sign-in link: the email behind SignInPanel. */
129
+ export function MagicLink({
130
+ productName,
131
+ href,
132
+ expiresIn,
133
+ requestedFrom,
134
+ footer,
135
+ ...shell
136
+ }: MagicLinkProps) {
137
+ return (
138
+ <EmailShell
139
+ {...shell}
140
+ preview={`Your sign-in link for ${productName}`}
141
+ footer={
142
+ footer ??
143
+ `You received this email because someone asked to sign in to ${productName} with this address. If that wasn't you, you can ignore it.`
144
+ }
145
+ >
146
+ <EmailHeading>Sign in to {productName}</EmailHeading>
147
+ <EmailText>Use the link below to sign in to {productName}.</EmailText>
148
+ <Action href={href} label={`Sign in to ${productName}`} />
149
+ {expiresIn && <Detail>This link expires in {expiresIn}.</Detail>}
150
+ {requestedFrom && <Detail>Requested from {requestedFrom}.</Detail>}
151
+ </EmailShell>
152
+ );
153
+ }
154
+
155
+ export interface PasswordResetProps extends EmailTemplateProps {
156
+ /** The reset link. */
157
+ href: string;
158
+ /** The account's address, shown so the person knows which account. */
159
+ recipient?: string;
160
+ /** Preformatted, e.g. "1 hour". */
161
+ expiresIn?: string;
162
+ /** Where the request came from, e.g. "Firefox on Windows". */
163
+ requestedFrom?: string;
164
+ }
165
+ /**
166
+ * The link for the auth flow's reset-password step. Send it only to an
167
+ * address that has an account, and show the same "check your email" page
168
+ * either way, so the form never reveals whether an account exists.
169
+ */
170
+ export function PasswordReset({
171
+ productName,
172
+ href,
173
+ recipient,
174
+ expiresIn,
175
+ requestedFrom,
176
+ footer,
177
+ ...shell
178
+ }: PasswordResetProps) {
179
+ return (
180
+ <EmailShell
181
+ {...shell}
182
+ preview={`Reset your ${productName} password`}
183
+ footer={
184
+ footer ??
185
+ "If you didn't ask to reset your password, you can ignore this email. Your password won't change."
186
+ }
187
+ >
188
+ <EmailHeading>Reset your password</EmailHeading>
189
+ <EmailText>
190
+ We received a request to reset the password for{" "}
191
+ {recipient
192
+ ? `the ${productName} account ${recipient}`
193
+ : `your ${productName} account`}
194
+ . To choose a new password, use the link below.
195
+ </EmailText>
196
+ <Action href={href} label="Reset password" />
197
+ {expiresIn && <Detail>This link expires in {expiresIn}.</Detail>}
198
+ {requestedFrom && <Detail>Requested from {requestedFrom}.</Detail>}
199
+ </EmailShell>
200
+ );
201
+ }
202
+
203
+ export interface InviteProps extends EmailTemplateProps {
204
+ /** Who sent the invitation. */
205
+ inviterName: string;
206
+ /** The team or workspace; the product when omitted. */
207
+ workspaceName?: string;
208
+ /** The link to accept. */
209
+ href: string;
210
+ /** The inviter's own note, shown quoted. */
211
+ message?: string;
212
+ /** Preformatted, e.g. "7 days". */
213
+ expiresIn?: string;
214
+ }
215
+ /** An invitation to join a workspace. */
216
+ export function Invite({
217
+ productName,
218
+ inviterName,
219
+ workspaceName,
220
+ href,
221
+ message,
222
+ expiresIn,
223
+ footer,
224
+ ...shell
225
+ }: InviteProps) {
226
+ const target = workspaceName ?? productName;
227
+ return (
228
+ <EmailShell
229
+ {...shell}
230
+ preview={`${inviterName} invited you to ${target}`}
231
+ footer={
232
+ footer ??
233
+ `You received this email because ${inviterName} invited this address to ${productName}. If you weren't expecting it, you can ignore it.`
234
+ }
235
+ >
236
+ <EmailHeading>
237
+ {inviterName} invited you to {target}
238
+ </EmailHeading>
239
+ <EmailText>
240
+ {workspaceName
241
+ ? `Join the ${workspaceName} workspace on ${productName} to work with ${inviterName}.`
242
+ : `Join ${inviterName} on ${productName}.`}
243
+ </EmailText>
244
+ {message && (
245
+ <EmailCallout title={`Message from ${inviterName}`}>
246
+ {message}
247
+ </EmailCallout>
248
+ )}
249
+ <Action href={href} label="Accept invitation" />
250
+ {expiresIn && <Detail>This invitation expires in {expiresIn}.</Detail>}
251
+ </EmailShell>
252
+ );
253
+ }
254
+
255
+ export interface ReceiptProps extends EmailTemplateProps {
256
+ orderNumber: string;
257
+ /** Preformatted, e.g. "6 November 2026". */
258
+ date: string;
259
+ items: EmailSummaryItem[];
260
+ /** Subtotal, shipping, tax, discounts. */
261
+ lines?: { label: string; value: string }[];
262
+ total: { label: string; value: string };
263
+ /** e.g. "Visa ending 4242". */
264
+ paymentMethod?: string;
265
+ /** The order in your app. */
266
+ href?: string;
267
+ /** Defaults to "Thanks for your order". */
268
+ title?: string;
269
+ }
270
+ /** An order confirmation or receipt, with items, costs and total. */
271
+ export function Receipt({
272
+ productName,
273
+ orderNumber,
274
+ date,
275
+ items,
276
+ lines,
277
+ total,
278
+ paymentMethod,
279
+ href,
280
+ title = "Thanks for your order",
281
+ footer,
282
+ ...shell
283
+ }: ReceiptProps) {
284
+ return (
285
+ <EmailShell
286
+ {...shell}
287
+ preview={`Your ${productName} receipt for order ${orderNumber}`}
288
+ footer={
289
+ footer ??
290
+ `You received this receipt for order ${orderNumber} from ${productName}. Keep it for your records.`
291
+ }
292
+ >
293
+ <EmailHeading>{title}</EmailHeading>
294
+ <Detail>
295
+ Order {orderNumber}, {date}
296
+ </Detail>
297
+ <EmailSummary items={items} lines={lines} total={total} />
298
+ {paymentMethod && <Detail>Paid with {paymentMethod}.</Detail>}
299
+ {href && <EmailButton href={href}>View order</EmailButton>}
300
+ </EmailShell>
301
+ );
302
+ }
303
+
304
+ export interface NotificationProps extends EmailTemplateProps {
305
+ title: string;
306
+ /** The inbox preview line; the title when omitted. */
307
+ preview?: string;
308
+ children: ReactNode;
309
+ /** One main action. */
310
+ action?: { label: string; href: string };
311
+ /** Where the person can change which emails they get. */
312
+ preferencesHref?: string;
313
+ }
314
+ /** A product notification: a title, a message and at most one action. */
315
+ export function Notification({
316
+ productName,
317
+ title,
318
+ preview,
319
+ children,
320
+ action,
321
+ preferencesHref,
322
+ footer,
323
+ ...shell
324
+ }: NotificationProps) {
325
+ return (
326
+ <EmailShell
327
+ {...shell}
328
+ preview={preview ?? title}
329
+ footer={
330
+ footer ?? (
331
+ <>
332
+ You received this email because of your notification settings in{" "}
333
+ {productName}.
334
+ {preferencesHref && (
335
+ <>
336
+ {" "}
337
+ <EmailLink href={preferencesHref}>
338
+ Manage email preferences
339
+ </EmailLink>
340
+ </>
341
+ )}
342
+ </>
343
+ )
344
+ }
345
+ >
346
+ <EmailHeading>{title}</EmailHeading>
347
+ {typeof children === "string" ? (
348
+ <EmailText>{children}</EmailText>
349
+ ) : (
350
+ children
351
+ )}
352
+ {action && <EmailButton href={action.href}>{action.label}</EmailButton>}
353
+ </EmailShell>
354
+ );
355
+ }
@@ -0,0 +1,254 @@
1
+ /* Email theme. Email clients cannot read Mortar's stylesheet: Gmail drops CSS
2
+ variables and Outlook for Windows renders with Word. So an email takes its
3
+ colours and fonts as literal values, resolved here from a brand the way
4
+ tokens.css resolves it for the light appearance: omitted values keep
5
+ Mortar's defaults or derive from primary, and derived colours
6
+ (color-mix(in oklab, …)) are computed in JS. tests/email.test.mjs checks
7
+ the defaults against tokens.css. */
8
+
9
+ import { isBrandFont, type BrandDefinition } from "./brand.js";
10
+
11
+ /** Literal colours (#rrggbb) and font stacks for an email. */
12
+ export interface EmailTheme {
13
+ /** The page behind the message. */
14
+ paper: string;
15
+ /** The message card. */
16
+ surface: string;
17
+ /** Recessed areas such as a one-time code. */
18
+ sunken: string;
19
+ line: string;
20
+ ink: string;
21
+ secondary: string;
22
+ muted: string;
23
+ primary: string;
24
+ onPrimary: string;
25
+ accent: string;
26
+ onAccent: string;
27
+ link: string;
28
+ /** A tint of primary on the paper, for highlighted rows and callouts. */
29
+ selected: string;
30
+ success: string;
31
+ warning: string;
32
+ danger: string;
33
+ info: string;
34
+ /** Body font stack, ending in fonts every email client has. */
35
+ font: string;
36
+ /** Heading font stack; the body stack unless the brand sets one. */
37
+ fontHeading: string;
38
+ mono: string;
39
+ }
40
+
41
+ /* The light defaults in tokens.css. */
42
+ const DEFAULTS = {
43
+ paper: "#ffffff",
44
+ surface: "#ffffff",
45
+ sunken: "#f5f5f7",
46
+ line: "#e5e5ea",
47
+ ink: "#000000",
48
+ secondary: "#3a3a3c",
49
+ muted: "#6e6e73",
50
+ primary: "#000000",
51
+ onPrimary: "#ffffff",
52
+ success: "#1f7a36",
53
+ warning: "#945700",
54
+ danger: "#c70014",
55
+ info: "#0060c7",
56
+ };
57
+ /* The neutral brand's tuned selected tint (no brand at all). */
58
+ const NEUTRAL_SELECTED = "#f2f2f4";
59
+
60
+ /* Mortar's system stack, plus the fonts Windows and Android mail apps have. */
61
+ const SANS =
62
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif';
63
+ const SERIF = 'Georgia, "Times New Roman", Times, serif';
64
+ const MONO = '"SF Mono", Menlo, Consolas, "Courier New", monospace';
65
+ const GENERIC: Record<string, string> = {
66
+ "sans-serif": SANS,
67
+ "system-ui": SANS,
68
+ "ui-sans-serif": SANS,
69
+ serif: SERIF,
70
+ "ui-serif": SERIF,
71
+ monospace: MONO,
72
+ "ui-monospace": MONO,
73
+ };
74
+
75
+ /**
76
+ * A brand font list for email: `var()` entries (which email cannot resolve)
77
+ * and generic families are dropped, and a stack every client has is
78
+ * appended, serif or monospace when the brand's generic family is one.
79
+ */
80
+ function fontStack(value: string | undefined, key: string): string | undefined {
81
+ const text = value?.trim();
82
+ if (!text) return undefined;
83
+ if (!isBrandFont(text))
84
+ throw new Error(
85
+ `Invalid Mortar brand font for fonts.${key}: "${text}". Use family names, quoted names and generic families separated by commas, e.g. "Inter", sans-serif.`,
86
+ );
87
+ let fallback = SANS;
88
+ const names = text
89
+ .split(",")
90
+ .map((name) => name.trim())
91
+ .filter((name) => {
92
+ if (/^var\(/i.test(name)) return false;
93
+ const generic = GENERIC[name.toLowerCase()];
94
+ if (generic) fallback = generic;
95
+ return !generic;
96
+ });
97
+ return [...names, fallback].join(", ");
98
+ }
99
+
100
+ /* Colour parsing: the opaque colour syntax a brand can resolve without a
101
+ browser. Everything is converted to sRGB and written as #rrggbb. */
102
+ type Rgb = [number, number, number];
103
+
104
+ const linear = (v: number) =>
105
+ v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
106
+ const gamma = (v: number) =>
107
+ v <= 0.0031308 ? v * 12.92 : 1.055 * v ** (1 / 2.4) - 0.055;
108
+
109
+ function toOklab([r, g, b]: Rgb): Rgb {
110
+ const [lr, lg, lb] = [r, g, b].map(linear);
111
+ const l = Math.cbrt(
112
+ 0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb,
113
+ );
114
+ const m = Math.cbrt(
115
+ 0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb,
116
+ );
117
+ const s = Math.cbrt(
118
+ 0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb,
119
+ );
120
+ return [
121
+ 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
122
+ 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
123
+ 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
124
+ ];
125
+ }
126
+ function fromOklab([L, a, b]: Rgb): Rgb {
127
+ const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;
128
+ const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;
129
+ const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;
130
+ return [
131
+ 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s,
132
+ -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s,
133
+ -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s,
134
+ ].map(gamma) as Rgb;
135
+ }
136
+
137
+ /** sRGB channels in 0–1 as #rrggbb, clipped to the sRGB gamut. */
138
+ function hex(rgb: Rgb): string {
139
+ return `#${rgb
140
+ .map((v) =>
141
+ Math.round(Math.min(1, Math.max(0, v)) * 255)
142
+ .toString(16)
143
+ .padStart(2, "0"),
144
+ )
145
+ .join("")}`;
146
+ }
147
+
148
+ /** A number, or a percentage of `whole`. */
149
+ function amount(value: string, whole: number): number {
150
+ const n = parseFloat(value);
151
+ if (!/^[+-]?(?:\d+\.?\d*|\.\d+)%?$/.test(value) || Number.isNaN(n))
152
+ throw new Error();
153
+ return value.endsWith("%") ? (n / 100) * whole : n;
154
+ }
155
+ function hue(value: string): number {
156
+ const m = /^([+-]?(?:\d+\.?\d*|\.\d+))(deg|turn|rad)?$/.exec(value);
157
+ if (!m) throw new Error();
158
+ const n = parseFloat(m[1]);
159
+ return m[2] === "turn" ? n * 360 : m[2] === "rad" ? (n * 180) / Math.PI : n;
160
+ }
161
+
162
+ function hslToRgb(h: number, s: number, l: number): Rgb {
163
+ const k = (n: number) => (n + h / 30) % 12;
164
+ const a = s * Math.min(l, 1 - l);
165
+ return [0, 8, 4].map(
166
+ (n) => l - a * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1)),
167
+ ) as Rgb;
168
+ }
169
+
170
+ function parseColour(value: string): Rgb {
171
+ const text = value.trim().toLowerCase();
172
+ if (text === "white") return [1, 1, 1];
173
+ if (text === "black") return [0, 0, 0];
174
+ const short = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(text);
175
+ if (short) return short.slice(1).map((d) => parseInt(d + d, 16) / 255) as Rgb;
176
+ const long = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(text);
177
+ if (long) return long.slice(1).map((d) => parseInt(d, 16) / 255) as Rgb;
178
+ const fn = /^(rgba?|hsla?|oklab|oklch)\(([^()]*)\)$/.exec(text);
179
+ if (!fn) throw new Error();
180
+ const [channels, alpha] = fn[2].split("/");
181
+ const parts = channels.trim().split(/[\s,]+/);
182
+ const extraAlpha = parts.length === 4 ? parts.pop() : undefined;
183
+ const opacity = alpha ?? extraAlpha;
184
+ if (opacity !== undefined && amount(opacity.trim(), 1) !== 1)
185
+ throw new Error();
186
+ if (parts.length !== 3) throw new Error();
187
+ const [x, y, z] = parts;
188
+ switch (fn[1]) {
189
+ case "rgb":
190
+ case "rgba":
191
+ return [x, y, z].map((v) => amount(v, 255) / 255) as Rgb;
192
+ case "hsl":
193
+ case "hsla":
194
+ return hslToRgb(hue(x), amount(y, 100) / 100, amount(z, 100) / 100);
195
+ case "oklab":
196
+ return fromOklab([amount(x, 1), amount(y, 0.4), amount(z, 0.4)]);
197
+ default: {
198
+ const c = amount(y, 0.4),
199
+ h = (hue(z) * Math.PI) / 180;
200
+ return fromOklab([amount(x, 1), c * Math.cos(h), c * Math.sin(h)]);
201
+ }
202
+ }
203
+ }
204
+
205
+ function colour(value: string | undefined, key: string): string | undefined {
206
+ const text = value?.trim();
207
+ if (!text) return undefined;
208
+ try {
209
+ return hex(parseColour(text));
210
+ } catch {
211
+ throw new Error(
212
+ `Mortar email colours must be literal and opaque, for light.${key}: "${text}". Use a hex value, white, black, or rgb(), hsl(), oklab() or oklch().`,
213
+ );
214
+ }
215
+ }
216
+
217
+ /** color-mix(in oklab, a p%, b) as #rrggbb. */
218
+ function mix(a: string, b: string, percentA: number): string {
219
+ const t = percentA / 100;
220
+ const [x, y] = [toOklab(parseColour(a)), toOklab(parseColour(b))];
221
+ return hex(fromOklab(x.map((v, i) => v * t + y[i] * (1 - t)) as Rgb));
222
+ }
223
+
224
+ /**
225
+ * The email theme for a brand, in its light appearance: emails render light,
226
+ * since most clients ignore or override a dark one. Without a brand, Mortar's
227
+ * neutral defaults. Brand colours must be literal (`var()`, `color-mix()`
228
+ * and `light-dark()` need a browser) and opaque; the accent gradient is not
229
+ * used, as most clients cannot paint one, so accents use the flat `accent`.
230
+ */
231
+ export function emailTheme(brand?: BrandDefinition): EmailTheme {
232
+ const light = brand?.light ?? {};
233
+ const paper = colour(light.paper, "paper") ?? DEFAULTS.paper;
234
+ const primary = colour(light.primary, "primary") ?? DEFAULTS.primary;
235
+ const onPrimary = colour(light.onPrimary, "onPrimary") ?? DEFAULTS.onPrimary;
236
+ const font = fontStack(brand?.fonts?.body, "body") ?? SANS;
237
+ return {
238
+ ...DEFAULTS,
239
+ paper,
240
+ surface: colour(light.surface, "surface") ?? DEFAULTS.surface,
241
+ sunken: colour(light.sunken, "sunken") ?? DEFAULTS.sunken,
242
+ primary,
243
+ onPrimary,
244
+ accent: colour(light.accent, "accent") ?? primary,
245
+ onAccent: colour(light.onAccent, "onAccent") ?? onPrimary,
246
+ link: colour(light.link, "link") ?? primary,
247
+ selected:
248
+ colour(light.selected, "selected") ??
249
+ (brand ? mix(primary, paper, 8) : NEUTRAL_SELECTED),
250
+ font,
251
+ fontHeading: fontStack(brand?.fonts?.heading, "heading") ?? font,
252
+ mono: MONO,
253
+ };
254
+ }
package/src/email.ts ADDED
@@ -0,0 +1,47 @@
1
+ /* @tonycodes-ui/mortar/email: transactional email built on React Email
2
+ (the optional peer dependency @react-email/components). See docs/email.md. */
3
+
4
+ export { emailTheme } from "./email-theme.js";
5
+ export type { EmailTheme } from "./email-theme.js";
6
+ export {
7
+ EmailShell,
8
+ EmailHeading,
9
+ EmailText,
10
+ EmailButton,
11
+ EmailLink,
12
+ EmailCode,
13
+ EmailCallout,
14
+ EmailDivider,
15
+ EmailSummary,
16
+ renderEmail,
17
+ } from "./email-components.js";
18
+ export type {
19
+ EmailLogo,
20
+ EmailShellProps,
21
+ EmailHeadingProps,
22
+ EmailTextProps,
23
+ EmailButtonProps,
24
+ EmailLinkProps,
25
+ EmailCodeProps,
26
+ EmailCalloutProps,
27
+ EmailSummaryItem,
28
+ EmailSummaryProps,
29
+ RenderedEmail,
30
+ } from "./email-components.js";
31
+ export {
32
+ VerifyEmail,
33
+ MagicLink,
34
+ PasswordReset,
35
+ Invite,
36
+ Receipt,
37
+ Notification,
38
+ } from "./email-templates.js";
39
+ export type {
40
+ EmailTemplateProps,
41
+ VerifyEmailProps,
42
+ MagicLinkProps,
43
+ PasswordResetProps,
44
+ InviteProps,
45
+ ReceiptProps,
46
+ NotificationProps,
47
+ } from "./email-templates.js";