@parathantl/react-email-editor 0.1.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/LICENSE +21 -0
- package/README.md +267 -0
- package/dist/index.cjs +7354 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1616 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +515 -0
- package/dist/index.d.ts +515 -0
- package/dist/index.js +7290 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default, { ReactNode, ComponentType } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as _tiptap_core from '@tiptap/core';
|
|
5
|
+
import { Editor, Node } from '@tiptap/core';
|
|
6
|
+
import * as _tiptap_extension_underline from '@tiptap/extension-underline';
|
|
7
|
+
|
|
8
|
+
type BlockType = 'text' | 'button' | 'image' | 'divider' | 'spacer' | 'social' | 'html' | 'video' | 'heading' | 'countdown' | 'menu' | 'hero';
|
|
9
|
+
interface TextBlockProperties {
|
|
10
|
+
content: string;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
fontSize: string;
|
|
13
|
+
color: string;
|
|
14
|
+
lineHeight: string;
|
|
15
|
+
padding: string;
|
|
16
|
+
align: 'left' | 'center' | 'right' | 'justify';
|
|
17
|
+
fontWeight: string;
|
|
18
|
+
textTransform: string;
|
|
19
|
+
letterSpacing: string;
|
|
20
|
+
}
|
|
21
|
+
interface ButtonBlockProperties {
|
|
22
|
+
text: string;
|
|
23
|
+
href: string;
|
|
24
|
+
backgroundColor: string;
|
|
25
|
+
color: string;
|
|
26
|
+
fontFamily: string;
|
|
27
|
+
fontSize: string;
|
|
28
|
+
borderRadius: string;
|
|
29
|
+
padding: string;
|
|
30
|
+
innerPadding: string;
|
|
31
|
+
align: 'left' | 'center' | 'right';
|
|
32
|
+
width: string;
|
|
33
|
+
fontWeight: string;
|
|
34
|
+
textTransform: string;
|
|
35
|
+
letterSpacing: string;
|
|
36
|
+
}
|
|
37
|
+
interface ImageBlockProperties {
|
|
38
|
+
src: string;
|
|
39
|
+
alt: string;
|
|
40
|
+
href: string;
|
|
41
|
+
width: string;
|
|
42
|
+
height: string;
|
|
43
|
+
padding: string;
|
|
44
|
+
align: 'left' | 'center' | 'right';
|
|
45
|
+
fluidOnMobile: boolean;
|
|
46
|
+
}
|
|
47
|
+
interface DividerBlockProperties {
|
|
48
|
+
borderColor: string;
|
|
49
|
+
borderWidth: string;
|
|
50
|
+
borderStyle: 'solid' | 'dashed' | 'dotted';
|
|
51
|
+
padding: string;
|
|
52
|
+
width: string;
|
|
53
|
+
}
|
|
54
|
+
interface SpacerBlockProperties {
|
|
55
|
+
height: string;
|
|
56
|
+
}
|
|
57
|
+
interface SocialElement {
|
|
58
|
+
name: string;
|
|
59
|
+
href: string;
|
|
60
|
+
src?: string;
|
|
61
|
+
content?: string;
|
|
62
|
+
backgroundColor?: string;
|
|
63
|
+
color?: string;
|
|
64
|
+
}
|
|
65
|
+
interface SocialBlockProperties {
|
|
66
|
+
elements: SocialElement[];
|
|
67
|
+
mode: 'horizontal' | 'vertical';
|
|
68
|
+
align: 'left' | 'center' | 'right';
|
|
69
|
+
iconSize: string;
|
|
70
|
+
iconPadding: string;
|
|
71
|
+
padding: string;
|
|
72
|
+
fontSize: string;
|
|
73
|
+
color: string;
|
|
74
|
+
borderRadius: string;
|
|
75
|
+
}
|
|
76
|
+
interface HtmlBlockProperties {
|
|
77
|
+
content: string;
|
|
78
|
+
padding: string;
|
|
79
|
+
}
|
|
80
|
+
interface VideoBlockProperties {
|
|
81
|
+
src: string;
|
|
82
|
+
thumbnailUrl: string;
|
|
83
|
+
alt: string;
|
|
84
|
+
padding: string;
|
|
85
|
+
align: 'left' | 'center' | 'right';
|
|
86
|
+
}
|
|
87
|
+
interface HeadingBlockProperties {
|
|
88
|
+
content: string;
|
|
89
|
+
level: 'h1' | 'h2' | 'h3' | 'h4';
|
|
90
|
+
fontFamily: string;
|
|
91
|
+
fontSize: string;
|
|
92
|
+
color: string;
|
|
93
|
+
lineHeight: string;
|
|
94
|
+
fontWeight: string;
|
|
95
|
+
padding: string;
|
|
96
|
+
align: 'left' | 'center' | 'right' | 'justify';
|
|
97
|
+
textTransform: string;
|
|
98
|
+
letterSpacing: string;
|
|
99
|
+
}
|
|
100
|
+
interface CountdownBlockProperties {
|
|
101
|
+
targetDate: string;
|
|
102
|
+
label: string;
|
|
103
|
+
digitBackgroundColor: string;
|
|
104
|
+
digitColor: string;
|
|
105
|
+
labelColor: string;
|
|
106
|
+
fontSize: string;
|
|
107
|
+
padding: string;
|
|
108
|
+
align: 'left' | 'center' | 'right';
|
|
109
|
+
}
|
|
110
|
+
interface MenuItem {
|
|
111
|
+
text: string;
|
|
112
|
+
href: string;
|
|
113
|
+
}
|
|
114
|
+
interface MenuBlockProperties {
|
|
115
|
+
items: MenuItem[];
|
|
116
|
+
align: 'left' | 'center' | 'right';
|
|
117
|
+
fontFamily: string;
|
|
118
|
+
fontSize: string;
|
|
119
|
+
color: string;
|
|
120
|
+
padding: string;
|
|
121
|
+
hamburger: boolean;
|
|
122
|
+
iconColor: string;
|
|
123
|
+
}
|
|
124
|
+
interface HeroBlockProperties {
|
|
125
|
+
heading: string;
|
|
126
|
+
subtext: string;
|
|
127
|
+
buttonText: string;
|
|
128
|
+
buttonHref: string;
|
|
129
|
+
headingColor: string;
|
|
130
|
+
headingFontSize: string;
|
|
131
|
+
subtextColor: string;
|
|
132
|
+
subtextFontSize: string;
|
|
133
|
+
buttonBackgroundColor: string;
|
|
134
|
+
buttonColor: string;
|
|
135
|
+
buttonBorderRadius: string;
|
|
136
|
+
align: 'left' | 'center' | 'right';
|
|
137
|
+
padding: string;
|
|
138
|
+
}
|
|
139
|
+
type BlockProperties = TextBlockProperties | ButtonBlockProperties | ImageBlockProperties | DividerBlockProperties | SpacerBlockProperties | SocialBlockProperties | HtmlBlockProperties | VideoBlockProperties | HeadingBlockProperties | CountdownBlockProperties | MenuBlockProperties | HeroBlockProperties;
|
|
140
|
+
interface BlockPropertiesMap {
|
|
141
|
+
text: TextBlockProperties;
|
|
142
|
+
button: ButtonBlockProperties;
|
|
143
|
+
image: ImageBlockProperties;
|
|
144
|
+
divider: DividerBlockProperties;
|
|
145
|
+
spacer: SpacerBlockProperties;
|
|
146
|
+
social: SocialBlockProperties;
|
|
147
|
+
html: HtmlBlockProperties;
|
|
148
|
+
video: VideoBlockProperties;
|
|
149
|
+
heading: HeadingBlockProperties;
|
|
150
|
+
countdown: CountdownBlockProperties;
|
|
151
|
+
menu: MenuBlockProperties;
|
|
152
|
+
hero: HeroBlockProperties;
|
|
153
|
+
}
|
|
154
|
+
interface Block {
|
|
155
|
+
id: string;
|
|
156
|
+
type: BlockType;
|
|
157
|
+
properties: Record<string, any>;
|
|
158
|
+
}
|
|
159
|
+
interface Column {
|
|
160
|
+
id: string;
|
|
161
|
+
width: string;
|
|
162
|
+
blocks: Block[];
|
|
163
|
+
}
|
|
164
|
+
interface SectionProperties {
|
|
165
|
+
backgroundColor: string;
|
|
166
|
+
padding: string;
|
|
167
|
+
borderRadius: string;
|
|
168
|
+
fullWidth: boolean;
|
|
169
|
+
backgroundImage?: string;
|
|
170
|
+
backgroundSize?: string;
|
|
171
|
+
backgroundRepeat?: string;
|
|
172
|
+
}
|
|
173
|
+
interface Section {
|
|
174
|
+
id: string;
|
|
175
|
+
columns: Column[];
|
|
176
|
+
properties: SectionProperties;
|
|
177
|
+
}
|
|
178
|
+
interface GlobalStyles {
|
|
179
|
+
backgroundColor: string;
|
|
180
|
+
width: number;
|
|
181
|
+
fontFamily: string;
|
|
182
|
+
}
|
|
183
|
+
interface HeadMetadata {
|
|
184
|
+
title: string;
|
|
185
|
+
previewText: string;
|
|
186
|
+
headStyles: string[];
|
|
187
|
+
}
|
|
188
|
+
interface EmailTemplate {
|
|
189
|
+
sections: Section[];
|
|
190
|
+
globalStyles: GlobalStyles;
|
|
191
|
+
headMetadata?: HeadMetadata;
|
|
192
|
+
}
|
|
193
|
+
interface Variable {
|
|
194
|
+
key: string;
|
|
195
|
+
icon?: string;
|
|
196
|
+
sample: string;
|
|
197
|
+
label?: string;
|
|
198
|
+
group?: string;
|
|
199
|
+
}
|
|
200
|
+
interface VariableChipStyle {
|
|
201
|
+
backgroundColor: string;
|
|
202
|
+
color: string;
|
|
203
|
+
borderColor: string;
|
|
204
|
+
fontSize: string;
|
|
205
|
+
borderRadius: string;
|
|
206
|
+
}
|
|
207
|
+
interface PersistenceAdapter {
|
|
208
|
+
save(key: string, template: EmailTemplate): void;
|
|
209
|
+
load(key: string): EmailTemplate | null;
|
|
210
|
+
remove(key: string): void;
|
|
211
|
+
}
|
|
212
|
+
interface UploadOptions {
|
|
213
|
+
context: string;
|
|
214
|
+
blockId: string;
|
|
215
|
+
signal: AbortSignal;
|
|
216
|
+
}
|
|
217
|
+
interface UploadResult {
|
|
218
|
+
url: string;
|
|
219
|
+
width?: number;
|
|
220
|
+
height?: number;
|
|
221
|
+
alt?: string;
|
|
222
|
+
}
|
|
223
|
+
interface BrowseResult {
|
|
224
|
+
url: string;
|
|
225
|
+
width?: number;
|
|
226
|
+
height?: number;
|
|
227
|
+
alt?: string;
|
|
228
|
+
}
|
|
229
|
+
interface TransformOptions {
|
|
230
|
+
width: number;
|
|
231
|
+
height?: number;
|
|
232
|
+
fit: string;
|
|
233
|
+
format: string;
|
|
234
|
+
quality: number;
|
|
235
|
+
}
|
|
236
|
+
interface ImageUploadAdapter {
|
|
237
|
+
upload: (file: File, opts?: UploadOptions) => Promise<UploadResult>;
|
|
238
|
+
browse?: () => Promise<BrowseResult | null>;
|
|
239
|
+
delete?: (url: string) => Promise<void>;
|
|
240
|
+
validate?: (file: File) => string | null;
|
|
241
|
+
transform?: (url: string, opts: TransformOptions) => string;
|
|
242
|
+
}
|
|
243
|
+
type ActiveTab = 'visual' | 'source' | 'preview';
|
|
244
|
+
interface SelectionState {
|
|
245
|
+
sectionId: string | null;
|
|
246
|
+
columnId: string | null;
|
|
247
|
+
blockId: string | null;
|
|
248
|
+
}
|
|
249
|
+
interface EditorState {
|
|
250
|
+
template: EmailTemplate;
|
|
251
|
+
selection: SelectionState;
|
|
252
|
+
activeTab: ActiveTab;
|
|
253
|
+
history: EmailTemplate[];
|
|
254
|
+
historyIndex: number;
|
|
255
|
+
isDirty: boolean;
|
|
256
|
+
}
|
|
257
|
+
type EditorAction = {
|
|
258
|
+
type: 'SET_TEMPLATE';
|
|
259
|
+
payload: EmailTemplate;
|
|
260
|
+
} | {
|
|
261
|
+
type: 'ADD_SECTION';
|
|
262
|
+
payload: {
|
|
263
|
+
section: Section;
|
|
264
|
+
index?: number;
|
|
265
|
+
};
|
|
266
|
+
} | {
|
|
267
|
+
type: 'REMOVE_SECTION';
|
|
268
|
+
payload: {
|
|
269
|
+
sectionId: string;
|
|
270
|
+
};
|
|
271
|
+
} | {
|
|
272
|
+
type: 'MOVE_SECTION';
|
|
273
|
+
payload: {
|
|
274
|
+
sectionId: string;
|
|
275
|
+
toIndex: number;
|
|
276
|
+
};
|
|
277
|
+
} | {
|
|
278
|
+
type: 'UPDATE_SECTION';
|
|
279
|
+
payload: {
|
|
280
|
+
sectionId: string;
|
|
281
|
+
properties: Partial<SectionProperties>;
|
|
282
|
+
};
|
|
283
|
+
} | {
|
|
284
|
+
type: 'ADD_BLOCK';
|
|
285
|
+
payload: {
|
|
286
|
+
sectionId: string;
|
|
287
|
+
columnId: string;
|
|
288
|
+
block: Block;
|
|
289
|
+
index?: number;
|
|
290
|
+
};
|
|
291
|
+
} | {
|
|
292
|
+
type: 'REMOVE_BLOCK';
|
|
293
|
+
payload: {
|
|
294
|
+
sectionId: string;
|
|
295
|
+
columnId: string;
|
|
296
|
+
blockId: string;
|
|
297
|
+
};
|
|
298
|
+
} | {
|
|
299
|
+
type: 'MOVE_BLOCK';
|
|
300
|
+
payload: {
|
|
301
|
+
fromSectionId: string;
|
|
302
|
+
fromColumnId: string;
|
|
303
|
+
blockId: string;
|
|
304
|
+
toSectionId: string;
|
|
305
|
+
toColumnId: string;
|
|
306
|
+
toIndex: number;
|
|
307
|
+
};
|
|
308
|
+
} | {
|
|
309
|
+
type: 'UPDATE_BLOCK';
|
|
310
|
+
payload: {
|
|
311
|
+
blockId: string;
|
|
312
|
+
properties: Partial<BlockProperties>;
|
|
313
|
+
};
|
|
314
|
+
} | {
|
|
315
|
+
type: 'SELECT_BLOCK';
|
|
316
|
+
payload: {
|
|
317
|
+
sectionId: string;
|
|
318
|
+
columnId: string;
|
|
319
|
+
blockId: string;
|
|
320
|
+
} | null;
|
|
321
|
+
} | {
|
|
322
|
+
type: 'SELECT_SECTION';
|
|
323
|
+
payload: {
|
|
324
|
+
sectionId: string;
|
|
325
|
+
} | null;
|
|
326
|
+
} | {
|
|
327
|
+
type: 'SET_ACTIVE_TAB';
|
|
328
|
+
payload: ActiveTab;
|
|
329
|
+
} | {
|
|
330
|
+
type: 'UPDATE_GLOBAL_STYLES';
|
|
331
|
+
payload: Partial<GlobalStyles>;
|
|
332
|
+
} | {
|
|
333
|
+
type: 'UPDATE_HEAD_METADATA';
|
|
334
|
+
payload: Partial<HeadMetadata>;
|
|
335
|
+
} | {
|
|
336
|
+
type: 'DUPLICATE_BLOCK';
|
|
337
|
+
payload: {
|
|
338
|
+
sectionId: string;
|
|
339
|
+
columnId: string;
|
|
340
|
+
blockId: string;
|
|
341
|
+
};
|
|
342
|
+
} | {
|
|
343
|
+
type: 'DUPLICATE_SECTION';
|
|
344
|
+
payload: {
|
|
345
|
+
sectionId: string;
|
|
346
|
+
};
|
|
347
|
+
} | {
|
|
348
|
+
type: 'UNDO';
|
|
349
|
+
} | {
|
|
350
|
+
type: 'REDO';
|
|
351
|
+
};
|
|
352
|
+
interface EmailEditorProps {
|
|
353
|
+
initialTemplate?: EmailTemplate;
|
|
354
|
+
initialMJML?: string;
|
|
355
|
+
variables?: Variable[];
|
|
356
|
+
imageUploadAdapter?: ImageUploadAdapter;
|
|
357
|
+
onChange?: (template: EmailTemplate) => void;
|
|
358
|
+
onSave?: (mjml: string, html: string) => void;
|
|
359
|
+
onReady?: () => void;
|
|
360
|
+
/** Custom font family options for the rich text toolbar. Falls back to FONT_OPTIONS constant. */
|
|
361
|
+
fontFamilies?: string[];
|
|
362
|
+
/** Custom font size options for the rich text toolbar (e.g. ['12px', '14px', '16px']). Falls back to DEFAULT_FONT_SIZES constant. */
|
|
363
|
+
fontSizes?: string[];
|
|
364
|
+
/** Key for auto-persisting the template. Different keys allow multiple editor instances to coexist. */
|
|
365
|
+
persistenceKey?: string;
|
|
366
|
+
/** Custom persistence adapter. Defaults to localStorage when persistenceKey is set. */
|
|
367
|
+
persistenceAdapter?: PersistenceAdapter;
|
|
368
|
+
className?: string;
|
|
369
|
+
style?: React.CSSProperties;
|
|
370
|
+
}
|
|
371
|
+
interface EmailEditorRef {
|
|
372
|
+
getMJML: () => string;
|
|
373
|
+
getHTML: () => Promise<string>;
|
|
374
|
+
getJSON: () => EmailTemplate;
|
|
375
|
+
loadMJML: (source: string) => void;
|
|
376
|
+
loadJSON: (template: EmailTemplate) => void;
|
|
377
|
+
insertBlock: (type: BlockType, sectionIdx?: number) => void;
|
|
378
|
+
getVariables: () => string[];
|
|
379
|
+
undo: () => void;
|
|
380
|
+
redo: () => void;
|
|
381
|
+
reset: () => void;
|
|
382
|
+
exportPDF: () => Promise<void>;
|
|
383
|
+
/** Remove persisted template data for the current persistenceKey. No-op if no key is set. */
|
|
384
|
+
clearPersisted: () => void;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare const EmailEditor: React$1.ForwardRefExoticComponent<EmailEditorProps & React$1.RefAttributes<EmailEditorRef>>;
|
|
388
|
+
|
|
389
|
+
interface EditorContextValue {
|
|
390
|
+
state: EditorState;
|
|
391
|
+
dispatch: React__default.Dispatch<EditorAction>;
|
|
392
|
+
/** All variables: pre-defined (props) + custom (user-created) */
|
|
393
|
+
variables: Variable[];
|
|
394
|
+
/** Pre-defined variables from props (read-only) */
|
|
395
|
+
predefinedVariables: Variable[];
|
|
396
|
+
/** User-created custom variables */
|
|
397
|
+
customVariables: Variable[];
|
|
398
|
+
imageUploadAdapter?: ImageUploadAdapter;
|
|
399
|
+
setActiveEditor: (editor: Editor | null) => void;
|
|
400
|
+
getActiveEditor: () => Editor | null;
|
|
401
|
+
insertVariable: (key: string) => boolean;
|
|
402
|
+
addCustomVariable: (variable: Variable) => void;
|
|
403
|
+
removeCustomVariable: (key: string) => void;
|
|
404
|
+
variableChipStyle: VariableChipStyle;
|
|
405
|
+
updateVariableChipStyle: (style: Partial<VariableChipStyle>) => void;
|
|
406
|
+
/** Font family options for the rich text toolbar */
|
|
407
|
+
fontFamilies: string[];
|
|
408
|
+
/** Font size options for the rich text toolbar */
|
|
409
|
+
fontSizes: string[];
|
|
410
|
+
/** Remove persisted template for the current key. No-op if no persistenceKey. */
|
|
411
|
+
clearPersisted: () => void;
|
|
412
|
+
}
|
|
413
|
+
declare function useEditor(): EditorContextValue;
|
|
414
|
+
declare function useEditorState(): EditorState;
|
|
415
|
+
declare function useEditorDispatch(): React__default.Dispatch<EditorAction>;
|
|
416
|
+
declare function useSelectedBlock(): Block | null;
|
|
417
|
+
declare function useSelectedSection(): Section | null;
|
|
418
|
+
interface EditorProviderProps {
|
|
419
|
+
children: ReactNode;
|
|
420
|
+
initialTemplate?: EmailTemplate;
|
|
421
|
+
variables?: Variable[];
|
|
422
|
+
imageUploadAdapter?: ImageUploadAdapter;
|
|
423
|
+
onChange?: (template: EmailTemplate) => void;
|
|
424
|
+
fontFamilies?: string[];
|
|
425
|
+
fontSizes?: string[];
|
|
426
|
+
persistenceKey?: string;
|
|
427
|
+
persistenceAdapter?: PersistenceAdapter;
|
|
428
|
+
}
|
|
429
|
+
declare function EditorProvider({ children, initialTemplate, variables: predefinedVariables, imageUploadAdapter, onChange, fontFamilies: fontFamiliesProp, fontSizes: fontSizesProp, persistenceKey, persistenceAdapter, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
430
|
+
|
|
431
|
+
declare function parseMJML(mjmlString: string): EmailTemplate;
|
|
432
|
+
|
|
433
|
+
declare function generateMJML(template: EmailTemplate): string;
|
|
434
|
+
|
|
435
|
+
interface CompileResult {
|
|
436
|
+
html: string;
|
|
437
|
+
errors: CompileError[];
|
|
438
|
+
}
|
|
439
|
+
interface CompileError {
|
|
440
|
+
line: number;
|
|
441
|
+
message: string;
|
|
442
|
+
tagName: string;
|
|
443
|
+
}
|
|
444
|
+
declare function compileMJMLToHTML(mjmlString: string): Promise<CompileResult>;
|
|
445
|
+
|
|
446
|
+
declare function getExtensions(placeholder?: string): (_tiptap_core.Node<any, any> | _tiptap_core.Extension<any, any> | _tiptap_core.Mark<_tiptap_extension_underline.UnderlineOptions, any>)[];
|
|
447
|
+
|
|
448
|
+
declare module '@tiptap/core' {
|
|
449
|
+
interface Commands<ReturnType> {
|
|
450
|
+
variableNode: {
|
|
451
|
+
insertVariable: (key: string) => ReturnType;
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
declare const VariableNode: Node<any, any>;
|
|
456
|
+
|
|
457
|
+
declare function generateId(prefix?: string): string;
|
|
458
|
+
declare function generateBlockId(): string;
|
|
459
|
+
declare function generateSectionId(): string;
|
|
460
|
+
declare function generateColumnId(): string;
|
|
461
|
+
|
|
462
|
+
declare function extractVariableKeys(text: string): string[];
|
|
463
|
+
declare function replaceVariables(text: string, variables: Variable[], useSample?: boolean): string;
|
|
464
|
+
declare function groupVariables(variables: Variable[]): Map<string, Variable[]>;
|
|
465
|
+
|
|
466
|
+
declare function sanitizeHTML(html: string): string;
|
|
467
|
+
declare function escapeHTML(str: string): string;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Default persistence adapter using localStorage.
|
|
471
|
+
* All operations are wrapped in try/catch to handle quota errors,
|
|
472
|
+
* private browsing restrictions, and SSR environments.
|
|
473
|
+
*/
|
|
474
|
+
declare const localStorageAdapter: PersistenceAdapter;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Block type registries — single source of truth for mapping block types
|
|
478
|
+
* to their renderers, property panels, generators, and parsers.
|
|
479
|
+
*
|
|
480
|
+
* Adding a new block type requires only adding entries here (Open/Closed Principle).
|
|
481
|
+
*/
|
|
482
|
+
|
|
483
|
+
declare function registerBlockRenderer(type: BlockType, component: ComponentType<{
|
|
484
|
+
block: Block;
|
|
485
|
+
}>): void;
|
|
486
|
+
declare function registerBlockProperties(type: BlockType, component: ComponentType<{
|
|
487
|
+
block: Block;
|
|
488
|
+
}>): void;
|
|
489
|
+
declare function registerBlockGenerator(type: BlockType, generator: (block: Block, indent: string) => string): void;
|
|
490
|
+
declare function registerBlockParser(mjmlTag: string, parser: (el: Element) => Block): void;
|
|
491
|
+
|
|
492
|
+
declare const DEFAULT_SOCIAL_PROPERTIES: SocialBlockProperties;
|
|
493
|
+
declare const DEFAULT_BLOCK_PROPERTIES: {
|
|
494
|
+
[K in BlockType]: BlockPropertiesMap[K];
|
|
495
|
+
};
|
|
496
|
+
declare const DEFAULT_SECTION_PROPERTIES: SectionProperties;
|
|
497
|
+
declare const DEFAULT_HEAD_METADATA: HeadMetadata;
|
|
498
|
+
declare const DEFAULT_GLOBAL_STYLES: GlobalStyles;
|
|
499
|
+
declare const DEFAULT_VARIABLE_CHIP_STYLE: VariableChipStyle;
|
|
500
|
+
interface BlockDefinition {
|
|
501
|
+
type: BlockType;
|
|
502
|
+
label: string;
|
|
503
|
+
icon: string;
|
|
504
|
+
description: string;
|
|
505
|
+
}
|
|
506
|
+
declare const BLOCK_DEFINITIONS: BlockDefinition[];
|
|
507
|
+
declare const DEFAULT_FONT_SIZES: string[];
|
|
508
|
+
declare const FONT_OPTIONS: string[];
|
|
509
|
+
declare const COLOR_PRESETS: string[];
|
|
510
|
+
declare const COLUMN_LAYOUTS: {
|
|
511
|
+
label: string;
|
|
512
|
+
widths: string[];
|
|
513
|
+
}[];
|
|
514
|
+
|
|
515
|
+
export { type ActiveTab, BLOCK_DEFINITIONS, type Block, type BlockProperties, type BlockPropertiesMap, type BlockType, type BrowseResult, type ButtonBlockProperties, COLOR_PRESETS, COLUMN_LAYOUTS, type Column, type CountdownBlockProperties, DEFAULT_BLOCK_PROPERTIES, DEFAULT_FONT_SIZES, DEFAULT_GLOBAL_STYLES, DEFAULT_HEAD_METADATA, DEFAULT_SECTION_PROPERTIES, DEFAULT_SOCIAL_PROPERTIES, DEFAULT_VARIABLE_CHIP_STYLE, type DividerBlockProperties, type EditorAction, EditorProvider, type EditorState, EmailEditor, type EmailEditorProps, type EmailEditorRef, type EmailTemplate, FONT_OPTIONS, type GlobalStyles, type HeadMetadata, type HeroBlockProperties, type ImageBlockProperties, type ImageUploadAdapter, type MenuBlockProperties, type MenuItem, type PersistenceAdapter, type Section, type SectionProperties, type SelectionState, type SocialBlockProperties, type SocialElement, type SpacerBlockProperties, type TextBlockProperties, type TransformOptions, type UploadOptions, type UploadResult, type Variable, type VariableChipStyle, VariableNode, compileMJMLToHTML, escapeHTML, extractVariableKeys, generateBlockId, generateColumnId, generateId, generateMJML, generateSectionId, getExtensions, groupVariables, localStorageAdapter, parseMJML, registerBlockGenerator, registerBlockParser, registerBlockProperties, registerBlockRenderer, replaceVariables, sanitizeHTML, useEditor, useEditorDispatch, useEditorState, useSelectedBlock, useSelectedSection };
|