@marlinjai/email-editor-core 0.3.0 → 0.4.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/dist/index.mjs CHANGED
@@ -1,16 +1,10 @@
1
1
  import {
2
2
  AccordionBlockSchema,
3
- AccordionItemModel,
4
3
  BackgroundGradientSchema,
5
- BlockModel,
6
4
  BlockSchema,
7
- BlockType,
8
5
  ButtonBlockSchema,
9
- COLUMN_DEFAULTS,
10
- CONTAINER_BLOCK_TYPES,
11
6
  CURRENT_TEMPLATE_VERSION,
12
7
  CarouselBlockSchema,
13
- CarouselImageModel,
14
8
  ColumnSchema,
15
9
  CustomFontSchema,
16
10
  DividerBlockSchema,
@@ -23,42 +17,61 @@ import {
23
17
  HeaderBlockSchema,
24
18
  HeroBlockSchema,
25
19
  ImageBlockSchema,
26
- LEAF_BLOCK_TYPES,
27
20
  MjmlHeadSchema,
28
21
  NavbarBlockSchema,
29
- NavbarLinkModel,
30
22
  RawBlockSchema,
31
- SECTION_DEFAULTS,
32
23
  SUPPORTED_TEMPLATE_VERSIONS,
33
24
  SectionSchema,
34
25
  SectionSchemaV1_0,
35
26
  SocialBlockSchema,
36
- SocialLinkModel,
37
27
  SpacerBlockSchema,
38
- SpacingModel,
39
28
  SpacingSchema,
40
29
  TableBlockSchema,
41
30
  TemplateMetadataSchema,
42
31
  TemplateMigrationError,
43
32
  TextBlockSchema,
44
33
  TopLevelItemSchema,
45
- WRAPPER_DEFAULTS,
46
34
  WrapperSchema,
35
+ isTemplateMigrationError,
36
+ migrateTemplate,
37
+ migrateV1_0ToV1_1,
38
+ validateTemplate,
39
+ withTemplateId
40
+ } from "./chunk-NQPMHQ5G.mjs";
41
+ import {
42
+ AccordionItemModel,
43
+ BlockModel,
44
+ BlockType,
45
+ COLUMN_DEFAULTS,
46
+ CONTAINER_BLOCK_TYPES,
47
+ CarouselImageModel,
48
+ DEFAULT_MJML_ATTRIBUTES,
49
+ EDITOR_DATA_ATTRIBUTE,
50
+ EDITOR_MARKER,
51
+ LEAF_BLOCK_TYPES,
52
+ MjmlBuilder,
53
+ NavbarLinkModel,
54
+ SECTION_DEFAULTS,
55
+ SocialLinkModel,
56
+ SpacingModel,
57
+ WRAPPER_DEFAULTS,
58
+ addPx,
47
59
  allSections,
60
+ base64Utf8,
48
61
  buildGradientCSS,
49
62
  dropFilled,
63
+ encodeEditorData,
50
64
  fillColumnWidths,
51
65
  fillDefaults,
52
66
  isLeafBlockType,
53
- isTemplateMigrationError,
54
67
  isWrapper,
55
- migrateTemplate,
56
- migrateV1_0ToV1_1,
68
+ mjmlOptions,
57
69
  paddingIn,
58
70
  paddingOut,
59
- validateTemplate,
60
- withTemplateId
61
- } from "./chunk-2ZL7A2I6.mjs";
71
+ paddingWithGap,
72
+ stripEditorMarkup,
73
+ textInlineStyles
74
+ } from "./chunk-OOCYGZMB.mjs";
62
75
 
63
76
  // src/registry/BlockRegistry.ts
