@emabuild/email-renderer 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +816 -775
- package/dist/index.js.map +1 -1
- package/dist/layout/document-shell.d.ts +1 -1
- package/dist/layout/document-shell.d.ts.map +1 -1
- package/dist/layout/fluid-hybrid.d.ts +4 -0
- package/dist/layout/fluid-hybrid.d.ts.map +1 -1
- package/dist/layout/web-layout.d.ts +1 -1
- package/dist/layout/web-layout.d.ts.map +1 -1
- package/dist/render.d.ts +2 -1
- package/dist/render.d.ts.map +1 -1
- package/dist/utils/background.d.ts +37 -0
- package/dist/utils/background.d.ts.map +1 -0
- package/dist/utils/border.d.ts.map +1 -1
- package/dist/utils/css-inliner.d.ts.map +1 -1
- package/dist/utils/dark-mode.d.ts +2 -3
- package/dist/utils/dark-mode.d.ts.map +1 -1
- package/dist/utils/html-minifier.d.ts.map +1 -1
- package/dist/utils/markup.d.ts +12 -0
- package/dist/utils/markup.d.ts.map +1 -0
- package/dist/utils/mso.d.ts +27 -0
- package/dist/utils/mso.d.ts.map +1 -0
- package/dist/utils/plain-text.d.ts +2 -2
- package/dist/utils/plain-text.d.ts.map +1 -1
- package/dist/utils/responsive-overrides.d.ts +5 -4
- package/dist/utils/responsive-overrides.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -6,7 +6,7 @@ export interface DocumentShellExtras {
|
|
|
6
6
|
/** Additional CSS blocks (e.g. hoisted content styles), emitted after the base styles */
|
|
7
7
|
styles?: string[];
|
|
8
8
|
/** Document `<title>` (escaped; default: the body title, else the preheader) */
|
|
9
|
-
title?: string;
|
|
9
|
+
title?: string | undefined;
|
|
10
10
|
/** The design has dark-mode styles: declare `light dark` (default: `light` only, so clients that
|
|
11
11
|
* honour the declaration do not darken transparent areas around content that has no dark styles) */
|
|
12
12
|
darkMode?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-shell.d.ts","sourceRoot":"","sources":["../../src/layout/document-shell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"document-shell.d.ts","sourceRoot":"","sources":["../../src/layout/document-shell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKlD,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B;yGACqG;IACrG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAaD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,GAAE,mBAAwB,GAC/B,MAAM,CA6ER"}
|
|
@@ -10,6 +10,10 @@ type ContentRenderer = (values: Record<string, unknown>, ctx: ExportRenderContex
|
|
|
10
10
|
* hook classes when `_override.mobile` is set.
|
|
11
11
|
* - `noStackMobile` rows get class `no-stack`; each column is wrapped in a
|
|
12
12
|
* `.u_column_ns` percentage-width inline-block so it never stacks.
|
|
13
|
+
* - Outlook for Windows: the row's vertical padding moves to an MSO-only cell
|
|
14
|
+
* (Outlook ignores padding on `<div>`; horizontal padding only matters on
|
|
15
|
+
* narrow screens, which Outlook desktop never has), a background image is
|
|
16
|
+
* painted with a VML rectangle, and `hideDesktop` rows are hidden from it.
|
|
13
17
|
*
|
|
14
18
|
* @param displayMode - Passed to the tool renderers as `ctx.displayMode` (default `'email'`)
|
|
15
19
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluid-hybrid.d.ts","sourceRoot":"","sources":["../../src/layout/fluid-hybrid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"fluid-hybrid.d.ts","sourceRoot":"","sources":["../../src/layout/fluid-hybrid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQ7G,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,mBAAmB,KAAK,MAAM,CAAC;AAE7F;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC3C,WAAW,GAAE,WAAqB,GACjC,MAAM,CAiER;AA6CD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC3C,WAAW,EAAE,WAAW,GACvB,MAAM,CA4BR"}
|
|
@@ -32,7 +32,7 @@ export interface WebShellExtras {
|
|
|
32
32
|
/** Additional CSS blocks emitted after the base stylesheet */
|
|
33
33
|
styles?: string[];
|
|
34
34
|
/** Document `<title>` (escaped) */
|
|
35
|
-
title?: string;
|
|
35
|
+
title?: string | undefined;
|
|
36
36
|
/** `<html lang>` (default `en`) */
|
|
37
37
|
lang?: string;
|
|
38
38
|
}
|
|
@@ -1 +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,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;
|
|
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,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAUhG,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,mBAAmB,KAAK,MAAM,CAAC;AAK7F;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GAC1C,MAAM,CAiCR;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,GAAG,SAAS,CAAC;IAC3B,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
|
@@ -54,7 +54,8 @@ export declare function createRenderCache(): RenderCache;
|
|
|
54
54
|
*
|
|
55
55
|
* Pipeline: render (headers → rows → footers) → hoist body `<style>` blocks
|
|
56
56
|
* into the head → mobile override CSS (`_override.mobile`) → merge tags → design tags →
|
|
57
|
-
* CSS inlining (`inlineStyles`) → cleanup (`cleanup`) → minification (`minify
|
|
57
|
+
* CSS inlining (`inlineStyles`) → cleanup (`cleanup`) → minification (`minify`, on by
|
|
58
|
+
* default for email HTML; `minify: false` keeps it readable).
|
|
58
59
|
*
|
|
59
60
|
* @param design - Design JSON
|
|
60
61
|
* @param toolRenderers - Map of tool name → HTML render function. Keep the
|
package/dist/render.d.ts.map
CHANGED
|
@@ -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,EAAyB,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAazI,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,mBAAmB,KAAK,MAAM,CAAC;AAE7F;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC1C,wFAAwF;IACxF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gEAAgE;IAChE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAUD,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAWD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAE/C;AA+CD
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAyB,mBAAmB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAazI,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,mBAAmB,KAAK,MAAM,CAAC;AAE7F;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG;IAC1C,wFAAwF;IACxF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gEAAgE;IAChE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAUD,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,mDAAmD;IACnD,KAAK,IAAI,IAAI,CAAC;CACf;AAWD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAE/C;AA+CD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC3C,OAAO,CAAC,EAAE,aAAa,EACvB,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CA6Gd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,WAAW,EACnB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC3C,OAAO,CAAC,EAAE,aAAa,GAAG,gBAAgB,EAC1C,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAQR;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,SAAS,GAAE,CAAC,MAAM,EAAE,MAAM,CAAgB,GACzC,MAAM,CAOR;AAqBD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAY7D;AAqDD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUvD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module background
|
|
3
|
+
*
|
|
4
|
+
* Background images of the body and of rows: the CSS for modern clients and
|
|
5
|
+
* the VML that Outlook for Windows needs (it ignores `background-image`).
|
|
6
|
+
*/
|
|
7
|
+
/** Background image value of the body / a row */
|
|
8
|
+
export type BackgroundImageValue = {
|
|
9
|
+
url?: string;
|
|
10
|
+
repeat?: boolean | string;
|
|
11
|
+
center?: boolean;
|
|
12
|
+
cover?: boolean;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
} | undefined;
|
|
15
|
+
/** A background image resolved for output (URL already made safe) */
|
|
16
|
+
export interface ResolvedBackground {
|
|
17
|
+
url: string;
|
|
18
|
+
repeat: 'repeat' | 'no-repeat';
|
|
19
|
+
/** Inline CSS declarations (`background-image`, `-repeat`, `-position`, `-size`) */
|
|
20
|
+
css: string;
|
|
21
|
+
/** VML fill type: `tile` for repeating images, `frame` (stretched) otherwise */
|
|
22
|
+
fillType: 'tile' | 'frame';
|
|
23
|
+
}
|
|
24
|
+
/** Resolve a background image value, or `null` when there is no usable URL */
|
|
25
|
+
export declare function resolveBackground(img: unknown): ResolvedBackground | null;
|
|
26
|
+
/** Inline CSS for a background image value (empty without a URL) */
|
|
27
|
+
export declare function backgroundImageCss(img: unknown): string;
|
|
28
|
+
/**
|
|
29
|
+
* Outlook-only VML rectangle that paints a background image behind a block of
|
|
30
|
+
* markup: returns the opening and closing conditional comments to put around it.
|
|
31
|
+
* The rectangle is `widthPx` wide and grows with its content.
|
|
32
|
+
*/
|
|
33
|
+
export declare function vmlBackgroundRect(bg: ResolvedBackground, widthPx: number, color: string): {
|
|
34
|
+
open: string;
|
|
35
|
+
close: string;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=background.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../src/utils/background.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,iDAAiD;AACjD,MAAM,MAAM,oBAAoB,GAC5B;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACnG,SAAS,CAAC;AAEd,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC/B,oFAAoF;IACpF,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAYzE;AAED,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAMzH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/utils/border.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../src/utils/border.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAYnD"}
|
|
@@ -1 +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;
|
|
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;AAsED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAsG9E"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { EmailDesign } from '@emabuild/types';
|
|
2
|
-
|
|
2
|
+
import { UnknownRecord } from '@emabuild/shared';
|
|
3
3
|
/** The `_override.dark` record of a values object, if any */
|
|
4
|
-
export declare function getDarkOverrides(values: unknown):
|
|
4
|
+
export declare function getDarkOverrides(values: unknown): UnknownRecord | null;
|
|
5
5
|
/** Whether the design defines any dark-mode color */
|
|
6
6
|
export declare function hasDarkMode(design: EmailDesign): boolean;
|
|
7
7
|
/**
|
|
8
8
|
* CSS for every dark-mode color of the design, or `''` when there is none.
|
|
9
9
|
*/
|
|
10
10
|
export declare function buildDarkModeCss(design: EmailDesign): string;
|
|
11
|
-
export {};
|
|
12
11
|
//# sourceMappingURL=dark-mode.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAE7E,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGxF,6DAA6D;AAC7D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAEtE;AA6CD,qDAAqD;AACrD,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAsB5D"}
|
|
@@ -1 +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,
|
|
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,CAmD/C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module markup
|
|
3
|
+
*
|
|
4
|
+
* Escaping helpers shared by the layouts (email shell, fluid-hybrid rows, web layout).
|
|
5
|
+
*/
|
|
6
|
+
/** Escape a value for a double-quoted HTML attribute (existing entities are kept) */
|
|
7
|
+
export declare function escapeAttr(value: string): string;
|
|
8
|
+
/** Escape text content (e.g. `<title>`) */
|
|
9
|
+
export { escapeHtmlText as escapeText } from '@emabuild/shared';
|
|
10
|
+
/** Make a URL safe inside `url('…')` and attributes: quotes, parens, backslashes, spaces and `<>` are percent-encoded */
|
|
11
|
+
export declare function safeCssUrl(url: string): string;
|
|
12
|
+
//# sourceMappingURL=markup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markup.d.ts","sourceRoot":"","sources":["../../src/utils/markup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,2CAA2C;AAC3C,OAAO,EAAE,cAAc,IAAI,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhE,yHAAyH;AACzH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module mso
|
|
3
|
+
*
|
|
4
|
+
* Markup for Outlook for Windows (the Word rendering engine), which ignores
|
|
5
|
+
* `padding` outside table cells, `max-width`/`width` on `<div>`, media
|
|
6
|
+
* queries and `background-image`. Everything here is wrapped in `mso`
|
|
7
|
+
* conditional comments, so other clients never see it.
|
|
8
|
+
*/
|
|
9
|
+
/** CSS padding shorthand split into its four sides (`top right bottom left`) */
|
|
10
|
+
export declare function paddingSides(padding: string | undefined): [string, string, string, string];
|
|
11
|
+
/** Whether a padding shorthand is zero on every side */
|
|
12
|
+
export declare function isZeroPadding(padding: string | undefined): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* An Outlook-only table cell around some markup, carrying the padding (and
|
|
15
|
+
* background color) that Outlook drops from `<div>`s. Returns empty strings
|
|
16
|
+
* when there is nothing to carry.
|
|
17
|
+
*/
|
|
18
|
+
export declare function msoCell(padding: string, bgColor?: string): {
|
|
19
|
+
open: string;
|
|
20
|
+
close: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Hide markup from Outlook for Windows. Used for "hide on desktop": Outlook
|
|
24
|
+
* is a desktop client that never sees the media queries doing the hiding.
|
|
25
|
+
*/
|
|
26
|
+
export declare function hideFromOutlook(html: string): string;
|
|
27
|
+
//# sourceMappingURL=mso.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mso.d.ts","sourceRoot":"","sources":["../../src/utils/mso.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAK1F;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAQtF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
/** Options for {@link renderPlainText} */
|
|
9
9
|
export interface PlainTextOptions {
|
|
10
10
|
/** Wrap lines at this column (e.g. 78). Default `false` (no wrapping). Footnote URLs are never wrapped */
|
|
11
|
-
wordwrap?: number | false;
|
|
11
|
+
wordwrap?: number | false | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* How links are written: `'inline'` → `text (url)` (default),
|
|
14
14
|
* `'footnote'` → `text [1]` with a numbered URL list at the end.
|
|
15
15
|
*/
|
|
16
|
-
linkStyle?: 'inline' | 'footnote';
|
|
16
|
+
linkStyle?: 'inline' | 'footnote' | undefined;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Decode HTML character references (named, decimal, hex).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../../src/utils/plain-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"plain-text.d.ts","sourceRoot":"","sources":["../../src/utils/plain-text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,0CAA0C;AAC1C,MAAM,WAAW,gBAAgB;IAC/B,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;IACtC;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;CAC/C;AAgBD;;;;;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,CA0JpF;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAqB5D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EmailDesign, DesignRow, DesignContent } from '@emabuild/types';
|
|
2
|
-
|
|
2
|
+
import { UnknownRecord } from '@emabuild/shared';
|
|
3
3
|
/** camelCase value key → kebab-case (`fontSize` → `font-size`), same as the tools' `kebab()` */
|
|
4
4
|
export declare function kebabKey(key: string): string;
|
|
5
5
|
/** Responsive hook class for a value key (`fontSize` → `v-font-size`) */
|
|
@@ -13,8 +13,10 @@ export declare function cssId(id: string): string;
|
|
|
13
13
|
export declare function contentElementId(content: Pick<DesignContent, 'id' | 'values'>): string;
|
|
14
14
|
/** HTML id of a row's `u_row` div: `anchor`, else `_meta.htmlID`, else `u_row_<row.id>` */
|
|
15
15
|
export declare function rowElementId(row: Pick<DesignRow, 'id' | 'values'>): string;
|
|
16
|
+
/** The non-empty `_override.<device>` record of a values object, if any */
|
|
17
|
+
export declare function getDeviceOverrides(values: unknown, device: string): UnknownRecord | null;
|
|
16
18
|
/** The `_override.mobile` record of a values object, if it has any usable entry */
|
|
17
|
-
export declare function getMobileOverrides(values: unknown):
|
|
19
|
+
export declare function getMobileOverrides(values: unknown): UnknownRecord | null;
|
|
18
20
|
/** A single override declaration on a hook class */
|
|
19
21
|
export interface OverrideDeclaration {
|
|
20
22
|
/** Hook class without the dot (`v-font-size`) */
|
|
@@ -33,7 +35,7 @@ export interface OverrideDeclaration {
|
|
|
33
35
|
* @param overrides - e.g. `values._override.mobile`
|
|
34
36
|
* @returns Declarations in source order
|
|
35
37
|
*/
|
|
36
|
-
export declare function overrideDeclarations(overrides:
|
|
38
|
+
export declare function overrideDeclarations(overrides: UnknownRecord): OverrideDeclaration[];
|
|
37
39
|
/**
|
|
38
40
|
* Mobile override rules (without the media query) of one row and its
|
|
39
41
|
* contents, in source order. Used by the per-row render cache.
|
|
@@ -57,5 +59,4 @@ export declare function wrapOverrideRules(rules: string[], contentWidth: number)
|
|
|
57
59
|
* @returns A `@media` block, or `''` when the design has no mobile overrides
|
|
58
60
|
*/
|
|
59
61
|
export declare function buildResponsiveOverridesCss(design: EmailDesign): string;
|
|
60
|
-
export {};
|
|
61
62
|
//# sourceMappingURL=responsive-overrides.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAE7E,OAAO,EAA8C,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGlG,gGAAgG;AAChG,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAID,4DAA4D;AAC5D,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAExC;AAOD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG,MAAM,CAEtF;AAED,2FAA2F;AAC3F,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,QAAQ,CAAC,GAAG,MAAM,CAE1E;AAQD,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAIxF;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAExE;AA0BD,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,aAAa,GAAG,mBAAmB,EAAE,CAwBpF;AAiCD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,EAAE,CAMzD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAG/E;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CASvE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emabuild/email-renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Email HTML renderer — converts design JSON to cross-client email HTML",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@emabuild/shared": "^0.
|
|
22
|
-
"@emabuild/types": "^0.8.
|
|
21
|
+
"@emabuild/shared": "^0.3.0",
|
|
22
|
+
"@emabuild/types": "^0.8.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"vite": "^6.2.0",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"build": "vite build",
|
|
50
50
|
"dev": "vite build --watch",
|
|
51
51
|
"test": "vitest run",
|
|
52
|
-
"clean": "rm -rf dist"
|
|
52
|
+
"clean": "rm -rf dist",
|
|
53
|
+
"typecheck": "tsc --noEmit -p ."
|
|
53
54
|
}
|
|
54
55
|
}
|