@emailens/cli 0.13.9 → 0.13.11

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.
@@ -65543,7 +65543,9 @@ var CLIENT_CONFIGS = {
65543
65543
  stripExternalStylesheets: true,
65544
65544
  stripForms: true,
65545
65545
  stripSvg: true,
65546
- additionalChecks: gmailAdditionalChecks
65546
+ additionalChecks: gmailAdditionalChecks,
65547
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65548
+ autolinkEmails: { color: "#1155cc", underline: true }
65547
65549
  },
65548
65550
  "gmail-android": {
65549
65551
  id: "gmail-android",
@@ -65557,7 +65559,9 @@ var CLIENT_CONFIGS = {
65557
65559
  stripExternalStylesheets: true,
65558
65560
  stripForms: true,
65559
65561
  stripSvg: true,
65560
- additionalChecks: gmailAdditionalChecks
65562
+ additionalChecks: gmailAdditionalChecks,
65563
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65564
+ autolinkEmails: { color: "#1155cc", underline: false }
65561
65565
  },
65562
65566
  "gmail-ios": {
65563
65567
  id: "gmail-ios",
@@ -65585,6 +65589,8 @@ var CLIENT_CONFIGS = {
65585
65589
  },
65586
65590
  "outlook-windows-legacy": {
65587
65591
  id: "outlook-windows-legacy",
65592
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65593
+ autolinkEmails: { color: "blue", underline: true },
65588
65594
  strippedProperties: OUTLOOK_WORD_UNSUPPORTED,
65589
65595
  stripMode: "strip",
65590
65596
  valueStrips: [
@@ -65633,6 +65639,8 @@ var CLIENT_CONFIGS = {
65633
65639
  },
65634
65640
  "outlook-macos": {
65635
65641
  id: "outlook-macos",
65642
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65643
+ autolinkEmails: { color: "#0068da", underline: true },
65636
65644
  dropTextDecorationShorthand: true,
65637
65645
  // The new Outlook for Mac (caniemail 16.80), measured with probe sheet
65638
65646
  // 20-features on a real install, 2026-10-27, and matching caniemail's
@@ -65674,6 +65682,8 @@ var CLIENT_CONFIGS = {
65674
65682
  },
65675
65683
  "apple-mail-macos": {
65676
65684
  id: "apple-mail-macos",
65685
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65686
+ autolinkEmails: { color: "#0068da", underline: true },
65677
65687
  dropTextDecorationShorthand: true,
65678
65688
  strippedProperties: EMPTY_SET,
65679
65689
  stripMode: "strip",
@@ -65701,6 +65711,12 @@ var CLIENT_CONFIGS = {
65701
65711
  // An inline font-family naming a quoted font is dropped whole; <style>
65702
65712
  // keeps it (2026-10-28, analyze.ts step 7).
65703
65713
  valueStrips: [{ prop: "font-family", pattern: /['"]/ }],
65714
+ // A radial-gradient button drew as its flat background-color, inline and
65715
+ // from <style> alike (real-device capture of preview J9vFS4nm_LGl,
65716
+ // 2026-10-30; caniemail agrees). ponytail: radial only; linear is also "n"
65717
+ // in caniemail but every Yahoo capture we hold has a bgcolor fallback
65718
+ // under it, so it is unmeasured. Probe a fallback-less one before adding.
65719
+ dropValues: /radial-gradient\(/i,
65704
65720
  // Real Yahoo web drew foodpanda's `url(...) center / cover` logos at their
65705
65721
  // 236px and its `0% 0% / 100% 100%` coupon at the picture's own size,
65706
65722
  // cropped to the cell (emailens agreement run, 2026-10-28).
@@ -65786,7 +65802,10 @@ var CLIENT_CONFIGS = {
65786
65802
  inlineAndStripStyles: false,
65787
65803
  stripExternalStylesheets: true,
65788
65804
  stripForms: true,
65789
- stripSvg: false
65805
+ stripSvg: false,
65806
+ // Real Proton web drew 9 of 9 &nbsp;-only <p>/<div><span> spacers at no
65807
+ // height (real-device runs _YHEeChhj-3_, Z2Hn_aEsftuG; preview ckKDNoBCeSKz).
65808
+ emptyNbspBlocks: true
65790
65809
  },
65791
65810
  "aol": {
65792
65811
  id: "aol",
@@ -65868,8 +65887,9 @@ function applyStyleDrops($3, config) {
65868
65887
  }
65869
65888
  });
65870
65889
  }
65871
- const dropDeclarations = (ast, inline) => {
65872
- if (!dropValues && !dropProperties) return;
65890
+ const dropDeclarations = (ast) => {
65891
+ if (!dropValues && !dropProperties) return false;
65892
+ let changed = false;
65873
65893
  fy(ast, {
65874
65894
  visit: "Declaration",
65875
65895
  enter(node, item, list) {
@@ -65877,15 +65897,18 @@ function applyStyleDrops($3, config) {
65877
65897
  if (dropProperties == null ? void 0 : dropProperties.test(node.property)) {
65878
65898
  list.remove(item);
65879
65899
  dropped.add(node.property);
65900
+ changed = true;
65880
65901
  return;
65881
65902
  }
65882
65903
  const m2 = dropValues ? `${node.property}:${hy(node.value)}`.match(dropValues) : null;
65883
65904
  if (m2) {
65884
65905
  list.remove(item);
65885
65906
  dropped.add(m2[0].replace(/\($/, "()"));
65907
+ changed = true;
65886
65908
  }
65887
65909
  }
65888
65910
  });
65911
+ return changed;
65889
65912
  };
65890
65913
  $3("style").each((_3, el2) => {
65891
65914
  let ast;
@@ -65924,7 +65947,7 @@ function applyStyleDrops($3, config) {
65924
65947
  }
65925
65948
  });
65926
65949
  }
65927
- dropDeclarations(ast, false);
65950
+ dropDeclarations(ast);
65928
65951
  $3(el2).text(hy(ast));
65929
65952
  });
65930
65953
  if (dropValues || dropProperties) {
@@ -65936,8 +65959,7 @@ function applyStyleDrops($3, config) {
65936
65959
  } catch (e2) {
65937
65960
  return;
65938
65961
  }
65939
- dropDeclarations(ast, true);
65940
- $3(el2).attr("style", hy(ast));
65962
+ if (dropDeclarations(ast)) $3(el2).attr("style", hy(ast));
65941
65963
  });
65942
65964
  }
65943
65965
  return [...dropped];
@@ -66008,6 +66030,30 @@ function dropTextDecorationShorthands($3) {
66008
66030
  });
66009
66031
  return dropped;
66010
66032
  }
66033
+ var EMAIL_ADDRESS = /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g;
66034
+ var NO_AUTOLINK = /* @__PURE__ */ new Set(["a", "script", "style", "title", "textarea", "head"]);
66035
+ function autolinkEmails($3, link) {
66036
+ const style = `color:${link.color};text-decoration:${link.underline ? "underline" : "none"}`;
66037
+ const walk13 = (node) => {
66038
+ if (node.type === "text") {
66039
+ const text3 = node.data;
66040
+ if (!EMAIL_ADDRESS.test(text3)) return;
66041
+ EMAIL_ADDRESS.lastIndex = 0;
66042
+ const escape2 = (s2) => s2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
66043
+ let out = "";
66044
+ let at2 = 0;
66045
+ for (const m2 of text3.matchAll(EMAIL_ADDRESS)) {
66046
+ out += `${escape2(text3.slice(at2, m2.index))}<a href="mailto:${m2[0]}" style="${style}">${m2[0]}</a>`;
66047
+ at2 = m2.index + m2[0].length;
66048
+ }
66049
+ $3(node).replaceWith(out + escape2(text3.slice(at2)));
66050
+ return;
66051
+ }
66052
+ if (node.type === "tag" && NO_AUTOLINK.has(node.name)) return;
66053
+ if ("children" in node) for (const child of [...node.children]) walk13(child);
66054
+ };
66055
+ for (const body of $3("body").toArray()) walk13(body);
66056
+ }
66011
66057
  function applyTransformDom($3, html3, config, framework) {
66012
66058
  var _a22;
66013
66059
  const warnings = [];
@@ -66049,6 +66095,13 @@ function applyTransformDom($3, html3, config, framework) {
66049
66095
  $3(el2).replaceWith($3(el2).html() || "");
66050
66096
  });
66051
66097
  }
66098
+ if (config.emptyNbspBlocks) {
66099
+ $3("p, div, span").each((_3, el2) => {
66100
+ const $el = $3(el2);
66101
+ if ($el.children().length === 0 && /^[\s ]* [\s ]*$/.test($el.text())) $el.empty();
66102
+ });
66103
+ }
66104
+ if (config.autolinkEmails) autolinkEmails($3, config.autolinkEmails);
66052
66105
  if (config.dropFormActions && $3("form").length > 0) {
66053
66106
  warnings.push(makeWarning({
66054
66107
  severity: "error",
@@ -66507,6 +66560,9 @@ function simulateDarkMode(html3, clientId) {
66507
66560
  case "gmail-android":
66508
66561
  applyColorInversion($3, "gmail-android", clientId);
66509
66562
  break;
66563
+ case "outlook-macos":
66564
+ applyColorInversion($3, "outlook-macos", clientId);
66565
+ break;
66510
66566
  case "outlook-web":
66511
66567
  applyColorInversion($3, "partial", clientId);
66512
66568
  if (!html3.includes("prefers-color-scheme")) {
@@ -66614,12 +66670,21 @@ function simulateDarkMode(html3, clientId) {
66614
66670
  break;
66615
66671
  }
66616
66672
  const bodyStyle = ($3("body").attr("style") || "").toLowerCase();
66673
+ const canvas = MEASURED_CANVAS[clientId];
66674
+ if (canvas) {
66675
+ if (!/background(-color)?\s*:/.test(bodyStyle) && !$3("body").attr("bgcolor")) $3("body").css("background-color", canvas.bg);
66676
+ if (!/(^|;)\s*color\s*:/.test(bodyStyle)) $3("body").css("color", canvas.fg);
66677
+ return { html: $3.html(), warnings };
66678
+ }
66617
66679
  if (!Object.values((_c2 = SAMPLED_DARK[clientId]) != null ? _c2 : {}).some((c2) => bodyStyle.includes(c2.slice(1)))) {
66618
66680
  $3("body").css("background-color", "#1a1a1a");
66619
66681
  }
66620
66682
  $3("body").css("color", "#e0e0e0");
66621
66683
  return { html: $3.html(), warnings };
66622
66684
  }
66685
+ var MEASURED_CANVAS = {
66686
+ "outlook-macos": { bg: "#1e1e1e", fg: "#ffffff" }
66687
+ };
66623
66688
  var SAMPLED_DARK = {
66624
66689
  "outlook-web": { eeeae4: "#595651" },
66625
66690
  "gmail-ios": { eeeae4: "#4a4438" }
@@ -66640,20 +66705,41 @@ var FROM_XYZ = [
66640
66705
  var dot = (m2, v) => m2[0] * v[0] + m2[1] * v[1] + m2[2] * v[2];
66641
66706
  var labF = (t2) => t2 > 216 / 24389 ? Math.cbrt(t2) : 841 / 108 * t2 + 4 / 29;
66642
66707
  var labFInv = (t2) => t2 > 6 / 29 ? t2 ** 3 : 108 / 841 * (t2 - 4 / 29);
66643
- function flipLabLightness(c2) {
66708
+ function withLabLightness(c2, to2, [white, toXyz, fromXyz] = [D50, TO_XYZ, FROM_XYZ]) {
66644
66709
  const linear = [c2.r, c2.g, c2.b].map((v) => {
66645
66710
  const s2 = v / 255;
66646
66711
  return s2 <= 0.04045 ? s2 / 12.92 : ((s2 + 0.055) / 1.055) ** 2.4;
66647
66712
  });
66648
- const [fx, fy2, fz] = TO_XYZ.map((row, i2) => labF(dot(row, linear) / D50[i2]));
66649
- const y3 = (Math.min(110 - (116 * fy2 - 16), 100) + 16) / 116;
66650
- const xyz = [fx - fy2 + y3, y3, y3 - (fy2 - fz)].map((t2, i2) => labFInv(t2) * D50[i2]);
66651
- const [r2, g3, b2] = FROM_XYZ.map((row) => {
66713
+ const [fx, fy2, fz] = toXyz.map((row, i2) => labF(dot(row, linear) / white[i2]));
66714
+ const y3 = (to2(116 * fy2 - 16) + 16) / 116;
66715
+ const xyz = [fx - fy2 + y3, y3, y3 - (fy2 - fz)].map((t2, i2) => labFInv(t2) * white[i2]);
66716
+ const [r2, g3, b2] = fromXyz.map((row) => {
66652
66717
  const v = Math.min(1, Math.max(0, dot(row, xyz)));
66653
66718
  return Math.round(255 * (v <= 31308e-7 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055));
66654
66719
  });
66655
66720
  return hex({ r: r2, g: g3, b: b2 });
66656
66721
  }
66722
+ var D65 = [
66723
+ [0.95047, 1, 1.08883],
66724
+ [
66725
+ [0.4124564, 0.3575761, 0.1804375],
66726
+ [0.2126729, 0.7151522, 0.072175],
66727
+ [0.0193339, 0.119192, 0.9503041]
66728
+ ],
66729
+ [
66730
+ [3.2404542, -1.5371385, -0.4985314],
66731
+ [-0.969266, 1.8760108, 0.041556],
66732
+ [0.0556434, -0.2040259, 1.0572252]
66733
+ ]
66734
+ ];
66735
+ var flipLabLightness = (c2) => withLabLightness(c2, (l2) => Math.min(110 - l2, 100));
66736
+ function outlookMacColor(value, role) {
66737
+ const c2 = parseColor(value);
66738
+ if (!c2 || c2.a === 0) return null;
66739
+ if (role === "fg") return withLabLightness(c2, (l2) => Math.max(l2, 100 - 0.772 * l2), D65);
66740
+ if (c2.r === c2.g && c2.g === c2.b) return withLabLightness(c2, (l2) => Math.min(l2, 88.5 - 0.772 * l2), D65);
66741
+ return withLabLightness(c2, () => 34.6, D65);
66742
+ }
66657
66743
  function gmailAndroidColor(value, role) {
66658
66744
  const parsed = parseColor(value);
66659
66745
  if (!parsed || parsed.a === 0) return null;
@@ -66665,6 +66751,7 @@ function gmailAndroidColor(value, role) {
66665
66751
  function invertColor(value, mode, clientId, role = "bg") {
66666
66752
  var _a22;
66667
66753
  if (mode === "gmail-android") return gmailAndroidColor(value, role);
66754
+ if (mode === "outlook-macos") return outlookMacColor(value, role);
66668
66755
  const pinned = clientId && ((_a22 = SAMPLED_DARK[clientId]) == null ? void 0 : _a22[value.trim().replace("#", "").toLowerCase()]);
66669
66756
  if (pinned) return pinned;
66670
66757
  const parsed = parseColor(value);
@@ -68734,7 +68821,7 @@ function featureLabel(prop2) {
68734
68821
  return `"${prop2}"`;
68735
68822
  }
68736
68823
  function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressive", rawHtml) {
68737
- var _a22, _b;
68824
+ var _a22, _b, _c2;
68738
68825
  const warnings = [];
68739
68826
  const seenWarnings = /* @__PURE__ */ new Map();
68740
68827
  const targeting = emptyTargetingReport();
@@ -69185,6 +69272,26 @@ function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressi
69185
69272
  truncated: found.length > MAX_WARNING_LOCATIONS
69186
69273
  }) : {}));
69187
69274
  }
69275
+ const unloadable = $3("img[src]").toArray().filter((el2) => {
69276
+ var _a32;
69277
+ return isUnloadableImageSrc((_a32 = $3(el2).attr("src")) != null ? _a32 : "");
69278
+ });
69279
+ if (unloadable.length) {
69280
+ const found = unloadable.map((el2) => locOfElement(el2)).filter((l2) => l2 !== void 0);
69281
+ const first2 = ((_c2 = $3(unloadable[0]).attr("src")) != null ? _c2 : "").trim() || "an empty src";
69282
+ for (const client of EMAIL_CLIENTS) {
69283
+ addWarning(__spreadValues({
69284
+ severity: "error",
69285
+ client: client.id,
69286
+ property: "<img src>",
69287
+ message: `${unloadable.length === 1 ? "An image points" : `${unloadable.length} images point`} to an address no inbox can load (${first2}), so ${client.name} shows a broken image instead.`,
69288
+ suggestion: "Host the images and use full https:// addresses, such as https://cdn.example.com/logo.png."
69289
+ }, found.length ? occurrenceFields({
69290
+ locs: found.slice(0, MAX_WARNING_LOCATIONS),
69291
+ truncated: found.length > MAX_WARNING_LOCATIONS
69292
+ }) : {}));
69293
+ }
69294
+ }
69188
69295
  const severityOrder = { error: 0, warning: 1, info: 2 };
69189
69296
  warnings.sort((a2, b2) => severityOrder[a2.severity] - severityOrder[b2.severity]);
69190
69297
  return { warnings, targeting };
@@ -69451,6 +69558,14 @@ function checkPropertySupport(prop2, addWarning, framework, selector, line, valu
69451
69558
  }
69452
69559
  }
69453
69560
  }
69561
+ function isUnloadableImageSrc(raw) {
69562
+ const src = raw.trim();
69563
+ if (!src) return true;
69564
+ if (/\{\{|\}\}|\*\||\|\*|%%|\[\[|\$\{|<%/.test(src)) return false;
69565
+ if (/^(https?:)?\/\//i.test(src)) return /^(https?:)?\/\/(localhost|127\.\d+\.\d+\.\d+|\[::1\])(?=[:/]|$)/i.test(src);
69566
+ if (/^(data|cid):/i.test(src)) return false;
69567
+ return true;
69568
+ }
69454
69569
  function generateCompatibilityScore(warnings) {
69455
69570
  const result = {};
69456
69571
  for (const client of EMAIL_CLIENTS) {
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  simulateDarkMode,
33
33
  toFramework,
34
34
  transformForAllClients
35
- } from "./chunk-VC36VNI3.js";
35
+ } from "./chunk-HJEE6UV2.js";
36
36
  import "./chunk-ABDTBRVK.js";
37
37
  import "./chunk-2AP7CT6R.js";
38
38
  import "./chunk-NXBRJX3V.js";
@@ -35591,7 +35591,9 @@ h1 {
35591
35591
  stripExternalStylesheets: true,
35592
35592
  stripForms: true,
35593
35593
  stripSvg: true,
35594
- additionalChecks: gmailAdditionalChecks
35594
+ additionalChecks: gmailAdditionalChecks,
35595
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35596
+ autolinkEmails: { color: "#1155cc", underline: true }
35595
35597
  },
35596
35598
  "gmail-android": {
35597
35599
  id: "gmail-android",
@@ -35605,7 +35607,9 @@ h1 {
35605
35607
  stripExternalStylesheets: true,
35606
35608
  stripForms: true,
35607
35609
  stripSvg: true,
35608
- additionalChecks: gmailAdditionalChecks
35610
+ additionalChecks: gmailAdditionalChecks,
35611
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35612
+ autolinkEmails: { color: "#1155cc", underline: false }
35609
35613
  },
35610
35614
  "gmail-ios": {
35611
35615
  id: "gmail-ios",
@@ -35633,6 +35637,8 @@ h1 {
35633
35637
  },
35634
35638
  "outlook-windows-legacy": {
35635
35639
  id: "outlook-windows-legacy",
35640
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35641
+ autolinkEmails: { color: "blue", underline: true },
35636
35642
  strippedProperties: OUTLOOK_WORD_UNSUPPORTED,
35637
35643
  stripMode: "strip",
35638
35644
  valueStrips: [
@@ -35681,6 +35687,8 @@ h1 {
35681
35687
  },
35682
35688
  "outlook-macos": {
35683
35689
  id: "outlook-macos",
35690
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35691
+ autolinkEmails: { color: "#0068da", underline: true },
35684
35692
  dropTextDecorationShorthand: true,
35685
35693
  // The new Outlook for Mac (caniemail 16.80), measured with probe sheet
35686
35694
  // 20-features on a real install, 2026-10-27, and matching caniemail's
@@ -35722,6 +35730,8 @@ h1 {
35722
35730
  },
35723
35731
  "apple-mail-macos": {
35724
35732
  id: "apple-mail-macos",
35733
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35734
+ autolinkEmails: { color: "#0068da", underline: true },
35725
35735
  dropTextDecorationShorthand: true,
35726
35736
  strippedProperties: EMPTY_SET,
35727
35737
  stripMode: "strip",
@@ -35749,6 +35759,12 @@ h1 {
35749
35759
  // An inline font-family naming a quoted font is dropped whole; <style>
35750
35760
  // keeps it (2026-10-28, analyze.ts step 7).
35751
35761
  valueStrips: [{ prop: "font-family", pattern: /['"]/ }],
35762
+ // A radial-gradient button drew as its flat background-color, inline and
35763
+ // from <style> alike (real-device capture of preview J9vFS4nm_LGl,
35764
+ // 2026-10-30; caniemail agrees). ponytail: radial only; linear is also "n"
35765
+ // in caniemail but every Yahoo capture we hold has a bgcolor fallback
35766
+ // under it, so it is unmeasured. Probe a fallback-less one before adding.
35767
+ dropValues: /radial-gradient\(/i,
35752
35768
  // Real Yahoo web drew foodpanda's `url(...) center / cover` logos at their
35753
35769
  // 236px and its `0% 0% / 100% 100%` coupon at the picture's own size,
35754
35770
  // cropped to the cell (emailens agreement run, 2026-10-28).
@@ -35834,7 +35850,10 @@ h1 {
35834
35850
  inlineAndStripStyles: false,
35835
35851
  stripExternalStylesheets: true,
35836
35852
  stripForms: true,
35837
- stripSvg: false
35853
+ stripSvg: false,
35854
+ // Real Proton web drew 9 of 9 &nbsp;-only <p>/<div><span> spacers at no
35855
+ // height (real-device runs _YHEeChhj-3_, Z2Hn_aEsftuG; preview ckKDNoBCeSKz).
35856
+ emptyNbspBlocks: true
35838
35857
  },
35839
35858
  "aol": {
35840
35859
  id: "aol",
@@ -35916,8 +35935,9 @@ h1 {
35916
35935
  }
35917
35936
  });
35918
35937
  }
35919
- const dropDeclarations = (ast, inline) => {
35920
- if (!dropValues && !dropProperties) return;
35938
+ const dropDeclarations = (ast) => {
35939
+ if (!dropValues && !dropProperties) return false;
35940
+ let changed = false;
35921
35941
  csstree3.walk(ast, {
35922
35942
  visit: "Declaration",
35923
35943
  enter(node, item, list) {
@@ -35925,15 +35945,18 @@ h1 {
35925
35945
  if (dropProperties == null ? void 0 : dropProperties.test(node.property)) {
35926
35946
  list.remove(item);
35927
35947
  dropped.add(node.property);
35948
+ changed = true;
35928
35949
  return;
35929
35950
  }
35930
35951
  const m = dropValues ? `${node.property}:${csstree3.generate(node.value)}`.match(dropValues) : null;
35931
35952
  if (m) {
35932
35953
  list.remove(item);
35933
35954
  dropped.add(m[0].replace(/\($/, "()"));
35955
+ changed = true;
35934
35956
  }
35935
35957
  }
35936
35958
  });
35959
+ return changed;
35937
35960
  };
35938
35961
  $("style").each((_, el) => {
35939
35962
  let ast;
@@ -35972,7 +35995,7 @@ h1 {
35972
35995
  }
35973
35996
  });
35974
35997
  }
35975
- dropDeclarations(ast, false);
35998
+ dropDeclarations(ast);
35976
35999
  $(el).text(csstree3.generate(ast));
35977
36000
  });
35978
36001
  if (dropValues || dropProperties) {
@@ -35984,8 +36007,7 @@ h1 {
35984
36007
  } catch (e) {
35985
36008
  return;
35986
36009
  }
35987
- dropDeclarations(ast, true);
35988
- $(el).attr("style", csstree3.generate(ast));
36010
+ if (dropDeclarations(ast)) $(el).attr("style", csstree3.generate(ast));
35989
36011
  });
35990
36012
  }
35991
36013
  return [...dropped];
@@ -36056,6 +36078,30 @@ h1 {
36056
36078
  });
36057
36079
  return dropped;
36058
36080
  }
36081
+ var EMAIL_ADDRESS = /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g;
36082
+ var NO_AUTOLINK = /* @__PURE__ */ new Set(["a", "script", "style", "title", "textarea", "head"]);
36083
+ function autolinkEmails($, link) {
36084
+ const style = `color:${link.color};text-decoration:${link.underline ? "underline" : "none"}`;
36085
+ const walk13 = (node) => {
36086
+ if (node.type === "text") {
36087
+ const text = node.data;
36088
+ if (!EMAIL_ADDRESS.test(text)) return;
36089
+ EMAIL_ADDRESS.lastIndex = 0;
36090
+ const escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
36091
+ let out = "";
36092
+ let at = 0;
36093
+ for (const m of text.matchAll(EMAIL_ADDRESS)) {
36094
+ out += `${escape(text.slice(at, m.index))}<a href="mailto:${m[0]}" style="${style}">${m[0]}</a>`;
36095
+ at = m.index + m[0].length;
36096
+ }
36097
+ $(node).replaceWith(out + escape(text.slice(at)));
36098
+ return;
36099
+ }
36100
+ if (node.type === "tag" && NO_AUTOLINK.has(node.name)) return;
36101
+ if ("children" in node) for (const child of [...node.children]) walk13(child);
36102
+ };
36103
+ for (const body of $("body").toArray()) walk13(body);
36104
+ }
36059
36105
  function applyTransform(html, config, framework) {
36060
36106
  return applyTransformDom(cheerio3.load(html), html, config, framework);
36061
36107
  }
@@ -36100,6 +36146,13 @@ h1 {
36100
36146
  $(el).replaceWith($(el).html() || "");
36101
36147
  });
36102
36148
  }
36149
+ if (config.emptyNbspBlocks) {
36150
+ $("p, div, span").each((_, el) => {
36151
+ const $el = $(el);
36152
+ if ($el.children().length === 0 && /^[\s ]* [\s ]*$/.test($el.text())) $el.empty();
36153
+ });
36154
+ }
36155
+ if (config.autolinkEmails) autolinkEmails($, config.autolinkEmails);
36103
36156
  if (config.dropFormActions && $("form").length > 0) {
36104
36157
  warnings.push(makeWarning({
36105
36158
  severity: "error",
@@ -36595,6 +36648,9 @@ h1 {
36595
36648
  case "gmail-android":
36596
36649
  applyColorInversion($, "gmail-android", clientId);
36597
36650
  break;
36651
+ case "outlook-macos":
36652
+ applyColorInversion($, "outlook-macos", clientId);
36653
+ break;
36598
36654
  case "outlook-web":
36599
36655
  applyColorInversion($, "partial", clientId);
36600
36656
  if (!html.includes("prefers-color-scheme")) {
@@ -36702,12 +36758,21 @@ h1 {
36702
36758
  break;
36703
36759
  }
36704
36760
  const bodyStyle = ($("body").attr("style") || "").toLowerCase();
36761
+ const canvas = MEASURED_CANVAS[clientId];
36762
+ if (canvas) {
36763
+ if (!/background(-color)?\s*:/.test(bodyStyle) && !$("body").attr("bgcolor")) $("body").css("background-color", canvas.bg);
36764
+ if (!/(^|;)\s*color\s*:/.test(bodyStyle)) $("body").css("color", canvas.fg);
36765
+ return { html: $.html(), warnings };
36766
+ }
36705
36767
  if (!Object.values((_c = SAMPLED_DARK[clientId]) != null ? _c : {}).some((c) => bodyStyle.includes(c.slice(1)))) {
36706
36768
  $("body").css("background-color", "#1a1a1a");
36707
36769
  }
36708
36770
  $("body").css("color", "#e0e0e0");
36709
36771
  return { html: $.html(), warnings };
36710
36772
  }
36773
+ var MEASURED_CANVAS = {
36774
+ "outlook-macos": { bg: "#1e1e1e", fg: "#ffffff" }
36775
+ };
36711
36776
  var SAMPLED_DARK = {
36712
36777
  "outlook-web": { eeeae4: "#595651" },
36713
36778
  "gmail-ios": { eeeae4: "#4a4438" }
@@ -36728,20 +36793,41 @@ h1 {
36728
36793
  var dot = (m, v) => m[0] * v[0] + m[1] * v[1] + m[2] * v[2];
36729
36794
  var labF = (t) => t > 216 / 24389 ? Math.cbrt(t) : 841 / 108 * t + 4 / 29;
36730
36795
  var labFInv = (t) => t > 6 / 29 ? t ** 3 : 108 / 841 * (t - 4 / 29);
36731
- function flipLabLightness(c) {
36796
+ function withLabLightness(c, to, [white, toXyz, fromXyz] = [D50, TO_XYZ, FROM_XYZ]) {
36732
36797
  const linear = [c.r, c.g, c.b].map((v) => {
36733
36798
  const s = v / 255;
36734
36799
  return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
36735
36800
  });
36736
- const [fx, fy, fz] = TO_XYZ.map((row, i) => labF(dot(row, linear) / D50[i]));
36737
- const y = (Math.min(110 - (116 * fy - 16), 100) + 16) / 116;
36738
- const xyz = [fx - fy + y, y, y - (fy - fz)].map((t, i) => labFInv(t) * D50[i]);
36739
- const [r, g, b] = FROM_XYZ.map((row) => {
36801
+ const [fx, fy, fz] = toXyz.map((row, i) => labF(dot(row, linear) / white[i]));
36802
+ const y = (to(116 * fy - 16) + 16) / 116;
36803
+ const xyz = [fx - fy + y, y, y - (fy - fz)].map((t, i) => labFInv(t) * white[i]);
36804
+ const [r, g, b] = fromXyz.map((row) => {
36740
36805
  const v = Math.min(1, Math.max(0, dot(row, xyz)));
36741
36806
  return Math.round(255 * (v <= 31308e-7 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055));
36742
36807
  });
36743
36808
  return hex({ r, g, b });
36744
36809
  }
36810
+ var D65 = [
36811
+ [0.95047, 1, 1.08883],
36812
+ [
36813
+ [0.4124564, 0.3575761, 0.1804375],
36814
+ [0.2126729, 0.7151522, 0.072175],
36815
+ [0.0193339, 0.119192, 0.9503041]
36816
+ ],
36817
+ [
36818
+ [3.2404542, -1.5371385, -0.4985314],
36819
+ [-0.969266, 1.8760108, 0.041556],
36820
+ [0.0556434, -0.2040259, 1.0572252]
36821
+ ]
36822
+ ];
36823
+ var flipLabLightness = (c) => withLabLightness(c, (l) => Math.min(110 - l, 100));
36824
+ function outlookMacColor(value, role) {
36825
+ const c = parseColor(value);
36826
+ if (!c || c.a === 0) return null;
36827
+ if (role === "fg") return withLabLightness(c, (l) => Math.max(l, 100 - 0.772 * l), D65);
36828
+ if (c.r === c.g && c.g === c.b) return withLabLightness(c, (l) => Math.min(l, 88.5 - 0.772 * l), D65);
36829
+ return withLabLightness(c, () => 34.6, D65);
36830
+ }
36745
36831
  function gmailAndroidColor(value, role) {
36746
36832
  const parsed = parseColor(value);
36747
36833
  if (!parsed || parsed.a === 0) return null;
@@ -36753,6 +36839,7 @@ h1 {
36753
36839
  function invertColor(value, mode, clientId, role = "bg") {
36754
36840
  var _a2;
36755
36841
  if (mode === "gmail-android") return gmailAndroidColor(value, role);
36842
+ if (mode === "outlook-macos") return outlookMacColor(value, role);
36756
36843
  const pinned = clientId && ((_a2 = SAMPLED_DARK[clientId]) == null ? void 0 : _a2[value.trim().replace("#", "").toLowerCase()]);
36757
36844
  if (pinned) return pinned;
36758
36845
  const parsed = parseColor(value);
@@ -38826,7 +38913,7 @@ h1 {
38826
38913
  return `"${prop}"`;
38827
38914
  }
38828
38915
  function analyzeEmailFromDom($, framework, source, targetingPolicy = "progressive", rawHtml) {
38829
- var _a2, _b;
38916
+ var _a2, _b, _c;
38830
38917
  const warnings = [];
38831
38918
  const seenWarnings = /* @__PURE__ */ new Map();
38832
38919
  const targeting = emptyTargetingReport();
@@ -39277,6 +39364,26 @@ h1 {
39277
39364
  truncated: found.length > MAX_WARNING_LOCATIONS
39278
39365
  }) : {}));
39279
39366
  }
39367
+ const unloadable = $("img[src]").toArray().filter((el) => {
39368
+ var _a3;
39369
+ return isUnloadableImageSrc((_a3 = $(el).attr("src")) != null ? _a3 : "");
39370
+ });
39371
+ if (unloadable.length) {
39372
+ const found = unloadable.map((el) => locOfElement(el)).filter((l) => l !== void 0);
39373
+ const first = ((_c = $(unloadable[0]).attr("src")) != null ? _c : "").trim() || "an empty src";
39374
+ for (const client of EMAIL_CLIENTS2) {
39375
+ addWarning(__spreadValues({
39376
+ severity: "error",
39377
+ client: client.id,
39378
+ property: "<img src>",
39379
+ message: `${unloadable.length === 1 ? "An image points" : `${unloadable.length} images point`} to an address no inbox can load (${first}), so ${client.name} shows a broken image instead.`,
39380
+ suggestion: "Host the images and use full https:// addresses, such as https://cdn.example.com/logo.png."
39381
+ }, found.length ? occurrenceFields({
39382
+ locs: found.slice(0, MAX_WARNING_LOCATIONS),
39383
+ truncated: found.length > MAX_WARNING_LOCATIONS
39384
+ }) : {}));
39385
+ }
39386
+ }
39280
39387
  const severityOrder = { error: 0, warning: 1, info: 2 };
39281
39388
  warnings.sort((a, b) => severityOrder[a.severity] - severityOrder[b.severity]);
39282
39389
  return { warnings, targeting };
@@ -39543,6 +39650,14 @@ h1 {
39543
39650
  }
39544
39651
  }
39545
39652
  }
39653
+ function isUnloadableImageSrc(raw) {
39654
+ const src = raw.trim();
39655
+ if (!src) return true;
39656
+ if (/\{\{|\}\}|\*\||\|\*|%%|\[\[|\$\{|<%/.test(src)) return false;
39657
+ if (/^(https?:)?\/\//i.test(src)) return /^(https?:)?\/\/(localhost|127\.\d+\.\d+\.\d+|\[::1\])(?=[:/]|$)/i.test(src);
39658
+ if (/^(data|cid):/i.test(src)) return false;
39659
+ return true;
39660
+ }
39546
39661
  function generateCompatibilityScore2(warnings) {
39547
39662
  const result = {};
39548
39663
  for (const client of EMAIL_CLIENTS2) {
@@ -42955,7 +43070,7 @@ Href: ${href}`
42955
43070
  // package.json
42956
43071
  var package_default = {
42957
43072
  name: "@emailens/cli",
42958
- version: "0.13.9",
43073
+ version: "0.13.11",
42959
43074
  description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
42960
43075
  type: "module",
42961
43076
  bin: {
@@ -42996,7 +43111,7 @@ var package_default = {
42996
43111
  },
42997
43112
  devDependencies: {
42998
43113
  "@anthropic-ai/sdk": "^0.52.0",
42999
- "@emailens/engine": "^0.18.11",
43114
+ "@emailens/engine": "^0.18.13",
43000
43115
  "@types/bun": "^1.4.0",
43001
43116
  "@types/mjml": "^4.7.4",
43002
43117
  "@types/node": "^25.9.5",
package/dist/test.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  auditEmail,
6
6
  flattenToLintIssues,
7
7
  loadProjectConfig
8
- } from "./chunk-VC36VNI3.js";
8
+ } from "./chunk-HJEE6UV2.js";
9
9
  import "./chunk-ABDTBRVK.js";
10
10
  import "./chunk-2AP7CT6R.js";
11
11
  import "./chunk-NXBRJX3V.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailens/cli",
3
- "version": "0.13.9",
3
+ "version": "0.13.11",
4
4
  "description": "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@anthropic-ai/sdk": "^0.52.0",
44
- "@emailens/engine": "^0.18.11",
44
+ "@emailens/engine": "^0.18.13",
45
45
  "@types/bun": "^1.4.0",
46
46
  "@types/mjml": "^4.7.4",
47
47
  "@types/node": "^25.9.5",