@marlinjai/email-editor-blocks 0.2.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,456 @@
1
+ import * as _marlinjai_email_editor_core from '@marlinjai/email-editor-core';
2
+ import { BlockDefinition, TextBlock, ImageBlock, ButtonBlock, DividerBlock, SpacerBlock, SocialBlock, HeroBlock, AccordionBlock, RawBlock, NavbarBlock, CarouselBlock, TableBlock, FooterBlock, HeaderBlock, PrebuiltTemplate } from '@marlinjai/email-editor-core';
3
+
4
+ /**
5
+ * How a host tells this package where its own placeholder images live.
6
+ *
7
+ * Every section and every block default ships with a `data:` URI placeholder,
8
+ * which renders in the editor's canvas and needs nothing behind it. A host that
9
+ * sends real mail wants something better, because Gmail and Outlook.com do not
10
+ * render `data:` images and because a workspace may refuse every address but
11
+ * its service's own. Giving the base here swaps them all for
12
+ * `<base>/p/<width>x<height>.png`.
13
+ */
14
+ type PlaceholderOptions = {
15
+ /** An origin with no trailing slash, e.g. `https://mail.example.com`. Absent keeps the `data:` URIs. */
16
+ placeholderBase?: string;
17
+ };
18
+ /**
19
+ * A deep copy of `value` with every placeholder address swapped for one on
20
+ * `base`. Anything that is not a placeholder is left exactly as it was, so this
21
+ * is safe to run over a whole section tree or a block's default props.
22
+ *
23
+ * Copied rather than edited in place because the built-in sections are module
24
+ * level constants shared by every editor on the page: two editors with
25
+ * different hosts must not fight over them.
26
+ */
27
+ declare function withHostedPlaceholders<T>(value: T, base: string | undefined): T;
28
+
29
+ /**
30
+ * Create a registry with all standard blocks pre-registered
31
+ */
32
+ declare function createStandardBlockRegistry(options?: PlaceholderOptions): _marlinjai_email_editor_core.BlockRegistryImpl;
33
+
34
+ /**
35
+ * Text block definition
36
+ * Uses TipTap for rich text editing
37
+ */
38
+ declare const textBlockDefinition: BlockDefinition<TextBlock>;
39
+
40
+ /**
41
+ * Image block definition
42
+ */
43
+ declare const imageBlockDefinition: BlockDefinition<ImageBlock>;
44
+
45
+ /**
46
+ * Button block definition
47
+ */
48
+ declare const buttonBlockDefinition: BlockDefinition<ButtonBlock>;
49
+
50
+ /**
51
+ * Divider block definition
52
+ */
53
+ declare const dividerBlockDefinition: BlockDefinition<DividerBlock>;
54
+
55
+ /**
56
+ * Spacer block definition
57
+ */
58
+ declare const spacerBlockDefinition: BlockDefinition<SpacerBlock>;
59
+
60
+ /**
61
+ * Platform brand colors for social icons (exported for UI use)
62
+ */
63
+ declare const SOCIAL_COLORS: Record<string, string>;
64
+ /**
65
+ * Social icons block definition
66
+ * Renders as buttons with icon images instead of mj-social for reliable sizing
67
+ */
68
+ declare const socialBlockDefinition: BlockDefinition<SocialBlock>;
69
+
70
+ /**
71
+ * Hero block definition
72
+ */
73
+ declare const heroBlockDefinition: BlockDefinition<HeroBlock>;
74
+
75
+ /**
76
+ * Accordion block definition
77
+ * Maps to MJML's <mj-accordion> component
78
+ */
79
+ declare const accordionBlockDefinition: BlockDefinition<AccordionBlock>;
80
+
81
+ /**
82
+ * Raw HTML block definition
83
+ * Maps to MJML's <mj-raw> component
84
+ */
85
+ declare const rawBlockDefinition: BlockDefinition<RawBlock>;
86
+
87
+ /**
88
+ * Navbar block definition
89
+ * Creates a responsive navigation menu with optional hamburger mode
90
+ */
91
+ declare const navbarBlockDefinition: BlockDefinition<NavbarBlock>;
92
+
93
+ /**
94
+ * Carousel block definition
95
+ * Creates an interactive image gallery with optional thumbnails
96
+ */
97
+ declare const carouselBlockDefinition: BlockDefinition<CarouselBlock>;
98
+
99
+ /**
100
+ * Table block definition
101
+ * Creates a data table for displaying structured information
102
+ */
103
+ declare const tableBlockDefinition: BlockDefinition<TableBlock>;
104
+
105
+ /**
106
+ * Locked header block
107
+ */
108
+ declare const headerBlockDefinition: BlockDefinition<HeaderBlock>;
109
+ /**
110
+ * Locked footer block
111
+ *
112
+ * The unsubscribe link and nothing else: a locked block cannot be corrected by
113
+ * whoever sends the mail, so it must not claim a copyright holder or a company
114
+ * name that is not theirs.
115
+ */
116
+ declare const footerBlockDefinition: BlockDefinition<FooterBlock>;
117
+
118
+ /**
119
+ * A neutral grey palette. It carries no brand: it is a starting point a host
120
+ * overrides with its own colours.
121
+ */
122
+ declare const PALETTE: {
123
+ readonly primary: "#374151";
124
+ readonly primaryDark: "#111827";
125
+ readonly primaryLight: "#9ca3af";
126
+ readonly bgMuted: "#f5f5f5";
127
+ readonly bgWhite: "#ffffff";
128
+ readonly bgLight: "#fafafa";
129
+ readonly textDark: "#111827";
130
+ readonly textBody: "#4b5563";
131
+ readonly textLight: "#9ca3af";
132
+ readonly textWhite: "#ffffff";
133
+ readonly border: "#e5e7eb";
134
+ readonly divider: "#d1d5db";
135
+ };
136
+ /**
137
+ * Typography styles built from fonts every mail client already has, so a
138
+ * section renders as intended without loading a webfont (which `service_only`
139
+ * would refuse anyway).
140
+ */
141
+ declare const TYPOGRAPHY: {
142
+ readonly h1: "font-family: Helvetica, Arial, sans-serif; font-weight: 700; font-size: 32px; line-height: 1.2;";
143
+ readonly h2: "font-family: Helvetica, Arial, sans-serif; font-weight: 700; font-size: 26px; line-height: 1.3;";
144
+ readonly h3: "font-family: Helvetica, Arial, sans-serif; font-weight: 600; font-size: 21px; line-height: 1.4;";
145
+ readonly h4: "font-family: Helvetica, Arial, sans-serif; font-weight: 600; font-size: 18px; line-height: 1.4;";
146
+ readonly body: "font-family: Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.6;";
147
+ readonly bodySmall: "font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.5;";
148
+ readonly caption: "font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 1.4;";
149
+ readonly signature: "font-family: Georgia, \"Times New Roman\", serif; font-style: italic; font-size: 22px;";
150
+ readonly label: "font-family: Helvetica, Arial, sans-serif; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;";
151
+ readonly price: "font-family: Georgia, \"Times New Roman\", serif; font-weight: 600;";
152
+ };
153
+ /**
154
+ * A grey rectangle of the given size as a `data:` URI, used wherever a section
155
+ * needs an image the host has not chosen yet.
156
+ *
157
+ * It is a `data:` URI rather than an address on an image host for two reasons:
158
+ * a workspace whose `asset_policy` is `service_only` refuses every remote
159
+ * address at compile, so a section built on one could be inserted but never
160
+ * sent; and a placeholder should not make a reader's mail client call a third
161
+ * party. The `viewBox` carries the intended aspect ratio, so a block that sets
162
+ * only a width still lays out as designed.
163
+ *
164
+ * Gmail and Outlook.com do not render `data:` URIs, so a placeholder left in a
165
+ * sent mail shows as an empty frame there rather than a grey box. That is the
166
+ * point: the alt text says it must be replaced.
167
+ */
168
+ declare function placeholderImage(width: number, height: number): string;
169
+ /**
170
+ * The size a placeholder from {@link placeholderImage} was made at, or null for
171
+ * anything else.
172
+ *
173
+ * The encoder and this decoder are a pair and live together on purpose: this is
174
+ * the one place that knows the format, so a host can swap every placeholder for
175
+ * one served from its own address without the 35 built-in sections having to be
176
+ * rebuilt as functions of that address. See {@link hostedPlaceholder}.
177
+ */
178
+ declare function placeholderSize(src: string): {
179
+ width: number;
180
+ height: number;
181
+ } | null;
182
+ /**
183
+ * The same placeholder as an address on `base`, the host's own origin, or the
184
+ * value unchanged when it is not a placeholder.
185
+ *
186
+ * Why a host would want this, and why the `data:` URI is still the default:
187
+ *
188
+ * - **Gmail and Outlook.com do not render `data:` images.** A placeholder that
189
+ * survived into a sent mail would be invisible there rather than obviously
190
+ * wrong, which is the worse of the two failures.
191
+ * - **A workspace may refuse every address but its service's own.** That is
192
+ * what Lumitra Mail's `service_only` asset policy does, and it is why the
193
+ * placeholder cannot simply point at an image host: the section would insert
194
+ * and the mail would never send.
195
+ *
196
+ * So the address has to come from the host, which is the only thing that knows
197
+ * it. A consumer of this package with no service behind it passes nothing and
198
+ * keeps the `data:` URI, which renders in the editor's own canvas, where it is
199
+ * the only thing that has to work.
200
+ *
201
+ * `base` is an origin with no trailing slash, e.g. `https://mail.example.com`.
202
+ */
203
+ declare function hostedPlaceholder(src: string, base: string | undefined): string;
204
+ /** The alt text every placeholder image carries, so a reader knows why it is empty. */
205
+ declare const PLACEHOLDER_ALT = "Placeholder image, replace with your own";
206
+ /**
207
+ * Placeholder copy for the built-in sections. Every line reads as something to
208
+ * replace rather than as finished text, and no line names anybody: there is no
209
+ * company, no person and no email address here.
210
+ */
211
+ declare const PLACEHOLDER: {
212
+ readonly companyName: "Your company";
213
+ readonly tagline: "Your tagline goes here";
214
+ readonly ownerName: "Your name";
215
+ readonly ownerTitle: "Your title";
216
+ readonly ownerContact: "Your email address";
217
+ readonly ctaBookSession: "Book now";
218
+ readonly ctaLearnMore: "Learn more";
219
+ readonly ctaReadMore: "Read more";
220
+ readonly ctaGetStarted: "Get started";
221
+ readonly ctaExplore: "Explore more";
222
+ readonly headlines: readonly ["Your headline here", "A second headline", "A third headline", "One, two, three.", "Your subject in a few words"];
223
+ readonly bodyText: {
224
+ readonly intro: "A short paragraph introducing this section. Replace it with your own text, and keep it to a couple of sentences so it stays readable on a phone.";
225
+ readonly destination: "A closing line that says what the reader gets out of it.";
226
+ readonly welcome: "Thank you for subscribing. Replace this paragraph with a welcome in your own words.";
227
+ };
228
+ readonly closing: {
229
+ readonly gratitude: "With kind regards,";
230
+ readonly signature: "Your name";
231
+ };
232
+ readonly footer: {
233
+ readonly unsubscribe: "If you no longer wish to receive these emails, you can";
234
+ readonly unsubscribeLink: "unsubscribe here";
235
+ readonly received: "You received this email because you subscribed to this newsletter.";
236
+ };
237
+ readonly logoUrl: string;
238
+ readonly website: "https://example.com";
239
+ };
240
+ /**
241
+ * Helper function to create styled heading HTML
242
+ */
243
+ declare function styledHeading(text: string, level?: 1 | 2 | 3 | 4): string;
244
+ /**
245
+ * Helper function to create styled body text HTML
246
+ */
247
+ declare function styledBody(text: string, centered?: boolean): string;
248
+ /**
249
+ * Helper function to create styled label HTML
250
+ */
251
+ declare function styledLabel(text: string): string;
252
+
253
+ /**
254
+ * Hero Main - Full-width with background image
255
+ * A full-width hero: a heading, one line of copy and a button.
256
+ */
257
+ declare const heroMainTemplate: PrebuiltTemplate;
258
+ /**
259
+ * Hero Newsletter Header - Centered logo + welcome
260
+ * Based on the newsletter header screenshot provided
261
+ */
262
+ declare const heroNewsletterTemplate: PrebuiltTemplate;
263
+ /**
264
+ * Hero Minimal - Clean with divider
265
+ */
266
+ declare const heroMinimalTemplate: PrebuiltTemplate;
267
+ /**
268
+ * Hero Split - Image and text side by side
269
+ */
270
+ declare const heroSplitTemplate: PrebuiltTemplate;
271
+ declare const heroTemplates: PrebuiltTemplate[];
272
+
273
+ /**
274
+ * Text + Image Right - Image on the right side
275
+ * Like "Hiking Sequoia" example in Mailjet
276
+ */
277
+ declare const textImageRightTemplate: PrebuiltTemplate;
278
+ /**
279
+ * Text + Image Left - Image on the left side
280
+ * Like "Trail to Machu Picchu" example in Mailjet
281
+ */
282
+ declare const textImageLeftTemplate: PrebuiltTemplate;
283
+ /**
284
+ * Section Title 1 - Simple centered headline with body
285
+ * Like "The Scottish Highlands" example
286
+ */
287
+ declare const sectionTitle1Template: PrebuiltTemplate;
288
+ /**
289
+ * Section Title 2 - With button
290
+ * Like "Scottish Highlands with Buy now" example
291
+ */
292
+ declare const sectionTitle2Template: PrebuiltTemplate;
293
+ /**
294
+ * Section Title 3 - Colored background
295
+ * Like red "Other Adventure Styles" example
296
+ */
297
+ declare const sectionTitle3Template: PrebuiltTemplate;
298
+ /**
299
+ * Quote Block - Testimonial or inspirational quote
300
+ */
301
+ declare const quoteBlockTemplate: PrebuiltTemplate;
302
+ /**
303
+ * Simple Divider Section
304
+ */
305
+ declare const dividerSectionTemplate: PrebuiltTemplate;
306
+ /**
307
+ * Spacer Section
308
+ */
309
+ declare const spacerSectionTemplate: PrebuiltTemplate;
310
+ declare const contentTemplates: PrebuiltTemplate[];
311
+
312
+ /**
313
+ * Features 2-Column - Two feature boxes side by side
314
+ * Like "A breath of fresh air / Unplug and unwind" example
315
+ */
316
+ declare const features2ColTemplate: PrebuiltTemplate;
317
+ /**
318
+ * Features 3-Column - Three feature boxes
319
+ * Like "Wild beauty / Fresh adventure / Natural wonder" example
320
+ */
321
+ declare const features3ColTemplate: PrebuiltTemplate;
322
+ /**
323
+ * Features 4-Column (2x2 Grid) - Four features in a grid
324
+ * Like "Open horizon / Rugged terrain / Coastal charm / Outdoor escape" example
325
+ */
326
+ declare const features4ColTemplate: PrebuiltTemplate;
327
+ /**
328
+ * Features 4-Column Row 2 (continuation of grid)
329
+ */
330
+ declare const features4ColRow2Template: PrebuiltTemplate;
331
+ /**
332
+ * Take Action / CTA Section
333
+ * Like "Organized Adventures: What are they?" example
334
+ */
335
+ declare const takeActionTemplate: PrebuiltTemplate;
336
+ declare const featureTemplates: PrebuiltTemplate[];
337
+
338
+ /**
339
+ * Event Simple - Basic event details
340
+ */
341
+ declare const eventSimpleTemplate: PrebuiltTemplate;
342
+ /**
343
+ * Event with Image - Event card with visual
344
+ * Like "Travel Talks Lecture" example
345
+ */
346
+ declare const eventImageTemplate: PrebuiltTemplate;
347
+ /**
348
+ * Coupon Discount - Discount offer with code
349
+ * Like "-50% THANKYOU50" example
350
+ */
351
+ declare const couponDiscountTemplate: PrebuiltTemplate;
352
+ /**
353
+ * Coupon Gift Card - Gift card style
354
+ * Like the "Gift card HBD2U" example
355
+ */
356
+ declare const couponGiftCardTemplate: PrebuiltTemplate;
357
+ /**
358
+ * Coupon Banner - Simple banner with code
359
+ * Like the "FIRESIDE40" red banner example
360
+ */
361
+ declare const couponBannerTemplate: PrebuiltTemplate;
362
+ /**
363
+ * Product Right - Service with image on right
364
+ * Like "Nitro Weekender Backpack" example
365
+ */
366
+ declare const productRightTemplate: PrebuiltTemplate;
367
+ /**
368
+ * Product Left - Service with image on left
369
+ */
370
+ declare const productLeftTemplate: PrebuiltTemplate;
371
+ /**
372
+ * Products 2-Column - Two services side by side
373
+ */
374
+ declare const products2ColTemplate: PrebuiltTemplate;
375
+ /**
376
+ * Products 3-Column - Three services in a row
377
+ */
378
+ declare const products3ColTemplate: PrebuiltTemplate;
379
+ declare const marketingTemplates: PrebuiltTemplate[];
380
+
381
+ /**
382
+ * Signature 1 - Simple name + title
383
+ * Like "John Doe, CEO of Falcon" example
384
+ */
385
+ declare const signature1Template: PrebuiltTemplate;
386
+ /**
387
+ * Signature 2 - Centered with signature image
388
+ * Like centered "John Doe" with cursive signature
389
+ */
390
+ declare const signature2Template: PrebuiltTemplate;
391
+ /**
392
+ * Signature 3 - With email and phone
393
+ * Like "Mary Johnson" with contact info
394
+ */
395
+ declare const signature3Template: PrebuiltTemplate;
396
+ /**
397
+ * Signature 4 - Full signature with closing
398
+ * A signature with a name, a title and a line of contact details
399
+ */
400
+ declare const signature4Template: PrebuiltTemplate;
401
+ /**
402
+ * Dual Buttons - Two side-by-side CTAs
403
+ * Like "Book tour right now / Save tour for later" example
404
+ */
405
+ declare const buttonsDualTemplate: PrebuiltTemplate;
406
+ /**
407
+ * App Download - App store badges
408
+ * Like the Apple/Google Play example
409
+ */
410
+ declare const appDownloadTemplate: PrebuiltTemplate;
411
+ /**
412
+ * Footer Standard - Newsletter footer with unsubscribe
413
+ * A footer with the sender's name, a divider and the unsubscribe line
414
+ */
415
+ declare const footerStandardTemplate: PrebuiltTemplate;
416
+ /**
417
+ * Footer with Social - Footer including social icons
418
+ */
419
+ declare const footerSocialTemplate: PrebuiltTemplate;
420
+ /**
421
+ * Footer Links - Footer with navigation links
422
+ */
423
+ declare const footerLinksTemplate: PrebuiltTemplate;
424
+ declare const utilityTemplates: PrebuiltTemplate[];
425
+
426
+ /**
427
+ * All pre-built templates organized by category
428
+ *
429
+ * Categories:
430
+ * - hero (4): Main, Newsletter, Minimal, Split
431
+ * - content (8): Text+Image Right/Left, Section Titles 1-3, Quote, Divider, Spacer
432
+ * - features (5): 2-col, 3-col, 4-col, 4-col row 2, Take Action
433
+ * - marketing (9): Events (2), Coupons (3), Products/Services (4)
434
+ * - utility (9): Signatures (4), Buttons, App Download, Footers (3)
435
+ *
436
+ * Total: 35 templates
437
+ */
438
+ declare const allPrebuiltTemplates: _marlinjai_email_editor_core.PrebuiltTemplate[];
439
+ /**
440
+ * Get templates by category
441
+ */
442
+ declare function getTemplatesByCategory(category: string): _marlinjai_email_editor_core.PrebuiltTemplate[];
443
+ /**
444
+ * Template categories with display names
445
+ */
446
+ declare const templateCategories: {
447
+ id: string;
448
+ name: string;
449
+ count: number;
450
+ }[];
451
+ /**
452
+ * Create a pre-built template registry with all built-in, brand-neutral sections
453
+ */
454
+ declare function createStandardPrebuiltRegistry(options?: PlaceholderOptions): _marlinjai_email_editor_core.PrebuiltTemplateRegistry;
455
+
456
+ export { PALETTE, PLACEHOLDER, PLACEHOLDER_ALT, type PlaceholderOptions, SOCIAL_COLORS, TYPOGRAPHY, accordionBlockDefinition, allPrebuiltTemplates, appDownloadTemplate, buttonBlockDefinition, buttonsDualTemplate, carouselBlockDefinition, contentTemplates, couponBannerTemplate, couponDiscountTemplate, couponGiftCardTemplate, createStandardPrebuiltRegistry as createPrebuiltRegistry, createStandardBlockRegistry, createStandardPrebuiltRegistry, dividerBlockDefinition, dividerSectionTemplate, eventImageTemplate, eventSimpleTemplate, featureTemplates, features2ColTemplate, features3ColTemplate, features4ColRow2Template, features4ColTemplate, footerBlockDefinition, footerLinksTemplate, footerSocialTemplate, footerStandardTemplate, getTemplatesByCategory, headerBlockDefinition, heroBlockDefinition, heroMainTemplate, heroMinimalTemplate, heroNewsletterTemplate, heroSplitTemplate, heroTemplates, hostedPlaceholder, imageBlockDefinition, marketingTemplates, navbarBlockDefinition, placeholderImage, placeholderSize, productLeftTemplate, productRightTemplate, products2ColTemplate, products3ColTemplate, quoteBlockTemplate, rawBlockDefinition, sectionTitle1Template, sectionTitle2Template, sectionTitle3Template, signature1Template, signature2Template, signature3Template, signature4Template, socialBlockDefinition, spacerBlockDefinition, spacerSectionTemplate, styledBody, styledHeading, styledLabel, tableBlockDefinition, takeActionTemplate, templateCategories, textBlockDefinition, textImageLeftTemplate, textImageRightTemplate, utilityTemplates, withHostedPlaceholders };