@mailquilt/templates 0.0.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,11 +1,61 @@
1
1
  {
2
2
  "name": "@mailquilt/templates",
3
- "version": "0.0.0",
4
- "description": "Placeholder for @mailquilt/templates (0.5.0 release pending)",
3
+ "version": "0.5.0",
4
+ "description": "Production-ready Starter emails and Saved Rows for the Mail Quilt email editor, in format v4. Zero runtime dependencies.",
5
+ "keywords": [
6
+ "email",
7
+ "email-builder",
8
+ "email-editor",
9
+ "email-template",
10
+ "json",
11
+ "mailquilt",
12
+ "saved-rows",
13
+ "starter-emails"
14
+ ],
15
+ "homepage": "https://editor.mailquilt.com",
16
+ "bugs": {
17
+ "url": "https://github.com/mailquilt/editor/issues"
18
+ },
5
19
  "license": "MIT",
6
20
  "repository": {
7
21
  "type": "git",
8
22
  "url": "git+https://github.com/mailquilt/editor.git",
9
23
  "directory": "packages/templates"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "src"
28
+ ],
29
+ "type": "module",
30
+ "sideEffects": false,
31
+ "main": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "devDependencies": {
44
+ "@mailquilt/core": "0.5.0",
45
+ "@mailquilt/editor": "0.5.0",
46
+ "@mailquilt/renderer": "0.5.0",
47
+ "@repo/typescript-config": "0.0.0",
48
+ "@types/node": "^24.19.2",
49
+ "tsdown": "^0.23.5",
50
+ "typescript": "7.0.2",
51
+ "vitest": "^5.1.0"
52
+ },
53
+ "engines": {
54
+ "node": ">=22"
55
+ },
56
+ "scripts": {
57
+ "build": "tsdown",
58
+ "check-types": "tsc --noEmit && tsc --noEmit -p test",
59
+ "test": "vitest run"
10
60
  }
11
- }
61
+ }
@@ -0,0 +1,256 @@
1
+ import type {
2
+ TemplateBlock,
3
+ TemplateButtonBlockProps,
4
+ TemplateColumn,
5
+ TemplateColumnProps,
6
+ TemplateDividerBlockProps,
7
+ TemplateDocument,
8
+ TemplateEmailSettings,
9
+ TemplateHeadingBlockProps,
10
+ TemplateImageBlockProps,
11
+ TemplateMenuBlockProps,
12
+ TemplateMenuLink,
13
+ TemplateRichTextDocument,
14
+ TemplateRichTextHardBreak,
15
+ TemplateRichTextHeadingDocument,
16
+ TemplateRichTextInline,
17
+ TemplateRichTextList,
18
+ TemplateRichTextMark,
19
+ TemplateRichTextMergeTag,
20
+ TemplateRichTextParagraph,
21
+ TemplateRichTextText,
22
+ TemplateRow,
23
+ TemplateRowProps,
24
+ TemplateSavedRow,
25
+ TemplateSocialBlockProps,
26
+ TemplateSocialLink,
27
+ TemplateStarterEmail,
28
+ TemplateTextBlockProps,
29
+ TemplateVideoBlockProps,
30
+ } from "./types.js";
31
+
32
+ export const FONT_SANS = "Arial, Helvetica, sans-serif";
33
+ export const FONT_SERIF = "Georgia, 'Times New Roman', serif";
34
+ export const FONT_TAHOMA = "Tahoma, Verdana, sans-serif";
35
+
36
+ type InlineInput = string | TemplateRichTextInline;
37
+
38
+ const toInline = (item: InlineInput): TemplateRichTextInline =>
39
+ typeof item === "string" ? { text: item, type: "text" } : item;
40
+
41
+ export const textRun = (
42
+ text: string,
43
+ marks?: TemplateRichTextMark[]
44
+ ): TemplateRichTextText =>
45
+ marks === undefined ? { text, type: "text" } : { marks, text, type: "text" };
46
+
47
+ export const bold = (text: string): TemplateRichTextText =>
48
+ textRun(text, [{ type: "bold" }]);
49
+
50
+ export const italic = (text: string): TemplateRichTextText =>
51
+ textRun(text, [{ type: "italic" }]);
52
+
53
+ export const linkText = (
54
+ text: string,
55
+ href: string,
56
+ extraMarks: readonly Exclude<TemplateRichTextMark, { type: "link" }>[] = []
57
+ ): TemplateRichTextText => ({
58
+ marks: [...extraMarks, { attrs: { href }, type: "link" }],
59
+ text,
60
+ type: "text",
61
+ });
62
+
63
+ export const tag = (
64
+ name: string,
65
+ marks?: TemplateRichTextMark[]
66
+ ): TemplateRichTextMergeTag =>
67
+ marks === undefined
68
+ ? { attrs: { name }, type: "mergeTag" }
69
+ : { attrs: { name }, marks, type: "mergeTag" };
70
+
71
+ export const tagLink = (
72
+ name: string,
73
+ href: string,
74
+ extraMarks: readonly Exclude<TemplateRichTextMark, { type: "link" }>[] = []
75
+ ): TemplateRichTextMergeTag => ({
76
+ attrs: { name },
77
+ marks: [...extraMarks, { attrs: { href }, type: "link" }],
78
+ type: "mergeTag",
79
+ });
80
+
81
+ export const br = (): TemplateRichTextHardBreak => ({ type: "hardBreak" });
82
+
83
+ export const p = (...items: InlineInput[]): TemplateRichTextParagraph =>
84
+ items.length === 0
85
+ ? { type: "paragraph" }
86
+ : { content: items.map(toInline), type: "paragraph" };
87
+
88
+ export const ul = (
89
+ ...items: TemplateRichTextParagraph[]
90
+ ): TemplateRichTextList => ({
91
+ content: items.map((paragraph) => ({
92
+ content: [paragraph],
93
+ type: "listItem",
94
+ })),
95
+ type: "bulletList",
96
+ });
97
+
98
+ export const ol = (
99
+ ...items: TemplateRichTextParagraph[]
100
+ ): TemplateRichTextList => ({
101
+ content: items.map((paragraph) => ({
102
+ content: [paragraph],
103
+ type: "listItem",
104
+ })),
105
+ type: "orderedList",
106
+ });
107
+
108
+ export const doc = (
109
+ ...content: (TemplateRichTextParagraph | TemplateRichTextList)[]
110
+ ): TemplateRichTextDocument => ({
111
+ content,
112
+ type: "doc",
113
+ });
114
+
115
+ export const headingDoc = (
116
+ ...content: TemplateRichTextParagraph[]
117
+ ): TemplateRichTextHeadingDocument => ({
118
+ content,
119
+ type: "doc",
120
+ });
121
+
122
+ export const headingBlock = (
123
+ id: string,
124
+ level: 1 | 2 | 3,
125
+ content: TemplateRichTextHeadingDocument,
126
+ props: Omit<TemplateHeadingBlockProps, "content" | "level"> = {}
127
+ ): TemplateBlock => ({
128
+ id,
129
+ props: { ...props, content, level },
130
+ type: "heading",
131
+ });
132
+
133
+ export const textBlock = (
134
+ id: string,
135
+ content: TemplateRichTextDocument,
136
+ props: Omit<TemplateTextBlockProps, "content"> = {}
137
+ ): TemplateBlock => ({
138
+ id,
139
+ props: { ...props, content },
140
+ type: "text",
141
+ });
142
+
143
+ export const buttonBlock = (
144
+ id: string,
145
+ label: string,
146
+ href: string,
147
+ props: Omit<TemplateButtonBlockProps, "href" | "label"> = {}
148
+ ): TemplateBlock => ({
149
+ id,
150
+ props: { ...props, href, label },
151
+ type: "button",
152
+ });
153
+
154
+ export const dividerBlock = (
155
+ id: string,
156
+ props: TemplateDividerBlockProps = {}
157
+ ): TemplateBlock => ({
158
+ id,
159
+ props,
160
+ type: "divider",
161
+ });
162
+
163
+ export const imageBlock = (
164
+ id: string,
165
+ props: TemplateImageBlockProps
166
+ ): TemplateBlock => ({
167
+ id,
168
+ props,
169
+ type: "image",
170
+ });
171
+
172
+ export const menuBlock = (
173
+ id: string,
174
+ links: TemplateMenuLink[],
175
+ props: Omit<TemplateMenuBlockProps, "links"> = {}
176
+ ): TemplateBlock => ({
177
+ id,
178
+ props: { ...props, links },
179
+ type: "menu",
180
+ });
181
+
182
+ export const socialBlock = (
183
+ id: string,
184
+ links: TemplateSocialLink[],
185
+ props: Omit<TemplateSocialBlockProps, "links"> = {}
186
+ ): TemplateBlock => ({
187
+ id,
188
+ props: { ...props, links },
189
+ type: "social",
190
+ });
191
+
192
+ export const videoBlock = (
193
+ id: string,
194
+ props: TemplateVideoBlockProps
195
+ ): TemplateBlock => ({
196
+ id,
197
+ props,
198
+ type: "video",
199
+ });
200
+
201
+ export const col = (
202
+ id: string,
203
+ width: number,
204
+ blocks: TemplateBlock[],
205
+ props: TemplateColumnProps = {}
206
+ ): TemplateColumn => ({
207
+ blocks,
208
+ id,
209
+ props,
210
+ width,
211
+ });
212
+
213
+ export const row = (
214
+ id: string,
215
+ columns: TemplateColumn[],
216
+ props: TemplateRowProps = {}
217
+ ): TemplateRow => ({
218
+ columns,
219
+ id,
220
+ props,
221
+ });
222
+
223
+ export const singleColRow = (
224
+ id: string,
225
+ columnId: string,
226
+ blocks: TemplateBlock[],
227
+ rowProps: TemplateRowProps = {},
228
+ columnProps: TemplateColumnProps = {}
229
+ ): TemplateRow => row(id, [col(columnId, 100, blocks, columnProps)], rowProps);
230
+
231
+ export const emailDoc = (
232
+ settings: TemplateEmailSettings,
233
+ rows: TemplateRow[]
234
+ ): TemplateDocument => ({
235
+ kind: "blocks",
236
+ rows,
237
+ settings,
238
+ version: 4,
239
+ });
240
+
241
+ export const defineSavedRow = (
242
+ meta: Omit<TemplateSavedRow, "row" | "version">,
243
+ build: () => TemplateRow
244
+ ): TemplateSavedRow => ({
245
+ ...meta,
246
+ row: build(),
247
+ version: 4,
248
+ });
249
+
250
+ export const defineStarterEmail = (
251
+ meta: Omit<TemplateStarterEmail, "email">,
252
+ build: () => TemplateDocument
253
+ ): TemplateStarterEmail => ({
254
+ ...meta,
255
+ email: build(),
256
+ });
@@ -0,0 +1,69 @@
1
+ import type {
2
+ CategoryInfo,
3
+ SavedRowCategory,
4
+ StarterEmailCategory,
5
+ } from "./types.js";
6
+
7
+ /** Category metadata for Starter emails, in display order. */
8
+ export const STARTER_EMAIL_CATEGORIES: readonly CategoryInfo<StarterEmailCategory>[] =
9
+ [
10
+ {
11
+ description:
12
+ "Welcome flows, day-three product tips, and trial-ending reminders.",
13
+ id: "onboarding",
14
+ label: "Onboarding",
15
+ },
16
+ {
17
+ description:
18
+ "Feature launches, monthly release notes, and video walkthroughs.",
19
+ id: "product",
20
+ label: "Product",
21
+ },
22
+ {
23
+ description:
24
+ "Founder letters, newsletters, weekly digests, and company updates.",
25
+ id: "editorial",
26
+ label: "Editorial",
27
+ },
28
+ {
29
+ description: "High-clarity receipts and account security messages.",
30
+ id: "transactional",
31
+ label: "Transactional",
32
+ },
33
+ {
34
+ description:
35
+ "Event invitations, win-back notes, seasonal offers, and surveys.",
36
+ id: "engagement",
37
+ label: "Engagement",
38
+ },
39
+ ];
40
+
41
+ /** Category metadata for Saved Rows, in display order. */
42
+ export const SAVED_ROW_CATEGORIES: readonly CategoryInfo<SavedRowCategory>[] = [
43
+ {
44
+ description: "Minimal brand wordmarks and navigation bars.",
45
+ id: "header",
46
+ label: "Headers",
47
+ },
48
+ {
49
+ description: "Centered and split-column opening sections.",
50
+ id: "hero",
51
+ label: "Heroes",
52
+ },
53
+ {
54
+ description:
55
+ "Feature grids, metrics, quotes, pricing cards, video, and sign-offs.",
56
+ id: "content",
57
+ label: "Content",
58
+ },
59
+ {
60
+ description: "High-contrast dark bands and subtle tinted action cards.",
61
+ id: "cta",
62
+ label: "Calls to action",
63
+ },
64
+ {
65
+ description: "Social icon bars and light or dark legal footers.",
66
+ id: "footer",
67
+ label: "Footers & social",
68
+ },
69
+ ];
package/src/index.ts ADDED
@@ -0,0 +1,89 @@
1
+ export {
2
+ SAVED_ROW_CATEGORIES,
3
+ STARTER_EMAIL_CATEGORIES,
4
+ } from "./categories.js";
5
+ export { TEMPLATE_MERGE_TAGS } from "./merge-tags.js";
6
+ export {
7
+ featureGridThreeCol,
8
+ featureGridTwoCol,
9
+ founderSignOff,
10
+ pricingHighlight,
11
+ statStrip,
12
+ testimonialQuote,
13
+ videoCard,
14
+ } from "./rows/content.js";
15
+ export { ctaBannerDark, ctaBannerSoft } from "./rows/cta.js";
16
+ export { footerDark, footerLight, socialBar } from "./rows/footers.js";
17
+ export { headerMinimal, headerWithNav } from "./rows/headers.js";
18
+ export { heroCentered, heroSplit } from "./rows/heroes.js";
19
+ export { SAVED_ROWS } from "./rows/index.js";
20
+ export {
21
+ companyAnnouncement,
22
+ founderLetter,
23
+ newsletter,
24
+ weeklyDigest,
25
+ } from "./starters/editorial.js";
26
+ export {
27
+ eventInvite,
28
+ feedbackRequest,
29
+ promoOffer,
30
+ reengagement,
31
+ } from "./starters/engagement.js";
32
+ export { STARTER_EMAILS } from "./starters/index.js";
33
+ export {
34
+ onboardingTip,
35
+ saasWelcome,
36
+ trialEnding,
37
+ } from "./starters/onboarding.js";
38
+ export {
39
+ changelog,
40
+ productLaunch,
41
+ videoSpotlight,
42
+ } from "./starters/product.js";
43
+ export { passwordReset, receipt } from "./starters/transactional.js";
44
+ export type {
45
+ CategoryInfo,
46
+ SavedRowCategory,
47
+ StarterEmailCategory,
48
+ TemplateAlign,
49
+ TemplateBlock,
50
+ TemplateBorderProps,
51
+ TemplateBorderStyle,
52
+ TemplateBoxProps,
53
+ TemplateButtonBlockProps,
54
+ TemplateColumn,
55
+ TemplateColumnProps,
56
+ TemplateDividerBlockProps,
57
+ TemplateDocument,
58
+ TemplateEmailSettings,
59
+ TemplateEmailStyle,
60
+ TemplateHeadingBlockProps,
61
+ TemplateImageBlockProps,
62
+ TemplateMenuBlockProps,
63
+ TemplateMenuLink,
64
+ TemplateMergeTag,
65
+ TemplatePaddingProps,
66
+ TemplateRichTextDocument,
67
+ TemplateRichTextHardBreak,
68
+ TemplateRichTextHeadingDocument,
69
+ TemplateRichTextInline,
70
+ TemplateRichTextList,
71
+ TemplateRichTextListItem,
72
+ TemplateRichTextMark,
73
+ TemplateRichTextMergeTag,
74
+ TemplateRichTextParagraph,
75
+ TemplateRichTextText,
76
+ TemplateRow,
77
+ TemplateRowProps,
78
+ TemplateSavedRow,
79
+ TemplateShowOn,
80
+ TemplateSocialBlockProps,
81
+ TemplateSocialLink,
82
+ TemplateSocialNetwork,
83
+ TemplateSpacerBlockProps,
84
+ TemplateStarterEmail,
85
+ TemplateTextBlockProps,
86
+ TemplateVerticalAlign,
87
+ TemplateVideoBlockProps,
88
+ TemplateWebFont,
89
+ } from "./types.js";
@@ -0,0 +1,126 @@
1
+ import type { TemplateMergeTag } from "./types.js";
2
+
3
+ /**
4
+ * Shared Merge Tags used across the Starter emails and Saved Rows in
5
+ * `@mailquilt/templates`. Pass directly to `<mail-quilt>`'s `mergeTags`
6
+ * property or `@mailquilt/renderer`'s `checkEmail()`.
7
+ */
8
+ export const TEMPLATE_MERGE_TAGS: readonly TemplateMergeTag[] = [
9
+ { label: "First name", name: "first_name", sample: "Maya" },
10
+ { label: "Company name", name: "company_name", sample: "Northstar" },
11
+ {
12
+ label: "Company address",
13
+ name: "company_address",
14
+ sample: "548 Market Street, San Francisco, CA 94104",
15
+ },
16
+ { label: "Sender name", name: "sender_name", sample: "Elena Rostova" },
17
+ {
18
+ label: "Sender role",
19
+ name: "sender_role",
20
+ sample: "Co-founder, Northstar",
21
+ },
22
+ {
23
+ label: "Website URL",
24
+ name: "website_url",
25
+ sample: "https://northstar.example",
26
+ },
27
+ {
28
+ label: "App URL",
29
+ name: "app_url",
30
+ sample: "https://app.northstar.example",
31
+ },
32
+ {
33
+ label: "Primary CTA URL",
34
+ name: "cta_url",
35
+ sample: "https://northstar.example/explore",
36
+ },
37
+ {
38
+ label: "Help center URL",
39
+ name: "help_url",
40
+ sample: "https://northstar.example/help",
41
+ },
42
+ {
43
+ label: "Support email",
44
+ name: "support_email",
45
+ sample: "support@northstar.example",
46
+ },
47
+ {
48
+ label: "Preferences URL",
49
+ name: "preferences_url",
50
+ sample: "https://northstar.example/preferences",
51
+ },
52
+ {
53
+ label: "Unsubscribe URL",
54
+ name: "unsubscribe_url",
55
+ sample: "https://northstar.example/unsubscribe",
56
+ unsubscribe: true,
57
+ },
58
+ {
59
+ label: "Release notes URL",
60
+ name: "changelog_url",
61
+ sample: "https://northstar.example/changelog",
62
+ },
63
+ {
64
+ label: "Status page URL",
65
+ name: "status_url",
66
+ sample: "https://status.northstar.example",
67
+ },
68
+ { label: "Plan name", name: "plan_name", sample: "Team Pro" },
69
+ { label: "Invoice number", name: "invoice_number", sample: "INV-2026-0418" },
70
+ { label: "Invoice date", name: "invoice_date", sample: "April 12, 2026" },
71
+ { label: "Amount paid", name: "amount_paid", sample: "$49.00" },
72
+ {
73
+ label: "Payment method",
74
+ name: "payment_method",
75
+ sample: "Visa ending in 4242",
76
+ },
77
+ {
78
+ label: "Invoice URL",
79
+ name: "invoice_url",
80
+ sample: "https://app.northstar.example/billing/invoices/INV-2026-0418",
81
+ },
82
+ {
83
+ label: "Password reset URL",
84
+ name: "reset_url",
85
+ sample: "https://app.northstar.example/auth/reset",
86
+ },
87
+ { label: "Link expiry (minutes)", name: "expiry_minutes", sample: "30" },
88
+ { label: "Trial days remaining", name: "trial_days_left", sample: "3" },
89
+ {
90
+ label: "Upgrade URL",
91
+ name: "upgrade_url",
92
+ sample: "https://app.northstar.example/billing/upgrade",
93
+ },
94
+ {
95
+ label: "Event date",
96
+ name: "event_date",
97
+ sample: "Thursday, May 14 at 11:00 AM PT",
98
+ },
99
+ {
100
+ label: "Registration URL",
101
+ name: "rsvp_url",
102
+ sample: "https://northstar.example/events/register",
103
+ },
104
+ { label: "Offer code", name: "offer_code", sample: "SPRING25" },
105
+ { label: "Offer end date", name: "offer_expires", sample: "May 31, 2026" },
106
+ {
107
+ label: "Survey URL",
108
+ name: "survey_url",
109
+ sample: "https://northstar.example/feedback",
110
+ },
111
+ {
112
+ label: "Video URL",
113
+ name: "video_url",
114
+ sample: "https://northstar.example/watch/workspace-walkthrough",
115
+ },
116
+ {
117
+ label: "Video thumbnail URL",
118
+ name: "video_thumbnail_url",
119
+ sample: "https://northstar.example/media/walkthrough-thumb.jpg",
120
+ },
121
+ {
122
+ label: "Hero image URL",
123
+ name: "hero_image_url",
124
+ sample: "https://northstar.example/media/hero-workspace.jpg",
125
+ },
126
+ ];