@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 CHANGED
@@ -155,7 +155,7 @@ Covers:
155
155
 
156
156
  - [ ] Outlook VML auto-generation
157
157
  - [ ] GitHub Actions integration (score thresholds in CI)
158
- - [ ] Automated caniemail.com data sync
158
+ - [x] Automated caniemail.com data sync
159
159
  - [ ] Real-time rendering previews
160
160
  - [ ] MJML/Maizzle source-level linting
161
161
  - [ ] Plugin system for custom analyzers
@@ -165,9 +165,20 @@ Covers:
165
165
  Contributions are welcome! See **[CONTRIBUTING.md](./CONTRIBUTING.md)** for architecture overview, setup instructions, and PR guidelines.
166
166
 
167
167
  ```bash
168
- bun install && bun test # 574 tests
168
+ bun install && bun test # 580 tests
169
169
  ```
170
170
 
171
+ ### Data Maintenance
172
+
173
+ CSS support data is auto-synced from [caniemail.com](https://www.caniemail.com/). Other data (dark mode behavior, display limits, Superhuman overrides) is manually curated and tracked with verification dates.
174
+
175
+ ```bash
176
+ bun run sync:caniemail # Refresh CSS support matrix from caniemail.com
177
+ bun run check:freshness # Flag stale data sources (exits 1 if any overdue)
178
+ ```
179
+
180
+ See [CONTRIBUTING.md](./CONTRIBUTING.md#data-sources-and-freshness) for full details on data sources and verification procedures.
181
+
171
182
  ## License
172
183
 
173
184
  MIT — Copyright 2025 [Emailens](https://emailens.dev)
package/dist/index.cjs CHANGED
@@ -5606,7 +5606,7 @@ var GMAIL_CLIP_THRESHOLD = 102 * 1024;
5606
5606
  var GMAIL_CLIP_WARNING_THRESHOLD = 90 * 1024;
5607
5607
  var CLIENT_DISPLAY_LIMITS = [
5608
5608
  { client: "Gmail (Web)", subjectLimit: 70, preheaderLimit: 90 },
5609
- { client: "Gmail (Mobile)", subjectLimit: 40, preheaderLimit: 90 },
5609
+ { client: "Gmail (Mobile)", subjectLimit: 40, preheaderLimit: 45 },
5610
5610
  { client: "Outlook (Web)", subjectLimit: 60, preheaderLimit: 90 },
5611
5611
  { client: "Outlook (Desktop)", subjectLimit: 55, preheaderLimit: 35 },
5612
5612
  { client: "Apple Mail (macOS)", subjectLimit: 78, preheaderLimit: 140 },
@@ -6420,10 +6420,13 @@ function generateCompatibilityScore(warnings) {
6420
6420
  const result = {};
6421
6421
  for (const client of EMAIL_CLIENTS) {
6422
6422
  const clientWarnings = warnings.filter((w) => w.client === client.id);
6423
- const errors = clientWarnings.filter((w) => w.severity === "error").length;
6424
- const warns = clientWarnings.filter((w) => w.severity === "warning").length;
6425
- const info = clientWarnings.filter((w) => w.severity === "info").length;
6426
- const score = Math.max(0, Math.min(100, 100 - errors * 15 - warns * 5 - info * 1));
6423
+ const errorProps = new Set(clientWarnings.filter((w) => w.severity === "error").map((w) => w.property));
6424
+ const warnProps = new Set(clientWarnings.filter((w) => w.severity === "warning").map((w) => w.property));
6425
+ const infoProps = new Set(clientWarnings.filter((w) => w.severity === "info").map((w) => w.property));
6426
+ const errors = errorProps.size;
6427
+ const warns = warnProps.size;
6428
+ const info = infoProps.size;
6429
+ const score = Math.max(0, Math.min(100, 100 - errors * 10 - warns * 3));
6427
6430
  result[client.id] = { score, errors, warnings: warns, info };
6428
6431
  }
6429
6432
  return result;
@@ -6707,6 +6710,15 @@ function simulateDarkMode(html, clientId) {
6707
6710
  break;
6708
6711
  case "outlook-web":
6709
6712
  applyColorInversion($, "partial");
6713
+ if (!html.includes("prefers-color-scheme")) {
6714
+ warnings.push({
6715
+ severity: "info",
6716
+ client: clientId,
6717
+ property: "dark-mode",
6718
+ message: "Outlook.com applies partial color inversion in dark mode.",
6719
+ suggestion: "Use [data-ogsc] or [data-ogsb] CSS attribute selectors to override Outlook.com's dark mode color changes."
6720
+ });
6721
+ }
6710
6722
  break;
6711
6723
  case "outlook-windows":
6712
6724
  applyColorInversion($, "full");
@@ -6716,19 +6728,18 @@ function simulateDarkMode(html, clientId) {
6716
6728
  client: clientId,
6717
6729
  property: "dark-mode",
6718
6730
  message: "Outlook Windows applies full color inversion in dark mode. Colors may shift unexpectedly.",
6719
- suggestion: "Test with dark mode enabled. Use [data-ogsc] or [data-ogsb] overrides to control Outlook dark mode rendering."
6731
+ suggestion: "Test with dark mode enabled. The Word rendering engine offers limited control over dark mode color shifts."
6720
6732
  });
6721
6733
  }
6722
6734
  break;
6723
6735
  case "apple-mail-macos":
6724
6736
  case "apple-mail-ios":
6725
6737
  if (!html.includes("prefers-color-scheme")) {
6726
- applyColorInversion($, "partial");
6727
6738
  warnings.push({
6728
6739
  severity: "info",
6729
6740
  client: clientId,
6730
6741
  property: "dark-mode",
6731
- message: "Apple Mail supports @media (prefers-color-scheme: dark). Consider adding dark mode styles.",
6742
+ message: "Apple Mail supports @media (prefers-color-scheme: dark). Without it, email content renders unchanged in dark mode.",
6732
6743
  suggestion: "Add a @media (prefers-color-scheme: dark) block with inverted colors for the best dark mode experience."
6733
6744
  });
6734
6745
  }