@emailens/cli 0.13.10 → 0.13.12

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.
@@ -63268,12 +63268,27 @@ function arcsizeToRadius(arcsize, width, height) {
63268
63268
  return Math.min(shorter / 2, Math.max(0, pct) / 100 * shorter);
63269
63269
  }
63270
63270
  var DOWNLEVEL_REVEALED = /<!--\[if[^\]]*!\s*\(*\s*(?:mso|vml|true)[^\]]*\]>\s*<(?:!-->|!--\s*-->|!\s*-->)([\s\S]*?)(?:<!--\s*<!\[endif\]-->|<!--\[endif\]-*-->)/gi;
63271
- var DOWNLEVEL_HIDDEN = /<!--\[if(?![^\]]*!)[^\]]*(?:mso|vml|true)[^\]]*\]>([\s\S]*?)<!\[endif\]-->/gi;
63271
+ var DOWNLEVEL_HIDDEN = /<!--\[if(?![^\]]*!)([^\]]*(?:mso|vml|true)[^\]]*)\]>([\s\S]*?)<!\[endif\]-->/gi;
63272
+ var WORD_MSO_VERSION = 16;
63273
+ function wordOpens(condition) {
63274
+ const bits = condition.toLowerCase().replace(/\b(?:(lt|lte|gt|gte)\s+)?mso(?:\s+(\d+(?:\.\d+)?))?/g, (_3, op2, n2) => {
63275
+ if (!n2) return "1";
63276
+ const v = Number.parseFloat(n2);
63277
+ const ok = op2 === "lt" ? WORD_MSO_VERSION < v : op2 === "lte" ? WORD_MSO_VERSION <= v : op2 === "gt" ? WORD_MSO_VERSION > v : op2 === "gte" ? WORD_MSO_VERSION >= v : Math.floor(v) === WORD_MSO_VERSION;
63278
+ return ok ? "1" : "0";
63279
+ }).replace(/\b(?:vml|true)\b/g, "1").replace(/[a-z]\w*(?:\s+\d+(?:\.\d+)?)?/g, "0").replace(/\s+/g, "");
63280
+ let s2 = bits;
63281
+ for (let prev2 = ""; prev2 !== s2; ) {
63282
+ prev2 = s2;
63283
+ s2 = s2.replace(/\(([01])\)/g, "$1").replace(/([01])&([01])/g, (_3, a2, b2) => a2 === "1" && b2 === "1" ? "1" : "0").replace(/([01])\|([01])/g, (_3, a2, b2) => a2 === "1" || b2 === "1" ? "1" : "0");
63284
+ }
63285
+ return s2 === "1";
63286
+ }
63272
63287
  var OFFICE_SETTINGS = /<xml\b[^>]*>[\s\S]*?<\/xml>/gi;
63273
63288
  function resolveMsoBranch(html3) {
63274
63289
  return html3.replace(DOWNLEVEL_REVEALED, "").replace(
63275
63290
  DOWNLEVEL_HIDDEN,
63276
- (_3, inner) => /^\s*<style/i.test(inner) ? inner.replace(/(\.[\w-]+\s*\{[^}]*?)font-size\s*:[^;}]*;?/g, "$1") : inner
63291
+ (_3, condition, inner) => !wordOpens(condition) ? "" : /^\s*<style/i.test(inner) ? inner.replace(/(\.[\w-]+\s*\{[^}]*?)font-size\s*:[^;}]*;?/g, "$1") : inner
63277
63292
  ).replace(OFFICE_SETTINGS, "");
63278
63293
  }
63279
63294
  var MSO_HIDE = /mso-hide\s*:\s*all/i;
@@ -65543,7 +65558,9 @@ var CLIENT_CONFIGS = {
65543
65558
  stripExternalStylesheets: true,
65544
65559
  stripForms: true,
65545
65560
  stripSvg: true,
65546
- additionalChecks: gmailAdditionalChecks
65561
+ additionalChecks: gmailAdditionalChecks,
65562
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65563
+ autolinkEmails: { color: "#1155cc", underline: true }
65547
65564
  },
