@react-email/body 0.2.1 → 0.3.0
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.js → index.cjs} +25 -9
- package/dist/{index.d.ts → index.d.cts} +1 -1
- package/dist/index.d.cts.map +1 -0
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -7
- package/dist/index.d.ts.map +0 -1
|
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
return to;
|
|
17
21
|
};
|
|
@@ -24,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
28
|
let react = require("react");
|
|
25
29
|
react = __toESM(react);
|
|
26
30
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
-
react_jsx_runtime = __toESM(react_jsx_runtime);
|
|
28
31
|
|
|
29
32
|
//#region src/margin-properties.ts
|
|
30
33
|
const marginProperties = [
|
|
@@ -40,15 +43,28 @@ const marginProperties = [
|
|
|
40
43
|
"marginInlineStart",
|
|
41
44
|
"marginInlineEnd"
|
|
42
45
|
];
|
|
46
|
+
const paddingProperties = [
|
|
47
|
+
"padding",
|
|
48
|
+
"paddingTop",
|
|
49
|
+
"paddingBottom",
|
|
50
|
+
"paddingRight",
|
|
51
|
+
"paddingLeft",
|
|
52
|
+
"paddingInline",
|
|
53
|
+
"paddingBlock",
|
|
54
|
+
"paddingBlockStart",
|
|
55
|
+
"paddingBlockEnd",
|
|
56
|
+
"paddingInlineStart",
|
|
57
|
+
"paddingInlineEnd"
|
|
58
|
+
];
|
|
43
59
|
|
|
44
60
|
//#endregion
|
|
45
61
|
//#region src/body.tsx
|
|
46
|
-
const Body = react.forwardRef(({ children, style
|
|
62
|
+
const Body = react.forwardRef(({ children, style, ...props }, ref) => {
|
|
47
63
|
const bodyStyle = {
|
|
48
64
|
background: style?.background,
|
|
49
65
|
backgroundColor: style?.backgroundColor
|
|
50
66
|
};
|
|
51
|
-
if (style) for (const property of marginProperties) bodyStyle[property] = style[property] !== void 0 ? 0 : void 0;
|
|
67
|
+
if (style) for (const property of [...marginProperties, ...paddingProperties]) bodyStyle[property] = style[property] !== void 0 ? 0 : void 0;
|
|
52
68
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("body", {
|
|
53
69
|
...props,
|
|
54
70
|
style: bodyStyle,
|
|
@@ -5,4 +5,4 @@ type BodyProps = Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>>;
|
|
|
5
5
|
declare const Body: React.ForwardRefExoticComponent<Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>> & React.RefAttributes<HTMLBodyElement>>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Body, BodyProps };
|
|
8
|
-
//# sourceMappingURL=index.d.
|
|
8
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/body.tsx"],"sourcesContent":[],"mappings":";;;KAGY,SAAA,GAAY,SAAS,KAAA,CAAM,mBAAmB;cAE7C,MAAI,KAAA,CAAA,0BAAA,SAAA,KAAA,CAAA,mBAAA,oBAAA,KAAA,CAAA,cAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -15,15 +15,28 @@ const marginProperties = [
|
|
|
15
15
|
"marginInlineStart",
|
|
16
16
|
"marginInlineEnd"
|
|
17
17
|
];
|
|
18
|
+
const paddingProperties = [
|
|
19
|
+
"padding",
|
|
20
|
+
"paddingTop",
|
|
21
|
+
"paddingBottom",
|
|
22
|
+
"paddingRight",
|
|
23
|
+
"paddingLeft",
|
|
24
|
+
"paddingInline",
|
|
25
|
+
"paddingBlock",
|
|
26
|
+
"paddingBlockStart",
|
|
27
|
+
"paddingBlockEnd",
|
|
28
|
+
"paddingInlineStart",
|
|
29
|
+
"paddingInlineEnd"
|
|
30
|
+
];
|
|
18
31
|
|
|
19
32
|
//#endregion
|
|
20
33
|
//#region src/body.tsx
|
|
21
|
-
const Body = React.forwardRef(({ children, style
|
|
34
|
+
const Body = React.forwardRef(({ children, style, ...props }, ref) => {
|
|
22
35
|
const bodyStyle = {
|
|
23
36
|
background: style?.background,
|
|
24
37
|
backgroundColor: style?.backgroundColor
|
|
25
38
|
};
|
|
26
|
-
if (style) for (const property of marginProperties) bodyStyle[property] = style[property] !== void 0 ? 0 : void 0;
|
|
39
|
+
if (style) for (const property of [...marginProperties, ...paddingProperties]) bodyStyle[property] = style[property] !== void 0 ? 0 : void 0;
|
|
27
40
|
return /* @__PURE__ */ jsx("body", {
|
|
28
41
|
...props,
|
|
29
42
|
style: bodyStyle,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/margin-properties.ts","../src/body.tsx"],"sourcesContent":["export const marginProperties: (keyof React.CSSProperties)[] = [\n 'margin',\n 'marginTop',\n 'marginBottom',\n 'marginRight',\n 'marginLeft',\n 'marginInline',\n 'marginBlock',\n 'marginBlockStart',\n 'marginBlockEnd',\n 'marginInlineStart',\n 'marginInlineEnd',\n];\n\nexport const paddingProperties: (keyof React.CSSProperties)[] = [\n 'padding',\n 'paddingTop',\n 'paddingBottom',\n 'paddingRight',\n 'paddingLeft',\n 'paddingInline',\n 'paddingBlock',\n 'paddingBlockStart',\n 'paddingBlockEnd',\n 'paddingInlineStart',\n 'paddingInlineEnd',\n];\n","import * as React from 'react';\nimport { marginProperties, paddingProperties } from './margin-properties';\n\nexport type BodyProps = Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>>;\n\nexport const Body = React.forwardRef<HTMLBodyElement, BodyProps>(\n ({ children, style, ...props }, ref) => {\n const bodyStyle: Record<string, string | number | undefined> = {\n background: style?.background,\n backgroundColor: style?.backgroundColor,\n };\n if (style) {\n for (const property of [...marginProperties, ...paddingProperties]) {\n // We reset the margin if the user sets it, this mimics the\n // same behavior that would happen if this was only using the body.\n // This avoids the incoming margin summing up with the margin\n // defined by the email client on the body, or by the browser itself\n bodyStyle[property] = style[property] !== undefined ? 0 : undefined;\n }\n }\n return (\n <body {...props} style={bodyStyle} ref={ref}>\n <table\n border={0}\n width=\"100%\"\n cellPadding=\"0\"\n cellSpacing=\"0\"\n role=\"presentation\"\n align=\"center\"\n >\n <tbody>\n <tr>\n {/*\n Yahoo and AOL remove all styles of the body element while converting it to a div,\n so we need to apply them to to an inner cell.\n\n See https://github.com/resend/react-email/issues/662.\n */}\n <td style={style}>{children}</td>\n </tr>\n </tbody>\n </table>\n </body>\n );\n },\n);\n\nBody.displayName = 'Body';\n"],"mappings":";;;;AAAA,MAAa,mBAAkD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,oBAAmD;CAC9D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;ACrBD,MAAa,OAAO,MAAM,YACvB,EAAE,UAAU,OAAO,GAAG,SAAS,QAAQ;CACtC,MAAM,YAAyD;EAC7D,YAAY,OAAO;EACnB,iBAAiB,OAAO;EACzB;AACD,KAAI,MACF,MAAK,MAAM,YAAY,CAAC,GAAG,kBAAkB,GAAG,kBAAkB,CAKhE,WAAU,YAAY,MAAM,cAAc,SAAY,IAAI;AAG9D,QACE,oBAAC;EAAK,GAAI;EAAO,OAAO;EAAgB;YACtC,oBAAC;GACC,QAAQ;GACR,OAAM;GACN,aAAY;GACZ,aAAY;GACZ,MAAK;GACL,OAAM;aAEN,oBAAC,qBACC,oBAAC,kBAOC,oBAAC;IAAU;IAAQ;KAAc,GAC9B,GACC;IACF;GACH;EAGZ;AAED,KAAK,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/body",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A React body component to wrap emails",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
8
|
-
"types": "./dist/index.d.
|
|
8
|
+
"types": "./dist/index.d.cts",
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">=20.0.0"
|
|
11
11
|
},
|
|
@@ -19,18 +19,23 @@
|
|
|
19
19
|
"default": "./dist/index.mjs"
|
|
20
20
|
},
|
|
21
21
|
"require": {
|
|
22
|
-
"types": "./dist/index.d.
|
|
23
|
-
"default": "./dist/index.
|
|
22
|
+
"types": "./dist/index.d.cts",
|
|
23
|
+
"default": "./dist/index.cjs"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/resend/react-email.git",
|
|
31
|
+
"directory": "packages/body"
|
|
32
|
+
},
|
|
28
33
|
"peerDependencies": {
|
|
29
34
|
"react": "^18.0 || ^19.0 || ^19.0.0-rc"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
|
-
"typescript": "5.
|
|
33
|
-
"@react-email/render": "2.0.
|
|
37
|
+
"typescript": "5.9.3",
|
|
38
|
+
"@react-email/render": "2.0.4",
|
|
34
39
|
"tsconfig": "0.0.0"
|
|
35
40
|
},
|
|
36
41
|
"publishConfig": {
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/body.tsx"],"sourcesContent":[],"mappings":";;;KAGY,SAAA,GAAY,SAAS,KAAA,CAAM,mBAAmB;cAE7C,MAAI,KAAA,CAAA,0BAAA,SAAA,KAAA,CAAA,mBAAA,oBAAA,KAAA,CAAA,cAAA"}
|