@emabuild/email-renderer 0.7.1 → 0.8.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.
@@ -5,8 +5,11 @@ export interface DocumentShellExtras {
5
5
  fontUrls?: string[];
6
6
  /** Additional CSS blocks (e.g. hoisted content styles), emitted after the base styles */
7
7
  styles?: string[];
8
- /** Document `<title>` (escaped; default empty) */
8
+ /** Document `<title>` (escaped; default: the body title, else the preheader) */
9
9
  title?: string;
10
+ /** The design has dark-mode styles: declare `light dark` (default: `light` only, so clients that
11
+ * honour the declaration do not darken transparent areas around content that has no dark styles) */
12
+ darkMode?: boolean;
10
13
  }
11
14
  /**
12
15
  * Wrap rendered body HTML in an email-safe XHTML document shell
@@ -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;AAGlD,yDAAyD;AACzD,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,GAAE,mBAAwB,GAC/B,MAAM,CA0ER"}
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;AAGlD,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,CAAC;IACf;yGACqG;IACrG,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAmCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,GAAE,mBAAwB,GAC/B,MAAM,CA6ER"}
@@ -1,5 +1,5 @@
1
- import { DesignRow, DesignColumn, BodyValues } from '@emabuild/types';
2
- type ContentRenderer = (values: Record<string, unknown>, ctx: any) => string;
1
+ import { DesignRow, DesignColumn, BodyValues, ExportRenderContext, DisplayMode } from '@emabuild/types';
2
+ type ContentRenderer = (values: Record<string, unknown>, ctx: ExportRenderContext) => string;
3
3
  /**
4
4
  * Render a single design row as fluid-hybrid email HTML
5
5
  * (inline-block columns with MSO ghost tables for Outlook).
@@ -13,7 +13,7 @@ type ContentRenderer = (values: Record<string, unknown>, ctx: any) => string;
13
13
  *
14
14
  * @param displayMode - Passed to the tool renderers as `ctx.displayMode` (default `'email'`)
15
15
  */
16
- export declare function renderRow(row: DesignRow, bodyValues: BodyValues, toolRenderers: Map<string, ContentRenderer>, displayMode?: string): string;
16
+ export declare function renderRow(row: DesignRow, bodyValues: BodyValues, toolRenderers: Map<string, ContentRenderer>, displayMode?: DisplayMode): string;
17
17
  /**
18
18
  * Render the contents of a column with the tool renderers: unknown tools
19
19
  * become an HTML comment, `hideDesktop`/`hideMobile` wrap the output in a
@@ -21,6 +21,6 @@ export declare function renderRow(row: DesignRow, bodyValues: BodyValues, toolRe
21
21
  * tool didn't emit one, and each content's `displayCondition` wraps it.
22
22
  * Shared by the email (fluid-hybrid) and web layouts.
23
23
  */
24
- export declare function renderColumnContents(col: DesignColumn, widthPx: number, bodyValues: BodyValues, toolRenderers: Map<string, ContentRenderer>, displayMode: string): string;
24
+ export declare function renderColumnContents(col: DesignColumn, widthPx: number, bodyValues: BodyValues, toolRenderers: Map<string, ContentRenderer>, displayMode: DisplayMode): string;
25
25
  export {};
26
26
  //# sourceMappingURL=fluid-hybrid.d.ts.map
@@ -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,MAAM,iBAAiB,CAAC;AAK3E,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;AAK7E;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,SAAS,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,EAC3C,WAAW,SAAU,GACpB,MAAM,CAkER;AAwCD;;;;;;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,MAAM,GAClB,MAAM,CA0BR"}
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;AAK7G,KAAK,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,mBAAmB,KAAK,MAAM,CAAC;AAK7F;;;;;;;;;;;;GAYG;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,CAkER;AA2CD;;;;;;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,CA0BR"}
@@ -1,5 +1,5 @@
1
- import { DesignRow, BodyValues } from '@emabuild/types';
2
- type ContentRenderer = (values: Record<string, unknown>, ctx: any) => string;
1
+ import { DesignRow, BodyValues, ExportRenderContext } from '@emabuild/types';
2
+ type ContentRenderer = (values: Record<string, unknown>, ctx: ExportRenderContext) => string;
3
3
  /**
4
4
  * Render a single design row as a responsive web `<div>` block
5
5
  * (flex columns; see the module docs). The row's `displayCondition` wraps it.
@@ -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,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,MAA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mC;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,13 +1,13 @@
1
- import { EmailDesign, ExportResult, ExportOptions } from '@emabuild/types';
1
+ import { EmailDesign, ExportResult, ExportOptions, ExportRenderContext, DisplayMode } from '@emabuild/types';
2
2
  import { PlainTextOptions } from './utils/plain-text.js';
3
- type ContentRenderer = (values: Record<string, unknown>, ctx: any) => string;
3
+ type ContentRenderer = (values: Record<string, unknown>, ctx: ExportRenderContext) => string;
4
4
  /**
5
5
  * Export options accepted by the renderer. Extends the shared
6
6
  * `ExportOptions` with fields not (yet) declared there.
7
7
  */
