@emailens/cli 0.13.16 → 0.13.19
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/README.md +207 -188
- package/dist/{chunk-FFVMVESX.js → chunk-J4YQYM4C.js} +703 -226
- package/dist/{chunk-ABDTBRVK.js → chunk-UN26YQF6.js} +6 -5
- package/dist/index.js +483 -156
- package/dist/{react-email-4EWH2SB4-CUKHMPBB.js → react-email-QQA75STN-LT3O7SQP.js} +1 -1
- package/dist/test.js +2 -2
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ const require = __cr(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
AI_FIX_SYSTEM_PROMPT,
|
|
6
6
|
EMAIL_CLIENTS,
|
|
7
|
+
EMAIL_DIRS,
|
|
7
8
|
TARGETING_POLICY_ARG,
|
|
8
9
|
analyzeEmail,
|
|
9
10
|
auditEmail,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
defineCommand,
|
|
13
14
|
es_exports,
|
|
14
15
|
estimateAiFixTokens,
|
|
16
|
+
findEmailsDir,
|
|
15
17
|
generateAiFix,
|
|
16
18
|
generateCompatibilityScore,
|
|
17
19
|
init_csstree_esm,
|
|
@@ -32,8 +34,8 @@ import {
|
|
|
32
34
|
simulateDarkMode,
|
|
33
35
|
toFramework,
|
|
34
36
|
transformForAllClients
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-J4YQYM4C.js";
|
|
38
|
+
import "./chunk-UN26YQF6.js";
|
|
37
39
|
import "./chunk-2AP7CT6R.js";
|
|
38
40
|
import "./chunk-NXBRJX3V.js";
|
|
39
41
|
import {
|
|
@@ -20844,7 +20846,7 @@ var require_commonjs3 = __commonJS({
|
|
|
20844
20846
|
path: urlObject.pathname + urlObject.search,
|
|
20845
20847
|
...requestOptions
|
|
20846
20848
|
};
|
|
20847
|
-
const promise = new Promise((
|
|
20849
|
+
const promise = new Promise((resolve3, reject) => {
|
|
20848
20850
|
undiciStream = new undici.Client(urlObject.origin).compose(undici.interceptors.redirect({ maxRedirections: 5 })).stream(streamOptions, (res) => {
|
|
20849
20851
|
var _a, _b;
|
|
20850
20852
|
if (res.statusCode < 200 || res.statusCode >= 300) {
|
|
@@ -20867,7 +20869,7 @@ var require_commonjs3 = __commonJS({
|
|
|
20867
20869
|
baseURI,
|
|
20868
20870
|
...cheerioOptions
|
|
20869
20871
|
};
|
|
20870
|
-
return decodeStream(opts, (err, $) => err ? reject(err) :
|
|
20872
|
+
return decodeStream(opts, (err, $) => err ? reject(err) : resolve3($));
|
|
20871
20873
|
});
|
|
20872
20874
|
});
|
|
20873
20875
|
await undiciStream;
|
|
@@ -23451,7 +23453,7 @@ var require_dist = __commonJS({
|
|
|
23451
23453
|
"outlook-macos": "supported",
|
|
23452
23454
|
"apple-mail-macos": "supported",
|
|
23453
23455
|
"apple-mail-ios": "supported",
|
|
23454
|
-
"yahoo-mail": "
|
|
23456
|
+
"yahoo-mail": "partial",
|
|
23455
23457
|
"yahoo-mail-android": "supported",
|
|
23456
23458
|
"yahoo-mail-ios": "supported",
|
|
23457
23459
|
"samsung-mail": "supported",
|
|
@@ -26414,12 +26416,12 @@ var require_dist = __commonJS({
|
|
|
26414
26416
|
"outlook-windows": "unsupported",
|
|
26415
26417
|
"outlook-windows-legacy": "unsupported",
|
|
26416
26418
|
"outlook-ios": "unsupported",
|
|
26417
|
-
"outlook-android": "
|
|
26419
|
+
"outlook-android": "supported",
|
|
26418
26420
|
"outlook-macos": "unsupported",
|
|
26419
26421
|
"apple-mail-macos": "supported",
|
|
26420
26422
|
"apple-mail-ios": "supported",
|
|
26421
|
-
"yahoo-mail": "
|
|
26422
|
-
"yahoo-mail-android": "
|
|
26423
|
+
"yahoo-mail": "unsupported",
|
|
26424
|
+
"yahoo-mail-android": "unsupported",
|
|
26423
26425
|
"yahoo-mail-ios": "supported",
|
|
26424
26426
|
"samsung-mail": "supported",
|
|
26425
26427
|
"thunderbird": "supported",
|
|
@@ -27012,12 +27014,12 @@ var require_dist = __commonJS({
|
|
|
27012
27014
|
"outlook-windows": "supported",
|
|
27013
27015
|
"outlook-windows-legacy": "unsupported",
|
|
27014
27016
|
"outlook-ios": "supported",
|
|
27015
|
-
"outlook-android": "
|
|
27017
|
+
"outlook-android": "unsupported",
|
|
27016
27018
|
"outlook-macos": "supported",
|
|
27017
27019
|
"apple-mail-macos": "supported",
|
|
27018
27020
|
"apple-mail-ios": "supported",
|
|
27019
|
-
"yahoo-mail": "
|
|
27020
|
-
"yahoo-mail-android": "
|
|
27021
|
+
"yahoo-mail": "unsupported",
|
|
27022
|
+
"yahoo-mail-android": "unsupported",
|
|
27021
27023
|
"yahoo-mail-ios": "supported",
|
|
27022
27024
|
"samsung-mail": "supported",
|
|
27023
27025
|
"thunderbird": "supported",
|
|
@@ -28535,7 +28537,7 @@ var require_dist = __commonJS({
|
|
|
28535
28537
|
"gmail-android": ["Partial. Not supported with non Google accounts. But it can be used in the `background` shorthand property instead."],
|
|
28536
28538
|
"gmail-ios": ["Partial. Not supported with non Google accounts. But it can be used in the `background` shorthand property instead."],
|
|
28537
28539
|
"outlook-windows-legacy": ["Background images size can be used in VML with the `size` attribute. See [VML documentation](https://docs.microsoft.com/en-us/windows/win32/vml/size-attribute--fill--vml)."],
|
|
28538
|
-
"yahoo-mail": ["Partial.
|
|
28540
|
+
"yahoo-mail": ["Observed 2026-11-09 (Emailens real-device checks, Yahoo Mail web (Chrome): foodpanda campaign (2026-10-28), AliExpress (2026-11-09)): Partial. Ignored inside the background shorthand (`background: url() 0 0 / cover`): the image draws at its natural size. The background-size property written on its own works."],
|
|
28539
28541
|
"yahoo-mail-android": ["Partial. Does not support multiple values. The comma between two values is removed."],
|
|
28540
28542
|
"yahoo-mail-ios": ["Partial. Does not support multiple values. The comma between two values is removed."],
|
|
28541
28543
|
"aol": ["Partial. Does not support multiple values. The comma between two values is removed."]
|
|
@@ -29017,7 +29019,10 @@ var require_dist = __commonJS({
|
|
|
29017
29019
|
"gmail-ios": ["Partial. Not supported with non Google accounts."]
|
|
29018
29020
|
},
|
|
29019
29021
|
"text-shadow": {
|
|
29020
|
-
"outlook-web": ["Observed 2026-10-14 (Emailens real-device probe, Outlook.com (Chrome)): A red text-shadow rendered behind bold text."]
|
|
29022
|
+
"outlook-web": ["Observed 2026-10-14 (Emailens real-device probe, Outlook.com (Chrome)): A red text-shadow rendered behind bold text."],
|
|
29023
|
+
"outlook-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Outlook Android app, our own seed inbox): A green text-shadow drew behind the text."],
|
|
29024
|
+
"yahoo-mail": ["Observed 2026-11-08 (Emailens probe sheets 20-22, Yahoo Mail web (Chrome), our own seed inbox): A green text-shadow did not draw; the text rendered plain."],
|
|
29025
|
+
"yahoo-mail-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Yahoo Mail Android app, our own seed inbox): A green text-shadow did not draw; the text rendered plain."]
|
|
29021
29026
|
},
|
|
29022
29027
|
"text-transform": {
|
|
29023
29028
|
"outlook-windows-legacy": ["Partial. `lowercase` value is not supported."]
|
|
@@ -29071,9 +29076,12 @@ var require_dist = __commonJS({
|
|
|
29071
29076
|
},
|
|
29072
29077
|
"visibility": {
|
|
29073
29078
|
"outlook-ios": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
|
|
29079
|
+
"outlook-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Outlook Android app, our own seed inbox): An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."],
|
|
29074
29080
|
"outlook-macos": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
|
|
29075
29081
|
"apple-mail-macos": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
|
|
29076
29082
|
"apple-mail-ios": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
|
|
29083
|
+
"yahoo-mail": ["Observed 2026-11-08 (Emailens probe sheets 20-22, Yahoo Mail web (Chrome), our own seed inbox): An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."],
|
|
29084
|
+
"yahoo-mail-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Yahoo Mail Android app, our own seed inbox): An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."],
|
|
29077
29085
|
"yahoo-mail-ios": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
|
|
29078
29086
|
"protonmail": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.']
|
|
29079
29087
|
},
|
|
@@ -33699,6 +33707,13 @@ h1 {
|
|
|
33699
33707
|
(whole, n) => Number(n) > MAX_BORDER_PX ? `${MAX_BORDER_PX}px` : whole
|
|
33700
33708
|
);
|
|
33701
33709
|
var flattenMargin = (value) => value.split(/\s+/).map((part) => part === "auto" || /^-/.test(part) ? "0" : part).join(" ");
|
|
33710
|
+
var flattenDivMargin = (prop, value) => {
|
|
33711
|
+
if (prop === "margin-left" || prop === "margin-right") return value.trim() === "auto" ? "0" : value;
|
|
33712
|
+
if (prop !== "margin") return flattenMargin(value);
|
|
33713
|
+
const parts = value.trim().split(/\s+/);
|
|
33714
|
+
const vertical = (i) => i === 0 || i === 2 && parts.length >= 3;
|
|
33715
|
+
return parts.map((part, i) => part === "auto" || /^-/.test(part) && vertical(i) ? "0" : part).join(" ");
|
|
33716
|
+
};
|
|
33702
33717
|
function holdsNoText($, el) {
|
|
33703
33718
|
const own = $(el).clone();
|
|
33704
33719
|
own.find("table").remove();
|
|
@@ -33981,7 +33996,7 @@ h1 {
|
|
|
33981
33996
|
if (tag === "div" || tag === "table") {
|
|
33982
33997
|
for (const prop of MARGIN) {
|
|
33983
33998
|
const value = props.get(prop);
|
|
33984
|
-
if (value !== void 0) props.set(prop, flattenMargin(value));
|
|
33999
|
+
if (value !== void 0) props.set(prop, tag === "div" ? flattenDivMargin(prop, value) : flattenMargin(value));
|
|
33985
34000
|
}
|
|
33986
34001
|
if (tag === "table" && /center/i.test((_f = $(el).attr("align")) != null ? _f : "")) {
|
|
33987
34002
|
props.delete("margin-top");
|
|
@@ -35084,7 +35099,7 @@ h1 {
|
|
|
35084
35099
|
"notes": ""
|
|
35085
35100
|
}
|
|
35086
35101
|
];
|
|
35087
|
-
var GMAIL_WRAPPER_SELECTOR = /(?:^|[\s>~+(])u\s*\+\s*([.#][\w-]+)/i;
|
|
35102
|
+
var GMAIL_WRAPPER_SELECTOR = /(?:^|[\s>~+(,{}])u\s*\+\s*([.#][\w-]+)/i;
|
|
35088
35103
|
var TARGETING_MATCHERS = [
|
|
35089
35104
|
{
|
|
35090
35105
|
id: "gmail-android-div-u-body",
|
|
@@ -35531,6 +35546,160 @@ h1 {
|
|
|
35531
35546
|
function getWorkingTargetingHacks() {
|
|
35532
35547
|
return TARGETING_HACKS.filter((h) => h.status === "working");
|
|
35533
35548
|
}
|
|
35549
|
+
var RUN = "2026-10-14";
|
|
35550
|
+
var seen = (level, source, note) => ({
|
|
35551
|
+
level,
|
|
35552
|
+
observed: RUN,
|
|
35553
|
+
source,
|
|
35554
|
+
note
|
|
35555
|
+
});
|
|
35556
|
+
var newOutlookMac = (level, note) => ({
|
|
35557
|
+
level,
|
|
35558
|
+
observed: "2026-10-27",
|
|
35559
|
+
source: "Emailens probe sheets 20-22, the new Outlook for Mac",
|
|
35560
|
+
note
|
|
35561
|
+
});
|
|
35562
|
+
var yahooWeb = (level, note) => ({
|
|
35563
|
+
level,
|
|
35564
|
+
observed: "2026-10-27",
|
|
35565
|
+
source: "Emailens probe, Yahoo Mail web (Chrome), real-device run E8fVpFwwLtL8",
|
|
35566
|
+
note
|
|
35567
|
+
});
|
|
35568
|
+
var gmailWeb = (level, note) => ({
|
|
35569
|
+
level,
|
|
35570
|
+
observed: "2026-10-28",
|
|
35571
|
+
source: "Emailens probe, Gmail web (Chrome), real-device run 1isFNBBaOyEo",
|
|
35572
|
+
note
|
|
35573
|
+
});
|
|
35574
|
+
var worker = (level, source, note) => ({
|
|
35575
|
+
level,
|
|
35576
|
+
observed: "2026-11-08",
|
|
35577
|
+
source: `Emailens probe sheets 20-22, ${source}, our own seed inbox`,
|
|
35578
|
+
note
|
|
35579
|
+
});
|
|
35580
|
+
var OBSERVED_OVERRIDES = {
|
|
35581
|
+
// Email Geeks #email-code, 2026-10-29: "Yahoo strips action and formaction".
|
|
35582
|
+
// Six forms sent to our Yahoo seed; the delivered HTML had neither.
|
|
35583
|
+
"<form>": {
|
|
35584
|
+
"yahoo-mail": {
|
|
35585
|
+
level: "unsupported",
|
|
35586
|
+
observed: "2026-10-29",
|
|
35587
|
+
source: "Emailens probe, Yahoo Mail web (Chrome), our own seed inbox",
|
|
35588
|
+
note: 'The form is kept but its `action` is removed (absolute, relative and empty alike), and so is `formaction` on a button; Yahoo adds `target="_blank"`. The form cannot reach your server: link to a landing page instead. `type="email"` is also dropped from inputs; `method`, text, radio and submit inputs are kept.'
|
|
35589
|
+
}
|
|
35590
|
+
},
|
|
35591
|
+
// display:flex holds and so does width; the item sizing does not. A label
|
|
35592
|
+
// column at `flex:0 0 34%` beside a paragraph collapsed to a letter wide.
|
|
35593
|
+
flex: {
|
|
35594
|
+
"yahoo-mail": yahooWeb(
|
|
35595
|
+
"unsupported",
|
|
35596
|
+
"The `flex` shorthand is dropped: an item at `flex:0 0 34%` shrank to its narrowest, breaking words letter by letter. Size flex items with `width` (and `flex-shrink:0`), or use a table."
|
|
35597
|
+
),
|
|
35598
|
+
"gmail-web": gmailWeb(
|
|
35599
|
+
"unsupported",
|
|
35600
|
+
"The `flex` shorthand is dropped: an item at `flex:0 0 34%` lost its 34% and sized to its content. `width:34%` on the same item held, and so did a table."
|
|
35601
|
+
)
|
|
35602
|
+
},
|
|
35603
|
+
"flex-basis": {
|
|
35604
|
+
"yahoo-mail": yahooWeb(
|
|
35605
|
+
"unsupported",
|
|
35606
|
+
"Dropped, with flex-grow and flex-shrink beside it: the item sized to its content instead of 34%. `width:34%` on the same item held."
|
|
35607
|
+
),
|
|
35608
|
+
"gmail-web": gmailWeb(
|
|
35609
|
+
"unsupported",
|
|
35610
|
+
"Dropped, with flex-grow and flex-shrink beside it: the item sized to its content instead of 34%. `width:34%` on the same item held."
|
|
35611
|
+
)
|
|
35612
|
+
},
|
|
35613
|
+
// caniemail 16.80 says not supported; plain track lists are kept and the
|
|
35614
|
+
// functions dropped, twice over two runs.
|
|
35615
|
+
"grid-template-columns": {
|
|
35616
|
+
"outlook-macos": newOutlookMac(
|
|
35617
|
+
"partial",
|
|
35618
|
+
"Plain track sizes work (`300px 300px`, `1fr 1fr`); a value with `repeat()` or `minmax()` is dropped, so the grid falls back to one column."
|
|
35619
|
+
)
|
|
35620
|
+
},
|
|
35621
|
+
// Sheet 20 case 30: an orange block at visibility:hidden over a green cell
|
|
35622
|
+
// stayed orange. Gmail web, on the same sheet, hid it.
|
|
35623
|
+
visibility: {
|
|
35624
|
+
"yahoo-mail": worker(
|
|
35625
|
+
"unsupported",
|
|
35626
|
+
"Yahoo Mail web (Chrome)",
|
|
35627
|
+
"An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."
|
|
35628
|
+
),
|
|
35629
|
+
"yahoo-mail-android": worker(
|
|
35630
|
+
"unsupported",
|
|
35631
|
+
"the Yahoo Mail Android app",
|
|
35632
|
+
"An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."
|
|
35633
|
+
),
|
|
35634
|
+
"outlook-android": worker(
|
|
35635
|
+
"unsupported",
|
|
35636
|
+
"the Outlook Android app",
|
|
35637
|
+
"An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."
|
|
35638
|
+
)
|
|
35639
|
+
},
|
|
35640
|
+
"box-shadow": {
|
|
35641
|
+
"yahoo-mail": seen(
|
|
35642
|
+
"supported",
|
|
35643
|
+
"Emailens real-device probe, Yahoo Mail (Chrome)",
|
|
35644
|
+
"A box-shadow on a table cell rendered with its offset and colour."
|
|
35645
|
+
)
|
|
35646
|
+
},
|
|
35647
|
+
// Sheet 22 case 13: a green text-shadow drew in Gmail and Outlook Android,
|
|
35648
|
+
// not in either Yahoo.
|
|
35649
|
+
"text-shadow": {
|
|
35650
|
+
"yahoo-mail": worker(
|
|
35651
|
+
"unsupported",
|
|
35652
|
+
"Yahoo Mail web (Chrome)",
|
|
35653
|
+
"A green text-shadow did not draw; the text rendered plain."
|
|
35654
|
+
),
|
|
35655
|
+
"yahoo-mail-android": worker(
|
|
35656
|
+
"unsupported",
|
|
35657
|
+
"the Yahoo Mail Android app",
|
|
35658
|
+
"A green text-shadow did not draw; the text rendered plain."
|
|
35659
|
+
),
|
|
35660
|
+
"outlook-web": seen(
|
|
35661
|
+
"supported",
|
|
35662
|
+
"Emailens real-device probe, Outlook.com (Chrome)",
|
|
35663
|
+
"A red text-shadow rendered behind bold text."
|
|
35664
|
+
),
|
|
35665
|
+
"outlook-android": worker(
|
|
35666
|
+
"supported",
|
|
35667
|
+
"the Outlook Android app",
|
|
35668
|
+
"A green text-shadow drew behind the text."
|
|
35669
|
+
)
|
|
35670
|
+
},
|
|
35671
|
+
// foodpanda's logos and coupon on real Yahoo Mail web (2026-10-28): drawn
|
|
35672
|
+
// at their natural size, the size written inside the `background` shorthand
|
|
35673
|
+
// ignored (yahoo-background-size.test.ts). Written on its own it holds:
|
|
35674
|
+
// AliExpress's 29 product photos drew fitted (fidelity bench, 2026-11-09).
|
|
35675
|
+
"background-size": {
|
|
35676
|
+
"yahoo-mail": {
|
|
35677
|
+
level: "partial",
|
|
35678
|
+
observed: "2026-11-09",
|
|
35679
|
+
source: "Emailens real-device checks, Yahoo Mail web (Chrome): foodpanda campaign (2026-10-28), AliExpress (2026-11-09)",
|
|
35680
|
+
note: "Partial. Ignored inside the background shorthand (`background: url() 0 0 / cover`): the image draws at its natural size. The background-size property written on its own works."
|
|
35681
|
+
}
|
|
35682
|
+
},
|
|
35683
|
+
"text-decoration": {
|
|
35684
|
+
"apple-mail-macos": seen(
|
|
35685
|
+
"partial",
|
|
35686
|
+
"Emailens real-device probe, Apple Mail (macOS)",
|
|
35687
|
+
"The multi-value shorthand `text-decoration: underline wavy #d33` was dropped whole: no line at all. A single line value works; style and colour need -webkit-text-decoration."
|
|
35688
|
+
),
|
|
35689
|
+
"apple-mail-ios": seen(
|
|
35690
|
+
"partial",
|
|
35691
|
+
"Emailens real-device probe, Apple Mail (iPhone 13)",
|
|
35692
|
+
"The multi-value shorthand `text-decoration: underline wavy #d33` was dropped whole: no line at all. A single line value works; style and colour need -webkit-text-decoration."
|
|
35693
|
+
),
|
|
35694
|
+
"outlook-macos": seen(
|
|
35695
|
+
"partial",
|
|
35696
|
+
// The legacy app (Outlook 2019 for Mac). Not yet re-checked on the new
|
|
35697
|
+
// Outlook for Mac, which the outlook-macos column now describes.
|
|
35698
|
+
"Emailens real-device probe, Outlook 2019 for Mac (legacy app)",
|
|
35699
|
+
"The multi-value shorthand `text-decoration: underline wavy #d33` was dropped whole: no line at all. A single line value works; style and colour need -webkit-text-decoration."
|
|
35700
|
+
)
|
|
35701
|
+
}
|
|
35702
|
+
};
|
|
35534
35703
|
function isWordEngineClient(clientId) {
|
|
35535
35704
|
return clientId === "outlook-windows-legacy";
|
|
35536
35705
|
}
|
|
@@ -35573,14 +35742,35 @@ h1 {
|
|
|
35573
35742
|
}
|
|
35574
35743
|
return serializeStyle(out);
|
|
35575
35744
|
}
|
|
35576
|
-
function
|
|
35745
|
+
function sameProperty(a, b) {
|
|
35746
|
+
const props = (d) => d.split(";").map((p) => p.split(":")[0].trim().toLowerCase());
|
|
35747
|
+
const mine = new Set(props(b));
|
|
35748
|
+
return props(a).some((p) => p && mine.has(p));
|
|
35749
|
+
}
|
|
35750
|
+
function linkRule(color) {
|
|
35751
|
+
return { selector: 'a[href]:not([href="mailto:"])', weight: 100.5, declText: `color: ${color}`, client: true };
|
|
35752
|
+
}
|
|
35753
|
+
function specificity2(selector) {
|
|
35754
|
+
let ids = 0;
|
|
35755
|
+
let classes = 0;
|
|
35756
|
+
let types = 0;
|
|
35757
|
+
csstree3.walk(selector, (node) => {
|
|
35758
|
+
if (node.type === "IdSelector") ids++;
|
|
35759
|
+
else if (node.type === "ClassSelector" || node.type === "AttributeSelector") classes++;
|
|
35760
|
+
else if (node.type === "TypeSelector" && node.name !== "*") types++;
|
|
35761
|
+
});
|
|
35762
|
+
return ids * 1e4 + classes * 100 + types;
|
|
35763
|
+
}
|
|
35764
|
+
function inlineStyles($, keepFontFace = true, clientRules = []) {
|
|
35577
35765
|
const styleBlocks = [];
|
|
35578
35766
|
$("style").each((_, el) => {
|
|
35579
35767
|
styleBlocks.push($(el).text());
|
|
35580
35768
|
});
|
|
35581
|
-
if (styleBlocks.length === 0) return "";
|
|
35769
|
+
if (styleBlocks.length === 0 && clientRules.length === 0) return "";
|
|
35582
35770
|
const preserved = [];
|
|
35583
35771
|
const inlined = /* @__PURE__ */ new WeakMap();
|
|
35772
|
+
const rules = [...clientRules];
|
|
35773
|
+
const kept = [];
|
|
35584
35774
|
for (const block of styleBlocks) {
|
|
35585
35775
|
let ast;
|
|
35586
35776
|
try {
|
|
@@ -35618,22 +35808,33 @@ h1 {
|
|
|
35618
35808
|
const isClientTargeting = shouldPreserveSelector(selectorText);
|
|
35619
35809
|
if (hasPseudoSelector(selectorText) || isClientTargeting) {
|
|
35620
35810
|
preserved.push(csstree3.generate(node));
|
|
35811
|
+
if (!hasPseudoSelector(selectorText))
|
|
35812
|
+
node.prelude.children.forEach((selector) => {
|
|
35813
|
+
kept.push({ selector: csstree3.generate(selector), weight: specificity2(selector), declText });
|
|
35814
|
+
});
|
|
35621
35815
|
return;
|
|
35622
35816
|
}
|
|
35623
|
-
|
|
35624
|
-
|
|
35625
|
-
|
|
35626
|
-
if (!state) {
|
|
35627
|
-
state = { author: cascade(/* @__PURE__ */ new Map(), $(el).attr("style") || ""), sheet: /* @__PURE__ */ new Map() };
|
|
35628
|
-
inlined.set(el, state);
|
|
35629
|
-
}
|
|
35630
|
-
$(el).attr("style", mergeInline(state, declText));
|
|
35631
|
-
});
|
|
35632
|
-
} catch (e) {
|
|
35633
|
-
}
|
|
35817
|
+
node.prelude.children.forEach((selector) => {
|
|
35818
|
+
rules.push({ selector: csstree3.generate(selector), weight: specificity2(selector), declText });
|
|
35819
|
+
});
|
|
35634
35820
|
}
|
|
35635
35821
|
});
|
|
35636
35822
|
}
|
|
35823
|
+
for (const { selector, declText, weight, client } of rules.sort((a, b) => a.weight - b.weight)) {
|
|
35824
|
+
try {
|
|
35825
|
+
$(selector).each((_, el) => {
|
|
35826
|
+
if (client && kept.some((k) => k.weight > weight && sameProperty(k.declText, declText) && $(el).is(k.selector)))
|
|
35827
|
+
return;
|
|
35828
|
+
let state = inlined.get(el);
|
|
35829
|
+
if (!state) {
|
|
35830
|
+
state = { author: cascade(/* @__PURE__ */ new Map(), $(el).attr("style") || ""), sheet: /* @__PURE__ */ new Map() };
|
|
35831
|
+
inlined.set(el, state);
|
|
35832
|
+
}
|
|
35833
|
+
$(el).attr("style", mergeInline(state, declText));
|
|
35834
|
+
});
|
|
35835
|
+
} catch (e) {
|
|
35836
|
+
}
|
|
35837
|
+
}
|
|
35637
35838
|
return preserved.join("\n");
|
|
35638
35839
|
}
|
|
35639
35840
|
function makeWarning(base, prop, clientId, framework) {
|
|
@@ -35842,9 +36043,10 @@ h1 {
|
|
|
35842
36043
|
}
|
|
35843
36044
|
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
35844
36045
|
var OUTLOOK_WEB_STRIPPED = /* @__PURE__ */ new Set(["position", "transform", "animation", "transition"]);
|
|
35845
|
-
var YAHOO_STRIPPED = /* @__PURE__ */ new Set(["position", "box-shadow", "transform", "animation", "transition"
|
|
36046
|
+
var YAHOO_STRIPPED = /* @__PURE__ */ new Set(["position", "box-shadow", "transform", "animation", "transition"]);
|
|
36047
|
+
var YAHOO_IOS_STRIPPED = /* @__PURE__ */ new Set([...YAHOO_STRIPPED, "opacity"]);
|
|
35846
36048
|
var YAHOO_WEB_STRIPPED = /* @__PURE__ */ new Set([
|
|
35847
|
-
...
|
|
36049
|
+
...YAHOO_STRIPPED,
|
|
35848
36050
|
"flex",
|
|
35849
36051
|
"flex-basis",
|
|
35850
36052
|
// A width:100% + padding + border-box CTA came out 566px in a 534px column
|
|
@@ -35855,6 +36057,9 @@ h1 {
|
|
|
35855
36057
|
var CLIENT_CONFIGS = {
|
|
35856
36058
|
"gmail-web": {
|
|
35857
36059
|
id: "gmail-web",
|
|
36060
|
+
// 324 of 458 links with no inline colour came out #15c in real Gmail web
|
|
36061
|
+
// (emailens fidelity bench, 2026-11-09); its weight: see linkRule().
|
|
36062
|
+
linkColor: "#15c",
|
|
35858
36063
|
// caniemail's set. A 2026-10-14 render said Gmail web kept box-shadow,
|
|
35859
36064
|
// text-shadow, visibility, animation, gap and grid; caniemail's own tests in
|
|
35860
36065
|
// real Gmail web (Chrome and Firefox, 2026-10-24) did not, and the <style>
|
|
@@ -35912,8 +36117,15 @@ h1 {
|
|
|
35912
36117
|
strippedProperties: OUTLOOK_WEB_STRIPPED,
|
|
35913
36118
|
stripMode: "strip",
|
|
35914
36119
|
stripStyleAnimations: true,
|
|
36120
|
+
// No web font, as on Mac: postmark~welcome's @import of Nunito Sans drew
|
|
36121
|
+
// Arial on the worker's new Outlook (bench 2026-11-09); caniemail agrees.
|
|
36122
|
+
dropAtRules: /^@font-face\b|^@import\b/i,
|
|
36123
|
+
// @media reads the window, not the reading pane: of 27 emails with a
|
|
36124
|
+
// max-width query firing at 620, the worker's new Outlook drew none
|
|
36125
|
+
// mobile (bench 2026-11-09). 766 is that read window, 957 px at 125%.
|
|
36126
|
+
mediaWidth: 766,
|
|
35915
36127
|
inlineAndStripStyles: false,
|
|
35916
|
-
stripExternalStylesheets:
|
|
36128
|
+
stripExternalStylesheets: true,
|
|
35917
36129
|
stripForms: false,
|
|
35918
36130
|
stripSvg: false
|
|
35919
36131
|
},
|
|
@@ -35930,6 +36142,13 @@ h1 {
|
|
|
35930
36142
|
{ prop: "background", pattern: /linear-gradient|radial-gradient|url\(/ },
|
|
35931
36143
|
{ prop: "background-image", pattern: /linear-gradient|radial-gradient|url\(/ }
|
|
35932
36144
|
],
|
|
36145
|
+
// The same in <style> blocks: a `.mh-cta{background-image:radial-gradient}`
|
|
36146
|
+
// rule drew a magenta box in the sim where real Outlook Classic drew no
|
|
36147
|
+
// fill (real-device capture of preview J9vFS4nm_LGl, 2026-11-06).
|
|
36148
|
+
// ponytail: background-image only; a `background:` shorthand in <style>
|
|
36149
|
+
// still draws (it may carry the fallback colour Word keeps). Split it like
|
|
36150
|
+
// backgroundShorthandColor when a capture shows one.
|
|
36151
|
+
dropValues: /^background-image:.*(?:linear-gradient|radial-gradient|url)\(/,
|
|
35933
36152
|
inlineAndStripStyles: false,
|
|
35934
36153
|
stripExternalStylesheets: false,
|
|
35935
36154
|
stripForms: false,
|
|
@@ -36049,7 +36268,9 @@ h1 {
|
|
|
36049
36268
|
dropValues: /radial-gradient\(/i,
|
|
36050
36269
|
// Real Yahoo web drew foodpanda's `url(...) center / cover` logos at their
|
|
36051
36270
|
// 236px and its `0% 0% / 100% 100%` coupon at the picture's own size,
|
|
36052
|
-
// cropped to the cell (emailens agreement run, 2026-10-28)
|
|
36271
|
+
// cropped to the cell (emailens agreement run, 2026-10-28): the size inside
|
|
36272
|
+
// the shorthand is ignored. Written on its own it holds (AliExpress,
|
|
36273
|
+
// fidelity bench 2026-11-09).
|
|
36053
36274
|
dropBackgroundSize: true,
|
|
36054
36275
|
// A <style> with a comma-separated media query list is dropped whole: a
|
|
36055
36276
|
// probe on real Yahoo web lost the block for `screen and
|
|
@@ -36081,7 +36302,7 @@ h1 {
|
|
|
36081
36302
|
},
|
|
36082
36303
|
"yahoo-mail-ios": {
|
|
36083
36304
|
id: "yahoo-mail-ios",
|
|
36084
|
-
strippedProperties:
|
|
36305
|
+
strippedProperties: YAHOO_IOS_STRIPPED,
|
|
36085
36306
|
stripMode: "strip",
|
|
36086
36307
|
inlineAndStripStyles: false,
|
|
36087
36308
|
stripExternalStylesheets: false,
|
|
@@ -36173,6 +36394,21 @@ h1 {
|
|
|
36173
36394
|
additionalChecks: superhumanAdditionalChecks
|
|
36174
36395
|
}
|
|
36175
36396
|
};
|
|
36397
|
+
var PLAIN_PROPERTY = /^[a-z][a-z-]*$/;
|
|
36398
|
+
function applyObservations(observations, configs) {
|
|
36399
|
+
for (const [property, byClient] of Object.entries(observations)) {
|
|
36400
|
+
if (!PLAIN_PROPERTY.test(property)) continue;
|
|
36401
|
+
for (const [clientId, o] of Object.entries(byClient)) {
|
|
36402
|
+
const config = configs[clientId];
|
|
36403
|
+
if (!config || o.level === "partial") continue;
|
|
36404
|
+
const strip = new Set(config.strippedProperties);
|
|
36405
|
+
if (o.level === "unsupported") strip.add(property);
|
|
36406
|
+
else strip.delete(property);
|
|
36407
|
+
config.strippedProperties = strip;
|
|
36408
|
+
}
|
|
36409
|
+
}
|
|
36410
|
+
}
|
|
36411
|
+
applyObservations(OBSERVED_OVERRIDES, CLIENT_CONFIGS);
|
|
36176
36412
|
var TEXT_DECORATION_LINE = /^(?:none|underline|overline|line-through|blink)(?:\s+(?:underline|overline|line-through|blink))*\s*(?:!important)?$/i;
|
|
36177
36413
|
var isLineOnly = (value) => TEXT_DECORATION_LINE.test(value.trim());
|
|
36178
36414
|
function dropWarnings(html, config, clientId, framework) {
|
|
@@ -36187,9 +36423,25 @@ h1 {
|
|
|
36187
36423
|
}
|
|
36188
36424
|
function hasDrops(config) {
|
|
36189
36425
|
return Boolean(
|
|
36190
|
-
config.dropSelectors || config.dropAtRules || config.dropValues || config.dropProperties || config.dropNesting || config.dropElements || config.dropAttributes
|
|
36426
|
+
config.dropSelectors || config.dropAtRules || config.dropValues || config.dropProperties || config.dropNesting || config.dropElements || config.dropAttributes || config.mediaWidth
|
|
36191
36427
|
);
|
|
36192
36428
|
}
|
|
36429
|
+
function mediaAtWidth(prelude, width) {
|
|
36430
|
+
let any = false;
|
|
36431
|
+
for (const query of prelude.toLowerCase().split(",")) {
|
|
36432
|
+
const words = query.replace(/\([^)]*\)/g, " ").trim().split(/\s+/).filter(Boolean);
|
|
36433
|
+
if (words.some((w) => !["only", "screen", "all", "print", "and"].includes(w))) return null;
|
|
36434
|
+
let match = !words.includes("print");
|
|
36435
|
+
for (const f of query.matchAll(/\(([^)]*)\)/g)) {
|
|
36436
|
+
const m = /^\s*(min|max)-width\s*:\s*([\d.]+)px\s*$/.exec(f[1]);
|
|
36437
|
+
if (!m) return null;
|
|
36438
|
+
const px2 = Number(m[2]);
|
|
36439
|
+
if (m[1] === "min" ? width < px2 : width > px2) match = false;
|
|
36440
|
+
}
|
|
36441
|
+
any || (any = match);
|
|
36442
|
+
}
|
|
36443
|
+
return any;
|
|
36444
|
+
}
|
|
36193
36445
|
function prepareDropSource(html, config) {
|
|
36194
36446
|
if (!hasDrops(config)) return html;
|
|
36195
36447
|
const $ = cheerio3.load(html);
|
|
@@ -36251,9 +36503,16 @@ h1 {
|
|
|
36251
36503
|
enter(node, item, list) {
|
|
36252
36504
|
if (!list || !item) return;
|
|
36253
36505
|
const head = node.type === "Atrule" ? `@${node.name}${node.prelude ? ` ${csstree3.generate(node.prelude)}` : ""}` : "";
|
|
36506
|
+
const atWidth = config.mediaWidth && node.type === "Atrule" && node.name === "media" && node.prelude ? mediaAtWidth(csstree3.generate(node.prelude), config.mediaWidth) : null;
|
|
36254
36507
|
if (dropAtRules && node.type === "Atrule" && dropAtRules.test(head)) {
|
|
36255
36508
|
list.remove(item);
|
|
36256
36509
|
dropped.add(`@${node.name}`);
|
|
36510
|
+
} else if (atWidth === false) {
|
|
36511
|
+
list.remove(item);
|
|
36512
|
+
dropped.add("@media (width)");
|
|
36513
|
+
} else if (atWidth === true && node.type === "Atrule" && node.block) {
|
|
36514
|
+
list.insertList(node.block.children, item);
|
|
36515
|
+
list.remove(item);
|
|
36257
36516
|
} else if (dropSelectors && node.type === "Rule") {
|
|
36258
36517
|
const m = csstree3.generate(node.prelude).match(dropSelectors);
|
|
36259
36518
|
if (m) {
|
|
@@ -36394,8 +36653,13 @@ h1 {
|
|
|
36394
36653
|
if (config.additionalChecks && config.inlineAndStripStyles) {
|
|
36395
36654
|
warnings.push(...config.additionalChecks($, clientId, html, framework));
|
|
36396
36655
|
}
|
|
36656
|
+
applyTargetingSimulation($, clientId);
|
|
36397
36657
|
if (config.inlineAndStripStyles) {
|
|
36398
|
-
const preserved = inlineStyles(
|
|
36658
|
+
const preserved = inlineStyles(
|
|
36659
|
+
$,
|
|
36660
|
+
((_a2 = CSS_SUPPORT["@font-face"]) == null ? void 0 : _a2[clientId]) !== "unsupported",
|
|
36661
|
+
config.linkColor ? [linkRule(config.linkColor)] : []
|
|
36662
|
+
);
|
|
36399
36663
|
$("style").remove();
|
|
36400
36664
|
if (preserved.trim()) {
|
|
36401
36665
|
const head = $("head");
|
|
@@ -36487,7 +36751,7 @@ h1 {
|
|
|
36487
36751
|
}
|
|
36488
36752
|
if (config.dropBackgroundSize) {
|
|
36489
36753
|
const SIZE = /url\([^)]*\)|\s*\/\s*(?:cover|contain|auto|[\d.]+(?:px|%|em|rem|vw|vh)?)(?:\s+(?:auto|[\d.]+(?:px|%|em|rem|vw|vh)?))?/gi;
|
|
36490
|
-
const unsize = (css) => css.replace(
|
|
36754
|
+
const unsize = (css) => css.replace(
|
|
36491
36755
|
/(background\s*:[^;}]*)/gi,
|
|
36492
36756
|
(decl) => decl.replace(SIZE, (m) => m.startsWith("url(") ? m : "")
|
|
36493
36757
|
);
|
|
@@ -36586,7 +36850,6 @@ h1 {
|
|
|
36586
36850
|
warnings.push(...config.additionalChecks($, clientId, html, framework));
|
|
36587
36851
|
}
|
|
36588
36852
|
if (isWordEngineClient(clientId)) applyWordBoxModel($);
|
|
36589
|
-
applyTargetingSimulation($, clientId);
|
|
36590
36853
|
return { clientId, html: $.html(), warnings };
|
|
36591
36854
|
}
|
|
36592
36855
|
function transformForClient(html, clientId, framework) {
|
|
@@ -36619,9 +36882,12 @@ h1 {
|
|
|
36619
36882
|
const result = applyTransform(downleveled, config, framework);
|
|
36620
36883
|
if (dropSource !== source) result.warnings.unshift(...dropWarnings(source, config, clientId, framework));
|
|
36621
36884
|
if (wordEngine) result.html = vmlToCss(result.html);
|
|
36622
|
-
if (isWordEngineClient(clientId)) result.html = applyMsoHide(result.html);
|
|
36885
|
+
if (isWordEngineClient(clientId)) result.html = standardsMode(applyMsoHide(result.html));
|
|
36623
36886
|
return result;
|
|
36624
36887
|
}
|
|
36888
|
+
function standardsMode(html) {
|
|
36889
|
+
return /^\s*(?:<!--[\s\S]*?-->\s*)*<!doctype/i.test(html) ? html : `<!DOCTYPE html>${html}`;
|
|
36890
|
+
}
|
|
36625
36891
|
function transformForAllClients2(html, framework) {
|
|
36626
36892
|
if (!html || !html.trim()) {
|
|
36627
36893
|
return Object.keys(CLIENT_CONFIGS).map((clientId) => ({
|
|
@@ -36648,21 +36914,23 @@ h1 {
|
|
|
36648
36914
|
}
|
|
36649
36915
|
return clientIds.map((clientId) => {
|
|
36650
36916
|
const config = CLIENT_CONFIGS[clientId];
|
|
36651
|
-
const dropSource = prepareDropSource(html, config);
|
|
36652
|
-
if (dropSource !== html) {
|
|
36653
|
-
const own = downlevelCSS(dropSource);
|
|
36654
|
-
const result2 = applyTransformDom(cheerio3.load(own), own, config, framework);
|
|
36655
|
-
result2.warnings.unshift(...dropWarnings(html, config, clientId, framework));
|
|
36656
|
-
return result2;
|
|
36657
|
-
}
|
|
36658
36917
|
const wordEngine = isWordEngineClient(clientId) && hasOutlookBranch;
|
|
36659
36918
|
const ownSource = isWordEngineClient(clientId) && ownWordSource;
|
|
36660
|
-
const
|
|
36661
|
-
const
|
|
36662
|
-
|
|
36663
|
-
|
|
36919
|
+
const raw = ownSource ? wordRaw : html;
|
|
36920
|
+
const dropSource = prepareDropSource(raw, config);
|
|
36921
|
+
let result;
|
|
36922
|
+
if (dropSource !== raw) {
|
|
36923
|
+
const own = downlevelCSS(dropSource);
|
|
36924
|
+
result = applyTransformDom(cheerio3.load(own), own, config, framework);
|
|
36925
|
+
result.warnings.unshift(...dropWarnings(raw, config, clientId, framework));
|
|
36926
|
+
} else {
|
|
36927
|
+
const source = ownSource ? outlookSource : downleveled;
|
|
36928
|
+
const parsedDom = ownSource ? outlookDom : baseDom;
|
|
36929
|
+
const clientDom = lastClientForSource.get(parsedDom) === clientId ? parsedDom : cheerio3.load(parsedDom.root().clone().toArray()[0]);
|
|
36930
|
+
result = applyTransformDom(clientDom, source, config, framework);
|
|
36931
|
+
}
|
|
36664
36932
|
if (wordEngine) result.html = vmlToCss(result.html);
|
|
36665
|
-
if (isWordEngineClient(clientId)) result.html = applyMsoHide(result.html);
|
|
36933
|
+
if (isWordEngineClient(clientId)) result.html = standardsMode(applyMsoHide(result.html));
|
|
36666
36934
|
return result;
|
|
36667
36935
|
});
|
|
36668
36936
|
}
|
|
@@ -37875,9 +38143,9 @@ h1 {
|
|
|
37875
38143
|
}
|
|
37876
38144
|
if (parts.length === classes.length && classes.length === 1) {
|
|
37877
38145
|
const name = classes[0].name;
|
|
37878
|
-
const
|
|
37879
|
-
for (const p of props)
|
|
37880
|
-
propsByClass.set(name,
|
|
38146
|
+
const seen2 = (_a2 = propsByClass.get(name)) != null ? _a2 : /* @__PURE__ */ new Set();
|
|
38147
|
+
for (const p of props) seen2.add(p);
|
|
38148
|
+
propsByClass.set(name, seen2);
|
|
37881
38149
|
}
|
|
37882
38150
|
}
|
|
37883
38151
|
}
|
|
@@ -38006,18 +38274,18 @@ h1 {
|
|
|
38006
38274
|
const names = ((_a2 = $(el).attr("class")) != null ? _a2 : "").split(/\s+/).filter(Boolean);
|
|
38007
38275
|
if (names.length < 2) return;
|
|
38008
38276
|
const loc = locOfElement(el);
|
|
38009
|
-
const
|
|
38277
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
38010
38278
|
for (const sheet of sheets) {
|
|
38011
38279
|
for (const name of names) {
|
|
38012
38280
|
for (const prop of (_b = sheet.propsByClass.get(name)) != null ? _b : []) {
|
|
38013
|
-
const first =
|
|
38281
|
+
const first = seen2.get(prop);
|
|
38014
38282
|
if (first && first !== name) {
|
|
38015
38283
|
conflictExample || (conflictExample = `.${first} and .${name} both set ${prop}`);
|
|
38016
38284
|
conflictCount++;
|
|
38017
38285
|
if (loc) conflicting.push(loc);
|
|
38018
38286
|
return;
|
|
38019
38287
|
}
|
|
38020
|
-
if (!first)
|
|
38288
|
+
if (!first) seen2.set(prop, name);
|
|
38021
38289
|
}
|
|
38022
38290
|
}
|
|
38023
38291
|
if (names.some((n) => sheet.classesWithDescendants.has(n))) {
|
|
@@ -38078,7 +38346,7 @@ h1 {
|
|
|
38078
38346
|
const found = { selector: "", props: [], elements: [], inherits: false };
|
|
38079
38347
|
const body = $("body").first();
|
|
38080
38348
|
if (!body.length) return found;
|
|
38081
|
-
const
|
|
38349
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
38082
38350
|
const props = /* @__PURE__ */ new Set();
|
|
38083
38351
|
for (const el of $("style").toArray()) {
|
|
38084
38352
|
let ast;
|
|
@@ -38126,8 +38394,8 @@ h1 {
|
|
|
38126
38394
|
if (value === "inherit") found.inherits = true;
|
|
38127
38395
|
hit2 = true;
|
|
38128
38396
|
}
|
|
38129
|
-
if (hit2 && !
|
|
38130
|
-
|
|
38397
|
+
if (hit2 && !seen2.has(target)) {
|
|
38398
|
+
seen2.add(target);
|
|
38131
38399
|
found.elements.push(target);
|
|
38132
38400
|
found.selector || (found.selector = text.trim());
|
|
38133
38401
|
}
|
|
@@ -38215,8 +38483,8 @@ h1 {
|
|
|
38215
38483
|
);
|
|
38216
38484
|
return m ? (_a2 = m[1]) != null ? _a2 : m[2] : void 0;
|
|
38217
38485
|
}
|
|
38218
|
-
function add(issues,
|
|
38219
|
-
const existing =
|
|
38486
|
+
function add(issues, seen2, key, issue) {
|
|
38487
|
+
const existing = seen2.get(key);
|
|
38220
38488
|
if (existing) {
|
|
38221
38489
|
if (!issue.loc || !existing.locs) return;
|
|
38222
38490
|
if (existing.locs.some((l) => l.offset === issue.loc.offset)) return;
|
|
@@ -38227,32 +38495,32 @@ h1 {
|
|
|
38227
38495
|
existing.locs.push(issue.loc);
|
|
38228
38496
|
return;
|
|
38229
38497
|
}
|
|
38230
|
-
|
|
38498
|
+
seen2.set(key, issue);
|
|
38231
38499
|
issues.push(issue);
|
|
38232
38500
|
}
|
|
38233
38501
|
function withLoc(issue, loc) {
|
|
38234
38502
|
return loc ? __spreadProps(__spreadValues({}, issue), { loc, locs: [loc] }) : issue;
|
|
38235
38503
|
}
|
|
38236
38504
|
var TEXT_HOSTS = /<\s*(center|v:textbox|div|p|table|h[1-6]|span|font|a)\b/i;
|
|
38237
|
-
function checkLooseText(issues,
|
|
38505
|
+
function checkLooseText(issues, seen2, open, inner, source) {
|
|
38238
38506
|
if (TEXT_HOSTS.test(inner)) return;
|
|
38239
38507
|
const text = inner.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^>]*>/g, "").replace(/ |\s/g, "");
|
|
38240
38508
|
if (text === "") return;
|
|
38241
|
-
add(issues,
|
|
38509
|
+
add(issues, seen2, `loosetext:${open.name}`, withLoc({
|
|
38242
38510
|
rule: "vml-unrendered-text",
|
|
38243
38511
|
severity: "error",
|
|
38244
38512
|
message: `<v:${open.name}> has label text with no element around it, which Outlook does not draw.`,
|
|
38245
38513
|
detail: `Verified in Outlook Classic: the shape renders its fill and shape correctly and shows no text at all, so the reader gets a blank coloured block where the label should be. Nothing errors and the HTML fallback still reads correctly in every other client, so this ships unnoticed. Wrap the text in <center> (what the bulletproof-button pattern uses) or in <v:textbox>.`
|
|
38246
38514
|
}, locAt(source, open.offset, open.length)));
|
|
38247
38515
|
}
|
|
38248
|
-
function checkFillPicture(issues,
|
|
38516
|
+
function checkFillPicture(issues, seen2, open, inner, source) {
|
|
38249
38517
|
if (/<v:imagedata\b/i.test(inner)) return;
|
|
38250
38518
|
const fill = inner.match(/<v:fill\b([^>]*)>/i);
|
|
38251
38519
|
if (!fill || attr(fill[1], "src") === void 0) return;
|
|
38252
38520
|
const label = inner.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^>]*>/g, "").replace(/ |\s/g, "");
|
|
38253
38521
|
const picture2 = label === "";
|
|
38254
38522
|
const measured = `Measured on real Outlook: 2007 and 2010 draw the picture, but 2013, 2016 and 2019 show only the fill's colour.`;
|
|
38255
|
-
add(issues,
|
|
38523
|
+
add(issues, seen2, `fillpicture:${open.name}`, withLoc(picture2 ? {
|
|
38256
38524
|
rule: "vml-roundrect-fill-picture",
|
|
38257
38525
|
severity: "error",
|
|
38258
38526
|
message: `<v:roundrect> paints its picture with <v:fill src>, which Outlook 2013, 2016 and 2019 leave blank.`,
|
|
@@ -38284,7 +38552,7 @@ h1 {
|
|
|
38284
38552
|
}
|
|
38285
38553
|
return tags;
|
|
38286
38554
|
}
|
|
38287
|
-
function checkGhostTables(issues,
|
|
38555
|
+
function checkGhostTables(issues, seen2, blocks, source) {
|
|
38288
38556
|
var _a2;
|
|
38289
38557
|
const tags = ghostTags(blocks);
|
|
38290
38558
|
if (tags.length === 0) return;
|
|
@@ -38302,7 +38570,7 @@ h1 {
|
|
|
38302
38570
|
for (const [name, list] of opens) {
|
|
38303
38571
|
if (!GHOST_TAGS.has(name)) continue;
|
|
38304
38572
|
for (const tag of list.slice(0, 1)) {
|
|
38305
|
-
add(issues,
|
|
38573
|
+
add(issues, seen2, `ghost-open:${name}`, withLoc({
|
|
38306
38574
|
rule: "ghost-table-unbalanced",
|
|
38307
38575
|
severity: "error",
|
|
38308
38576
|
message: `<${name}> is opened inside an Outlook conditional comment and never closed.`,
|
|
@@ -38311,7 +38579,7 @@ h1 {
|
|
|
38311
38579
|
}
|
|
38312
38580
|
}
|
|
38313
38581
|
for (const tag of strays.slice(0, 1)) {
|
|
38314
|
-
add(issues,
|
|
38582
|
+
add(issues, seen2, `ghost-stray:${tag.name}`, withLoc({
|
|
38315
38583
|
rule: "ghost-table-unbalanced",
|
|
38316
38584
|
severity: "error",
|
|
38317
38585
|
message: `Closing </${tag.name}> inside an Outlook conditional comment has no matching opening tag.`,
|
|
@@ -38325,8 +38593,8 @@ h1 {
|
|
|
38325
38593
|
const blocks = msoBlocks(html);
|
|
38326
38594
|
const tags = vmlTags(blocks);
|
|
38327
38595
|
const issues = [];
|
|
38328
|
-
const
|
|
38329
|
-
checkGhostTables(issues,
|
|
38596
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
38597
|
+
checkGhostTables(issues, seen2, blocks, source);
|
|
38330
38598
|
if (tags.length === 0) return { hasVml: false, issues };
|
|
38331
38599
|
const openShapes = [];
|
|
38332
38600
|
let groupDepth = 0;
|
|
@@ -38342,11 +38610,11 @@ h1 {
|
|
|
38342
38610
|
if (idx !== -1) {
|
|
38343
38611
|
const open = openShapes[idx];
|
|
38344
38612
|
const inner = html.slice(open.offset + open.length, tag.offset);
|
|
38345
|
-
checkLooseText(issues,
|
|
38346
|
-
if (name === "roundrect") checkFillPicture(issues,
|
|
38613
|
+
checkLooseText(issues, seen2, open, inner, source);
|
|
38614
|
+
if (name === "roundrect") checkFillPicture(issues, seen2, open, inner, source);
|
|
38347
38615
|
}
|
|
38348
38616
|
if (idx === -1) {
|
|
38349
|
-
add(issues,
|
|
38617
|
+
add(issues, seen2, `stray:${name}`, withLoc({
|
|
38350
38618
|
rule: "vml-unbalanced-tag",
|
|
38351
38619
|
severity: "error",
|
|
38352
38620
|
message: `Closing </v:${name}> has no matching opening tag.`,
|
|
@@ -38362,7 +38630,7 @@ h1 {
|
|
|
38362
38630
|
if (isShape) {
|
|
38363
38631
|
const parent = openShapes[openShapes.length - 1];
|
|
38364
38632
|
if (parent && groupDepth === 0) {
|
|
38365
|
-
add(issues,
|
|
38633
|
+
add(issues, seen2, `nested:${parent.name}>${name}`, withLoc({
|
|
38366
38634
|
rule: "vml-nested-shape",
|
|
38367
38635
|
severity: "error",
|
|
38368
38636
|
message: `<v:${name}> is nested inside <v:${parent.name}>. Outlook does not support nesting one VML shape inside another.`,
|
|
@@ -38391,7 +38659,7 @@ h1 {
|
|
|
38391
38659
|
if (!m) continue;
|
|
38392
38660
|
const value = m[1].trim();
|
|
38393
38661
|
if (value === "" || /^[a-z%]+$/i.test(value)) {
|
|
38394
|
-
add(issues,
|
|
38662
|
+
add(issues, seen2, `dim:${name}:${prop}:${value}`, withLoc({
|
|
38395
38663
|
rule: "vml-invalid-dimension",
|
|
38396
38664
|
severity: "error",
|
|
38397
38665
|
message: `<v:${name}> has an invalid ${prop}: "${prop}:${value}" is missing its number.`,
|
|
@@ -38406,7 +38674,7 @@ h1 {
|
|
|
38406
38674
|
const raw = arcsize.trim();
|
|
38407
38675
|
const pct = raw.endsWith("%") ? parseFloat(raw) : parseFloat(raw) * 100;
|
|
38408
38676
|
if (Number.isFinite(pct) && (pct < 0 || pct > 100)) {
|
|
38409
|
-
add(issues,
|
|
38677
|
+
add(issues, seen2, `arcsize:${raw}`, withLoc({
|
|
38410
38678
|
rule: "vml-arcsize-range",
|
|
38411
38679
|
severity: "warning",
|
|
38412
38680
|
message: `<v:roundrect> has arcsize="${raw}", outside the valid 0%\u2013100% range.`,
|
|
@@ -38417,7 +38685,7 @@ h1 {
|
|
|
38417
38685
|
}
|
|
38418
38686
|
}
|
|
38419
38687
|
for (const tag of openShapes) {
|
|
38420
|
-
add(issues,
|
|
38688
|
+
add(issues, seen2, `unclosed:${tag.name}`, withLoc({
|
|
38421
38689
|
rule: "vml-unbalanced-tag",
|
|
38422
38690
|
severity: "error",
|
|
38423
38691
|
message: `<v:${tag.name}> is never closed.`,
|
|
@@ -38425,7 +38693,7 @@ h1 {
|
|
|
38425
38693
|
}, locAt(source, tag.offset, tag.length)));
|
|
38426
38694
|
}
|
|
38427
38695
|
if (/<head[\s>]/i.test(html) && !/<o:PixelsPerInch[\s>]/i.test(html)) {
|
|
38428
|
-
add(issues,
|
|
38696
|
+
add(issues, seen2, "ppi", withLoc({
|
|
38429
38697
|
rule: "vml-pixels-per-inch",
|
|
38430
38698
|
severity: "warning",
|
|
38431
38699
|
message: `This email uses VML but does not declare <o:PixelsPerInch>96</o:PixelsPerInch>.`,
|
|
@@ -38449,6 +38717,9 @@ h1 {
|
|
|
38449
38717
|
next = adjustBody(live$, next);
|
|
38450
38718
|
return appendKillers(next, html, wordHtml, vml, framework);
|
|
38451
38719
|
}
|
|
38720
|
+
var nonZeroPadding = (style) => [...style.matchAll(/(?:^|[^-])padding(?:-(?:top|right|bottom|left))?\s*:\s*([^;]*)/gi)].some(
|
|
38721
|
+
([, value]) => !/^(?:\s*0(?:px|em|rem|%|pt)?)+\s*(?:!important)?\s*$/i.test(value)
|
|
38722
|
+
);
|
|
38452
38723
|
var hit = (re) => (style) => re.test(style);
|
|
38453
38724
|
var LAYER_TOKEN = {
|
|
38454
38725
|
image: null,
|
|
@@ -38505,7 +38776,7 @@ h1 {
|
|
|
38505
38776
|
apply(word$, wordRules, WORD, "linear-gradient", hit(/linear-gradient\s*\(/i), wordFill, "Outlook Classic drops this linear-gradient, and no v:fill covers it.", true);
|
|
38506
38777
|
apply(word$, wordRules, WORD, "max-width", hit(/max-width\s*:/i), (el, style) => maxWidthCovered(word$, el, style), "Outlook Classic only honours max-width on a table. Wrap the element in a table with a fixed width.", true);
|
|
38507
38778
|
apply(word$, wordRules, WORD, "min-width", hit(/min-width\s*:/i), (el, style) => minWidthCovered(word$, el, style), "Outlook Classic ignores min-width. Give the box a width, or put it in a cell with one.", true);
|
|
38508
|
-
apply(word$, wordRules, WORD, "padding",
|
|
38779
|
+
apply(word$, wordRules, WORD, "padding", nonZeroPadding, (el) => paddingCovered(word$, el, true), "Outlook Classic drops this padding. Put it on a table cell, or set mso-padding-alt on one.", true);
|
|
38509
38780
|
apply(word$, wordRules, WORD, "float", hit(/float\s*:/i), never, "Outlook Classic drops this float. The MSO branch needs a table with align.", true);
|
|
38510
38781
|
apply(word$, wordRules, WORD, "display:flex", hit(/display\s*:\s*(?:inline-)?flex\b/i), never, "Outlook Classic receives this flex box. The MSO branch needs a table.", true);
|
|
38511
38782
|
apply(word$, wordRules, WORD, "display:grid", hit(/display\s*:\s*(?:inline-)?grid\b/i), never, "Outlook Classic receives this grid box. The MSO branch needs a table.", true);
|
|
@@ -38934,12 +39205,12 @@ h1 {
|
|
|
38934
39205
|
}
|
|
38935
39206
|
function appendKillers(warnings, html, wordHtml, vml, framework) {
|
|
38936
39207
|
const extra = [];
|
|
38937
|
-
const
|
|
39208
|
+
const seen2 = new Set(warnings.map((w) => `${w.client}:${w.property}`));
|
|
38938
39209
|
const push = (client, property, severity, message) => {
|
|
38939
39210
|
var _a2;
|
|
38940
39211
|
const key = `${client}:${property}`;
|
|
38941
|
-
if (
|
|
38942
|
-
|
|
39212
|
+
if (seen2.has(key)) return;
|
|
39213
|
+
seen2.add(key);
|
|
38943
39214
|
extra.push({
|
|
38944
39215
|
severity,
|
|
38945
39216
|
client,
|
|
@@ -39079,11 +39350,11 @@ h1 {
|
|
|
39079
39350
|
suggestion: "Avoid client-specific hacks in strict mode, or switch to progressive targeting policy."
|
|
39080
39351
|
};
|
|
39081
39352
|
}
|
|
39082
|
-
function recordMatch(report,
|
|
39083
|
-
if (
|
|
39353
|
+
function recordMatch(report, seen2, matcher, policy, matchedText, selector) {
|
|
39354
|
+
if (seen2.has(matcher.id)) return;
|
|
39084
39355
|
const hack = targetingHackForMatcher(matcher);
|
|
39085
39356
|
if (!hack) return;
|
|
39086
|
-
|
|
39357
|
+
seen2.add(matcher.id);
|
|
39087
39358
|
report.detectedHacks.push({
|
|
39088
39359
|
hack,
|
|
39089
39360
|
foundIn: matcher.foundIn,
|
|
@@ -39093,14 +39364,14 @@ h1 {
|
|
|
39093
39364
|
const warning = applyLint(matcher, hack, policy, { matchedText, selector });
|
|
39094
39365
|
if (warning) report.warnings.push(warning);
|
|
39095
39366
|
}
|
|
39096
|
-
function scanHtmlForTargeting(html, report,
|
|
39367
|
+
function scanHtmlForTargeting(html, report, seen2, policy) {
|
|
39097
39368
|
for (const matcher of HTML_MATCHERS) {
|
|
39098
39369
|
const match = html.match(matcher.pattern);
|
|
39099
39370
|
if (!match) continue;
|
|
39100
|
-
recordMatch(report,
|
|
39371
|
+
recordMatch(report, seen2, matcher, policy, match[0]);
|
|
39101
39372
|
}
|
|
39102
39373
|
}
|
|
39103
|
-
function scanCssAstForTargeting(ast, report,
|
|
39374
|
+
function scanCssAstForTargeting(ast, report, seen2, policy) {
|
|
39104
39375
|
csstree8.walk(ast, {
|
|
39105
39376
|
visit: "Rule",
|
|
39106
39377
|
enter(node) {
|
|
@@ -39109,7 +39380,7 @@ h1 {
|
|
|
39109
39380
|
const selectorText = csstree8.generate(child).trim();
|
|
39110
39381
|
for (const matcher of SELECTOR_MATCHERS) {
|
|
39111
39382
|
if (matcher.pattern.test(selectorText)) {
|
|
39112
|
-
recordMatch(report,
|
|
39383
|
+
recordMatch(report, seen2, matcher, policy, selectorText, selectorText);
|
|
39113
39384
|
}
|
|
39114
39385
|
}
|
|
39115
39386
|
});
|
|
@@ -39123,13 +39394,13 @@ h1 {
|
|
|
39123
39394
|
const haystack = `@${node.name} ${atRulePrelude}`;
|
|
39124
39395
|
for (const matcher of ATRULE_MATCHERS) {
|
|
39125
39396
|
if (matcher.pattern.test(atRulePrelude) || matcher.pattern.test(haystack)) {
|
|
39126
|
-
recordMatch(report,
|
|
39397
|
+
recordMatch(report, seen2, matcher, policy, haystack);
|
|
39127
39398
|
}
|
|
39128
39399
|
}
|
|
39129
39400
|
}
|
|
39130
39401
|
});
|
|
39131
39402
|
}
|
|
39132
|
-
function scanStyleBlocks(html, report,
|
|
39403
|
+
function scanStyleBlocks(html, report, seen2, policy) {
|
|
39133
39404
|
const styleRegex = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
39134
39405
|
let styleMatch;
|
|
39135
39406
|
while ((styleMatch = styleRegex.exec(html)) !== null) {
|
|
@@ -39139,14 +39410,14 @@ h1 {
|
|
|
39139
39410
|
} catch (e) {
|
|
39140
39411
|
continue;
|
|
39141
39412
|
}
|
|
39142
|
-
scanCssAstForTargeting(ast, report,
|
|
39413
|
+
scanCssAstForTargeting(ast, report, seen2, policy);
|
|
39143
39414
|
}
|
|
39144
39415
|
}
|
|
39145
39416
|
function checkTargetingHacks(html, policy = "progressive") {
|
|
39146
39417
|
const report = emptyTargetingReport();
|
|
39147
|
-
const
|
|
39148
|
-
scanHtmlForTargeting(html, report,
|
|
39149
|
-
scanStyleBlocks(html, report,
|
|
39418
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
39419
|
+
scanHtmlForTargeting(html, report, seen2, policy);
|
|
39420
|
+
scanStyleBlocks(html, report, seen2, policy);
|
|
39150
39421
|
return report;
|
|
39151
39422
|
}
|
|
39152
39423
|
var WORD_ENGINE_CLIENT = "outlook-windows-legacy";
|
|
@@ -39419,24 +39690,24 @@ h1 {
|
|
|
39419
39690
|
if (!cssLoc) return;
|
|
39420
39691
|
const loc = locInCssBlock(blockAnchor, cssLoc);
|
|
39421
39692
|
if (!loc) return;
|
|
39422
|
-
const
|
|
39423
|
-
if (!
|
|
39693
|
+
const seen2 = selectorLocs.get(key);
|
|
39694
|
+
if (!seen2) {
|
|
39424
39695
|
selectorLocs.set(key, { locs: [loc], scopes: [scope != null ? scope : null] });
|
|
39425
39696
|
return;
|
|
39426
39697
|
}
|
|
39427
|
-
if (
|
|
39428
|
-
if (
|
|
39429
|
-
|
|
39698
|
+
if (seen2.locs.some((l) => l.offset === loc.offset)) return;
|
|
39699
|
+
if (seen2.locs.length >= MAX_WARNING_LOCATIONS) {
|
|
39700
|
+
seen2.truncated = true;
|
|
39430
39701
|
return;
|
|
39431
39702
|
}
|
|
39432
|
-
|
|
39433
|
-
if (
|
|
39703
|
+
seen2.locs.push(loc);
|
|
39704
|
+
if (seen2.scopes) seen2.scopes.push(scope != null ? scope : null);
|
|
39434
39705
|
}
|
|
39435
39706
|
function recordLoc(key, cssLoc, value, scope) {
|
|
39436
39707
|
const loc = locInCssBlock(blockAnchor, cssLoc);
|
|
39437
39708
|
if (!loc) return;
|
|
39438
|
-
const
|
|
39439
|
-
if (!
|
|
39709
|
+
const seen2 = propertyLocs.get(key);
|
|
39710
|
+
if (!seen2) {
|
|
39440
39711
|
propertyLocs.set(key, __spreadProps(__spreadValues({
|
|
39441
39712
|
locs: [loc]
|
|
39442
39713
|
}, value !== void 0 ? { values: [value] } : {}), {
|
|
@@ -39444,14 +39715,14 @@ h1 {
|
|
|
39444
39715
|
}));
|
|
39445
39716
|
return;
|
|
39446
39717
|
}
|
|
39447
|
-
if (
|
|
39448
|
-
if (
|
|
39449
|
-
|
|
39718
|
+
if (seen2.locs.some((l) => l.offset === loc.offset)) return;
|
|
39719
|
+
if (seen2.locs.length >= MAX_WARNING_LOCATIONS) {
|
|
39720
|
+
seen2.truncated = true;
|
|
39450
39721
|
return;
|
|
39451
39722
|
}
|
|
39452
|
-
|
|
39453
|
-
if (
|
|
39454
|
-
if (
|
|
39723
|
+
seen2.locs.push(loc);
|
|
39724
|
+
if (seen2.values && value !== void 0) seen2.values.push(value);
|
|
39725
|
+
if (seen2.scopes) seen2.scopes.push(scope != null ? scope : null);
|
|
39455
39726
|
}
|
|
39456
39727
|
$("style").each((_, el) => {
|
|
39457
39728
|
const cssText = $(el).text();
|
|
@@ -40299,11 +40570,11 @@ Client-agnostic rendering bugs. Apply each fix directly to the code.
|
|
|
40299
40570
|
return { warnings, truncated: false, removed: 0 };
|
|
40300
40571
|
}
|
|
40301
40572
|
let result = [...warnings];
|
|
40302
|
-
const
|
|
40573
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
40303
40574
|
result = result.filter((w) => {
|
|
40304
40575
|
const key = `${w.property}:${w.severity}`;
|
|
40305
|
-
if (
|
|
40306
|
-
|
|
40576
|
+
if (seen2.has(key)) return false;
|
|
40577
|
+
seen2.add(key);
|
|
40307
40578
|
return true;
|
|
40308
40579
|
});
|
|
40309
40580
|
if (estimateFits(result, html, maxTokens)) {
|
|
@@ -40964,7 +41235,7 @@ ${targetingFixBullets()}
|
|
|
40964
41235
|
}
|
|
40965
41236
|
function checkUrlShorteners($) {
|
|
40966
41237
|
const issues = [];
|
|
40967
|
-
const
|
|
41238
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
40968
41239
|
$("a[href]").each((_, el) => {
|
|
40969
41240
|
const href = $(el).attr("href") || "";
|
|
40970
41241
|
let hostname;
|
|
@@ -40974,8 +41245,8 @@ ${targetingFixBullets()}
|
|
|
40974
41245
|
return;
|
|
40975
41246
|
}
|
|
40976
41247
|
for (const shortener of URL_SHORTENERS) {
|
|
40977
|
-
if ((hostname === shortener || hostname.endsWith("." + shortener)) && !
|
|
40978
|
-
|
|
41248
|
+
if ((hostname === shortener || hostname.endsWith("." + shortener)) && !seen2.has(shortener)) {
|
|
41249
|
+
seen2.add(shortener);
|
|
40979
41250
|
issues.push({
|
|
40980
41251
|
rule: "url-shortener",
|
|
40981
41252
|
severity: "warning",
|
|
@@ -41663,7 +41934,7 @@ Href: ${href}`
|
|
|
41663
41934
|
});
|
|
41664
41935
|
if (!decls.length) return;
|
|
41665
41936
|
for (const selector of splitTopLevel(selectorList).map((x) => x.trim()).filter(Boolean)) {
|
|
41666
|
-
const
|
|
41937
|
+
const specificity3 = specificityOf(selector);
|
|
41667
41938
|
let matched;
|
|
41668
41939
|
try {
|
|
41669
41940
|
matched = $(selector).toArray();
|
|
@@ -41675,7 +41946,7 @@ Href: ${href}`
|
|
|
41675
41946
|
record(el, d.prop, __spreadProps(__spreadValues({}, d), {
|
|
41676
41947
|
inline: false,
|
|
41677
41948
|
presentational: false,
|
|
41678
|
-
specificity:
|
|
41949
|
+
specificity: specificity3,
|
|
41679
41950
|
order: order++
|
|
41680
41951
|
}));
|
|
41681
41952
|
}
|
|
@@ -41989,10 +42260,10 @@ Href: ${href}`
|
|
|
41989
42260
|
return issues.filter((i) => i.rule === "low-contrast");
|
|
41990
42261
|
}
|
|
41991
42262
|
function contrastDelta(candidates, baseline, rule, prefix, details) {
|
|
41992
|
-
const
|
|
42263
|
+
const seen2 = new Set(lowContrastOnly(baseline).map((i) => i.element));
|
|
41993
42264
|
return lowContrastOnly(candidates).filter((issue) => {
|
|
41994
|
-
if (
|
|
41995
|
-
|
|
42265
|
+
if (seen2.has(issue.element)) return false;
|
|
42266
|
+
seen2.add(issue.element);
|
|
41996
42267
|
return true;
|
|
41997
42268
|
}).map((issue) => __spreadProps(__spreadValues(__spreadValues({
|
|
41998
42269
|
severity: issue.severity,
|
|
@@ -42503,15 +42774,15 @@ Href: ${href}`
|
|
|
42503
42774
|
function checkTemplateVariablesFromDom($, source) {
|
|
42504
42775
|
var _a2;
|
|
42505
42776
|
const issues = [];
|
|
42506
|
-
const
|
|
42777
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
42507
42778
|
const textNodes = visibleTextNodes($);
|
|
42508
42779
|
const positioned = textNodes.some((n) => n.sourceCodeLocation);
|
|
42509
42780
|
for (const node of positioned ? textNodes : []) {
|
|
42510
42781
|
const data = (_a2 = node.data) != null ? _a2 : "";
|
|
42511
42782
|
for (const { variable, label, index } of findVariables(data)) {
|
|
42512
42783
|
const key = `text:${variable}`;
|
|
42513
|
-
if (
|
|
42514
|
-
|
|
42784
|
+
if (seen2.has(key)) continue;
|
|
42785
|
+
seen2.add(key);
|
|
42515
42786
|
const loc = locInTextNode(node, index, variable.length, source);
|
|
42516
42787
|
issues.push(__spreadValues({
|
|
42517
42788
|
rule: "unresolved-variable",
|
|
@@ -42528,8 +42799,8 @@ Href: ${href}`
|
|
|
42528
42799
|
}).join("");
|
|
42529
42800
|
for (const { variable, label } of findVariables(textContent)) {
|
|
42530
42801
|
const key = `text:${variable}`;
|
|
42531
|
-
if (
|
|
42532
|
-
|
|
42802
|
+
if (seen2.has(key)) continue;
|
|
42803
|
+
seen2.add(key);
|
|
42533
42804
|
issues.push({
|
|
42534
42805
|
rule: "unresolved-variable",
|
|
42535
42806
|
severity: "error",
|
|
@@ -42547,8 +42818,8 @@ Href: ${href}`
|
|
|
42547
42818
|
if (!value) continue;
|
|
42548
42819
|
for (const { variable, label } of findVariables(value)) {
|
|
42549
42820
|
const key = `attr:${attr2}:${variable}`;
|
|
42550
|
-
if (
|
|
42551
|
-
|
|
42821
|
+
if (seen2.has(key)) continue;
|
|
42822
|
+
seen2.add(key);
|
|
42552
42823
|
const loc = locOfAttr(el, attr2);
|
|
42553
42824
|
const espLink = attr2 === "href" && ESP_SYSTEM_LINK.test(variable);
|
|
42554
42825
|
issues.push(__spreadValues({
|
|
@@ -42588,9 +42859,9 @@ Href: ${href}`
|
|
|
42588
42859
|
if (maxMatch && parseInt(maxMatch[1], 10) <= EMAIL_MAX_WIDTH) return true;
|
|
42589
42860
|
return false;
|
|
42590
42861
|
}
|
|
42591
|
-
function addWidthIssue(width, label, issues,
|
|
42862
|
+
function addWidthIssue(width, label, issues, seen2, loc) {
|
|
42592
42863
|
const key = `w:${label}:${width}`;
|
|
42593
|
-
const existing =
|
|
42864
|
+
const existing = seen2.get(key);
|
|
42594
42865
|
if (existing) {
|
|
42595
42866
|
addOccurrence(existing, loc);
|
|
42596
42867
|
return;
|
|
@@ -42601,7 +42872,7 @@ Href: ${href}`
|
|
|
42601
42872
|
message: `${label} has a fixed width of ${width}px, wider than the ${EMAIL_MAX_WIDTH}px email frame; it will force horizontal scrolling, especially on mobile.`,
|
|
42602
42873
|
detail: `Use width:100% with max-width:${EMAIL_MAX_WIDTH}px instead of a fixed width beyond the frame.`
|
|
42603
42874
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42604
|
-
|
|
42875
|
+
seen2.set(key, issue);
|
|
42605
42876
|
issues.push(issue);
|
|
42606
42877
|
}
|
|
42607
42878
|
function locateInNodes(nodes, starts, index, length, source) {
|
|
@@ -42636,7 +42907,7 @@ Href: ${href}`
|
|
|
42636
42907
|
function checkOverflowFromDom($, source) {
|
|
42637
42908
|
var _a2;
|
|
42638
42909
|
const issues = [];
|
|
42639
|
-
const
|
|
42910
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
42640
42911
|
const tokensSeen = /* @__PURE__ */ new Set();
|
|
42641
42912
|
$("[width], [style*='width']").each((_, el) => {
|
|
42642
42913
|
const $el = $(el);
|
|
@@ -42645,7 +42916,7 @@ Href: ${href}`
|
|
|
42645
42916
|
if (isFluid($el.attr("style") || "")) return;
|
|
42646
42917
|
const tag = (el.tagName || "element").toLowerCase();
|
|
42647
42918
|
const fromStyle = /(?:^|[;\s])width\s*:\s*\d+px/i.test($el.attr("style") || "");
|
|
42648
|
-
addWidthIssue(width, `<${tag}>`, issues,
|
|
42919
|
+
addWidthIssue(width, `<${tag}>`, issues, seen2, locOfAttr(el, fromStyle ? "style" : "width"));
|
|
42649
42920
|
});
|
|
42650
42921
|
$("style").each((_, el) => {
|
|
42651
42922
|
const cssText = $(el).text();
|
|
@@ -42680,7 +42951,7 @@ Href: ${href}`
|
|
|
42680
42951
|
});
|
|
42681
42952
|
if (widthPx !== null && widthPx > EMAIL_MAX_WIDTH && !fluid) {
|
|
42682
42953
|
const selector = csstree11.generate(node.prelude).trim().slice(0, 40);
|
|
42683
|
-
addWidthIssue(widthPx, selector || "rule", issues,
|
|
42954
|
+
addWidthIssue(widthPx, selector || "rule", issues, seen2, widthLoc);
|
|
42684
42955
|
}
|
|
42685
42956
|
}
|
|
42686
42957
|
});
|
|
@@ -42710,7 +42981,7 @@ Href: ${href}`
|
|
|
42710
42981
|
}
|
|
42711
42982
|
if (!rowHasFluid && explicitCellCount >= 2 && rowFixedPx > EMAIL_MAX_WIDTH) {
|
|
42712
42983
|
const key = `row:${rowFixedPx}:${explicitCellCount}`;
|
|
42713
|
-
if (!
|
|
42984
|
+
if (!seen2.has(key)) {
|
|
42714
42985
|
const loc = locOfElement(trEl) || locOfElement(tableEl);
|
|
42715
42986
|
const issue = __spreadValues({
|
|
42716
42987
|
rule: "table-row-overflow",
|
|
@@ -42718,7 +42989,7 @@ Href: ${href}`
|
|
|
42718
42989
|
message: `Table row has ${explicitCellCount} columns totaling ${rowFixedPx}px, wider than the ${EMAIL_MAX_WIDTH}px email frame; it will force horizontal scrolling on mobile.`,
|
|
42719
42990
|
detail: `Make columns fluid with percentage widths (e.g. width:50%) or stack columns vertically on small screens.`
|
|
42720
42991
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42721
|
-
|
|
42992
|
+
seen2.set(key, issue);
|
|
42722
42993
|
issues.push(issue);
|
|
42723
42994
|
}
|
|
42724
42995
|
}
|
|
@@ -42735,7 +43006,7 @@ Href: ${href}`
|
|
|
42735
43006
|
const parentWidth = fixedPxWidth($parent);
|
|
42736
43007
|
if (parentWidth !== null && parentWidth > 0 && imgWidth > parentWidth) {
|
|
42737
43008
|
const key = `img-overflow:${imgWidth}:${parentWidth}`;
|
|
42738
|
-
if (!
|
|
43009
|
+
if (!seen2.has(key)) {
|
|
42739
43010
|
const loc = locOfAttr(imgEl, "width") || locOfElement(imgEl);
|
|
42740
43011
|
const issue = __spreadValues({
|
|
42741
43012
|
rule: "image-container-overflow",
|
|
@@ -42743,7 +43014,7 @@ Href: ${href}`
|
|
|
42743
43014
|
message: `<img> has fixed width ${imgWidth}px exceeding its container's width (${parentWidth}px); it will blow out the layout.`,
|
|
42744
43015
|
detail: `Set width:100% with max-width:${imgWidth}px or reduce the image width to fit within ${parentWidth}px.`
|
|
42745
43016
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42746
|
-
|
|
43017
|
+
seen2.set(key, issue);
|
|
42747
43018
|
issues.push(issue);
|
|
42748
43019
|
}
|
|
42749
43020
|
}
|
|
@@ -42867,7 +43138,7 @@ Href: ${href}`
|
|
|
42867
43138
|
}
|
|
42868
43139
|
issue.locs.push(loc);
|
|
42869
43140
|
}
|
|
42870
|
-
function inspectDeclarations(style, issues,
|
|
43141
|
+
function inspectDeclarations(style, issues, seen2, locs) {
|
|
42871
43142
|
var _a2, _b, _c;
|
|
42872
43143
|
const combined = `${(_a2 = style.get("background-image")) != null ? _a2 : ""} ${(_b = style.get("background")) != null ? _b : ""}`;
|
|
42873
43144
|
const isGradient = GRADIENT_RE.test(combined);
|
|
@@ -42877,7 +43148,7 @@ Href: ${href}`
|
|
|
42877
43148
|
const fix = stop ? `background-color: ${stop};` : `background-color: <solid colour matching the image>;`;
|
|
42878
43149
|
const key = `bg:${fix}`;
|
|
42879
43150
|
const loc = (_c = locs == null ? void 0 : locs.get("background-image")) != null ? _c : locs == null ? void 0 : locs.get("background");
|
|
42880
|
-
const existing =
|
|
43151
|
+
const existing = seen2.get(key);
|
|
42881
43152
|
if (existing) {
|
|
42882
43153
|
addOccurrence2(existing, loc);
|
|
42883
43154
|
} else {
|
|
@@ -42888,7 +43159,7 @@ Href: ${href}`
|
|
|
42888
43159
|
detail: isGradient ? `Add a solid fallback beneath the gradient using its first colour stop.` : `Add a solid background-color so the area still has colour when the image is dropped.`,
|
|
42889
43160
|
fix
|
|
42890
43161
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42891
|
-
|
|
43162
|
+
seen2.set(key, issue);
|
|
42892
43163
|
issues.push(issue);
|
|
42893
43164
|
}
|
|
42894
43165
|
}
|
|
@@ -42897,7 +43168,7 @@ Href: ${href}`
|
|
|
42897
43168
|
const fix = `font-family: ${font.trim()}, Arial, sans-serif;`;
|
|
42898
43169
|
const key = `font:${font.trim().toLowerCase()}`;
|
|
42899
43170
|
const loc = locs == null ? void 0 : locs.get("font-family");
|
|
42900
|
-
const existing =
|
|
43171
|
+
const existing = seen2.get(key);
|
|
42901
43172
|
if (existing) {
|
|
42902
43173
|
addOccurrence2(existing, loc);
|
|
42903
43174
|
} else {
|
|
@@ -42908,7 +43179,7 @@ Href: ${href}`
|
|
|
42908
43179
|
detail: `End the stack with a web-safe font and a generic family.`,
|
|
42909
43180
|
fix
|
|
42910
43181
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42911
|
-
|
|
43182
|
+
seen2.set(key, issue);
|
|
42912
43183
|
issues.push(issue);
|
|
42913
43184
|
}
|
|
42914
43185
|
}
|
|
@@ -42924,12 +43195,12 @@ Href: ${href}`
|
|
|
42924
43195
|
}
|
|
42925
43196
|
function checkVisualFromDom($, source) {
|
|
42926
43197
|
const issues = [];
|
|
42927
|
-
const
|
|
43198
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
42928
43199
|
$("[style]").each((_, el) => {
|
|
42929
43200
|
const attrLoc = locOfAttr(el, "style");
|
|
42930
43201
|
const style = parseInlineStyle($(el).attr("style") || "");
|
|
42931
43202
|
const locs = attrLoc ? new Map([...style.keys()].map((prop) => [prop, attrLoc])) : void 0;
|
|
42932
|
-
inspectDeclarations(style, issues,
|
|
43203
|
+
inspectDeclarations(style, issues, seen2, locs);
|
|
42933
43204
|
});
|
|
42934
43205
|
$("style").each((_, el) => {
|
|
42935
43206
|
const cssText = $(el).text();
|
|
@@ -42950,7 +43221,7 @@ Href: ${href}`
|
|
|
42950
43221
|
const loc = locInCssBlock(anchor, child.loc);
|
|
42951
43222
|
if (loc) locs.set(child.property.toLowerCase(), loc);
|
|
42952
43223
|
});
|
|
42953
|
-
inspectDeclarations(ruleToMap(node), issues,
|
|
43224
|
+
inspectDeclarations(ruleToMap(node), issues, seen2, locs);
|
|
42954
43225
|
}
|
|
42955
43226
|
});
|
|
42956
43227
|
});
|
|
@@ -43066,13 +43337,13 @@ Href: ${href}`
|
|
|
43066
43337
|
return clusters;
|
|
43067
43338
|
}
|
|
43068
43339
|
function distinctValues(values, normalise2) {
|
|
43069
|
-
const
|
|
43340
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
43070
43341
|
for (const raw of values) {
|
|
43071
43342
|
const key = normalise2(raw);
|
|
43072
43343
|
if (!key) continue;
|
|
43073
|
-
if (!
|
|
43344
|
+
if (!seen2.has(key)) seen2.set(key, raw.trim());
|
|
43074
43345
|
}
|
|
43075
|
-
return [...
|
|
43346
|
+
return [...seen2.values()];
|
|
43076
43347
|
}
|
|
43077
43348
|
function checkDesignConsistencyFromDom($) {
|
|
43078
43349
|
const found = collect($);
|
|
@@ -43182,10 +43453,10 @@ Href: ${href}`
|
|
|
43182
43453
|
design: EMPTY_DESIGN
|
|
43183
43454
|
};
|
|
43184
43455
|
function dedupeByElement(issues) {
|
|
43185
|
-
const
|
|
43456
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
43186
43457
|
return issues.filter((issue) => {
|
|
43187
|
-
if (
|
|
43188
|
-
|
|
43458
|
+
if (seen2.has(issue.element)) return false;
|
|
43459
|
+
seen2.add(issue.element);
|
|
43189
43460
|
return true;
|
|
43190
43461
|
});
|
|
43191
43462
|
}
|
|
@@ -43432,7 +43703,7 @@ Href: ${href}`
|
|
|
43432
43703
|
// package.json
|
|
43433
43704
|
var package_default = {
|
|
43434
43705
|
name: "@emailens/cli",
|
|
43435
|
-
version: "0.13.
|
|
43706
|
+
version: "0.13.19",
|
|
43436
43707
|
description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
|
|
43437
43708
|
type: "module",
|
|
43438
43709
|
bin: {
|
|
@@ -43473,7 +43744,8 @@ var package_default = {
|
|
|
43473
43744
|
},
|
|
43474
43745
|
devDependencies: {
|
|
43475
43746
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
43476
|
-
"@emailens/engine": "^0.18.
|
|
43747
|
+
"@emailens/engine": "^0.18.22",
|
|
43748
|
+
"@react-email/components": "1.0.12",
|
|
43477
43749
|
"@types/bun": "^1.4.0",
|
|
43478
43750
|
"@types/mjml": "^4.7.4",
|
|
43479
43751
|
"@types/node": "^25.9.5",
|
|
@@ -43483,6 +43755,9 @@ var package_default = {
|
|
|
43483
43755
|
ora: "^8.2.0",
|
|
43484
43756
|
picocolors: "^1.1.1",
|
|
43485
43757
|
"playwright-core": "^1.62.1",
|
|
43758
|
+
react: "19.3.1",
|
|
43759
|
+
"react-dom": "19.3.1",
|
|
43760
|
+
"react-email": "6.11.8",
|
|
43486
43761
|
tsup: "^8.5.1",
|
|
43487
43762
|
typescript: "^5.9.3"
|
|
43488
43763
|
},
|
|
@@ -46059,6 +46334,57 @@ var inbox_default = defineCommand({
|
|
|
46059
46334
|
subCommands: { wait }
|
|
46060
46335
|
});
|
|
46061
46336
|
|
|
46337
|
+
// src/commands/react-email.ts
|
|
46338
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
46339
|
+
import { spawn } from "child_process";
|
|
46340
|
+
import { watch } from "fs";
|
|
46341
|
+
import { resolve as resolve2 } from "path";
|
|
46342
|
+
var react_email_default = defineCommand({
|
|
46343
|
+
meta: {
|
|
46344
|
+
name: "react-email",
|
|
46345
|
+
description: "Lint every React Email template in this project: no export step, PreviewProps applied. --watch re-checks on save"
|
|
46346
|
+
},
|
|
46347
|
+
args: {
|
|
46348
|
+
dir: { type: "positional", required: false, description: `Emails folder (default: the first of ${EMAIL_DIRS.join(", ")})` },
|
|
46349
|
+
watch: { type: "boolean", alias: "w", description: "Re-check whenever a template changes" },
|
|
46350
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
46351
|
+
info: { type: "boolean", description: "List info findings too" },
|
|
46352
|
+
failOnWarning: { type: "boolean", description: "Exit 2 if warnings found" },
|
|
46353
|
+
skip: { type: "string", description: "Comma-separated checks to skip, as for lint" },
|
|
46354
|
+
"email-type": { type: "string", description: "transactional: sign-in, receipts and alerts need no unsubscribe link" },
|
|
46355
|
+
gate: { type: "boolean", description: "Also run each email through the pre-send gate (Pro, needs EMAILENS_API_KEY)" },
|
|
46356
|
+
"api-key": { type: "string", description: "API key for --gate (default: EMAILENS_API_KEY)" },
|
|
46357
|
+
reporter: { type: "string", description: "github: annotate the pull request" },
|
|
46358
|
+
quiet: { type: "boolean", alias: "q", description: "No hosted-preview line after a failure" }
|
|
46359
|
+
},
|
|
46360
|
+
async run({ args, rawArgs }) {
|
|
46361
|
+
const dir = args.dir ? resolve2(args.dir) : findEmailsDir();
|
|
46362
|
+
if (!dir) {
|
|
46363
|
+
console.error(import_picocolors6.default.red(`No emails folder here. Looked for ${EMAIL_DIRS.join(", ")}; pass the folder: emailens react-email path/to/emails`));
|
|
46364
|
+
process.exit(1);
|
|
46365
|
+
}
|
|
46366
|
+
if (!args.watch) {
|
|
46367
|
+
await lint_default.run({ args: { ...args, input: dir, _: [] }, rawArgs, cmd: lint_default });
|
|
46368
|
+
return;
|
|
46369
|
+
}
|
|
46370
|
+
const passOn = rawArgs.filter((a) => a !== "--watch" && a !== "-w" && a !== args.dir);
|
|
46371
|
+
const check = () => {
|
|
46372
|
+
console.clear();
|
|
46373
|
+
spawn(process.execPath, [process.argv[1], "lint", dir, ...passOn], { stdio: "inherit" }).on(
|
|
46374
|
+
"exit",
|
|
46375
|
+
() => console.log(import_picocolors6.default.dim(`
|
|
46376
|
+
Watching ${dir} for changes. Ctrl+C to stop.`))
|
|
46377
|
+
);
|
|
46378
|
+
};
|
|
46379
|
+
let timer;
|
|
46380
|
+
watch(dir, { recursive: true }, () => {
|
|
46381
|
+
clearTimeout(timer);
|
|
46382
|
+
timer = setTimeout(check, 150);
|
|
46383
|
+
});
|
|
46384
|
+
check();
|
|
46385
|
+
}
|
|
46386
|
+
});
|
|
46387
|
+
|
|
46062
46388
|
// src/index.ts
|
|
46063
46389
|
var main2 = defineCommand({
|
|
46064
46390
|
meta,
|
|
@@ -46070,7 +46396,8 @@ var main2 = defineCommand({
|
|
|
46070
46396
|
fix: fix_default,
|
|
46071
46397
|
audit: audit_default,
|
|
46072
46398
|
lint: lint_default,
|
|
46073
|
-
inbox: inbox_default
|
|
46399
|
+
inbox: inbox_default,
|
|
46400
|
+
"react-email": react_email_default
|
|
46074
46401
|
}
|
|
46075
46402
|
});
|
|
46076
46403
|
runMain(main2);
|