@emailens/engine 0.11.8 → 0.11.9

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/dist/index.js CHANGED
@@ -8949,10 +8949,6 @@ function splitTopLevel(value) {
8949
8949
  return parts;
8950
8950
  }
8951
8951
 
8952
- // src/downlevel.ts
8953
- import * as cheerio from "cheerio";
8954
- import * as csstree from "css-tree";
8955
-
8956
8952
  // src/color-utils.ts
8957
8953
  var NAMED_COLORS = {
8958
8954
  aliceblue: [240, 248, 255],
@@ -9390,6 +9386,8 @@ function colorDistance(a, b) {
9390
9386
  }
9391
9387
 
9392
9388
  // src/downlevel.ts
9389
+ import * as cheerio from "cheerio";
9390
+ import * as csstree from "css-tree";
9393
9391
  var LOGICAL_PROPERTY_MAP = {
9394
9392
  "padding-inline": ["padding-left", "padding-right"],
9395
9393
  "padding-block": ["padding-top", "padding-bottom"],
@@ -10288,13 +10286,17 @@ var CLIENT_CONFIGS = {
10288
10286
  strippedProperties: OUTLOOK_WORD_UNSUPPORTED,
10289
10287
  stripMode: "strip",
10290
10288
  valueStrips: [
10291
- { prop: "background", pattern: /linear-gradient|radial-gradient/ },
10292
- { prop: "background-image", pattern: /linear-gradient|radial-gradient/ }
10289
+ // Gradients and image URLs alike: the Word engine paints neither. Only
10290
+ // VML does, and vmlToCss runs after this pass, so a hero built the
10291
+ // bulletproof way keeps the background this strip would otherwise take.
10292
+ { prop: "background", pattern: /linear-gradient|radial-gradient|url\(/ },
10293
+ { prop: "background-image", pattern: /linear-gradient|radial-gradient|url\(/ }
10293
10294
  ],
10294
10295
  inlineAndStripStyles: false,
10295
10296
  stripExternalStylesheets: false,
10296
10297
  stripForms: false,
10297
10298
  stripSvg: false,
10299
+ stripBackgroundAttribute: true,
10298
10300
  additionalChecks: outlookWindowsAdditionalChecks
10299
10301
  },
10300
10302
  "outlook-web": {
@@ -10515,6 +10517,11 @@ function applyTransform(html, config, framework) {
10515
10517
  $(el).replaceWith('<img alt="[SVG not supported]" />');
10516
10518
  });
10517
10519
  }
10520
+ if (config.stripBackgroundAttribute) {
10521
+ $("[background]").each((_, el) => {
10522
+ $(el).removeAttr("background");
10523
+ });
10524
+ }
10518
10525
  if (config.strippedProperties.size > 0 || config.valueStrips && config.valueStrips.length > 0) {
10519
10526
  $("[style]").each((_, el) => {
10520
10527
  const style = $(el).attr("style") || "";
@@ -10539,7 +10546,9 @@ function applyTransform(html, config, framework) {
10539
10546
  for (const vs of (_a = config.valueStrips) != null ? _a : []) {
10540
10547
  if (prop === vs.prop && vs.pattern.test(value)) {
10541
10548
  removed.push(prop);
10542
- props.delete(prop);
10549
+ const fallback = prop === "background" ? backgroundShorthandColor(value) : null;
10550
+ if (fallback) props.set(prop, fallback);
10551
+ else props.delete(prop);
10543
10552
  return;
10544
10553
  }
10545
10554
  }