@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/LICENSE +5 -5
- package/dist/index.cjs +1261 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +836 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +818 -96
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1129 -160
- package/dist/index.mjs.map +1 -1
- package/package.json +32 -26
- package/readme.md +47 -11
- package/dist/index.d.ts +0 -114
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -213
- package/dist/index.js.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,114 +1,836 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Properties } from "csstype";
|
|
2
|
+
//#region src/alignment.d.ts
|
|
3
|
+
declare const TEXT_ALIGNMENTS: {
|
|
4
|
+
readonly LEFT: 'left';
|
|
5
|
+
readonly CENTER: 'center';
|
|
6
|
+
readonly RIGHT: 'right';
|
|
7
|
+
};
|
|
8
|
+
type AllowedTextAlignment = (typeof TEXT_ALIGNMENTS)[keyof typeof TEXT_ALIGNMENTS];
|
|
9
|
+
declare const DEFAULT_TEXT_ALIGN: AllowedTextAlignment;
|
|
10
|
+
declare function isAllowedTextAlignment(value: unknown): value is AllowedTextAlignment;
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/style.d.ts
|
|
13
|
+
type InlineStyle = Record<string, string>;
|
|
14
|
+
declare function parseInlineStyles(style: string): InlineStyle;
|
|
15
|
+
declare function stringifyInlineStyles(style: InlineStyle): string;
|
|
16
|
+
declare function expandInlineStyles(style: InlineStyle): InlineStyle;
|
|
17
|
+
declare function mergeInlineStyles(under: InlineStyle, over: InlineStyle): InlineStyle;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/border.d.ts
|
|
20
|
+
declare const BORDER_STYLES: {
|
|
21
|
+
readonly SOLID: 'solid';
|
|
22
|
+
readonly DASHED: 'dashed';
|
|
23
|
+
readonly DOTTED: 'dotted';
|
|
24
|
+
};
|
|
25
|
+
type AllowedBorderStyle = (typeof BORDER_STYLES)[keyof typeof BORDER_STYLES];
|
|
26
|
+
declare const DEFAULT_BORDER_STYLE: AllowedBorderStyle;
|
|
27
|
+
declare function isAllowedBorderStyle(value: unknown): value is AllowedBorderStyle;
|
|
28
|
+
type BorderParts = {
|
|
29
|
+
color: string | undefined;
|
|
30
|
+
style: string | undefined;
|
|
31
|
+
width: string | undefined;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Reads the width, style and colour of a border from the `border` shorthand,
|
|
35
|
+
* letting any longhand already in the style win. The shorthand lists its
|
|
36
|
+
* parts in any order, so each is recognised by shape rather than position.
|
|
37
|
+
*/
|
|
38
|
+
declare function getBorderParts(style: InlineStyle): BorderParts;
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/box.d.ts
|
|
41
|
+
declare const BOX_SIDES: readonly ['top', 'right', 'bottom', 'left'];
|
|
42
|
+
type BoxSide = (typeof BOX_SIDES)[number];
|
|
43
|
+
type BoxSideValues = Record<BoxSide, number>;
|
|
44
|
+
declare const BOX_CORNERS: readonly ['topLeft', 'topRight', 'bottomRight', 'bottomLeft'];
|
|
45
|
+
type BoxCorner = (typeof BOX_CORNERS)[number];
|
|
46
|
+
type BoxCornerValues = Record<BoxCorner, number>;
|
|
47
|
+
declare function getBoxSides(style: InlineStyle, property: string): BoxSideValues;
|
|
48
|
+
declare function toBoxSides(property: string, values: BoxSideValues): Record<string, string | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Radius shorthands run clockwise from the top-left corner, and repeat the
|
|
51
|
+
* same way box shorthands do.
|
|
52
|
+
*/
|
|
53
|
+
declare function getBoxCorners(style: InlineStyle, property: string): BoxCornerValues;
|
|
54
|
+
declare function toBoxCorners(property: string, values: BoxCornerValues): Record<string, string | null>;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/button.d.ts
|
|
57
|
+
/**
|
|
58
|
+
* Button layout kinds.
|
|
59
|
+
* "tight" renders the button at its content width,
|
|
60
|
+
* "full-width" stretches it to fill the container.
|
|
61
|
+
*/
|
|
62
|
+
declare const BUTTON_KINDS: {
|
|
63
|
+
readonly TIGHT: 'tight';
|
|
64
|
+
readonly FULL_WIDTH: 'full-width';
|
|
65
|
+
};
|
|
66
|
+
type AllowedButtonKind = (typeof BUTTON_KINDS)[keyof typeof BUTTON_KINDS];
|
|
67
|
+
declare const DEFAULT_BUTTON_KIND: AllowedButtonKind;
|
|
68
|
+
declare function isAllowedButtonKind(value: unknown): value is AllowedButtonKind;
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/column.d.ts
|
|
71
|
+
type ColumnWidth = number | string;
|
|
72
|
+
declare function getColumnWidth(value: string | null | undefined): ColumnWidth | null;
|
|
73
|
+
declare function getColumnWidthValue(width: ColumnWidth): string;
|
|
74
|
+
type ColumnWidthPercentOptions = {
|
|
75
|
+
containerWidth: number;
|
|
76
|
+
width: ColumnWidth | null | undefined;
|
|
77
|
+
};
|
|
78
|
+
declare function getColumnWidthPercent(options: ColumnWidthPercentOptions): number | null;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/constants.d.ts
|
|
81
|
+
declare const DATA_NODE_TYPE_KEY = "data-node-type";
|
|
82
|
+
declare const MAILY_ERROR_PREFIX = "[Maily Error]";
|
|
83
|
+
declare const MAILY_BUG_REPORT_URL = "https://github.com/arikchakma/maily.to/issues/new";
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/font.d.ts
|
|
86
|
+
/**
|
|
87
|
+
* List of allowed fallback font families. These are system fonts or
|
|
88
|
+
* generic font families that serve as fallbacks when a web font
|
|
89
|
+
* fails to load.
|
|
90
|
+
*/
|
|
91
|
+
declare const allowedFallbackFonts: readonly ['Arial', 'Helvetica', 'Verdana', 'Georgia', 'Times New Roman', 'serif', 'sans-serif', 'monospace', 'cursive', 'fantasy'];
|
|
6
92
|
type FallbackFont = (typeof allowedFallbackFonts)[number];
|
|
7
|
-
declare const allowedFontFormats: readonly [
|
|
93
|
+
declare const allowedFontFormats: readonly ['woff', 'woff2', 'truetype', 'opentype', 'embedded-opentype', 'svg'];
|
|
8
94
|
type FontFormat = (typeof allowedFontFormats)[number];
|
|
9
|
-
type
|
|
10
|
-
|
|
95
|
+
type FontStyle = Properties['fontStyle'];
|
|
96
|
+
/**
|
|
97
|
+
* Configuration for a font used in the editor or renderer.
|
|
98
|
+
* Specifies the primary font family, a fallback, and an optional
|
|
99
|
+
* web font URL with its format for @font-face loading.
|
|
100
|
+
*/
|
|
11
101
|
interface FontProps {
|
|
12
|
-
/** The font you want to use. NOTE: Do not insert multiple fonts here, use fallbackFontFamily for that */
|
|
13
102
|
fontFamily: string;
|
|
14
|
-
/** An array is possible, but the order of the array is the priority order */
|
|
15
103
|
fallbackFontFamily: FallbackFont;
|
|
16
|
-
/** Not all clients support web fonts. For support check: https://www.caniemail.com/features/css-at-font-face/ */
|
|
17
104
|
webFont?: {
|
|
18
105
|
url: string;
|
|
19
106
|
format: FontFormat;
|
|
20
107
|
};
|
|
21
|
-
/** Default: 'normal' */
|
|
22
108
|
fontStyle?: FontStyle;
|
|
23
|
-
|
|
24
|
-
fontWeight?: FontWeight;
|
|
25
|
-
}
|
|
26
|
-
interface BaseThemeOptions {
|
|
27
|
-
container?: Partial<Pick<CSS$1.Properties, "backgroundColor" | "maxWidth" | "minWidth" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "borderRadius" | "borderWidth" | "borderColor">>;
|
|
28
|
-
body?: Partial<Pick<CSS$1.Properties, "backgroundColor" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft">>;
|
|
29
|
-
button?: Partial<Pick<CSS$1.Properties, "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "backgroundColor" | "color">>;
|
|
30
|
-
link?: Partial<Pick<CSS$1.Properties, "color">>;
|
|
31
|
-
font?: Pick<FontProps, "fontFamily" | "fallbackFontFamily" | "webFont"> | null;
|
|
109
|
+
fontWeight?: number;
|
|
32
110
|
}
|
|
33
111
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
interface EditorThemeOptions extends BaseThemeOptions {}
|
|
39
|
-
/**
|
|
40
|
-
* The theme options for the renderer.
|
|
41
|
-
* currently, we don't allow any customizations for the colors in the editor.
|
|
42
|
-
* that's why we have a separate theme for the renderer.
|
|
43
|
-
*/
|
|
44
|
-
interface RendererThemeOptions extends BaseThemeOptions {
|
|
45
|
-
colors?: Partial<{
|
|
46
|
-
heading: string;
|
|
47
|
-
paragraph: string;
|
|
48
|
-
horizontal: string;
|
|
49
|
-
footer: string;
|
|
50
|
-
blockquoteBorder: string;
|
|
51
|
-
codeBackground: string;
|
|
52
|
-
codeText: string;
|
|
53
|
-
linkCardTitle: string;
|
|
54
|
-
linkCardDescription: string;
|
|
55
|
-
linkCardBadgeText: string;
|
|
56
|
-
linkCardBadgeBackground: string;
|
|
57
|
-
linkCardSubTitle: string;
|
|
58
|
-
}>;
|
|
59
|
-
fontSize?: Partial<{
|
|
60
|
-
paragraph: Partial<{
|
|
61
|
-
size: string;
|
|
62
|
-
lineHeight: string;
|
|
63
|
-
}>;
|
|
64
|
-
footer: Partial<{
|
|
65
|
-
size: string;
|
|
66
|
-
lineHeight: string;
|
|
67
|
-
}>;
|
|
68
|
-
}>;
|
|
69
|
-
}
|
|
112
|
+
* Default font configuration: Inter with sans-serif fallback,
|
|
113
|
+
* loaded from the Maily CDN as woff2.
|
|
114
|
+
*/
|
|
70
115
|
declare const DEFAULT_FONT: FontProps;
|
|
71
|
-
declare
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
declare
|
|
77
|
-
interface Properties {
|
|
78
|
-
[index: `--mly-${string}`]: any;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
116
|
+
declare function getFontFamilyNames(value: string): string[];
|
|
117
|
+
type FontFamilyValueOptions = {
|
|
118
|
+
fallbackFontFamily?: string | null;
|
|
119
|
+
fontFamily?: string | null;
|
|
120
|
+
};
|
|
121
|
+
declare function getFontFamilyValue(options: FontFamilyValueOptions): string;
|
|
81
122
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
*/
|
|
88
|
-
declare function getVariableValue(name: `--mly-${string}`, value: any): CSS.Properties;
|
|
123
|
+
* Generates a @font-face CSS rule string for the given font configuration.
|
|
124
|
+
* Includes the font family, style, weight, MSO fallback, and web font
|
|
125
|
+
* source URL when available.
|
|
126
|
+
*/
|
|
127
|
+
declare function getFontFaceStyle(font: FontProps): string;
|
|
89
128
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* ```ts
|
|
95
|
-
* const theme = {
|
|
96
|
-
* body: {
|
|
97
|
-
* backgroundColor: 'red',
|
|
98
|
-
* },
|
|
99
|
-
* };
|
|
100
|
-
*
|
|
101
|
-
* const cssVariables = getCssVariables(theme);
|
|
102
|
-
*
|
|
103
|
-
* console.log(cssVariables);
|
|
104
|
-
* // { '--mly-body-background-color': 'red' }
|
|
105
|
-
*/
|
|
106
|
-
declare function getMailyCssVariables(theme: EditorThemeOptions): CSS.Properties;
|
|
129
|
+
* Injects a @font-face style element into the document head to load
|
|
130
|
+
* the given font. Only works in browser environments.
|
|
131
|
+
*/
|
|
132
|
+
declare function loadFont(font: FontProps): void;
|
|
107
133
|
//#endregion
|
|
108
|
-
//#region src/font.d.ts
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
134
|
+
//#region src/font-style.d.ts
|
|
135
|
+
/**
|
|
136
|
+
* Entry for the font picker dropdown. Web fonts include a CDN URL
|
|
137
|
+
* and format for @font-face loading; system fonts omit the webFont field.
|
|
138
|
+
*/
|
|
139
|
+
type FontFamilyItem = {
|
|
140
|
+
fontFamily: string;
|
|
141
|
+
label?: string;
|
|
142
|
+
webFont?: {
|
|
143
|
+
url: string;
|
|
144
|
+
format: FontFormat;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Built-in font options served from the Maily CDN. System fonts
|
|
149
|
+
* (Arial, Helvetica, etc.) are included without a webFont field.
|
|
150
|
+
*/
|
|
151
|
+
declare const DEFAULT_FONT_FAMILIES: FontFamilyItem[];
|
|
152
|
+
type FontFamily = string;
|
|
153
|
+
declare const FONT_STYLES: {
|
|
154
|
+
readonly NORMAL: 'normal';
|
|
155
|
+
readonly ITALIC: 'italic';
|
|
156
|
+
};
|
|
157
|
+
type FontStyleValue = (typeof FONT_STYLES)[keyof typeof FONT_STYLES];
|
|
158
|
+
declare const FONT_SIZE_PRESETS: readonly [{
|
|
159
|
+
readonly value: 12;
|
|
160
|
+
readonly label: 'Small';
|
|
161
|
+
}, {
|
|
162
|
+
readonly value: 14;
|
|
163
|
+
readonly label: 'Normal';
|
|
164
|
+
}, {
|
|
165
|
+
readonly value: 16;
|
|
166
|
+
readonly label: 'Medium';
|
|
167
|
+
}, {
|
|
168
|
+
readonly value: 18;
|
|
169
|
+
readonly label: 'Large';
|
|
170
|
+
}, {
|
|
171
|
+
readonly value: 24;
|
|
172
|
+
readonly label: 'XL';
|
|
173
|
+
}, {
|
|
174
|
+
readonly value: 32;
|
|
175
|
+
readonly label: '2XL';
|
|
176
|
+
}];
|
|
177
|
+
declare const LINE_HEIGHT_PRESETS: readonly [{
|
|
178
|
+
readonly value: 1;
|
|
179
|
+
readonly label: 'Tight';
|
|
180
|
+
}, {
|
|
181
|
+
readonly value: 1.25;
|
|
182
|
+
readonly label: 'Snug';
|
|
183
|
+
}, {
|
|
184
|
+
readonly value: 1.5;
|
|
185
|
+
readonly label: 'Normal';
|
|
186
|
+
}, {
|
|
187
|
+
readonly value: 1.75;
|
|
188
|
+
readonly label: 'Relaxed';
|
|
189
|
+
}, {
|
|
190
|
+
readonly value: 2;
|
|
191
|
+
readonly label: 'Loose';
|
|
192
|
+
}];
|
|
193
|
+
declare const DEFAULT_FONT_FAMILY: FontFamily;
|
|
194
|
+
declare const DEFAULT_FONT_FALLBACK: FallbackFont;
|
|
195
|
+
//#endregion
|
|
196
|
+
//#region src/font-weight.d.ts
|
|
197
|
+
/**
|
|
198
|
+
* Numeric font weight values mapped to semantic names.
|
|
199
|
+
* Normal (400), Medium (500), Semibold (600), Bold (700), Extra Bold (800).
|
|
200
|
+
*/
|
|
201
|
+
declare const FONT_WEIGHTS: {
|
|
202
|
+
readonly NORMAL: 400;
|
|
203
|
+
readonly MEDIUM: 500;
|
|
204
|
+
readonly SEMIBOLD: 600;
|
|
205
|
+
readonly BOLD: 700;
|
|
206
|
+
readonly EXTRA_BOLD: 800;
|
|
207
|
+
};
|
|
208
|
+
type FontWeight = (typeof FONT_WEIGHTS)[keyof typeof FONT_WEIGHTS];
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/function.d.ts
|
|
211
|
+
declare function noop(): void;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/html-code-block.d.ts
|
|
214
|
+
/**
|
|
215
|
+
* Tab options for the HTML code block node.
|
|
216
|
+
* "code" shows the raw HTML source, "preview" renders it visually.
|
|
217
|
+
*/
|
|
218
|
+
declare const HTML_CODE_BLOCK_TABS: {
|
|
219
|
+
readonly CODE: 'code';
|
|
220
|
+
readonly PREVIEW: 'preview';
|
|
221
|
+
};
|
|
222
|
+
type AllowedHtmlCodeBlockTab = (typeof HTML_CODE_BLOCK_TABS)[keyof typeof HTML_CODE_BLOCK_TABS];
|
|
223
|
+
declare const DEFAULT_HTML_CODE_BLOCK_TAB: AllowedHtmlCodeBlockTab;
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/image.d.ts
|
|
226
|
+
type ImageWidth = number | string;
|
|
227
|
+
declare const MIN_IMAGE_WIDTH_PERCENTAGE = 5;
|
|
228
|
+
declare const MAX_IMAGE_WIDTH_PERCENTAGE = 100;
|
|
229
|
+
declare const DEFAULT_CONTAINER_WIDTH_PIXELS = 600;
|
|
230
|
+
declare function parseWidthToPercentage(width: ImageWidth | null | undefined, containerWidthPixels?: number): number;
|
|
231
|
+
declare function clampImageWidthPercentage(width: number): number;
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/invariant.d.ts
|
|
234
|
+
declare function invariant(value: boolean, message?: string): asserts value;
|
|
235
|
+
declare function invariant<T>(value: T | null | undefined, message?: string): asserts value is T;
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/mark.d.ts
|
|
238
|
+
declare const MAILY_MARK_TYPES: {
|
|
239
|
+
readonly BOLD: 'bold';
|
|
240
|
+
readonly ITALIC: 'italic';
|
|
241
|
+
readonly STRIKE: 'strike';
|
|
242
|
+
readonly UNDERLINE: 'underline';
|
|
243
|
+
readonly LINK: 'link';
|
|
244
|
+
readonly CODE: 'code';
|
|
245
|
+
readonly TEXT_STYLE: 'textStyle';
|
|
246
|
+
readonly HIGHLIGHT: 'highlight';
|
|
247
|
+
readonly SPAN: 'span';
|
|
248
|
+
};
|
|
249
|
+
declare const allowedMarkTypes: ("bold" | "code" | "highlight" | "italic" | "link" | "span" | "strike" | "textStyle" | "underline")[];
|
|
250
|
+
type MailyMarkType = (typeof MAILY_MARK_TYPES)[keyof typeof MAILY_MARK_TYPES];
|
|
251
|
+
type MarkStyleAttributes = {
|
|
252
|
+
style?: string | null;
|
|
253
|
+
};
|
|
254
|
+
type BaseMailyMark = {
|
|
255
|
+
attrs?: MarkStyleAttributes & Record<string, unknown>;
|
|
256
|
+
type: MailyMarkType;
|
|
257
|
+
};
|
|
258
|
+
type BoldMark = BaseMailyMark & {
|
|
259
|
+
type: typeof MAILY_MARK_TYPES.BOLD;
|
|
260
|
+
};
|
|
261
|
+
type ItalicMark = BaseMailyMark & {
|
|
262
|
+
type: typeof MAILY_MARK_TYPES.ITALIC;
|
|
263
|
+
};
|
|
264
|
+
type StrikeMark = BaseMailyMark & {
|
|
265
|
+
type: typeof MAILY_MARK_TYPES.STRIKE;
|
|
266
|
+
};
|
|
267
|
+
type UnderlineMark = BaseMailyMark & {
|
|
268
|
+
type: typeof MAILY_MARK_TYPES.UNDERLINE;
|
|
269
|
+
};
|
|
270
|
+
type LinkAttributes = MarkStyleAttributes & {
|
|
271
|
+
class?: string | null;
|
|
272
|
+
href: string;
|
|
273
|
+
rel?: string | null;
|
|
274
|
+
target?: string | null;
|
|
275
|
+
title?: string | null;
|
|
276
|
+
};
|
|
277
|
+
type LinkMark = BaseMailyMark & {
|
|
278
|
+
attrs: LinkAttributes;
|
|
279
|
+
type: typeof MAILY_MARK_TYPES.LINK;
|
|
280
|
+
};
|
|
281
|
+
type CodeMark = BaseMailyMark & {
|
|
282
|
+
type: typeof MAILY_MARK_TYPES.CODE;
|
|
283
|
+
};
|
|
284
|
+
type TextStyleAttributes = MarkStyleAttributes & {
|
|
285
|
+
color: string;
|
|
286
|
+
};
|
|
287
|
+
type TextStyleMark = BaseMailyMark & {
|
|
288
|
+
attrs: TextStyleAttributes;
|
|
289
|
+
type: typeof MAILY_MARK_TYPES.TEXT_STYLE;
|
|
290
|
+
};
|
|
291
|
+
type HighlightAttributes = MarkStyleAttributes & {
|
|
292
|
+
color: string;
|
|
293
|
+
};
|
|
294
|
+
type HighlightMark = BaseMailyMark & {
|
|
295
|
+
attrs: HighlightAttributes;
|
|
296
|
+
type: typeof MAILY_MARK_TYPES.HIGHLIGHT;
|
|
297
|
+
};
|
|
298
|
+
type SpanMark = BaseMailyMark & {
|
|
299
|
+
attrs?: MarkStyleAttributes;
|
|
300
|
+
type: typeof MAILY_MARK_TYPES.SPAN;
|
|
301
|
+
};
|
|
302
|
+
type AnyMailyMark = BoldMark | ItalicMark | StrikeMark | UnderlineMark | LinkMark | CodeMark | TextStyleMark | HighlightMark | SpanMark;
|
|
303
|
+
//#endregion
|
|
304
|
+
//#region src/direction.d.ts
|
|
305
|
+
declare const TEXT_DIRECTIONS: {
|
|
306
|
+
readonly LTR: 'ltr';
|
|
307
|
+
readonly RTL: 'rtl';
|
|
308
|
+
readonly AUTO: 'auto';
|
|
309
|
+
};
|
|
310
|
+
type TextDirection = (typeof TEXT_DIRECTIONS)[keyof typeof TEXT_DIRECTIONS];
|
|
311
|
+
declare const DEFAULT_TEXT_DIRECTION: TextDirection;
|
|
312
|
+
declare function getCssDirection(dir: TextDirection | null | undefined): {
|
|
313
|
+
direction: "ltr" | "rtl";
|
|
314
|
+
} | {
|
|
315
|
+
direction?: undefined;
|
|
316
|
+
};
|
|
317
|
+
//#endregion
|
|
318
|
+
//#region src/theme.d.ts
|
|
319
|
+
type NodeThemeOptions = {
|
|
320
|
+
blockquote?: InlineStyle;
|
|
321
|
+
body?: InlineStyle;
|
|
322
|
+
bulletList?: InlineStyle;
|
|
323
|
+
button?: InlineStyle;
|
|
324
|
+
code?: InlineStyle;
|
|
325
|
+
container?: InlineStyle;
|
|
326
|
+
footer?: InlineStyle;
|
|
327
|
+
h1?: InlineStyle;
|
|
328
|
+
h2?: InlineStyle;
|
|
329
|
+
h3?: InlineStyle;
|
|
330
|
+
heading?: InlineStyle;
|
|
331
|
+
horizontalRule?: InlineStyle;
|
|
332
|
+
htmlCodeBlock?: InlineStyle;
|
|
333
|
+
link?: InlineStyle;
|
|
334
|
+
listItem?: InlineStyle;
|
|
335
|
+
orderedList?: InlineStyle;
|
|
336
|
+
paragraph?: InlineStyle;
|
|
337
|
+
section?: InlineStyle;
|
|
338
|
+
table?: InlineStyle;
|
|
339
|
+
tableCell?: InlineStyle;
|
|
340
|
+
tableRow?: InlineStyle;
|
|
341
|
+
};
|
|
342
|
+
declare const DEFAULT_CONTAINER_MAX_WIDTH = 600;
|
|
343
|
+
declare const BASIC_NODE_THEME: NodeThemeOptions;
|
|
344
|
+
declare const MAILY_NODE_THEME: NodeThemeOptions;
|
|
345
|
+
type ExtendNodeThemeOptions = {
|
|
346
|
+
extension: NodeThemeOptions;
|
|
347
|
+
preset: NodeThemeOptions;
|
|
348
|
+
};
|
|
349
|
+
declare function extendNodeTheme(options: ExtendNodeThemeOptions): NodeThemeOptions;
|
|
350
|
+
type ThemeDeclarationsOptions = {
|
|
351
|
+
attrs?: Record<string, unknown> | undefined;
|
|
352
|
+
theme: NodeThemeOptions;
|
|
353
|
+
type: string;
|
|
354
|
+
};
|
|
355
|
+
declare function getThemeDeclarations(options: ThemeDeclarationsOptions): InlineStyle | undefined;
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/visibility.d.ts
|
|
358
|
+
declare const VISIBILITY_ACTIONS: {
|
|
359
|
+
readonly SHOW: 'show';
|
|
360
|
+
readonly HIDE: 'hide';
|
|
361
|
+
};
|
|
362
|
+
type AllowedVisibilityAction = (typeof VISIBILITY_ACTIONS)[keyof typeof VISIBILITY_ACTIONS];
|
|
363
|
+
declare const VISIBILITY_ACTION_OPTIONS: {
|
|
364
|
+
label: string;
|
|
365
|
+
value: AllowedVisibilityAction;
|
|
366
|
+
}[];
|
|
367
|
+
declare const VISIBILITY_OPERATORS: {
|
|
368
|
+
readonly IS_TRUE: 'is_true';
|
|
369
|
+
readonly IS_FALSE: 'is_false';
|
|
370
|
+
readonly EQUALS: 'equals';
|
|
371
|
+
readonly NOT_EQUALS: 'not_equals';
|
|
372
|
+
readonly CONTAINS: 'contains';
|
|
373
|
+
readonly NOT_CONTAINS: 'not_contains';
|
|
374
|
+
readonly STARTS_WITH: 'starts_with';
|
|
375
|
+
readonly ENDS_WITH: 'ends_with';
|
|
376
|
+
readonly GREATER_THAN: 'greater_than';
|
|
377
|
+
readonly LESS_THAN: 'less_than';
|
|
378
|
+
};
|
|
379
|
+
type AllowedVisibilityOperator = (typeof VISIBILITY_OPERATORS)[keyof typeof VISIBILITY_OPERATORS];
|
|
380
|
+
declare const VISIBILITY_OPERATOR_OPTIONS: {
|
|
381
|
+
label: string;
|
|
382
|
+
value: AllowedVisibilityOperator;
|
|
383
|
+
}[];
|
|
384
|
+
type VisibilityRule = {
|
|
385
|
+
action: AllowedVisibilityAction;
|
|
386
|
+
operator: AllowedVisibilityOperator;
|
|
387
|
+
value: string;
|
|
388
|
+
variable: string;
|
|
389
|
+
};
|
|
390
|
+
type WithVisibilityAttrs = {
|
|
391
|
+
visibilityRule?: VisibilityRule | null;
|
|
392
|
+
};
|
|
393
|
+
declare const DEFAULT_VISIBILITY_RULE: VisibilityRule;
|
|
394
|
+
declare function getVisibilityValueSupport(operator: AllowedVisibilityOperator): boolean;
|
|
395
|
+
type VisibilityRuleOptions = {
|
|
396
|
+
action: string | null | undefined;
|
|
397
|
+
operator: string | null | undefined;
|
|
398
|
+
value: string | null | undefined;
|
|
399
|
+
variable: string | null | undefined;
|
|
400
|
+
};
|
|
401
|
+
declare function getVisibilityRule(options: VisibilityRuleOptions): VisibilityRule | null;
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/node.d.ts
|
|
404
|
+
declare const MAILY_NODE_TYPES: {
|
|
405
|
+
readonly DOCUMENT: 'doc';
|
|
406
|
+
readonly BODY: 'body';
|
|
407
|
+
readonly CONTAINER: 'container';
|
|
408
|
+
readonly SECTION: 'section';
|
|
409
|
+
readonly COLUMNS: 'columns';
|
|
410
|
+
readonly COLUMN: 'column';
|
|
411
|
+
readonly IMAGE: 'image';
|
|
412
|
+
readonly INLINE_IMAGE: 'inlineImage';
|
|
413
|
+
readonly INLINE_SPAN: 'inlineSpan';
|
|
414
|
+
readonly SPACER: 'spacer';
|
|
415
|
+
readonly BUTTON: 'button';
|
|
416
|
+
readonly FOOTER: 'footer';
|
|
417
|
+
readonly PARAGRAPH: 'paragraph';
|
|
418
|
+
readonly HEADING: 'heading';
|
|
419
|
+
readonly BLOCKQUOTE: 'blockquote';
|
|
420
|
+
readonly HORIZONTAL_RULE: 'horizontalRule';
|
|
421
|
+
readonly HTML_CODE_BLOCK: 'htmlCodeBlock';
|
|
422
|
+
readonly REPEAT: 'repeat';
|
|
423
|
+
readonly HARD_BREAK: 'hardBreak';
|
|
424
|
+
readonly BULLET_LIST: 'bulletList';
|
|
425
|
+
readonly ORDERED_LIST: 'orderedList';
|
|
426
|
+
readonly LIST_ITEM: 'listItem';
|
|
427
|
+
readonly TEXT: 'text';
|
|
428
|
+
readonly VARIABLE: 'variable';
|
|
429
|
+
readonly TABLE: 'table';
|
|
430
|
+
readonly TABLE_ROW: 'tableRow';
|
|
431
|
+
readonly TABLE_CELL: 'tableCell';
|
|
432
|
+
readonly TABLE_HEADER: 'tableHeader';
|
|
433
|
+
readonly LINK_CARD: 'linkCard';
|
|
434
|
+
};
|
|
435
|
+
declare const MAILY_EXTENSION_TYPES: {
|
|
436
|
+
readonly STYLE: 'style';
|
|
437
|
+
readonly THEME: 'theme';
|
|
438
|
+
readonly VISIBILITY: 'visibility';
|
|
439
|
+
};
|
|
440
|
+
declare const allowedNodeTypes: ("blockquote" | "body" | "bulletList" | "button" | "column" | "columns" | "container" | "doc" | "footer" | "hardBreak" | "heading" | "horizontalRule" | "htmlCodeBlock" | "image" | "inlineImage" | "inlineSpan" | "linkCard" | "listItem" | "orderedList" | "paragraph" | "repeat" | "section" | "spacer" | "table" | "tableCell" | "tableHeader" | "tableRow" | "text" | "variable")[];
|
|
441
|
+
type MailyNodeType = (typeof MAILY_NODE_TYPES)[keyof typeof MAILY_NODE_TYPES];
|
|
442
|
+
type WithExtraAttrs = {
|
|
443
|
+
dir?: TextDirection | null;
|
|
444
|
+
};
|
|
445
|
+
type BaseMailyNode = {
|
|
446
|
+
attrs?: WithExtraAttrs & Record<string, unknown>;
|
|
447
|
+
content?: AnyMailyNode[];
|
|
448
|
+
marks?: AnyMailyMark[];
|
|
449
|
+
text?: string;
|
|
450
|
+
type: MailyNodeType;
|
|
451
|
+
};
|
|
452
|
+
type DocumentAttributes = WithExtraAttrs & {
|
|
453
|
+
theme?: NodeThemeOptions | null;
|
|
454
|
+
version: number;
|
|
455
|
+
};
|
|
456
|
+
type DocumentNode = BaseMailyNode & {
|
|
457
|
+
attrs: DocumentAttributes;
|
|
458
|
+
content: AnyMailyNode[];
|
|
459
|
+
type: typeof MAILY_NODE_TYPES.DOCUMENT;
|
|
460
|
+
};
|
|
461
|
+
type BodyAttributes = WithExtraAttrs & {
|
|
462
|
+
style?: string | null;
|
|
463
|
+
};
|
|
464
|
+
type BodyNode = BaseMailyNode & {
|
|
465
|
+
attrs?: BodyAttributes;
|
|
466
|
+
content: AnyMailyNode[];
|
|
467
|
+
type: typeof MAILY_NODE_TYPES.BODY;
|
|
468
|
+
};
|
|
469
|
+
type ContainerAttributes = WithExtraAttrs & {
|
|
470
|
+
style?: string | null;
|
|
471
|
+
};
|
|
472
|
+
type ContainerNode = BaseMailyNode & {
|
|
473
|
+
attrs?: ContainerAttributes;
|
|
474
|
+
content: AnyMailyNode[];
|
|
475
|
+
type: typeof MAILY_NODE_TYPES.CONTAINER;
|
|
476
|
+
};
|
|
477
|
+
type SectionAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
478
|
+
style?: string | null;
|
|
479
|
+
};
|
|
480
|
+
type SectionNode = BaseMailyNode & {
|
|
481
|
+
attrs?: SectionAttributes;
|
|
482
|
+
content: AnyMailyNode[];
|
|
483
|
+
type: typeof MAILY_NODE_TYPES.SECTION;
|
|
484
|
+
};
|
|
485
|
+
type RepeatAttributes = WithVisibilityAttrs & {
|
|
486
|
+
each: string;
|
|
487
|
+
};
|
|
488
|
+
type RepeatNode = BaseMailyNode & {
|
|
489
|
+
attrs: RepeatAttributes;
|
|
490
|
+
content: AnyMailyNode[];
|
|
491
|
+
type: typeof MAILY_NODE_TYPES.REPEAT;
|
|
492
|
+
};
|
|
493
|
+
type ColumnsAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
494
|
+
columnCount: number;
|
|
495
|
+
gap: number;
|
|
496
|
+
style?: string | null;
|
|
497
|
+
};
|
|
498
|
+
type ColumnsNode = BaseMailyNode & {
|
|
499
|
+
attrs: ColumnsAttributes;
|
|
500
|
+
content: ColumnNode[];
|
|
501
|
+
type: typeof MAILY_NODE_TYPES.COLUMNS;
|
|
502
|
+
};
|
|
503
|
+
type ColumnAttributes = WithExtraAttrs & {
|
|
504
|
+
verticalAlign: string;
|
|
505
|
+
width: ColumnWidth | null;
|
|
506
|
+
style?: string | null;
|
|
507
|
+
};
|
|
508
|
+
type ColumnNode = BaseMailyNode & {
|
|
509
|
+
attrs: ColumnAttributes;
|
|
510
|
+
content: AnyMailyNode[];
|
|
511
|
+
type: typeof MAILY_NODE_TYPES.COLUMN;
|
|
512
|
+
};
|
|
513
|
+
type ImageAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
514
|
+
align: AllowedTextAlignment;
|
|
515
|
+
alt?: string | null;
|
|
516
|
+
externalLink?: string | null;
|
|
517
|
+
src: string;
|
|
518
|
+
style?: string | null;
|
|
519
|
+
title?: string | null;
|
|
520
|
+
width: string;
|
|
521
|
+
};
|
|
522
|
+
type ImageNode = BaseMailyNode & {
|
|
523
|
+
attrs: ImageAttributes;
|
|
524
|
+
type: typeof MAILY_NODE_TYPES.IMAGE;
|
|
525
|
+
};
|
|
526
|
+
type ButtonAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
527
|
+
align: AllowedTextAlignment;
|
|
528
|
+
kind: AllowedButtonKind;
|
|
529
|
+
style?: string | null;
|
|
530
|
+
url: string;
|
|
531
|
+
};
|
|
532
|
+
type ButtonNode = BaseMailyNode & {
|
|
533
|
+
attrs: ButtonAttributes;
|
|
534
|
+
content: AnyMailyNode[];
|
|
535
|
+
type: typeof MAILY_NODE_TYPES.BUTTON;
|
|
536
|
+
};
|
|
537
|
+
type FooterAttributes = WithExtraAttrs & {
|
|
538
|
+
style?: string | null;
|
|
539
|
+
};
|
|
540
|
+
type FooterNode = BaseMailyNode & {
|
|
541
|
+
attrs?: FooterAttributes;
|
|
542
|
+
content: AnyMailyNode[];
|
|
543
|
+
type: typeof MAILY_NODE_TYPES.FOOTER;
|
|
544
|
+
};
|
|
545
|
+
type InlineImageAttributes = WithExtraAttrs & {
|
|
546
|
+
alt?: string | null;
|
|
547
|
+
externalLink?: string | null;
|
|
548
|
+
height: number;
|
|
549
|
+
src: string;
|
|
550
|
+
style?: string | null;
|
|
551
|
+
title?: string | null;
|
|
552
|
+
width: number;
|
|
553
|
+
};
|
|
554
|
+
type InlineImageNode = BaseMailyNode & {
|
|
555
|
+
attrs: InlineImageAttributes;
|
|
556
|
+
type: typeof MAILY_NODE_TYPES.INLINE_IMAGE;
|
|
557
|
+
};
|
|
558
|
+
type InlineSpanAttributes = WithExtraAttrs & {
|
|
559
|
+
style?: string | null;
|
|
560
|
+
};
|
|
561
|
+
type InlineSpanNode = BaseMailyNode & {
|
|
562
|
+
attrs?: InlineSpanAttributes;
|
|
563
|
+
type: typeof MAILY_NODE_TYPES.INLINE_SPAN;
|
|
564
|
+
};
|
|
565
|
+
type SpacerAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
566
|
+
height: number;
|
|
567
|
+
style?: string | null;
|
|
568
|
+
};
|
|
569
|
+
type SpacerNode = BaseMailyNode & {
|
|
570
|
+
attrs: SpacerAttributes;
|
|
571
|
+
type: typeof MAILY_NODE_TYPES.SPACER;
|
|
572
|
+
};
|
|
573
|
+
type ParagraphAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
574
|
+
style?: string | null;
|
|
575
|
+
};
|
|
576
|
+
type ParagraphNode = BaseMailyNode & {
|
|
577
|
+
attrs?: ParagraphAttributes;
|
|
578
|
+
type: typeof MAILY_NODE_TYPES.PARAGRAPH;
|
|
579
|
+
};
|
|
580
|
+
type HeadingLevel = 1 | 2 | 3;
|
|
581
|
+
type HeadingAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
582
|
+
level: HeadingLevel;
|
|
583
|
+
style?: string | null;
|
|
584
|
+
};
|
|
585
|
+
type HeadingNode = BaseMailyNode & {
|
|
586
|
+
attrs: HeadingAttributes;
|
|
587
|
+
type: typeof MAILY_NODE_TYPES.HEADING;
|
|
588
|
+
};
|
|
589
|
+
type BlockquoteAttributes = WithExtraAttrs & {
|
|
590
|
+
style?: string | null;
|
|
591
|
+
};
|
|
592
|
+
type BlockquoteNode = BaseMailyNode & {
|
|
593
|
+
attrs?: BlockquoteAttributes;
|
|
594
|
+
content: AnyMailyNode[];
|
|
595
|
+
type: typeof MAILY_NODE_TYPES.BLOCKQUOTE;
|
|
596
|
+
};
|
|
597
|
+
type HorizontalRuleAttributes = WithVisibilityAttrs & {
|
|
598
|
+
style?: string | null;
|
|
599
|
+
};
|
|
600
|
+
type HorizontalRuleNode = BaseMailyNode & {
|
|
601
|
+
attrs?: HorizontalRuleAttributes;
|
|
602
|
+
type: typeof MAILY_NODE_TYPES.HORIZONTAL_RULE;
|
|
603
|
+
};
|
|
604
|
+
type HardBreakNode = BaseMailyNode & {
|
|
605
|
+
type: typeof MAILY_NODE_TYPES.HARD_BREAK;
|
|
606
|
+
};
|
|
607
|
+
type BulletListAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
608
|
+
style?: string | null;
|
|
609
|
+
};
|
|
610
|
+
type BulletListNode = BaseMailyNode & {
|
|
611
|
+
attrs?: BulletListAttributes;
|
|
612
|
+
content: ListItemNode[];
|
|
613
|
+
type: typeof MAILY_NODE_TYPES.BULLET_LIST;
|
|
614
|
+
};
|
|
615
|
+
type OrderedListAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
616
|
+
start?: number;
|
|
617
|
+
style?: string | null;
|
|
618
|
+
};
|
|
619
|
+
type OrderedListNode = BaseMailyNode & {
|
|
620
|
+
attrs?: OrderedListAttributes;
|
|
621
|
+
content: ListItemNode[];
|
|
622
|
+
type: typeof MAILY_NODE_TYPES.ORDERED_LIST;
|
|
623
|
+
};
|
|
624
|
+
type ListItemAttributes = WithExtraAttrs & {
|
|
625
|
+
style?: string | null;
|
|
626
|
+
};
|
|
627
|
+
type ListItemNode = BaseMailyNode & {
|
|
628
|
+
attrs?: ListItemAttributes;
|
|
629
|
+
content: AnyMailyNode[];
|
|
630
|
+
type: typeof MAILY_NODE_TYPES.LIST_ITEM;
|
|
631
|
+
};
|
|
632
|
+
type HtmlCodeBlockAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
633
|
+
activeTab: AllowedHtmlCodeBlockTab;
|
|
634
|
+
language: string;
|
|
635
|
+
style?: string | null;
|
|
636
|
+
};
|
|
637
|
+
type HtmlCodeBlockNode = BaseMailyNode & {
|
|
638
|
+
attrs: HtmlCodeBlockAttributes;
|
|
639
|
+
content: AnyMailyNode[];
|
|
640
|
+
type: typeof MAILY_NODE_TYPES.HTML_CODE_BLOCK;
|
|
641
|
+
};
|
|
642
|
+
type TextNode = BaseMailyNode & {
|
|
643
|
+
marks?: AnyMailyMark[];
|
|
644
|
+
text: string;
|
|
645
|
+
type: typeof MAILY_NODE_TYPES.TEXT;
|
|
646
|
+
};
|
|
647
|
+
type VariableAttributes = WithExtraAttrs & {
|
|
648
|
+
fallback?: string | null;
|
|
649
|
+
/** @deprecated Use `isDefaultEditable` instead. */
|
|
650
|
+
hideDefaultValue?: boolean;
|
|
651
|
+
id: string;
|
|
652
|
+
isDefaultEditable?: boolean;
|
|
653
|
+
label?: string | null;
|
|
654
|
+
required?: boolean;
|
|
655
|
+
style?: string | null;
|
|
656
|
+
};
|
|
657
|
+
declare const DEFAULT_VARIABLE_ATTRIBUTES: {
|
|
658
|
+
fallback: null;
|
|
659
|
+
isDefaultEditable: true;
|
|
660
|
+
label: null;
|
|
661
|
+
required: true;
|
|
662
|
+
style: null;
|
|
663
|
+
};
|
|
664
|
+
type VariableNode = BaseMailyNode & {
|
|
665
|
+
attrs: VariableAttributes;
|
|
666
|
+
type: typeof MAILY_NODE_TYPES.VARIABLE;
|
|
667
|
+
};
|
|
668
|
+
type TableAttributes = {
|
|
669
|
+
border?: number;
|
|
670
|
+
cellpadding?: number;
|
|
671
|
+
cellspacing?: number;
|
|
672
|
+
responsive: boolean;
|
|
673
|
+
style?: string | null;
|
|
674
|
+
};
|
|
675
|
+
type TableNode = BaseMailyNode & {
|
|
676
|
+
attrs: TableAttributes;
|
|
677
|
+
content: TableRowNode[];
|
|
678
|
+
type: typeof MAILY_NODE_TYPES.TABLE;
|
|
679
|
+
};
|
|
680
|
+
type TableRowAttributes = {
|
|
681
|
+
style?: string | null;
|
|
682
|
+
};
|
|
683
|
+
type TableRowNode = BaseMailyNode & {
|
|
684
|
+
attrs?: TableRowAttributes;
|
|
685
|
+
content: (TableCellNode | TableHeaderNode)[];
|
|
686
|
+
type: typeof MAILY_NODE_TYPES.TABLE_ROW;
|
|
687
|
+
};
|
|
688
|
+
type TableCellAttributes = {
|
|
689
|
+
colspan: number;
|
|
690
|
+
colwidth: number[] | null;
|
|
691
|
+
rowspan: number;
|
|
692
|
+
style?: string | null;
|
|
693
|
+
};
|
|
694
|
+
type TableCellNode = BaseMailyNode & {
|
|
695
|
+
attrs: TableCellAttributes;
|
|
696
|
+
content: AnyMailyNode[];
|
|
697
|
+
type: typeof MAILY_NODE_TYPES.TABLE_CELL;
|
|
698
|
+
};
|
|
699
|
+
type TableHeaderAttributes = TableCellAttributes;
|
|
700
|
+
type TableHeaderNode = BaseMailyNode & {
|
|
701
|
+
attrs: TableHeaderAttributes;
|
|
702
|
+
content: AnyMailyNode[];
|
|
703
|
+
type: typeof MAILY_NODE_TYPES.TABLE_HEADER;
|
|
704
|
+
};
|
|
705
|
+
type LinkCardAttributes = WithExtraAttrs & WithVisibilityAttrs & {
|
|
706
|
+
badgeText: string;
|
|
707
|
+
description: string;
|
|
708
|
+
image: string;
|
|
709
|
+
link: string;
|
|
710
|
+
linkTitle: string;
|
|
711
|
+
style?: string | null;
|
|
712
|
+
subTitle: string;
|
|
713
|
+
title: string;
|
|
714
|
+
};
|
|
715
|
+
type LinkCardNode = BaseMailyNode & {
|
|
716
|
+
attrs: LinkCardAttributes;
|
|
717
|
+
type: typeof MAILY_NODE_TYPES.LINK_CARD;
|
|
718
|
+
};
|
|
719
|
+
type AnyMailyNode = BodyNode | ContainerNode | BlockquoteNode | ButtonNode | ColumnNode | ColumnsNode | BulletListNode | DocumentNode | FooterNode | HardBreakNode | HeadingNode | ImageNode | InlineImageNode | InlineSpanNode | HorizontalRuleNode | HtmlCodeBlockNode | LinkCardNode | ListItemNode | OrderedListNode | ParagraphNode | RepeatNode | SectionNode | SpacerNode | TableCellNode | TableHeaderNode | TableNode | TableRowNode | TextNode | VariableNode;
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/is.d.ts
|
|
722
|
+
declare function isObject(val: unknown): val is object;
|
|
723
|
+
declare const is: {
|
|
724
|
+
node(value: unknown): value is AnyMailyNode;
|
|
725
|
+
mark(value: unknown): value is AnyMailyMark;
|
|
726
|
+
parent(node: AnyMailyNode): node is AnyMailyNode & {
|
|
727
|
+
content: AnyMailyNode[];
|
|
728
|
+
};
|
|
729
|
+
marked(node: AnyMailyNode): node is AnyMailyNode & {
|
|
730
|
+
marks: AnyMailyMark[];
|
|
731
|
+
};
|
|
732
|
+
doc: (value: AnyMailyNode | AnyMailyMark) => value is DocumentNode;
|
|
733
|
+
body: (value: AnyMailyNode | AnyMailyMark) => value is BodyNode;
|
|
734
|
+
container: (value: AnyMailyNode | AnyMailyMark) => value is ContainerNode;
|
|
735
|
+
section: (value: AnyMailyNode | AnyMailyMark) => value is SectionNode;
|
|
736
|
+
columns: (value: AnyMailyNode | AnyMailyMark) => value is ColumnsNode;
|
|
737
|
+
column: (value: AnyMailyNode | AnyMailyMark) => value is ColumnNode;
|
|
738
|
+
image: (value: AnyMailyNode | AnyMailyMark) => value is ImageNode;
|
|
739
|
+
inlineImage: (value: AnyMailyNode | AnyMailyMark) => value is InlineImageNode;
|
|
740
|
+
inlineSpan: (value: AnyMailyNode | AnyMailyMark) => value is InlineSpanNode;
|
|
741
|
+
spacer: (value: AnyMailyNode | AnyMailyMark) => value is SpacerNode;
|
|
742
|
+
button: (value: AnyMailyNode | AnyMailyMark) => value is ButtonNode;
|
|
743
|
+
footer: (value: AnyMailyNode | AnyMailyMark) => value is FooterNode;
|
|
744
|
+
paragraph: (value: AnyMailyNode | AnyMailyMark) => value is ParagraphNode;
|
|
745
|
+
heading: (value: AnyMailyNode | AnyMailyMark) => value is HeadingNode;
|
|
746
|
+
blockquote: (value: AnyMailyNode | AnyMailyMark) => value is BlockquoteNode;
|
|
747
|
+
horizontalRule: (value: AnyMailyNode | AnyMailyMark) => value is HorizontalRuleNode;
|
|
748
|
+
hardBreak: (value: AnyMailyNode | AnyMailyMark) => value is HardBreakNode;
|
|
749
|
+
htmlCodeBlock: (value: AnyMailyNode | AnyMailyMark) => value is HtmlCodeBlockNode;
|
|
750
|
+
repeat: (value: AnyMailyNode | AnyMailyMark) => value is RepeatNode;
|
|
751
|
+
bulletList: (value: AnyMailyNode | AnyMailyMark) => value is BulletListNode;
|
|
752
|
+
orderedList: (value: AnyMailyNode | AnyMailyMark) => value is OrderedListNode;
|
|
753
|
+
listItem: (value: AnyMailyNode | AnyMailyMark) => value is ListItemNode;
|
|
754
|
+
linkCard: (value: AnyMailyNode | AnyMailyMark) => value is LinkCardNode;
|
|
755
|
+
text: (value: AnyMailyNode | AnyMailyMark) => value is TextNode;
|
|
756
|
+
variable: (value: AnyMailyNode | AnyMailyMark) => value is VariableNode;
|
|
757
|
+
table: (value: AnyMailyNode | AnyMailyMark) => value is TableNode;
|
|
758
|
+
tableRow: (value: AnyMailyNode | AnyMailyMark) => value is TableRowNode;
|
|
759
|
+
tableCell: (value: AnyMailyNode | AnyMailyMark) => value is TableCellNode;
|
|
760
|
+
tableHeader: (value: AnyMailyNode | AnyMailyMark) => value is TableHeaderNode;
|
|
761
|
+
bold: (value: AnyMailyNode | AnyMailyMark) => value is BoldMark;
|
|
762
|
+
italic: (value: AnyMailyNode | AnyMailyMark) => value is ItalicMark;
|
|
763
|
+
strike: (value: AnyMailyNode | AnyMailyMark) => value is StrikeMark;
|
|
764
|
+
underline: (value: AnyMailyNode | AnyMailyMark) => value is UnderlineMark;
|
|
765
|
+
link: (value: AnyMailyNode | AnyMailyMark) => value is LinkMark;
|
|
766
|
+
code: (value: AnyMailyNode | AnyMailyMark) => value is CodeMark;
|
|
767
|
+
textStyle: (value: AnyMailyNode | AnyMailyMark) => value is TextStyleMark;
|
|
768
|
+
highlight: (value: AnyMailyNode | AnyMailyMark) => value is HighlightMark;
|
|
769
|
+
span: (value: AnyMailyNode | AnyMailyMark) => value is SpanMark;
|
|
770
|
+
};
|
|
771
|
+
declare function isDef<T>(value: T | null | undefined): value is T;
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/math.d.ts
|
|
774
|
+
declare function clamp(value: number, [min, max]: [number, number]): number;
|
|
775
|
+
declare function percentage(portion: number, total: number): number;
|
|
776
|
+
declare function roundTo(value: number, decimals: number): number;
|
|
777
|
+
declare function absoluteFromPercentage(percentage: number, total: number): number;
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region src/object.d.ts
|
|
780
|
+
declare function isMergeableObject(value: unknown): value is Record<string, unknown>;
|
|
781
|
+
/**
|
|
782
|
+
* One-level deep merge of plain objects. Nested plain objects are
|
|
783
|
+
* shallow-merged; primitives, arrays, and null are replaced outright.
|
|
784
|
+
* Does not mutate the target — returns a new object.
|
|
785
|
+
*
|
|
786
|
+
* Example:
|
|
787
|
+
* deepMerge({ a: 1, nested: { x: 1, y: 2 } }, { nested: { y: 3 } })
|
|
788
|
+
* // => { a: 1, nested: { x: 1, y: 3 } }
|
|
789
|
+
*/
|
|
790
|
+
declare function deepMerge<T extends object>(target: T, ...sources: Partial<T>[]): T;
|
|
791
|
+
//#endregion
|
|
792
|
+
//#region src/spacing.d.ts
|
|
793
|
+
declare const BLOCK_CONTAINER_TYPES: string[];
|
|
794
|
+
declare const MARGIN_TOP_ABSORBER_TYPES: string[];
|
|
795
|
+
declare const MARGIN_BOTTOM_ABSORBER_TYPES: string[];
|
|
796
|
+
type NodePosition = {
|
|
797
|
+
isFirst: boolean;
|
|
798
|
+
isLast: boolean;
|
|
799
|
+
nextType?: string | undefined;
|
|
800
|
+
parentType?: string | undefined;
|
|
801
|
+
previousType?: string | undefined;
|
|
802
|
+
};
|
|
803
|
+
declare function getSuppressedMargins(position: NodePosition): {
|
|
804
|
+
marginBottom: boolean;
|
|
805
|
+
marginTop: boolean;
|
|
806
|
+
};
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src/variable.d.ts
|
|
809
|
+
declare const DEFAULT_VARIABLE_START_TRIGGER = "{{";
|
|
810
|
+
declare const DEFAULT_VARIABLE_END_TRIGGER = "}}";
|
|
811
|
+
declare function serializeVariableToText(variable: VariableAttributes): string;
|
|
812
|
+
declare function deserializeVariableFromText(text: string): VariableAttributes;
|
|
813
|
+
type VariableSegment = {
|
|
814
|
+
isReference: boolean;
|
|
815
|
+
text: string;
|
|
816
|
+
};
|
|
817
|
+
declare function getVariableSegments(content: string): VariableSegment[];
|
|
818
|
+
declare function buildDocFromVariableText(content: string): {
|
|
819
|
+
type: "doc";
|
|
820
|
+
content: {
|
|
821
|
+
type: "paragraph";
|
|
822
|
+
content: ({
|
|
823
|
+
type: "variable";
|
|
824
|
+
attrs: VariableAttributes;
|
|
825
|
+
text?: undefined;
|
|
826
|
+
} | {
|
|
827
|
+
attrs?: undefined;
|
|
828
|
+
type: "text";
|
|
829
|
+
text: string;
|
|
830
|
+
})[];
|
|
831
|
+
}[];
|
|
832
|
+
};
|
|
833
|
+
declare function hasVariableInText(text: string): boolean;
|
|
112
834
|
//#endregion
|
|
113
|
-
export {
|
|
835
|
+
export { AllowedBorderStyle, AllowedButtonKind, AllowedHtmlCodeBlockTab, AllowedTextAlignment, AllowedVisibilityAction, AllowedVisibilityOperator, AnyMailyMark, AnyMailyNode, BASIC_NODE_THEME, BLOCK_CONTAINER_TYPES, BORDER_STYLES, BOX_CORNERS, BOX_SIDES, BUTTON_KINDS, BaseMailyMark, BaseMailyNode, BlockquoteAttributes, BlockquoteNode, BodyAttributes, BodyNode, BoldMark, BorderParts, BoxCorner, BoxCornerValues, BoxSide, BoxSideValues, BulletListAttributes, BulletListNode, ButtonAttributes, ButtonNode, CodeMark, ColumnAttributes, ColumnNode, ColumnWidth, ColumnsAttributes, ColumnsNode, ContainerAttributes, ContainerNode, DATA_NODE_TYPE_KEY, DEFAULT_BORDER_STYLE, DEFAULT_BUTTON_KIND, DEFAULT_CONTAINER_MAX_WIDTH, DEFAULT_CONTAINER_WIDTH_PIXELS, DEFAULT_FONT, DEFAULT_FONT_FALLBACK, DEFAULT_FONT_FAMILIES, DEFAULT_FONT_FAMILY, DEFAULT_HTML_CODE_BLOCK_TAB, DEFAULT_TEXT_ALIGN, DEFAULT_TEXT_DIRECTION, DEFAULT_VARIABLE_ATTRIBUTES, DEFAULT_VARIABLE_END_TRIGGER, DEFAULT_VARIABLE_START_TRIGGER, DEFAULT_VISIBILITY_RULE, DocumentAttributes, DocumentNode, ExtendNodeThemeOptions, FONT_SIZE_PRESETS, FONT_STYLES, FONT_WEIGHTS, FallbackFont, FontFamily, FontFamilyItem, FontFamilyValueOptions, FontFormat, FontProps, FontStyleValue, FontWeight, FooterAttributes, FooterNode, HTML_CODE_BLOCK_TABS, HardBreakNode, HeadingAttributes, HeadingLevel, HeadingNode, HighlightAttributes, HighlightMark, HorizontalRuleAttributes, HorizontalRuleNode, HtmlCodeBlockAttributes, HtmlCodeBlockNode, ImageAttributes, ImageNode, ImageWidth, InlineImageAttributes, InlineImageNode, InlineSpanAttributes, InlineSpanNode, InlineStyle, ItalicMark, LINE_HEIGHT_PRESETS, LinkAttributes, LinkCardAttributes, LinkCardNode, LinkMark, ListItemAttributes, ListItemNode, MAILY_BUG_REPORT_URL, MAILY_ERROR_PREFIX, MAILY_EXTENSION_TYPES, MAILY_MARK_TYPES, MAILY_NODE_THEME, MAILY_NODE_TYPES, MARGIN_BOTTOM_ABSORBER_TYPES, MARGIN_TOP_ABSORBER_TYPES, MAX_IMAGE_WIDTH_PERCENTAGE, MIN_IMAGE_WIDTH_PERCENTAGE, MailyMarkType, MailyNodeType, MarkStyleAttributes, NodePosition, NodeThemeOptions, OrderedListAttributes, OrderedListNode, ParagraphAttributes, ParagraphNode, RepeatAttributes, RepeatNode, SectionAttributes, SectionNode, SpacerAttributes, SpacerNode, SpanMark, StrikeMark, TEXT_ALIGNMENTS, TEXT_DIRECTIONS, TableAttributes, TableCellAttributes, TableCellNode, TableHeaderAttributes, TableHeaderNode, TableNode, TableRowAttributes, TableRowNode, TextDirection, TextNode, TextStyleAttributes, TextStyleMark, ThemeDeclarationsOptions, UnderlineMark, VISIBILITY_ACTIONS, VISIBILITY_ACTION_OPTIONS, VISIBILITY_OPERATORS, VISIBILITY_OPERATOR_OPTIONS, VariableAttributes, VariableNode, VisibilityRule, WithExtraAttrs, WithVisibilityAttrs, absoluteFromPercentage, allowedFallbackFonts, allowedMarkTypes, allowedNodeTypes, buildDocFromVariableText, clamp, clampImageWidthPercentage, deepMerge, deserializeVariableFromText, expandInlineStyles, extendNodeTheme, getBorderParts, getBoxCorners, getBoxSides, getColumnWidth, getColumnWidthPercent, getColumnWidthValue, getCssDirection, getFontFaceStyle, getFontFamilyNames, getFontFamilyValue, getSuppressedMargins, getThemeDeclarations, getVariableSegments, getVisibilityRule, getVisibilityValueSupport, hasVariableInText, invariant, is, isAllowedBorderStyle, isAllowedButtonKind, isAllowedTextAlignment, isDef, isMergeableObject, isObject, loadFont, mergeInlineStyles, noop, parseInlineStyles, parseWidthToPercentage, percentage, roundTo, serializeVariableToText, stringifyInlineStyles, toBoxCorners, toBoxSides };
|
|
114
836
|
//# sourceMappingURL=index.d.mts.map
|