@emabuild/email-renderer 0.3.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +102 -5
  2. package/dist/index.d.ts +19 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1371 -109
  5. package/dist/index.js.map +1 -1
  6. package/dist/layout/document-shell.d.ts +23 -1
  7. package/dist/layout/document-shell.d.ts.map +1 -1
  8. package/dist/layout/fluid-hybrid.d.ts +23 -2
  9. package/dist/layout/fluid-hybrid.d.ts.map +1 -1
  10. package/dist/layout/web-layout.d.ts +51 -0
  11. package/dist/layout/web-layout.d.ts.map +1 -0
  12. package/dist/render.d.ts +101 -1
  13. package/dist/render.d.ts.map +1 -1
  14. package/dist/utils/border.d.ts +7 -0
  15. package/dist/utils/border.d.ts.map +1 -0
  16. package/dist/utils/css-inliner.d.ts +58 -0
  17. package/dist/utils/css-inliner.d.ts.map +1 -0
  18. package/dist/utils/css.d.ts +67 -0
  19. package/dist/utils/css.d.ts.map +1 -0
  20. package/dist/utils/dark-mode.d.ts +12 -0
  21. package/dist/utils/dark-mode.d.ts.map +1 -0
  22. package/dist/utils/display-condition.d.ts +11 -0
  23. package/dist/utils/display-condition.d.ts.map +1 -0
  24. package/dist/utils/html-cleanup.d.ts +20 -0
  25. package/dist/utils/html-cleanup.d.ts.map +1 -0
  26. package/dist/utils/html-minifier.d.ts +20 -0
  27. package/dist/utils/html-minifier.d.ts.map +1 -0
  28. package/dist/utils/html-sanitizer.d.ts.map +1 -1
  29. package/dist/utils/html-tokenizer.d.ts +89 -0
  30. package/dist/utils/html-tokenizer.d.ts.map +1 -0
  31. package/dist/utils/plain-text.d.ts +52 -0
  32. package/dist/utils/plain-text.d.ts.map +1 -0
  33. package/dist/utils/responsive-css.d.ts +16 -0
  34. package/dist/utils/responsive-css.d.ts.map +1 -1
  35. package/dist/utils/responsive-overrides.d.ts +61 -0
  36. package/dist/utils/responsive-overrides.d.ts.map +1 -0
  37. package/package.json +22 -12
@@ -0,0 +1,51 @@
1
+ import { DesignRow, BodyValues } from '@emabuild/types';
2
+ type ContentRenderer = (values: Record<string, unknown>, ctx: any) => string;
3
+ /**
4
+ * Render a single design row as a responsive web `<div>` block
5
+ * (flex columns; see the module docs). The row's `displayCondition` wraps it.
6
+ *
7
+ * @param row - Design row
8
+ * @param bodyValues - Design body values (`contentWidth` = container max-width)
9
+ * @param toolRenderers - Tool name → HTML render function (`ctx.displayMode = 'web'`)
10
+ */
11
+ export declare function renderWebRow(row: DesignRow, bodyValues: BodyValues, toolRenderers: Map<string, ContentRenderer>): string;
12
+ /**
13
+ * Remove Outlook conditional comments from tool markup: downlevel-hidden
14
+ * blocks (`<!--[if mso]>…<![endif]-->`, VML buttons, ghost tables) are
15
+ * dropped, downlevel-revealed markers (`<!--[if !mso]><!-->` …
16
+ * `<!--<![endif]-->`) are unwrapped so their content stays.
17
+ *
18
+ * @param html - Rendered HTML
19
+ */
20
+ export declare function stripMsoConditionals(html: string): string;
21
+ /**
22
+ * Base stylesheet of the web layout: container, flex columns, stacking under
23
+ * the mobile breakpoint and the `hideDesktop` / `hideMobile` classes.
24
+ *
25
+ * @param contentWidth - Container max-width in px
26
+ */
27
+ export declare function getWebCss(contentWidth: number): string;
28
+ /** Extra head content for {@link wrapInWebShell} */
29
+ export interface WebShellExtras {
30
+ /** Web font stylesheet URLs (`<link rel="stylesheet">`) */
31
+ fontUrls?: string[];
32
+ /** Additional CSS blocks emitted after the base stylesheet */
33
+ styles?: string[];
34
+ /** Document `<title>` (escaped) */
35
+ title?: string;
36
+ /** `<html lang>` (default `en`) */
37
+ lang?: string;
38
+ }
39
+ /**
40
+ * Wrap rendered web rows in an HTML5 document: `<meta charset>` and
41
+ * `<meta viewport>`, font links, the base web stylesheet plus extra styles,
42
+ * and a `.u_body` wrapper carrying the body background colour/image, text
43
+ * colour and font family.
44
+ *
45
+ * @param bodyHtml - Rendered rows (see {@link renderWebRow})
46
+ * @param bodyValues - Design body values
47
+ * @param extras - Fonts, styles, title, lang
48
+ */
49
+ export declare function wrapInWebShell(bodyHtml: string, bodyValues: BodyValues, extras?: WebShellExtras): string;
50
+ export {};
51
+ //# sourceMappingURL=web-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-layout.d.ts","sourceRoot":"","sources":["../../src/layout/web-layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAgB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAQ3E,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;AAoB7E;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GAC1C,MAAM,CAkCR;AAwBD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAoBtD;AAqBD,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,GAAE,cAAmB,GAAG,MAAM,CAgC5G"}
package/dist/render.d.ts CHANGED
@@ -1,5 +1,105 @@
1
1
  import { EmailDesign, ExportResult, ExportOptions } from '@emabuild/types';
