@emailens/cli 0.13.10 → 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.
- package/dist/{chunk-56SQXQSC.js → chunk-HJEE6UV2.js} +105 -8
- package/dist/index.js +108 -11
- package/dist/test.js +1 -1
- package/package.json +2 -2
|
@@ -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",
|
|
@@ -66020,6 +66030,30 @@ function dropTextDecorationShorthands($3) {
|
|
|
66020
66030
|
});
|
|
66021
66031
|
return dropped;
|
|
66022
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, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
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
|
+
}
|
|
66023
66057
|
function applyTransformDom($3, html3, config, framework) {
|
|
66024
66058
|
var _a22;
|
|
66025
66059
|
const warnings = [];
|
|
@@ -66067,6 +66101,7 @@ function applyTransformDom($3, html3, config, framework) {
|
|
|
66067
66101
|
if ($el.children().length === 0 && /^[\s ]* [\s ]*$/.test($el.text())) $el.empty();
|
|
66068
66102
|
});
|
|
66069
66103
|
}
|
|
66104
|
+
if (config.autolinkEmails) autolinkEmails($3, config.autolinkEmails);
|
|
66070
66105
|
if (config.dropFormActions && $3("form").length > 0) {
|
|
66071
66106
|
warnings.push(makeWarning({
|
|
66072
66107
|
severity: "error",
|
|
@@ -66525,6 +66560,9 @@ function simulateDarkMode(html3, clientId) {
|
|
|
66525
66560
|
case "gmail-android":
|
|
66526
66561
|
applyColorInversion($3, "gmail-android", clientId);
|
|
66527
66562
|
break;
|
|
66563
|
+
case "outlook-macos":
|
|
66564
|
+
applyColorInversion($3, "outlook-macos", clientId);
|
|
66565
|
+
break;
|
|
66528
66566
|
case "outlook-web":
|
|
66529
66567
|
applyColorInversion($3, "partial", clientId);
|
|
66530
66568
|
if (!html3.includes("prefers-color-scheme")) {
|
|
@@ -66632,12 +66670,21 @@ function simulateDarkMode(html3, clientId) {
|
|
|
66632
66670
|
break;
|
|
66633
66671
|
}
|
|
66634
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
|
+
}
|
|
66635
66679
|
if (!Object.values((_c2 = SAMPLED_DARK[clientId]) != null ? _c2 : {}).some((c2) => bodyStyle.includes(c2.slice(1)))) {
|
|
66636
66680
|
$3("body").css("background-color", "#1a1a1a");
|
|
66637
66681
|
}
|
|
66638
66682
|
$3("body").css("color", "#e0e0e0");
|
|
66639
66683
|
return { html: $3.html(), warnings };
|
|
66640
66684
|
}
|
|
66685
|
+
var MEASURED_CANVAS = {
|
|
66686
|
+
"outlook-macos": { bg: "#1e1e1e", fg: "#ffffff" }
|
|
66687
|
+
};
|
|
66641
66688
|
var SAMPLED_DARK = {
|
|
66642
66689
|
"outlook-web": { eeeae4: "#595651" },
|
|
66643
66690
|
"gmail-ios": { eeeae4: "#4a4438" }
|
|
@@ -66658,20 +66705,41 @@ var FROM_XYZ = [
|
|
|
66658
66705
|
var dot = (m2, v) => m2[0] * v[0] + m2[1] * v[1] + m2[2] * v[2];
|
|
66659
66706
|
var labF = (t2) => t2 > 216 / 24389 ? Math.cbrt(t2) : 841 / 108 * t2 + 4 / 29;
|
|
66660
66707
|
var labFInv = (t2) => t2 > 6 / 29 ? t2 ** 3 : 108 / 841 * (t2 - 4 / 29);
|
|
66661
|
-
function
|
|
66708
|
+
function withLabLightness(c2, to2, [white, toXyz, fromXyz] = [D50, TO_XYZ, FROM_XYZ]) {
|
|
66662
66709
|
const linear = [c2.r, c2.g, c2.b].map((v) => {
|
|
66663
66710
|
const s2 = v / 255;
|
|
66664
66711
|
return s2 <= 0.04045 ? s2 / 12.92 : ((s2 + 0.055) / 1.055) ** 2.4;
|
|
66665
66712
|
});
|
|
66666
|
-
const [fx, fy2, fz] =
|
|
66667
|
-
const y3 = (
|
|
66668
|
-
const xyz = [fx - fy2 + y3, y3, y3 - (fy2 - fz)].map((t2, i2) => labFInv(t2) *
|
|
66669
|
-
const [r2, g3, b2] =
|
|
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) => {
|
|
66670
66717
|
const v = Math.min(1, Math.max(0, dot(row, xyz)));
|
|
66671
66718
|
return Math.round(255 * (v <= 31308e-7 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055));
|
|
66672
66719
|
});
|
|
66673
66720
|
return hex({ r: r2, g: g3, b: b2 });
|
|
66674
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
|
+
}
|
|
66675
66743
|
function gmailAndroidColor(value, role) {
|
|
66676
66744
|
const parsed = parseColor(value);
|
|
66677
66745
|
if (!parsed || parsed.a === 0) return null;
|
|
@@ -66683,6 +66751,7 @@ function gmailAndroidColor(value, role) {
|
|
|
66683
66751
|
function invertColor(value, mode, clientId, role = "bg") {
|
|
66684
66752
|
var _a22;
|
|
66685
66753
|
if (mode === "gmail-android") return gmailAndroidColor(value, role);
|
|
66754
|
+
if (mode === "outlook-macos") return outlookMacColor(value, role);
|
|
66686
66755
|
const pinned = clientId && ((_a22 = SAMPLED_DARK[clientId]) == null ? void 0 : _a22[value.trim().replace("#", "").toLowerCase()]);
|
|
66687
66756
|
if (pinned) return pinned;
|
|
66688
66757
|
const parsed = parseColor(value);
|
|
@@ -68752,7 +68821,7 @@ function featureLabel(prop2) {
|
|
|
68752
68821
|
return `"${prop2}"`;
|
|
68753
68822
|
}
|
|
68754
68823
|
function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressive", rawHtml) {
|
|
68755
|
-
var _a22, _b;
|
|
68824
|
+
var _a22, _b, _c2;
|
|
68756
68825
|
const warnings = [];
|
|
68757
68826
|
const seenWarnings = /* @__PURE__ */ new Map();
|
|
68758
68827
|
const targeting = emptyTargetingReport();
|
|
@@ -69203,6 +69272,26 @@ function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressi
|
|
|
69203
69272
|
truncated: found.length > MAX_WARNING_LOCATIONS
|
|
69204
69273
|
}) : {}));
|
|
69205
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
|
+
}
|
|
69206
69295
|
const severityOrder = { error: 0, warning: 1, info: 2 };
|
|
69207
69296
|
warnings.sort((a2, b2) => severityOrder[a2.severity] - severityOrder[b2.severity]);
|
|
69208
69297
|
return { warnings, targeting };
|
|
@@ -69469,6 +69558,14 @@ function checkPropertySupport(prop2, addWarning, framework, selector, line, valu
|
|
|
69469
69558
|
}
|
|
69470
69559
|
}
|
|
69471
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
|
+
}
|
|
69472
69569
|
function generateCompatibilityScore(warnings) {
|
|
69473
69570
|
const result = {};
|
|
69474
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-
|
|
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",
|
|
@@ -36068,6 +36078,30 @@ h1 {
|
|
|
36068
36078
|
});
|
|
36069
36079
|
return dropped;
|
|
36070
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, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
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
|
+
}
|
|
36071
36105
|
function applyTransform(html, config, framework) {
|
|
36072
36106
|
return applyTransformDom(cheerio3.load(html), html, config, framework);
|
|
36073
36107
|
}
|
|
@@ -36118,6 +36152,7 @@ h1 {
|
|
|
36118
36152
|
if ($el.children().length === 0 && /^[\s ]* [\s ]*$/.test($el.text())) $el.empty();
|
|
36119
36153
|
});
|
|
36120
36154
|
}
|
|
36155
|
+
if (config.autolinkEmails) autolinkEmails($, config.autolinkEmails);
|
|
36121
36156
|
if (config.dropFormActions && $("form").length > 0) {
|
|
36122
36157
|
warnings.push(makeWarning({
|
|
36123
36158
|
severity: "error",
|
|
@@ -36613,6 +36648,9 @@ h1 {
|
|
|
36613
36648
|
case "gmail-android":
|
|
36614
36649
|
applyColorInversion($, "gmail-android", clientId);
|
|
36615
36650
|
break;
|
|
36651
|
+
case "outlook-macos":
|
|
36652
|
+
applyColorInversion($, "outlook-macos", clientId);
|
|
36653
|
+
break;
|
|
36616
36654
|
case "outlook-web":
|
|
36617
36655
|
applyColorInversion($, "partial", clientId);
|
|
36618
36656
|
if (!html.includes("prefers-color-scheme")) {
|
|
@@ -36720,12 +36758,21 @@ h1 {
|
|
|
36720
36758
|
break;
|
|
36721
36759
|
}
|
|
36722
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
|
+
}
|
|
36723
36767
|
if (!Object.values((_c = SAMPLED_DARK[clientId]) != null ? _c : {}).some((c) => bodyStyle.includes(c.slice(1)))) {
|
|
36724
36768
|
$("body").css("background-color", "#1a1a1a");
|
|
36725
36769
|
}
|
|
36726
36770
|
$("body").css("color", "#e0e0e0");
|
|
36727
36771
|
return { html: $.html(), warnings };
|
|
36728
36772
|
}
|
|
36773
|
+
var MEASURED_CANVAS = {
|
|
36774
|
+
"outlook-macos": { bg: "#1e1e1e", fg: "#ffffff" }
|
|
36775
|
+
};
|
|
36729
36776
|
var SAMPLED_DARK = {
|
|
36730
36777
|
"outlook-web": { eeeae4: "#595651" },
|
|
36731
36778
|
"gmail-ios": { eeeae4: "#4a4438" }
|
|
@@ -36746,20 +36793,41 @@ h1 {
|
|
|
36746
36793
|
var dot = (m, v) => m[0] * v[0] + m[1] * v[1] + m[2] * v[2];
|
|
36747
36794
|
var labF = (t) => t > 216 / 24389 ? Math.cbrt(t) : 841 / 108 * t + 4 / 29;
|
|
36748
36795
|
var labFInv = (t) => t > 6 / 29 ? t ** 3 : 108 / 841 * (t - 4 / 29);
|
|
36749
|
-
function
|
|
36796
|
+
function withLabLightness(c, to, [white, toXyz, fromXyz] = [D50, TO_XYZ, FROM_XYZ]) {
|
|
36750
36797
|
const linear = [c.r, c.g, c.b].map((v) => {
|
|
36751
36798
|
const s = v / 255;
|
|
36752
36799
|
return s <= 0.04045 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
|
36753
36800
|
});
|
|
36754
|
-
const [fx, fy, fz] =
|
|
36755
|
-
const y = (
|
|
36756
|
-
const xyz = [fx - fy + y, y, y - (fy - fz)].map((t, i) => labFInv(t) *
|
|
36757
|
-
const [r, g, b] =
|
|
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) => {
|
|
36758
36805
|
const v = Math.min(1, Math.max(0, dot(row, xyz)));
|
|
36759
36806
|
return Math.round(255 * (v <= 31308e-7 ? 12.92 * v : 1.055 * v ** (1 / 2.4) - 0.055));
|
|
36760
36807
|
});
|
|
36761
36808
|
return hex({ r, g, b });
|
|
36762
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
|
+
}
|
|
36763
36831
|
function gmailAndroidColor(value, role) {
|
|
36764
36832
|
const parsed = parseColor(value);
|
|
36765
36833
|
if (!parsed || parsed.a === 0) return null;
|
|
@@ -36771,6 +36839,7 @@ h1 {
|
|
|
36771
36839
|
function invertColor(value, mode, clientId, role = "bg") {
|
|
36772
36840
|
var _a2;
|
|
36773
36841
|
if (mode === "gmail-android") return gmailAndroidColor(value, role);
|
|
36842
|
+
if (mode === "outlook-macos") return outlookMacColor(value, role);
|
|
36774
36843
|
const pinned = clientId && ((_a2 = SAMPLED_DARK[clientId]) == null ? void 0 : _a2[value.trim().replace("#", "").toLowerCase()]);
|
|
36775
36844
|
if (pinned) return pinned;
|
|
36776
36845
|
const parsed = parseColor(value);
|
|
@@ -38844,7 +38913,7 @@ h1 {
|
|
|
38844
38913
|
return `"${prop}"`;
|
|
38845
38914
|
}
|
|
38846
38915
|
function analyzeEmailFromDom($, framework, source, targetingPolicy = "progressive", rawHtml) {
|
|
38847
|
-
var _a2, _b;
|
|
38916
|
+
var _a2, _b, _c;
|
|
38848
38917
|
const warnings = [];
|
|
38849
38918
|
const seenWarnings = /* @__PURE__ */ new Map();
|
|
38850
38919
|
const targeting = emptyTargetingReport();
|
|
@@ -39295,6 +39364,26 @@ h1 {
|
|
|
39295
39364
|
truncated: found.length > MAX_WARNING_LOCATIONS
|
|
39296
39365
|
}) : {}));
|
|
39297
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
|
+
}
|
|
39298
39387
|
const severityOrder = { error: 0, warning: 1, info: 2 };
|
|
39299
39388
|
warnings.sort((a, b) => severityOrder[a.severity] - severityOrder[b.severity]);
|
|
39300
39389
|
return { warnings, targeting };
|
|
@@ -39561,6 +39650,14 @@ h1 {
|
|
|
39561
39650
|
}
|
|
39562
39651
|
}
|
|
39563
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
|
+
}
|
|
39564
39661
|
function generateCompatibilityScore2(warnings) {
|
|
39565
39662
|
const result = {};
|
|
39566
39663
|
for (const client of EMAIL_CLIENTS2) {
|
|
@@ -42973,7 +43070,7 @@ Href: ${href}`
|
|
|
42973
43070
|
// package.json
|
|
42974
43071
|
var package_default = {
|
|
42975
43072
|
name: "@emailens/cli",
|
|
42976
|
-
version: "0.13.
|
|
43073
|
+
version: "0.13.11",
|
|
42977
43074
|
description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
|
|
42978
43075
|
type: "module",
|
|
42979
43076
|
bin: {
|
|
@@ -43014,7 +43111,7 @@ var package_default = {
|
|
|
43014
43111
|
},
|
|
43015
43112
|
devDependencies: {
|
|
43016
43113
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
43017
|
-
"@emailens/engine": "^0.18.
|
|
43114
|
+
"@emailens/engine": "^0.18.13",
|
|
43018
43115
|
"@types/bun": "^1.4.0",
|
|
43019
43116
|
"@types/mjml": "^4.7.4",
|
|
43020
43117
|
"@types/node": "^25.9.5",
|
package/dist/test.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emailens/cli",
|
|
3
|
-
"version": "0.13.
|
|
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.
|
|
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",
|