@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.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["DEFAULT_FONT: FontProps","DEFAULT_RENDERER_THEME: RendererThemeOptions","DEFAULT_EDITOR_THEME: EditorThemeOptions","name: `--mly-${string}`","value: any","theme: EditorThemeOptions","font: Font"],"sources":["../src/theme.ts","../src/css-variables.ts","../src/font.ts"],"sourcesContent":["import type * as CSS from 'csstype';\n\nexport const allowedFallbackFonts = [\n 'Arial',\n 'Helvetica',\n 'Verdana',\n 'Georgia',\n 'Times New Roman',\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n] as const;\n\nexport type FallbackFont = (typeof allowedFallbackFonts)[number];\n\nexport const allowedFontFormats = [\n 'woff',\n 'woff2',\n 'truetype',\n 'opentype',\n 'embedded-opentype',\n 'svg',\n] as const;\n\nexport type FontFormat = (typeof allowedFontFormats)[number];\n\ntype FontWeight = CSS.Properties['fontWeight'];\ntype FontStyle = CSS.Properties['fontStyle'];\n\nexport interface FontProps {\n /** The font you want to use. NOTE: Do not insert multiple fonts here, use fallbackFontFamily for that */\n fontFamily: string;\n /** An array is possible, but the order of the array is the priority order */\n fallbackFontFamily: FallbackFont;\n /** Not all clients support web fonts. For support check: https://www.caniemail.com/features/css-at-font-face/ */\n webFont?: {\n url: string;\n format: FontFormat;\n };\n /** Default: 'normal' */\n fontStyle?: FontStyle;\n /** Default: 400 */\n fontWeight?: FontWeight;\n}\n\nexport interface BaseThemeOptions {\n container?: Partial<\n Pick<\n CSS.Properties,\n | 'backgroundColor'\n | 'maxWidth'\n | 'minWidth'\n | 'paddingTop'\n | 'paddingRight'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'borderRadius'\n | 'borderWidth'\n | 'borderColor'\n >\n >;\n body?: Partial<\n Pick<\n CSS.Properties,\n | 'backgroundColor'\n | 'paddingTop'\n | 'paddingRight'\n | 'paddingBottom'\n | 'paddingLeft'\n >\n >;\n button?: Partial<\n Pick<\n CSS.Properties,\n | 'paddingTop'\n | 'paddingRight'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'backgroundColor'\n | 'color'\n >\n >;\n link?: Partial<Pick<CSS.Properties, 'color'>>;\n font?: Pick<\n FontProps,\n 'fontFamily' | 'fallbackFontFamily' | 'webFont'\n > | null;\n}\n\n/**\n * The theme options for the editor.\n * currently, we don't allow any customizations for the colors in the editor.\n * that's why we have a separate theme for the editor.\n */\nexport interface EditorThemeOptions extends BaseThemeOptions {}\n\n/**\n * The theme options for the renderer.\n * currently, we don't allow any customizations for the colors in the editor.\n * that's why we have a separate theme for the renderer.\n */\nexport interface RendererThemeOptions extends BaseThemeOptions {\n colors?: Partial<{\n heading: string;\n paragraph: string;\n horizontal: string;\n footer: string;\n blockquoteBorder: string;\n codeBackground: string;\n codeText: string;\n linkCardTitle: string;\n linkCardDescription: string;\n linkCardBadgeText: string;\n linkCardBadgeBackground: string;\n linkCardSubTitle: string;\n }>;\n fontSize?: Partial<{\n paragraph: Partial<{\n size: string;\n lineHeight: string;\n }>;\n footer: Partial<{\n size: string;\n lineHeight: string;\n }>;\n }>;\n}\n\nexport const DEFAULT_FONT: FontProps = {\n fallbackFontFamily: 'sans-serif',\n fontFamily: 'Inter',\n webFont: {\n url: 'https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19',\n format: 'woff2',\n },\n};\n\nexport const DEFAULT_LINK_TEXT_COLOR = '#111827';\n\nexport const DEFAULT_RENDERER_THEME: RendererThemeOptions = {\n colors: {\n heading: '#111827',\n paragraph: '#374151',\n horizontal: '#EAEAEA',\n footer: '#64748B',\n blockquoteBorder: '#D1D5DB',\n codeBackground: '#EFEFEF',\n codeText: '#111827',\n linkCardTitle: '#111827',\n linkCardDescription: '#6B7280',\n linkCardBadgeText: '#111827',\n linkCardBadgeBackground: '#FEF08A',\n linkCardSubTitle: '#6B7280',\n },\n fontSize: {\n paragraph: {\n size: '15px',\n lineHeight: '26.25px',\n },\n footer: {\n size: '14px',\n lineHeight: '24px',\n },\n },\n\n container: {\n backgroundColor: '#ffffff',\n maxWidth: '600px',\n minWidth: '300px',\n paddingTop: '0.5rem',\n paddingRight: '0.5rem',\n paddingBottom: '0.5rem',\n paddingLeft: '0.5rem',\n\n borderRadius: '0px',\n borderWidth: '0px',\n borderColor: 'transparent',\n },\n body: {\n backgroundColor: '#ffffff',\n\n paddingTop: '0px',\n paddingRight: '0px',\n paddingBottom: '0px',\n paddingLeft: '0px',\n },\n button: {\n backgroundColor: '#000000',\n color: '#ffffff',\n paddingTop: '10px',\n paddingRight: '32px',\n paddingBottom: '10px',\n paddingLeft: '32px',\n },\n link: {\n color: DEFAULT_LINK_TEXT_COLOR,\n },\n font: DEFAULT_FONT,\n};\n\nexport const DEFAULT_EDITOR_THEME: EditorThemeOptions = {\n container: {\n backgroundColor: '#ffffff',\n maxWidth: '600px',\n minWidth: '300px',\n paddingTop: '8px',\n paddingRight: '8px',\n paddingBottom: '8px',\n paddingLeft: '8px',\n\n borderRadius: '0px',\n borderWidth: '0px',\n borderColor: 'transparent',\n },\n body: {\n backgroundColor: '#ffffff',\n\n paddingTop: '0px',\n paddingRight: '0px',\n paddingBottom: '0px',\n paddingLeft: '0px',\n },\n button: {\n backgroundColor: '#000000',\n color: '#ffffff',\n paddingTop: '10px',\n paddingRight: '32px',\n paddingBottom: '10px',\n paddingLeft: '32px',\n },\n link: {\n color: DEFAULT_LINK_TEXT_COLOR,\n },\n font: DEFAULT_FONT,\n};\n","import type * as CSS from 'csstype';\nimport { DEFAULT_FONT, type EditorThemeOptions } from './theme';\n\ndeclare module 'csstype' {\n interface Properties {\n [index: `--mly-${string}`]: any;\n }\n}\n\n/**\n * if the value is undefined, it will return an empty object\n * so that we don't override the default value\n * @param name - The name of the CSS variable\n * @param value - The value of the CSS variable\n * @returns The CSS variable value\n */\nexport function getVariableValue(\n name: `--mly-${string}`,\n value: any\n): CSS.Properties {\n if (value === undefined || value === null || value === '') {\n return {};\n }\n\n return {\n [name]: value,\n };\n}\n\n/**\n * Get the CSS variables for the theme\n * @param theme - The theme\n * @returns The CSS variables\n * @example\n * ```ts\n * const theme = {\n * body: {\n * backgroundColor: 'red',\n * },\n * };\n *\n * const cssVariables = getCssVariables(theme);\n *\n * console.log(cssVariables);\n * // { '--mly-body-background-color': 'red' }\n */\nexport function getMailyCssVariables(\n theme: EditorThemeOptions\n): CSS.Properties {\n const font = theme.font || DEFAULT_FONT;\n\n return {\n ...getVariableValue(\n '--mly-body-background-color',\n theme.body?.backgroundColor\n ),\n ...getVariableValue('--mly-body-padding-top', theme.body?.paddingTop),\n ...getVariableValue('--mly-body-padding-right', theme.body?.paddingRight),\n ...getVariableValue('--mly-body-padding-bottom', theme.body?.paddingBottom),\n ...getVariableValue('--mly-body-padding-left', theme.body?.paddingLeft),\n\n ...getVariableValue(\n '--mly-container-background-color',\n theme.container?.backgroundColor\n ),\n ...getVariableValue('--mly-container-max-width', theme.container?.maxWidth),\n ...getVariableValue('--mly-container-min-width', theme.container?.minWidth),\n\n ...getVariableValue(\n '--mly-container-padding-top',\n theme.container?.paddingTop\n ),\n ...getVariableValue(\n '--mly-container-padding-right',\n theme.container?.paddingRight\n ),\n ...getVariableValue(\n '--mly-container-padding-bottom',\n theme.container?.paddingBottom\n ),\n ...getVariableValue(\n '--mly-container-padding-left',\n theme.container?.paddingLeft\n ),\n\n ...getVariableValue(\n '--mly-container-border-radius',\n theme.container?.borderRadius\n ),\n ...getVariableValue(\n '--mly-container-border-width',\n theme.container?.borderWidth\n ),\n ...getVariableValue(\n '--mly-container-border-color',\n theme.container?.borderColor\n ),\n\n ...getVariableValue(\n '--mly-button-background-color',\n theme.button?.backgroundColor\n ),\n ...getVariableValue('--mly-button-text-color', theme.button?.color),\n ...getVariableValue('--mly-button-padding-top', theme.button?.paddingTop),\n ...getVariableValue(\n '--mly-button-padding-right',\n theme.button?.paddingRight\n ),\n ...getVariableValue(\n '--mly-button-padding-bottom',\n theme.button?.paddingBottom\n ),\n ...getVariableValue('--mly-button-padding-left', theme.button?.paddingLeft),\n\n ...getVariableValue('--mly-link-color', theme.link?.color),\n\n ...getVariableValue('--mly-font-family', font.fontFamily),\n ...getVariableValue('--mly-font-fallback-family', font.fallbackFontFamily),\n '--mly-font': `var(--mly-font-family), var(--mly-font-fallback-family)`,\n };\n}\n","import type { FontProps } from './theme';\n\ntype Font = Pick<FontProps, 'fontFamily' | 'fallbackFontFamily' | 'webFont'>;\n\nexport function loadFont(font: Font): void {\n const style = fontStyle(font);\n\n const styleElement = document.createElement('style');\n styleElement.textContent = style;\n document.head.appendChild(styleElement);\n}\n\nexport function fontStyle(font: Font): string {\n const { fontFamily, fallbackFontFamily, webFont } = font;\n\n const src = webFont\n ? `src: url(${webFont.url}) format('${webFont.format}');`\n : '';\n\n const style = `\n @font-face {\n font-family: '${fontFamily}';\n font-style: normal;\n font-weight: 400;\n mso-font-alt: '${fallbackFontFamily}';\n ${src}\n }`;\n\n return style;\n}\n"],"mappings":";AAEA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAID,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;AACD;AA0GD,MAAaA,eAA0B;CACrC,oBAAoB;CACpB,YAAY;CACZ,SAAS;EACP,KAAK;EACL,QAAQ;C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AY,aAAa;AACxC;AAED,SAAgB,UAAUA,MAAoB;CAC5C,MAAM,EAAE,YAAY,oBAAoB,SAAS,GAAG;CAEpD,MAAM,MAAM,WACP,WAAW,QAAQ,IAAI,YAAY,QAAQ,OAAO,OACnD;CAEJ,MAAM,SAAS;;oBAEG,WAAW;;;qBAGV,mBAAmB;MAClC,IAAI;;AAGR,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/alignment.ts","../src/border.ts","../src/box.ts","../src/button.ts","../src/math.ts","../src/column.ts","../src/constants.ts","../src/font.ts","../src/font-style.ts","../src/font-weight.ts","../src/function.ts","../src/html-code-block.ts","../src/image.ts","../src/invariant.ts","../src/mark.ts","../src/node.ts","../src/is.ts","../src/object.ts","../src/spacing.ts","../src/style.ts","../src/direction.ts","../src/variable.ts","../src/visibility.ts","../src/theme.ts"],"sourcesContent":["export const TEXT_ALIGNMENTS = {\n LEFT: 'left',\n CENTER: 'center',\n RIGHT: 'right',\n} as const;\n\nexport type AllowedTextAlignment =\n (typeof TEXT_ALIGNMENTS)[keyof typeof TEXT_ALIGNMENTS];\n\nconst allowedTextAligns: readonly AllowedTextAlignment[] = Object.freeze(\n Object.values(TEXT_ALIGNMENTS)\n);\n\nexport const DEFAULT_TEXT_ALIGN: AllowedTextAlignment = TEXT_ALIGNMENTS.LEFT;\n\nexport function isAllowedTextAlignment(\n value: unknown\n): value is AllowedTextAlignment {\n return (\n typeof value === 'string' &&\n allowedTextAligns.includes(value as AllowedTextAlignment)\n );\n}\n","import type { InlineStyle } from './style';\n\nexport const BORDER_STYLES = {\n SOLID: 'solid',\n DASHED: 'dashed',\n DOTTED: 'dotted',\n} as const;\n\nexport type AllowedBorderStyle =\n (typeof BORDER_STYLES)[keyof typeof BORDER_STYLES];\n\nconst allowedBorderStyles: readonly AllowedBorderStyle[] = Object.freeze(\n Object.values(BORDER_STYLES)\n);\n\nexport const DEFAULT_BORDER_STYLE: AllowedBorderStyle = BORDER_STYLES.SOLID;\n\nexport function isAllowedBorderStyle(\n value: unknown\n): value is AllowedBorderStyle {\n return (\n typeof value === 'string' &&\n allowedBorderStyles.includes(value as AllowedBorderStyle)\n );\n}\n\nexport type BorderParts = {\n color: string | undefined;\n style: string | undefined;\n width: string | undefined;\n};\n\n/**\n * Reads the width, style and colour of a border from the `border` shorthand,\n * letting any longhand already in the style win. The shorthand lists its\n * parts in any order, so each is recognised by shape rather than position.\n */\nexport function getBorderParts(style: InlineStyle): BorderParts {\n const parts = (style.border ?? '').trim().split(/\\s+/).filter(Boolean);\n\n let color: string | undefined;\n let borderStyle: string | undefined;\n let width: string | undefined;\n\n for (const part of parts) {\n if (isAllowedBorderStyle(part) || part === 'none') {\n borderStyle = part;\n } else if (/^[\\d.]/.test(part)) {\n width = part;\n } else {\n color = part;\n }\n }\n\n return {\n color: style.borderColor ?? color,\n style: style.borderStyle ?? borderStyle,\n width: style.borderWidth ?? width,\n };\n}\n","import type { InlineStyle } from './style';\n\nexport const BOX_SIDES = ['top', 'right', 'bottom', 'left'] as const;\nexport type BoxSide = (typeof BOX_SIDES)[number];\nexport type BoxSideValues = Record<BoxSide, number>;\n\nexport const BOX_CORNERS = [\n 'topLeft',\n 'topRight',\n 'bottomRight',\n 'bottomLeft',\n] as const;\nexport type BoxCorner = (typeof BOX_CORNERS)[number];\nexport type BoxCornerValues = Record<BoxCorner, number>;\n\nfunction capitalize(value: string) {\n return value.charAt(0).toUpperCase() + value.slice(1);\n}\n\n/**\n * CSS box shorthands repeat their values when fewer than four are given:\n * one applies to every edge, two to the vertical then horizontal pair, and\n * three to top, the horizontal pair, then bottom.\n */\nfunction getShorthandEdges(shorthand: string | undefined) {\n const parts = (shorthand ?? '').trim().split(/\\s+/).filter(Boolean);\n if (parts.length === 0) {\n return null;\n }\n\n const [first, second = first, third = first, fourth = second] = parts;\n\n return [first, second, third, fourth].map(toLength);\n}\n\nfunction toLength(value: string) {\n const parsed = Number.parseFloat(value);\n\n return Number.isNaN(parsed) ? 0 : parsed;\n}\n\nfunction getLonghand(\n style: InlineStyle,\n property: string,\n edge: string,\n suffix: string\n) {\n return style[`${property}${capitalize(edge)}${suffix}`];\n}\n\nfunction toShorthand(edges: number[]) {\n const [first, second, third, fourth] = edges;\n const values =\n first === third && second === fourth\n ? first === second\n ? [first]\n : [first, second]\n : [first, second, third, fourth];\n\n return values.map((value) => `${value}px`).join(' ');\n}\n\nexport function getBoxSides(\n style: InlineStyle,\n property: string\n): BoxSideValues {\n const edges = getShorthandEdges(style[property]) ?? [0, 0, 0, 0];\n const [top, right, bottom, left] = edges;\n const sides: BoxSideValues = { bottom, left, right, top };\n\n for (const side of BOX_SIDES) {\n const longhand = getLonghand(style, property, side, '');\n if (longhand !== undefined) {\n sides[side] = toLength(longhand);\n }\n }\n\n return sides;\n}\n\nexport function toBoxSides(\n property: string,\n values: BoxSideValues\n): Record<string, string | null> {\n const declarations: Record<string, string | null> = {\n [property]: toShorthand([\n values.top,\n values.right,\n values.bottom,\n values.left,\n ]),\n };\n\n for (const side of BOX_SIDES) {\n declarations[`${property}${capitalize(side)}`] = null;\n }\n\n return declarations;\n}\n\n/**\n * Radius shorthands run clockwise from the top-left corner, and repeat the\n * same way box shorthands do.\n */\nexport function getBoxCorners(\n style: InlineStyle,\n property: string\n): BoxCornerValues {\n const edges = getShorthandEdges(style[property]) ?? [0, 0, 0, 0];\n const [topLeft, topRight, bottomRight, bottomLeft] = edges;\n const corners: BoxCornerValues = {\n bottomLeft,\n bottomRight,\n topLeft,\n topRight,\n };\n\n for (const corner of BOX_CORNERS) {\n const longhand = getLonghand(style, 'border', corner, 'Radius');\n if (longhand !== undefined) {\n corners[corner] = toLength(longhand);\n }\n }\n\n return corners;\n}\n\nexport function toBoxCorners(\n property: string,\n values: BoxCornerValues\n): Record<string, string | null> {\n const declarations: Record<string, string | null> = {\n [property]: toShorthand([\n values.topLeft,\n values.topRight,\n values.bottomRight,\n values.bottomLeft,\n ]),\n };\n\n for (const corner of BOX_CORNERS) {\n declarations[`border${capitalize(corner)}Radius`] = null;\n }\n\n return declarations;\n}\n","/**\n * Button layout kinds.\n * \"tight\" renders the button at its content width,\n * \"full-width\" stretches it to fill the container.\n */\nexport const BUTTON_KINDS = {\n TIGHT: 'tight',\n FULL_WIDTH: 'full-width',\n} as const;\n\nexport type AllowedButtonKind =\n (typeof BUTTON_KINDS)[keyof typeof BUTTON_KINDS];\n\nconst allowedButtonKinds: readonly AllowedButtonKind[] = Object.freeze(\n Object.values(BUTTON_KINDS)\n);\n\nexport const DEFAULT_BUTTON_KIND: AllowedButtonKind = BUTTON_KINDS.TIGHT;\n\nexport function isAllowedButtonKind(\n value: unknown\n): value is AllowedButtonKind {\n return (\n typeof value === 'string' &&\n allowedButtonKinds.includes(value as AllowedButtonKind)\n );\n}\n","export function clamp(value: number, [min, max]: [number, number]): number {\n return Math.min(Math.max(value, min), max);\n}\n\nexport function percentage(portion: number, total: number): number {\n return clamp((portion / total) * 100, [0, 100]);\n}\n\nexport function roundTo(value: number, decimals: number): number {\n const factor = 10 ** decimals;\n\n return Math.round(value * factor) / factor;\n}\n\nexport function absoluteFromPercentage(\n percentage: number,\n total: number\n): number {\n return Math.round((total * percentage) / 100);\n}\n","import { roundTo } from './math';\n\nexport type ColumnWidth = number | string;\n\nconst PERCENTAGE_PATTERN = /^(\\d+(?:\\.\\d+)?)%$/;\nconst PIXEL_PATTERN = /^(\\d+(?:\\.\\d+)?)px$/;\nconst CSS_LENGTH_PATTERN =\n /^\\d+(?:\\.\\d+)?(?:px|pt|pc|in|cm|mm|em|rem|ex|ch|vw|vh|vmin|vmax)$/;\n\nexport function getColumnWidth(\n value: string | null | undefined\n): ColumnWidth | null {\n const declaration = value?.trim();\n if (!declaration) {\n return null;\n }\n\n const percentage = PERCENTAGE_PATTERN.exec(declaration);\n if (percentage) {\n return Number(percentage[1]);\n }\n\n return CSS_LENGTH_PATTERN.test(declaration) ? declaration : null;\n}\n\nexport function getColumnWidthValue(width: ColumnWidth): string {\n return typeof width === 'number' ? `${width}%` : width;\n}\n\ntype ColumnWidthPercentOptions = {\n containerWidth: number;\n width: ColumnWidth | null | undefined;\n};\n\nexport function getColumnWidthPercent(\n options: ColumnWidthPercentOptions\n): number | null {\n const { containerWidth, width } = options;\n\n if (width === null || width === undefined) {\n return null;\n }\n\n if (typeof width === 'number') {\n return width;\n }\n\n const percentage = PERCENTAGE_PATTERN.exec(width);\n if (percentage) {\n return Number(percentage[1]);\n }\n\n const pixels = PIXEL_PATTERN.exec(width);\n if (pixels && containerWidth > 0) {\n return roundTo((Number(pixels[1]) / containerWidth) * 100, 3);\n }\n\n return null;\n}\n","export const DATA_NODE_TYPE_KEY = 'data-node-type';\n\nexport const MAILY_ERROR_PREFIX = '[Maily Error]';\n\nexport const MAILY_BUG_REPORT_URL =\n 'https://github.com/arikchakma/maily.to/issues/new';\n","import type { Properties } from 'csstype';\n\n/**\n * List of allowed fallback font families. These are system fonts or\n * generic font families that serve as fallbacks when a web font\n * fails to load.\n */\nexport const allowedFallbackFonts = [\n 'Arial',\n 'Helvetica',\n 'Verdana',\n 'Georgia',\n 'Times New Roman',\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n] as const;\n\nexport type FallbackFont = (typeof allowedFallbackFonts)[number];\n\nconst allowedFontFormats = [\n 'woff',\n 'woff2',\n 'truetype',\n 'opentype',\n 'embedded-opentype',\n 'svg',\n] as const;\n\nexport type FontFormat = (typeof allowedFontFormats)[number];\n\ntype FontStyle = Properties['fontStyle'];\n\n/**\n * Configuration for a font used in the editor or renderer.\n * Specifies the primary font family, a fallback, and an optional\n * web font URL with its format for @font-face loading.\n */\nexport interface FontProps {\n fontFamily: string;\n fallbackFontFamily: FallbackFont;\n webFont?: {\n url: string;\n format: FontFormat;\n };\n fontStyle?: FontStyle;\n fontWeight?: number;\n}\n\n/**\n * Default font configuration: Inter with sans-serif fallback,\n * loaded from the Maily CDN as woff2.\n */\nexport const DEFAULT_FONT: FontProps = {\n fallbackFontFamily: 'sans-serif',\n fontFamily: 'Inter',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/inter.woff2',\n },\n};\n\nexport function getFontFamilyNames(value: string): string[] {\n return value\n .split(',')\n .map((font) => {\n return font.trim().replace(/['\"]/g, '');\n })\n .filter(Boolean);\n}\n\nexport type FontFamilyValueOptions = {\n fallbackFontFamily?: string | null;\n fontFamily?: string | null;\n};\n\nexport function getFontFamilyValue(options: FontFamilyValueOptions): string {\n const { fallbackFontFamily, fontFamily } = options;\n\n return [fontFamily ? `'${fontFamily}'` : null, fallbackFontFamily]\n .filter(Boolean)\n .join(', ');\n}\n\n/**\n * Generates a @font-face CSS rule string for the given font configuration.\n * Includes the font family, style, weight, MSO fallback, and web font\n * source URL when available.\n */\nexport function getFontFaceStyle(font: FontProps): string {\n const {\n fallbackFontFamily,\n fontFamily,\n fontStyle = 'normal',\n fontWeight = 400,\n webFont,\n } = font;\n\n const src = webFont\n ? `src: url(${webFont.url}) format('${webFont.format}');`\n : '';\n\n return /* css */ `@font-face {font-family: '${fontFamily}';font-style: ${fontStyle};font-weight: ${fontWeight};mso-font-alt: '${fallbackFontFamily}';${src}}`;\n}\n\n/**\n * Injects a @font-face style element into the document head to load\n * the given font. Only works in browser environments.\n */\nexport function loadFont(font: FontProps): void {\n const styleElement = document.createElement('style');\n styleElement.textContent = getFontFaceStyle(font);\n document.head.appendChild(styleElement);\n}\n","import type { FallbackFont, FontFormat } from './font';\n\n/**\n * Entry for the font picker dropdown. Web fonts include a CDN URL\n * and format for @font-face loading; system fonts omit the webFont field.\n */\nexport type FontFamilyItem = {\n fontFamily: string;\n label?: string;\n webFont?: { url: string; format: FontFormat };\n};\n\n/**\n * Built-in font options served from the Maily CDN. System fonts\n * (Arial, Helvetica, etc.) are included without a webFont field.\n */\nexport const DEFAULT_FONT_FAMILIES: FontFamilyItem[] = [\n {\n fontFamily: 'Inter',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/inter.woff2',\n },\n },\n {\n fontFamily: 'Roboto',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/roboto.woff2',\n },\n },\n {\n fontFamily: 'Open Sans',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/open-sans.woff2',\n },\n },\n {\n fontFamily: 'Lato',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/lato.woff2',\n },\n },\n {\n fontFamily: 'Montserrat',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/montserrat.woff2',\n },\n },\n {\n fontFamily: 'Poppins',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/poppins.woff2',\n },\n },\n {\n fontFamily: 'Raleway',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/raleway.woff2',\n },\n },\n {\n fontFamily: 'Ubuntu',\n webFont: {\n format: 'woff2',\n url: 'https://cdn.usemaily.com/fonts/v0/ubuntu.woff2',\n },\n },\n { fontFamily: 'Arial' },\n { fontFamily: 'Helvetica' },\n { fontFamily: 'Georgia' },\n { fontFamily: 'Times New Roman' },\n { fontFamily: 'Verdana' },\n { fontFamily: 'Courier New' },\n { fontFamily: 'Trebuchet MS' },\n];\n\nexport type FontFamily = string;\n\nexport const FONT_STYLES = {\n NORMAL: 'normal',\n ITALIC: 'italic',\n} as const;\n\nexport type FontStyleValue = (typeof FONT_STYLES)[keyof typeof FONT_STYLES];\n\nexport const FONT_SIZE_PRESETS = [\n { value: 12, label: 'Small' },\n { value: 14, label: 'Normal' },\n { value: 16, label: 'Medium' },\n { value: 18, label: 'Large' },\n { value: 24, label: 'XL' },\n { value: 32, label: '2XL' },\n] as const;\n\nexport const LINE_HEIGHT_PRESETS = [\n { value: 1, label: 'Tight' },\n { value: 1.25, label: 'Snug' },\n { value: 1.5, label: 'Normal' },\n { value: 1.75, label: 'Relaxed' },\n { value: 2, label: 'Loose' },\n] as const;\n\nexport const DEFAULT_FONT_FAMILY: FontFamily = 'Inter';\nexport const DEFAULT_FONT_FALLBACK: FallbackFont = 'sans-serif';\n","/**\n * Numeric font weight values mapped to semantic names.\n * Normal (400), Medium (500), Semibold (600), Bold (700), Extra Bold (800).\n */\nexport const FONT_WEIGHTS = {\n NORMAL: 400,\n MEDIUM: 500,\n SEMIBOLD: 600,\n BOLD: 700,\n EXTRA_BOLD: 800,\n} as const;\n\nexport type FontWeight = (typeof FONT_WEIGHTS)[keyof typeof FONT_WEIGHTS];\n","export function noop(): void {}\n","/**\n * Tab options for the HTML code block node.\n * \"code\" shows the raw HTML source, \"preview\" renders it visually.\n */\nexport const HTML_CODE_BLOCK_TABS = {\n CODE: 'code',\n PREVIEW: 'preview',\n} as const;\n\nexport type AllowedHtmlCodeBlockTab =\n (typeof HTML_CODE_BLOCK_TABS)[keyof typeof HTML_CODE_BLOCK_TABS];\n\nexport const DEFAULT_HTML_CODE_BLOCK_TAB: AllowedHtmlCodeBlockTab =\n HTML_CODE_BLOCK_TABS.CODE;\n","import { clamp } from './math';\n\nexport type ImageWidth = number | string;\n\nexport const MIN_IMAGE_WIDTH_PERCENTAGE = 5;\nexport const MAX_IMAGE_WIDTH_PERCENTAGE = 100;\n\nexport const DEFAULT_CONTAINER_WIDTH_PIXELS = 600;\n\nconst PIXEL_SUFFIX = 'px';\n\nfunction getPixels(value: string) {\n const length = value.endsWith(PIXEL_SUFFIX)\n ? value.slice(0, -PIXEL_SUFFIX.length)\n : value;\n\n if (length === '') {\n return null;\n }\n\n const pixels = Number(length);\n\n return Number.isFinite(pixels) ? pixels : null;\n}\n\nexport function parseWidthToPercentage(\n width: ImageWidth | null | undefined,\n containerWidthPixels: number = DEFAULT_CONTAINER_WIDTH_PIXELS\n): number {\n if (width === null || width === undefined || width === 'auto') {\n return MAX_IMAGE_WIDTH_PERCENTAGE;\n }\n\n const value = String(width).trim();\n if (value.endsWith('%')) {\n return clampImageWidthPercentage(Number.parseFloat(value));\n }\n\n const pixels = getPixels(value);\n if (pixels === null) {\n return MAX_IMAGE_WIDTH_PERCENTAGE;\n }\n\n return clampImageWidthPercentage(\n Math.round((100 * pixels) / containerWidthPixels)\n );\n}\n\nexport function clampImageWidthPercentage(width: number) {\n return clamp(width, [MIN_IMAGE_WIDTH_PERCENTAGE, MAX_IMAGE_WIDTH_PERCENTAGE]);\n}\n","import { MAILY_BUG_REPORT_URL, MAILY_ERROR_PREFIX } from './constants';\n\nexport function invariant(value: boolean, message?: string): asserts value;\n\nexport function invariant<T>(\n value: T | null | undefined,\n message?: string\n): asserts value is T;\n\nexport function invariant(value: unknown, message?: string) {\n if (value === false || value === null || typeof value === 'undefined') {\n console.error(\n `${MAILY_ERROR_PREFIX}: The following error is a bug in Maily;\nPlease open an issue! ${MAILY_BUG_REPORT_URL}`\n );\n throw new Error(message);\n }\n}\n","export const MAILY_MARK_TYPES = {\n BOLD: 'bold',\n ITALIC: 'italic',\n STRIKE: 'strike',\n UNDERLINE: 'underline',\n LINK: 'link',\n CODE: 'code',\n TEXT_STYLE: 'textStyle',\n HIGHLIGHT: 'highlight',\n SPAN: 'span',\n} as const;\n\nexport const allowedMarkTypes = Object.values(MAILY_MARK_TYPES);\n\nexport type MailyMarkType =\n (typeof MAILY_MARK_TYPES)[keyof typeof MAILY_MARK_TYPES];\n\nexport type MarkStyleAttributes = {\n style?: string | null;\n};\n\nexport type BaseMailyMark = {\n attrs?: MarkStyleAttributes & Record<string, unknown>;\n type: MailyMarkType;\n};\n\nexport type BoldMark = BaseMailyMark & {\n type: typeof MAILY_MARK_TYPES.BOLD;\n};\n\nexport type ItalicMark = BaseMailyMark & {\n type: typeof MAILY_MARK_TYPES.ITALIC;\n};\n\nexport type StrikeMark = BaseMailyMark & {\n type: typeof MAILY_MARK_TYPES.STRIKE;\n};\n\nexport type UnderlineMark = BaseMailyMark & {\n type: typeof MAILY_MARK_TYPES.UNDERLINE;\n};\n\nexport type LinkAttributes = MarkStyleAttributes & {\n class?: string | null;\n href: string;\n rel?: string | null;\n target?: string | null;\n title?: string | null;\n};\n\nexport type LinkMark = BaseMailyMark & {\n attrs: LinkAttributes;\n type: typeof MAILY_MARK_TYPES.LINK;\n};\n\nexport type CodeMark = BaseMailyMark & {\n type: typeof MAILY_MARK_TYPES.CODE;\n};\n\nexport type TextStyleAttributes = MarkStyleAttributes & {\n color: string;\n};\n\nexport type TextStyleMark = BaseMailyMark & {\n attrs: TextStyleAttributes;\n type: typeof MAILY_MARK_TYPES.TEXT_STYLE;\n};\n\nexport type HighlightAttributes = MarkStyleAttributes & {\n color: string;\n};\n\nexport type HighlightMark = BaseMailyMark & {\n attrs: HighlightAttributes;\n type: typeof MAILY_MARK_TYPES.HIGHLIGHT;\n};\n\nexport type SpanMark = BaseMailyMark & {\n attrs?: MarkStyleAttributes;\n type: typeof MAILY_MARK_TYPES.SPAN;\n};\n\nexport type AnyMailyMark =\n | BoldMark\n | ItalicMark\n | StrikeMark\n | UnderlineMark\n | LinkMark\n | CodeMark\n | TextStyleMark\n | HighlightMark\n | SpanMark;\n","import type { AllowedTextAlignment } from './alignment';\nimport type { AllowedButtonKind } from './button';\nimport type { ColumnWidth } from './column';\nimport type { TextDirection } from './direction';\nimport type { AllowedHtmlCodeBlockTab } from './html-code-block';\nimport type { AnyMailyMark } from './mark';\nimport type { NodeThemeOptions } from './theme';\nimport type { WithVisibilityAttrs } from './visibility';\n\nexport const MAILY_NODE_TYPES = {\n DOCUMENT: 'doc',\n BODY: 'body',\n CONTAINER: 'container',\n SECTION: 'section',\n COLUMNS: 'columns',\n COLUMN: 'column',\n IMAGE: 'image',\n INLINE_IMAGE: 'inlineImage',\n INLINE_SPAN: 'inlineSpan',\n SPACER: 'spacer',\n BUTTON: 'button',\n FOOTER: 'footer',\n PARAGRAPH: 'paragraph',\n HEADING: 'heading',\n BLOCKQUOTE: 'blockquote',\n HORIZONTAL_RULE: 'horizontalRule',\n HTML_CODE_BLOCK: 'htmlCodeBlock',\n REPEAT: 'repeat',\n HARD_BREAK: 'hardBreak',\n BULLET_LIST: 'bulletList',\n ORDERED_LIST: 'orderedList',\n LIST_ITEM: 'listItem',\n TEXT: 'text',\n VARIABLE: 'variable',\n TABLE: 'table',\n TABLE_ROW: 'tableRow',\n TABLE_CELL: 'tableCell',\n TABLE_HEADER: 'tableHeader',\n LINK_CARD: 'linkCard',\n} as const;\n\nexport const MAILY_EXTENSION_TYPES = {\n STYLE: 'style',\n THEME: 'theme',\n VISIBILITY: 'visibility',\n} as const;\n\nexport const allowedNodeTypes = Object.values(MAILY_NODE_TYPES);\n\nexport type MailyNodeType =\n (typeof MAILY_NODE_TYPES)[keyof typeof MAILY_NODE_TYPES];\n\nexport type WithExtraAttrs = {\n dir?: TextDirection | null;\n};\n\nexport type BaseMailyNode = {\n attrs?: WithExtraAttrs & Record<string, unknown>;\n content?: AnyMailyNode[];\n marks?: AnyMailyMark[];\n text?: string;\n type: MailyNodeType;\n};\n\nexport type DocumentAttributes = WithExtraAttrs & {\n theme?: NodeThemeOptions | null;\n version: number;\n};\n\nexport type DocumentNode = BaseMailyNode & {\n attrs: DocumentAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.DOCUMENT;\n};\n\nexport type BodyAttributes = WithExtraAttrs & {\n style?: string | null;\n};\n\nexport type BodyNode = BaseMailyNode & {\n attrs?: BodyAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.BODY;\n};\n\nexport type ContainerAttributes = WithExtraAttrs & {\n style?: string | null;\n};\n\nexport type ContainerNode = BaseMailyNode & {\n attrs?: ContainerAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.CONTAINER;\n};\n\nexport type SectionAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n style?: string | null;\n };\n\nexport type SectionNode = BaseMailyNode & {\n attrs?: SectionAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.SECTION;\n};\n\nexport type RepeatAttributes = WithVisibilityAttrs & {\n each: string;\n};\n\nexport type RepeatNode = BaseMailyNode & {\n attrs: RepeatAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.REPEAT;\n};\n\nexport type ColumnsAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n columnCount: number;\n gap: number;\n style?: string | null;\n };\n\nexport type ColumnsNode = BaseMailyNode & {\n attrs: ColumnsAttributes;\n content: ColumnNode[];\n type: typeof MAILY_NODE_TYPES.COLUMNS;\n};\n\nexport type ColumnAttributes = WithExtraAttrs & {\n verticalAlign: string;\n width: ColumnWidth | null;\n style?: string | null;\n};\n\nexport type ColumnNode = BaseMailyNode & {\n attrs: ColumnAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.COLUMN;\n};\n\nexport type ImageAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n align: AllowedTextAlignment;\n alt?: string | null;\n externalLink?: string | null;\n src: string;\n style?: string | null;\n title?: string | null;\n width: string;\n };\n\nexport type ImageNode = BaseMailyNode & {\n attrs: ImageAttributes;\n type: typeof MAILY_NODE_TYPES.IMAGE;\n};\n\nexport type ButtonAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n align: AllowedTextAlignment;\n kind: AllowedButtonKind;\n style?: string | null;\n url: string;\n };\n\nexport type ButtonNode = BaseMailyNode & {\n attrs: ButtonAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.BUTTON;\n};\n\nexport type FooterAttributes = WithExtraAttrs & {\n style?: string | null;\n};\n\nexport type FooterNode = BaseMailyNode & {\n attrs?: FooterAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.FOOTER;\n};\n\nexport type InlineImageAttributes = WithExtraAttrs & {\n alt?: string | null;\n externalLink?: string | null;\n height: number;\n src: string;\n style?: string | null;\n title?: string | null;\n width: number;\n};\n\nexport type InlineImageNode = BaseMailyNode & {\n attrs: InlineImageAttributes;\n type: typeof MAILY_NODE_TYPES.INLINE_IMAGE;\n};\n\nexport type InlineSpanAttributes = WithExtraAttrs & {\n style?: string | null;\n};\n\nexport type InlineSpanNode = BaseMailyNode & {\n attrs?: InlineSpanAttributes;\n type: typeof MAILY_NODE_TYPES.INLINE_SPAN;\n};\n\nexport type SpacerAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n height: number;\n style?: string | null;\n };\n\nexport type SpacerNode = BaseMailyNode & {\n attrs: SpacerAttributes;\n type: typeof MAILY_NODE_TYPES.SPACER;\n};\n\nexport type ParagraphAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n style?: string | null;\n };\n\nexport type ParagraphNode = BaseMailyNode & {\n attrs?: ParagraphAttributes;\n type: typeof MAILY_NODE_TYPES.PARAGRAPH;\n};\n\nexport type HeadingLevel = 1 | 2 | 3;\n\nexport type HeadingAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n level: HeadingLevel;\n style?: string | null;\n };\n\nexport type HeadingNode = BaseMailyNode & {\n attrs: HeadingAttributes;\n type: typeof MAILY_NODE_TYPES.HEADING;\n};\n\nexport type BlockquoteAttributes = WithExtraAttrs & {\n style?: string | null;\n};\n\nexport type BlockquoteNode = BaseMailyNode & {\n attrs?: BlockquoteAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.BLOCKQUOTE;\n};\n\nexport type HorizontalRuleAttributes = WithVisibilityAttrs & {\n style?: string | null;\n};\n\nexport type HorizontalRuleNode = BaseMailyNode & {\n attrs?: HorizontalRuleAttributes;\n type: typeof MAILY_NODE_TYPES.HORIZONTAL_RULE;\n};\n\nexport type HardBreakNode = BaseMailyNode & {\n type: typeof MAILY_NODE_TYPES.HARD_BREAK;\n};\n\nexport type BulletListAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n style?: string | null;\n };\n\nexport type BulletListNode = BaseMailyNode & {\n attrs?: BulletListAttributes;\n content: ListItemNode[];\n type: typeof MAILY_NODE_TYPES.BULLET_LIST;\n};\n\nexport type OrderedListAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n start?: number;\n style?: string | null;\n };\n\nexport type OrderedListNode = BaseMailyNode & {\n attrs?: OrderedListAttributes;\n content: ListItemNode[];\n type: typeof MAILY_NODE_TYPES.ORDERED_LIST;\n};\n\nexport type ListItemAttributes = WithExtraAttrs & {\n style?: string | null;\n};\n\nexport type ListItemNode = BaseMailyNode & {\n attrs?: ListItemAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.LIST_ITEM;\n};\n\nexport type HtmlCodeBlockAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n activeTab: AllowedHtmlCodeBlockTab;\n language: string;\n style?: string | null;\n };\n\nexport type HtmlCodeBlockNode = BaseMailyNode & {\n attrs: HtmlCodeBlockAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.HTML_CODE_BLOCK;\n};\n\nexport type TextNode = BaseMailyNode & {\n marks?: AnyMailyMark[];\n text: string;\n type: typeof MAILY_NODE_TYPES.TEXT;\n};\n\nexport type VariableAttributes = WithExtraAttrs & {\n fallback?: string | null;\n /** @deprecated Use `isDefaultEditable` instead. */\n hideDefaultValue?: boolean;\n id: string;\n isDefaultEditable?: boolean;\n label?: string | null;\n required?: boolean;\n style?: string | null;\n};\n\nexport const DEFAULT_VARIABLE_ATTRIBUTES = {\n fallback: null,\n isDefaultEditable: true,\n label: null,\n required: true,\n style: null,\n} satisfies Omit<VariableAttributes, 'id'>;\n\nexport type VariableNode = BaseMailyNode & {\n attrs: VariableAttributes;\n type: typeof MAILY_NODE_TYPES.VARIABLE;\n};\n\nexport type TableAttributes = {\n border?: number;\n cellpadding?: number;\n cellspacing?: number;\n responsive: boolean;\n style?: string | null;\n};\n\nexport type TableNode = BaseMailyNode & {\n attrs: TableAttributes;\n content: TableRowNode[];\n type: typeof MAILY_NODE_TYPES.TABLE;\n};\n\nexport type TableRowAttributes = {\n style?: string | null;\n};\n\nexport type TableRowNode = BaseMailyNode & {\n attrs?: TableRowAttributes;\n content: (TableCellNode | TableHeaderNode)[];\n type: typeof MAILY_NODE_TYPES.TABLE_ROW;\n};\n\nexport type TableCellAttributes = {\n colspan: number;\n colwidth: number[] | null;\n rowspan: number;\n style?: string | null;\n};\n\nexport type TableCellNode = BaseMailyNode & {\n attrs: TableCellAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.TABLE_CELL;\n};\n\nexport type TableHeaderAttributes = TableCellAttributes;\n\nexport type TableHeaderNode = BaseMailyNode & {\n attrs: TableHeaderAttributes;\n content: AnyMailyNode[];\n type: typeof MAILY_NODE_TYPES.TABLE_HEADER;\n};\n\nexport type LinkCardAttributes = WithExtraAttrs &\n WithVisibilityAttrs & {\n badgeText: string;\n description: string;\n image: string;\n link: string;\n linkTitle: string;\n style?: string | null;\n subTitle: string;\n title: string;\n };\n\nexport type LinkCardNode = BaseMailyNode & {\n attrs: LinkCardAttributes;\n type: typeof MAILY_NODE_TYPES.LINK_CARD;\n};\n\nexport type AnyMailyNode =\n | BodyNode\n | ContainerNode\n | BlockquoteNode\n | ButtonNode\n | ColumnNode\n | ColumnsNode\n | BulletListNode\n | DocumentNode\n | FooterNode\n | HardBreakNode\n | HeadingNode\n | ImageNode\n | InlineImageNode\n | InlineSpanNode\n | HorizontalRuleNode\n | HtmlCodeBlockNode\n | LinkCardNode\n | ListItemNode\n | OrderedListNode\n | ParagraphNode\n | RepeatNode\n | SectionNode\n | SpacerNode\n | TableCellNode\n | TableHeaderNode\n | TableNode\n | TableRowNode\n | TextNode\n | VariableNode;\n","import type {\n AnyMailyMark,\n BoldMark,\n CodeMark,\n HighlightMark,\n ItalicMark,\n LinkMark,\n MailyMarkType,\n SpanMark,\n StrikeMark,\n TextStyleMark,\n UnderlineMark,\n} from './mark';\nimport { allowedMarkTypes, MAILY_MARK_TYPES } from './mark';\nimport type {\n AnyMailyNode,\n BlockquoteNode,\n BodyNode,\n BulletListNode,\n ContainerNode,\n DocumentNode,\n FooterNode,\n HardBreakNode,\n HeadingNode,\n HorizontalRuleNode,\n HtmlCodeBlockNode,\n ImageNode,\n InlineImageNode,\n InlineSpanNode,\n LinkCardNode,\n ListItemNode,\n MailyNodeType,\n OrderedListNode,\n ButtonNode,\n ColumnNode,\n ColumnsNode,\n ParagraphNode,\n RepeatNode,\n SectionNode,\n SpacerNode,\n TableCellNode,\n TableHeaderNode,\n TableNode,\n TableRowNode,\n TextNode,\n VariableNode,\n} from './node';\nimport { allowedNodeTypes, MAILY_NODE_TYPES } from './node';\n\nfunction guard<T extends AnyMailyNode | AnyMailyMark>(type: string) {\n return (value: AnyMailyNode | AnyMailyMark): value is T =>\n value.type === type;\n}\n\nexport function isObject(val: unknown): val is object {\n return typeof val === 'object' && val !== null;\n}\n\nexport const is = {\n node(value: unknown): value is AnyMailyNode {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'type' in value &&\n allowedNodeTypes.includes(value.type as MailyNodeType)\n );\n },\n mark(value: unknown): value is AnyMailyMark {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'type' in value &&\n allowedMarkTypes.includes(value.type as MailyMarkType)\n );\n },\n parent(\n node: AnyMailyNode\n ): node is AnyMailyNode & { content: AnyMailyNode[] } {\n return Array.isArray(node?.content);\n },\n marked(node: AnyMailyNode): node is AnyMailyNode & { marks: AnyMailyMark[] } {\n return Array.isArray(node?.marks);\n },\n doc: guard<DocumentNode>(MAILY_NODE_TYPES.DOCUMENT),\n body: guard<BodyNode>(MAILY_NODE_TYPES.BODY),\n container: guard<ContainerNode>(MAILY_NODE_TYPES.CONTAINER),\n section: guard<SectionNode>(MAILY_NODE_TYPES.SECTION),\n columns: guard<ColumnsNode>(MAILY_NODE_TYPES.COLUMNS),\n column: guard<ColumnNode>(MAILY_NODE_TYPES.COLUMN),\n image: guard<ImageNode>(MAILY_NODE_TYPES.IMAGE),\n inlineImage: guard<InlineImageNode>(MAILY_NODE_TYPES.INLINE_IMAGE),\n inlineSpan: guard<InlineSpanNode>(MAILY_NODE_TYPES.INLINE_SPAN),\n spacer: guard<SpacerNode>(MAILY_NODE_TYPES.SPACER),\n button: guard<ButtonNode>(MAILY_NODE_TYPES.BUTTON),\n footer: guard<FooterNode>(MAILY_NODE_TYPES.FOOTER),\n paragraph: guard<ParagraphNode>(MAILY_NODE_TYPES.PARAGRAPH),\n heading: guard<HeadingNode>(MAILY_NODE_TYPES.HEADING),\n blockquote: guard<BlockquoteNode>(MAILY_NODE_TYPES.BLOCKQUOTE),\n horizontalRule: guard<HorizontalRuleNode>(MAILY_NODE_TYPES.HORIZONTAL_RULE),\n hardBreak: guard<HardBreakNode>(MAILY_NODE_TYPES.HARD_BREAK),\n htmlCodeBlock: guard<HtmlCodeBlockNode>(MAILY_NODE_TYPES.HTML_CODE_BLOCK),\n repeat: guard<RepeatNode>(MAILY_NODE_TYPES.REPEAT),\n bulletList: guard<BulletListNode>(MAILY_NODE_TYPES.BULLET_LIST),\n orderedList: guard<OrderedListNode>(MAILY_NODE_TYPES.ORDERED_LIST),\n listItem: guard<ListItemNode>(MAILY_NODE_TYPES.LIST_ITEM),\n linkCard: guard<LinkCardNode>(MAILY_NODE_TYPES.LINK_CARD),\n text: guard<TextNode>(MAILY_NODE_TYPES.TEXT),\n variable: guard<VariableNode>(MAILY_NODE_TYPES.VARIABLE),\n table: guard<TableNode>(MAILY_NODE_TYPES.TABLE),\n tableRow: guard<TableRowNode>(MAILY_NODE_TYPES.TABLE_ROW),\n tableCell: guard<TableCellNode>(MAILY_NODE_TYPES.TABLE_CELL),\n tableHeader: guard<TableHeaderNode>(MAILY_NODE_TYPES.TABLE_HEADER),\n bold: guard<BoldMark>(MAILY_MARK_TYPES.BOLD),\n italic: guard<ItalicMark>(MAILY_MARK_TYPES.ITALIC),\n strike: guard<StrikeMark>(MAILY_MARK_TYPES.STRIKE),\n underline: guard<UnderlineMark>(MAILY_MARK_TYPES.UNDERLINE),\n link: guard<LinkMark>(MAILY_MARK_TYPES.LINK),\n code: guard<CodeMark>(MAILY_MARK_TYPES.CODE),\n textStyle: guard<TextStyleMark>(MAILY_MARK_TYPES.TEXT_STYLE),\n highlight: guard<HighlightMark>(MAILY_MARK_TYPES.HIGHLIGHT),\n span: guard<SpanMark>(MAILY_MARK_TYPES.SPAN),\n};\n\nexport function isDef<T>(value: T | null | undefined): value is T {\n return value !== undefined && value !== null;\n}\n","export function isMergeableObject(\n value: unknown\n): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * One-level deep merge of plain objects. Nested plain objects are\n * shallow-merged; primitives, arrays, and null are replaced outright.\n * Does not mutate the target — returns a new object.\n *\n * Example:\n * deepMerge({ a: 1, nested: { x: 1, y: 2 } }, { nested: { y: 3 } })\n * // => { a: 1, nested: { x: 1, y: 3 } }\n */\nexport function deepMerge<T extends object>(\n target: T,\n ...sources: Partial<T>[]\n): T {\n const result = { ...target } as Record<string, unknown>;\n\n for (const source of sources) {\n for (const [key, value] of Object.entries(source)) {\n result[key] =\n isMergeableObject(value) && isMergeableObject(result[key])\n ? { ...result[key], ...value }\n : value;\n }\n }\n\n return result as T;\n}\n","import { MAILY_NODE_TYPES } from './node';\n\nexport const BLOCK_CONTAINER_TYPES: string[] = [\n MAILY_NODE_TYPES.DOCUMENT,\n MAILY_NODE_TYPES.BODY,\n MAILY_NODE_TYPES.CONTAINER,\n MAILY_NODE_TYPES.SECTION,\n MAILY_NODE_TYPES.COLUMN,\n MAILY_NODE_TYPES.REPEAT,\n MAILY_NODE_TYPES.BULLET_LIST,\n MAILY_NODE_TYPES.ORDERED_LIST,\n];\n\nexport const MARGIN_TOP_ABSORBER_TYPES: string[] = [MAILY_NODE_TYPES.SPACER];\n\nexport const MARGIN_BOTTOM_ABSORBER_TYPES: string[] = [\n MAILY_NODE_TYPES.SPACER,\n MAILY_NODE_TYPES.HORIZONTAL_RULE,\n];\n\nexport type NodePosition = {\n isFirst: boolean;\n isLast: boolean;\n nextType?: string | undefined;\n parentType?: string | undefined;\n previousType?: string | undefined;\n};\n\nexport function getSuppressedMargins(position: NodePosition) {\n const { isFirst, isLast, nextType, parentType, previousType } = position;\n const stacks =\n parentType !== undefined && BLOCK_CONTAINER_TYPES.includes(parentType);\n\n return {\n marginBottom:\n !stacks ||\n isLast ||\n MARGIN_BOTTOM_ABSORBER_TYPES.includes(nextType ?? ''),\n marginTop:\n !stacks ||\n isFirst ||\n MARGIN_TOP_ABSORBER_TYPES.includes(previousType ?? ''),\n };\n}\n","import { collapse, expand, objectify, stringify } from 'stylecast';\n\nexport type InlineStyle = Record<string, string>;\n\nexport function parseInlineStyles(style: string): InlineStyle {\n return objectify(style, { reactify: true });\n}\n\nexport function stringifyInlineStyles(style: InlineStyle): string {\n return stringify(style, { kebabCase: true });\n}\n\nexport function expandInlineStyles(style: InlineStyle): InlineStyle {\n return expand(style, { camelCase: true });\n}\n\nfunction collapseInlineStyles(style: InlineStyle): InlineStyle {\n return collapse(style, { camelCase: true });\n}\n\nexport function mergeInlineStyles(\n under: InlineStyle,\n over: InlineStyle\n): InlineStyle {\n return collapseInlineStyles({\n ...expandInlineStyles(under),\n ...expandInlineStyles(over),\n });\n}\n","export const TEXT_DIRECTIONS = {\n LTR: 'ltr',\n RTL: 'rtl',\n AUTO: 'auto',\n} as const;\n\nexport type TextDirection =\n (typeof TEXT_DIRECTIONS)[keyof typeof TEXT_DIRECTIONS];\n\nexport const DEFAULT_TEXT_DIRECTION: TextDirection = TEXT_DIRECTIONS.AUTO;\n\nexport function getCssDirection(dir: TextDirection | null | undefined) {\n if (dir && dir !== TEXT_DIRECTIONS.AUTO) {\n return { direction: dir };\n }\n\n return {};\n}\n","import { DEFAULT_VARIABLE_ATTRIBUTES, MAILY_NODE_TYPES } from './node';\nimport type { VariableAttributes } from './node';\n\nexport const DEFAULT_VARIABLE_START_TRIGGER = '{{';\n\nexport const DEFAULT_VARIABLE_END_TRIGGER = '}}';\n\ntype VariableAttributeName = keyof typeof DEFAULT_VARIABLE_ATTRIBUTES;\n\nconst LEGACY_HIDE_DEFAULT_VALUE = 'hideDefaultValue';\n\nfunction getQuotedValue(value: string): string {\n return `\"${value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"')}\"`;\n}\n\ntype SerializedAttributeOptions = {\n name: VariableAttributeName;\n value: VariableAttributes[VariableAttributeName];\n};\n\nfunction getSerializedAttribute(\n options: SerializedAttributeOptions\n): string | null {\n const { name, value } = options;\n\n if (value === undefined || value === DEFAULT_VARIABLE_ATTRIBUTES[name]) {\n return null;\n }\n\n if (typeof value === 'boolean') {\n return `${name}=${value}`;\n }\n\n return typeof value === 'string' ? `${name}=${getQuotedValue(value)}` : null;\n}\n\nexport function serializeVariableToText(variable: VariableAttributes): string {\n const { fallback, id, isDefaultEditable, label, required, style } = variable;\n\n const attributes = [\n getSerializedAttribute({ name: 'fallback', value: fallback }),\n getSerializedAttribute({\n name: 'isDefaultEditable',\n value: isDefaultEditable,\n }),\n getSerializedAttribute({\n name: 'label',\n value: label === id ? null : label,\n }),\n getSerializedAttribute({ name: 'required', value: required }),\n getSerializedAttribute({ name: 'style', value: style }),\n ].filter((attribute) => {\n return attribute !== null;\n });\n\n return [\n DEFAULT_VARIABLE_START_TRIGGER,\n [id, ...attributes].join(' '),\n DEFAULT_VARIABLE_END_TRIGGER,\n ].join('');\n}\n\nfunction getReferenceTokens(inner: string): string[] {\n const tokens: string[] = [];\n let token = '';\n let quoted = false;\n\n for (let index = 0; index < inner.length; index += 1) {\n const character = inner[index]!;\n\n if (quoted && character === '\\\\' && index + 1 < inner.length) {\n token += character + inner[index + 1];\n index += 1;\n continue;\n }\n\n if (character === '\"') {\n quoted = !quoted;\n token += character;\n continue;\n }\n\n if (!quoted && /\\s/.test(character)) {\n if (token) {\n tokens.push(token);\n token = '';\n }\n continue;\n }\n\n token += character;\n }\n\n if (token) {\n tokens.push(token);\n }\n\n return tokens;\n}\n\nfunction getUnquotedValue(value: string): unknown {\n if (value.startsWith('\"') && value.endsWith('\"') && value.length > 1) {\n return value.slice(1, -1).replace(/\\\\\"/g, '\"').replace(/\\\\\\\\/g, '\\\\');\n }\n\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n\n return value;\n}\n\nexport function deserializeVariableFromText(text: string): VariableAttributes {\n const inner = text\n .slice(\n DEFAULT_VARIABLE_START_TRIGGER.length,\n text.length - DEFAULT_VARIABLE_END_TRIGGER.length\n )\n .trim();\n\n const [id = '', ...pairs] = getReferenceTokens(inner);\n const attributes: Record<string, unknown> = { id };\n\n for (const pair of pairs) {\n const separator = pair.indexOf('=');\n if (separator <= 0) {\n continue;\n }\n\n const key = pair.slice(0, separator);\n const value = getUnquotedValue(pair.slice(separator + 1));\n\n if (key === LEGACY_HIDE_DEFAULT_VALUE) {\n attributes.isDefaultEditable ??= value !== true;\n continue;\n }\n\n attributes[key] = value;\n }\n\n return {\n ...DEFAULT_VARIABLE_ATTRIBUTES,\n ...attributes,\n } as VariableAttributes;\n}\n\ntype VariableSegment = {\n isReference: boolean;\n text: string;\n};\n\nexport function getVariableSegments(content: string): VariableSegment[] {\n const segments: VariableSegment[] = [];\n let plain = '';\n let index = 0;\n\n while (index < content.length) {\n if (!content.startsWith(DEFAULT_VARIABLE_START_TRIGGER, index)) {\n plain += content[index];\n index += 1;\n continue;\n }\n\n const end = getReferenceEnd({ content, start: index });\n if (end === -1) {\n plain += content[index];\n index += 1;\n continue;\n }\n\n if (plain) {\n segments.push({ isReference: false, text: plain });\n plain = '';\n }\n\n segments.push({ isReference: true, text: content.slice(index, end) });\n index = end;\n }\n\n if (plain) {\n segments.push({ isReference: false, text: plain });\n }\n\n return segments;\n}\n\ntype ReferenceEndOptions = {\n content: string;\n start: number;\n};\n\nfunction getReferenceEnd(options: ReferenceEndOptions): number {\n const { content, start } = options;\n let quoted = false;\n\n for (\n let index = start + DEFAULT_VARIABLE_START_TRIGGER.length;\n index < content.length;\n index += 1\n ) {\n const character = content[index]!;\n\n if (quoted && character === '\\\\') {\n index += 1;\n continue;\n }\n\n if (character === '\"') {\n quoted = !quoted;\n continue;\n }\n\n if (!quoted && content.startsWith(DEFAULT_VARIABLE_END_TRIGGER, index)) {\n return index + DEFAULT_VARIABLE_END_TRIGGER.length;\n }\n }\n\n return -1;\n}\n\nexport function buildDocFromVariableText(content: string) {\n return {\n type: MAILY_NODE_TYPES.DOCUMENT,\n content: [\n {\n type: MAILY_NODE_TYPES.PARAGRAPH,\n content: getVariableSegments(content).map((segment) => {\n return segment.isReference\n ? {\n type: MAILY_NODE_TYPES.VARIABLE,\n attrs: deserializeVariableFromText(segment.text),\n }\n : { type: MAILY_NODE_TYPES.TEXT, text: segment.text };\n }),\n },\n ],\n };\n}\n\nexport function hasVariableInText(text: string): boolean {\n const start = text.indexOf(DEFAULT_VARIABLE_START_TRIGGER);\n if (start === -1) {\n return false;\n }\n\n return (\n text.indexOf(\n DEFAULT_VARIABLE_END_TRIGGER,\n start + DEFAULT_VARIABLE_START_TRIGGER.length\n ) !== -1\n );\n}\n","export const VISIBILITY_ACTIONS = {\n SHOW: 'show',\n HIDE: 'hide',\n} as const;\n\nexport type AllowedVisibilityAction =\n (typeof VISIBILITY_ACTIONS)[keyof typeof VISIBILITY_ACTIONS];\n\nconst allowedVisibilityActions = Object.values(VISIBILITY_ACTIONS);\n\nexport const VISIBILITY_ACTION_OPTIONS: {\n label: string;\n value: AllowedVisibilityAction;\n}[] = [\n { label: 'Show if', value: VISIBILITY_ACTIONS.SHOW },\n { label: 'Hide if', value: VISIBILITY_ACTIONS.HIDE },\n];\n\nexport const VISIBILITY_OPERATORS = {\n IS_TRUE: 'is_true',\n IS_FALSE: 'is_false',\n EQUALS: 'equals',\n NOT_EQUALS: 'not_equals',\n CONTAINS: 'contains',\n NOT_CONTAINS: 'not_contains',\n STARTS_WITH: 'starts_with',\n ENDS_WITH: 'ends_with',\n GREATER_THAN: 'greater_than',\n LESS_THAN: 'less_than',\n} as const;\n\nexport type AllowedVisibilityOperator =\n (typeof VISIBILITY_OPERATORS)[keyof typeof VISIBILITY_OPERATORS];\n\nconst allowedVisibilityOperators = Object.values(VISIBILITY_OPERATORS);\n\nexport const VISIBILITY_OPERATOR_OPTIONS: {\n label: string;\n value: AllowedVisibilityOperator;\n}[] = [\n { label: 'Is true', value: VISIBILITY_OPERATORS.IS_TRUE },\n { label: 'Is false', value: VISIBILITY_OPERATORS.IS_FALSE },\n { label: 'Equals', value: VISIBILITY_OPERATORS.EQUALS },\n { label: 'Not equals', value: VISIBILITY_OPERATORS.NOT_EQUALS },\n { label: 'Contains', value: VISIBILITY_OPERATORS.CONTAINS },\n { label: 'Not contains', value: VISIBILITY_OPERATORS.NOT_CONTAINS },\n { label: 'Starts with', value: VISIBILITY_OPERATORS.STARTS_WITH },\n { label: 'Ends with', value: VISIBILITY_OPERATORS.ENDS_WITH },\n { label: 'Greater than', value: VISIBILITY_OPERATORS.GREATER_THAN },\n { label: 'Less than', value: VISIBILITY_OPERATORS.LESS_THAN },\n];\n\nconst VISIBILITY_OPERATORS_WITHOUT_VALUE: AllowedVisibilityOperator[] = [\n VISIBILITY_OPERATORS.IS_TRUE,\n VISIBILITY_OPERATORS.IS_FALSE,\n];\n\nexport type VisibilityRule = {\n action: AllowedVisibilityAction;\n operator: AllowedVisibilityOperator;\n value: string;\n variable: string;\n};\n\nexport type WithVisibilityAttrs = {\n visibilityRule?: VisibilityRule | null;\n};\n\nexport const DEFAULT_VISIBILITY_RULE: VisibilityRule = {\n action: VISIBILITY_ACTIONS.SHOW,\n operator: VISIBILITY_OPERATORS.EQUALS,\n value: '',\n variable: '',\n};\n\nexport function getVisibilityValueSupport(\n operator: AllowedVisibilityOperator\n): boolean {\n return !VISIBILITY_OPERATORS_WITHOUT_VALUE.includes(operator);\n}\n\ntype VisibilityRuleOptions = {\n action: string | null | undefined;\n operator: string | null | undefined;\n value: string | null | undefined;\n variable: string | null | undefined;\n};\n\nexport function getVisibilityRule(\n options: VisibilityRuleOptions\n): VisibilityRule | null {\n const { action, operator, value, variable } = options;\n\n const isAllowedAction = allowedVisibilityActions.some((candidate) => {\n return candidate === action;\n });\n const isAllowedOperator = allowedVisibilityOperators.some((candidate) => {\n return candidate === operator;\n });\n\n if (!(isAllowedAction && isAllowedOperator)) {\n return null;\n }\n\n return {\n action: action as AllowedVisibilityAction,\n operator: operator as AllowedVisibilityOperator,\n value: getVisibilityValueSupport(operator as AllowedVisibilityOperator)\n ? (value ?? '')\n : '',\n variable: variable ?? '',\n };\n}\n","import { DEFAULT_FONT, getFontFamilyValue } from './font';\nimport { MAILY_NODE_TYPES } from './node';\nimport { deepMerge } from './object';\nimport type { InlineStyle } from './style';\n\nexport type NodeThemeOptions = {\n blockquote?: InlineStyle;\n body?: InlineStyle;\n bulletList?: InlineStyle;\n button?: InlineStyle;\n code?: InlineStyle;\n container?: InlineStyle;\n footer?: InlineStyle;\n h1?: InlineStyle;\n h2?: InlineStyle;\n h3?: InlineStyle;\n heading?: InlineStyle;\n horizontalRule?: InlineStyle;\n htmlCodeBlock?: InlineStyle;\n link?: InlineStyle;\n listItem?: InlineStyle;\n orderedList?: InlineStyle;\n paragraph?: InlineStyle;\n section?: InlineStyle;\n table?: InlineStyle;\n tableCell?: InlineStyle;\n tableRow?: InlineStyle;\n};\n\nexport const DEFAULT_CONTAINER_MAX_WIDTH = 600;\n\nexport const BASIC_NODE_THEME: NodeThemeOptions = {\n blockquote: {\n borderColor: '#d1d5db',\n borderLeftStyle: 'solid',\n borderLeftWidth: '4px',\n color: '#374151',\n fontSize: '15px',\n fontStyle: 'italic',\n fontWeight: '500',\n lineHeight: '26px',\n marginBottom: '20px',\n marginLeft: '0',\n marginRight: '0',\n marginTop: '20px',\n paddingLeft: '16px',\n },\n body: {\n fontFamily: getFontFamilyValue({\n fallbackFontFamily: DEFAULT_FONT.fallbackFontFamily,\n fontFamily: DEFAULT_FONT.fontFamily,\n }),\n },\n bulletList: {\n listStyleType: 'disc',\n margin: '0',\n paddingLeft: '26px',\n },\n button: {\n backgroundColor: '#000000',\n borderRadius: '9999px',\n color: '#ffffff',\n fontSize: '14px',\n fontWeight: '500',\n lineHeight: '20px',\n padding: '10px 32px',\n },\n code: {\n borderRadius: '8px',\n fontFamily: 'ui-monospace, monospace',\n fontSize: '85%',\n padding: '2px 6px',\n },\n h1: {\n fontSize: '36px',\n fontWeight: '800',\n lineHeight: '40px',\n },\n h2: {\n fontSize: '30px',\n fontWeight: '700',\n lineHeight: '40px',\n },\n h3: {\n fontSize: '24px',\n fontWeight: '600',\n lineHeight: '38px',\n },\n heading: {\n color: '#101828',\n marginBottom: '12px',\n marginTop: '0',\n },\n horizontalRule: {\n border: 'none',\n borderTop: '1px solid #eaeaea',\n marginBottom: '32px',\n marginTop: '32px',\n },\n htmlCodeBlock: {\n marginBottom: '32px',\n },\n link: {\n color: '#0000ee',\n textDecoration: 'underline',\n },\n listItem: {\n marginBottom: '8px',\n paddingLeft: '6px',\n },\n orderedList: {\n listStyleType: 'decimal',\n margin: '0',\n paddingLeft: '26px',\n },\n footer: {\n color: '#64748B',\n display: 'block',\n fontSize: '14px',\n fontWeight: '400',\n lineHeight: '24px',\n marginBottom: '0',\n marginTop: '0',\n },\n paragraph: {\n color: '#18181b',\n fontSize: '14px',\n lineHeight: '24px',\n },\n section: {\n padding: '8px',\n },\n};\n\nexport const MAILY_NODE_THEME: NodeThemeOptions = {\n blockquote: {\n borderLeftColor: '#d1d5db',\n borderLeftStyle: 'solid',\n borderLeftWidth: '4px',\n color: '#374151',\n fontSize: '15px',\n fontStyle: 'italic',\n fontWeight: '500',\n lineHeight: '1.75',\n marginBottom: '20px',\n marginLeft: '0',\n marginRight: '0',\n marginTop: '20px',\n paddingLeft: '16px',\n },\n body: {\n backgroundColor: '#ffffff',\n fontFamily: getFontFamilyValue({\n fallbackFontFamily: DEFAULT_FONT.fallbackFontFamily,\n fontFamily: DEFAULT_FONT.fontFamily,\n }),\n padding: '0',\n },\n bulletList: {\n listStyleType: 'disc',\n marginBottom: '20px',\n marginLeft: '0',\n marginRight: '0',\n marginTop: '0',\n paddingLeft: '26px',\n },\n button: {\n backgroundColor: '#000000',\n borderRadius: '9999px',\n color: '#ffffff',\n fontSize: '14px',\n fontWeight: '600',\n lineHeight: '1.4285714',\n marginBottom: '20px',\n padding: '10px 32px',\n },\n code: {\n backgroundColor: '#efefef',\n borderRadius: '8px',\n color: '#111827',\n fontFamily: 'ui-monospace, monospace',\n fontSize: '85%',\n padding: '2px 6px',\n },\n container: {\n backgroundColor: '#ffffff',\n maxWidth: `${DEFAULT_CONTAINER_MAX_WIDTH}px`,\n minWidth: '300px',\n padding: '8px',\n },\n footer: {\n color: '#64748b',\n display: 'block',\n fontSize: '14px',\n fontWeight: '400',\n lineHeight: '1.7142857',\n marginBottom: '20px',\n marginTop: '0',\n },\n h1: {\n fontSize: '36px',\n fontWeight: '600',\n lineHeight: '1.1111111',\n },\n h2: {\n fontSize: '30px',\n fontWeight: '600',\n lineHeight: '1.3333333',\n },\n h3: {\n fontSize: '24px',\n fontWeight: '600',\n lineHeight: '1.6',\n },\n heading: {\n color: '#111827',\n marginBottom: '12px',\n marginTop: '0',\n },\n horizontalRule: {\n border: 'none',\n borderTop: '1px solid #eaeaea',\n marginBottom: '32px',\n marginTop: '32px',\n },\n htmlCodeBlock: {\n marginBottom: '32px',\n },\n link: {\n color: '#111827',\n textDecoration: 'underline',\n },\n listItem: {\n color: '#d1d5dc',\n marginBottom: '8px',\n marginTop: '8px',\n paddingLeft: '6px',\n },\n orderedList: {\n listStyleType: 'decimal',\n marginBottom: '20px',\n marginLeft: '0',\n marginRight: '0',\n marginTop: '0',\n paddingLeft: '26px',\n },\n paragraph: {\n color: '#374151',\n fontSize: '15px',\n fontWeight: '400',\n lineHeight: '1.75',\n marginBottom: '20px',\n marginTop: '0',\n MozOsxFontSmoothing: 'grayscale',\n WebkitFontSmoothing: 'antialiased',\n },\n section: {\n backgroundColor: '#f7f7f7',\n border: '2px solid #e2e2e2',\n borderRadius: '0',\n marginBottom: '20px',\n padding: '0',\n },\n};\n\nexport type ExtendNodeThemeOptions = {\n extension: NodeThemeOptions;\n preset: NodeThemeOptions;\n};\n\nexport function extendNodeTheme(\n options: ExtendNodeThemeOptions\n): NodeThemeOptions {\n const { extension, preset } = options;\n\n return deepMerge(preset, extension);\n}\n\nexport type ThemeDeclarationsOptions = {\n attrs?: Record<string, unknown> | undefined;\n theme: NodeThemeOptions;\n type: string;\n};\n\nexport function getThemeDeclarations(\n options: ThemeDeclarationsOptions\n): InlineStyle | undefined {\n const { attrs, theme, type } = options;\n const declarations = theme[type as keyof NodeThemeOptions];\n\n if (type !== MAILY_NODE_TYPES.HEADING) {\n return declarations;\n }\n\n const level =\n typeof attrs?.level === 'number'\n ? theme[`h${attrs.level}` as keyof NodeThemeOptions]\n : undefined;\n if (!(declarations || level)) {\n return;\n }\n\n return { ...declarations, ...level };\n}\n"],"mappings":";;AAAA,MAAa,kBAAkB;CAC7B,MAAM;CACN,QAAQ;CACR,OAAO;AACT;AAKA,MAAM,oBAAqD,OAAO,OAChE,OAAO,OAAO,eAAe,CAC/B;AAEA,MAAa,qBAA2C,gBAAgB;AAExE,SAAgB,uBACd,OAC+B;CAC/B,OACE,OAAO,UAAU,YACjB,kBAAkB,SAAS,KAA6B;AAE5D;;;ACpBA,MAAa,gBAAgB;CAC3B,OAAO;CACP,QAAQ;CACR,QAAQ;AACV;AAKA,MAAM,sBAAqD,OAAO,OAChE,OAAO,OAAO,aAAa,CAC7B;AAEA,MAAa,uBAA2C,cAAc;AAEtE,SAAgB,qBACd,OAC6B;CAC7B,OACE,OAAO,UAAU,YACjB,oBAAoB,SAAS,KAA2B;AAE5D;;;;;;AAaA,SAAgB,eAAe,OAAiC;CAC9D,MAAM,SAAS,MAAM,UAAU,GAAA,CAAI,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO;CAErE,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,KAAK,MAAM,QAAQ,OACjB,IAAI,qBAAqB,IAAI,KAAK,SAAS,QACzC,cAAc;MACT,IAAI,SAAS,KAAK,IAAI,GAC3B,QAAQ;MAER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;EACT,OAAO;EACP,UAAU;EACV,YAAY;EACZ,YAAY;EACZ,cAAc;EACd,WAAW;EACX,qBAAqB;EACrB,qBAAqB;CACvB;CACA,SAAS;EACP,iBAAiB;EACjB,QAAQ;EACR,cAAc;EACd,cAAc;EACd,SAAS;CACX;AACF;AAOA,SAAgB,gBACd,SACkB;CAClB,MAAM,EAAE,WAAW,WAAW;CAE9B,OAAO,UAAU,QAAQ,SAAS;AACpC;AAQA,SAAgB,qBACd,SACyB;CACzB,MAAM,EAAE,OAAO,OAAO,SAAS;CAC/B,MAAM,eAAe,MAAM;CAE3B,IAAI,SAAS,iBAAiB,SAC5B,OAAO;CAGT,MAAM,QACJ,OAAO,OAAO,UAAU,WACpB,MAAM,IAAI,MAAM,WAChB,KAAA;CACN,IAAI,EAAE,gBAAgB,QACpB;CAGF,OAAO;EAAE,GAAG;EAAc,GAAG;CAAM;AACrC"}
|
package/package.json
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maily-to/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared utilities for Maily",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"keywords": [
|
|
7
|
+
"email",
|
|
8
|
+
"maily.to",
|
|
9
|
+
"react"
|
|
10
|
+
],
|
|
11
|
+
"author": "Arik Chakma <arikchangma@gmail.com>",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/arikchakma/maily.to.git",
|
|
15
|
+
"directory": "packages/shared"
|
|
16
|
+
},
|
|
10
17
|
"files": [
|
|
11
18
|
"dist/**"
|
|
12
19
|
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"main": "./dist/index.cjs",
|
|
23
|
+
"module": "./dist/index.mjs",
|
|
24
|
+
"types": "./dist/index.d.cts",
|
|
13
25
|
"exports": {
|
|
14
26
|
".": {
|
|
15
27
|
"import": "./dist/index.mjs",
|
|
16
|
-
"require": "./dist/index.
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
17
29
|
},
|
|
18
30
|
"./package.json": "./package.json"
|
|
19
31
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"url": "git+https://github.com/arikchakma/maily.to.git",
|
|
23
|
-
"directory": "packages/shared"
|
|
24
|
-
},
|
|
25
|
-
"author": "Arik Chakma <arikchangma@gmail.com>",
|
|
26
|
-
"keywords": [
|
|
27
|
-
"maily.to",
|
|
28
|
-
"react",
|
|
29
|
-
"email"
|
|
30
|
-
],
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"typescript": "^5.8.2",
|
|
33
|
-
"tsconfig": "0.0.0"
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"csstype": "^3.
|
|
37
|
-
"
|
|
36
|
+
"csstype": "^3.2.3",
|
|
37
|
+
"stylecast": "^0.2.0"
|
|
38
38
|
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"bumpp": "^12.1.1",
|
|
41
|
+
"typescript": "^7.0.2",
|
|
42
|
+
"vite-plus": "0.3.0",
|
|
43
|
+
"@maily-to/tsconfig": "0.0.0"
|
|
41
44
|
},
|
|
42
45
|
"scripts": {
|
|
43
|
-
"
|
|
46
|
+
"build": "vp pack",
|
|
44
47
|
"clean": "rm -rf dist",
|
|
45
|
-
"
|
|
48
|
+
"dev": "vp pack --watch --no-clean",
|
|
49
|
+
"release": "bumpp",
|
|
50
|
+
"test": "vp test run --passWithNoTests",
|
|
51
|
+
"test:watch": "vp test"
|
|
46
52
|
}
|
|
47
53
|
}
|
package/readme.md
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
<br>
|
|
3
|
-
|
|
4
|
-
<div align="center"><strong>@maily-to/shared</strong></div>
|
|
5
|
-
<div align="center">Shared utilities for <a href="https://maily.to">Maily</a>.</div>
|
|
6
|
-
<br />
|
|
1
|
+
[](https://maily.to)
|
|
7
2
|
|
|
8
3
|
<p align="center">
|
|
9
|
-
<a href="https://github.com/arikchakma/maily.to/blob/main/
|
|
4
|
+
<a href="https://github.com/arikchakma/maily.to/blob/main/LICENSE">
|
|
10
5
|
<img src="https://img.shields.io/badge/License-MIT-222222.svg" />
|
|
11
6
|
</a>
|
|
12
7
|
<a href="https://buymeacoffee.com/arikchakma">
|
|
@@ -16,7 +11,7 @@
|
|
|
16
11
|
|
|
17
12
|
<br>
|
|
18
13
|
|
|
19
|
-
|
|
14
|
+
### Install
|
|
20
15
|
|
|
21
16
|
Install `@maily-to/shared` from your command line.
|
|
22
17
|
|
|
@@ -24,10 +19,51 @@ Install `@maily-to/shared` from your command line.
|
|
|
24
19
|
pnpm add @maily-to/shared
|
|
25
20
|
```
|
|
26
21
|
|
|
27
|
-
|
|
22
|
+
<br>
|
|
23
|
+
|
|
24
|
+
### What is in here
|
|
25
|
+
|
|
26
|
+
`@maily-to/shared` is the root package. It owns the vocabulary that
|
|
27
|
+
`@maily-to/core`, `@maily-to/render`, and `@maily-to/migration` all speak, and
|
|
28
|
+
it depends on none of them.
|
|
29
|
+
|
|
30
|
+
| Export group | Contents |
|
|
31
|
+
| -------------- | ------------------------------------------------------------------ |
|
|
32
|
+
| Document types | `DocumentNode`, `AnyMailyNode`, node and mark attribute types |
|
|
33
|
+
| Guards | `guard<T>()`-derived type guards for every node and mark |
|
|
34
|
+
| Style | `InlineStyle` and the helpers that read and write a `style` object |
|
|
35
|
+
| Theme | `NodeThemeOptions`, `BASIC_NODE_THEME` |
|
|
36
|
+
| Constants | `MAILY_NODE_TYPES`, `MAILY_MARK_TYPES`, trigger and limit values |
|
|
37
|
+
|
|
38
|
+
#### Documents
|
|
39
|
+
|
|
40
|
+
A Maily document is a Tiptap `doc` whose hierarchy mirrors the HTML it renders
|
|
41
|
+
to — `doc > body > container+ > blocks`. Authored styling lives in each node's
|
|
42
|
+
and mark's `style` attribute, so a document carries its own appearance and the
|
|
43
|
+
renderer applies no theme of its own.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import type { DocumentNode } from '@maily-to/shared';
|
|
47
|
+
import { BASIC_NODE_THEME, MAILY_NODE_TYPES } from '@maily-to/shared';
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### Themes
|
|
51
|
+
|
|
52
|
+
`NodeThemeOptions` maps a node type to an `InlineStyle`. `BASIC_NODE_THEME` is
|
|
53
|
+
a plain starter theme. Pass it to `ThemeExtension` to start from it, or omit it
|
|
54
|
+
for an unthemed document.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { BASIC_NODE_THEME } from '@maily-to/shared';
|
|
58
|
+
import { ThemeExtension } from '@maily-to/core/extensions';
|
|
59
|
+
|
|
60
|
+
ThemeExtension.configure({ theme: BASIC_NODE_THEME });
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Contributions
|
|
28
64
|
|
|
29
65
|
Feel free to submit pull requests, create issues, or spread the word.
|
|
30
66
|
|
|
31
|
-
|
|
67
|
+
### License
|
|
32
68
|
|
|
33
|
-
MIT © [Arik Chakma](https://
|
|
69
|
+
MIT © [Arik Chakma](https://x.com/imarikchakma)
|
package/dist/index.d.ts
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import * as CSS$1 from "csstype";
|
|
2
|
-
import * as CSS from "csstype";
|
|
3
|
-
|
|
4
|
-
//#region src/theme.d.ts
|
|
5
|
-
declare const allowedFallbackFonts: readonly ["Arial", "Helvetica", "Verdana", "Georgia", "Times New Roman", "serif", "sans-serif", "monospace", "cursive", "fantasy"];
|
|
6
|
-
type FallbackFont = (typeof allowedFallbackFonts)[number];
|
|
7
|
-
declare const allowedFontFormats: readonly ["woff", "woff2", "truetype", "opentype", "embedded-opentype", "svg"];
|
|
8
|
-
type FontFormat = (typeof allowedFontFormats)[number];
|
|
9
|
-
type FontWeight = CSS$1.Properties["fontWeight"];
|
|
10
|
-
type FontStyle = CSS$1.Properties["fontStyle"];
|
|
11
|
-
interface FontProps {
|
|
12
|
-
/** The font you want to use. NOTE: Do not insert multiple fonts here, use fallbackFontFamily for that */
|
|
13
|
-
fontFamily: string;
|
|
14
|
-
/** An array is possible, but the order of the array is the priority order */
|
|
15
|
-
fallbackFontFamily: FallbackFont;
|
|
16
|
-
/** Not all clients support web fonts. For support check: https://www.caniemail.com/features/css-at-font-face/ */
|
|
17
|
-
webFont?: {
|
|
18
|
-
url: string;
|
|
19
|
-
format: FontFormat;
|
|
20
|
-
};
|
|
21
|
-
/** Default: 'normal' */
|
|
22
|
-
fontStyle?: FontStyle;
|
|
23
|
-
/** Default: 400 */
|
|
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;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* The theme options for the editor.
|
|
35
|
-
* currently, we don't allow any customizations for the colors in the editor.
|
|
36
|
-
* that's why we have a separate theme for the editor.
|
|
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
|
-
}
|
|
70
|
-
declare const DEFAULT_FONT: FontProps;
|
|
71
|
-
declare const DEFAULT_LINK_TEXT_COLOR = "#111827";
|
|
72
|
-
declare const DEFAULT_RENDERER_THEME: RendererThemeOptions;
|
|
73
|
-
declare const DEFAULT_EDITOR_THEME: EditorThemeOptions;
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region src/css-variables.d.ts
|
|
76
|
-
declare module "csstype" {
|
|
77
|
-
interface Properties {
|
|
78
|
-
[index: `--mly-${string}`]: any;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* if the value is undefined, it will return an empty object
|
|
83
|
-
* so that we don't override the default value
|
|
84
|
-
* @param name - The name of the CSS variable
|
|
85
|
-
* @param value - The value of the CSS variable
|
|
86
|
-
* @returns The CSS variable value
|
|
87
|
-
*/
|
|
88
|
-
declare function getVariableValue(name: `--mly-${string}`, value: any): CSS.Properties;
|
|
89
|
-
/**
|
|
90
|
-
* Get the CSS variables for the theme
|
|
91
|
-
* @param theme - The theme
|
|
92
|
-
* @returns The CSS variables
|
|
93
|
-
* @example
|
|
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;
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/font.d.ts
|
|
109
|
-
type Font = Pick<FontProps, "fontFamily" | "fallbackFontFamily" | "webFont">;
|
|
110
|
-
declare function loadFont(font: Font): void;
|
|
111
|
-
declare function fontStyle(font: Font): string;
|
|
112
|
-
//#endregion
|
|
113
|
-
export { BaseThemeOptions, DEFAULT_EDITOR_THEME, DEFAULT_FONT, DEFAULT_LINK_TEXT_COLOR, DEFAULT_RENDERER_THEME, EditorThemeOptions, FallbackFont, FontFormat, FontProps, RendererThemeOptions, allowedFallbackFonts, allowedFontFormats, fontStyle, getMailyCssVariables, getVariableValue, loadFont };
|
|
114
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["DEFAULT_FONT: FontProps","DEFAULT_RENDERER_THEME: RendererThemeOptions","DEFAULT_EDITOR_THEME: EditorThemeOptions","name: `--mly-${string}`","value: any","theme: EditorThemeOptions","font: Font"],"sources":["../src/theme.ts","../src/css-variables.ts","../src/font.ts"],"sourcesContent":[],"mappings":";;;;cAEa;KAaD,YAAA,WAAuB;cAEtB;AAfA,KAwBD,UAAA,GAxBC,CAAA,O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