@emailens/engine 0.12.0 → 0.12.1

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 SpamAnalysisOptions, d as SpamReport, L as LinkReport, e as AccessibilityReport, f as AccessibilityIssue, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, O as OverflowReport, V as VmlReport, j as VisualReport, k as DesignReport, l as DeliverabilityReport } from './types-edFeUest.cjs';
2
- export { m as AT_RULE_FEATURES, B as BaseIssue, n as COMPOUND_VALUE_FEATURES, o as CSS_FUNCTION_FEATURES, p as CSS_PROPERTY_FEATURES, q as CSS_SUPPORT, r as CSS_SUPPORT_NOTES, s as ClientId, t as ClientTruncation, u as DeliverabilityCheck, v as DeliverabilityIssue, w as DesignIssue, x as EstimateOptions, y as ExportScope, z as FEATURE_LAST_TESTED, G as FeatureKey, H as FixType, J as GRACEFUL_FEATURES, K as HTML_ATTRIBUTE_FEATURES, M as HTML_ELEMENT_FEATURES, N as HTML_MISC_FEATURES, P as IMAGE_FORMATS, Q as IMAGE_SUPPORT, R as IMAGE_SUPPORT_NOTES, U as ImageFormat, W as ImageInfo, X as ImageIssue, Y as InboxPreviewIssue, Z as InputFormat, _ as LinkInfo, $ as LinkIssue, a0 as OverflowIssue, a1 as PreviewResult, a2 as SELECTOR_FEATURES, a3 as STRUCTURAL_FIX_PROPERTIES, a4 as SUPPORT_CLIENTS, a5 as Severity, a6 as SizeIssue, a7 as SourceLocation, a8 as SpamIssue, a9 as SupportLevel, aa as TemplateIssue, ab as TokenEstimate, ac as TokenEstimateWithWarnings, ad as VisualIssue, ae as VmlIssue, af as estimateAiFixTokens, ag as generateFixPrompt, ah as heuristicTokenCount } from './types-edFeUest.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 StyleSurvivalReport, 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-hQYXbiqj.cjs';
2
+ export { n as AT_RULE_FEATURES, B as BaseIssue, o as COMPOUND_VALUE_FEATURES, p as CSS_FUNCTION_FEATURES, q as CSS_PROPERTY_FEATURES, r as CSS_SUPPORT, s as CSS_SUPPORT_NOTES, t as ClientId, u as ClientTruncation, v as DeliverabilityCheck, w as DeliverabilityIssue, x as DesignIssue, y as EstimateOptions, z as ExportScope, G as FEATURE_LAST_TESTED, H as FeatureKey, J as FixType, K as GRACEFUL_FEATURES, M as HTML_ATTRIBUTE_FEATURES, N as HTML_ELEMENT_FEATURES, P as HTML_MISC_FEATURES, Q as IMAGE_FORMATS, R as IMAGE_SUPPORT, U as IMAGE_SUPPORT_NOTES, W as ImageFormat, X as ImageInfo, Y as ImageIssue, Z as InboxPreviewIssue, _ as InputFormat, $ as LinkInfo, a0 as LinkIssue, a1 as OverflowIssue, a2 as PreviewResult, a3 as SELECTOR_FEATURES, a4 as STRUCTURAL_FIX_PROPERTIES, a5 as SUPPORT_CLIENTS, a6 as Severity, a7 as SizeIssue, a8 as SourceLocation, a9 as SpamIssue, aa as SupportLevel, ab as TemplateIssue, ac as TokenEstimate, ad as TokenEstimateWithWarnings, ae as VisualIssue, af as VmlIssue, ag as estimateAiFixTokens, ah as generateFixPrompt, ai as heuristicTokenCount } from './types-hQYXbiqj.cjs';
3
3
  import * as cheerio from 'cheerio';
4
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-DHkCZ7TG.cjs';
4
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-eJhDK8a5.cjs';
5
5
 
6
6
  declare const EMAIL_CLIENTS: EmailClient[];
7
7
  declare function getClient(id: string): EmailClient | undefined;
@@ -157,6 +157,16 @@ declare function generateAiFix(options: GenerateAiFixOptions): Promise<AiFixResu
157
157
  */
