@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.cjs CHANGED
@@ -9068,10 +9068,6 @@ function splitTopLevel(value) {
9068
9068
  return parts;
9069
9069
  }
9070
9070
 
9071
- // src/downlevel.ts
9072
- var cheerio = __toESM(require("cheerio"), 1);
9073
- var csstree = __toESM(require("css-tree"), 1);
9074
-
9075
9071
  // src/color-utils.ts
9076
9072
  var NAMED_COLORS = {
9077
9073
  aliceblue: [240, 248, 255],
@@ -9509,6 +9505,8 @@ function colorDistance(a, b) {
9509
9505
  }
9510
9506
 
9511
9507
  // src/downlevel.ts
9508
+ var cheerio = __toESM(require("cheerio"), 1);
9509
+ var csstree = __toESM(require("css-tree"), 1);
9512
9510
  var LOGICAL_PROPERTY_MAP = {
9513
9511
  "padding-inline": ["padding-left", "padding-right"],
9514
9512
  "padding-block": ["padding-top", "padding-bottom"],
@@ -10407,13 +10405,17 @@ var CLIENT_CONFIGS = {
10407
10405
  strippedProperties: OUTLOOK_WORD_UNSUPPORTED,
10408
10406
  stripMode: "strip",
10409
10407
  valueStrips: [
10410
- { prop: "background", pattern: /linear-gradient|radial-gradient/ },
10411
- { prop: "background-image", pattern: /linear-gradient|radial-gradient/ }
10408
+ // Gradients and image URLs alike: the Word engine paints neither. Only
10409
+ // VML does, and vmlToCss runs after this pass, so a hero built the
10410
+ // bulletproof way keeps the background this strip would otherwise take.
10411
+ { prop: "background", pattern: /linear-gradient|radial-gradient|url\(/ },
10412
+ { prop: "background-image", pattern: /linear-gradient|radial-gradient|url\(/ }
10412
10413
  ],
10413
10414
  inlineAndStripStyles: false,
10414
10415
  stripExternalStylesheets: false,
10415
10416
  stripForms: false,
10416
10417
  stripSvg: false,
10418
+ stripBackgroundAttribute: true,
10417
10419
  additionalChecks: outlookWindowsAdditionalChecks
10418
10420
  },
10419
10421
  "outlook-web": {
@@ -10634,6 +10636,11 @@ function applyTransform(html, config, framework) {
10634
10636
  $(el).replaceWith('<img alt="[SVG not supported]" />');
10635
10637
  });
10636
10638
  }
10639
+ if (config.stripBackgroundAttribute) {
10640
+ $("[background]").each((_, el) => {
10641
+ $(el).removeAttr("background");
10642
+ });
10643
+ }
10637
10644
  if (config.strippedProperties.size > 0 || config.valueStrips && config.valueStrips.length > 0) {
10638
10645
  $("[style]").each((_, el) => {
10639
10646
  const style = $(el).attr("style") || "";
@@ -10658,7 +10665,9 @@ function applyTransform(html, config, framework) {
10658
10665
  for (const vs of (_a = config.valueStrips) != null ? _a : []) {
10659
10666
  if (prop === vs.prop && vs.pattern.test(value)) {
10660
10667
  removed.push(prop);
10661
- props.delete(prop);
10668
+ const fallback = prop === "background" ? backgroundShorthandColor(value) : null;
10669
+ if (fallback) props.set(prop, fallback);
10670
+ else props.delete(prop);
10662
10671
  return;
10663
10672
  }
10664
10673
  }