2
+ import { PlainTextOptions } from './utils/plain-text.js';
2
3
  type ContentRenderer = (values: Record<string, unknown>, ctx: any) => string;
3
- export declare function renderDesignToHtml(design: EmailDesign, toolRenderers: Map<string, ContentRenderer>, options?: ExportOptions): ExportResult;
4
+ /**
5
+ * Export options accepted by the renderer. Extends the shared
6
+ * `ExportOptions` with fields not (yet) declared there.
7
+ */
8
+ export type RenderOptions = ExportOptions & {
9
+ /** `'web'` renders a responsive web page; anything else (default) renders email HTML */
10
+ displayMode?: string;
11
+ /** Per-row render cache (same as the 4th argument's `cache`) */
12
+ cache?: RenderCache;
13
+ };
14
+ /** Extra, non-serializable render settings (4th argument of {@link renderDesignToHtml}) */
15
+ export interface RenderContext {
16
+ /** Reuse rendered rows across calls; see {@link createRenderCache} */
17
+ cache?: RenderCache;
18
+ }
19
+ /** Hit/miss counters of a {@link RenderCache} */
20
+ export interface RenderCacheStats {
21
+ hits: number;
22
+ misses: number;
23
+ }
24
+ /**
25
+ * Per-row render cache, keyed by row object identity (`WeakMap`, so dropped
26
+ * rows are garbage collected). Create one with {@link createRenderCache}.
27
+ *
28
+ * Contract: a row object must not be mutated after it has been rendered with
29
+ * a cache (immutable / structurally shared designs, like the editor store's).
30
+ * Mutating a row in place returns stale HTML; replace the row object instead
31
+ * (or call `clear()`).
32
+ */
33
+ export interface RenderCache {
34
+ /** Counters, cumulative since creation / last `clear()` */
35
+ readonly stats: RenderCacheStats;
36
+ /** Drop every cached row and reset the counters */
37
+ clear(): void;
38
+ }
39
+ /**
40
+ * Create a per-row render cache for {@link renderDesignToHtml}. Rendering the
41
+ * same row object again (same body settings, display mode and tool renderer
42
+ * map) reuses its HTML, so re-exporting an immutable design after a small
43
+ * edit only re-renders the changed rows.
44
+ *
45
+ * @example
46
+ * const cache = createRenderCache();
47
+ * renderDesignToHtml(design, renderers, options, { cache });
48
+ */
49
+ export declare function createRenderCache(): RenderCache;
50
+ /**
51
+ * Render a design JSON into a complete, cross-client email HTML document —
52
+ * or, with `displayMode: 'web'`, a responsive web page (`<div>` flex layout,
53
+ * plain stylesheet, no MSO/VML).
54
+ *
55
+ * Pipeline: render (headers → rows → footers) → hoist body `<style>` blocks
56
+ * into the head → mobile override CSS (`_override.mobile`) → merge tags → design tags →
57
+ * CSS inlining (`inlineStyles`) → cleanup (`cleanup`) → minification (`minify`).
58
+ *
59
+ * @param design - Design JSON
60
+ * @param toolRenderers - Map of tool name → HTML render function. Keep the
61
+ * same Map instance across calls to benefit from a render cache.
62
+ * @param options - Export options (plus `displayMode`)
63
+ * @param context - `{ cache }`: per-row render cache ({@link createRenderCache});
64
+ * `options.cache` is accepted too
65
+ * @returns Full HTML plus body/css/fonts chunks
66
+ */
67
+ export declare function renderDesignToHtml(design: EmailDesign, toolRenderers: Map<string, ContentRenderer>, options?: RenderOptions, context?: RenderContext): ExportResult;
68
+ /**
69
+ * Render a design straight to plain text (the `text/plain` alternative of an
70
+ * email): {@link renderDesignToHtml} (merge/design tags applied, no inlining
71
+ * or minification needed) followed by {@link renderPlainText}.
72
+ *
73
+ * @param design - Design JSON
74
+ * @param toolRenderers - Map of tool name → HTML render function
75
+ * @param options - Export options (merge/design tags) plus plain-text options
76
+ * @param context - `{ cache }` (see {@link renderDesignToHtml})
77
+ * @returns Plain text
78
+ */
79
+ export declare function renderDesignToPlainText(design: EmailDesign, toolRenderers: Map<string, ContentRenderer>, options?: RenderOptions & PlainTextOptions, context?: RenderContext): string;
80
+ /**
81
+ * Replace design tags (`{{name}}` by default) with their values.
82
+ *
83
+ * @param html - HTML to process
84
+ * @param tags - Map of tag name → replacement value
85
+ * @param delimiter - Opening/closing delimiters (default `['{{', '}}']`)
86
+ * @returns HTML with design tags replaced
87
+ */
88
+ export declare function replaceDesignTags(html: string, tags: Record<string, string>, delimiter?: [string, string]): string;
89
+ /**
90
+ * Collect every distinct web font URL used by a design: the body font plus
91
+ * any `fontFamily` / `*FontFamily` value of contents in headers, rows and footers.
92
+ *
93
+ * @param design - Design JSON
94
+ * @returns Deduplicated font stylesheet URLs, in order of first use
95
+ */
96
+ export declare function collectFontUrls(design: EmailDesign): string[];
97
+ /**
98
+ * CSS of every `<style>` element outside comments, joined by newlines.
99
+ * A single linear regex scan (equivalent to walking the tokenizer output,
100
+ * but much cheaper on large documents): comments and `<script>` /
101
+ * `<textarea>` raw text are skipped.
102
+ */
103
+ export declare function extractTopLevelCss(html: string): string;
4
104
  export {};