8
8
  export type RenderOptions = ExportOptions & {
9
9
  /** `'web'` renders a responsive web page; anything else (default) renders email HTML */
10
- displayMode?: string;
10
+ displayMode?: DisplayMode;
11
11
  /** Per-row render cache (same as the 4th argument's `cache`) */
12
12
  cache?: RenderCache;
13
13
  };
@@ -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,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;IAChE,KAA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AM,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;AAmDD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUvD"}
@@ -1 +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
+ {"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;AAmBD;;;;;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"}
@@ -12,6 +12,9 @@ export declare function mobileMediaQuery(contentWidth: number): string;
12
12
  * percentage wrappers, so the stacking rule (100% width) only fills that
13
13
  * wrapper and the columns stay side by side.
14
14
  *
15
+ * On mobile `.u_row` is 100% wide with `box-sizing: border-box`, so the row
16
+ * padding stays inside the screen instead of adding to the width.
17
+ *
15
18
  * @param contentWidth - Body content width in px
16
19
  */
17
20
  export declare function getResponsiveCss(contentWidth: number): string;
@@ -1 +1 @@
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"}
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;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAyC7D"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module strip-active-content
3
+ *
4
+ * Removes everything that could run code from exported email HTML. Email
5
+ * clients never run scripts, so nothing legitimate is lost, but a host that
6
+ * shows the exported HTML in its own app (a preview, an archive page) would
7
+ * otherwise run whatever an HTML block, an import or an AI result carried:
8
+ *
9
+ * - `<script>` elements with their content;
10
+ * - embedding / navigation elements: iframe, frame(set), object, embed,
11
+ * applet, base, `<meta http-equiv="refresh">` (their content stays);
12
+ * - SVG animation elements (animate, set, …) that can rewrite `href` to
13
+ * `javascript:` after any check;
14
+ * - `on*` handlers, `srcdoc`, `formaction`;
15
+ * - `javascript:` / `vbscript:` / `data:text/html` URLs (also entity- or
16
+ * whitespace-obfuscated) in URL attributes;
17
+ * - `expression(` / `javascript:` / `behavior:` in `style` attributes.
18
+ *
19
+ * Token based (see html-tokenizer): no DOM, same result in the browser and
20
+ * in Node. Comments (MSO conditionals) are left as they are.
21
+ */
22
+ /**
23
+ * Strip scripts, handlers and script URLs from an HTML document or fragment.
24
+ * Returns the input unchanged (same string) when there is nothing to remove.
25
+ */
26
+ export declare function stripActiveContent(html: string): string;
27
+ //# sourceMappingURL=strip-active-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-active-content.d.ts","sourceRoot":"","sources":["../../src/utils/strip-active-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AA2CH;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoCvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emabuild/email-renderer",
3
- "version": "0.7.1",
3
+ "version": "0.8.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",
@@ -14,11 +14,12 @@
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
- "README.md"
17
+ "README.md",
18
+ "LICENSE"
18
19
  ],
19
20
  "dependencies": {
20
- "@emabuild/shared": "^0.1.2",
21
- "@emabuild/types": "^0.7.1"
21
+ "@emabuild/shared": "^0.2.0",
22
+ "@emabuild/types": "^0.8.0"
22
23
  },
23
24
  "devDependencies": {
24
25
  "vite": "^6.2.0",
@@ -39,6 +40,11 @@
39
40
  ],
40
41
  "license": "MIT",
41
42
  "sideEffects": false,
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/Fabiovarrenti/emabuild.git",
46
+ "directory": "packages/email-renderer"
47
+ },
42
48
  "scripts": {
43
49
  "build": "vite build",
44
50
  "dev": "vite build --watch",