@emailens/engine 0.11.0 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, g as AccessibilityIssue, I as ImageReport, h as InboxPreview, i as SizeReport, j as TemplateReport, O as OverflowReport, V as VisualReport, k as DesignReport, l as DeliverabilityReport } from './types-BFhPXh3c.cjs';
2
- export { B as BaseIssue, m as ClientTruncation, n as DeliverabilityCheck, o as DeliverabilityIssue, p as DesignIssue, q as EstimateOptions, r as ExportScope, s as FixType, t as ImageInfo, u as ImageIssue, v as InboxPreviewIssue, w as InputFormat, x as LinkIssue, y as OverflowIssue, P as PreviewResult, z as Severity, G as SizeIssue, H as SourceLocation, J as SpamIssue, K as TemplateIssue, M as TokenEstimate, N as TokenEstimateWithWarnings, Q as VisualIssue, R as estimateAiFixTokens, U as generateFixPrompt, W as heuristicTokenCount } from './types-BFhPXh3c.cjs';
1
+ import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, g as AccessibilityIssue, I as ImageReport, h as InboxPreview, i as SizeReport, j as TemplateReport, O as OverflowReport, V as VmlReport, k as VisualReport, l as DesignReport, m as DeliverabilityReport } from './types-bvGDId6f.cjs';
2
+ export { B as BaseIssue, n as ClientTruncation, o as DeliverabilityCheck, p as DeliverabilityIssue, q as DesignIssue, r as EstimateOptions, s as ExportScope, t as FixType, u as ImageInfo, v as ImageIssue, w as InboxPreviewIssue, x as InputFormat, y as LinkIssue, z as OverflowIssue, P as PreviewResult, G as Severity, H as SizeIssue, J as SourceLocation, K as SpamIssue, M as TemplateIssue, N as TokenEstimate, Q as TokenEstimateWithWarnings, R as VisualIssue, U as VmlIssue, W as estimateAiFixTokens, X as generateFixPrompt, Y as heuristicTokenCount } from './types-bvGDId6f.cjs';
3
3
  import * as cheerio from 'cheerio';
4
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-BWIfwG7U.cjs';
4
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-DuZAgJtw.cjs';
5
5
 
6
6
  declare const EMAIL_CLIENTS: EmailClient[];
7
7
  declare function getClient(id: string): EmailClient | undefined;
@@ -372,6 +372,73 @@ declare function checkTemplateVariables(html: string, options?: ParseOptions): T
372
372
  */
373
373
  declare function checkOverflow(html: string, options?: ParseOptions): OverflowReport;
374
374
 