65548
65565
  "gmail-android": {
65549
65566
  id: "gmail-android",
@@ -65557,7 +65574,9 @@ var CLIENT_CONFIGS = {
65557
65574
  stripExternalStylesheets: true,
65558
65575
  stripForms: true,
65559
65576
  stripSvg: true,
65560
- additionalChecks: gmailAdditionalChecks
65577
+ additionalChecks: gmailAdditionalChecks,
65578
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65579
+ autolinkEmails: { color: "#1155cc", underline: false }
65561
65580
  },
65562
65581
  "gmail-ios": {
65563
65582
  id: "gmail-ios",
@@ -65585,6 +65604,8 @@ var CLIENT_CONFIGS = {
65585
65604
  },
65586
65605
  "outlook-windows-legacy": {
65587
65606
  id: "outlook-windows-legacy",
65607
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65608
+ autolinkEmails: { color: "blue", underline: true },
65588
65609
  strippedProperties: OUTLOOK_WORD_UNSUPPORTED,
65589
65610
  stripMode: "strip",
65590
65611
  valueStrips: [
@@ -65633,6 +65654,8 @@ var CLIENT_CONFIGS = {
65633
65654
  },
65634
65655
  "outlook-macos": {
65635
65656
  id: "outlook-macos",
65657
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65658
+ autolinkEmails: { color: "#0068da", underline: true },
65636
65659
  dropTextDecorationShorthand: true,
65637
65660
  // The new Outlook for Mac (caniemail 16.80), measured with probe sheet
65638
65661
  // 20-features on a real install, 2026-10-27, and matching caniemail's
@@ -65674,6 +65697,8 @@ var CLIENT_CONFIGS = {
65674
65697
  },
65675
65698
  "apple-mail-macos": {
65676
65699
  id: "apple-mail-macos",
65700
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
65701
+ autolinkEmails: { color: "#0068da", underline: true },
65677
65702
  dropTextDecorationShorthand: true,
65678
65703
  strippedProperties: EMPTY_SET,
65679
65704
  stripMode: "strip",
@@ -66020,6 +66045,30 @@ function dropTextDecorationShorthands($3) {
66020
66045
  });
66021
66046
  return dropped;
66022
66047
  }
66048
+ var EMAIL_ADDRESS = /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g;
66049
+ var NO_AUTOLINK = /* @__PURE__ */ new Set(["a", "script", "style", "title", "textarea", "head"]);
66050
+ function autolinkEmails($3, link) {
66051
+ const style = `color:${link.color};text-decoration:${link.underline ? "underline" : "none"}`;
66052
+ const walk13 = (node) => {
66053
+ if (node.type === "text") {
66054
+ const text3 = node.data;
66055
+ if (!EMAIL_ADDRESS.test(text3)) return;
66056
+ EMAIL_ADDRESS.lastIndex = 0;
66057
+ const escape2 = (s2) => s2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
66058
+ let out = "";
66059
+ let at2 = 0;
66060
+ for (const m2 of text3.matchAll(EMAIL_ADDRESS)) {
66061
+ out += `${escape2(text3.slice(at2, m2.index))}<a href="mailto:${m2[0]}" style="${style}">${m2[0]}</a>`;
66062
+ at2 = m2.index + m2[0].length;
66063
+ }
66064
+ $3(node).replaceWith(out + escape2(text3.slice(at2)));
66065
+ return;
66066
+ }
66067
+ if (node.type === "tag" && NO_AUTOLINK.has(node.name)) return;
66068
+ if ("children" in node) for (const child of [...node.children]) walk13(child);
66069
+ };
66070
+ for (const body of $3("body").toArray()) walk13(body);
66071
+ }
66023
66072
  function applyTransformDom($3, html3, config, framework) {
66024
66073
  var _a22;
66025
66074
  const warnings = [];
@@ -66067,6 +66116,7 @@ function applyTransformDom($3, html3, config, framework) {
66067
66116
  if ($el.children().length === 0 && /^[\s ]* [\s ]*$/.test($el.text())) $el.empty();
66068
66117
  });
66069
66118
  }
66119
+ if (config.autolinkEmails) autolinkEmails($3, config.autolinkEmails);
66070
66120
  if (config.dropFormActions && $3("form").length > 0) {
66071
66121
  warnings.push(makeWarning({
66072
66122
  severity: "error",
@@ -66525,6 +66575,9 @@ function simulateDarkMode(html3, clientId) {
66525
66575
  case "gmail-android":
66526
66576
  applyColorInversion($3, "gmail-android", clientId);
66527
66577
  break;
66578
+ case "outlook-macos":
66579
+ applyColorInversion($3, "outlook-macos", clientId);
66580
+ break;
66528
66581
  case "outlook-web":
66529
66582
  applyColorInversion($3, "partial", clientId);
66530
66583
  if (!html3.includes("prefers-color-scheme")) {
@@ -66632,12 +66685,21 @@ function simulateDarkMode(html3, clientId) {
66632
66685
  break;
66633
66686
  }
66634
66687
  const bodyStyle = ($3("body").attr("style") || "").toLowerCase();
66688
+ const canvas = MEASURED_CANVAS[clientId];
66689
+ if (canvas) {
66690
+ if (!/background(-color)?\s*:/.test(bodyStyle) && !$3("body").attr("bgcolor")) $3("body").css("background-color", canvas.bg);
66691
+ if (!/(^|;)\s*color\s*:/.test(bodyStyle)) $3("body").css("color", canvas.fg);
66692
+ return { html: $3.html(), warnings };
66693
+ }
66635
66694
  if (!Object.values((_c2 = SAMPLED_DARK[clientId]) != null ? _c2 : {}).some((c2) => bodyStyle.includes(c2.slice(1)))) {
66636
66695
  $3("body").css("background-color", "#1a1a1a");
66637
66696
  }
66638
66697
  $3("body").css("color", "#e0e0e0");
66639
66698
  return { html: $3.html(), warnings };
66640
66699
  }
66700
+ var MEASURED_CANVAS = {
66701
+ "outlook-macos": { bg: "#1e1e1e", fg: "#ffffff" }
66702
+ };
66641
66703
  var SAMPLED_DARK = {
66642
66704
  "outlook-web": { eeeae4: "#595651" },
66643
66705
  "gmail-ios": { eeeae4: "#4a4438" }
@@ -66658,20 +66720,41 @@ var FROM_XYZ = [
66658
66720
  var dot = (m2, v) => m2[0] * v[0] + m2[1] * v[1] + m2[2] * v[2];
66659
66721
  var labF = (t2) => t2 > 216 / 24389 ? Math.cbrt(t2) : 841 / 108 * t2 + 4 / 29;
66660
66722
  var labFInv = (t2) => t2 > 6 / 29 ? t2 ** 3 : 108 / 841 * (t2 - 4 / 29);
66661
- function flipLabLightness(c2) {
66723
+ function withLabLightness(c2, to2, [white, toXyz, fromXyz] = [D50, TO_XYZ, FROM_XYZ]) {
66662
66724
  const linear = [c2.r, c2.g, c2.b].map((v) => {
66663
66725
  const s2 = v / 255;
66664
66726
  return s2 <= 0.04045 ? s2 / 12.92 : ((s2 + 0.055) / 1.055) ** 2.4;
66665
66727
  });
66666
- const [fx, fy2, fz] = TO_XYZ.map((row, i2) => labF(dot(row, linear) / D50[i2]));
66667
- const y3 = (Math.min(110 - (116 * fy2 - 16), 100) + 16) / 116;
66668
- const xyz = [fx - fy2 + y3, y3, y3 - (fy2 - fz)].map((t2, i2) => labFInv(t2) * D50[i2]);
66669
- const [r2, g3, b2] = FROM_XYZ.map((row) => {
66728
+ const [fx, fy2, fz] = toXyz.map((row, i2) => labF(dot(row, linear) / white[i2]));
66729
+ const y3 = (to2(116 * fy2 - 16) + 16) / 116;
66730
+ const xyz = [fx - fy2 + y3, y3, y3 - (fy2 - fz)].map((t2, i2) => labFInv(t2) * white[i2]);
66731
+ const [r2, g3, b2] = fromXyz.map((row) => {
66670
66732
  const v = Math.min(1, Math.max(0, dot(row, xyz)));
66671
66733
  return Math.round(255 * (v <= 31308e-7 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055));
66672
66734
  });
66673
66735
  return hex({ r: r2, g: g3, b: b2 });
66674
66736
  }
66737
+ var D65 = [
66738
+ [0.95047, 1, 1.08883],
66739
+ [
66740
+ [0.4124564, 0.3575761, 0.1804375],
66741
+ [0.2126729, 0.7151522, 0.072175],
66742
+ [0.0193339, 0.119192, 0.9503041]
66743
+ ],
66744
+ [
66745
+ [3.2404542, -1.5371385, -0.4985314],
66746
+ [-0.969266, 1.8760108, 0.041556],
66747
+ [0.0556434, -0.2040259, 1.0572252]
66748
+ ]
66749
+ ];
66750
+ var flipLabLightness = (c2) => withLabLightness(c2, (l2) => Math.min(110 - l2, 100));
66751
+ function outlookMacColor(value, role) {
66752
+ const c2 = parseColor(value);
66753
+ if (!c2 || c2.a === 0) return null;
66754
+ if (role === "fg") return withLabLightness(c2, (l2) => Math.max(l2, 100 - 0.772 * l2), D65);
66755
+ if (c2.r === c2.g && c2.g === c2.b) return withLabLightness(c2, (l2) => Math.min(l2, 88.5 - 0.772 * l2), D65);
66756
+ return withLabLightness(c2, () => 34.6, D65);
66757
+ }
66675
66758
  function gmailAndroidColor(value, role) {
66676
66759
  const parsed = parseColor(value);
66677
66760
  if (!parsed || parsed.a === 0) return null;
@@ -66683,6 +66766,7 @@ function gmailAndroidColor(value, role) {
66683
66766
  function invertColor(value, mode, clientId, role = "bg") {
66684
66767
  var _a22;
66685
66768
  if (mode === "gmail-android") return gmailAndroidColor(value, role);
66769
+ if (mode === "outlook-macos") return outlookMacColor(value, role);
66686
66770
  const pinned = clientId && ((_a22 = SAMPLED_DARK[clientId]) == null ? void 0 : _a22[value.trim().replace("#", "").toLowerCase()]);
66687
66771
  if (pinned) return pinned;
66688
66772
  const parsed = parseColor(value);
@@ -68752,7 +68836,7 @@ function featureLabel(prop2) {
68752
68836
  return `"${prop2}"`;
68753
68837
  }
68754
68838
  function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressive", rawHtml) {
68755
- var _a22, _b;
68839
+ var _a22, _b, _c2;
68756
68840
  const warnings = [];
68757
68841
  const seenWarnings = /* @__PURE__ */ new Map();
68758
68842
  const targeting = emptyTargetingReport();
@@ -69203,6 +69287,26 @@ function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressi
69203
69287
  truncated: found.length > MAX_WARNING_LOCATIONS
69204
69288
  }) : {}));
69205
69289
  }
69290
+ const unloadable = $3("img[src]").toArray().filter((el2) => {
69291
+ var _a32;
69292
+ return isUnloadableImageSrc((_a32 = $3(el2).attr("src")) != null ? _a32 : "");
69293
+ });
69294
+ if (unloadable.length) {
69295
+ const found = unloadable.map((el2) => locOfElement(el2)).filter((l2) => l2 !== void 0);
69296
+ const first2 = ((_c2 = $3(unloadable[0]).attr("src")) != null ? _c2 : "").trim() || "an empty src";
69297
+ for (const client of EMAIL_CLIENTS) {
69298
+ addWarning(__spreadValues({
69299
+ severity: "error",
69300
+ client: client.id,
69301
+ property: "<img src>",
69302
+ 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.`,
69303
+ suggestion: "Host the images and use full https:// addresses, such as https://cdn.example.com/logo.png."
69304
+ }, found.length ? occurrenceFields({
69305
+ locs: found.slice(0, MAX_WARNING_LOCATIONS),
69306
+ truncated: found.length > MAX_WARNING_LOCATIONS
69307
+ }) : {}));
69308
+ }
69309
+ }
69206
69310
  const severityOrder = { error: 0, warning: 1, info: 2 };
69207
69311
  warnings.sort((a2, b2) => severityOrder[a2.severity] - severityOrder[b2.severity]);
69208
69312
  return { warnings, targeting };
@@ -69469,6 +69573,14 @@ function checkPropertySupport(prop2, addWarning, framework, selector, line, valu
69469
69573
  }
69470
69574
  }
69471
69575
  }
69576
+ function isUnloadableImageSrc(raw) {
69577
+ const src = raw.trim();
69578
+ if (!src) return true;
69579
+ if (/\{\{|\}\}|\*\||\|\*|%%|\[\[|\$\{|<%/.test(src)) return false;
69580
+ if (/^(https?:)?\/\//i.test(src)) return /^(https?:)?\/\/(localhost|127\.\d+\.\d+\.\d+|\[::1\])(?=[:/]|$)/i.test(src);
69581
+ if (/^(data|cid):/i.test(src)) return false;
69582
+ return true;
69583
+ }
69472
69584
  function generateCompatibilityScore(warnings) {
69473
69585
  const result = {};
69474
69586
  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-56SQXQSC.js";
35
+ } from "./chunk-3TDW4LHR.js";
36
36
  import "./chunk-ABDTBRVK.js";
37
37
  import "./chunk-2AP7CT6R.js";
38
38
  import "./chunk-NXBRJX3V.js";
@@ -33302,12 +33302,27 @@ h1 {
33302
33302
  return Math.min(shorter / 2, Math.max(0, pct) / 100 * shorter);
33303
33303
  }
33304
33304
  var DOWNLEVEL_REVEALED = /<!--\[if[^\]]*!\s*\(*\s*(?:mso|vml|true)[^\]]*\]>\s*<(?:!-->|!--\s*-->|!\s*-->)([\s\S]*?)(?:<!--\s*<!\[endif\]-->|<!--\[endif\]-*-->)/gi;
33305
- var DOWNLEVEL_HIDDEN = /<!--\[if(?![^\]]*!)[^\]]*(?:mso|vml|true)[^\]]*\]>([\s\S]*?)<!\[endif\]-->/gi;
33305
+ var DOWNLEVEL_HIDDEN = /<!--\[if(?![^\]]*!)([^\]]*(?:mso|vml|true)[^\]]*)\]>([\s\S]*?)<!\[endif\]-->/gi;
33306
+ var WORD_MSO_VERSION = 16;
33307
+ function wordOpens(condition) {
33308
+ const bits = condition.toLowerCase().replace(/\b(?:(lt|lte|gt|gte)\s+)?mso(?:\s+(\d+(?:\.\d+)?))?/g, (_, op, n) => {
33309
+ if (!n) return "1";
33310
+ const v = Number.parseFloat(n);
33311
+ const ok = op === "lt" ? WORD_MSO_VERSION < v : op === "lte" ? WORD_MSO_VERSION <= v : op === "gt" ? WORD_MSO_VERSION > v : op === "gte" ? WORD_MSO_VERSION >= v : Math.floor(v) === WORD_MSO_VERSION;
33312
+ return ok ? "1" : "0";
33313
+ }).replace(/\b(?:vml|true)\b/g, "1").replace(/[a-z]\w*(?:\s+\d+(?:\.\d+)?)?/g, "0").replace(/\s+/g, "");
33314
+ let s = bits;
33315
+ for (let prev = ""; prev !== s; ) {
33316
+ prev = s;
33317
+ s = s.replace(/\(([01])\)/g, "$1").replace(/([01])&([01])/g, (_, a, b) => a === "1" && b === "1" ? "1" : "0").replace(/([01])\|([01])/g, (_, a, b) => a === "1" || b === "1" ? "1" : "0");
33318
+ }
33319
+ return s === "1";
33320
+ }
33306
33321
  var OFFICE_SETTINGS = /<xml\b[^>]*>[\s\S]*?<\/xml>/gi;
33307
33322
  function resolveMsoBranch(html) {
33308
33323
  return html.replace(DOWNLEVEL_REVEALED, "").replace(
33309
33324
  DOWNLEVEL_HIDDEN,
33310
- (_, inner) => /^\s*<style/i.test(inner) ? inner.replace(/(\.[\w-]+\s*\{[^}]*?)font-size\s*:[^;}]*;?/g, "$1") : inner
33325
+ (_, condition, inner) => !wordOpens(condition) ? "" : /^\s*<style/i.test(inner) ? inner.replace(/(\.[\w-]+\s*\{[^}]*?)font-size\s*:[^;}]*;?/g, "$1") : inner
33311
33326
  ).replace(OFFICE_SETTINGS, "");
33312
33327
  }
33313
33328
  var MSO_HIDE = /mso-hide\s*:\s*all/i;
@@ -35591,7 +35606,9 @@ h1 {
35591
35606
  stripExternalStylesheets: true,
35592
35607
  stripForms: true,
35593
35608
  stripSvg: true,
35594
- additionalChecks: gmailAdditionalChecks
35609
+ additionalChecks: gmailAdditionalChecks,
35610
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35611
+ autolinkEmails: { color: "#1155cc", underline: true }
35595
35612
  },
35596
35613
  "gmail-android": {
35597
35614
  id: "gmail-android",
@@ -35605,7 +35622,9 @@ h1 {
35605
35622
  stripExternalStylesheets: true,
35606
35623
  stripForms: true,
35607
35624
  stripSvg: true,
35608
- additionalChecks: gmailAdditionalChecks
35625
+ additionalChecks: gmailAdditionalChecks,
35626
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35627
+ autolinkEmails: { color: "#1155cc", underline: false }
35609
35628
  },
35610
35629
  "gmail-ios": {
35611
35630
  id: "gmail-ios",
@@ -35633,6 +35652,8 @@ h1 {
35633
35652
  },
35634
35653
  "outlook-windows-legacy": {
35635
35654
  id: "outlook-windows-legacy",
35655
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35656
+ autolinkEmails: { color: "blue", underline: true },
35636
35657
  strippedProperties: OUTLOOK_WORD_UNSUPPORTED,
35637
35658
  stripMode: "strip",
35638
35659
  valueStrips: [
@@ -35681,6 +35702,8 @@ h1 {
35681
35702
  },
35682
35703
  "outlook-macos": {
35683
35704
  id: "outlook-macos",
35705
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35706
+ autolinkEmails: { color: "#0068da", underline: true },
35684
35707
  dropTextDecorationShorthand: true,
35685
35708
  // The new Outlook for Mac (caniemail 16.80), measured with probe sheet
35686
35709
  // 20-features on a real install, 2026-10-27, and matching caniemail's
@@ -35722,6 +35745,8 @@ h1 {
35722
35745
  },
35723
35746
  "apple-mail-macos": {
35724
35747
  id: "apple-mail-macos",
35748
+ // Bare addresses become links: real-device run C93iCoVV5yas, 2026-11-03.
35749
+ autolinkEmails: { color: "#0068da", underline: true },
35725
35750
  dropTextDecorationShorthand: true,
35726
35751
  strippedProperties: EMPTY_SET,
35727
35752
  stripMode: "strip",
@@ -36068,6 +36093,30 @@ h1 {
36068
36093
  });
36069
36094
  return dropped;
36070
36095
  }
36096
+ var EMAIL_ADDRESS = /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g;
36097
+ var NO_AUTOLINK = /* @__PURE__ */ new Set(["a", "script", "style", "title", "textarea", "head"]);
36098
+ function autolinkEmails($, link) {
36099
+ const style = `color:${link.color};text-decoration:${link.underline ? "underline" : "none"}`;
36100
+ const walk13 = (node) => {
36101
+ if (node.type === "text") {
36102
+ const text = node.data;
36103
+ if (!EMAIL_ADDRESS.test(text)) return;
36104
+ EMAIL_ADDRESS.lastIndex = 0;
36105
+ const escape = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
36106
+ let out = "";
36107
+ let at = 0;
36108
+ for (const m of text.matchAll(EMAIL_ADDRESS)) {
36109
+ out += `${escape(text.slice(at, m.index))}<a href="mailto:${m[0]}" style="${style}">${m[0]}</a>`;
36110
+ at = m.index + m[0].length;
36111
+ }
36112
+ $(node).replaceWith(out + escape(text.slice(at)));
36113
+ return;
36114
+ }
36115
+ if (node.type === "tag" && NO_AUTOLINK.has(node.name)) return;
36116
+ if ("children" in node) for (const child of [...node.children]) walk13(child);
36117
+ };
36118
+ for (const body of $("body").toArray()) walk13(body);
36119
+ }
36071
36120
  function applyTransform(html, config, framework) {
36072
36121
  return applyTransformDom(cheerio3.load(html), html, config, framework);
36073
36122
  }
@@ -36118,6 +36167,7 @@ h1 {
36118
36167
  if ($el.children().length === 0 && /^[\s ]* [\s ]*$/.test($el.text())) $el.empty();
36119
36168
  });
36120
36169
  }
36170
+ if (config.autolinkEmails) autolinkEmails($, config.autolinkEmails);
36121
36171
  if (config.dropFormActions && $("form").length > 0) {
36122
36172
  warnings.push(makeWarning({
36123
36173
  severity: "error",
@@ -36613,6 +36663,9 @@ h1 {
36613
36663
  case "gmail-android":
36614
36664
  applyColorInversion($, "gmail-android", clientId);
36615
36665
  break;
36666
+ case "outlook-macos":
36667
+ applyColorInversion($, "outlook-macos", clientId);
36668
+ break;
36616
36669
  case "outlook-web":
36617
36670
  applyColorInversion($, "partial", clientId);
36618
36671
  if (!html.includes("prefers-color-scheme")) {
@@ -36720,12 +36773,21 @@ h1 {
36720
36773
  break;
36721
36774
  }
36722
36775
  const bodyStyle = ($("body").attr("style") || "").toLowerCase();
36776
+ const canvas = MEASURED_CANVAS[clientId];
36777
+ if (canvas) {
36778
+ if (!/background(-color)?\s*:/.test(bodyStyle) && !$("body").attr("bgcolor")) $("body").css("background-color", canvas.bg);
36779
+ if (!/(^|;)\s*color\s*:/.test(bodyStyle)) $("body").css("color", canvas.fg);
36780
+ return { html: $.html(), warnings };
36781
+ }
36723
36782
  if (!Object.values((_c = SAMPLED_DARK[clientId]) != null ? _c : {}).some((c) => bodyStyle.includes(c.slice(1)))) {
36724
36783
  $("body").css("background-color", "#1a1a1a");
36725
36784
  }
36726
36785
  $("body").css("color", "#e0e0e0");
36727
36786
  return { html: $.html(), warnings };
36728
36787
  }
36788
+ var MEASURED_CANVAS = {
36789
+ "outlook-macos": { bg: "#1e1e1e", fg: "#ffffff" }
36790
+ };
36729
36791
  var SAMPLED_DARK = {
36730
36792
  "outlook-web": { eeeae4: "#595651" },
36731
36793
  "gmail-ios": { eeeae4: "#4a4438" }
@@ -36746,20 +36808,41 @@ h1 {
36746
36808
  var dot = (m, v) => m[0] * v[0] + m[1] * v[1] + m[2] * v[2];
36747
36809
  var labF = (t) => t > 216 / 24389 ? Math.cbrt(t) : 841 / 108 * t + 4 / 29;
36748
36810
  var labFInv = (t) => t > 6 / 29 ? t ** 3 : 108 / 841 * (t - 4 / 29);
36749
- function flipLabLightness(c) {
36811
+ function withLabLightness(c, to, [white, toXyz, fromXyz] = [D50, TO_XYZ, FROM_XYZ]) {
36750
36812
  const linear = [c.r, c.g, c.b].map((v) => {
36751
36813
  const s = v / 255;
36752
36814
  return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
36753
36815
  });
36754
- const [fx, fy, fz] = TO_XYZ.map((row, i) => labF(dot(row, linear) / D50[i]));
36755
- const y = (Math.min(110 - (116 * fy - 16), 100) + 16) / 116;
36756
- const xyz = [fx - fy + y, y, y - (fy - fz)].map((t, i) => labFInv(t) * D50[i]);
36757
- const [r, g, b] = FROM_XYZ.map((row) => {
36816
+ const [fx, fy, fz] = toXyz.map((row, i) => labF(dot(row, linear) / white[i]));
36817
+ const y = (to(116 * fy - 16) + 16) / 116;
36818
+ const xyz = [fx - fy + y, y, y - (fy - fz)].map((t, i) => labFInv(t) * white[i]);
36819
+ const [r, g, b] = fromXyz.map((row) => {
36758
36820
  const v = Math.min(1, Math.max(0, dot(row, xyz)));
36759
36821
  return Math.round(255 * (v <= 31308e-7 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055));
36760
36822
  });
36761
36823
  return hex({ r, g, b });
36762
36824
  }
36825
+ var D65 = [
36826
+ [0.95047, 1, 1.08883],
36827
+ [
36828
+ [0.4124564, 0.3575761, 0.1804375],
36829
+ [0.2126729, 0.7151522, 0.072175],
36830
+ [0.0193339, 0.119192, 0.9503041]
36831
+ ],
36832
+ [
36833
+ [3.2404542, -1.5371385, -0.4985314],
36834
+ [-0.969266, 1.8760108, 0.041556],
36835
+ [0.0556434, -0.2040259, 1.0572252]
36836
+ ]
36837
+ ];
36838
+ var flipLabLightness = (c) => withLabLightness(c, (l) => Math.min(110 - l, 100));
36839
+ function outlookMacColor(value, role) {
36840
+ const c = parseColor(value);
36841
+ if (!c || c.a === 0) return null;
36842
+ if (role === "fg") return withLabLightness(c, (l) => Math.max(l, 100 - 0.772 * l), D65);
36843
+ if (c.r === c.g && c.g === c.b) return withLabLightness(c, (l) => Math.min(l, 88.5 - 0.772 * l), D65);
36844
+ return withLabLightness(c, () => 34.6, D65);
36845
+ }
36763
36846
  function gmailAndroidColor(value, role) {
36764
36847
  const parsed = parseColor(value);
36765
36848
  if (!parsed || parsed.a === 0) return null;
@@ -36771,6 +36854,7 @@ h1 {
36771
36854
  function invertColor(value, mode, clientId, role = "bg") {
36772
36855
  var _a2;
36773
36856
  if (mode === "gmail-android") return gmailAndroidColor(value, role);
36857
+ if (mode === "outlook-macos") return outlookMacColor(value, role);
36774
36858
  const pinned = clientId && ((_a2 = SAMPLED_DARK[clientId]) == null ? void 0 : _a2[value.trim().replace("#", "").toLowerCase()]);
36775
36859
  if (pinned) return pinned;
36776
36860
  const parsed = parseColor(value);
@@ -38844,7 +38928,7 @@ h1 {
38844
38928
  return `"${prop}"`;
38845
38929
  }
38846
38930
  function analyzeEmailFromDom($, framework, source, targetingPolicy = "progressive", rawHtml) {
38847
- var _a2, _b;
38931
+ var _a2, _b, _c;
38848
38932
  const warnings = [];
38849
38933
  const seenWarnings = /* @__PURE__ */ new Map();
38850
38934
  const targeting = emptyTargetingReport();
@@ -39295,6 +39379,26 @@ h1 {
39295
39379
  truncated: found.length > MAX_WARNING_LOCATIONS
39296
39380
  }) : {}));
39297
39381
  }
39382
+ const unloadable = $("img[src]").toArray().filter((el) => {
39383
+ var _a3;
39384
+ return isUnloadableImageSrc((_a3 = $(el).attr("src")) != null ? _a3 : "");
39385
+ });
39386
+ if (unloadable.length) {
39387
+ const found = unloadable.map((el) => locOfElement(el)).filter((l) => l !== void 0);
39388
+ const first = ((_c = $(unloadable[0]).attr("src")) != null ? _c : "").trim() || "an empty src";
39389
+ for (const client of EMAIL_CLIENTS2) {
39390
+ addWarning(__spreadValues({
39391
+ severity: "error",
39392
+ client: client.id,
39393
+ property: "<img src>",
39394
+ 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.`,
39395
+ suggestion: "Host the images and use full https:// addresses, such as https://cdn.example.com/logo.png."
39396
+ }, found.length ? occurrenceFields({
39397
+ locs: found.slice(0, MAX_WARNING_LOCATIONS),
39398
+ truncated: found.length > MAX_WARNING_LOCATIONS
39399
+ }) : {}));
39400
+ }
39401
+ }
39298
39402
  const severityOrder = { error: 0, warning: 1, info: 2 };
39299
39403
  warnings.sort((a, b) => severityOrder[a.severity] - severityOrder[b.severity]);
39300
39404
  return { warnings, targeting };
@@ -39561,6 +39665,14 @@ h1 {
39561
39665
  }
39562
39666
  }
39563
39667
  }
39668
+ function isUnloadableImageSrc(raw) {
39669
+ const src = raw.trim();
39670
+ if (!src) return true;
39671
+ if (/\{\{|\}\}|\*\||\|\*|%%|\[\[|\$\{|<%/.test(src)) return false;
39672
+ if (/^(https?:)?\/\//i.test(src)) return /^(https?:)?\/\/(localhost|127\.\d+\.\d+\.\d+|\[::1\])(?=[:/]|$)/i.test(src);
39673
+ if (/^(data|cid):/i.test(src)) return false;
39674
+ return true;
39675
+ }
39564
39676
  function generateCompatibilityScore2(warnings) {
39565
39677
  const result = {};
39566
39678
  for (const client of EMAIL_CLIENTS2) {
@@ -42973,7 +43085,7 @@ Href: ${href}`
42973
43085
  // package.json
42974
43086
  var package_default = {
42975
43087
  name: "@emailens/cli",
42976
- version: "0.13.10",
43088
+ version: "0.13.12",
42977
43089
  description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
42978
43090
  type: "module",
42979
43091
  bin: {
@@ -43014,7 +43126,7 @@ var package_default = {
43014
43126
  },
43015
43127
  devDependencies: {
43016
43128
  "@anthropic-ai/sdk": "^0.52.0",
43017
- "@emailens/engine": "^0.18.12",
43129
+ "@emailens/engine": "^0.18.14",
43018
43130
  "@types/bun": "^1.4.0",
43019
43131
  "@types/mjml": "^4.7.4",
43020
43132
  "@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-56SQXQSC.js";
8
+ } from "./chunk-3TDW4LHR.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.10",
3
+ "version": "0.13.12",
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.12",
44
+ "@emailens/engine": "^0.18.14",
45
45
  "@types/bun": "^1.4.0",
46
46
  "@types/mjml": "^4.7.4",
47
47
  "@types/node": "^25.9.5",