158
158
  declare const AI_FIX_SYSTEM_PROMPT = "You are an expert email developer specializing in cross-client HTML email compatibility. You fix emails to render correctly across all email clients.\n\nRules:\n- Return ONLY the fixed code inside a single code fence. No explanations before or after.\n- Preserve all existing content, text, links, and visual design.\n- For structural issues (fixType: \"structural\"), you MUST restructure the HTML; CSS-only changes will not work.\n- Common structural patterns:\n - word-break/overflow-wrap unsupported \u2192 wrap text in <table><tr><td> with constrained width\n - display:flex/grid \u2192 convert to <table> layout (match the original column count and proportions)\n - border-radius in Outlook \u2192 use VML <v:roundrect> with <!--[if mso]> conditionals\n - background-image in Outlook \u2192 use VML <v:rect> with <v:fill>\n - max-width in Outlook \u2192 wrap in <!--[if mso]><table width=\"N\"> conditional\n - position:absolute \u2192 use <table> cells for layout\n - <svg> \u2192 replace with <img> pointing to a hosted PNG\n- For CSS-only issues (fixType: \"css\"), swap properties or add fallbacks.\n- For \"Layout & Visual Issues\", apply the provided Fix directly: add the background-color fallback beneath a gradient/image, append a web-safe font to the stack, and constrain fixed widths wider than the frame to width:100% with max-width.\n- Apply ALL fixes from the issues list: do not skip any.\n- Use the framework syntax specified (JSX/MJML/Maizzle/HTML).\n- For JSX: use camelCase style props, React Email components, and proper TypeScript types.\n- For MJML: use mj-* elements and attributes.\n- For Maizzle: use Tailwind CSS classes.";
159
159
 
160
+ /**
161
+ * Check whether the target clients will keep this email's CSS.
162
+ *
163
+ * These are not support questions. Each rule is a client discarding CSS it
164
+ * parsed correctly, with no error anywhere the author can see.
165
+ */
166
+ declare function checkStyleSurvival(html: string, options?: ParseOptions & {
167
+ framework?: Framework;
168
+ }): StyleSurvivalReport;
169
+
160
170
  /**
161
171
  * caniemail's page for each feature, for a diagnostic's `codeDescription`.
162
172
  *
@@ -425,7 +435,7 @@ interface AuditOptions extends ParseOptions {
425
435
  /** Options for spam analysis */
426
436
  spam?: SpamAnalysisOptions;
427
437
  /** Skip specific checks */
428
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design" | "vml">;
438
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design" | "vml" | "styleSurvival">;
429
439
  }
