@pagenflow/email 1.4.8 → 1.4.9
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.esm.js
CHANGED
|
@@ -1790,6 +1790,15 @@ function Button({ config, devMode, bindings }) {
|
|
|
1790
1790
|
}
|
|
1791
1791
|
var Button_default = memo(Button, arePropsEqual);
|
|
1792
1792
|
|
|
1793
|
+
function isGapZero(gap) {
|
|
1794
|
+
if (!gap)
|
|
1795
|
+
return true;
|
|
1796
|
+
// Remove whitespace and convert to lowercase
|
|
1797
|
+
const trimmedGap = gap.trim().toLowerCase();
|
|
1798
|
+
// Check for exact zero matches (0, 0px, 0%, 0em, 0rem, etc.)
|
|
1799
|
+
return /^0(px|%|em|rem|ex|ch|vw|vh|vmin|vmax)?$/.test(trimmedGap);
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1793
1802
|
// Helper for vertical alignment
|
|
1794
1803
|
const vAlignMap = {
|
|
1795
1804
|
start: "top",
|
|
@@ -1924,7 +1933,7 @@ function Column({ children, config, devNode, bindings }) {
|
|
|
1924
1933
|
? vAlignMap[config.justifyContent]
|
|
1925
1934
|
: "top", align: config.alignItems
|
|
1926
1935
|
? alignMap$2[config.alignItems]
|
|
1927
|
-
: "left", children: child }) }), index < numChildren - 1 && (jsx("tr", { children: jsx("td", { style: gapSpacerStyle, children: "\u00A0" }) }))] }, `col-child-${index}`))) }) })) : (children) }) }) }) }));
|
|
1936
|
+
: "left", children: child }) }), index < numChildren - 1 && !isGapZero(config.gap) && (jsx("tr", { children: jsx("td", { style: gapSpacerStyle, children: "\u00A0" }) }))] }, `col-child-${index}`))) }) })) : (children) }) }) }) }));
|
|
1928
1937
|
return (jsxs("table", { "aria-label": "Column Wrapper", role: "presentation", cellPadding: 0, cellSpacing: 0, border: 0, ...rootBindingProps(bindings), style: {
|
|
1929
1938
|
position: "relative",
|
|
1930
1939
|
...outerTableStyle,
|
|
@@ -2102,13 +2111,13 @@ function Container({ children, config, bindings, devMode, devNode, }) {
|
|
|
2102
2111
|
textAlign: "left",
|
|
2103
2112
|
};
|
|
2104
2113
|
if (config.gap && index < numChildren - 1) {
|
|
2105
|
-
return (jsxs(Fragment, { children: [jsxs("td", { className: isStacking ? "stack-td" : undefined, width: getChildWidths[index], style: childTdStyle, children: [child, isStacking && (jsx("div", { className: "mobile-gap-spacer", style: {
|
|
2114
|
+
return (jsxs(Fragment, { children: [jsxs("td", { className: isStacking ? "stack-td" : undefined, width: getChildWidths[index], style: childTdStyle, children: [child, isStacking && !isGapZero(config.gap) && (jsx("div", { className: "mobile-gap-spacer", style: {
|
|
2106
2115
|
display: "none",
|
|
2107
2116
|
fontSize: "0",
|
|
2108
2117
|
lineHeight: "0",
|
|
2109
2118
|
height: config.gap,
|
|
2110
2119
|
background: "transparent",
|
|
2111
|
-
}, children: "\u00A0" }))] }, `child-${index}`), jsx("td", { className: isStacking ? "desktop-gap-column" : undefined, width: config.gap, style: gapTdStyle, children: "\u00A0" }, `gap-${index}`)] }, `ctn:${index}`));
|
|
2120
|
+
}, children: "\u00A0" }))] }, `child-${index}`), !isGapZero(config.gap) && (jsx("td", { className: isStacking ? "desktop-gap-column" : undefined, width: config.gap, style: gapTdStyle, children: "\u00A0" }, `gap-${index}`))] }, `ctn:${index}`));
|
|
2112
2121
|
}
|
|
2113
2122
|
return (jsx("td", { className: isStacking ? "stack-td" : undefined, width: getChildWidths[index], style: childTdStyle, children: child }, `child-${index}`));
|
|
2114
2123
|
});
|
|
@@ -2236,7 +2245,13 @@ function Head({ children, backgroundColor = "#ffffff", title = "Email Preview",
|
|
|
2236
2245
|
line-height: inherit !important;
|
|
2237
2246
|
}
|
|
2238
2247
|
body { background-color: ${backgroundColor} !important; }
|
|
2239
|
-
p {
|
|
2248
|
+
p {
|
|
2249
|
+
margin: 0;
|
|
2250
|
+
margin-block-start: 0px;
|
|
2251
|
+
margin-block-end: 0px;
|
|
2252
|
+
margin-inline-start: 0px;
|
|
2253
|
+
margin-inline-end: 0px;
|
|
2254
|
+
}
|
|
2240
2255
|
`;
|
|
2241
2256
|
const globalStyles = `
|
|
2242
2257
|
@media screen and (max-width: 768px) {
|
|
@@ -2458,6 +2473,30 @@ function injectLinkStyles(html, fallback) {
|
|
|
2458
2473
|
return result;
|
|
2459
2474
|
}
|
|
2460
2475
|
|
|
2476
|
+
// injectParagraphReset.ts
|
|
2477
|
+
const P_RESET_STYLE = [
|
|
2478
|
+
"margin:0",
|
|
2479
|
+
"margin-block-start:0px",
|
|
2480
|
+
"margin-block-end:0px",
|
|
2481
|
+
"margin-inline-start:0px",
|
|
2482
|
+
"margin-inline-end:0px",
|
|
2483
|
+
].join(";");
|
|
2484
|
+
function injectParagraphReset(html) {
|
|
2485
|
+
if (!html || !html.includes("<p"))
|
|
2486
|
+
return html;
|
|
2487
|
+
return html.replace(/<p(\s[^>]*)?>/gi, (_, attrs = "") => {
|
|
2488
|
+
var _a, _b;
|
|
2489
|
+
const existingStyle = (_b = (_a = /style\s*=\s*"([^"]*)"/i.exec(attrs)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : "";
|
|
2490
|
+
const mergedStyle = existingStyle
|
|
2491
|
+
? `${existingStyle};${P_RESET_STYLE}`
|
|
2492
|
+
: P_RESET_STYLE;
|
|
2493
|
+
const cleanAttrs = attrs.replace(/\s*style\s*=\s*"[^"]*"/i, "").trim();
|
|
2494
|
+
return cleanAttrs
|
|
2495
|
+
? `<p ${cleanAttrs} style="${mergedStyle}">`
|
|
2496
|
+
: `<p style="${mergedStyle}">`;
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2461
2500
|
// Helper to build link href based on innerLink type
|
|
2462
2501
|
function buildLinkHref$3(innerLink) {
|
|
2463
2502
|
if (!innerLink || innerLink.type === "none")
|
|
@@ -2516,7 +2555,7 @@ function Heading({ config, devMode, children, bindings }) {
|
|
|
2516
2555
|
["msoLineHeightRule"]: "exactly",
|
|
2517
2556
|
};
|
|
2518
2557
|
const processedHtml = isString
|
|
2519
|
-
? injectLinkStyles(content, headingStyle)
|
|
2558
|
+
? injectParagraphReset(injectLinkStyles(content, headingStyle))
|
|
2520
2559
|
: "";
|
|
2521
2560
|
// Dynamically create the Heading element
|
|
2522
2561
|
const HeadingTag = level;
|