375
+ /**
376
+ * Check hand-written VML for the mistakes Outlook punishes.
377
+ *
378
+ * This is the one part of an email the DOM analyzers structurally cannot see:
379
+ * VML lives inside `<!--[if mso]>` conditional comments, so to every HTML
380
+ * parser it is a comment node, and to a headless-Chromium screenshot it does
381
+ * not exist at all. An email can therefore lint clean and preview perfectly
382
+ * while the branch Outlook actually renders is broken.
383
+ *
384
+ * ponytail: a tag-sequence checker, not a VML renderer. It validates structure
385
+ * and attribute values, which is where the reported breakages cluster. It does
386
+ * not resolve geometry, so it can say Outlook will misplace a nested shape but
387
+ * not where the shape lands.
388
+ */
389
+ declare function checkVml(html: string, options?: {
390
+ positions?: boolean;
391
+ }): VmlReport;
392
+
393
+ /**
394
+ * Resolve the Outlook branch of an email and translate its VML into CSS a
395
+ * browser can draw.
396
+ *
397
+ * Every preview of a Word-engine Outlook has, until now, rendered the wrong
398
+ * half of the email: the `<!--[if mso]>` blocks stayed commented and the
399
+ * `<!--[if !mso]>` fallback stayed live, so the screenshot showed precisely
400
+ * what Outlook does *not* render and hid what it does.
401
+ *
402
+ * Resolving the branch alone makes that worse rather than better. VML has been
403
+ * dead in browsers since IE9, so `<v:rect>` parses as an HTMLUnknownElement:
404
+ * `display:inline`, no box, no fill. The content inside would render as bare
405
+ * inline text. Resolution and translation therefore ship together and are not
406
+ * useful apart.
407
+ *
408
+ * ponytail: a mapping for the two shapes that occur in practice, not a VML
409
+ * renderer. Measured across a reported production email and MJML's output,
410
+ * `roundrect` and `rect` are the whole surface. Anything else is left alone
411
+ * rather than approximated.
412
+ *
413
+ * Deliberately NOT emulated: how Word *mis*-renders a nested shape. That is a
414
+ * real and confirmed failure (the container disappears and text stops drawing
415
+ * further down the document), but reproducing it means perturbing Chromium's
416
+ * layout into a picture that is wrong in a third way, different from both the
417
+ * correct render and Outlook's. `checkVml` reports it with a line number
418
+ * instead, which is more useful and cannot mislead.
419
+ */
420
+ /**
421
+ * `arcsize` is a VgFraction: a proportion of *half the shape's shorter side*,
422
+ * where 0% is square and 100% fully circular. Values outside that are clamped
423
+ * rather than rejected, which is why 120% and 100% draw the identical corner.
424
+ * Verified against Outlook Classic.
425
+ */
426
+ declare function arcsizeToRadius(arcsize: string, width: number, height: number): number;
427
+ /**
428
+ * Uncomment the Outlook-only blocks and delete the downlevel-revealed branch,
429
+ * leaving the markup a Word-engine client actually parses.
430
+ */
431
+ declare function resolveMsoBranch(html: string): string;
432
+ /** Translate the VML shapes a browser cannot draw into divs it can. */
433
+ declare function vmlToCss(html: string): string;
434
+ /**
435
+ * Render the branch a Word-engine Outlook actually sees.
436
+ *
437
+ * Returns the input unchanged when there is nothing Outlook-only in it, so an
438
+ * email without conditional comments is never rewritten for no reason.
439
+ */
440
+ declare function renderOutlookBranch(html: string): string;
441
+
375
442
  /**
376
443
  * Detect probable visual bugs in a stylized email: background images/gradients
377
444
  * with no colour fallback, and font stacks with no web-safe fallback. Each
@@ -390,7 +457,7 @@ interface AuditOptions extends ParseOptions {
390
457
  /** Options for spam analysis */
391
458
  spam?: SpamAnalysisOptions;
392
459
  /** Skip specific checks */
393
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design">;
460
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design" | "vml">;
394
461
  }
