@emailens/engine 0.8.2 → 0.8.4
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 +13 -2
- package/dist/index.cjs +19 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -41,6 +41,9 @@ declare function structuralWarnings(warnings: CSSWarning[]): CSSWarning[];
|
|
|
41
41
|
* - Some invert colors (Gmail Android)
|
|
42
42
|
* - Some use prefers-color-scheme media query (Apple Mail)
|
|
43
43
|
* - Some do partial inversion (Outlook.com)
|
|
44
|
+
*
|
|
45
|
+
* Last verified: 2026-03-04
|
|
46
|
+
* Sources: Litmus dark mode guide, caniemail.com, Parcel dark mode guide
|
|
44
47
|
*/
|
|
45
48
|
declare function simulateDarkMode(html: string, clientId: string): {
|
|
46
49
|
html: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -41,6 +41,9 @@ declare function structuralWarnings(warnings: CSSWarning[]): CSSWarning[];
|
|
|
41
41
|
* - Some invert colors (Gmail Android)
|
|
42
42
|
* - Some use prefers-color-scheme media query (Apple Mail)
|
|
43
43
|
* - Some do partial inversion (Outlook.com)
|
|
44
|
+
*
|
|
45
|
+
* Last verified: 2026-03-04
|
|
46
|
+
* Sources: Litmus dark mode guide, caniemail.com, Parcel dark mode guide
|
|
44
47
|
*/
|
|
45
48
|
declare function simulateDarkMode(html: string, clientId: string): {
|
|
46
49
|
html: string;
|
package/dist/index.js
CHANGED
|
@@ -5509,7 +5509,7 @@ var GMAIL_CLIP_THRESHOLD = 102 * 1024;
|
|
|
5509
5509
|
var GMAIL_CLIP_WARNING_THRESHOLD = 90 * 1024;
|
|
5510
5510
|
var CLIENT_DISPLAY_LIMITS = [
|
|
5511
5511
|
{ client: "Gmail (Web)", subjectLimit: 70, preheaderLimit: 90 },
|
|
5512
|
-
{ client: "Gmail (Mobile)", subjectLimit: 40, preheaderLimit:
|
|
5512
|
+
{ client: "Gmail (Mobile)", subjectLimit: 40, preheaderLimit: 45 },
|
|
5513
5513
|
{ client: "Outlook (Web)", subjectLimit: 60, preheaderLimit: 90 },
|
|
5514
5514
|
{ client: "Outlook (Desktop)", subjectLimit: 55, preheaderLimit: 35 },
|
|
5515
5515
|
{ client: "Apple Mail (macOS)", subjectLimit: 78, preheaderLimit: 140 },
|
|
@@ -6323,10 +6323,13 @@ function generateCompatibilityScore(warnings) {
|
|
|
6323
6323
|
const result = {};
|
|
6324
6324
|
for (const client of EMAIL_CLIENTS) {
|
|
6325
6325
|
const clientWarnings = warnings.filter((w) => w.client === client.id);
|
|
6326
|
-
const
|
|
6327
|
-
const
|
|
6328
|
-
const
|
|
6329
|
-
const
|
|
6326
|
+
const errorProps = new Set(clientWarnings.filter((w) => w.severity === "error").map((w) => w.property));
|
|
6327
|
+
const warnProps = new Set(clientWarnings.filter((w) => w.severity === "warning").map((w) => w.property));
|
|
6328
|
+
const infoProps = new Set(clientWarnings.filter((w) => w.severity === "info").map((w) => w.property));
|
|
6329
|
+
const errors = errorProps.size;
|
|
6330
|
+
const warns = warnProps.size;
|
|
6331
|
+
const info = infoProps.size;
|
|
6332
|
+
const score = Math.max(0, Math.min(100, 100 - errors * 10 - warns * 3));
|
|
6330
6333
|
result[client.id] = { score, errors, warnings: warns, info };
|
|
6331
6334
|
}
|
|
6332
6335
|
return result;
|
|
@@ -6610,6 +6613,15 @@ function simulateDarkMode(html, clientId) {
|
|
|
6610
6613
|
break;
|
|
6611
6614
|
case "outlook-web":
|
|
6612
6615
|
applyColorInversion($, "partial");
|
|
6616
|
+
if (!html.includes("prefers-color-scheme")) {
|
|
6617
|
+
warnings.push({
|
|
6618
|
+
severity: "info",
|
|
6619
|
+
client: clientId,
|
|
6620
|
+
property: "dark-mode",
|
|
6621
|
+
message: "Outlook.com applies partial color inversion in dark mode.",
|
|
6622
|
+
suggestion: "Use [data-ogsc] or [data-ogsb] CSS attribute selectors to override Outlook.com's dark mode color changes."
|
|
6623
|
+
});
|
|
6624
|
+
}
|
|
6613
6625
|
break;
|
|
6614
6626
|
case "outlook-windows":
|
|
6615
6627
|
applyColorInversion($, "full");
|
|
@@ -6619,19 +6631,18 @@ function simulateDarkMode(html, clientId) {
|
|
|
6619
6631
|
client: clientId,
|
|
6620
6632
|
property: "dark-mode",
|
|
6621
6633
|
message: "Outlook Windows applies full color inversion in dark mode. Colors may shift unexpectedly.",
|
|
6622
|
-
suggestion: "Test with dark mode enabled.
|
|
6634
|
+
suggestion: "Test with dark mode enabled. The Word rendering engine offers limited control over dark mode color shifts."
|
|
6623
6635
|
});
|
|
6624
6636
|
}
|
|
6625
6637
|
break;
|
|
6626
6638
|
case "apple-mail-macos":
|
|
6627
6639
|
case "apple-mail-ios":
|
|
6628
6640
|
if (!html.includes("prefers-color-scheme")) {
|
|
6629
|
-
applyColorInversion($, "partial");
|
|
6630
6641
|
warnings.push({
|
|
6631
6642
|
severity: "info",
|
|
6632
6643
|
client: clientId,
|
|
6633
6644
|
property: "dark-mode",
|
|
6634
|
-
message: "Apple Mail supports @media (prefers-color-scheme: dark).
|
|
6645
|
+
message: "Apple Mail supports @media (prefers-color-scheme: dark). Without it, email content renders unchanged in dark mode.",
|
|
6635
6646
|
suggestion: "Add a @media (prefers-color-scheme: dark) block with inverted colors for the best dark mode experience."
|
|
6636
6647
|
});
|
|
6637
6648
|
}
|