@emailens/cli 0.13.5 → 0.13.6
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/{chunk-N2VVATK3.js → chunk-SBRXUNV5.js} +199 -45
- package/dist/index.js +202 -48
- package/dist/test.js +1 -1
- package/package.json +2 -2
|
@@ -63271,7 +63271,10 @@ var DOWNLEVEL_REVEALED = /<!--\[if[^\]]*!\s*\(*\s*(?:mso|vml|true)[^\]]*\]>\s*<(
|
|
|
63271
63271
|
var DOWNLEVEL_HIDDEN = /<!--\[if(?![^\]]*!)[^\]]*(?:mso|vml|true)[^\]]*\]>([\s\S]*?)<!\[endif\]-->/gi;
|
|
63272
63272
|
var OFFICE_SETTINGS = /<xml\b[^>]*>[\s\S]*?<\/xml>/gi;
|
|
63273
63273
|
function resolveMsoBranch(html3) {
|
|
63274
|
-
return html3.replace(DOWNLEVEL_REVEALED, "").replace(
|
|
63274
|
+
return html3.replace(DOWNLEVEL_REVEALED, "").replace(
|
|
63275
|
+
DOWNLEVEL_HIDDEN,
|
|
63276
|
+
(_3, inner) => /^\s*<style/i.test(inner) ? inner.replace(/(\.[\w-]+\s*\{[^}]*?)font-size\s*:[^;}]*;?/g, "$1") : inner
|
|
63277
|
+
).replace(OFFICE_SETTINGS, "");
|
|
63275
63278
|
}
|
|
63276
63279
|
var MSO_HIDE = /mso-hide\s*:\s*all/i;
|
|
63277
63280
|
function applyMsoHide(html3) {
|
|
@@ -63610,7 +63613,7 @@ var NATURAL_LINE = 1.15;
|
|
|
63610
63613
|
var TABLE_GUTTER = 3.5;
|
|
63611
63614
|
var INVISIBLE_ONLY = /^[\s\u00a0\u00ad\u034f\u200b-\u200d\u2007\ufeff]+$/;
|
|
63612
63615
|
var LIST_TRAILING_PX = 18;
|
|
63613
|
-
var
|
|
63616
|
+
var LIST_TEXT_INDENT_PX = 48;
|
|
63614
63617
|
var MAX_BORDER_PX = 8;
|
|
63615
63618
|
var capBorder = (value) => value.replace(
|
|
63616
63619
|
/(\d+(?:\.\d+)?)px/gi,
|
|
@@ -63662,7 +63665,8 @@ function fontFaceWinners($3, faces) {
|
|
|
63662
63665
|
order++;
|
|
63663
63666
|
for (const one of selector.split(",")) {
|
|
63664
63667
|
if (!one.trim() || IGNORED_BY_WORD.test(one)) continue;
|
|
63665
|
-
const
|
|
63668
|
+
const universal = one.trim() === "*";
|
|
63669
|
+
const family2 = universal ? WORD_DEFAULT : drawn;
|
|
63666
63670
|
let matched;
|
|
63667
63671
|
try {
|
|
63668
63672
|
matched = $3(one).toArray();
|
|
@@ -63672,7 +63676,8 @@ function fontFaceWinners($3, faces) {
|
|
|
63672
63676
|
const weight = (important ? 1e12 : 0) + specificity(one.trim()) * 1e5 + order;
|
|
63673
63677
|
for (const el2 of matched) {
|
|
63674
63678
|
const was = best.get(el2);
|
|
63675
|
-
|
|
63679
|
+
const inherited2 = universal && $3(el2).parents("[style*='font-family']").length > 0;
|
|
63680
|
+
if (!was || weight > was.weight) best.set(el2, { weight, family: inherited2 ? "inherit" : family2 });
|
|
63676
63681
|
}
|
|
63677
63682
|
}
|
|
63678
63683
|
}
|
|
@@ -63682,6 +63687,14 @@ function fontFaceWinners($3, faces) {
|
|
|
63682
63687
|
return out;
|
|
63683
63688
|
}
|
|
63684
63689
|
var IGNORED_BY_WORD = /\[|>|:first-child|:nth-child|:not\(|::?before|\.[\w-]+\.[\w-]/;
|
|
63690
|
+
function matchedByWord($3, selector) {
|
|
63691
|
+
if (!selector.trim() || IGNORED_BY_WORD.test(selector)) return [];
|
|
63692
|
+
try {
|
|
63693
|
+
return $3(selector).toArray();
|
|
63694
|
+
} catch (e2) {
|
|
63695
|
+
return [];
|
|
63696
|
+
}
|
|
63697
|
+
}
|
|
63685
63698
|
function overrideStylesheetRules($3, faces) {
|
|
63686
63699
|
var _a22;
|
|
63687
63700
|
const override = (el2, declarations) => {
|
|
@@ -63704,14 +63717,7 @@ function overrideStylesheetRules($3, faces) {
|
|
|
63704
63717
|
const hides = props.get("display") === "none";
|
|
63705
63718
|
if (!hasPadding && !hasSize && !hasBackground && !hides) continue;
|
|
63706
63719
|
for (const one of selector.split(",")) {
|
|
63707
|
-
|
|
63708
|
-
let matched;
|
|
63709
|
-
try {
|
|
63710
|
-
matched = $3(one).toArray();
|
|
63711
|
-
} catch (e2) {
|
|
63712
|
-
continue;
|
|
63713
|
-
}
|
|
63714
|
-
for (const el2 of matched) {
|
|
63720
|
+
for (const el2 of matchedByWord($3, one)) {
|
|
63715
63721
|
const tag = (_b = el2.tagName) == null ? void 0 : _b.toLowerCase();
|
|
63716
63722
|
if (hasPadding && (tag === "div" || tag === "p" || tag === "span" || tag === "a"))
|
|
63717
63723
|
override(el2, "padding:0!important");
|
|
@@ -63754,6 +63760,10 @@ function markHiddenCells(html3) {
|
|
|
63754
63760
|
const style = (_a22 = dq != null ? dq : sq) != null ? _a22 : "";
|
|
63755
63761
|
if (!/display\s*:\s*none/i.test(style) || /mso-hide\s*:/i.test(style)) return whole;
|
|
63756
63762
|
const quote = dq === void 0 ? "'" : '"';
|
|
63763
|
+
if (/^<t[dh]\s/i.test(lead) && /padding/i.test(style)) {
|
|
63764
|
+
const kept = style.replace(/display\s*:\s*none\s*(?:!important)?\s*;?/gi, "");
|
|
63765
|
+
return `${lead}${quote}${kept}${/;\s*$/.test(kept) ? "" : ";"}mso-hollow:1${quote}`;
|
|
63766
|
+
}
|
|
63757
63767
|
return `${lead}${quote}${style}${/;\s*$/.test(style) ? "" : ";"}mso-hide:all${quote}`;
|
|
63758
63768
|
}
|
|
63759
63769
|
);
|
|
@@ -63768,22 +63778,24 @@ function declaredFaces($3) {
|
|
|
63768
63778
|
for (const [, body] of ((_a22 = $3(block).html()) != null ? _a22 : "").matchAll(/@font-face\s*\{([^}]*)\}/gi)) {
|
|
63769
63779
|
const props = parseInlineStyle(body);
|
|
63770
63780
|
const family = props.get("font-family");
|
|
63771
|
-
const
|
|
63781
|
+
const named = ((_b = props.get("mso-font-alt")) == null ? void 0 : _b.replace(/["']/g, "").trim()) || null;
|
|
63782
|
+
const alt = named && /^sans-serif$/i.test(named) ? WORD_DEFAULT : named;
|
|
63772
63783
|
if (family) faces.set(firstFamily(family), (_c2 = alt != null ? alt : faces.get(firstFamily(family))) != null ? _c2 : null);
|
|
63773
63784
|
}
|
|
63774
63785
|
});
|
|
63775
63786
|
return faces;
|
|
63776
63787
|
}
|
|
63777
63788
|
var firstFamily = (value) => value.split(",")[0].replace(/["']|!important/gi, "").trim().toLowerCase();
|
|
63778
|
-
var
|
|
63789
|
+
var WORD_DEFAULT = "Aptos,'Segoe UI',sans-serif";
|
|
63779
63790
|
function wordFamily(value, faces) {
|
|
63780
|
-
|
|
63781
|
-
const
|
|
63782
|
-
|
|
63791
|
+
const families = value.replace(/!important/gi, "").split(",");
|
|
63792
|
+
const named = families.filter((f3) => !/^\s*(?:system-ui|ui-[a-z-]+)\s*$/i.test(f3));
|
|
63793
|
+
const first2 = firstFamily(named.join(","));
|
|
63794
|
+
if (!faces.has(first2)) return named.length < families.length ? named.join(",").trim() || WORD_DEFAULT : null;
|
|
63783
63795
|
const alt = faces.get(first2);
|
|
63784
|
-
if (alt) return `'${alt}'`;
|
|
63785
|
-
const rest =
|
|
63786
|
-
return rest ||
|
|
63796
|
+
if (alt) return alt === WORD_DEFAULT ? alt : `'${alt}'`;
|
|
63797
|
+
const rest = named.slice(1).join(",").trim();
|
|
63798
|
+
return rest || WORD_DEFAULT;
|
|
63787
63799
|
}
|
|
63788
63800
|
function hasBorder(props) {
|
|
63789
63801
|
for (const prop2 of ["border", "border-top", "border-right", "border-bottom", "border-left"]) {
|
|
@@ -63803,7 +63815,7 @@ function leftPadding(props) {
|
|
|
63803
63815
|
function applyWordBoxModel($3) {
|
|
63804
63816
|
const faces = declaredFaces($3);
|
|
63805
63817
|
$3("[style]").each((_3, node) => {
|
|
63806
|
-
var _a22, _b, _c2, _d, _e2, _f, _g;
|
|
63818
|
+
var _a22, _b, _c2, _d, _e2, _f, _g, _h2, _i2, _j, _k, _l2, _m2, _n2;
|
|
63807
63819
|
const el2 = node;
|
|
63808
63820
|
const tag = (_a22 = el2.tagName) == null ? void 0 : _a22.toLowerCase();
|
|
63809
63821
|
const props = parseInlineStyle($3(el2).attr("style") || "");
|
|
@@ -63811,20 +63823,37 @@ function applyWordBoxModel($3) {
|
|
|
63811
63823
|
for (const prop2 of [...PADDING, ...MARGIN]) {
|
|
63812
63824
|
if (/\d(?:\.\d+)?rem\b/i.test((_b = props.get(prop2)) != null ? _b : "")) props.delete(prop2);
|
|
63813
63825
|
}
|
|
63814
|
-
const bordered = (tag === "div" || tag === "p") && hasBorder(props);
|
|
63815
|
-
if (
|
|
63826
|
+
const bordered = (tag === "div" || tag === "p" || tag === "a") && hasBorder(props);
|
|
63827
|
+
if (bordered && tag === "a") {
|
|
63828
|
+
props.set("display", "inline-block");
|
|
63829
|
+
$3(el2).attr("data-word-box", "");
|
|
63830
|
+
const fill = (_c2 = props.get("background-color")) != null ? _c2 : props.get("background");
|
|
63831
|
+
if (fill) {
|
|
63832
|
+
props.delete("background-color");
|
|
63833
|
+
props.delete("background");
|
|
63834
|
+
$3(el2).html(`<span style="background-color:${fill}">${$3(el2).html()}</span>`);
|
|
63835
|
+
}
|
|
63836
|
+
}
|
|
63837
|
+
if (bordered && !props.has("border") && !props.has("border-top")) props.set("padding-top", "0");
|
|
63838
|
+
const spacerRuns = tag === "a" && ((_d = $3(el2).html()) == null ? void 0 : _d.includes("mso-font-width"));
|
|
63839
|
+
if (spacerRuns) props.set("display", "inline-block");
|
|
63840
|
+
if ((tag === "div" || tag === "p" || tag === "span" || tag === "a") && !bordered && !spacerRuns) {
|
|
63816
63841
|
for (const prop2 of PADDING) props.delete(prop2);
|
|
63817
63842
|
}
|
|
63818
|
-
if (/^(?:fit|max|min)-content$/i.test(((
|
|
63843
|
+
if (/^(?:fit|max|min)-content$/i.test(((_e2 = props.get("width")) != null ? _e2 : "").replace(/!important/i, "").trim())) props.delete("width");
|
|
63819
63844
|
if (tag === "div" || tag === "span") {
|
|
63820
63845
|
props.delete("width");
|
|
63821
63846
|
props.delete("height");
|
|
63822
63847
|
}
|
|
63823
|
-
if (tag === "div") {
|
|
63848
|
+
if (tag === "div" || tag === "table") {
|
|
63824
63849
|
for (const prop2 of MARGIN) {
|
|
63825
63850
|
const value = props.get(prop2);
|
|
63826
63851
|
if (value !== void 0) props.set(prop2, flattenMargin(value));
|
|
63827
63852
|
}
|
|
63853
|
+
if (tag === "table" && /center/i.test((_f = $3(el2).attr("align")) != null ? _f : "")) {
|
|
63854
|
+
props.delete("margin-top");
|
|
63855
|
+
props.delete("margin-bottom");
|
|
63856
|
+
}
|
|
63828
63857
|
}
|
|
63829
63858
|
if ((tag === "div" || tag === "h2") && holdsNoText($3, el2)) {
|
|
63830
63859
|
props.delete("background");
|
|
@@ -63833,18 +63862,24 @@ function applyWordBoxModel($3) {
|
|
|
63833
63862
|
const family = props.get("font-family");
|
|
63834
63863
|
const drawn = family === void 0 ? null : wordFamily(family, faces);
|
|
63835
63864
|
if (drawn) props.set("font-family", drawn);
|
|
63865
|
+
if ((tag === "body" || tag === "td") && /^\s*sans-serif(?![\w-])/i.test((_g = drawn != null ? drawn : family) != null ? _g : "")) props.set("font-family", WORD_DEFAULT);
|
|
63866
|
+
if (/none/i.test((_h2 = props.get("mso-border-alt")) != null ? _h2 : "")) {
|
|
63867
|
+
for (const prop2 of [...props.keys()]) if (prop2.startsWith("border") && prop2 !== "border-radius") props.delete(prop2);
|
|
63868
|
+
}
|
|
63869
|
+
if (/transparent/i.test((_i2 = props.get("mso-shading")) != null ? _i2 : "")) props.delete("background-color");
|
|
63836
63870
|
const lineAlt = props.get("mso-line-height-alt");
|
|
63837
|
-
|
|
63838
|
-
|
|
63839
|
-
const
|
|
63840
|
-
|
|
63871
|
+
const altEm = /^([\d.]+)em$/i.exec((_j = lineAlt == null ? void 0 : lineAlt.trim()) != null ? _j : "");
|
|
63872
|
+
if (lineAlt !== void 0) props.set("line-height", altEm ? `${Number(altEm[1]) * 16}px` : lineAlt);
|
|
63873
|
+
const lineHeight = /^([\d.]+)px$/i.exec((_k = props.get("line-height")) != null ? _k : "");
|
|
63874
|
+
const fontSize = /^([\d.]+)px$/i.exec((_l2 = props.get("font-size")) != null ? _l2 : "");
|
|
63875
|
+
if (lineHeight && fontSize && !/exactly/i.test((_m2 = props.get("mso-line-height-rule")) != null ? _m2 : "")) {
|
|
63841
63876
|
const natural = Math.round(Number(fontSize[1]) * NATURAL_LINE);
|
|
63842
63877
|
if (Number(lineHeight[1]) < natural) props.set("line-height", `${natural}px`);
|
|
63843
63878
|
}
|
|
63844
63879
|
for (const prop2 of ["word-spacing", "outline", "outline-width", "outline-style", "outline-color", "outline-offset"]) {
|
|
63845
63880
|
props.delete(prop2);
|
|
63846
63881
|
}
|
|
63847
|
-
if (tag === "div" && /^center$/i.test((
|
|
63882
|
+
if (tag === "div" && /^center$/i.test((_n2 = props.get("text-align")) != null ? _n2 : "") && !$3(el2).attr("align")) {
|
|
63848
63883
|
$3(el2).attr("align", "center");
|
|
63849
63884
|
props.delete("text-align");
|
|
63850
63885
|
}
|
|
@@ -63867,6 +63902,38 @@ function applyWordBoxModel($3) {
|
|
|
63867
63902
|
else $3(el2).removeAttr("style");
|
|
63868
63903
|
}
|
|
63869
63904
|
});
|
|
63905
|
+
$3("td[style*='mso-hollow'], th[style*='mso-hollow']").each((_3, node) => {
|
|
63906
|
+
const cell = $3(node);
|
|
63907
|
+
const props = parseInlineStyle(cell.attr("style") || "");
|
|
63908
|
+
props.delete("mso-hollow");
|
|
63909
|
+
props.set("display", "table-cell!important");
|
|
63910
|
+
props.set("font-size", "0");
|
|
63911
|
+
props.set("line-height", "0");
|
|
63912
|
+
cell.empty().attr("style", serializeStyle(props));
|
|
63913
|
+
});
|
|
63914
|
+
$3("hr").each((_3, node) => {
|
|
63915
|
+
var _a22, _b, _c2;
|
|
63916
|
+
const props = parseInlineStyle($3(node).attr("style") || "");
|
|
63917
|
+
const [top = "", , bottom = top] = ((_a22 = props.get("margin")) != null ? _a22 : "").trim().split(/\s+/).concat([""]);
|
|
63918
|
+
const px2 = (v) => Number.parseFloat(v != null ? v : "") || 0;
|
|
63919
|
+
const set = /* @__PURE__ */ new Map([
|
|
63920
|
+
["border", "none"],
|
|
63921
|
+
["border-top", "1px solid #a0a0a0"],
|
|
63922
|
+
["height", "0"],
|
|
63923
|
+
["width", "100%"],
|
|
63924
|
+
["margin", `${px2((_b = props.get("margin-top")) != null ? _b : top) + 4}px 0 ${px2((_c2 = props.get("margin-bottom")) != null ? _c2 : bottom || top) + 4}px`]
|
|
63925
|
+
]);
|
|
63926
|
+
$3(node).attr("style", serializeStyle(set));
|
|
63927
|
+
});
|
|
63928
|
+
$3("a").each((_3, node) => {
|
|
63929
|
+
if (!$3(node).children("div").length) return;
|
|
63930
|
+
$3(node).before('<div style="height:21px"></div>').after('<div style="height:20px"></div>');
|
|
63931
|
+
});
|
|
63932
|
+
$3("a[style*='text-decoration-line']").each((_3, node) => {
|
|
63933
|
+
const props = parseInlineStyle($3(node).attr("style") || "");
|
|
63934
|
+
props.delete("text-decoration-line");
|
|
63935
|
+
$3(node).attr("style", serializeStyle(props));
|
|
63936
|
+
});
|
|
63870
63937
|
$3("td table, th table").each((_3, node) => {
|
|
63871
63938
|
const table = node;
|
|
63872
63939
|
const own = parseInlineStyle($3(table).attr("style") || "");
|
|
@@ -63883,10 +63950,11 @@ function applyWordBoxModel($3) {
|
|
|
63883
63950
|
$3(table).attr("style", serializeStyle(props));
|
|
63884
63951
|
});
|
|
63885
63952
|
$3("img").each((_3, node) => {
|
|
63886
|
-
var _a22;
|
|
63953
|
+
var _a22, _b, _c2, _d;
|
|
63887
63954
|
const el2 = node;
|
|
63888
63955
|
const props = parseInlineStyle($3(el2).attr("style") || "");
|
|
63889
63956
|
const NUMBER = /^\d+(?:\.\d+)?$/;
|
|
63957
|
+
const percent = /^\d+(?:\.\d+)?%$/.test((_b = (_a22 = $3(el2).attr("width")) == null ? void 0 : _a22.trim()) != null ? _b : "") ? (_c2 = $3(el2).attr("width")) == null ? void 0 : _c2.trim() : void 0;
|
|
63890
63958
|
const numeric = (name) => {
|
|
63891
63959
|
var _a32;
|
|
63892
63960
|
const value = (_a32 = $3(el2).attr(name)) == null ? void 0 : _a32.trim();
|
|
@@ -63900,11 +63968,11 @@ function applyWordBoxModel($3) {
|
|
|
63900
63968
|
}
|
|
63901
63969
|
for (const name of ["hspace", "vspace"]) $3(el2).removeAttr(name);
|
|
63902
63970
|
if ($3(el2).attr("border") !== void 0) $3(el2).attr("border", "0");
|
|
63903
|
-
props.set("width", width ? `${width}px!important` : "auto!important");
|
|
63971
|
+
props.set("width", percent ? `${percent}!important` : width ? `${width}px!important` : "auto!important");
|
|
63904
63972
|
props.set("height", height ? `${height}px!important` : "auto!important");
|
|
63905
63973
|
props.set("max-width", "none!important");
|
|
63906
63974
|
props.set("vertical-align", "bottom");
|
|
63907
|
-
if (/\.(?:svg|webp)(?:[?#]|$)/i.test((
|
|
63975
|
+
if (/\.(?:svg|webp)(?:[?#]|$)/i.test((_d = $3(el2).attr("src")) != null ? _d : "")) props.set("visibility", "hidden");
|
|
63908
63976
|
const after2 = serializeStyle(props);
|
|
63909
63977
|
if (after2) $3(el2).attr("style", after2);
|
|
63910
63978
|
else $3(el2).removeAttr("style");
|
|
@@ -63916,20 +63984,18 @@ function applyWordBoxModel($3) {
|
|
|
63916
63984
|
if (text3.length > 20 && INVISIBLE_ONLY.test(text3)) el2.text(String.fromCharCode(160));
|
|
63917
63985
|
});
|
|
63918
63986
|
$3("ul,ol").each((_3, node) => {
|
|
63919
|
-
var _a22;
|
|
63920
63987
|
const el2 = node;
|
|
63921
63988
|
const props = parseInlineStyle($3(el2).attr("style") || "");
|
|
63922
|
-
const margin = ((_a22 = props.get("margin")) != null ? _a22 : "").trim().split(/\s+/).filter(Boolean);
|
|
63923
|
-
const indented = props.has("margin-left") || props.has("padding-left") || props.has("padding") || margin.length > 0;
|
|
63924
63989
|
let previous = el2.prev;
|
|
63925
63990
|
while (previous && previous.type === "text" && !previous.data.trim()) previous = previous.prev;
|
|
63926
63991
|
const afterBreak = (previous == null ? void 0 : previous.type) === "tag" && previous.name === "br";
|
|
63927
|
-
|
|
63928
|
-
|
|
63929
|
-
|
|
63930
|
-
|
|
63931
|
-
|
|
63932
|
-
}
|
|
63992
|
+
const tight = $3(el2).children("li").toArray().some((item) => {
|
|
63993
|
+
const style = parseInlineStyle($3(item).attr("style") || "");
|
|
63994
|
+
return style.has("margin") || style.has("margin-top") || style.has("margin-bottom");
|
|
63995
|
+
});
|
|
63996
|
+
props.set("margin-top", afterBreak || previous && !tight ? "1lh!important" : "0!important");
|
|
63997
|
+
props.set("margin-bottom", tight ? "0!important" : `${LIST_TRAILING_PX}px!important`);
|
|
63998
|
+
props.set("padding-left", `${LIST_TEXT_INDENT_PX}px!important`);
|
|
63933
63999
|
$3(el2).attr("style", serializeStyle(props));
|
|
63934
64000
|
});
|
|
63935
64001
|
$3("picture source").remove();
|
|
@@ -63967,7 +64033,94 @@ function applyWordBoxModel($3) {
|
|
|
63967
64033
|
})) return;
|
|
63968
64034
|
cell.attr("style", `${style}${style.trim() === "" || /;\s*$/.test(style) ? "" : ";"}text-align:left`);
|
|
63969
64035
|
});
|
|
63970
|
-
|
|
64036
|
+
$3("table").each((_3, node) => {
|
|
64037
|
+
var _a22, _b, _c2, _d, _e2, _f, _g, _h2;
|
|
64038
|
+
const table = $3(node);
|
|
64039
|
+
const props = parseInlineStyle(table.attr("style") || "");
|
|
64040
|
+
const box2 = ((_a22 = props.get("margin")) != null ? _a22 : "").trim().split(/\s+/).filter(Boolean);
|
|
64041
|
+
const top = Number.parseFloat((_c2 = (_b = props.get("margin-top")) != null ? _b : box2[0]) != null ? _c2 : "") || 0;
|
|
64042
|
+
const bottom = Number.parseFloat((_f = (_e2 = (_d = props.get("margin-bottom")) != null ? _d : box2[2]) != null ? _e2 : box2[0]) != null ? _f : "") || 0;
|
|
64043
|
+
if (top <= 0 && bottom <= 0 || /center/i.test((_g = table.attr("align")) != null ? _g : "")) return;
|
|
64044
|
+
const rows = table.find("> tr, > tbody > tr");
|
|
64045
|
+
const grow = (row, side, by2) => {
|
|
64046
|
+
row.children("td, th").each((_22, cell) => {
|
|
64047
|
+
var _a32, _b2, _c22, _d2;
|
|
64048
|
+
const own = parseInlineStyle($3(cell).attr("style") || "");
|
|
64049
|
+
const pad = ((_a32 = own.get("padding")) != null ? _a32 : "").trim().split(/\s+/).filter(Boolean);
|
|
64050
|
+
const was = Number.parseFloat((_d2 = (_c22 = own.get(`padding-${side}`)) != null ? _c22 : side === "top" ? pad[0] : (_b2 = pad[2]) != null ? _b2 : pad[0]) != null ? _d2 : "") || 0;
|
|
64051
|
+
own.set(`padding-${side}`, `${was + by2}px`);
|
|
64052
|
+
$3(cell).attr("style", serializeStyle(own));
|
|
64053
|
+
});
|
|
64054
|
+
};
|
|
64055
|
+
if (!rows.length) return;
|
|
64056
|
+
if (top > 0) grow(rows.first(), "top", top);
|
|
64057
|
+
if (bottom > 0) grow(rows.last(), "bottom", bottom);
|
|
64058
|
+
props.delete("margin-top");
|
|
64059
|
+
props.delete("margin-bottom");
|
|
64060
|
+
if (box2.length) {
|
|
64061
|
+
props.delete("margin");
|
|
64062
|
+
if (box2[1]) props.set("margin-left", (_h2 = box2[3]) != null ? _h2 : box2[1]);
|
|
64063
|
+
if (box2[1]) props.set("margin-right", box2[1]);
|
|
64064
|
+
}
|
|
64065
|
+
table.attr("style", serializeStyle(props));
|
|
64066
|
+
});
|
|
64067
|
+
$3("table").each((_3, node) => {
|
|
64068
|
+
var _a22, _b;
|
|
64069
|
+
const props = parseInlineStyle($3(node).attr("style") || "");
|
|
64070
|
+
if (!/para-border-div/i.test((_a22 = props.get("mso-element")) != null ? _a22 : "")) return;
|
|
64071
|
+
const width = Number.parseFloat((_b = props.get("mso-element-frame-width")) != null ? _b : "");
|
|
64072
|
+
if (!width) return;
|
|
64073
|
+
props.delete("max-width");
|
|
64074
|
+
props.set("width", `${width + 17}px`);
|
|
64075
|
+
props.set("box-sizing", "border-box");
|
|
64076
|
+
props.set("margin", "0 auto");
|
|
64077
|
+
props.set("padding", "4px 12px 4px 4px");
|
|
64078
|
+
props.set("border", "1px dotted #a6a6a6");
|
|
64079
|
+
props.set("border-collapse", "separate");
|
|
64080
|
+
props.set("text-align", "justify");
|
|
64081
|
+
$3(node).attr("style", serializeStyle(props));
|
|
64082
|
+
$3(node).removeAttr("width");
|
|
64083
|
+
});
|
|
64084
|
+
$3("table").each((_3, node) => {
|
|
64085
|
+
var _a22, _b;
|
|
64086
|
+
const props = parseInlineStyle($3(node).attr("style") || "");
|
|
64087
|
+
const zero = /^0(?:px)?\s+solid\s+(\S+)/i.exec((_b = (_a22 = props.get("border")) == null ? void 0 : _a22.trim()) != null ? _b : "");
|
|
64088
|
+
if (!zero) return;
|
|
64089
|
+
props.set("border", `1px solid ${zero[1]}`);
|
|
64090
|
+
$3(node).attr("style", serializeStyle(props));
|
|
64091
|
+
});
|
|
64092
|
+
const borderOf = (style) => [...parseInlineStyle(style != null ? style : "")].filter(([k2, v]) => k2.startsWith("border") && !/^0|none/.test(v)).join(";");
|
|
64093
|
+
$3("p").each((_3, node) => {
|
|
64094
|
+
var _a22;
|
|
64095
|
+
const p = $3(node);
|
|
64096
|
+
const next2 = p.next();
|
|
64097
|
+
const border = borderOf(p.attr("style"));
|
|
64098
|
+
if (!border || !next2.is("p") || borderOf(next2.attr("style")) !== border) return;
|
|
64099
|
+
const props = parseInlineStyle((_a22 = p.attr("style")) != null ? _a22 : "");
|
|
64100
|
+
for (const key of [...props.keys()]) if (key.startsWith("border")) props.delete(key);
|
|
64101
|
+
props.set("padding-bottom", "0");
|
|
64102
|
+
p.attr("style", serializeStyle(props));
|
|
64103
|
+
});
|
|
64104
|
+
const margined = /* @__PURE__ */ new Set();
|
|
64105
|
+
$3("style").each((_3, block) => {
|
|
64106
|
+
var _a22;
|
|
64107
|
+
for (const { selector, body } of topLevelRules((_a22 = $3(block).html()) != null ? _a22 : "")) {
|
|
64108
|
+
const props = parseInlineStyle(body);
|
|
64109
|
+
if (!props.has("margin") && !props.has("margin-top") && !props.has("margin-bottom")) continue;
|
|
64110
|
+
for (const one of selector.split(",")) for (const el2 of matchedByWord($3, one)) margined.add(el2);
|
|
64111
|
+
}
|
|
64112
|
+
});
|
|
64113
|
+
$3("p").each((_3, node) => {
|
|
64114
|
+
const p = $3(node);
|
|
64115
|
+
const props = parseInlineStyle(p.attr("style") || "");
|
|
64116
|
+
if (props.has("margin") || props.has("margin-top") || props.has("margin-bottom")) return;
|
|
64117
|
+
if (margined.has(node)) return;
|
|
64118
|
+
if (!p.prev().length) props.set("margin-top", "0");
|
|
64119
|
+
if (!p.next().length) props.set("margin-bottom", "0");
|
|
64120
|
+
const after2 = serializeStyle(props);
|
|
64121
|
+
if (after2) p.attr("style", after2);
|
|
64122
|
+
});
|
|
64123
|
+
const reset = "<style>h2{margin:0}p{margin:14pt 0}</style>";
|
|
63971
64124
|
const head = $3("head");
|
|
63972
64125
|
if (head.length) head.prepend(reset);
|
|
63973
64126
|
else if ($3("p,h2").length) $3.root().prepend(reset);
|
|
@@ -65250,12 +65403,12 @@ function outlookWindowsAdditionalChecks($3, clientId, _html, framework) {
|
|
|
65250
65403
|
message: "Outlook Classic ignores border-radius. Buttons and containers will have sharp corners."
|
|
65251
65404
|
}, "border-radius", clientId, framework));
|
|
65252
65405
|
}
|
|
65253
|
-
if ($3("[style*='max-width']").length > 0) {
|
|
65406
|
+
if ($3("[style*='max-width']").not("table").length > 0) {
|
|
65254
65407
|
warnings.push(makeWarning({
|
|
65255
65408
|
severity: "warning",
|
|
65256
65409
|
client: clientId,
|
|
65257
65410
|
property: "max-width",
|
|
65258
|
-
message: "Outlook Classic ignores max-width."
|
|
65411
|
+
message: "Outlook Classic ignores max-width except on tables."
|
|
65259
65412
|
}, "max-width", clientId, framework));
|
|
65260
65413
|
}
|
|
65261
65414
|
const hasDivLayout = $3("div[style*='display']").length > 0 || $3("div[style*='flex']").length > 0 || $3("div[style*='grid']").length > 0;
|
|
@@ -65980,6 +66133,7 @@ function applyTransformDom($3, html3, config, framework) {
|
|
|
65980
66133
|
const removed = [];
|
|
65981
66134
|
props.forEach((value, prop2) => {
|
|
65982
66135
|
var _a32;
|
|
66136
|
+
if (prop2 === "max-width" && clientId === "outlook-windows-legacy" && $3(el2).is("table")) return;
|
|
65983
66137
|
if (config.strippedProperties.has(prop2)) {
|
|
65984
66138
|
if (config.stripMode === "strip") {
|
|
65985
66139
|
removed.push(prop2);
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
simulateDarkMode,
|
|
33
33
|
toFramework,
|
|
34
34
|
transformForAllClients
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-SBRXUNV5.js";
|
|
36
36
|
import "./chunk-ABDTBRVK.js";
|
|
37
37
|
import "./chunk-2AP7CT6R.js";
|
|
38
38
|
import "./chunk-NXBRJX3V.js";
|
|
@@ -33305,7 +33305,10 @@ h1 {
|
|
|
33305
33305
|
var DOWNLEVEL_HIDDEN = /<!--\[if(?![^\]]*!)[^\]]*(?:mso|vml|true)[^\]]*\]>([\s\S]*?)<!\[endif\]-->/gi;
|
|
33306
33306
|
var OFFICE_SETTINGS = /<xml\b[^>]*>[\s\S]*?<\/xml>/gi;
|
|
33307
33307
|
function resolveMsoBranch(html) {
|
|
33308
|
-
return html.replace(DOWNLEVEL_REVEALED, "").replace(
|
|
33308
|
+
return html.replace(DOWNLEVEL_REVEALED, "").replace(
|
|
33309
|
+
DOWNLEVEL_HIDDEN,
|
|
33310
|
+
(_, inner) => /^\s*<style/i.test(inner) ? inner.replace(/(\.[\w-]+\s*\{[^}]*?)font-size\s*:[^;}]*;?/g, "$1") : inner
|
|
33311
|
+
).replace(OFFICE_SETTINGS, "");
|
|
33309
33312
|
}
|
|
33310
33313
|
var MSO_HIDE = /mso-hide\s*:\s*all/i;
|
|
33311
33314
|
function applyMsoHide(html) {
|
|
@@ -33648,7 +33651,7 @@ h1 {
|
|
|
33648
33651
|
var TABLE_GUTTER = 3.5;
|
|
33649
33652
|
var INVISIBLE_ONLY = /^[\s\u00a0\u00ad\u034f\u200b-\u200d\u2007\ufeff]+$/;
|
|
33650
33653
|
var LIST_TRAILING_PX = 18;
|
|
33651
|
-
var
|
|
33654
|
+
var LIST_TEXT_INDENT_PX = 48;
|
|
33652
33655
|
var MAX_BORDER_PX = 8;
|
|
33653
33656
|
var capBorder = (value) => value.replace(
|
|
33654
33657
|
/(\d+(?:\.\d+)?)px/gi,
|
|
@@ -33700,7 +33703,8 @@ h1 {
|
|
|
33700
33703
|
order++;
|
|
33701
33704
|
for (const one of selector.split(",")) {
|
|
33702
33705
|
if (!one.trim() || IGNORED_BY_WORD.test(one)) continue;
|
|
33703
|
-
const
|
|
33706
|
+
const universal = one.trim() === "*";
|
|
33707
|
+
const family2 = universal ? WORD_DEFAULT : drawn;
|
|
33704
33708
|
let matched;
|
|
33705
33709
|
try {
|
|
33706
33710
|
matched = $(one).toArray();
|
|
@@ -33710,7 +33714,8 @@ h1 {
|
|
|
33710
33714
|
const weight = (important ? 1e12 : 0) + specificity(one.trim()) * 1e5 + order;
|
|
33711
33715
|
for (const el of matched) {
|
|
33712
33716
|
const was = best.get(el);
|
|
33713
|
-
|
|
33717
|
+
const inherited2 = universal && $(el).parents("[style*='font-family']").length > 0;
|
|
33718
|
+
if (!was || weight > was.weight) best.set(el, { weight, family: inherited2 ? "inherit" : family2 });
|
|
33714
33719
|
}
|
|
33715
33720
|
}
|
|
33716
33721
|
}
|
|
@@ -33720,6 +33725,14 @@ h1 {
|
|
|
33720
33725
|
return out;
|
|
33721
33726
|
}
|
|
33722
33727
|
var IGNORED_BY_WORD = /\[|>|:first-child|:nth-child|:not\(|::?before|\.[\w-]+\.[\w-]/;
|
|
33728
|
+
function matchedByWord($, selector) {
|
|
33729
|
+
if (!selector.trim() || IGNORED_BY_WORD.test(selector)) return [];
|
|
33730
|
+
try {
|
|
33731
|
+
return $(selector).toArray();
|
|
33732
|
+
} catch (e) {
|
|
33733
|
+
return [];
|
|
33734
|
+
}
|
|
33735
|
+
}
|
|
33723
33736
|
function overrideStylesheetRules($, faces) {
|
|
33724
33737
|
var _a2;
|
|
33725
33738
|
const override = (el, declarations) => {
|
|
@@ -33742,14 +33755,7 @@ h1 {
|
|
|
33742
33755
|
const hides = props.get("display") === "none";
|
|
33743
33756
|
if (!hasPadding && !hasSize && !hasBackground && !hides) continue;
|
|
33744
33757
|
for (const one of selector.split(",")) {
|
|
33745
|
-
|
|
33746
|
-
let matched;
|
|
33747
|
-
try {
|
|
33748
|
-
matched = $(one).toArray();
|
|
33749
|
-
} catch (e) {
|
|
33750
|
-
continue;
|
|
33751
|
-
}
|
|
33752
|
-
for (const el of matched) {
|
|
33758
|
+
for (const el of matchedByWord($, one)) {
|
|
33753
33759
|
const tag = (_b = el.tagName) == null ? void 0 : _b.toLowerCase();
|
|
33754
33760
|
if (hasPadding && (tag === "div" || tag === "p" || tag === "span" || tag === "a"))
|
|
33755
33761
|
override(el, "padding:0!important");
|
|
@@ -33792,6 +33798,10 @@ h1 {
|
|
|
33792
33798
|
const style = (_a2 = dq != null ? dq : sq) != null ? _a2 : "";
|
|
33793
33799
|
if (!/display\s*:\s*none/i.test(style) || /mso-hide\s*:/i.test(style)) return whole;
|
|
33794
33800
|
const quote = dq === void 0 ? "'" : '"';
|
|
33801
|
+
if (/^<t[dh]\s/i.test(lead) && /padding/i.test(style)) {
|
|
33802
|
+
const kept = style.replace(/display\s*:\s*none\s*(?:!important)?\s*;?/gi, "");
|
|
33803
|
+
return `${lead}${quote}${kept}${/;\s*$/.test(kept) ? "" : ";"}mso-hollow:1${quote}`;
|
|
33804
|
+
}
|
|
33795
33805
|
return `${lead}${quote}${style}${/;\s*$/.test(style) ? "" : ";"}mso-hide:all${quote}`;
|
|
33796
33806
|
}
|
|
33797
33807
|
);
|
|
@@ -33806,22 +33816,24 @@ h1 {
|
|
|
33806
33816
|
for (const [, body] of ((_a2 = $(block).html()) != null ? _a2 : "").matchAll(/@font-face\s*\{([^}]*)\}/gi)) {
|
|
33807
33817
|
const props = parseInlineStyle(body);
|
|
33808
33818
|
const family = props.get("font-family");
|
|
33809
|
-
const
|
|
33819
|
+
const named = ((_b = props.get("mso-font-alt")) == null ? void 0 : _b.replace(/["']/g, "").trim()) || null;
|
|
33820
|
+
const alt = named && /^sans-serif$/i.test(named) ? WORD_DEFAULT : named;
|
|
33810
33821
|
if (family) faces.set(firstFamily(family), (_c = alt != null ? alt : faces.get(firstFamily(family))) != null ? _c : null);
|
|
33811
33822
|
}
|
|
33812
33823
|
});
|
|
33813
33824
|
return faces;
|
|
33814
33825
|
}
|
|
33815
33826
|
var firstFamily = (value) => value.split(",")[0].replace(/["']|!important/gi, "").trim().toLowerCase();
|
|
33816
|
-
var
|
|
33827
|
+
var WORD_DEFAULT = "Aptos,'Segoe UI',sans-serif";
|
|
33817
33828
|
function wordFamily(value, faces) {
|
|
33818
|
-
|
|
33819
|
-
const
|
|
33820
|
-
|
|
33829
|
+
const families = value.replace(/!important/gi, "").split(",");
|
|
33830
|
+
const named = families.filter((f) => !/^\s*(?:system-ui|ui-[a-z-]+)\s*$/i.test(f));
|
|
33831
|
+
const first = firstFamily(named.join(","));
|
|
33832
|
+
if (!faces.has(first)) return named.length < families.length ? named.join(",").trim() || WORD_DEFAULT : null;
|
|
33821
33833
|
const alt = faces.get(first);
|
|
33822
|
-
if (alt) return `'${alt}'`;
|
|
33823
|
-
const rest =
|
|
33824
|
-
return rest ||
|
|
33834
|
+
if (alt) return alt === WORD_DEFAULT ? alt : `'${alt}'`;
|
|
33835
|
+
const rest = named.slice(1).join(",").trim();
|
|
33836
|
+
return rest || WORD_DEFAULT;
|
|
33825
33837
|
}
|
|
33826
33838
|
function hasBorder(props) {
|
|
33827
33839
|
for (const prop of ["border", "border-top", "border-right", "border-bottom", "border-left"]) {
|
|
@@ -33841,7 +33853,7 @@ h1 {
|
|
|
33841
33853
|
function applyWordBoxModel($) {
|
|
33842
33854
|
const faces = declaredFaces($);
|
|
33843
33855
|
$("[style]").each((_, node) => {
|
|
33844
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
|
33856
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
33845
33857
|
const el = node;
|
|
33846
33858
|
const tag = (_a2 = el.tagName) == null ? void 0 : _a2.toLowerCase();
|
|
33847
33859
|
const props = parseInlineStyle($(el).attr("style") || "");
|
|
@@ -33849,20 +33861,37 @@ h1 {
|
|
|
33849
33861
|
for (const prop of [...PADDING, ...MARGIN]) {
|
|
33850
33862
|
if (/\d(?:\.\d+)?rem\b/i.test((_b = props.get(prop)) != null ? _b : "")) props.delete(prop);
|
|
33851
33863
|
}
|
|
33852
|
-
const bordered = (tag === "div" || tag === "p") && hasBorder(props);
|
|
33853
|
-
if (
|
|
33864
|
+
const bordered = (tag === "div" || tag === "p" || tag === "a") && hasBorder(props);
|
|
33865
|
+
if (bordered && tag === "a") {
|
|
33866
|
+
props.set("display", "inline-block");
|
|
33867
|
+
$(el).attr("data-word-box", "");
|
|
33868
|
+
const fill = (_c = props.get("background-color")) != null ? _c : props.get("background");
|
|
33869
|
+
if (fill) {
|
|
33870
|
+
props.delete("background-color");
|
|
33871
|
+
props.delete("background");
|
|
33872
|
+
$(el).html(`<span style="background-color:${fill}">${$(el).html()}</span>`);
|
|
33873
|
+
}
|
|
33874
|
+
}
|
|
33875
|
+
if (bordered && !props.has("border") && !props.has("border-top")) props.set("padding-top", "0");
|
|
33876
|
+
const spacerRuns = tag === "a" && ((_d = $(el).html()) == null ? void 0 : _d.includes("mso-font-width"));
|
|
33877
|
+
if (spacerRuns) props.set("display", "inline-block");
|
|
33878
|
+
if ((tag === "div" || tag === "p" || tag === "span" || tag === "a") && !bordered && !spacerRuns) {
|
|
33854
33879
|
for (const prop of PADDING) props.delete(prop);
|
|
33855
33880
|
}
|
|
33856
|
-
if (/^(?:fit|max|min)-content$/i.test(((
|
|
33881
|
+
if (/^(?:fit|max|min)-content$/i.test(((_e = props.get("width")) != null ? _e : "").replace(/!important/i, "").trim())) props.delete("width");
|
|
33857
33882
|
if (tag === "div" || tag === "span") {
|
|
33858
33883
|
props.delete("width");
|
|
33859
33884
|
props.delete("height");
|
|
33860
33885
|
}
|
|
33861
|
-
if (tag === "div") {
|
|
33886
|
+
if (tag === "div" || tag === "table") {
|
|
33862
33887
|
for (const prop of MARGIN) {
|
|
33863
33888
|
const value = props.get(prop);
|
|
33864
33889
|
if (value !== void 0) props.set(prop, flattenMargin(value));
|
|
33865
33890
|
}
|
|
33891
|
+
if (tag === "table" && /center/i.test((_f = $(el).attr("align")) != null ? _f : "")) {
|
|
33892
|
+
props.delete("margin-top");
|
|
33893
|
+
props.delete("margin-bottom");
|
|
33894
|
+
}
|
|
33866
33895
|
}
|
|
33867
33896
|
if ((tag === "div" || tag === "h2") && holdsNoText($, el)) {
|
|
33868
33897
|
props.delete("background");
|
|
@@ -33871,18 +33900,24 @@ h1 {
|
|
|
33871
33900
|
const family = props.get("font-family");
|
|
33872
33901
|
const drawn = family === void 0 ? null : wordFamily(family, faces);
|
|
33873
33902
|
if (drawn) props.set("font-family", drawn);
|
|
33903
|
+
if ((tag === "body" || tag === "td") && /^\s*sans-serif(?![\w-])/i.test((_g = drawn != null ? drawn : family) != null ? _g : "")) props.set("font-family", WORD_DEFAULT);
|
|
33904
|
+
if (/none/i.test((_h = props.get("mso-border-alt")) != null ? _h : "")) {
|
|
33905
|
+
for (const prop of [...props.keys()]) if (prop.startsWith("border") && prop !== "border-radius") props.delete(prop);
|
|
33906
|
+
}
|
|
33907
|
+
if (/transparent/i.test((_i = props.get("mso-shading")) != null ? _i : "")) props.delete("background-color");
|
|
33874
33908
|
const lineAlt = props.get("mso-line-height-alt");
|
|
33875
|
-
|
|
33876
|
-
|
|
33877
|
-
const
|
|
33878
|
-
|
|
33909
|
+
const altEm = /^([\d.]+)em$/i.exec((_j = lineAlt == null ? void 0 : lineAlt.trim()) != null ? _j : "");
|
|
33910
|
+
if (lineAlt !== void 0) props.set("line-height", altEm ? `${Number(altEm[1]) * 16}px` : lineAlt);
|
|
33911
|
+
const lineHeight = /^([\d.]+)px$/i.exec((_k = props.get("line-height")) != null ? _k : "");
|
|
33912
|
+
const fontSize = /^([\d.]+)px$/i.exec((_l = props.get("font-size")) != null ? _l : "");
|
|
33913
|
+
if (lineHeight && fontSize && !/exactly/i.test((_m = props.get("mso-line-height-rule")) != null ? _m : "")) {
|
|
33879
33914
|
const natural = Math.round(Number(fontSize[1]) * NATURAL_LINE);
|
|
33880
33915
|
if (Number(lineHeight[1]) < natural) props.set("line-height", `${natural}px`);
|
|
33881
33916
|
}
|
|
33882
33917
|
for (const prop of ["word-spacing", "outline", "outline-width", "outline-style", "outline-color", "outline-offset"]) {
|
|
33883
33918
|
props.delete(prop);
|
|
33884
33919
|
}
|
|
33885
|
-
if (tag === "div" && /^center$/i.test((
|
|
33920
|
+
if (tag === "div" && /^center$/i.test((_n = props.get("text-align")) != null ? _n : "") && !$(el).attr("align")) {
|
|
33886
33921
|
$(el).attr("align", "center");
|
|
33887
33922
|
props.delete("text-align");
|
|
33888
33923
|
}
|
|
@@ -33905,6 +33940,38 @@ h1 {
|
|
|
33905
33940
|
else $(el).removeAttr("style");
|
|
33906
33941
|
}
|
|
33907
33942
|
});
|
|
33943
|
+
$("td[style*='mso-hollow'], th[style*='mso-hollow']").each((_, node) => {
|
|
33944
|
+
const cell = $(node);
|
|
33945
|
+
const props = parseInlineStyle(cell.attr("style") || "");
|
|
33946
|
+
props.delete("mso-hollow");
|
|
33947
|
+
props.set("display", "table-cell!important");
|
|
33948
|
+
props.set("font-size", "0");
|
|
33949
|
+
props.set("line-height", "0");
|
|
33950
|
+
cell.empty().attr("style", serializeStyle(props));
|
|
33951
|
+
});
|
|
33952
|
+
$("hr").each((_, node) => {
|
|
33953
|
+
var _a2, _b, _c;
|
|
33954
|
+
const props = parseInlineStyle($(node).attr("style") || "");
|
|
33955
|
+
const [top = "", , bottom = top] = ((_a2 = props.get("margin")) != null ? _a2 : "").trim().split(/\s+/).concat([""]);
|
|
33956
|
+
const px2 = (v) => Number.parseFloat(v != null ? v : "") || 0;
|
|
33957
|
+
const set = /* @__PURE__ */ new Map([
|
|
33958
|
+
["border", "none"],
|
|
33959
|
+
["border-top", "1px solid #a0a0a0"],
|
|
33960
|
+
["height", "0"],
|
|
33961
|
+
["width", "100%"],
|
|
33962
|
+
["margin", `${px2((_b = props.get("margin-top")) != null ? _b : top) + 4}px 0 ${px2((_c = props.get("margin-bottom")) != null ? _c : bottom || top) + 4}px`]
|
|
33963
|
+
]);
|
|
33964
|
+
$(node).attr("style", serializeStyle(set));
|
|
33965
|
+
});
|
|
33966
|
+
$("a").each((_, node) => {
|
|
33967
|
+
if (!$(node).children("div").length) return;
|
|
33968
|
+
$(node).before('<div style="height:21px"></div>').after('<div style="height:20px"></div>');
|
|
33969
|
+
});
|
|
33970
|
+
$("a[style*='text-decoration-line']").each((_, node) => {
|
|
33971
|
+
const props = parseInlineStyle($(node).attr("style") || "");
|
|
33972
|
+
props.delete("text-decoration-line");
|
|
33973
|
+
$(node).attr("style", serializeStyle(props));
|
|
33974
|
+
});
|
|
33908
33975
|
$("td table, th table").each((_, node) => {
|
|
33909
33976
|
const table = node;
|
|
33910
33977
|
const own = parseInlineStyle($(table).attr("style") || "");
|
|
@@ -33921,10 +33988,11 @@ h1 {
|
|
|
33921
33988
|
$(table).attr("style", serializeStyle(props));
|
|
33922
33989
|
});
|
|
33923
33990
|
$("img").each((_, node) => {
|
|
33924
|
-
var _a2;
|
|
33991
|
+
var _a2, _b, _c, _d;
|
|
33925
33992
|
const el = node;
|
|
33926
33993
|
const props = parseInlineStyle($(el).attr("style") || "");
|
|
33927
33994
|
const NUMBER = /^\d+(?:\.\d+)?$/;
|
|
33995
|
+
const percent = /^\d+(?:\.\d+)?%$/.test((_b = (_a2 = $(el).attr("width")) == null ? void 0 : _a2.trim()) != null ? _b : "") ? (_c = $(el).attr("width")) == null ? void 0 : _c.trim() : void 0;
|
|
33928
33996
|
const numeric = (name) => {
|
|
33929
33997
|
var _a3;
|
|
33930
33998
|
const value = (_a3 = $(el).attr(name)) == null ? void 0 : _a3.trim();
|
|
@@ -33938,11 +34006,11 @@ h1 {
|
|
|
33938
34006
|
}
|
|
33939
34007
|
for (const name of ["hspace", "vspace"]) $(el).removeAttr(name);
|
|
33940
34008
|
if ($(el).attr("border") !== void 0) $(el).attr("border", "0");
|
|
33941
|
-
props.set("width", width ? `${width}px!important` : "auto!important");
|
|
34009
|
+
props.set("width", percent ? `${percent}!important` : width ? `${width}px!important` : "auto!important");
|
|
33942
34010
|
props.set("height", height ? `${height}px!important` : "auto!important");
|
|
33943
34011
|
props.set("max-width", "none!important");
|
|
33944
34012
|
props.set("vertical-align", "bottom");
|
|
33945
|
-
if (/\.(?:svg|webp)(?:[?#]|$)/i.test((
|
|
34013
|
+
if (/\.(?:svg|webp)(?:[?#]|$)/i.test((_d = $(el).attr("src")) != null ? _d : "")) props.set("visibility", "hidden");
|
|
33946
34014
|
const after = serializeStyle(props);
|
|
33947
34015
|
if (after) $(el).attr("style", after);
|
|
33948
34016
|
else $(el).removeAttr("style");
|
|
@@ -33954,20 +34022,18 @@ h1 {
|
|
|
33954
34022
|
if (text.length > 20 && INVISIBLE_ONLY.test(text)) el.text(String.fromCharCode(160));
|
|
33955
34023
|
});
|
|
33956
34024
|
$("ul,ol").each((_, node) => {
|
|
33957
|
-
var _a2;
|
|
33958
34025
|
const el = node;
|
|
33959
34026
|
const props = parseInlineStyle($(el).attr("style") || "");
|
|
33960
|
-
const margin = ((_a2 = props.get("margin")) != null ? _a2 : "").trim().split(/\s+/).filter(Boolean);
|
|
33961
|
-
const indented = props.has("margin-left") || props.has("padding-left") || props.has("padding") || margin.length > 0;
|
|
33962
34027
|
let previous = el.prev;
|
|
33963
34028
|
while (previous && previous.type === "text" && !previous.data.trim()) previous = previous.prev;
|
|
33964
34029
|
const afterBreak = (previous == null ? void 0 : previous.type) === "tag" && previous.name === "br";
|
|
33965
|
-
|
|
33966
|
-
|
|
33967
|
-
|
|
33968
|
-
|
|
33969
|
-
|
|
33970
|
-
}
|
|
34030
|
+
const tight = $(el).children("li").toArray().some((item) => {
|
|
34031
|
+
const style = parseInlineStyle($(item).attr("style") || "");
|
|
34032
|
+
return style.has("margin") || style.has("margin-top") || style.has("margin-bottom");
|
|
34033
|
+
});
|
|
34034
|
+
props.set("margin-top", afterBreak || previous && !tight ? "1lh!important" : "0!important");
|
|
34035
|
+
props.set("margin-bottom", tight ? "0!important" : `${LIST_TRAILING_PX}px!important`);
|
|
34036
|
+
props.set("padding-left", `${LIST_TEXT_INDENT_PX}px!important`);
|
|
33971
34037
|
$(el).attr("style", serializeStyle(props));
|
|
33972
34038
|
});
|
|
33973
34039
|
$("picture source").remove();
|
|
@@ -34005,7 +34071,94 @@ h1 {
|
|
|
34005
34071
|
})) return;
|
|
34006
34072
|
cell.attr("style", `${style}${style.trim() === "" || /;\s*$/.test(style) ? "" : ";"}text-align:left`);
|
|
34007
34073
|
});
|
|
34008
|
-
|
|
34074
|
+
$("table").each((_, node) => {
|
|
34075
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
34076
|
+
const table = $(node);
|
|
34077
|
+
const props = parseInlineStyle(table.attr("style") || "");
|
|
34078
|
+
const box = ((_a2 = props.get("margin")) != null ? _a2 : "").trim().split(/\s+/).filter(Boolean);
|
|
34079
|
+
const top = Number.parseFloat((_c = (_b = props.get("margin-top")) != null ? _b : box[0]) != null ? _c : "") || 0;
|
|
34080
|
+
const bottom = Number.parseFloat((_f = (_e = (_d = props.get("margin-bottom")) != null ? _d : box[2]) != null ? _e : box[0]) != null ? _f : "") || 0;
|
|
34081
|
+
if (top <= 0 && bottom <= 0 || /center/i.test((_g = table.attr("align")) != null ? _g : "")) return;
|
|
34082
|
+
const rows = table.find("> tr, > tbody > tr");
|
|
34083
|
+
const grow = (row, side, by) => {
|
|
34084
|
+
row.children("td, th").each((_2, cell) => {
|
|
34085
|
+
var _a3, _b2, _c2, _d2;
|
|
34086
|
+
const own = parseInlineStyle($(cell).attr("style") || "");
|
|
34087
|
+
const pad = ((_a3 = own.get("padding")) != null ? _a3 : "").trim().split(/\s+/).filter(Boolean);
|
|
34088
|
+
const was = Number.parseFloat((_d2 = (_c2 = own.get(`padding-${side}`)) != null ? _c2 : side === "top" ? pad[0] : (_b2 = pad[2]) != null ? _b2 : pad[0]) != null ? _d2 : "") || 0;
|
|
34089
|
+
own.set(`padding-${side}`, `${was + by}px`);
|
|
34090
|
+
$(cell).attr("style", serializeStyle(own));
|
|
34091
|
+
});
|
|
34092
|
+
};
|
|
34093
|
+
if (!rows.length) return;
|
|
34094
|
+
if (top > 0) grow(rows.first(), "top", top);
|
|
34095
|
+
if (bottom > 0) grow(rows.last(), "bottom", bottom);
|
|
34096
|
+
props.delete("margin-top");
|
|
34097
|
+
props.delete("margin-bottom");
|
|
34098
|
+
if (box.length) {
|
|
34099
|
+
props.delete("margin");
|
|
34100
|
+
if (box[1]) props.set("margin-left", (_h = box[3]) != null ? _h : box[1]);
|
|
34101
|
+
if (box[1]) props.set("margin-right", box[1]);
|
|
34102
|
+
}
|
|
34103
|
+
table.attr("style", serializeStyle(props));
|
|
34104
|
+
});
|
|
34105
|
+
$("table").each((_, node) => {
|
|
34106
|
+
var _a2, _b;
|
|
34107
|
+
const props = parseInlineStyle($(node).attr("style") || "");
|
|
34108
|
+
if (!/para-border-div/i.test((_a2 = props.get("mso-element")) != null ? _a2 : "")) return;
|
|
34109
|
+
const width = Number.parseFloat((_b = props.get("mso-element-frame-width")) != null ? _b : "");
|
|
34110
|
+
if (!width) return;
|
|
34111
|
+
props.delete("max-width");
|
|
34112
|
+
props.set("width", `${width + 17}px`);
|
|
34113
|
+
props.set("box-sizing", "border-box");
|
|
34114
|
+
props.set("margin", "0 auto");
|
|
34115
|
+
props.set("padding", "4px 12px 4px 4px");
|
|
34116
|
+
props.set("border", "1px dotted #a6a6a6");
|
|
34117
|
+
props.set("border-collapse", "separate");
|
|
34118
|
+
props.set("text-align", "justify");
|
|
34119
|
+
$(node).attr("style", serializeStyle(props));
|
|
34120
|
+
$(node).removeAttr("width");
|
|
34121
|
+
});
|
|
34122
|
+
$("table").each((_, node) => {
|
|
34123
|
+
var _a2, _b;
|
|
34124
|
+
const props = parseInlineStyle($(node).attr("style") || "");
|
|
34125
|
+
const zero = /^0(?:px)?\s+solid\s+(\S+)/i.exec((_b = (_a2 = props.get("border")) == null ? void 0 : _a2.trim()) != null ? _b : "");
|
|
34126
|
+
if (!zero) return;
|
|
34127
|
+
props.set("border", `1px solid ${zero[1]}`);
|
|
34128
|
+
$(node).attr("style", serializeStyle(props));
|
|
34129
|
+
});
|
|
34130
|
+
const borderOf = (style) => [...parseInlineStyle(style != null ? style : "")].filter(([k, v]) => k.startsWith("border") && !/^0|none/.test(v)).join(";");
|
|
34131
|
+
$("p").each((_, node) => {
|
|
34132
|
+
var _a2;
|
|
34133
|
+
const p = $(node);
|
|
34134
|
+
const next = p.next();
|
|
34135
|
+
const border = borderOf(p.attr("style"));
|
|
34136
|
+
if (!border || !next.is("p") || borderOf(next.attr("style")) !== border) return;
|
|
34137
|
+
const props = parseInlineStyle((_a2 = p.attr("style")) != null ? _a2 : "");
|
|
34138
|
+
for (const key of [...props.keys()]) if (key.startsWith("border")) props.delete(key);
|
|
34139
|
+
props.set("padding-bottom", "0");
|
|
34140
|
+
p.attr("style", serializeStyle(props));
|
|
34141
|
+
});
|
|
34142
|
+
const margined = /* @__PURE__ */ new Set();
|
|
34143
|
+
$("style").each((_, block) => {
|
|
34144
|
+
var _a2;
|
|
34145
|
+
for (const { selector, body } of topLevelRules((_a2 = $(block).html()) != null ? _a2 : "")) {
|
|
34146
|
+
const props = parseInlineStyle(body);
|
|
34147
|
+
if (!props.has("margin") && !props.has("margin-top") && !props.has("margin-bottom")) continue;
|
|
34148
|
+
for (const one of selector.split(",")) for (const el of matchedByWord($, one)) margined.add(el);
|
|
34149
|
+
}
|
|
34150
|
+
});
|
|
34151
|
+
$("p").each((_, node) => {
|
|
34152
|
+
const p = $(node);
|
|
34153
|
+
const props = parseInlineStyle(p.attr("style") || "");
|
|
34154
|
+
if (props.has("margin") || props.has("margin-top") || props.has("margin-bottom")) return;
|
|
34155
|
+
if (margined.has(node)) return;
|
|
34156
|
+
if (!p.prev().length) props.set("margin-top", "0");
|
|
34157
|
+
if (!p.next().length) props.set("margin-bottom", "0");
|
|
34158
|
+
const after = serializeStyle(props);
|
|
34159
|
+
if (after) p.attr("style", after);
|
|
34160
|
+
});
|
|
34161
|
+
const reset = "<style>h2{margin:0}p{margin:14pt 0}</style>";
|
|
34009
34162
|
const head = $("head");
|
|
34010
34163
|
if (head.length) head.prepend(reset);
|
|
34011
34164
|
else if ($("p,h2").length) $.root().prepend(reset);
|
|
@@ -35298,12 +35451,12 @@ h1 {
|
|
|
35298
35451
|
message: "Outlook Classic ignores border-radius. Buttons and containers will have sharp corners."
|
|
35299
35452
|
}, "border-radius", clientId, framework));
|
|
35300
35453
|
}
|
|
35301
|
-
if ($("[style*='max-width']").length > 0) {
|
|
35454
|
+
if ($("[style*='max-width']").not("table").length > 0) {
|
|
35302
35455
|
warnings.push(makeWarning({
|
|
35303
35456
|
severity: "warning",
|
|
35304
35457
|
client: clientId,
|
|
35305
35458
|
property: "max-width",
|
|
35306
|
-
message: "Outlook Classic ignores max-width."
|
|
35459
|
+
message: "Outlook Classic ignores max-width except on tables."
|
|
35307
35460
|
}, "max-width", clientId, framework));
|
|
35308
35461
|
}
|
|
35309
35462
|
const hasDivLayout = $("div[style*='display']").length > 0 || $("div[style*='flex']").length > 0 || $("div[style*='grid']").length > 0;
|
|
@@ -36031,6 +36184,7 @@ h1 {
|
|
|
36031
36184
|
const removed = [];
|
|
36032
36185
|
props.forEach((value, prop) => {
|
|
36033
36186
|
var _a3;
|
|
36187
|
+
if (prop === "max-width" && clientId === "outlook-windows-legacy" && $(el).is("table")) return;
|
|
36034
36188
|
if (config.strippedProperties.has(prop)) {
|
|
36035
36189
|
if (config.stripMode === "strip") {
|
|
36036
36190
|
removed.push(prop);
|
|
@@ -42787,7 +42941,7 @@ Href: ${href}`
|
|
|
42787
42941
|
// package.json
|
|
42788
42942
|
var package_default = {
|
|
42789
42943
|
name: "@emailens/cli",
|
|
42790
|
-
version: "0.13.
|
|
42944
|
+
version: "0.13.6",
|
|
42791
42945
|
description: "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
|
|
42792
42946
|
type: "module",
|
|
42793
42947
|
bin: {
|
|
@@ -42828,7 +42982,7 @@ var package_default = {
|
|
|
42828
42982
|
},
|
|
42829
42983
|
devDependencies: {
|
|
42830
42984
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
42831
|
-
"@emailens/engine": "^0.18.
|
|
42985
|
+
"@emailens/engine": "^0.18.8",
|
|
42832
42986
|
"@types/bun": "^1.4.0",
|
|
42833
42987
|
"@types/mjml": "^4.7.4",
|
|
42834
42988
|
"@types/node": "^25.9.5",
|
package/dist/test.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emailens/cli",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.6",
|
|
4
4
|
"description": "CLI tool for email compatibility analysis: lint, preview and export HTML, MJML, Maizzle and React Email rendering across 21 email clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@anthropic-ai/sdk": "^0.52.0",
|
|
44
|
-
"@emailens/engine": "^0.18.
|
|
44
|
+
"@emailens/engine": "^0.18.8",
|
|
45
45
|
"@types/bun": "^1.4.0",
|
|
46
46
|
"@types/mjml": "^4.7.4",
|
|
47
47
|
"@types/node": "^25.9.5",
|