5
105
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAc,MAAM,iBAAiB,CAAC;AAM5F,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;AAE7E,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC3C,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA6Cd"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAyB,MAAM,iBAAiB,CAAC;AAYvG,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG/E,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC1C,wFAAwF;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IACh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,GAAG,MAAM,CAUvD"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Inline CSS for a 12-key border object (`borderTopWidth`, `borderTopStyle`,
3
+ * `borderTopColor`, …). Sides with no width (or 0) are skipped, so an empty
4
+ * or default border renders nothing.
5
+ */
6
+ export declare function borderToCss(border: unknown): string;
7
+ //# sourceMappingURL=border.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/utils/border.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAanD"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @module css-inliner
3
+ *
4
+ * Dependency-free CSS inliner for email HTML. Runs in the browser and Node.js.
5
+ *
6
+ * Rules from `<style>` blocks are copied into matching elements' `style`
7
+ * attributes, following CSS specificity and source order; declarations already
8
+ * present inline always win.
9
+ *
10
+ * What is NOT inlined (and stays in a `<style>` block):
11
+ * - every at-rule (`@media`, `@font-face`, `@import`, `@supports`, ...)
12
+ * - selectors with pseudo-classes / pseudo-elements (`:hover`, `::before`),
13
+ * attribute selectors and sibling combinators (`+`, `~`)
14
+ * - `!important` declarations (inlining them would defeat responsive
15
+ * `@media` overrides, which rely on `!important` beating inline styles)
16
+ * - `<style>` blocks with a `media` attribute, or inside comments (e.g.
17
+ * MSO conditional comments, which are never touched)
18
+ *
19
+ * Inlined rules are removed from their `<style>` block; a block that becomes
20
+ * empty is removed entirely.
21
+ */
22
+ /** Options for {@link inlineCss} */
23
+ export interface InlineCssOptions {
24
+ /** Remove inlined rules from the `<style>` blocks (default: true) */
25
+ removeInlinedRules?: boolean;
26
+ }
27
+ /** One compound selector (`p.intro#x`) */
28
+ interface CompoundSelector {
29
+ tag: string | null;
30
+ id: string | null;
31
+ classes: string[];
32
+ }
33
+ /** Parsed complex selector, stored right-to-left */
34
+ interface ParsedSelector {
35
+ /** compounds[0] is the subject (rightmost) */
36
+ compounds: CompoundSelector[];
37
+ /** combinators[i] links compounds[i] to compounds[i + 1]: ' ' or '>' */
38
+ combinators: Array<' ' | '>'>;
39
+ specificity: [number, number, number];
40
+ }
41
+ /**
42
+ * Parse a selector if it is supported by the inliner.
43
+ * Supports type, `*`, `.class`, `#id`, compound selectors and the
44
+ * descendant / child (`>`) combinators.
45
+ *
46
+ * @returns Parsed selector, or `null` if the selector must not be inlined
47
+ */
48
+ export declare function parseInlinableSelector(selector: string): ParsedSelector | null;
49
+ /**
50
+ * Inline CSS from `<style>` blocks into elements' `style` attributes.
51
+ *
52
+ * @param html - Full HTML document (or fragment containing `<style>` blocks)
53
+ * @param options - Inliner options
54
+ * @returns HTML with styles inlined; non-inlinable CSS stays in `<style>` blocks
55
+ */
56
+ export declare function inlineCss(html: string, options?: InlineCssOptions): string;
57
+ export {};
58
+ //# sourceMappingURL=css-inliner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-inliner.d.ts","sourceRoot":"","sources":["../../src/utils/css-inliner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAkBH,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,0CAA0C;AAC1C,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,oDAAoD;AACpD,UAAU,cAAc;IACtB,8CAA8C;IAC9C,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,wEAAwE;IACxE,WAAW,EAAE,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IAC9B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAmBD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CA0C9E;AAqED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAuG9E"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @module css
3
+ *
4
+ * Minimal, dependency-free CSS utilities used by the inliner and minifier:
5
+ * a top-level stylesheet parser, a declaration parser and a CSS minifier.
6
+ * String literals and parentheses (e.g. `url(data:...;base64,...)`) are
7
+ * respected when splitting.
8
+ */
9
+ /** A single `property: value` declaration */
10
+ export interface CssDeclaration {
11
+ /** Property name, lowercased */
12
+ property: string;
13
+ /** Value without the `!important` flag */
14
+ value: string;
15
+ important: boolean;
16
+ }
17
+ /** A top-level style rule (`selectors { declarations }`) */
18
+ export interface CssStyleRule {
19
+ type: 'rule';
20
+ selectors: string[];
21
+ declarations: CssDeclaration[];
22
+ /** Original source text of the rule */
23
+ raw: string;
24
+ }
25
+ /** Any at-rule (`@media`, `@font-face`, `@import`, ...), kept verbatim */
26
+ export interface CssAtRule {
27
+ type: 'at-rule';
28
+ /** At-rule name, lowercased, without `@` */
29
+ name: string;
30
+ raw: string;
31
+ }
32
+ export type CssItem = CssStyleRule | CssAtRule;
33
+ /** Remove `/* ... *\/` comments, leaving string literals untouched. */
34
+ export declare function stripCssComments(css: string): string;
35
+ /**
36
+ * Split a string on a separator character at nesting depth 0.
37
+ *
38
+ * @param input - Text to split
39
+ * @param separator - Single separator character (e.g. `,` or `;`)
40
+ */
41
+ export declare function splitTopLevel(input: string, separator: string): string[];
42
+ /**
43
+ * Parse a declaration block body (or a `style` attribute value).
44
+ *
45
+ * @param body - e.g. `color: red; padding: 0 !important`
46
+ * @returns Declarations in source order
47
+ */
48
+ export declare function parseDeclarations(body: string): CssDeclaration[];
49
+ /** Serialize declarations as `prop:value;prop:value !important` */
50
+ export declare function serializeDeclarations(decls: CssDeclaration[]): string;
51
+ /**
52
+ * Parse a stylesheet into top-level rules and at-rules.
53
+ * Comments are dropped; at-rules are kept as raw text.
54
+ *
55
+ * @param css - Stylesheet source (content of a `<style>` block)
56
+ */
57
+ export declare function parseStylesheet(css: string): CssItem[];
58
+ /**
59
+ * Minify CSS: strip comments, collapse whitespace and remove unneeded
60
+ * spaces/semicolons. String literals are preserved verbatim.
61
+ * Spaces before `:` are kept (they are significant in selectors like `a :hover`).
62
+ *
63
+ * @param css - CSS source
64
+ * @returns Minified CSS
65
+ */
66
+ export declare function minifyCss(css: string): string;
67
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/utils/css.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,OAAO,GAAG,YAAY,GAAG,SAAS,CAAC;AAE/C,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAkBpD;AA0DD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAWxE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,CAiBhE;AAED,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,EAAE,CA8CtD;AAKD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA8C7C"}
@@ -0,0 +1,12 @@
1
+ import { EmailDesign } from '@emabuild/types';
2
+ type Rec = Record<string, unknown>;
3
+ /** The `_override.dark` record of a values object, if any */
4
+ export declare function getDarkOverrides(values: unknown): Rec | null;
5
+ /** Whether the design defines any dark-mode color */
6
+ export declare function hasDarkMode(design: EmailDesign): boolean;
7
+ /**
8
+ * CSS for every dark-mode color of the design, or `''` when there is none.
9
+ */
10
+ export declare function buildDarkModeCss(design: EmailDesign): string;
11
+ export {};
12
+ //# sourceMappingURL=dark-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dark-mode.d.ts","sourceRoot":"","sources":["../../src/utils/dark-mode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAA4B,MAAM,iBAAiB,CAAC;AAI7E,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAGnC,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI,CAI5D;AA6CD,qDAAqD;AACrD,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAsB5D"}
@@ -0,0 +1,11 @@
1
+ import { DisplayCondition } from '@emabuild/types';
2
+ /**
3
+ * Wrap rendered HTML with a display condition's `before` / `after` strings.
4
+ * Returns the HTML unchanged when the condition is missing or has neither.
5
+ *
6
+ * @param html - Rendered row or content HTML
7
+ * @param condition - `values.displayCondition` of the row/content
8
+ * @returns Wrapped HTML
9
+ */
10
+ export declare function wrapWithDisplayCondition(html: string, condition: DisplayCondition | null | undefined): string;
11
+ //# sourceMappingURL=display-condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-condition.d.ts","sourceRoot":"","sources":["../../src/utils/display-condition.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAM7G"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module html-cleanup
3
+ *
4
+ * Conservative cleanup of exported email HTML:
5
+ * - removes empty `class=""`, `style=""` and `id=""` attributes
6
+ * - removes editor-only attributes that may leak into content
7
+ * (e.g. `contenteditable`, `data-content-id` from pasted canvas HTML)
8
+ *
9
+ * Content inside comments (MSO conditional comments) is never touched.
10
+ */
11
+ /** Editor-only attributes that never belong in an exported email */
12
+ export declare const EDITOR_ONLY_ATTRS: Set<string>;
13
+ /**
14
+ * Remove empty and editor-only attributes from HTML.
15
+ *
16
+ * @param html - HTML document or fragment
17
+ * @returns Cleaned HTML
18
+ */
19
+ export declare function cleanupHtml(html: string): string;
20
+ //# sourceMappingURL=html-cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-cleanup.d.ts","sourceRoot":"","sources":["../../src/utils/html-cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,oEAAoE;AACpE,eAAO,MAAM,iBAAiB,aAM5B,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAehD"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module html-minifier
3
+ *
4
+ * Email-safe HTML minifier (no dependencies, browser + Node.js).
5
+ *
6
+ * - Collapses whitespace in text; drops whitespace-only text next to
7
+ * block-level / structural tags.
8
+ * - Strips regular comments but KEEPS MSO/IE conditional comments.
9
+ * - Minifies CSS inside `<style>` blocks.
10
+ * - Never touches the content of `<pre>`, `<textarea>`, `<script>` or
11
+ * the inside of conditional comments.
12
+ */
13
+ /**
14
+ * Minify an email HTML document.
15
+ *
16
+ * @param html - HTML to minify
17
+ * @returns Minified HTML (MSO conditional comments preserved)
18
+ */
19
+ export declare function minifyHtml(html: string): string;
20
+ //# sourceMappingURL=html-minifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-minifier.d.ts","sourceRoot":"","sources":["../../src/utils/html-minifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkCH;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoD/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"html-sanitizer.d.ts","sourceRoot":"","sources":["../../src/utils/html-sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8BH;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAgBtD"}
1
+ {"version":3,"file":"html-sanitizer.d.ts","sourceRoot":"","sources":["../../src/utils/html-sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8BH;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBtD"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @module html-tokenizer
3
+ *
4
+ * A small, dependency-free HTML tokenizer used by the post-processing steps
5
+ * (CSS inliner, minifier, cleanup). It works identically in the browser and
6
+ * in Node.js — no DOMParser required.
7
+ *
8
+ * Design goals:
9
+ * - Lossless: serializing an untouched token list gives back the exact input.
10
+ * - Comments (including MSO conditional comments) are opaque tokens, so their
11
+ * contents are never parsed or modified.
12
+ * - Raw-text elements (`<style>`, `<script>`, `<textarea>`, `<title>`) keep
13
+ * their content as a single raw token.
14
+ */
15
+ /** A parsed HTML attribute */
16
+ export interface HtmlAttribute {
17
+ /** Attribute name, lowercased */
18
+ name: string;
19
+ /** Raw (still entity-encoded) value, or `null` for boolean attributes */
20
+ value: string | null;
21
+ /** Quote character used in the source (`"`, `'`, or `''` for unquoted) */
22
+ quote: '"' | "'" | '';
23
+ }
24
+ export interface TextToken {
25
+ type: 'text';
26
+ raw: string;
27
+ }
28
+ export interface RawTextToken {
29
+ type: 'rawtext';
30
+ /** Name of the enclosing raw-text element (style, script, textarea, title) */
31
+ parent: string;
32
+ raw: string;
33
+ }
34
+ export interface CommentToken {
35
+ type: 'comment';
36
+ raw: string;
37
+ }
38
+ export interface DoctypeToken {
39
+ type: 'doctype';
40
+ raw: string;
41
+ }
42
+ export interface OpenTagToken {
43
+ type: 'open';
44
+ /** Tag name, lowercased */
45
+ name: string;
46
+ attrs: HtmlAttribute[];
47
+ selfClosing: boolean;
48
+ raw: string;
49
+ /** Set to true when `attrs` were modified and `raw` must be regenerated */
50
+ dirty?: boolean;
51
+ }
52
+ export interface CloseTagToken {
53
+ type: 'close';
54
+ name: string;
55
+ raw: string;
56
+ }
57
+ export type HtmlToken = TextToken | RawTextToken | CommentToken | DoctypeToken | OpenTagToken | CloseTagToken;
58
+ /** Elements that never have a closing tag */
59
+ export declare const VOID_ELEMENTS: Set<string>;
60
+ /**
61
+ * Tokenize an HTML string into a flat list of tokens.
62
+ *
63
+ * @param html - HTML document or fragment
64
+ * @returns Token list; `serializeHtmlTokens(tokenizeHtml(x)) === x`
65
+ */
66
+ export declare function tokenizeHtml(html: string): HtmlToken[];
67
+ /**
68
+ * Regenerate the raw source of an open tag from its attributes.
69
+ * Values containing the original quote character are re-quoted safely.
70
+ */
71
+ export declare function serializeOpenTag(token: OpenTagToken): string;
72
+ /**
73
+ * Serialize a token list back to HTML. Untouched tokens are emitted verbatim.
74
+ *
75
+ * @param tokens - Tokens produced by {@link tokenizeHtml} (possibly modified)
76
+ * @returns HTML string
77
+ */
78
+ export declare function serializeHtmlTokens(tokens: HtmlToken[]): string;
79
+ /** Get an attribute value from an open tag token (`undefined` when missing). */
80
+ export declare function getAttr(token: OpenTagToken, name: string): string | null | undefined;
81
+ /** Set (or add) an attribute on an open tag token and mark it dirty. */
82
+ export declare function setAttr(token: OpenTagToken, name: string, value: string): void;
83
+ /**
84
+ * Whether a comment token is an MSO / IE conditional comment
85
+ * (`<!--[if mso]>`, `<![endif]-->`, `<!--[if !mso]><!-->`, `<!--<![endif]-->`).
86
+ * These must always be preserved.
87
+ */
88
+ export declare function isConditionalComment(raw: string): boolean;
89
+ //# sourceMappingURL=html-tokenizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-tokenizer.d.ts","sourceRoot":"","sources":["../../src/utils/html-tokenizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,8BAA8B;AAC9B,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,0EAA0E;IAC1E,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,Y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 * DOM-free HTML → plain text conversion for the `text/plain` part of an
5
+ * email. Built on the lossless {@link tokenizeHtml} tokenizer, so it runs
6
+ * the same in browsers, Node.js and Web Workers.
7
+ */
8
+ /** Options for {@link renderPlainText} */
9
+ export interface PlainTextOptions {
10
+ /** Wrap lines at this column (e.g. 78). Default `false` (no wrapping). Footnote URLs are never wrapped */
11
+ wordwrap?: number | false;
12
+ /**
13
+ * How links are written: `'inline'` → `text (url)` (default),
14
+ * `'footnote'` → `text [1]` with a numbered URL list at the end.
15
+ */
16
+ linkStyle?: 'inline' | 'footnote';
17
+ }
18
+ /**
19
+ * Decode HTML character references (named, decimal, hex).
20
+ * Unknown named references are left untouched.
21
+ *
22
+ * @param text - Entity-encoded text
23
+ */
24
+ export declare function decodeEntities(text: string): string;
25
+ /**
26
+ * Convert email HTML into readable plain text (no DOM required).
27
+ *
28
+ * - drops `<head>`, `<style>`, `<script>`, all comments (so MSO-only
29
+ * conditional content), and hidden elements (`display:none`,
30
+ * `mso-hide:all`, `max-height:0` — e.g. the preheader)
31
+ * - headings → UPPERCASE surrounded by blank lines; `p` → blank line after;
32
+ * `div` / `tr` / `table` / `br` → line breaks; `td` → space separated
33
+ * - `<li>` → `- item` (`1. item` in `<ol>`); `<hr>` → `---`
34
+ * - links (incl. buttons) → `text (url)` unless the URL equals the text;
35
+ * `#`, `javascript:` and empty hrefs print the text only
36
+ * - images → `[alt]` when alt is non-empty
37
+ * - entities decoded, whitespace collapsed, at most 2 consecutive blank lines
38
+ *
39
+ * @param html - Email HTML (full document or fragment)
40
+ * @param options - Word wrap and link style
41
+ * @returns Plain text
42
+ */
43
+ export declare function renderPlainText(html: string, options?: PlainTextOptions): string;
44
+ /**
45
+ * Wrap each line at `width` columns on word boundaries. Words longer than
46
+ * the width (e.g. URLs) are kept whole on their own line.
47
+ *
48
+ * @param text - Plain text
49
+ * @param width - Maximum line length
50
+ */
51
+ export declare function wrapText(text: string, width: number): string;
52
+ //# sourceMappingURL=plain-text.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../../src/utils/plain-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CACnC;AAkBD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASnD;AAiCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAuJpF;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAqB5D"}
@@ -1,2 +1,18 @@
1
+ /**
2
+ * Media query (without `@media`) that targets "mobile" for a given content
3
+ * width: every viewport narrower than the content plus a 20px gutter.
4
+ * Shared by the stacking rules and the per-device value overrides.
5
+ *
6
+ * @param contentWidth - Body content width in px
7
+ */
8
+ export declare function mobileMediaQuery(contentWidth: number): string;
9
+ /**
10
+ * Base responsive CSS: column stacking, visibility classes and dark-mode hooks.
11
+ * Rows with `noStackMobile` render their columns inside `.u_column_ns`
12
+ * percentage wrappers, so the stacking rule (100% width) only fills that
13
+ * wrapper and the columns stay side by side.
14
+ *
15
+ * @param contentWidth - Body content width in px
16
+ */
1
17
  export declare function getResponsiveCss(contentWidth: number): string;
2
18
  //# sourceMappingURL=responsive-css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-css.d.ts","sourceRoot":"","sources":["../../src/utils/responsive-css.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAgD7D"}
1
+ {"version":3,"file":"responsive-css.d.ts","sourceRoot":"","sources":["../../src/utils/responsive-css.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAmD7D"}
@@ -0,0 +1,61 @@
1
+ import { EmailDesign, DesignRow, DesignContent } from '@emabuild/types';
2
+ type Rec = Record<string, unknown>;
3
+ /** camelCase value key → kebab-case (`fontSize` → `font-size`), same as the tools' `kebab()` */
4
+ export declare function kebabKey(key: string): string;
5
+ /** Responsive hook class for a value key (`fontSize` → `v-font-size`) */
6
+ export declare function overrideClass(key: string): string;
7
+ /** Escape a sanitized id for use in a CSS `#id` selector */
8
+ export declare function cssId(id: string): string;
9
+ /**
10
+ * HTML id of a content's wrapper: `anchor`, else `_meta.htmlID`, else
11
+ * `u_content_<content.id>` (all sanitized to `[A-Za-z0-9_:.-]`).
12
+ */
13
+ export declare function contentElementId(content: Pick<DesignContent, 'id' | 'values'>): string;
14
+ /** HTML id of a row's `u_row` div: `anchor`, else `_meta.htmlID`, else `u_row_<row.id>` */
15
+ export declare function rowElementId(row: Pick<DesignRow, 'id' | 'values'>): string;
16
+ /** The `_override.mobile` record of a values object, if it has any usable entry */
17
+ export declare function getMobileOverrides(values: unknown): Rec | null;
18
+ /** A single override declaration on a hook class */
19
+ export interface OverrideDeclaration {
20
+ /** Hook class without the dot (`v-font-size`) */
21
+ className: string;
22
+ /** CSS property (`font-size`) */
23
+ property: string;
24
+ /** CSS value (`18px`) */
25
+ value: string;
26
+ }
27
+ /**
28
+ * Convert an override record into CSS declarations grouped by hook class.
29
+ * Strings/numbers map to `v-<kebab-key>`; `border` objects emit each
30
+ * `borderXxx` side prop on `.v-border`; `buttonColors` emits
31
+ * `background-color` / `color` on `.v-button-colors`. Other objects are skipped.
32
+ *
33
+ * @param overrides - e.g. `values._override.mobile`
34
+ * @returns Declarations in source order
35
+ */
36
+ export declare function overrideDeclarations(overrides: Rec): OverrideDeclaration[];
37
+ /**
38
+ * Mobile override rules (without the media query) of one row and its
39
+ * contents, in source order. Used by the per-row render cache.
40
+ *
41
+ * @param row - Design row
42
+ * @returns CSS rules (one per hook class)
43
+ */
44
+ export declare function rowOverrideRules(row: DesignRow): string[];
45
+ /**
46
+ * Wrap override rules in the mobile media query for a content width.
47
+ *
48
+ * @returns A `@media` block, or `''` when there are no rules
49
+ */
50
+ export declare function wrapOverrideRules(rules: string[], contentWidth: number): string;
51
+ /**
52
+ * Build the CSS for every mobile override (`values._override.mobile`) of the
53
+ * design's rows and contents (headers, rows, footers), wrapped in the mobile
54
+ * media query (`max-width: contentWidth + 20px`).
55
+ *
56
+ * @param design - Design JSON
57
+ * @returns A `@media` block, or `''` when the design has no mobile overrides
58
+ */
59
+ export declare function buildResponsiveOverridesCss(design: EmailDesign): string;
60
+ export {};
61
+ //# sourceMappingURL=responsive-overrides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive-overrides.d.ts","sourceRoot":"","sources":["../../src/utils/responsive-overrides.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI7E,KAAK,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEnC,gGAAgG;AAChG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAKD,4DAA4D;AAC5D,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAExC;AAOD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI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