430
440
  interface AuditReport {
431
441
  compatibility: {
@@ -443,6 +453,8 @@ interface AuditReport {
443
453
  images: ImageReport;
444
454
  inboxPreview: InboxPreview;
445
455
  size: SizeReport;
456
+ /** Rules about clients discarding CSS they parsed fine. */
457
+ styleSurvival: StyleSurvivalReport;
446
458
  templateVariables: TemplateReport;
447
459
  overflow: OverflowReport;
448
460
  visual: VisualReport;
@@ -691,4 +703,4 @@ declare function colorDistance(a: RGBA, b: RGBA): number;
691
703
  */
692
704
  declare function downlevelCSS(html: string): string;
693
705
 
694
- export { AI_FIX_SYSTEM_PROMPT, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, CSSWarning, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, SizeReport, SpamAnalysisOptions, SpamReport, 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 };
706
+ export { AI_FIX_SYSTEM_PROMPT, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, CSSWarning, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, SizeReport, SpamAnalysisOptions, SpamReport, TemplateReport, TransformResult, VALUE_CAVEAT_PROPS, VisualReport, VmlReport, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, arcsizeToRadius, auditEmail, caveatApplies, checkAccessibility, checkDarkModeContrast, checkDarkStylesContrastFromDom, checkDesignConsistency, checkMobileContrast, checkOverflow, checkSize, checkStyleSurvival, 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 SpamAnalysisOptions, d as SpamReport, L as LinkReport, e as AccessibilityReport, f as AccessibilityIssue, I as ImageReport, g as InboxPreview, h as SizeReport, i as TemplateReport, O as OverflowReport, V as VmlReport, j as VisualReport, k as DesignReport, l as DeliverabilityReport } from './types-edFeUest.js';
2
- export { m as AT_RULE_FEATURES, B as BaseIssue, n as COMPOUND_VALUE_FEATURES, o as CSS_FUNCTION_FEATURES, p as CSS_PROPERTY_FEATURES, q as CSS_SUPPORT, r as CSS_SUPPORT_NOTES, s as ClientId, t as ClientTruncation, u as DeliverabilityCheck, v as DeliverabilityIssue, w as DesignIssue, x as EstimateOptions, y as ExportScope, z as FEATURE_LAST_TESTED, G as FeatureKey, H as FixType, J as GRACEFUL_FEATURES, K as HTML_ATTRIBUTE_FEATURES, M as HTML_ELEMENT_FEATURES, N as HTML_MISC_FEATURES, P as IMAGE_FORMATS, Q as IMAGE_SUPPORT, R as IMAGE_SUPPORT_NOTES, U as ImageFormat, W as ImageInfo, X as ImageIssue, Y as InboxPreviewIssue, Z as InputFormat, _ as LinkInfo, $ as LinkIssue, a0 as OverflowIssue, a1 as PreviewResult, a2 as SELECTOR_FEATURES, a3 as STRUCTURAL_FIX_PROPERTIES, a4 as SUPPORT_CLIENTS, a5 as Severity, a6 as SizeIssue, a7 as SourceLocation, a8 as SpamIssue, a9 as SupportLevel, aa as TemplateIssue, ab as TokenEstimate, ac as TokenEstimateWithWarnings, ad as VisualIssue, ae as VmlIssue, af as estimateAiFixTokens, ag as generateFixPrompt, ah as heuristicTokenCount } from './types-edFeUest.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 StyleSurvivalReport, 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-hQYXbiqj.js';
2
+ export { n as AT_RULE_FEATURES, B as BaseIssue, o as COMPOUND_VALUE_FEATURES, p as CSS_FUNCTION_FEATURES, q as CSS_PROPERTY_FEATURES, r as CSS_SUPPORT, s as CSS_SUPPORT_NOTES, t as ClientId, u as ClientTruncation, v as DeliverabilityCheck, w as DeliverabilityIssue, x as DesignIssue, y as EstimateOptions, z as ExportScope, G as FEATURE_LAST_TESTED, H as FeatureKey, J as FixType, K as GRACEFUL_FEATURES, M as HTML_ATTRIBUTE_FEATURES, N as HTML_ELEMENT_FEATURES, P as HTML_MISC_FEATURES, Q as IMAGE_FORMATS, R as IMAGE_SUPPORT, U as IMAGE_SUPPORT_NOTES, W as ImageFormat, X as ImageInfo, Y as ImageIssue, Z as InboxPreviewIssue, _ as InputFormat, $ as LinkInfo, a0 as LinkIssue, a1 as OverflowIssue, a2 as PreviewResult, a3 as SELECTOR_FEATURES, a4 as STRUCTURAL_FIX_PROPERTIES, a5 as SUPPORT_CLIENTS, a6 as Severity, a7 as SizeIssue, a8 as SourceLocation, a9 as SpamIssue, aa as SupportLevel, ab as TemplateIssue, ac as TokenEstimate, ad as TokenEstimateWithWarnings, ae as VisualIssue, af as VmlIssue, ag as estimateAiFixTokens, ah as generateFixPrompt, ai as heuristicTokenCount } from './types-hQYXbiqj.js';
3
3
  import * as cheerio from 'cheerio';
4
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-BzyXjPrH.js';
4
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy } from './react-email-CDNfg8Ta.js';
5
5
 
6
6
  declare const EMAIL_CLIENTS: EmailClient[];
7
7
  declare function getClient(id: string): EmailClient | undefined;
@@ -157,6 +157,16 @@ declare function generateAiFix(options: GenerateAiFixOptions): Promise<AiFixResu
157
157
  */
158
158
  declare const AI_FIX_SYSTEM_PROMPT = "You are an expert email developer specializing in cross-client HTML email compatibility. You fix emails to render correctly across all email clients.\n\nRules:\n- Return ONLY the fixed code inside a single code fence. No explanations before or after.\n- Preserve all existing content, text, links, and visual design.\n- For structural issues (fixType: \"structural\"), you MUST restructure the HTML; CSS-only changes will not work.\n- Common structural patterns:\n - word-break/overflow-wrap unsupported \u2192 wrap text in <table><tr><td> with constrained width\n - display:flex/grid \u2192 convert to <table> layout (match the original column count and proportions)\n - border-radius in Outlook \u2192 use VML <v:roundrect> with <!--[if mso]> conditionals\n - background-image in Outlook \u2192 use VML <v:rect> with <v:fill>\n - max-width in Outlook \u2192 wrap in <!--[if mso]><table width=\"N\"> conditional\n - position:absolute \u2192 use <table> cells for layout\n - <svg> \u2192 replace with <img> pointing to a hosted PNG\n- For CSS-only issues (fixType: \"css\"), swap properties or add fallbacks.\n- For \"Layout & Visual Issues\", apply the provided Fix directly: add the background-color fallback beneath a gradient/image, append a web-safe font to the stack, and constrain fixed widths wider than the frame to width:100% with max-width.\n- Apply ALL fixes from the issues list: do not skip any.\n- Use the framework syntax specified (JSX/MJML/Maizzle/HTML).\n- For JSX: use camelCase style props, React Email components, and proper TypeScript types.\n- For MJML: use mj-* elements and attributes.\n- For Maizzle: use Tailwind CSS classes.";
159
159
 
160
+ /**
161
+ * Check whether the target clients will keep this email's CSS.
162
+ *
163
+ * These are not support questions. Each rule is a client discarding CSS it
164
+ * parsed correctly, with no error anywhere the author can see.
165
+ */
166
+ declare function checkStyleSurvival(html: string, options?: ParseOptions & {
167
+ framework?: Framework;
168
+ }): StyleSurvivalReport;
169
+
160
170
  /**
161
171
  * caniemail's page for each feature, for a diagnostic's `codeDescription`.
162
172
  *
@@ -425,7 +435,7 @@ interface AuditOptions extends ParseOptions {
425
435
  /** Options for spam analysis */
426
436
  spam?: SpamAnalysisOptions;
427
437
  /** Skip specific checks */
428
- skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design" | "vml">;
438
+ skip?: Array<"spam" | "links" | "accessibility" | "images" | "compatibility" | "inboxPreview" | "size" | "templateVariables" | "overflow" | "visual" | "darkContrast" | "mobileContrast" | "design" | "vml" | "styleSurvival">;
429
439
  }
430
440
  interface AuditReport {
431
441
  compatibility: {
@@ -443,6 +453,8 @@ interface AuditReport {
443
453
  images: ImageReport;
444
454
  inboxPreview: InboxPreview;
445
455
  size: SizeReport;
456
+ /** Rules about clients discarding CSS they parsed fine. */
457
+ styleSurvival: StyleSurvivalReport;
446
458
  templateVariables: TemplateReport;
447
459
  overflow: OverflowReport;
448
460
  visual: VisualReport;
@@ -691,4 +703,4 @@ declare function colorDistance(a: RGBA, b: RGBA): number;
691
703
  */
692
704
  declare function downlevelCSS(html: string): string;
693
705
 
694
- export { AI_FIX_SYSTEM_PROMPT, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, CSSWarning, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, SizeReport, SpamAnalysisOptions, SpamReport, 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 };
706
+ export { AI_FIX_SYSTEM_PROMPT, AccessibilityIssue, AccessibilityReport, AiFixResult, AiProvider, type AuditOptions, type AuditReport, CSSWarning, CodeFix, type CreateSessionOptions, DeliverabilityReport, DesignReport, DiffResult, EMAIL_CLIENTS, EMPTY_DELIVERABILITY, EmailClient, type EmailSession, ExportPromptOptions, FEATURE_URLS, Framework, GENERIC_LINK_TEXT, type GenerateAiFixOptions, ImageReport, InboxPreview, LinkReport, MAX_HTML_SIZE, MAX_WARNING_LOCATIONS, OverflowReport, type ParseOptions, type RGBA, type RenderContext, SizeReport, SpamAnalysisOptions, SpamReport, TemplateReport, TransformResult, VALUE_CAVEAT_PROPS, VisualReport, VmlReport, type WcagGrade, alphaBlend, analyzeEmail, analyzeImages, analyzeSpam, arcsizeToRadius, auditEmail, caveatApplies, checkAccessibility, checkDarkModeContrast, checkDarkStylesContrastFromDom, checkDesignConsistency, checkMobileContrast, checkOverflow, checkSize, checkStyleSurvival, 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 };