64
77
  var BlockRegistryImpl = class {
@@ -1593,8 +1606,7 @@ var EditorUIStore = types6.model("EditorUI", {
1593
1606
  previewDevice: types6.optional(
1594
1607
  types6.enumeration(["desktop", "mobile"]),
1595
1608
  "desktop"
1596
- ),
1597
- zoomLevel: types6.optional(types6.number, 1)
1609
+ )
1598
1610
  }).volatile(() => ({
1599
1611
  // === Transient State (not persisted) ===
1600
1612
  hoverBlockId: void 0,
@@ -1851,30 +1863,6 @@ var EditorUIStore = types6.model("EditorUI", {
1851
1863
  */
1852
1864
  togglePreviewDevice() {
1853
1865
  self.previewDevice = self.previewDevice === "desktop" ? "mobile" : "desktop";
1854
- },
1855
- /**
1856
- * Set zoom level
1857
- */
1858
- setZoomLevel(zoom) {
1859
- self.zoomLevel = Math.max(0.25, Math.min(2, zoom));
1860
- },
1861
- /**
1862
- * Zoom in
1863
- */
1864
- zoomIn() {
1865
- self.zoomLevel = Math.min(2, self.zoomLevel + 0.1);
1866
- },
1867
- /**
1868
- * Zoom out
1869
- */
1870
- zoomOut() {
1871
- self.zoomLevel = Math.max(0.25, self.zoomLevel - 0.1);
1872
- },
1873
- /**
1874
- * Reset zoom to 100%
1875
- */
1876
- resetZoom() {
1877
- self.zoomLevel = 1;
1878
1866
  }
1879
1867
  })).views((self) => ({
1880
1868
  /**
@@ -1965,12 +1953,6 @@ var EditorUIStore = types6.model("EditorUI", {
1965
1953
  */
1966
1954
  get isDesktopPreview() {
1967
1955
  return self.previewDevice === "desktop";
1968
- },
1969
- /**
1970
- * Get zoom percentage
1971
- */
1972
- get zoomPercentage() {
1973
- return Math.round(self.zoomLevel * 100);
1974
1956
  }
1975
1957
  }));
1976
1958
 
@@ -2220,8 +2202,11 @@ export {
2220
2202
  ColumnModel,
2221
2203
  ColumnSchema,
2222
2204
  CustomFontSchema,
2205
+ DEFAULT_MJML_ATTRIBUTES,
2223
2206
  DEFAULT_ON_CHANGE_DEBOUNCE_MS,
2224
2207
  DividerBlockSchema,
2208
+ EDITOR_DATA_ATTRIBUTE,
2209
+ EDITOR_MARKER,
2225
2210
  EditorUIStore,
2226
2211
  EmailTemplateSchema,
2227
2212
  EmailTemplateSchemaV1_0,
@@ -2236,6 +2221,7 @@ export {
2236
2221
  ImageBlockSchema,
2237
2222
  LEAF_BLOCK_TYPES,
2238
2223
  MJML_WRAPPER_DEFAULT_PADDING,
2224
+ MjmlBuilder,
2239
2225
  MjmlHeadSchema,
2240
2226
  NavbarBlockSchema,
2241
2227
  NavbarLinkModel,
@@ -2263,7 +2249,9 @@ export {
2263
2249
  TopLevelItemSchema,
2264
2250
  WrapperModel,
2265
2251
  WrapperSchema,
2252
+ addPx,
2266
2253
  allSections,
2254
+ base64Utf8,
2267
2255
  buildGradientCSS,
2268
2256
  cloneSectionSnapshot,
2269
2257
  createBlockRegistry,
@@ -2278,12 +2266,17 @@ export {
2278
2266
  createTemplate,
2279
2267
  createTemplateWithDefaultSection,
2280
2268
  createWrapper,
2269
+ encodeEditorData,
2281
2270
  isLeafBlockType,
2282
2271
  isTemplateMigrationError,
2283
2272
  isWrapper,
2284
2273
  isWrapperInstance,
2285
2274
  migrateTemplate,
2286
2275
  migrateV1_0ToV1_1,
2276
+ mjmlOptions,
2277
+ paddingWithGap,
2278
+ stripEditorMarkup,
2279
+ textInlineStyles,
2287
2280
  validateTemplate,
2288
2281
  withTemplateId
2289
2282
  };
package/dist/server.d.mts CHANGED
@@ -1,175 +1,17 @@
1
- import { E as EmailTemplate, y as CompileResult, a4 as TemplateInstance } from './TemplateModel-v__r5Nvi.mjs';
1
+ import { M as MjmlBuilder, E as EmailTemplate, C as CompileOptions, B as BuildOptions, a as CompileResult } from './MjmlBuilder-DsiOyhiL.mjs';
2
+ export { D as DEFAULT_MJML_ATTRIBUTES, n as EDITOR_DATA_ATTRIBUTE, b as EDITOR_MARKER, O as addPx, Q as base64Utf8, V as encodeEditorData, m as mjmlOptions, Y as paddingWithGap, s as stripEditorMarkup } from './MjmlBuilder-DsiOyhiL.mjs';
3
+ import { t as TemplateInstance } from './TemplateModel-PcCoyBdo.mjs';
2
4
  import 'mobx-state-tree';
3
5
 
4
- /** The `<mj-attributes>` a document gets unless it brings its own (`metadata.mjmlHead.attributes`). */
5
- declare const DEFAULT_MJML_ATTRIBUTES = "\n <mj-all font-family=\"Georgia, serif\" />\n <mj-text font-size=\"14px\" line-height=\"1.6\" />\n ";
6
- /** Marks the editor's own raw markup so the MJML import can read the block back exactly. */
7
- declare const EDITOR_DATA_ATTRIBUTE: {
8
- readonly social: "data-ee-social";
9
- readonly subColumns: "data-ee-subcols";
10
- };
11
- /** A block's (or sub-columns') JSON, base64-encoded, for an {@link EDITOR_DATA_ATTRIBUTE}. */
12
- declare function encodeEditorData(value: unknown): string;
13
- /** Options for one {@link MJMLCompiler.compile} call. */
14
- interface CompileOptions {
15
- /**
16
- * MJML adds a Google Fonts `<link>` and `@import` on its own whenever a font
17
- * family it knows (Open Sans, Droid Sans, Lato, Roboto, Ubuntu) appears in
18
- * the document. `false` leaves them out, so the font falls back to the rest
19
- * of its stack and the mail loads nothing from Google. Fonts the document
20
- * declares itself (`metadata.fonts`) are always emitted. Default `true`.
21
- */
22
- webFonts?: boolean;
23
- }
24
6
  /**
25
7
  * MJML Compiler class
26
8
  * Converts EmailTemplate to MJML markup and compiles to HTML
27
9
  */
28
- declare class MJMLCompiler {
29
- /**
30
- * Set true while emitting a column with sub-columns. Causes generateHead
31
- * to inject the responsive media query exactly once per template.
32
- */
33
- private needsSubColumnStyles;
10
+ declare class MJMLCompiler extends MjmlBuilder {
34
11
  /**
35
12
  * Compile email template to MJML and HTML
36
13
  */
37
- compile(template: EmailTemplate, options?: CompileOptions): CompileResult;
38
- /**
39
- * The MJML markup for a document, without compiling it to HTML.
40
- */
41
- toMJML(template: EmailTemplate): string;
42
- /**
43
- * Convert template to MJML markup
44
- */
45
- private templateToMJML;
46
- /**
47
- * Generate MJML head section with all head components
48
- * Supports: mj-title, mj-preview, mj-font, mj-breakpoint, mj-style
49
- */
50
- private generateHead;
51
- /**
52
- * Collect background-image CSS rules for all wrappers, sections and columns that have gradients.
53
- * Returns a string of CSS rules to inject as a single mj-style block.
54
- */
55
- private collectGradientStyles;
56
- /**
57
- * Convert a wrapper to an `<mj-wrapper>` around its sections. The wrapper's
58
- * attributes are MJML's own for `mj-wrapper`; the sections inside follow
59
- * MJML's rules there (a full-width section inside a full-width wrapper
60
- * renders at standard width, which the inspector explains).
61
- */
62
- private wrapperToMJML;
63
- /** Background attributes shared by sections and wrappers: a gradient (with its Outlook fallback colour), or colour and image. */
64
- private pushBackground;
65
- /**
66
- * Convert section to MJML
67
- * Supports background images, full-width, and mj-group for non-stacking columns
68
- */
69
- private sectionToMJML;
70
- /**
71
- * Convert column to MJML
72
- */
73
- private columnToMJML;
74
- /**
75
- * Emit a group column as an mj-column wrapping a hand-built nested
76
- * table inside an mj-raw island. The parent mj-section structure
77
- * stays standard MJML; only the nested area escapes MJML's parser.
78
- *
79
- * The responsive media query (table.ee-sub-cols td.ee-sub-col) is
80
- * injected once at document head via generateHead when the
81
- * needsSubColumnStyles flag is set.
82
- */
83
- private subColumnsToMJML;
84
- /**
85
- * Convert block to MJML based on type
86
- */
87
- private blockToMJML;
88
- /**
89
- * Convert text block to MJML
90
- *
91
- * Note: MJML applies styles to the container <td>, but TipTap content
92
- * (wrapped in <p> tags) doesn't inherit these styles. We solve this by
93
- * wrapping the content in a <div> with explicit inline styles.
94
- */
95
- private textBlockToMJML;
96
- /**
97
- * Convert image block to MJML
98
- */
99
- private imageBlockToMJML;
100
- /**
101
- * Convert button block to MJML
102
- */
103
- private buttonBlockToMJML;
104
- /**
105
- * Convert divider block to MJML
106
- */
107
- private dividerBlockToMJML;
108
- /**
109
- * Convert spacer block to MJML
110
- */
111
- private spacerBlockToMJML;
112
- /**
113
- * Platform brand colors for social icons
114
- */
115
- private readonly SOCIAL_COLORS;
116
- /**
117
- * Get white SVG icon as data URI for a platform
118
- * Uses clean, minimal SVGs optimized for email
119
- */
120
- private getSocialIconDataUri;
121
- /**
122
- * Convert social block to MJML using raw HTML table for reliable horizontal layout
123
- * Uses styled anchor tags with background colors for full width control
124
- */
125
- private socialBlockToMJML;
126
- /**
127
- * Convert hero block to MJML
128
- */
129
- private heroBlockToMJML;
130
- /**
131
- * Convert accordion block to MJML
132
- */
133
- private accordionBlockToMJML;
134
- /**
135
- * Convert raw HTML block to MJML
136
- */
137
- private rawBlockToMJML;
138
- /**
139
- * Convert navbar block to MJML
140
- */
141
- private navbarBlockToMJML;
142
- /**
143
- * Convert carousel block to MJML
144
- */
145
- private carouselBlockToMJML;
146
- /**
147
- * Convert table block to MJML
148
- */
149
- private tableBlockToMJML;
150
- /**
151
- * Generate the locked header block.
152
- *
153
- * It used to render one client's company name and a logo from an image host;
154
- * both are gone. What is left is a placeholder image slot. Keep this in step
155
- * with `headerBlockDefinition` in `packages/blocks/src/branded/index.ts`:
156
- * which of the two runs depends on how the registry is configured.
157
- *
158
- * The placeholder is a `data:` URI rather than an address on an image host,
159
- * so a workspace whose `asset_policy` is `service_only` can still send a mail
160
- * that contains this block.
161
- */
162
- private headerBlockToMJML;
163
- /**
164
- * Generate the locked footer block: the unsubscribe link and nothing else.
165
- *
166
- * It used to carry a copyright line naming one client's company. A locked
167
- * block carries no props, so whoever sends the mail cannot correct a name
168
- * that is not theirs; the line is gone rather than replaced with a fake one.
169
- * Keep this in step with `footerBlockDefinition` in
170
- * `packages/blocks/src/branded/index.ts`.
171
- */
172
- private footerBlockToMJML;
14
+ compile(template: EmailTemplate, options?: CompileOptions & BuildOptions): Promise<CompileResult>;
173
15
  }
174
16
  /**
175
17
  * Create a new MJML compiler instance
@@ -223,7 +65,7 @@ declare class MJMLExporter {
223
65
  /**
224
66
  * Export template to MJML + HTML
225
67
  */
226
- export(template: TemplateInstance): ExportResult;
68
+ export(template: TemplateInstance): Promise<ExportResult>;
227
69
  /**
228
70
  * Export only MJML (without HTML compilation)
229
71
  */
@@ -236,7 +78,7 @@ declare function createMJMLExporter(options?: ExportOptions): MJMLExporter;
236
78
  /**
237
79
  * Quick export function for simple use cases
238
80
  */
239
- declare function exportTemplate(template: TemplateInstance, options?: ExportOptions): ExportResult;
81
+ declare function exportTemplate(template: TemplateInstance, options?: ExportOptions): Promise<ExportResult>;
240
82
 
241
83
  /** The largest MJML source `importMjml` reads, in UTF-8 bytes. */
242
84
  declare const MAX_MJML_BYTES: number;
@@ -336,6 +178,6 @@ declare function isMjmlImportError(error: unknown): error is MjmlImportError;
336
178
  * and every such change is in `warnings`. The document has passed
337
179
  * `migrateTemplate`. Server only: it compiles fallbacks with mjml.
338
180
  */
339
- declare function importMjml(source: string): MjmlImportResult;
181
+ declare function importMjml(source: string): Promise<MjmlImportResult>;
340
182
 
341
- export { type CompileOptions, DEFAULT_MJML_ATTRIBUTES, EDITOR_DATA_ATTRIBUTE, type ExportOptions, type ExportResult, MAX_MJML_BYTES, MAX_MJML_DEPTH, MAX_MJML_ELEMENTS, MJMLCompiler, MJMLExporter, MjmlImportError, type MjmlImportErrorCode, type MjmlImportResult, type MjmlImportWarning, type MjmlImportWarningCode, type MjmlImportWarningSeverity, createMJMLCompiler, createMJMLExporter, encodeEditorData, exportTemplate, importMjml, isMjmlImportError };
183
+ export { BuildOptions, CompileOptions, type ExportOptions, type ExportResult, MAX_MJML_BYTES, MAX_MJML_DEPTH, MAX_MJML_ELEMENTS, MJMLCompiler, MJMLExporter, MjmlBuilder, MjmlImportError, type MjmlImportErrorCode, type MjmlImportResult, type MjmlImportWarning, type MjmlImportWarningCode, type MjmlImportWarningSeverity, createMJMLCompiler, createMJMLExporter, exportTemplate, importMjml, isMjmlImportError };
package/dist/server.d.ts CHANGED
@@ -1,175 +1,17 @@
1
- import { E as EmailTemplate, y as CompileResult, a4 as TemplateInstance } from './TemplateModel-v__r5Nvi.js';
1
+ import { M as MjmlBuilder, E as EmailTemplate, C as CompileOptions, B as BuildOptions, a as CompileResult } from './MjmlBuilder-DsiOyhiL.js';
2
+ export { D as DEFAULT_MJML_ATTRIBUTES, n as EDITOR_DATA_ATTRIBUTE, b as EDITOR_MARKER, O as addPx, Q as base64Utf8, V as encodeEditorData, m as mjmlOptions, Y as paddingWithGap, s as stripEditorMarkup } from './MjmlBuilder-DsiOyhiL.js';
3
+ import { t as TemplateInstance } from './TemplateModel-CmpvrapI.js';
2
4
  import 'mobx-state-tree';
3
5
 
4
- /** The `<mj-attributes>` a document gets unless it brings its own (`metadata.mjmlHead.attributes`). */
5
- declare const DEFAULT_MJML_ATTRIBUTES = "\n <mj-all font-family=\"Georgia, serif\" />\n <mj-text font-size=\"14px\" line-height=\"1.6\" />\n ";
6
- /** Marks the editor's own raw markup so the MJML import can read the block back exactly. */
7
- declare const EDITOR_DATA_ATTRIBUTE: {
8
- readonly social: "data-ee-social";
9
- readonly subColumns: "data-ee-subcols";
10
- };
11
- /** A block's (or sub-columns') JSON, base64-encoded, for an {@link EDITOR_DATA_ATTRIBUTE}. */
12
- declare function encodeEditorData(value: unknown): string;
13
- /** Options for one {@link MJMLCompiler.compile} call. */
14
- interface CompileOptions {
15
- /**
16
- * MJML adds a Google Fonts `<link>` and `@import` on its own whenever a font
17
- * family it knows (Open Sans, Droid Sans, Lato, Roboto, Ubuntu) appears in
18
- * the document. `false` leaves them out, so the font falls back to the rest
19
- * of its stack and the mail loads nothing from Google. Fonts the document
20
- * declares itself (`metadata.fonts`) are always emitted. Default `true`.
21
- */
22
- webFonts?: boolean;
23
- }
24
6
  /**
25
7
  * MJML Compiler class
26
8
  * Converts EmailTemplate to MJML markup and compiles to HTML
27
9
  */
28
- declare class MJMLCompiler {
29
- /**
30
- * Set true while emitting a column with sub-columns. Causes generateHead
31
- * to inject the responsive media query exactly once per template.
32
- */
33
- private needsSubColumnStyles;
10
+ declare class MJMLCompiler extends MjmlBuilder {
34
11
  /**
35
12
  * Compile email template to MJML and HTML
36
13
  */
37
- compile(template: EmailTemplate, options?: CompileOptions): CompileResult;
38
- /**
39
- * The MJML markup for a document, without compiling it to HTML.
40
- */
41
- toMJML(template: EmailTemplate): string;
42
- /**
43
- * Convert template to MJML markup
44
- */
45
- private templateToMJML;
46
- /**
47
- * Generate MJML head section with all head components
48
- * Supports: mj-title, mj-preview, mj-font, mj-breakpoint, mj-style
49
- */
50
- private generateHead;
51
- /**
52
- * Collect background-image CSS rules for all wrappers, sections and columns that have gradients.
53
- * Returns a string of CSS rules to inject as a single mj-style block.
54
- */
55
- private collectGradientStyles;
56
- /**
57
- * Convert a wrapper to an `<mj-wrapper>` around its sections. The wrapper's
58
- * attributes are MJML's own for `mj-wrapper`; the sections inside follow
59
- * MJML's rules there (a full-width section inside a full-width wrapper
60
- * renders at standard width, which the inspector explains).
61
- */
62
- private wrapperToMJML;
63
- /** Background attributes shared by sections and wrappers: a gradient (with its Outlook fallback colour), or colour and image. */
64
- private pushBackground;
65
- /**
66
- * Convert section to MJML
67
- * Supports background images, full-width, and mj-group for non-stacking columns
68
- */
69
- private sectionToMJML;
70
- /**
71
- * Convert column to MJML
72
- */
73
- private columnToMJML;
74
- /**
75
- * Emit a group column as an mj-column wrapping a hand-built nested
76
- * table inside an mj-raw island. The parent mj-section structure
77
- * stays standard MJML; only the nested area escapes MJML's parser.
78
- *
79
- * The responsive media query (table.ee-sub-cols td.ee-sub-col) is
80
- * injected once at document head via generateHead when the
81
- * needsSubColumnStyles flag is set.
82
- */
83
- private subColumnsToMJML;
84
- /**
85
- * Convert block to MJML based on type
86
- */
87
- private blockToMJML;
88
- /**
89
- * Convert text block to MJML
90
- *
91
- * Note: MJML applies styles to the container <td>, but TipTap content
92
- * (wrapped in <p> tags) doesn't inherit these styles. We solve this by
93
- * wrapping the content in a <div> with explicit inline styles.
94
- */
95
- private textBlockToMJML;
96
- /**
97
- * Convert image block to MJML
98
- */
99
- private imageBlockToMJML;
100
- /**
101
- * Convert button block to MJML
102
- */
103
- private buttonBlockToMJML;
104
- /**
105
- * Convert divider block to MJML
106
- */
107
- private dividerBlockToMJML;
108
- /**
109
- * Convert spacer block to MJML
110
- */
111
- private spacerBlockToMJML;
112
- /**
113
- * Platform brand colors for social icons
114
- */
115
- private readonly SOCIAL_COLORS;
116
- /**
117
- * Get white SVG icon as data URI for a platform
118
- * Uses clean, minimal SVGs optimized for email
119
- */
120
- private getSocialIconDataUri;
121
- /**
122
- * Convert social block to MJML using raw HTML table for reliable horizontal layout
123
- * Uses styled anchor tags with background colors for full width control
124
- */
125
- private socialBlockToMJML;
126
- /**
127
- * Convert hero block to MJML
128
- */
129
- private heroBlockToMJML;
130
- /**
131
- * Convert accordion block to MJML
132
- */
133
- private accordionBlockToMJML;
134
- /**
135
- * Convert raw HTML block to MJML
136
- */
137
- private rawBlockToMJML;
138
- /**
139
- * Convert navbar block to MJML
140
- */
141
- private navbarBlockToMJML;
142
- /**
143
- * Convert carousel block to MJML
144
- */
145
- private carouselBlockToMJML;
146
- /**
147
- * Convert table block to MJML
148
- */
149
- private tableBlockToMJML;
150
- /**
151
- * Generate the locked header block.
152
- *
153
- * It used to render one client's company name and a logo from an image host;
154
- * both are gone. What is left is a placeholder image slot. Keep this in step
155
- * with `headerBlockDefinition` in `packages/blocks/src/branded/index.ts`:
156
- * which of the two runs depends on how the registry is configured.
157
- *
158
- * The placeholder is a `data:` URI rather than an address on an image host,
159
- * so a workspace whose `asset_policy` is `service_only` can still send a mail
160
- * that contains this block.
161
- */
162
- private headerBlockToMJML;
163
- /**
164
- * Generate the locked footer block: the unsubscribe link and nothing else.
165
- *
166
- * It used to carry a copyright line naming one client's company. A locked
167
- * block carries no props, so whoever sends the mail cannot correct a name
168
- * that is not theirs; the line is gone rather than replaced with a fake one.
169
- * Keep this in step with `footerBlockDefinition` in
170
- * `packages/blocks/src/branded/index.ts`.
171
- */
172
- private footerBlockToMJML;
14
+ compile(template: EmailTemplate, options?: CompileOptions & BuildOptions): Promise<CompileResult>;
173
15
  }
174
16
  /**
175
17
  * Create a new MJML compiler instance
@@ -223,7 +65,7 @@ declare class MJMLExporter {
223
65
  /**
224
66
  * Export template to MJML + HTML
225
67
  */
226
- export(template: TemplateInstance): ExportResult;
68
+ export(template: TemplateInstance): Promise<ExportResult>;
227
69
  /**
228
70
  * Export only MJML (without HTML compilation)
229
71
  */
@@ -236,7 +78,7 @@ declare function createMJMLExporter(options?: ExportOptions): MJMLExporter;
236
78
  /**
237
79
  * Quick export function for simple use cases
238
80
  */
239
- declare function exportTemplate(template: TemplateInstance, options?: ExportOptions): ExportResult;
81
+ declare function exportTemplate(template: TemplateInstance, options?: ExportOptions): Promise<ExportResult>;
240
82
 
241
83
  /** The largest MJML source `importMjml` reads, in UTF-8 bytes. */
242
84
  declare const MAX_MJML_BYTES: number;
@@ -336,6 +178,6 @@ declare function isMjmlImportError(error: unknown): error is MjmlImportError;
336
178
  * and every such change is in `warnings`. The document has passed
337
179
  * `migrateTemplate`. Server only: it compiles fallbacks with mjml.
338
180
  */
339
- declare function importMjml(source: string): MjmlImportResult;
181
+ declare function importMjml(source: string): Promise<MjmlImportResult>;
340
182
 
341
- export { type CompileOptions, DEFAULT_MJML_ATTRIBUTES, EDITOR_DATA_ATTRIBUTE, type ExportOptions, type ExportResult, MAX_MJML_BYTES, MAX_MJML_DEPTH, MAX_MJML_ELEMENTS, MJMLCompiler, MJMLExporter, MjmlImportError, type MjmlImportErrorCode, type MjmlImportResult, type MjmlImportWarning, type MjmlImportWarningCode, type MjmlImportWarningSeverity, createMJMLCompiler, createMJMLExporter, encodeEditorData, exportTemplate, importMjml, isMjmlImportError };
183
+ export { BuildOptions, CompileOptions, type ExportOptions, type ExportResult, MAX_MJML_BYTES, MAX_MJML_DEPTH, MAX_MJML_ELEMENTS, MJMLCompiler, MJMLExporter, MjmlBuilder, MjmlImportError, type MjmlImportErrorCode, type MjmlImportResult, type MjmlImportWarning, type MjmlImportWarningCode, type MjmlImportWarningSeverity, createMJMLCompiler, createMJMLExporter, exportTemplate, importMjml, isMjmlImportError };