395
462
  interface AuditReport {
396
463
  compatibility: {
@@ -411,6 +478,8 @@ interface AuditReport {
411
478
  templateVariables: TemplateReport;
412
479
  overflow: OverflowReport;
413
480
  visual: VisualReport;
481
+ /** Structural faults in Outlook-only VML, which lives inside conditional comments. */
482
+ vml: VmlReport;
414
483
  /** Contrast failures present only once a client inverts colours. */
415
484
  darkContrast: AccessibilityIssue[];
416
485
  /** Contrast failures present only below the email's mobile breakpoint. */
@@ -654,4 +723,4 @@ declare function colorDistance(a: RGBA, b: RGBA): number;
654
723
  */
655
724
  declare function downlevelCSS(html: string): string;
656
725
 
657
- export { AI_FIX_SYSTEM_PROMPT, AT_RULE_FEATURES, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, COMPOUND_VALUE_FEATURES, CSSWarning, CSS_FUNCTION_FEATURES, CSS_SUPPORT, CSS_SUPPORT_NOTES, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, HTML_ELEMENT_FEATURES, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, SupportLevel, TemplateReport, TransformResult, VALUE_CAVEAT_PROPS, VisualReport, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, auditEmail, caveatApplies, checkAccessibility, checkDarkModeContrast, checkDarkStylesContrastFromDom, checkDesignConsistency, checkMobileContrast, checkOverflow, checkSize, checkTemplateVariables, checkVisual, colorDistance, contrastRatio, createSession, diffResults, downlevelCSS, errorWarnings, extractInboxPreview, featureUrl, formatRgb, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, rgbToOklab, simulateDarkMode, structuralWarnings, toPlainText, transformForAllClients, transformForClient, validateLinks, warningsForClient, wcagGrade };
726
+ export { AI_FIX_SYSTEM_PROMPT, AT_RULE_FEATURES, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, COMPOUND_VALUE_FEATURES, CSSWarning, CSS_FUNCTION_FEATURES, CSS_SUPPORT, CSS_SUPPORT_NOTES, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, HTML_ELEMENT_FEATURES, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, SupportLevel, TemplateReport, TransformResult, VALUE_CAVEAT_PROPS, VisualReport, VmlReport, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, arcsizeToRadius, auditEmail, caveatApplies, checkAccessibility, checkDarkModeContrast, checkDarkStylesContrastFromDom, checkDesignConsistency, checkMobileContrast, checkOverflow, checkSize, checkTemplateVariables, checkVisual, checkVml, colorDistance, contrastRatio, createSession, diffResults, downlevelCSS, errorWarnings, extractInboxPreview, featureUrl, formatRgb, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, renderOutlookBranch, resolveMsoBranch, rgbToOklab, simulateDarkMode, structuralWarnings, toPlainText, transformForAllClients, transformForClient, validateLinks, vmlToCss, warningsForClient, wcagGrade };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, g as AccessibilityIssue, I as ImageReport, h as InboxPreview, i as SizeReport, j as TemplateReport, O as OverflowReport, V as VisualReport, k as DesignReport, l as DeliverabilityReport } from './types-BFhPXh3c.js';
2
- export { B as BaseIssue, m as ClientTruncation, n as DeliverabilityCheck, o as DeliverabilityIssue, p as DesignIssue, q as EstimateOptions, r as ExportScope, s as FixType, t as ImageInfo, u as ImageIssue, v as InboxPreviewIssue, w as InputFormat, x as LinkIssue, y as OverflowIssue, P as PreviewResult, z as Severity, G as SizeIssue, H as SourceLocation, J as SpamIssue, K as TemplateIssue, M as TokenEstimate, N as TokenEstimateWithWarnings, Q as VisualIssue, R as estimateAiFixTokens, U as generateFixPrompt, W as heuristicTokenCount } from './types-BFhPXh3c.js';
1
+ import { E as EmailClient, F as Framework, T as TransformResult, C as CSSWarning, a as CodeFix, D as DiffResult, b as ExportPromptOptions, A as AiProvider, c as AiFixResult, S as SupportLevel, d as SpamAnalysisOptions, e as SpamReport, L as LinkReport, f as AccessibilityReport, g as AccessibilityIssue, I as ImageReport, h as InboxPreview, i as SizeReport, j as TemplateReport, O as OverflowReport, V as VmlReport, k as VisualReport, l as DesignReport, m as DeliverabilityReport } from './types-bvGDId6f.js';
2
+ export { B as BaseIssue, n as ClientTruncation, o as DeliverabilityCheck, p as DeliverabilityIssue, q as DesignIssue, r as EstimateOptions, s as ExportScope, t as FixType, u as ImageInfo, v as ImageIssue, w as InboxPreviewIssue, x as InputFormat, y as LinkIssue, z as OverflowIssue, P as PreviewResult, G as Severity, H as SizeIssue, J as SourceLocation, K as SpamIssue, M as TemplateIssue, N as TokenEstimate, Q as TokenEstimateWithWarnings, R as VisualIssue, U as VmlIssue, W as estimateAiFixTokens, X as generateFixPrompt, Y as heuristicTokenCount } from './types-bvGDId6f.js';
3
3
  import * as cheerio from 'cheerio';
4
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-D24HkW2Z.js';
4
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-BROBcC8u.js';
5
5
 
6
6
  declare const EMAIL_CLIENTS: EmailClient[];
7
7
  declare function getClient(id: string): EmailClient | undefined;
@@ -372,6 +372,73 @@ declare function checkTemplateVariables(html: string, options?: ParseOptions): T
372
372
  */
373
373
  declare function checkOverflow(html: string, options?: ParseOptions): OverflowReport;
374
374
 
375
+ /**
376
+ * Check hand-written VML for the mistakes Outlook punishes.
377
+ *
378
+ * This is the one part of an email the DOM analyzers structurally cannot see:
379
+ * VML lives inside `<!--[if mso]>` conditional comments, so to every HTML
380
+ * parser it is a comment node, and to a headless-Chromium screenshot it does
381
+ * not exist at all. An email can therefore lint clean and preview perfectly
382
+ * while the branch Outlook actually renders is broken.
383
+ *
384
+ * ponytail: a tag-sequence checker, not a VML renderer. It validates structure
385
+ * and attribute values, which is where the reported breakages cluster. It does
386
+ * not resolve geometry, so it can say Outlook will misplace a nested shape but
387
+ * not where the shape lands.
388
+ */
389
+ declare function checkVml(html: string, options?: {
390
+ positions?: boolean;
391
+ }): VmlReport;
392
+
393
+ /**
394
+ * Resolve the Outlook branch of an email and translate its VML into CSS a
395
+ * browser can draw.
396
+ *
397
+ * Every preview of a Word-engine Outlook has, until now, rendered the wrong
398
+ * half of the email: the `<!--[if mso]>` blocks stayed commented and the
399
+ * `<!--[if !mso]>` fallback stayed live, so the screenshot showed precisely
400
+ * what Outlook does *not* render and hid what it does.
401
+ *
402
+ * Resolving the branch alone makes that worse rather than better. VML has been
403
+ * dead in browsers since IE9, so `<v:rect>` parses as an HTMLUnknownElement:
404
+ * `display:inline`, no box, no fill. The content inside would render as bare
405
+ * inline text. Resolution and translation therefore ship together and are not
406
+ * useful apart.
407
+ *
408
+ * ponytail: a mapping for the two shapes that occur in practice, not a VML
409
+ * renderer. Measured across a reported production email and MJML's output,
410
+ * `roundrect` and `rect` are the whole surface. Anything else is left alone
411
+ * rather than approximated.
412
+ *
413
+ * Deliberately NOT emulated: how Word *mis*-renders a nested shape. That is a
414
+ * real and confirmed failure (the container disappears and text stops drawing
415
+ * further down the document), but reproducing it means perturbing Chromium's
416
+ * layout into a picture that is wrong in a third way, different from both the
417
+ * correct render and Outlook's. `checkVml` reports it with a line number
418
+ * instead, which is more useful and cannot mislead.
419
+ */
420
+ /**
421
+ * `arcsize` is a VgFraction: a proportion of *half the shape's shorter side*,
422
+ * where 0% is square and 100% fully circular. Values outside that are clamped
423
+ * rather than rejected, which is why 120% and 100% draw the identical corner.
424
+ * Verified against Outlook Classic.
425
+ */
426
+ declare function arcsizeToRadius(arcsize: string, width: number, height: number): number;
427
+ /**
428
+ * Uncomment the Outlook-only blocks and delete the downlevel-revealed branch,
429
+ * leaving the markup a Word-engine client actually parses.
430
+ */
431
+ declare function resolveMsoBranch(html: string): string;
432
+ /** Translate the VML shapes a browser cannot draw into divs it can. */
433
+ declare function vmlToCss(html: string): string;
434
+ /**
435
+ * Render the branch a Word-engine Outlook actually sees.
436
+ *
437
+ * Returns the input unchanged when there is nothing Outlook-only in it, so an
438
+ * email without conditional comments is never rewritten for no reason.
439
+ */
440
+ declare function renderOutlookBranch(html: string): string;
441
+
375
442
  /**
376
443
  * Detect probable visual bugs in a stylized email: background images/gradients
377
444
  * with no colour fallback, and font stacks with no web-safe fallback. Each
@@ -390,7 +457,7 @@ interface AuditOptions extends ParseOptions {
390
457
  /** Options for spam analysis */
391
458
  spam?: SpamAnalysisOptions;
392
459
  /** Skip specific checks */
393
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design">;
460
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design" | "vml">;
394
461
  }
395
462
  interface AuditReport {
396
463
  compatibility: {
@@ -411,6 +478,8 @@ interface AuditReport {
411
478
  templateVariables: TemplateReport;
412
479
  overflow: OverflowReport;
413
480
  visual: VisualReport;
481
+ /** Structural faults in Outlook-only VML, which lives inside conditional comments. */
482
+ vml: VmlReport;
414
483
  /** Contrast failures present only once a client inverts colours. */
415
484
  darkContrast: AccessibilityIssue[];
416
485
  /** Contrast failures present only below the email's mobile breakpoint. */
@@ -654,4 +723,4 @@ declare function colorDistance(a: RGBA, b: RGBA): number;
654
723
  */
655
724
  declare function downlevelCSS(html: string): string;
656
725
 
657
- export { AI_FIX_SYSTEM_PROMPT, AT_RULE_FEATURES, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, COMPOUND_VALUE_FEATURES, CSSWarning, CSS_FUNCTION_FEATURES, CSS_SUPPORT, CSS_SUPPORT_NOTES, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, HTML_ELEMENT_FEATURES, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, SupportLevel, TemplateReport, TransformResult, VALUE_CAVEAT_PROPS, VisualReport, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, auditEmail, caveatApplies, checkAccessibility, checkDarkModeContrast, checkDarkStylesContrastFromDom, checkDesignConsistency, checkMobileContrast, checkOverflow, checkSize, checkTemplateVariables, checkVisual, colorDistance, contrastRatio, createSession, diffResults, downlevelCSS, errorWarnings, extractInboxPreview, featureUrl, formatRgb, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, rgbToOklab, simulateDarkMode, structuralWarnings, toPlainText, transformForAllClients, transformForClient, validateLinks, warningsForClient, wcagGrade };
726
+ export { AI_FIX_SYSTEM_PROMPT, AT_RULE_FEATURES, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, COMPOUND_VALUE_FEATURES, CSSWarning, CSS_FUNCTION_FEATURES, CSS_SUPPORT, CSS_SUPPORT_NOTES, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, HTML_ELEMENT_FEATURES, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, STRUCTURAL_FIX_PROPERTIES, SizeReport, SpamAnalysisOptions, SpamReport, SupportLevel, TemplateReport, TransformResult, VALUE_CAVEAT_PROPS, VisualReport, VmlReport, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, arcsizeToRadius, auditEmail, caveatApplies, checkAccessibility, checkDarkModeContrast, checkDarkStylesContrastFromDom, checkDesignConsistency, checkMobileContrast, checkOverflow, checkSize, checkTemplateVariables, checkVisual, checkVml, colorDistance, contrastRatio, createSession, diffResults, downlevelCSS, errorWarnings, extractInboxPreview, featureUrl, formatRgb, generateAiFix, generateCompatibilityScore, getClient, getCodeFix, getSuggestion, parseColor, relativeLuminance, renderOutlookBranch, resolveMsoBranch, rgbToOklab, simulateDarkMode, structuralWarnings, toPlainText, transformForAllClients, transformForClient, validateLinks, vmlToCss, warningsForClient, wcagGrade };