@maily-to/shared 0.0.2 → 2.0.0-beta.10

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.cjs ADDED
@@ -0,0 +1,1261 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let stylecast = require("stylecast");
3
+ //#region src/alignment.ts
4
+ const TEXT_ALIGNMENTS = {
5
+ LEFT: "left",
6
+ CENTER: "center",
7
+ RIGHT: "right"
8
+ };
9
+ const allowedTextAligns = Object.freeze(Object.values(TEXT_ALIGNMENTS));
10
+ const DEFAULT_TEXT_ALIGN = TEXT_ALIGNMENTS.LEFT;
11
+ function isAllowedTextAlignment(value) {
12
+ return typeof value === "string" && allowedTextAligns.includes(value);
13
+ }
14
+ //#endregion
15
+ //#region src/border.ts
16
+ const BORDER_STYLES = {
17
+ SOLID: "solid",
18
+ DASHED: "dashed",
19
+ DOTTED: "dotted"
20
+ };
21
+ const allowedBorderStyles = Object.freeze(Object.values(BORDER_STYLES));
22
+ const DEFAULT_BORDER_STYLE = BORDER_STYLES.SOLID;
23
+ function isAllowedBorderStyle(value) {
24
+ return typeof value === "string" && allowedBorderStyles.includes(value);
25
+ }
26
+ /**
27
+ * Reads the width, style and colour of a border from the `border` shorthand,
28
+ * letting any longhand already in the style win. The shorthand lists its
29
+ * parts in any order, so each is recognised by shape rather than position.
30
+ */
31
+ function getBorderParts(style) {
32
+ const parts = (style.border ?? "").trim().split(/\s+/).filter(Boolean);
33
+ let color;
34
+ let borderStyle;
35
+ let width;
36
+ for (const part of parts) if (isAllowedBorderStyle(part) || part === "none") borderStyle = part;
37
+ else if (/^[\d.]/.test(part)) width = part;
38
+ else color = part;
39
+ return {
40
+ color: style.borderColor ?? color,
41
+ style: style.borderStyle ?? borderStyle,
42
+ width: style.borderWidth ?? width
43
+ };
44
+ }
45
+ //#endregion
46
+ //#region src/box.ts
47
+ const BOX_SIDES = [
48
+ "top",
49
+ "right",
50
+ "bottom",
51
+ "left"
52
+ ];
53
+ const BOX_CORNERS = [
54
+ "topLeft",
55
+ "topRight",
56
+ "bottomRight",
57
+ "bottomLeft"
58
+ ];
59
+ function capitalize(value) {
60
+ return value.charAt(0).toUpperCase() + value.slice(1);
61
+ }
62
+ /**
63
+ * CSS box shorthands repeat their values when fewer than four are given:
64
+ * one applies to every edge, two to the vertical then horizontal pair, and
65
+ * three to top, the horizontal pair, then bottom.
66
+ */
67
+ function getShorthandEdges(shorthand) {
68
+ const parts = (shorthand ?? "").trim().split(/\s+/).filter(Boolean);
69
+ if (parts.length === 0) return null;
70
+ const [first, second = first, third = first, fourth = second] = parts;
71
+ return [
72
+ first,
73
+ second,
74
+ third,
75
+ fourth
76
+ ].map(toLength);
77
+ }
78
+ function toLength(value) {
79
+ const parsed = Number.parseFloat(value);
80
+ return Number.isNaN(parsed) ? 0 : parsed;
81
+ }
82
+ function getLonghand(style, property, edge, suffix) {
83
+ return style[`${property}${capitalize(edge)}${suffix}`];
84
+ }
85
+ function toShorthand(edges) {
86
+ const [first, second, third, fourth] = edges;
87
+ return (first === third && second === fourth ? first === second ? [first] : [first, second] : [
88
+ first,
89
+ second,
90
+ third,
91
+ fourth
92
+ ]).map((value) => `${value}px`).join(" ");
93
+ }
94
+ function getBoxSides(style, property) {
95
+ const [top, right, bottom, left] = getShorthandEdges(style[property]) ?? [
96
+ 0,
97
+ 0,
98
+ 0,
99
+ 0
100
+ ];
101
+ const sides = {
102
+ bottom,
103
+ left,
104
+ right,
105
+ top
106
+ };
107
+ for (const side of BOX_SIDES) {
108
+ const longhand = getLonghand(style, property, side, "");
109
+ if (longhand !== void 0) sides[side] = toLength(longhand);
110
+ }
111
+ return sides;
112
+ }
113
+ function toBoxSides(property, values) {
114
+ const declarations = { [property]: toShorthand([
115
+ values.top,
116
+ values.right,
117
+ values.bottom,
118
+ values.left
119
+ ]) };
120
+ for (const side of BOX_SIDES) declarations[`${property}${capitalize(side)}`] = null;
121
+ return declarations;
122
+ }
123
+ /**
124
+ * Radius shorthands run clockwise from the top-left corner, and repeat the
125
+ * same way box shorthands do.
126
+ */
127
+ function getBoxCorners(style, property) {
128
+ const [topLeft, topRight, bottomRight, bottomLeft] = getShorthandEdges(style[property]) ?? [
129
+ 0,
130
+ 0,
131
+ 0,
132
+ 0
133
+ ];
134
+ const corners = {
135
+ bottomLeft,
136
+ bottomRight,
137
+ topLeft,
138
+ topRight
139
+ };
140
+ for (const corner of BOX_CORNERS) {
141
+ const longhand = getLonghand(style, "border", corner, "Radius");
142
+ if (longhand !== void 0) corners[corner] = toLength(longhand);
143
+ }
144
+ return corners;
145
+ }
146
+ function toBoxCorners(property, values) {
147
+ const declarations = { [property]: toShorthand([
148
+ values.topLeft,
149
+ values.topRight,
150
+ values.bottomRight,
151
+ values.bottomLeft
152
+ ]) };
153
+ for (const corner of BOX_CORNERS) declarations[`border${capitalize(corner)}Radius`] = null;
154
+ return declarations;
155
+ }
156
+ //#endregion
157
+ //#region src/button.ts
158
+ /**
159
+ * Button layout kinds.
160
+ * "tight" renders the button at its content width,
161
+ * "full-width" stretches it to fill the container.
162
+ */
163
+ const BUTTON_KINDS = {
164
+ TIGHT: "tight",
165
+ FULL_WIDTH: "full-width"
166
+ };
167
+ const allowedButtonKinds = Object.freeze(Object.values(BUTTON_KINDS));
168
+ const DEFAULT_BUTTON_KIND = BUTTON_KINDS.TIGHT;
169
+ function isAllowedButtonKind(value) {
170
+ return typeof value === "string" && allowedButtonKinds.includes(value);
171
+ }
172
+ //#endregion
173
+ //#region src/math.ts
174
+ function clamp(value, [min, max]) {
175
+ return Math.min(Math.max(value, min), max);
176
+ }
177
+ function percentage(portion, total) {
178
+ return clamp(portion / total * 100, [0, 100]);
179
+ }
180
+ function roundTo(value, decimals) {
181
+ const factor = 10 ** decimals;
182
+ return Math.round(value * factor) / factor;
183
+ }
184
+ function absoluteFromPercentage(percentage, total) {
185
+ return Math.round(total * percentage / 100);
186
+ }
187
+ //#endregion
188
+ //#region src/column.ts
189
+ const PERCENTAGE_PATTERN = /^(\d+(?:\.\d+)?)%$/;
190
+ const PIXEL_PATTERN = /^(\d+(?:\.\d+)?)px$/;
191
+ const CSS_LENGTH_PATTERN = /^\d+(?:\.\d+)?(?:px|pt|pc|in|cm|mm|em|rem|ex|ch|vw|vh|vmin|vmax)$/;
192
+ function getColumnWidth(value) {
193
+ const declaration = value?.trim();
194
+ if (!declaration) return null;
195
+ const percentage = PERCENTAGE_PATTERN.exec(declaration);
196
+ if (percentage) return Number(percentage[1]);
197
+ return CSS_LENGTH_PATTERN.test(declaration) ? declaration : null;
198
+ }
199
+ function getColumnWidthValue(width) {
200
+ return typeof width === "number" ? `${width}%` : width;
201
+ }
202
+ function getColumnWidthPercent(options) {
203
+ const { containerWidth, width } = options;
204
+ if (width === null || width === void 0) return null;
205
+ if (typeof width === "number") return width;
206
+ const percentage = PERCENTAGE_PATTERN.exec(width);
207
+ if (percentage) return Number(percentage[1]);
208
+ const pixels = PIXEL_PATTERN.exec(width);
209
+ if (pixels && containerWidth > 0) return roundTo(Number(pixels[1]) / containerWidth * 100, 3);
210
+ return null;
211
+ }
212
+ //#endregion
213
+ //#region src/constants.ts
214
+ const DATA_NODE_TYPE_KEY = "data-node-type";
215
+ const MAILY_ERROR_PREFIX = "[Maily Error]";
216
+ const MAILY_BUG_REPORT_URL = "https://github.com/arikchakma/maily.to/issues/new";
217
+ //#endregion
218
+ //#region src/font.ts
219
+ /**
220
+ * List of allowed fallback font families. These are system fonts or
221
+ * generic font families that serve as fallbacks when a web font
222
+ * fails to load.
223
+ */
224
+ const allowedFallbackFonts = [
225
+ "Arial",
226
+ "Helvetica",
227
+ "Verdana",
228
+ "Georgia",
229
+ "Times New Roman",
230
+ "serif",
231
+ "sans-serif",
232
+ "monospace",
233
+ "cursive",
234
+ "fantasy"
235
+ ];
236
+ /**
237
+ * Default font configuration: Inter with sans-serif fallback,
238
+ * loaded from the Maily CDN as woff2.
239
+ */
240
+ const DEFAULT_FONT = {
241
+ fallbackFontFamily: "sans-serif",
242
+ fontFamily: "Inter",
243
+ webFont: {
244
+ format: "woff2",
245
+ url: "https://cdn.usemaily.com/fonts/v0/inter.woff2"
246
+ }
247
+ };
248
+ function getFontFamilyNames(value) {
249
+ return value.split(",").map((font) => {
250
+ return font.trim().replace(/['"]/g, "");
251
+ }).filter(Boolean);
252
+ }
253
+ function getFontFamilyValue(options) {
254
+ const { fallbackFontFamily, fontFamily } = options;
255
+ return [fontFamily ? `'${fontFamily}'` : null, fallbackFontFamily].filter(Boolean).join(", ");
256
+ }
257
+ /**
258
+ * Generates a @font-face CSS rule string for the given font configuration.
259
+ * Includes the font family, style, weight, MSO fallback, and web font
260
+ * source URL when available.
261
+ */
262
+ function getFontFaceStyle(font) {
263
+ const { fallbackFontFamily, fontFamily, fontStyle = "normal", fontWeight = 400, webFont } = font;
264
+ return `@font-face {font-family: '${fontFamily}';font-style: ${fontStyle};font-weight: ${fontWeight};mso-font-alt: '${fallbackFontFamily}';${webFont ? `src: url(${webFont.url}) format('${webFont.format}');` : ""}}`;
265
+ }
266
+ /**
267
+ * Injects a @font-face style element into the document head to load
268
+ * the given font. Only works in browser environments.
269
+ */
270
+ function loadFont(font) {
271
+ const styleElement = document.createElement("style");
272
+ styleElement.textContent = getFontFaceStyle(font);
273
+ document.head.appendChild(styleElement);
274
+ }
275
+ //#endregion
276
+ //#region src/font-style.ts
277
+ /**
278
+ * Built-in font options served from the Maily CDN. System fonts
279
+ * (Arial, Helvetica, etc.) are included without a webFont field.
280
+ */
281
+ const DEFAULT_FONT_FAMILIES = [
282
+ {
283
+ fontFamily: "Inter",
284
+ webFont: {
285
+ format: "woff2",
286
+ url: "https://cdn.usemaily.com/fonts/v0/inter.woff2"
287
+ }
288
+ },
289
+ {
290
+ fontFamily: "Roboto",
291
+ webFont: {
292
+ format: "woff2",
293
+ url: "https://cdn.usemaily.com/fonts/v0/roboto.woff2"
294
+ }
295
+ },
296
+ {
297
+ fontFamily: "Open Sans",
298
+ webFont: {
299
+ format: "woff2",
300
+ url: "https://cdn.usemaily.com/fonts/v0/open-sans.woff2"
301
+ }
302
+ },
303
+ {
304
+ fontFamily: "Lato",
305
+ webFont: {
306
+ format: "woff2",
307
+ url: "https://cdn.usemaily.com/fonts/v0/lato.woff2"
308
+ }
309
+ },
310
+ {
311
+ fontFamily: "Montserrat",
312
+ webFont: {
313
+ format: "woff2",
314
+ url: "https://cdn.usemaily.com/fonts/v0/montserrat.woff2"
315
+ }
316
+ },
317
+ {
318
+ fontFamily: "Poppins",
319
+ webFont: {
320
+ format: "woff2",
321
+ url: "https://cdn.usemaily.com/fonts/v0/poppins.woff2"
322
+ }
323
+ },
324
+ {
325
+ fontFamily: "Raleway",
326
+ webFont: {
327
+ format: "woff2",
328
+ url: "https://cdn.usemaily.com/fonts/v0/raleway.woff2"
329
+ }
330
+ },
331
+ {
332
+ fontFamily: "Ubuntu",
333
+ webFont: {
334
+ format: "woff2",
335
+ url: "https://cdn.usemaily.com/fonts/v0/ubuntu.woff2"
336
+ }
337
+ },
338
+ { fontFamily: "Arial" },
339
+ { fontFamily: "Helvetica" },
340
+ { fontFamily: "Georgia" },
341
+ { fontFamily: "Times New Roman" },
342
+ { fontFamily: "Verdana" },
343
+ { fontFamily: "Courier New" },
344
+ { fontFamily: "Trebuchet MS" }
345
+ ];
346
+ const FONT_STYLES = {
347
+ NORMAL: "normal",
348
+ ITALIC: "italic"
349
+ };
350
+ const FONT_SIZE_PRESETS = [
351
+ {
352
+ value: 12,
353
+ label: "Small"
354
+ },
355
+ {
356
+ value: 14,
357
+ label: "Normal"
358
+ },
359
+ {
360
+ value: 16,
361
+ label: "Medium"
362
+ },
363
+ {
364
+ value: 18,
365
+ label: "Large"
366
+ },
367
+ {
368
+ value: 24,
369
+ label: "XL"
370
+ },
371
+ {
372
+ value: 32,
373
+ label: "2XL"
374
+ }
375
+ ];
376
+ const LINE_HEIGHT_PRESETS = [
377
+ {
378
+ value: 1,
379
+ label: "Tight"
380
+ },
381
+ {
382
+ value: 1.25,
383
+ label: "Snug"
384
+ },
385
+ {
386
+ value: 1.5,
387
+ label: "Normal"
388
+ },
389
+ {
390
+ value: 1.75,
391
+ label: "Relaxed"
392
+ },
393
+ {
394
+ value: 2,
395
+ label: "Loose"
396
+ }
397
+ ];
398
+ const DEFAULT_FONT_FAMILY = "Inter";
399
+ const DEFAULT_FONT_FALLBACK = "sans-serif";
400
+ //#endregion
401
+ //#region src/font-weight.ts
402
+ /**
403
+ * Numeric font weight values mapped to semantic names.
404
+ * Normal (400), Medium (500), Semibold (600), Bold (700), Extra Bold (800).
405
+ */
406
+ const FONT_WEIGHTS = {
407
+ NORMAL: 400,
408
+ MEDIUM: 500,
409
+ SEMIBOLD: 600,
410
+ BOLD: 700,
411
+ EXTRA_BOLD: 800
412
+ };
413
+ //#endregion
414
+ //#region src/function.ts
415
+ function noop() {}
416
+ //#endregion
417
+ //#region src/html-code-block.ts
418
+ /**
419
+ * Tab options for the HTML code block node.
420
+ * "code" shows the raw HTML source, "preview" renders it visually.
421
+ */
422
+ const HTML_CODE_BLOCK_TABS = {
423
+ CODE: "code",
424
+ PREVIEW: "preview"
425
+ };
426
+ const DEFAULT_HTML_CODE_BLOCK_TAB = HTML_CODE_BLOCK_TABS.CODE;
427
+ //#endregion
428
+ //#region src/image.ts
429
+ const MIN_IMAGE_WIDTH_PERCENTAGE = 5;
430
+ const MAX_IMAGE_WIDTH_PERCENTAGE = 100;
431
+ const DEFAULT_CONTAINER_WIDTH_PIXELS = 600;
432
+ const PIXEL_SUFFIX = "px";
433
+ function getPixels(value) {
434
+ const length = value.endsWith(PIXEL_SUFFIX) ? value.slice(0, -2) : value;
435
+ if (length === "") return null;
436
+ const pixels = Number(length);
437
+ return Number.isFinite(pixels) ? pixels : null;
438
+ }
439
+ function parseWidthToPercentage(width, containerWidthPixels = 600) {
440
+ if (width === null || width === void 0 || width === "auto") return 100;
441
+ const value = String(width).trim();
442
+ if (value.endsWith("%")) return clampImageWidthPercentage(Number.parseFloat(value));
443
+ const pixels = getPixels(value);
444
+ if (pixels === null) return 100;
445
+ return clampImageWidthPercentage(Math.round(100 * pixels / containerWidthPixels));
446
+ }
447
+ function clampImageWidthPercentage(width) {
448
+ return clamp(width, [5, 100]);
449
+ }
450
+ //#endregion
451
+ //#region src/invariant.ts
452
+ function invariant(value, message) {
453
+ if (value === false || value === null || typeof value === "undefined") {
454
+ console.error(`${MAILY_ERROR_PREFIX}: The following error is a bug in Maily;
455
+ Please open an issue! ${MAILY_BUG_REPORT_URL}`);
456
+ throw new Error(message);
457
+ }
458
+ }
459
+ //#endregion
460
+ //#region src/mark.ts
461
+ const MAILY_MARK_TYPES = {
462
+ BOLD: "bold",
463
+ ITALIC: "italic",
464
+ STRIKE: "strike",
465
+ UNDERLINE: "underline",
466
+ LINK: "link",
467
+ CODE: "code",
468
+ TEXT_STYLE: "textStyle",
469
+ HIGHLIGHT: "highlight",
470
+ SPAN: "span"
471
+ };
472
+ const allowedMarkTypes = Object.values(MAILY_MARK_TYPES);
473
+ //#endregion
474
+ //#region src/node.ts
475
+ const MAILY_NODE_TYPES = {
476
+ DOCUMENT: "doc",
477
+ BODY: "body",
478
+ CONTAINER: "container",
479
+ SECTION: "section",
480
+ COLUMNS: "columns",
481
+ COLUMN: "column",
482
+ IMAGE: "image",
483
+ INLINE_IMAGE: "inlineImage",
484
+ INLINE_SPAN: "inlineSpan",
485
+ SPACER: "spacer",
486
+ BUTTON: "button",
487
+ FOOTER: "footer",
488
+ PARAGRAPH: "paragraph",
489
+ HEADING: "heading",
490
+ BLOCKQUOTE: "blockquote",
491
+ HORIZONTAL_RULE: "horizontalRule",
492
+ HTML_CODE_BLOCK: "htmlCodeBlock",
493
+ REPEAT: "repeat",
494
+ HARD_BREAK: "hardBreak",
495
+ BULLET_LIST: "bulletList",
496
+ ORDERED_LIST: "orderedList",
497
+ LIST_ITEM: "listItem",
498
+ TEXT: "text",
499
+ VARIABLE: "variable",
500
+ TABLE: "table",
501
+ TABLE_ROW: "tableRow",
502
+ TABLE_CELL: "tableCell",
503
+ TABLE_HEADER: "tableHeader",
504
+ LINK_CARD: "linkCard"
505
+ };
506
+ const MAILY_EXTENSION_TYPES = {
507
+ STYLE: "style",
508
+ THEME: "theme",
509
+ VISIBILITY: "visibility"
510
+ };
511
+ const allowedNodeTypes = Object.values(MAILY_NODE_TYPES);
512
+ const DEFAULT_VARIABLE_ATTRIBUTES = {
513
+ fallback: null,
514
+ isDefaultEditable: true,
515
+ label: null,
516
+ required: true,
517
+ style: null
518
+ };
519
+ //#endregion
520
+ //#region src/is.ts
521
+ function guard(type) {
522
+ return (value) => value.type === type;
523
+ }
524
+ function isObject(val) {
525
+ return typeof val === "object" && val !== null;
526
+ }
527
+ const is = {
528
+ node(value) {
529
+ return typeof value === "object" && value !== null && "type" in value && allowedNodeTypes.includes(value.type);
530
+ },
531
+ mark(value) {
532
+ return typeof value === "object" && value !== null && "type" in value && allowedMarkTypes.includes(value.type);
533
+ },
534
+ parent(node) {
535
+ return Array.isArray(node?.content);
536
+ },
537
+ marked(node) {
538
+ return Array.isArray(node?.marks);
539
+ },
540
+ doc: guard(MAILY_NODE_TYPES.DOCUMENT),
541
+ body: guard(MAILY_NODE_TYPES.BODY),
542
+ container: guard(MAILY_NODE_TYPES.CONTAINER),
543
+ section: guard(MAILY_NODE_TYPES.SECTION),
544
+ columns: guard(MAILY_NODE_TYPES.COLUMNS),
545
+ column: guard(MAILY_NODE_TYPES.COLUMN),
546
+ image: guard(MAILY_NODE_TYPES.IMAGE),
547
+ inlineImage: guard(MAILY_NODE_TYPES.INLINE_IMAGE),
548
+ inlineSpan: guard(MAILY_NODE_TYPES.INLINE_SPAN),
549
+ spacer: guard(MAILY_NODE_TYPES.SPACER),
550
+ button: guard(MAILY_NODE_TYPES.BUTTON),
551
+ footer: guard(MAILY_NODE_TYPES.FOOTER),
552
+ paragraph: guard(MAILY_NODE_TYPES.PARAGRAPH),
553
+ heading: guard(MAILY_NODE_TYPES.HEADING),
554
+ blockquote: guard(MAILY_NODE_TYPES.BLOCKQUOTE),
555
+ horizontalRule: guard(MAILY_NODE_TYPES.HORIZONTAL_RULE),
556
+ hardBreak: guard(MAILY_NODE_TYPES.HARD_BREAK),
557
+ htmlCodeBlock: guard(MAILY_NODE_TYPES.HTML_CODE_BLOCK),
558
+ repeat: guard(MAILY_NODE_TYPES.REPEAT),
559
+ bulletList: guard(MAILY_NODE_TYPES.BULLET_LIST),
560
+ orderedList: guard(MAILY_NODE_TYPES.ORDERED_LIST),
561
+ listItem: guard(MAILY_NODE_TYPES.LIST_ITEM),
562
+ linkCard: guard(MAILY_NODE_TYPES.LINK_CARD),
563
+ text: guard(MAILY_NODE_TYPES.TEXT),
564
+ variable: guard(MAILY_NODE_TYPES.VARIABLE),
565
+ table: guard(MAILY_NODE_TYPES.TABLE),
566
+ tableRow: guard(MAILY_NODE_TYPES.TABLE_ROW),
567
+ tableCell: guard(MAILY_NODE_TYPES.TABLE_CELL),
568
+ tableHeader: guard(MAILY_NODE_TYPES.TABLE_HEADER),
569
+ bold: guard(MAILY_MARK_TYPES.BOLD),
570
+ italic: guard(MAILY_MARK_TYPES.ITALIC),
571
+ strike: guard(MAILY_MARK_TYPES.STRIKE),
572
+ underline: guard(MAILY_MARK_TYPES.UNDERLINE),
573
+ link: guard(MAILY_MARK_TYPES.LINK),
574
+ code: guard(MAILY_MARK_TYPES.CODE),
575
+ textStyle: guard(MAILY_MARK_TYPES.TEXT_STYLE),
576
+ highlight: guard(MAILY_MARK_TYPES.HIGHLIGHT),
577
+ span: guard(MAILY_MARK_TYPES.SPAN)
578
+ };
579
+ function isDef(value) {
580
+ return value !== void 0 && value !== null;
581
+ }
582
+ //#endregion
583
+ //#region src/object.ts
584
+ function isMergeableObject(value) {
585
+ return value !== null && typeof value === "object" && !Array.isArray(value);
586
+ }
587
+ /**
588
+ * One-level deep merge of plain objects. Nested plain objects are
589
+ * shallow-merged; primitives, arrays, and null are replaced outright.
590
+ * Does not mutate the target — returns a new object.
591
+ *
592
+ * Example:
593
+ * deepMerge({ a: 1, nested: { x: 1, y: 2 } }, { nested: { y: 3 } })
594
+ * // => { a: 1, nested: { x: 1, y: 3 } }
595
+ */
596
+ function deepMerge(target, ...sources) {
597
+ const result = { ...target };
598
+ for (const source of sources) for (const [key, value] of Object.entries(source)) result[key] = isMergeableObject(value) && isMergeableObject(result[key]) ? {
599
+ ...result[key],
600
+ ...value
601
+ } : value;
602
+ return result;
603
+ }
604
+ //#endregion
605
+ //#region src/spacing.ts
606
+ const BLOCK_CONTAINER_TYPES = [
607
+ MAILY_NODE_TYPES.DOCUMENT,
608
+ MAILY_NODE_TYPES.BODY,
609
+ MAILY_NODE_TYPES.CONTAINER,
610
+ MAILY_NODE_TYPES.SECTION,
611
+ MAILY_NODE_TYPES.COLUMN,
612
+ MAILY_NODE_TYPES.REPEAT,
613
+ MAILY_NODE_TYPES.BULLET_LIST,
614
+ MAILY_NODE_TYPES.ORDERED_LIST
615
+ ];
616
+ const MARGIN_TOP_ABSORBER_TYPES = [MAILY_NODE_TYPES.SPACER];
617
+ const MARGIN_BOTTOM_ABSORBER_TYPES = [MAILY_NODE_TYPES.SPACER, MAILY_NODE_TYPES.HORIZONTAL_RULE];
618
+ function getSuppressedMargins(position) {
619
+ const { isFirst, isLast, nextType, parentType, previousType } = position;
620
+ const stacks = parentType !== void 0 && BLOCK_CONTAINER_TYPES.includes(parentType);
621
+ return {
622
+ marginBottom: !stacks || isLast || MARGIN_BOTTOM_ABSORBER_TYPES.includes(nextType ?? ""),
623
+ marginTop: !stacks || isFirst || MARGIN_TOP_ABSORBER_TYPES.includes(previousType ?? "")
624
+ };
625
+ }
626
+ //#endregion
627
+ //#region src/style.ts
628
+ function parseInlineStyles(style) {
629
+ return (0, stylecast.objectify)(style, { reactify: true });
630
+ }
631
+ function stringifyInlineStyles(style) {
632
+ return (0, stylecast.stringify)(style, { kebabCase: true });
633
+ }
634
+ function expandInlineStyles(style) {
635
+ return (0, stylecast.expand)(style, { camelCase: true });
636
+ }
637
+ function collapseInlineStyles(style) {
638
+ return (0, stylecast.collapse)(style, { camelCase: true });
639
+ }
640
+ function mergeInlineStyles(under, over) {
641
+ return collapseInlineStyles({
642
+ ...expandInlineStyles(under),
643
+ ...expandInlineStyles(over)
644
+ });
645
+ }
646
+ //#endregion
647
+ //#region src/direction.ts
648
+ const TEXT_DIRECTIONS = {
649
+ LTR: "ltr",
650
+ RTL: "rtl",
651
+ AUTO: "auto"
652
+ };
653
+ const DEFAULT_TEXT_DIRECTION = TEXT_DIRECTIONS.AUTO;
654
+ function getCssDirection(dir) {
655
+ if (dir && dir !== TEXT_DIRECTIONS.AUTO) return { direction: dir };
656
+ return {};
657
+ }
658
+ //#endregion
659
+ //#region src/variable.ts
660
+ const DEFAULT_VARIABLE_START_TRIGGER = "{{";
661
+ const DEFAULT_VARIABLE_END_TRIGGER = "}}";
662
+ const LEGACY_HIDE_DEFAULT_VALUE = "hideDefaultValue";
663
+ function getQuotedValue(value) {
664
+ return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
665
+ }
666
+ function getSerializedAttribute(options) {
667
+ const { name, value } = options;
668
+ if (value === void 0 || value === DEFAULT_VARIABLE_ATTRIBUTES[name]) return null;
669
+ if (typeof value === "boolean") return `${name}=${value}`;
670
+ return typeof value === "string" ? `${name}=${getQuotedValue(value)}` : null;
671
+ }
672
+ function serializeVariableToText(variable) {
673
+ const { fallback, id, isDefaultEditable, label, required, style } = variable;
674
+ return [
675
+ "{{",
676
+ [id, ...[
677
+ getSerializedAttribute({
678
+ name: "fallback",
679
+ value: fallback
680
+ }),
681
+ getSerializedAttribute({
682
+ name: "isDefaultEditable",
683
+ value: isDefaultEditable
684
+ }),
685
+ getSerializedAttribute({
686
+ name: "label",
687
+ value: label === id ? null : label
688
+ }),
689
+ getSerializedAttribute({
690
+ name: "required",
691
+ value: required
692
+ }),
693
+ getSerializedAttribute({
694
+ name: "style",
695
+ value: style
696
+ })
697
+ ].filter((attribute) => {
698
+ return attribute !== null;
699
+ })].join(" "),
700
+ "}}"
701
+ ].join("");
702
+ }
703
+ function getReferenceTokens(inner) {
704
+ const tokens = [];
705
+ let token = "";
706
+ let quoted = false;
707
+ for (let index = 0; index < inner.length; index += 1) {
708
+ const character = inner[index];
709
+ if (quoted && character === "\\" && index + 1 < inner.length) {
710
+ token += character + inner[index + 1];
711
+ index += 1;
712
+ continue;
713
+ }
714
+ if (character === "\"") {
715
+ quoted = !quoted;
716
+ token += character;
717
+ continue;
718
+ }
719
+ if (!quoted && /\s/.test(character)) {
720
+ if (token) {
721
+ tokens.push(token);
722
+ token = "";
723
+ }
724
+ continue;
725
+ }
726
+ token += character;
727
+ }
728
+ if (token) tokens.push(token);
729
+ return tokens;
730
+ }
731
+ function getUnquotedValue(value) {
732
+ if (value.startsWith("\"") && value.endsWith("\"") && value.length > 1) return value.slice(1, -1).replace(/\\"/g, "\"").replace(/\\\\/g, "\\");
733
+ if (value === "true") return true;
734
+ if (value === "false") return false;
735
+ return value;
736
+ }
737
+ function deserializeVariableFromText(text) {
738
+ const [id = "", ...pairs] = getReferenceTokens(text.slice(2, text.length - 2).trim());
739
+ const attributes = { id };
740
+ for (const pair of pairs) {
741
+ const separator = pair.indexOf("=");
742
+ if (separator <= 0) continue;
743
+ const key = pair.slice(0, separator);
744
+ const value = getUnquotedValue(pair.slice(separator + 1));
745
+ if (key === LEGACY_HIDE_DEFAULT_VALUE) {
746
+ attributes.isDefaultEditable ??= value !== true;
747
+ continue;
748
+ }
749
+ attributes[key] = value;
750
+ }
751
+ return {
752
+ ...DEFAULT_VARIABLE_ATTRIBUTES,
753
+ ...attributes
754
+ };
755
+ }
756
+ function getVariableSegments(content) {
757
+ const segments = [];
758
+ let plain = "";
759
+ let index = 0;
760
+ while (index < content.length) {
761
+ if (!content.startsWith("{{", index)) {
762
+ plain += content[index];
763
+ index += 1;
764
+ continue;
765
+ }
766
+ const end = getReferenceEnd({
767
+ content,
768
+ start: index
769
+ });
770
+ if (end === -1) {
771
+ plain += content[index];
772
+ index += 1;
773
+ continue;
774
+ }
775
+ if (plain) {
776
+ segments.push({
777
+ isReference: false,
778
+ text: plain
779
+ });
780
+ plain = "";
781
+ }
782
+ segments.push({
783
+ isReference: true,
784
+ text: content.slice(index, end)
785
+ });
786
+ index = end;
787
+ }
788
+ if (plain) segments.push({
789
+ isReference: false,
790
+ text: plain
791
+ });
792
+ return segments;
793
+ }
794
+ function getReferenceEnd(options) {
795
+ const { content, start } = options;
796
+ let quoted = false;
797
+ for (let index = start + 2; index < content.length; index += 1) {
798
+ const character = content[index];
799
+ if (quoted && character === "\\") {
800
+ index += 1;
801
+ continue;
802
+ }
803
+ if (character === "\"") {
804
+ quoted = !quoted;
805
+ continue;
806
+ }
807
+ if (!quoted && content.startsWith("}}", index)) return index + 2;
808
+ }
809
+ return -1;
810
+ }
811
+ function buildDocFromVariableText(content) {
812
+ return {
813
+ type: MAILY_NODE_TYPES.DOCUMENT,
814
+ content: [{
815
+ type: MAILY_NODE_TYPES.PARAGRAPH,
816
+ content: getVariableSegments(content).map((segment) => {
817
+ return segment.isReference ? {
818
+ type: MAILY_NODE_TYPES.VARIABLE,
819
+ attrs: deserializeVariableFromText(segment.text)
820
+ } : {
821
+ type: MAILY_NODE_TYPES.TEXT,
822
+ text: segment.text
823
+ };
824
+ })
825
+ }]
826
+ };
827
+ }
828
+ function hasVariableInText(text) {
829
+ const start = text.indexOf("{{");
830
+ if (start === -1) return false;
831
+ return text.indexOf("}}", start + 2) !== -1;
832
+ }
833
+ //#endregion
834
+ //#region src/visibility.ts
835
+ const VISIBILITY_ACTIONS = {
836
+ SHOW: "show",
837
+ HIDE: "hide"
838
+ };
839
+ const allowedVisibilityActions = Object.values(VISIBILITY_ACTIONS);
840
+ const VISIBILITY_ACTION_OPTIONS = [{
841
+ label: "Show if",
842
+ value: VISIBILITY_ACTIONS.SHOW
843
+ }, {
844
+ label: "Hide if",
845
+ value: VISIBILITY_ACTIONS.HIDE
846
+ }];
847
+ const VISIBILITY_OPERATORS = {
848
+ IS_TRUE: "is_true",
849
+ IS_FALSE: "is_false",
850
+ EQUALS: "equals",
851
+ NOT_EQUALS: "not_equals",
852
+ CONTAINS: "contains",
853
+ NOT_CONTAINS: "not_contains",
854
+ STARTS_WITH: "starts_with",
855
+ ENDS_WITH: "ends_with",
856
+ GREATER_THAN: "greater_than",
857
+ LESS_THAN: "less_than"
858
+ };
859
+ const allowedVisibilityOperators = Object.values(VISIBILITY_OPERATORS);
860
+ const VISIBILITY_OPERATOR_OPTIONS = [
861
+ {
862
+ label: "Is true",
863
+ value: VISIBILITY_OPERATORS.IS_TRUE
864
+ },
865
+ {
866
+ label: "Is false",
867
+ value: VISIBILITY_OPERATORS.IS_FALSE
868
+ },
869
+ {
870
+ label: "Equals",
871
+ value: VISIBILITY_OPERATORS.EQUALS
872
+ },
873
+ {
874
+ label: "Not equals",
875
+ value: VISIBILITY_OPERATORS.NOT_EQUALS
876
+ },
877
+ {
878
+ label: "Contains",
879
+ value: VISIBILITY_OPERATORS.CONTAINS
880
+ },
881
+ {
882
+ label: "Not contains",
883
+ value: VISIBILITY_OPERATORS.NOT_CONTAINS
884
+ },
885
+ {
886
+ label: "Starts with",
887
+ value: VISIBILITY_OPERATORS.STARTS_WITH
888
+ },
889
+ {
890
+ label: "Ends with",
891
+ value: VISIBILITY_OPERATORS.ENDS_WITH
892
+ },
893
+ {
894
+ label: "Greater than",
895
+ value: VISIBILITY_OPERATORS.GREATER_THAN
896
+ },
897
+ {
898
+ label: "Less than",
899
+ value: VISIBILITY_OPERATORS.LESS_THAN
900
+ }
901
+ ];
902
+ const VISIBILITY_OPERATORS_WITHOUT_VALUE = [VISIBILITY_OPERATORS.IS_TRUE, VISIBILITY_OPERATORS.IS_FALSE];
903
+ const DEFAULT_VISIBILITY_RULE = {
904
+ action: VISIBILITY_ACTIONS.SHOW,
905
+ operator: VISIBILITY_OPERATORS.EQUALS,
906
+ value: "",
907
+ variable: ""
908
+ };
909
+ function getVisibilityValueSupport(operator) {
910
+ return !VISIBILITY_OPERATORS_WITHOUT_VALUE.includes(operator);
911
+ }
912
+ function getVisibilityRule(options) {
913
+ const { action, operator, value, variable } = options;
914
+ const isAllowedAction = allowedVisibilityActions.some((candidate) => {
915
+ return candidate === action;
916
+ });
917
+ const isAllowedOperator = allowedVisibilityOperators.some((candidate) => {
918
+ return candidate === operator;
919
+ });
920
+ if (!(isAllowedAction && isAllowedOperator)) return null;
921
+ return {
922
+ action,
923
+ operator,
924
+ value: getVisibilityValueSupport(operator) ? value ?? "" : "",
925
+ variable: variable ?? ""
926
+ };
927
+ }
928
+ //#endregion
929
+ //#region src/theme.ts
930
+ const DEFAULT_CONTAINER_MAX_WIDTH = 600;
931
+ const BASIC_NODE_THEME = {
932
+ blockquote: {
933
+ borderColor: "#d1d5db",
934
+ borderLeftStyle: "solid",
935
+ borderLeftWidth: "4px",
936
+ color: "#374151",
937
+ fontSize: "15px",
938
+ fontStyle: "italic",
939
+ fontWeight: "500",
940
+ lineHeight: "26px",
941
+ marginBottom: "20px",
942
+ marginLeft: "0",
943
+ marginRight: "0",
944
+ marginTop: "20px",
945
+ paddingLeft: "16px"
946
+ },
947
+ body: { fontFamily: getFontFamilyValue({
948
+ fallbackFontFamily: DEFAULT_FONT.fallbackFontFamily,
949
+ fontFamily: DEFAULT_FONT.fontFamily
950
+ }) },
951
+ bulletList: {
952
+ listStyleType: "disc",
953
+ margin: "0",
954
+ paddingLeft: "26px"
955
+ },
956
+ button: {
957
+ backgroundColor: "#000000",
958
+ borderRadius: "9999px",
959
+ color: "#ffffff",
960
+ fontSize: "14px",
961
+ fontWeight: "500",
962
+ lineHeight: "20px",
963
+ padding: "10px 32px"
964
+ },
965
+ code: {
966
+ borderRadius: "8px",
967
+ fontFamily: "ui-monospace, monospace",
968
+ fontSize: "85%",
969
+ padding: "2px 6px"
970
+ },
971
+ h1: {
972
+ fontSize: "36px",
973
+ fontWeight: "800",
974
+ lineHeight: "40px"
975
+ },
976
+ h2: {
977
+ fontSize: "30px",
978
+ fontWeight: "700",
979
+ lineHeight: "40px"
980
+ },
981
+ h3: {
982
+ fontSize: "24px",
983
+ fontWeight: "600",
984
+ lineHeight: "38px"
985
+ },
986
+ heading: {
987
+ color: "#101828",
988
+ marginBottom: "12px",
989
+ marginTop: "0"
990
+ },
991
+ horizontalRule: {
992
+ border: "none",
993
+ borderTop: "1px solid #eaeaea",
994
+ marginBottom: "32px",
995
+ marginTop: "32px"
996
+ },
997
+ htmlCodeBlock: { marginBottom: "32px" },
998
+ link: {
999
+ color: "#0000ee",
1000
+ textDecoration: "underline"
1001
+ },
1002
+ listItem: {
1003
+ marginBottom: "8px",
1004
+ paddingLeft: "6px"
1005
+ },
1006
+ orderedList: {
1007
+ listStyleType: "decimal",
1008
+ margin: "0",
1009
+ paddingLeft: "26px"
1010
+ },
1011
+ footer: {
1012
+ color: "#64748B",
1013
+ display: "block",
1014
+ fontSize: "14px",
1015
+ fontWeight: "400",
1016
+ lineHeight: "24px",
1017
+ marginBottom: "0",
1018
+ marginTop: "0"
1019
+ },
1020
+ paragraph: {
1021
+ color: "#18181b",
1022
+ fontSize: "14px",
1023
+ lineHeight: "24px"
1024
+ },
1025
+ section: { padding: "8px" }
1026
+ };
1027
+ const MAILY_NODE_THEME = {
1028
+ blockquote: {
1029
+ borderLeftColor: "#d1d5db",
1030
+ borderLeftStyle: "solid",
1031
+ borderLeftWidth: "4px",
1032
+ color: "#374151",
1033
+ fontSize: "15px",
1034
+ fontStyle: "italic",
1035
+ fontWeight: "500",
1036
+ lineHeight: "1.75",
1037
+ marginBottom: "20px",
1038
+ marginLeft: "0",
1039
+ marginRight: "0",
1040
+ marginTop: "20px",
1041
+ paddingLeft: "16px"
1042
+ },
1043
+ body: {
1044
+ backgroundColor: "#ffffff",
1045
+ fontFamily: getFontFamilyValue({
1046
+ fallbackFontFamily: DEFAULT_FONT.fallbackFontFamily,
1047
+ fontFamily: DEFAULT_FONT.fontFamily
1048
+ }),
1049
+ padding: "0"
1050
+ },
1051
+ bulletList: {
1052
+ listStyleType: "disc",
1053
+ marginBottom: "20px",
1054
+ marginLeft: "0",
1055
+ marginRight: "0",
1056
+ marginTop: "0",
1057
+ paddingLeft: "26px"
1058
+ },
1059
+ button: {
1060
+ backgroundColor: "#000000",
1061
+ borderRadius: "9999px",
1062
+ color: "#ffffff",
1063
+ fontSize: "14px",
1064
+ fontWeight: "600",
1065
+ lineHeight: "1.4285714",
1066
+ marginBottom: "20px",
1067
+ padding: "10px 32px"
1068
+ },
1069
+ code: {
1070
+ backgroundColor: "#efefef",
1071
+ borderRadius: "8px",
1072
+ color: "#111827",
1073
+ fontFamily: "ui-monospace, monospace",
1074
+ fontSize: "85%",
1075
+ padding: "2px 6px"
1076
+ },
1077
+ container: {
1078
+ backgroundColor: "#ffffff",
1079
+ maxWidth: `600px`,
1080
+ minWidth: "300px",
1081
+ padding: "8px"
1082
+ },
1083
+ footer: {
1084
+ color: "#64748b",
1085
+ display: "block",
1086
+ fontSize: "14px",
1087
+ fontWeight: "400",
1088
+ lineHeight: "1.7142857",
1089
+ marginBottom: "20px",
1090
+ marginTop: "0"
1091
+ },
1092
+ h1: {
1093
+ fontSize: "36px",
1094
+ fontWeight: "600",
1095
+ lineHeight: "1.1111111"
1096
+ },
1097
+ h2: {
1098
+ fontSize: "30px",
1099
+ fontWeight: "600",
1100
+ lineHeight: "1.3333333"
1101
+ },
1102
+ h3: {
1103
+ fontSize: "24px",
1104
+ fontWeight: "600",
1105
+ lineHeight: "1.6"
1106
+ },
1107
+ heading: {
1108
+ color: "#111827",
1109
+ marginBottom: "12px",
1110
+ marginTop: "0"
1111
+ },
1112
+ horizontalRule: {
1113
+ border: "none",
1114
+ borderTop: "1px solid #eaeaea",
1115
+ marginBottom: "32px",
1116
+ marginTop: "32px"
1117
+ },
1118
+ htmlCodeBlock: { marginBottom: "32px" },
1119
+ link: {
1120
+ color: "#111827",
1121
+ textDecoration: "underline"
1122
+ },
1123
+ listItem: {
1124
+ color: "#d1d5dc",
1125
+ marginBottom: "8px",
1126
+ marginTop: "8px",
1127
+ paddingLeft: "6px"
1128
+ },
1129
+ orderedList: {
1130
+ listStyleType: "decimal",
1131
+ marginBottom: "20px",
1132
+ marginLeft: "0",
1133
+ marginRight: "0",
1134
+ marginTop: "0",
1135
+ paddingLeft: "26px"
1136
+ },
1137
+ paragraph: {
1138
+ color: "#374151",
1139
+ fontSize: "15px",
1140
+ fontWeight: "400",
1141
+ lineHeight: "1.75",
1142
+ marginBottom: "20px",
1143
+ marginTop: "0",
1144
+ MozOsxFontSmoothing: "grayscale",
1145
+ WebkitFontSmoothing: "antialiased"
1146
+ },
1147
+ section: {
1148
+ backgroundColor: "#f7f7f7",
1149
+ border: "2px solid #e2e2e2",
1150
+ borderRadius: "0",
1151
+ marginBottom: "20px",
1152
+ padding: "0"
1153
+ }
1154
+ };
1155
+ function extendNodeTheme(options) {
1156
+ const { extension, preset } = options;
1157
+ return deepMerge(preset, extension);
1158
+ }
1159
+ function getThemeDeclarations(options) {
1160
+ const { attrs, theme, type } = options;
1161
+ const declarations = theme[type];
1162
+ if (type !== MAILY_NODE_TYPES.HEADING) return declarations;
1163
+ const level = typeof attrs?.level === "number" ? theme[`h${attrs.level}`] : void 0;
1164
+ if (!(declarations || level)) return;
1165
+ return {
1166
+ ...declarations,
1167
+ ...level
1168
+ };
1169
+ }
1170
+ //#endregion
1171
+ exports.BASIC_NODE_THEME = BASIC_NODE_THEME;
1172
+ exports.BLOCK_CONTAINER_TYPES = BLOCK_CONTAINER_TYPES;
1173
+ exports.BORDER_STYLES = BORDER_STYLES;
1174
+ exports.BOX_CORNERS = BOX_CORNERS;
1175
+ exports.BOX_SIDES = BOX_SIDES;
1176
+ exports.BUTTON_KINDS = BUTTON_KINDS;
1177
+ exports.DATA_NODE_TYPE_KEY = DATA_NODE_TYPE_KEY;
1178
+ exports.DEFAULT_BORDER_STYLE = DEFAULT_BORDER_STYLE;
1179
+ exports.DEFAULT_BUTTON_KIND = DEFAULT_BUTTON_KIND;
1180
+ exports.DEFAULT_CONTAINER_MAX_WIDTH = DEFAULT_CONTAINER_MAX_WIDTH;
1181
+ exports.DEFAULT_CONTAINER_WIDTH_PIXELS = DEFAULT_CONTAINER_WIDTH_PIXELS;
1182
+ exports.DEFAULT_FONT = DEFAULT_FONT;
1183
+ exports.DEFAULT_FONT_FALLBACK = DEFAULT_FONT_FALLBACK;
1184
+ exports.DEFAULT_FONT_FAMILIES = DEFAULT_FONT_FAMILIES;
1185
+ exports.DEFAULT_FONT_FAMILY = DEFAULT_FONT_FAMILY;
1186
+ exports.DEFAULT_HTML_CODE_BLOCK_TAB = DEFAULT_HTML_CODE_BLOCK_TAB;
1187
+ exports.DEFAULT_TEXT_ALIGN = DEFAULT_TEXT_ALIGN;
1188
+ exports.DEFAULT_TEXT_DIRECTION = DEFAULT_TEXT_DIRECTION;
1189
+ exports.DEFAULT_VARIABLE_ATTRIBUTES = DEFAULT_VARIABLE_ATTRIBUTES;
1190
+ exports.DEFAULT_VARIABLE_END_TRIGGER = DEFAULT_VARIABLE_END_TRIGGER;
1191
+ exports.DEFAULT_VARIABLE_START_TRIGGER = DEFAULT_VARIABLE_START_TRIGGER;
1192
+ exports.DEFAULT_VISIBILITY_RULE = DEFAULT_VISIBILITY_RULE;
1193
+ exports.FONT_SIZE_PRESETS = FONT_SIZE_PRESETS;
1194
+ exports.FONT_STYLES = FONT_STYLES;
1195
+ exports.FONT_WEIGHTS = FONT_WEIGHTS;
1196
+ exports.HTML_CODE_BLOCK_TABS = HTML_CODE_BLOCK_TABS;
1197
+ exports.LINE_HEIGHT_PRESETS = LINE_HEIGHT_PRESETS;
1198
+ exports.MAILY_BUG_REPORT_URL = MAILY_BUG_REPORT_URL;
1199
+ exports.MAILY_ERROR_PREFIX = MAILY_ERROR_PREFIX;
1200
+ exports.MAILY_EXTENSION_TYPES = MAILY_EXTENSION_TYPES;
1201
+ exports.MAILY_MARK_TYPES = MAILY_MARK_TYPES;
1202
+ exports.MAILY_NODE_THEME = MAILY_NODE_THEME;
1203
+ exports.MAILY_NODE_TYPES = MAILY_NODE_TYPES;
1204
+ exports.MARGIN_BOTTOM_ABSORBER_TYPES = MARGIN_BOTTOM_ABSORBER_TYPES;
1205
+ exports.MARGIN_TOP_ABSORBER_TYPES = MARGIN_TOP_ABSORBER_TYPES;
1206
+ exports.MAX_IMAGE_WIDTH_PERCENTAGE = MAX_IMAGE_WIDTH_PERCENTAGE;
1207
+ exports.MIN_IMAGE_WIDTH_PERCENTAGE = MIN_IMAGE_WIDTH_PERCENTAGE;
1208
+ exports.TEXT_ALIGNMENTS = TEXT_ALIGNMENTS;
1209
+ exports.TEXT_DIRECTIONS = TEXT_DIRECTIONS;
1210
+ exports.VISIBILITY_ACTIONS = VISIBILITY_ACTIONS;
1211
+ exports.VISIBILITY_ACTION_OPTIONS = VISIBILITY_ACTION_OPTIONS;
1212
+ exports.VISIBILITY_OPERATORS = VISIBILITY_OPERATORS;
1213
+ exports.VISIBILITY_OPERATOR_OPTIONS = VISIBILITY_OPERATOR_OPTIONS;
1214
+ exports.absoluteFromPercentage = absoluteFromPercentage;
1215
+ exports.allowedFallbackFonts = allowedFallbackFonts;
1216
+ exports.allowedMarkTypes = allowedMarkTypes;
1217
+ exports.allowedNodeTypes = allowedNodeTypes;
1218
+ exports.buildDocFromVariableText = buildDocFromVariableText;
1219
+ exports.clamp = clamp;
1220
+ exports.clampImageWidthPercentage = clampImageWidthPercentage;
1221
+ exports.deepMerge = deepMerge;
1222
+ exports.deserializeVariableFromText = deserializeVariableFromText;
1223
+ exports.expandInlineStyles = expandInlineStyles;
1224
+ exports.extendNodeTheme = extendNodeTheme;
1225
+ exports.getBorderParts = getBorderParts;
1226
+ exports.getBoxCorners = getBoxCorners;
1227
+ exports.getBoxSides = getBoxSides;
1228
+ exports.getColumnWidth = getColumnWidth;
1229
+ exports.getColumnWidthPercent = getColumnWidthPercent;
1230
+ exports.getColumnWidthValue = getColumnWidthValue;
1231
+ exports.getCssDirection = getCssDirection;
1232
+ exports.getFontFaceStyle = getFontFaceStyle;
1233
+ exports.getFontFamilyNames = getFontFamilyNames;
1234
+ exports.getFontFamilyValue = getFontFamilyValue;
1235
+ exports.getSuppressedMargins = getSuppressedMargins;
1236
+ exports.getThemeDeclarations = getThemeDeclarations;
1237
+ exports.getVariableSegments = getVariableSegments;
1238
+ exports.getVisibilityRule = getVisibilityRule;
1239
+ exports.getVisibilityValueSupport = getVisibilityValueSupport;
1240
+ exports.hasVariableInText = hasVariableInText;
1241
+ exports.invariant = invariant;
1242
+ exports.is = is;
1243
+ exports.isAllowedBorderStyle = isAllowedBorderStyle;
1244
+ exports.isAllowedButtonKind = isAllowedButtonKind;
1245
+ exports.isAllowedTextAlignment = isAllowedTextAlignment;
1246
+ exports.isDef = isDef;
1247
+ exports.isMergeableObject = isMergeableObject;
1248
+ exports.isObject = isObject;
1249
+ exports.loadFont = loadFont;
1250
+ exports.mergeInlineStyles = mergeInlineStyles;
1251
+ exports.noop = noop;
1252
+ exports.parseInlineStyles = parseInlineStyles;
1253
+ exports.parseWidthToPercentage = parseWidthToPercentage;
1254
+ exports.percentage = percentage;
1255
+ exports.roundTo = roundTo;
1256
+ exports.serializeVariableToText = serializeVariableToText;
1257
+ exports.stringifyInlineStyles = stringifyInlineStyles;
1258
+ exports.toBoxCorners = toBoxCorners;
1259
+ exports.toBoxSides = toBoxSides;
1260
+
1261
+ //# sourceMappingURL=index.cjs.map