@emailens/cli 0.13.17 → 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-ICIM22UE.js → chunk-J4YQYM4C.js} +683 -215
- package/dist/{chunk-ABDTBRVK.js → chunk-UN26YQF6.js} +6 -5
- package/dist/index.js +463 -145
- package/dist/{react-email-4EWH2SB4-CUKHMPBB.js → react-email-QQA75STN-LT3O7SQP.js} +1 -1
- package/dist/test.js +2 -2
- package/package.json +88 -84
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
|
},
|
|
@@ -36056,7 +36268,9 @@ h1 {
|
|
|
36056
36268
|
dropValues: /radial-gradient\(/i,
|
|
36057
36269
|
// Real Yahoo web drew foodpanda's `url(...) center / cover` logos at their
|
|
36058
36270
|
// 236px and its `0% 0% / 100% 100%` coupon at the picture's own size,
|
|
36059
|
-
// 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).
|
|
36060
36274
|
dropBackgroundSize: true,
|
|
36061
36275
|
// A <style> with a comma-separated media query list is dropped whole: a
|
|
36062
36276
|
// probe on real Yahoo web lost the block for `screen and
|
|
@@ -36088,7 +36302,7 @@ h1 {
|
|
|
36088
36302
|
},
|
|
36089
36303
|
"yahoo-mail-ios": {
|
|
36090
36304
|
id: "yahoo-mail-ios",
|
|
36091
|
-
strippedProperties:
|
|
36305
|
+
strippedProperties: YAHOO_IOS_STRIPPED,
|
|
36092
36306
|
stripMode: "strip",
|
|
36093
36307
|
inlineAndStripStyles: false,
|
|
36094
36308
|
stripExternalStylesheets: false,
|
|
@@ -36180,6 +36394,21 @@ h1 {
|
|
|
36180
36394
|
additionalChecks: superhumanAdditionalChecks
|
|
36181
36395
|
}
|
|
36182
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);
|
|
36183
36412
|
var TEXT_DECORATION_LINE = /^(?:none|underline|overline|line-through|blink)(?:\s+(?:underline|overline|line-through|blink))*\s*(?:!important)?$/i;
|
|
36184
36413
|
var isLineOnly = (value) => TEXT_DECORATION_LINE.test(value.trim());
|
|
36185
36414
|
function dropWarnings(html, config, clientId, framework) {
|
|
@@ -36194,9 +36423,25 @@ h1 {
|
|
|
36194
36423
|
}
|
|
36195
36424
|
function hasDrops(config) {
|
|
36196
36425
|
return Boolean(
|
|
36197
|
-
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
|
|
36198
36427
|
);
|
|
36199
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
|
+
}
|
|
36200
36445
|
function prepareDropSource(html, config) {
|
|
36201
36446
|
if (!hasDrops(config)) return html;
|
|
36202
36447
|
const $ = cheerio3.load(html);
|
|
@@ -36258,9 +36503,16 @@ h1 {
|
|
|
36258
36503
|
enter(node, item, list) {
|
|
36259
36504
|
if (!list || !item) return;
|
|
36260
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;
|
|
36261
36507
|
if (dropAtRules && node.type === "Atrule" && dropAtRules.test(head)) {
|
|
36262
36508
|
list.remove(item);
|
|
36263
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);
|
|
36264
36516
|
} else if (dropSelectors && node.type === "Rule") {
|
|
36265
36517
|
const m = csstree3.generate(node.prelude).match(dropSelectors);
|
|
36266
36518
|
if (m) {
|
|
@@ -36401,8 +36653,13 @@ h1 {
|
|
|
36401
36653
|
if (config.additionalChecks && config.inlineAndStripStyles) {
|
|
36402
36654
|
warnings.push(...config.additionalChecks($, clientId, html, framework));
|
|
36403
36655
|
}
|
|
36656
|
+
applyTargetingSimulation($, clientId);
|
|
36404
36657
|
if (config.inlineAndStripStyles) {
|
|
36405
|
-
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
|
+
);
|
|
36406
36663
|
$("style").remove();
|
|
36407
36664
|
if (preserved.trim()) {
|
|
36408
36665
|
const head = $("head");
|
|
@@ -36494,7 +36751,7 @@ h1 {
|
|
|
36494
36751
|
}
|
|
36495
36752
|
if (config.dropBackgroundSize) {
|
|
36496
36753
|
const SIZE = /url\([^)]*\)|\s*\/\s*(?:cover|contain|auto|[\d.]+(?:px|%|em|rem|vw|vh)?)(?:\s+(?:auto|[\d.]+(?:px|%|em|rem|vw|vh)?))?/gi;
|
|
36497
|
-
const unsize = (css) => css.replace(
|
|
36754
|
+
const unsize = (css) => css.replace(
|
|
36498
36755
|
/(background\s*:[^;}]*)/gi,
|
|
36499
36756
|
(decl) => decl.replace(SIZE, (m) => m.startsWith("url(") ? m : "")
|
|
36500
36757
|
);
|
|
@@ -36593,7 +36850,6 @@ h1 {
|
|
|
36593
36850
|
warnings.push(...config.additionalChecks($, clientId, html, framework));
|
|
36594
36851
|
}
|
|
36595
36852
|
if (isWordEngineClient(clientId)) applyWordBoxModel($);
|
|
36596
|
-
applyTargetingSimulation($, clientId);
|
|
36597
36853
|
return { clientId, html: $.html(), warnings };
|
|
36598
36854
|
}
|
|
36599
36855
|
function transformForClient(html, clientId, framework) {
|
|
@@ -36626,9 +36882,12 @@ h1 {
|
|
|
36626
36882
|
const result = applyTransform(downleveled, config, framework);
|
|
36627
36883
|
if (dropSource !== source) result.warnings.unshift(...dropWarnings(source, config, clientId, framework));
|
|
36628
36884
|
if (wordEngine) result.html = vmlToCss(result.html);
|
|
36629
|
-
if (isWordEngineClient(clientId)) result.html = applyMsoHide(result.html);
|
|
36885
|
+
if (isWordEngineClient(clientId)) result.html = standardsMode(applyMsoHide(result.html));
|
|
36630
36886
|
return result;
|
|
36631
36887
|
}
|
|
36888
|
+
function standardsMode(html) {
|
|
36889
|
+
return /^\s*(?:<!--[\s\S]*?-->\s*)*<!doctype/i.test(html) ? html : `<!DOCTYPE html>${html}`;
|
|
36890
|
+
}
|
|
36632
36891
|
function transformForAllClients2(html, framework) {
|
|
36633
36892
|
if (!html || !html.trim()) {
|
|
36634
36893
|
return Object.keys(CLIENT_CONFIGS).map((clientId) => ({
|
|
@@ -36671,7 +36930,7 @@ h1 {
|
|
|
36671
36930
|
result = applyTransformDom(clientDom, source, config, framework);
|
|
36672
36931
|
}
|
|
36673
36932
|
if (wordEngine) result.html = vmlToCss(result.html);
|
|
36674
|
-
if (isWordEngineClient(clientId)) result.html = applyMsoHide(result.html);
|
|
36933
|
+
if (isWordEngineClient(clientId)) result.html = standardsMode(applyMsoHide(result.html));
|
|
36675
36934
|
return result;
|
|
36676
36935
|
});
|
|
36677
36936
|
}
|
|
@@ -37884,9 +38143,9 @@ h1 {
|
|
|
37884
38143
|
}
|
|
37885
38144
|
if (parts.length === classes.length && classes.length === 1) {
|
|
37886
38145
|
const name = classes[0].name;
|
|
37887
|
-
const
|
|
37888
|
-
for (const p of props)
|
|
37889
|
-
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);
|
|
37890
38149
|
}
|
|
37891
38150
|
}
|
|
37892
38151
|
}
|
|
@@ -38015,18 +38274,18 @@ h1 {
|
|
|
38015
38274
|
const names = ((_a2 = $(el).attr("class")) != null ? _a2 : "").split(/\s+/).filter(Boolean);
|
|
38016
38275
|
if (names.length < 2) return;
|
|
38017
38276
|
const loc = locOfElement(el);
|
|
38018
|
-
const
|
|
38277
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
38019
38278
|
for (const sheet of sheets) {
|
|
38020
38279
|
for (const name of names) {
|
|
38021
38280
|
for (const prop of (_b = sheet.propsByClass.get(name)) != null ? _b : []) {
|
|
38022
|
-
const first =
|
|
38281
|
+
const first = seen2.get(prop);
|
|
38023
38282
|
if (first && first !== name) {
|
|
38024
38283
|
conflictExample || (conflictExample = `.${first} and .${name} both set ${prop}`);
|
|
38025
38284
|
conflictCount++;
|
|
38026
38285
|
if (loc) conflicting.push(loc);
|
|
38027
38286
|
return;
|
|
38028
38287
|
}
|
|
38029
|
-
if (!first)
|
|
38288
|
+
if (!first) seen2.set(prop, name);
|
|
38030
38289
|
}
|
|
38031
38290
|
}
|
|
38032
38291
|
if (names.some((n) => sheet.classesWithDescendants.has(n))) {
|
|
@@ -38087,7 +38346,7 @@ h1 {
|
|
|
38087
38346
|
const found = { selector: "", props: [], elements: [], inherits: false };
|
|
38088
38347
|
const body = $("body").first();
|
|
38089
38348
|
if (!body.length) return found;
|
|
38090
|
-
const
|
|
38349
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
38091
38350
|
const props = /* @__PURE__ */ new Set();
|
|
38092
38351
|
for (const el of $("style").toArray()) {
|
|
38093
38352
|
let ast;
|
|
@@ -38135,8 +38394,8 @@ h1 {
|
|
|
38135
38394
|
if (value === "inherit") found.inherits = true;
|
|
38136
38395
|
hit2 = true;
|
|
38137
38396
|
}
|
|
38138
|
-
if (hit2 && !
|
|
38139
|
-
|
|
38397
|
+
if (hit2 && !seen2.has(target)) {
|
|
38398
|
+
seen2.add(target);
|
|
38140
38399
|
found.elements.push(target);
|
|
38141
38400
|
found.selector || (found.selector = text.trim());
|
|
38142
38401
|
}
|
|
@@ -38224,8 +38483,8 @@ h1 {
|
|
|
38224
38483
|
);
|
|
38225
38484
|
return m ? (_a2 = m[1]) != null ? _a2 : m[2] : void 0;
|
|
38226
38485
|
}
|
|
38227
|
-
function add(issues,
|
|
38228
|
-
const existing =
|
|
38486
|
+
function add(issues, seen2, key, issue) {
|
|
38487
|
+
const existing = seen2.get(key);
|
|
38229
38488
|
if (existing) {
|
|
38230
38489
|
if (!issue.loc || !existing.locs) return;
|
|
38231
38490
|
if (existing.locs.some((l) => l.offset === issue.loc.offset)) return;
|
|
@@ -38236,32 +38495,32 @@ h1 {
|
|
|
38236
38495
|
existing.locs.push(issue.loc);
|
|
38237
38496
|
return;
|
|
38238
38497
|
}
|
|
38239
|
-
|
|
38498
|
+
seen2.set(key, issue);
|
|
38240
38499
|
issues.push(issue);
|
|
38241
38500
|
}
|
|
38242
38501
|
function withLoc(issue, loc) {
|
|
38243
38502
|
return loc ? __spreadProps(__spreadValues({}, issue), { loc, locs: [loc] }) : issue;
|
|
38244
38503
|
}
|
|
38245
38504
|
var TEXT_HOSTS = /<\s*(center|v:textbox|div|p|table|h[1-6]|span|font|a)\b/i;
|
|
38246
|
-
function checkLooseText(issues,
|
|
38505
|
+
function checkLooseText(issues, seen2, open, inner, source) {
|
|
38247
38506
|
if (TEXT_HOSTS.test(inner)) return;
|
|
38248
38507
|
const text = inner.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^>]*>/g, "").replace(/ |\s/g, "");
|
|
38249
38508
|
if (text === "") return;
|
|
38250
|
-
add(issues,
|
|
38509
|
+
add(issues, seen2, `loosetext:${open.name}`, withLoc({
|
|
38251
38510
|
rule: "vml-unrendered-text",
|
|
38252
38511
|
severity: "error",
|
|
38253
38512
|
message: `<v:${open.name}> has label text with no element around it, which Outlook does not draw.`,
|
|
38254
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>.`
|
|
38255
38514
|
}, locAt(source, open.offset, open.length)));
|
|
38256
38515
|
}
|
|
38257
|
-
function checkFillPicture(issues,
|
|
38516
|
+
function checkFillPicture(issues, seen2, open, inner, source) {
|
|
38258
38517
|
if (/<v:imagedata\b/i.test(inner)) return;
|
|
38259
38518
|
const fill = inner.match(/<v:fill\b([^>]*)>/i);
|
|
38260
38519
|
if (!fill || attr(fill[1], "src") === void 0) return;
|
|
38261
38520
|
const label = inner.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^>]*>/g, "").replace(/ |\s/g, "");
|
|
38262
38521
|
const picture2 = label === "";
|
|
38263
38522
|
const measured = `Measured on real Outlook: 2007 and 2010 draw the picture, but 2013, 2016 and 2019 show only the fill's colour.`;
|
|
38264
|
-
add(issues,
|
|
38523
|
+
add(issues, seen2, `fillpicture:${open.name}`, withLoc(picture2 ? {
|
|
38265
38524
|
rule: "vml-roundrect-fill-picture",
|
|
38266
38525
|
severity: "error",
|
|
38267
38526
|
message: `<v:roundrect> paints its picture with <v:fill src>, which Outlook 2013, 2016 and 2019 leave blank.`,
|
|
@@ -38293,7 +38552,7 @@ h1 {
|
|
|
38293
38552
|
}
|
|
38294
38553
|
return tags;
|
|
38295
38554
|
}
|
|
38296
|
-
function checkGhostTables(issues,
|
|
38555
|
+
function checkGhostTables(issues, seen2, blocks, source) {
|
|
38297
38556
|
var _a2;
|
|
38298
38557
|
const tags = ghostTags(blocks);
|
|
38299
38558
|
if (tags.length === 0) return;
|
|
@@ -38311,7 +38570,7 @@ h1 {
|
|
|
38311
38570
|
for (const [name, list] of opens) {
|
|
38312
38571
|
if (!GHOST_TAGS.has(name)) continue;
|
|
38313
38572
|
for (const tag of list.slice(0, 1)) {
|
|
38314
|
-
add(issues,
|
|
38573
|
+
add(issues, seen2, `ghost-open:${name}`, withLoc({
|
|
38315
38574
|
rule: "ghost-table-unbalanced",
|
|
38316
38575
|
severity: "error",
|
|
38317
38576
|
message: `<${name}> is opened inside an Outlook conditional comment and never closed.`,
|
|
@@ -38320,7 +38579,7 @@ h1 {
|
|
|
38320
38579
|
}
|
|
38321
38580
|
}
|
|
38322
38581
|
for (const tag of strays.slice(0, 1)) {
|
|
38323
|
-
add(issues,
|
|
38582
|
+
add(issues, seen2, `ghost-stray:${tag.name}`, withLoc({
|
|
38324
38583
|
rule: "ghost-table-unbalanced",
|
|
38325
38584
|
severity: "error",
|
|
38326
38585
|
message: `Closing </${tag.name}> inside an Outlook conditional comment has no matching opening tag.`,
|
|
@@ -38334,8 +38593,8 @@ h1 {
|
|
|
38334
38593
|
const blocks = msoBlocks(html);
|
|
38335
38594
|
const tags = vmlTags(blocks);
|
|
38336
38595
|
const issues = [];
|
|
38337
|
-
const
|
|
38338
|
-
checkGhostTables(issues,
|
|
38596
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
38597
|
+
checkGhostTables(issues, seen2, blocks, source);
|
|
38339
38598
|
if (tags.length === 0) return { hasVml: false, issues };
|
|
38340
38599
|
const openShapes = [];
|
|
38341
38600
|
let groupDepth = 0;
|
|
@@ -38351,11 +38610,11 @@ h1 {
|
|
|
38351
38610
|
if (idx !== -1) {
|
|
38352
38611
|
const open = openShapes[idx];
|
|
38353
38612
|
const inner = html.slice(open.offset + open.length, tag.offset);
|
|
38354
|
-
checkLooseText(issues,
|
|
38355
|
-
if (name === "roundrect") checkFillPicture(issues,
|
|
38613
|
+
checkLooseText(issues, seen2, open, inner, source);
|
|
38614
|
+
if (name === "roundrect") checkFillPicture(issues, seen2, open, inner, source);
|
|
38356
38615
|
}
|
|
38357
38616
|
if (idx === -1) {
|
|
38358
|
-
add(issues,
|
|
38617
|
+
add(issues, seen2, `stray:${name}`, withLoc({
|
|
38359
38618
|
rule: "vml-unbalanced-tag",
|
|
38360
38619
|
severity: "error",
|
|
38361
38620
|
message: `Closing </v:${name}> has no matching opening tag.`,
|
|
@@ -38371,7 +38630,7 @@ h1 {
|
|
|
38371
38630
|
if (isShape) {
|
|
38372
38631
|
const parent = openShapes[openShapes.length - 1];
|
|
38373
38632
|
if (parent && groupDepth === 0) {
|
|
38374
|
-
add(issues,
|
|
38633
|
+
add(issues, seen2, `nested:${parent.name}>${name}`, withLoc({
|
|
38375
38634
|
rule: "vml-nested-shape",
|
|
38376
38635
|
severity: "error",
|
|
38377
38636
|
message: `<v:${name}> is nested inside <v:${parent.name}>. Outlook does not support nesting one VML shape inside another.`,
|
|
@@ -38400,7 +38659,7 @@ h1 {
|
|
|
38400
38659
|
if (!m) continue;
|
|
38401
38660
|
const value = m[1].trim();
|
|
38402
38661
|
if (value === "" || /^[a-z%]+$/i.test(value)) {
|
|
38403
|
-
add(issues,
|
|
38662
|
+
add(issues, seen2, `dim:${name}:${prop}:${value}`, withLoc({
|
|
38404
38663
|
rule: "vml-invalid-dimension",
|
|
38405
38664
|
severity: "error",
|
|
38406
38665
|
message: `<v:${name}> has an invalid ${prop}: "${prop}:${value}" is missing its number.`,
|
|
@@ -38415,7 +38674,7 @@ h1 {
|
|
|
38415
38674
|
const raw = arcsize.trim();
|
|
38416
38675
|
const pct = raw.endsWith("%") ? parseFloat(raw) : parseFloat(raw) * 100;
|
|
38417
38676
|
if (Number.isFinite(pct) && (pct < 0 || pct > 100)) {
|
|
38418
|
-
add(issues,
|
|
38677
|
+
add(issues, seen2, `arcsize:${raw}`, withLoc({
|
|
38419
38678
|
rule: "vml-arcsize-range",
|
|
38420
38679
|
severity: "warning",
|
|
38421
38680
|
message: `<v:roundrect> has arcsize="${raw}", outside the valid 0%\u2013100% range.`,
|
|
@@ -38426,7 +38685,7 @@ h1 {
|
|
|
38426
38685
|
}
|
|
38427
38686
|
}
|
|
38428
38687
|
for (const tag of openShapes) {
|
|
38429
|
-
add(issues,
|
|
38688
|
+
add(issues, seen2, `unclosed:${tag.name}`, withLoc({
|
|
38430
38689
|
rule: "vml-unbalanced-tag",
|
|
38431
38690
|
severity: "error",
|
|
38432
38691
|
message: `<v:${tag.name}> is never closed.`,
|
|
@@ -38434,7 +38693,7 @@ h1 {
|
|
|
38434
38693
|
}, locAt(source, tag.offset, tag.length)));
|
|
38435
38694
|
}
|
|
38436
38695
|
if (/<head[\s>]/i.test(html) && !/<o:PixelsPerInch[\s>]/i.test(html)) {
|
|
38437
|
-
add(issues,
|
|
38696
|
+
add(issues, seen2, "ppi", withLoc({
|
|
38438
38697
|
rule: "vml-pixels-per-inch",
|
|
38439
38698
|
severity: "warning",
|
|
38440
38699
|
message: `This email uses VML but does not declare <o:PixelsPerInch>96</o:PixelsPerInch>.`,
|
|
@@ -38458,6 +38717,9 @@ h1 {
|
|
|
38458
38717
|
next = adjustBody(live$, next);
|
|
38459
38718
|
return appendKillers(next, html, wordHtml, vml, framework);
|
|
38460
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
|
+
);
|
|
38461
38723
|
var hit = (re) => (style) => re.test(style);
|
|
38462
38724
|
var LAYER_TOKEN = {
|
|
38463
38725
|
image: null,
|
|
@@ -38514,7 +38776,7 @@ h1 {
|
|
|
38514
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);
|
|
38515
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);
|
|
38516
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);
|
|
38517
|
-
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);
|
|
38518
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);
|
|
38519
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);
|
|
38520
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);
|
|
@@ -38943,12 +39205,12 @@ h1 {
|
|
|
38943
39205
|
}
|
|
38944
39206
|
function appendKillers(warnings, html, wordHtml, vml, framework) {
|
|
38945
39207
|
const extra = [];
|
|
38946
|
-
const
|
|
39208
|
+
const seen2 = new Set(warnings.map((w) => `${w.client}:${w.property}`));
|
|
38947
39209
|
const push = (client, property, severity, message) => {
|
|
38948
39210
|
var _a2;
|
|
38949
39211
|
const key = `${client}:${property}`;
|
|
38950
|
-
if (
|
|
38951
|
-
|
|
39212
|
+
if (seen2.has(key)) return;
|
|
39213
|
+
seen2.add(key);
|
|
38952
39214
|
extra.push({
|
|
38953
39215
|
severity,
|
|
38954
39216
|
client,
|
|
@@ -39088,11 +39350,11 @@ h1 {
|
|
|
39088
39350
|
suggestion: "Avoid client-specific hacks in strict mode, or switch to progressive targeting policy."
|
|
39089
39351
|
};
|
|
39090
39352
|
}
|
|
39091
|
-
function recordMatch(report,
|
|
39092
|
-
if (
|
|
39353
|
+
function recordMatch(report, seen2, matcher, policy, matchedText, selector) {
|
|
39354
|
+
if (seen2.has(matcher.id)) return;
|
|
39093
39355
|
const hack = targetingHackForMatcher(matcher);
|
|
39094
39356
|
if (!hack) return;
|
|
39095
|
-
|
|
39357
|
+
seen2.add(matcher.id);
|
|
39096
39358
|
report.detectedHacks.push({
|
|
39097
39359
|
hack,
|
|
39098
39360
|
foundIn: matcher.foundIn,
|
|
@@ -39102,14 +39364,14 @@ h1 {
|
|
|
39102
39364
|
const warning = applyLint(matcher, hack, policy, { matchedText, selector });
|
|
39103
39365
|
if (warning) report.warnings.push(warning);
|
|
39104
39366
|
}
|
|
39105
|
-
function scanHtmlForTargeting(html, report,
|
|
39367
|
+
function scanHtmlForTargeting(html, report, seen2, policy) {
|
|
39106
39368
|
for (const matcher of HTML_MATCHERS) {
|
|
39107
39369
|
const match = html.match(matcher.pattern);
|
|
39108
39370
|
if (!match) continue;
|
|
39109
|
-
recordMatch(report,
|
|
39371
|
+
recordMatch(report, seen2, matcher, policy, match[0]);
|
|
39110
39372
|
}
|
|
39111
39373
|
}
|
|
39112
|
-
function scanCssAstForTargeting(ast, report,
|
|
39374
|
+
function scanCssAstForTargeting(ast, report, seen2, policy) {
|
|
39113
39375
|
csstree8.walk(ast, {
|
|
39114
39376
|
visit: "Rule",
|
|
39115
39377
|
enter(node) {
|
|
@@ -39118,7 +39380,7 @@ h1 {
|
|
|
39118
39380
|
const selectorText = csstree8.generate(child).trim();
|
|
39119
39381
|
for (const matcher of SELECTOR_MATCHERS) {
|
|
39120
39382
|
if (matcher.pattern.test(selectorText)) {
|
|
39121
|
-
recordMatch(report,
|
|
39383
|
+
recordMatch(report, seen2, matcher, policy, selectorText, selectorText);
|
|
39122
39384
|
}
|
|
39123
39385
|
}
|
|
39124
39386
|
});
|
|
@@ -39132,13 +39394,13 @@ h1 {
|
|
|
39132
39394
|
const haystack = `@${node.name} ${atRulePrelude}`;
|
|
39133
39395
|
for (const matcher of ATRULE_MATCHERS) {
|
|
39134
39396
|
if (matcher.pattern.test(atRulePrelude) || matcher.pattern.test(haystack)) {
|
|
39135
|
-
recordMatch(report,
|
|
39397
|
+
recordMatch(report, seen2, matcher, policy, haystack);
|
|
39136
39398
|
}
|
|
39137
39399
|
}
|
|
39138
39400
|
}
|
|
39139
39401
|
});
|
|
39140
39402
|
}
|
|
39141
|
-
function scanStyleBlocks(html, report,
|
|
39403
|
+
function scanStyleBlocks(html, report, seen2, policy) {
|
|
39142
39404
|
const styleRegex = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
39143
39405
|
let styleMatch;
|
|
39144
39406
|
while ((styleMatch = styleRegex.exec(html)) !== null) {
|
|
@@ -39148,14 +39410,14 @@ h1 {
|
|
|
39148
39410
|
} catch (e) {
|
|
39149
39411
|
continue;
|
|
39150
39412
|
}
|
|
39151
|
-
scanCssAstForTargeting(ast, report,
|
|
39413
|
+
scanCssAstForTargeting(ast, report, seen2, policy);
|
|
39152
39414
|
}
|
|
39153
39415
|
}
|
|
39154
39416
|
function checkTargetingHacks(html, policy = "progressive") {
|
|
39155
39417
|
const report = emptyTargetingReport();
|
|
39156
|
-
const
|
|
39157
|
-
scanHtmlForTargeting(html, report,
|
|
39158
|
-
scanStyleBlocks(html, report,
|
|
39418
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
39419
|
+
scanHtmlForTargeting(html, report, seen2, policy);
|
|
39420
|
+
scanStyleBlocks(html, report, seen2, policy);
|
|
39159
39421
|
return report;
|
|
39160
39422
|
}
|
|
39161
39423
|
var WORD_ENGINE_CLIENT = "outlook-windows-legacy";
|
|
@@ -39428,24 +39690,24 @@ h1 {
|
|
|
39428
39690
|
if (!cssLoc) return;
|
|
39429
39691
|
const loc = locInCssBlock(blockAnchor, cssLoc);
|
|
39430
39692
|
if (!loc) return;
|
|
39431
|
-
const
|
|
39432
|
-
if (!
|
|
39693
|
+
const seen2 = selectorLocs.get(key);
|
|
39694
|
+
if (!seen2) {
|
|
39433
39695
|
selectorLocs.set(key, { locs: [loc], scopes: [scope != null ? scope : null] });
|
|
39434
39696
|
return;
|
|
39435
39697
|
}
|
|
39436
|
-
if (
|
|
39437
|
-
if (
|
|
39438
|
-
|
|
39698
|
+
if (seen2.locs.some((l) => l.offset === loc.offset)) return;
|
|
39699
|
+
if (seen2.locs.length >= MAX_WARNING_LOCATIONS) {
|
|
39700
|
+
seen2.truncated = true;
|
|
39439
39701
|
return;
|
|
39440
39702
|
}
|
|
39441
|
-
|
|
39442
|
-
if (
|
|
39703
|
+
seen2.locs.push(loc);
|
|
39704
|
+
if (seen2.scopes) seen2.scopes.push(scope != null ? scope : null);
|
|
39443
39705
|
}
|
|
39444
39706
|
function recordLoc(key, cssLoc, value, scope) {
|
|
39445
39707
|
const loc = locInCssBlock(blockAnchor, cssLoc);
|
|
39446
39708
|
if (!loc) return;
|
|
39447
|
-
const
|
|
39448
|
-
if (!
|
|
39709
|
+
const seen2 = propertyLocs.get(key);
|
|
39710
|
+
if (!seen2) {
|
|
39449
39711
|
propertyLocs.set(key, __spreadProps(__spreadValues({
|
|
39450
39712
|
locs: [loc]
|
|
39451
39713
|
}, value !== void 0 ? { values: [value] } : {}), {
|
|
@@ -39453,14 +39715,14 @@ h1 {
|
|
|
39453
39715
|
}));
|
|
39454
39716
|
return;
|
|
39455
39717
|
}
|
|
39456
|
-
if (
|
|
39457
|
-
if (
|
|
39458
|
-
|
|
39718
|
+
if (seen2.locs.some((l) => l.offset === loc.offset)) return;
|
|
39719
|
+
if (seen2.locs.length >= MAX_WARNING_LOCATIONS) {
|
|
39720
|
+
seen2.truncated = true;
|
|
39459
39721
|
return;
|
|
39460
39722
|
}
|
|
39461
|
-
|
|
39462
|
-
if (
|
|
39463
|
-
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);
|
|
39464
39726
|
}
|
|
39465
39727
|
$("style").each((_, el) => {
|
|
39466
39728
|
const cssText = $(el).text();
|
|
@@ -40308,11 +40570,11 @@ Client-agnostic rendering bugs. Apply each fix directly to the code.
|
|
|
40308
40570
|
return { warnings, truncated: false, removed: 0 };
|
|
40309
40571
|
}
|
|
40310
40572
|
let result = [...warnings];
|
|
40311
|
-
const
|
|
40573
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
40312
40574
|
result = result.filter((w) => {
|
|
40313
40575
|
const key = `${w.property}:${w.severity}`;
|
|
40314
|
-
if (
|
|
40315
|
-
|
|
40576
|
+
if (seen2.has(key)) return false;
|
|
40577
|
+
seen2.add(key);
|
|
40316
40578
|
return true;
|
|
40317
40579
|
});
|
|
40318
40580
|
if (estimateFits(result, html, maxTokens)) {
|
|
@@ -40973,7 +41235,7 @@ ${targetingFixBullets()}
|
|
|
40973
41235
|
}
|
|
40974
41236
|
function checkUrlShorteners($) {
|
|
40975
41237
|
const issues = [];
|
|
40976
|
-
const
|
|
41238
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
40977
41239
|
$("a[href]").each((_, el) => {
|
|
40978
41240
|
const href = $(el).attr("href") || "";
|
|
40979
41241
|
let hostname;
|
|
@@ -40983,8 +41245,8 @@ ${targetingFixBullets()}
|
|
|
40983
41245
|
return;
|
|
40984
41246
|
}
|
|
40985
41247
|
for (const shortener of URL_SHORTENERS) {
|
|
40986
|
-
if ((hostname === shortener || hostname.endsWith("." + shortener)) && !
|
|
40987
|
-
|
|
41248
|
+
if ((hostname === shortener || hostname.endsWith("." + shortener)) && !seen2.has(shortener)) {
|
|
41249
|
+
seen2.add(shortener);
|
|
40988
41250
|
issues.push({
|
|
40989
41251
|
rule: "url-shortener",
|
|
40990
41252
|
severity: "warning",
|
|
@@ -41672,7 +41934,7 @@ Href: ${href}`
|
|
|
41672
41934
|
});
|
|
41673
41935
|
if (!decls.length) return;
|
|
41674
41936
|
for (const selector of splitTopLevel(selectorList).map((x) => x.trim()).filter(Boolean)) {
|
|
41675
|
-
const
|
|
41937
|
+
const specificity3 = specificityOf(selector);
|
|
41676
41938
|
let matched;
|
|
41677
41939
|
try {
|
|
41678
41940
|
matched = $(selector).toArray();
|
|
@@ -41684,7 +41946,7 @@ Href: ${href}`
|
|
|
41684
41946
|
record(el, d.prop, __spreadProps(__spreadValues({}, d), {
|
|
41685
41947
|
inline: false,
|
|
41686
41948
|
presentational: false,
|
|
41687
|
-
specificity:
|
|
41949
|
+
specificity: specificity3,
|
|
41688
41950
|
order: order++
|
|
41689
41951
|
}));
|
|
41690
41952
|
}
|
|
@@ -41998,10 +42260,10 @@ Href: ${href}`
|
|
|
41998
42260
|
return issues.filter((i) => i.rule === "low-contrast");
|
|
41999
42261
|
}
|
|
42000
42262
|
function contrastDelta(candidates, baseline, rule, prefix, details) {
|
|
42001
|
-
const
|
|
42263
|
+
const seen2 = new Set(lowContrastOnly(baseline).map((i) => i.element));
|
|
42002
42264
|
return lowContrastOnly(candidates).filter((issue) => {
|
|
42003
|
-
if (
|
|
42004
|
-
|
|
42265
|
+
if (seen2.has(issue.element)) return false;
|
|
42266
|
+
seen2.add(issue.element);
|
|
42005
42267
|
return true;
|
|
42006
42268
|
}).map((issue) => __spreadProps(__spreadValues(__spreadValues({
|
|
42007
42269
|
severity: issue.severity,
|
|
@@ -42512,15 +42774,15 @@ Href: ${href}`
|
|
|
42512
42774
|
function checkTemplateVariablesFromDom($, source) {
|
|
42513
42775
|
var _a2;
|
|
42514
42776
|
const issues = [];
|
|
42515
|
-
const
|
|
42777
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
42516
42778
|
const textNodes = visibleTextNodes($);
|
|
42517
42779
|
const positioned = textNodes.some((n) => n.sourceCodeLocation);
|
|
42518
42780
|
for (const node of positioned ? textNodes : []) {
|
|
42519
42781
|
const data = (_a2 = node.data) != null ? _a2 : "";
|
|
42520
42782
|
for (const { variable, label, index } of findVariables(data)) {
|
|
42521
42783
|
const key = `text:${variable}`;
|
|
42522
|
-
if (
|
|
42523
|
-
|
|
42784
|
+
if (seen2.has(key)) continue;
|
|
42785
|
+
seen2.add(key);
|
|
42524
42786
|
const loc = locInTextNode(node, index, variable.length, source);
|
|
42525
42787
|
issues.push(__spreadValues({
|
|
42526
42788
|
rule: "unresolved-variable",
|
|
@@ -42537,8 +42799,8 @@ Href: ${href}`
|
|
|
42537
42799
|
}).join("");
|
|
42538
42800
|
for (const { variable, label } of findVariables(textContent)) {
|
|
42539
42801
|
const key = `text:${variable}`;
|
|
42540
|
-
if (
|
|
42541
|
-
|
|
42802
|
+
if (seen2.has(key)) continue;
|
|
42803
|
+
seen2.add(key);
|
|
42542
42804
|
issues.push({
|
|
42543
42805
|
rule: "unresolved-variable",
|
|
42544
42806
|
severity: "error",
|
|
@@ -42556,8 +42818,8 @@ Href: ${href}`
|
|
|
42556
42818
|
if (!value) continue;
|
|
42557
42819
|
for (const { variable, label } of findVariables(value)) {
|
|
42558
42820
|
const key = `attr:${attr2}:${variable}`;
|
|
42559
|
-
if (
|
|
42560
|
-
|
|
42821
|
+
if (seen2.has(key)) continue;
|
|
42822
|
+
seen2.add(key);
|
|
42561
42823
|
const loc = locOfAttr(el, attr2);
|
|
42562
42824
|
const espLink = attr2 === "href" && ESP_SYSTEM_LINK.test(variable);
|
|
42563
42825
|
issues.push(__spreadValues({
|
|
@@ -42597,9 +42859,9 @@ Href: ${href}`
|
|
|
42597
42859
|
if (maxMatch && parseInt(maxMatch[1], 10) <= EMAIL_MAX_WIDTH) return true;
|
|
42598
42860
|
return false;
|
|
42599
42861
|
}
|
|
42600
|
-
function addWidthIssue(width, label, issues,
|
|
42862
|
+
function addWidthIssue(width, label, issues, seen2, loc) {
|
|
42601
42863
|
const key = `w:${label}:${width}`;
|
|
42602
|
-
const existing =
|
|
42864
|
+
const existing = seen2.get(key);
|
|
42603
42865
|
if (existing) {
|
|
42604
42866
|
addOccurrence(existing, loc);
|
|
42605
42867
|
return;
|
|
@@ -42610,7 +42872,7 @@ Href: ${href}`
|
|
|
42610
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.`,
|
|
42611
42873
|
detail: `Use width:100% with max-width:${EMAIL_MAX_WIDTH}px instead of a fixed width beyond the frame.`
|
|
42612
42874
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42613
|
-
|
|
42875
|
+
seen2.set(key, issue);
|
|
42614
42876
|
issues.push(issue);
|
|
42615
42877
|
}
|
|
42616
42878
|
function locateInNodes(nodes, starts, index, length, source) {
|
|
@@ -42645,7 +42907,7 @@ Href: ${href}`
|
|
|
42645
42907
|
function checkOverflowFromDom($, source) {
|
|
42646
42908
|
var _a2;
|
|
42647
42909
|
const issues = [];
|
|
42648
|
-
const
|
|
42910
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
42649
42911
|
const tokensSeen = /* @__PURE__ */ new Set();
|
|
42650
42912
|
$("[width], [style*='width']").each((_, el) => {
|
|
42651
42913
|
const $el = $(el);
|
|
@@ -42654,7 +42916,7 @@ Href: ${href}`
|
|
|
42654
42916
|
if (isFluid($el.attr("style") || "")) return;
|
|
42655
42917
|
const tag = (el.tagName || "element").toLowerCase();
|
|
42656
42918
|
const fromStyle = /(?:^|[;\s])width\s*:\s*\d+px/i.test($el.attr("style") || "");
|
|
42657
|
-
addWidthIssue(width, `<${tag}>`, issues,
|
|
42919
|
+
addWidthIssue(width, `<${tag}>`, issues, seen2, locOfAttr(el, fromStyle ? "style" : "width"));
|
|
42658
42920
|
});
|
|
42659
42921
|
$("style").each((_, el) => {
|
|
42660
42922
|
const cssText = $(el).text();
|
|
@@ -42689,7 +42951,7 @@ Href: ${href}`
|
|
|
42689
42951
|
});
|
|
42690
42952
|
if (widthPx !== null && widthPx > EMAIL_MAX_WIDTH && !fluid) {
|
|
42691
42953
|
const selector = csstree11.generate(node.prelude).trim().slice(0, 40);
|
|
42692
|
-
addWidthIssue(widthPx, selector || "rule", issues,
|
|
42954
|
+
addWidthIssue(widthPx, selector || "rule", issues, seen2, widthLoc);
|
|
42693
42955
|
}
|
|
42694
42956
|
}
|
|
42695
42957
|
});
|
|
@@ -42719,7 +42981,7 @@ Href: ${href}`
|
|
|
42719
42981
|
}
|
|
42720
42982
|
if (!rowHasFluid && explicitCellCount >= 2 && rowFixedPx > EMAIL_MAX_WIDTH) {
|
|
42721
42983
|
const key = `row:${rowFixedPx}:${explicitCellCount}`;
|
|
42722
|
-
if (!
|
|
42984
|
+
if (!seen2.has(key)) {
|
|
42723
42985
|
const loc = locOfElement(trEl) || locOfElement(tableEl);
|
|
42724
42986
|
const issue = __spreadValues({
|
|
42725
42987
|
rule: "table-row-overflow",
|
|
@@ -42727,7 +42989,7 @@ Href: ${href}`
|
|
|
42727
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.`,
|
|
42728
42990
|
detail: `Make columns fluid with percentage widths (e.g. width:50%) or stack columns vertically on small screens.`
|
|
42729
42991
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42730
|
-
|
|
42992
|
+
seen2.set(key, issue);
|
|
42731
42993
|
issues.push(issue);
|
|
42732
42994
|
}
|
|
42733
42995
|
}
|
|
@@ -42744,7 +43006,7 @@ Href: ${href}`
|
|
|
42744
43006
|
const parentWidth = fixedPxWidth($parent);
|
|
42745
43007
|
if (parentWidth !== null && parentWidth > 0 && imgWidth > parentWidth) {
|
|
42746
43008
|
const key = `img-overflow:${imgWidth}:${parentWidth}`;
|
|
42747
|
-
if (!
|
|
43009
|
+
if (!seen2.has(key)) {
|
|
42748
43010
|
const loc = locOfAttr(imgEl, "width") || locOfElement(imgEl);
|
|
42749
43011
|
const issue = __spreadValues({
|
|
42750
43012
|
rule: "image-container-overflow",
|
|
@@ -42752,7 +43014,7 @@ Href: ${href}`
|
|
|
42752
43014
|
message: `<img> has fixed width ${imgWidth}px exceeding its container's width (${parentWidth}px); it will blow out the layout.`,
|
|
42753
43015
|
detail: `Set width:100% with max-width:${imgWidth}px or reduce the image width to fit within ${parentWidth}px.`
|
|
42754
43016
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42755
|
-
|
|
43017
|
+
seen2.set(key, issue);
|
|
42756
43018
|
issues.push(issue);
|
|
42757
43019
|
}
|
|
42758
43020
|
}
|
|
@@ -42876,7 +43138,7 @@ Href: ${href}`
|
|
|
42876
43138
|
}
|
|
42877
43139
|
issue.locs.push(loc);
|
|
42878
43140
|
}
|
|
42879
|
-
function inspectDeclarations(style, issues,
|
|
43141
|
+
function inspectDeclarations(style, issues, seen2, locs) {
|
|
42880
43142
|
var _a2, _b, _c;
|
|
42881
43143
|
const combined = `${(_a2 = style.get("background-image")) != null ? _a2 : ""} ${(_b = style.get("background")) != null ? _b : ""}`;
|
|
42882
43144
|
const isGradient = GRADIENT_RE.test(combined);
|
|
@@ -42886,7 +43148,7 @@ Href: ${href}`
|
|
|
42886
43148
|
const fix = stop ? `background-color: ${stop};` : `background-color: <solid colour matching the image>;`;
|
|
42887
43149
|
const key = `bg:${fix}`;
|
|
42888
43150
|
const loc = (_c = locs == null ? void 0 : locs.get("background-image")) != null ? _c : locs == null ? void 0 : locs.get("background");
|
|
42889
|
-
const existing =
|
|
43151
|
+
const existing = seen2.get(key);
|
|
42890
43152
|
if (existing) {
|
|
42891
43153
|
addOccurrence2(existing, loc);
|
|
42892
43154
|
} else {
|
|
@@ -42897,7 +43159,7 @@ Href: ${href}`
|
|
|
42897
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.`,
|
|
42898
43160
|
fix
|
|
42899
43161
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42900
|
-
|
|
43162
|
+
seen2.set(key, issue);
|
|
42901
43163
|
issues.push(issue);
|
|
42902
43164
|
}
|
|
42903
43165
|
}
|
|
@@ -42906,7 +43168,7 @@ Href: ${href}`
|
|
|
42906
43168
|
const fix = `font-family: ${font.trim()}, Arial, sans-serif;`;
|
|
42907
43169
|
const key = `font:${font.trim().toLowerCase()}`;
|
|
42908
43170
|
const loc = locs == null ? void 0 : locs.get("font-family");
|
|
42909
|
-
const existing =
|
|
43171
|
+
const existing = seen2.get(key);
|
|
42910
43172
|
if (existing) {
|
|
42911
43173
|
addOccurrence2(existing, loc);
|
|
42912
43174
|
} else {
|
|
@@ -42917,7 +43179,7 @@ Href: ${href}`
|
|
|
42917
43179
|
detail: `End the stack with a web-safe font and a generic family.`,
|
|
42918
43180
|
fix
|
|
42919
43181
|
}, loc ? { loc, locs: [loc] } : {});
|
|
42920
|
-
|
|
43182
|
+
seen2.set(key, issue);
|
|
42921
43183
|
issues.push(issue);
|
|
42922
43184
|
}
|
|
42923
43185
|
}
|
|
@@ -42933,12 +43195,12 @@ Href: ${href}`
|
|
|
42933
43195
|
}
|
|
42934
43196
|
function checkVisualFromDom($, source) {
|
|
42935
43197
|
const issues = [];
|
|
42936
|
-
const
|
|
43198
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
42937
43199
|
$("[style]").each((_, el) => {
|
|
42938
43200
|
const attrLoc = locOfAttr(el, "style");
|
|
42939
43201
|
const style = parseInlineStyle($(el).attr("style") || "");
|
|
42940
43202
|
const locs = attrLoc ? new Map([...style.keys()].map((prop) => [prop, attrLoc])) : void 0;
|
|
42941
|
-
inspectDeclarations(style, issues,
|
|
43203
|
+
inspectDeclarations(style, issues, seen2, locs);
|
|
42942
43204
|
});
|
|
42943
43205
|
$("style").each((_, el) => {
|
|
42944
43206
|
const cssText = $(el).text();
|
|
@@ -42959,7 +43221,7 @@ Href: ${href}`
|
|
|
42959
43221
|
const loc = locInCssBlock(anchor, child.loc);
|
|
42960
43222
|
if (loc) locs.set(child.property.toLowerCase(), loc);
|
|
42961
43223
|
});
|
|
42962
|
-
inspectDeclarations(ruleToMap(node), issues,
|
|
43224
|
+
inspectDeclarations(ruleToMap(node), issues, seen2, locs);
|
|
42963
43225
|
}
|
|
42964
43226
|
});
|
|
42965
43227
|
});
|
|
@@ -43075,13 +43337,13 @@ Href: ${href}`
|
|
|
43075
43337
|
return clusters;
|
|
43076
43338
|
}
|
|
43077
43339
|
function distinctValues(values, normalise2) {
|
|
43078
|
-
const
|
|
43340
|
+
const seen2 = /* @__PURE__ */ new Map();
|
|
43079
43341
|
for (const raw of values) {
|
|
43080
43342
|
const key = normalise2(raw);
|
|
43081
43343
|
if (!key) continue;
|
|
43082
|
-
if (!
|
|
43344
|
+
if (!seen2.has(key)) seen2.set(key, raw.trim());
|
|
43083
43345
|
}
|
|
43084
|
-
return [...
|
|
43346
|
+
return [...seen2.values()];
|
|
43085
43347
|
}
|
|
43086
43348
|
function checkDesignConsistencyFromDom($) {
|
|
43087
43349
|
const found = collect($);
|
|
@@ -43191,10 +43453,10 @@ Href: ${href}`
|
|
|
43191
43453
|
design: EMPTY_DESIGN
|
|
43192
43454
|
};
|
|
43193
43455
|
function dedupeByElement(issues) {
|
|
43194
|
-
const
|
|
43456
|
+
const seen2 = /* @__PURE__ */ new Set();
|
|
43195
43457
|
return issues.filter((issue) => {
|
|
43196
|
-
if (
|
|
43197
|
-
|
|
43458
|
+
if (seen2.has(issue.element)) return false;
|
|
43459
|
+
seen2.add(issue.element);
|
|
43198
43460
|
return true;
|
|
43199
43461
|
});
|
|
43200
43462
|
}
|
|
@@ -43441,7 +43703,7 @@ Href: ${href}`
|
|
|
43441
43703
|
// package.json
|
|
43442
43704
|
var package_default = {
|
|
43443
43705
|
name: "@emailens/cli",
|
|
43444
|
-
version: "0.13.
|
|
43706
|
+
version: "0.13.19",
|
|
43445
43707
|
description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
|
|
43446
43708
|
type: "module",
|
|
43447
43709
|
bin: {
|
|
@@ -43482,7 +43744,8 @@ var package_default = {
|
|
|
43482
43744
|
},
|
|
43483
43745
|
devDependencies: {
|
|
43484
43746
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
43485
|
-
"@emailens/engine": "^0.18.
|
|
43747
|
+
"@emailens/engine": "^0.18.22",
|
|
43748
|
+
"@react-email/components": "1.0.12",
|
|
43486
43749
|
"@types/bun": "^1.4.0",
|
|
43487
43750
|
"@types/mjml": "^4.7.4",
|
|
43488
43751
|
"@types/node": "^25.9.5",
|
|
@@ -43492,6 +43755,9 @@ var package_default = {
|
|
|
43492
43755
|
ora: "^8.2.0",
|
|
43493
43756
|
picocolors: "^1.1.1",
|
|
43494
43757
|
"playwright-core": "^1.62.1",
|
|
43758
|
+
react: "19.3.1",
|
|
43759
|
+
"react-dom": "19.3.1",
|
|
43760
|
+
"react-email": "6.11.8",
|
|
43495
43761
|
tsup: "^8.5.1",
|
|
43496
43762
|
typescript: "^5.9.3"
|
|
43497
43763
|
},
|
|
@@ -46068,6 +46334,57 @@ var inbox_default = defineCommand({
|
|
|
46068
46334
|
subCommands: { wait }
|
|
46069
46335
|
});
|
|
46070
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
|
+
|
|
46071
46388
|
// src/index.ts
|
|
46072
46389
|
var main2 = defineCommand({
|
|
46073
46390
|
meta,
|
|
@@ -46079,7 +46396,8 @@ var main2 = defineCommand({
|
|
|
46079
46396
|
fix: fix_default,
|
|
46080
46397
|
audit: audit_default,
|
|
46081
46398
|
lint: lint_default,
|
|
46082
|
-
inbox: inbox_default
|
|
46399
|
+
inbox: inbox_default,
|
|
46400
|
+
"react-email": react_email_default
|
|
46083
46401
|
}
|
|
46084
46402
|
});
|
|
46085
46403
|
runMain(main2);
|