@react-email/body 0.1.0 → 0.2.0-canary.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.d.mts +5 -3
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -89
- package/dist/index.mjs +46 -63
- package/dist/index.mjs.map +1 -0
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
|
+
//#region src/body.d.ts
|
|
3
4
|
type BodyProps = Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>>;
|
|
4
5
|
declare const Body: React.ForwardRefExoticComponent<Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>> & React.RefAttributes<HTMLBodyElement>>;
|
|
5
|
-
|
|
6
|
-
export { Body,
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Body, BodyProps };
|
|
8
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","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.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import * as React from
|
|
1
|
+
import * as React from "react";
|
|
2
2
|
|
|
3
|
+
//#region src/body.d.ts
|
|
3
4
|
type BodyProps = Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>>;
|
|
4
5
|
declare const Body: React.ForwardRefExoticComponent<Readonly<React.HtmlHTMLAttributes<HTMLBodyElement>> & React.RefAttributes<HTMLBodyElement>>;
|
|
5
|
-
|
|
6
|
-
export { Body,
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Body, BodyProps };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -1,100 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
10
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
-
};
|
|
41
8
|
var __copyProps = (to, from, except, desc) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
48
17
|
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
-
mod
|
|
56
|
-
));
|
|
57
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
58
22
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
module.exports = __toCommonJS(index_exports);
|
|
23
|
+
//#endregion
|
|
24
|
+
let react = require("react");
|
|
25
|
+
react = __toESM(react);
|
|
26
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
react_jsx_runtime = __toESM(react_jsx_runtime);
|
|
65
28
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
29
|
+
//#region src/margin-properties.ts
|
|
30
|
+
const marginProperties = [
|
|
31
|
+
"margin",
|
|
32
|
+
"marginTop",
|
|
33
|
+
"marginBottom",
|
|
34
|
+
"marginRight",
|
|
35
|
+
"marginLeft",
|
|
36
|
+
"marginInline",
|
|
37
|
+
"marginBlock",
|
|
38
|
+
"marginBlockStart",
|
|
39
|
+
"marginBlockEnd",
|
|
40
|
+
"marginInlineStart",
|
|
41
|
+
"marginInlineEnd"
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/body.tsx
|
|
46
|
+
const Body = react.forwardRef(({ children, style,...props }, ref) => {
|
|
47
|
+
const bodyStyle = {
|
|
48
|
+
background: style?.background,
|
|
49
|
+
backgroundColor: style?.backgroundColor
|
|
50
|
+
};
|
|
51
|
+
if (style) for (const property of marginProperties) bodyStyle[property] = style[property] !== void 0 ? 0 : void 0;
|
|
52
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("body", {
|
|
53
|
+
...props,
|
|
54
|
+
style: bodyStyle,
|
|
55
|
+
ref,
|
|
56
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
|
|
57
|
+
border: 0,
|
|
58
|
+
width: "100%",
|
|
59
|
+
cellPadding: "0",
|
|
60
|
+
cellSpacing: "0",
|
|
61
|
+
role: "presentation",
|
|
62
|
+
align: "center",
|
|
63
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
64
|
+
style,
|
|
65
|
+
children
|
|
66
|
+
}) }) })
|
|
67
|
+
})
|
|
68
|
+
});
|
|
100
69
|
});
|
|
70
|
+
Body.displayName = "Body";
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
exports.Body = Body;
|
package/dist/index.mjs
CHANGED
|
@@ -1,66 +1,49 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// src/body.tsx
|
|
34
1
|
import * as React from "react";
|
|
35
2
|
import { jsx } from "react/jsx-runtime";
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
3
|
+
|
|
4
|
+
//#region src/margin-properties.ts
|
|
5
|
+
const marginProperties = [
|
|
6
|
+
"margin",
|
|
7
|
+
"marginTop",
|
|
8
|
+
"marginBottom",
|
|
9
|
+
"marginRight",
|
|
10
|
+
"marginLeft",
|
|
11
|
+
"marginInline",
|
|
12
|
+
"marginBlock",
|
|
13
|
+
"marginBlockStart",
|
|
14
|
+
"marginBlockEnd",
|
|
15
|
+
"marginInlineStart",
|
|
16
|
+
"marginInlineEnd"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/body.tsx
|
|
21
|
+
const Body = React.forwardRef(({ children, style,...props }, ref) => {
|
|
22
|
+
const bodyStyle = {
|
|
23
|
+
background: style?.background,
|
|
24
|
+
backgroundColor: style?.backgroundColor
|
|
25
|
+
};
|
|
26
|
+
if (style) for (const property of marginProperties) bodyStyle[property] = style[property] !== void 0 ? 0 : void 0;
|
|
27
|
+
return /* @__PURE__ */ jsx("body", {
|
|
28
|
+
...props,
|
|
29
|
+
style: bodyStyle,
|
|
30
|
+
ref,
|
|
31
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
32
|
+
border: 0,
|
|
33
|
+
width: "100%",
|
|
34
|
+
cellPadding: "0",
|
|
35
|
+
cellSpacing: "0",
|
|
36
|
+
role: "presentation",
|
|
37
|
+
align: "center",
|
|
38
|
+
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
39
|
+
style,
|
|
40
|
+
children
|
|
41
|
+
}) }) })
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
});
|
|
63
45
|
Body.displayName = "Body";
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { Body };
|
|
49
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["marginProperties: (keyof React.CSSProperties)[]","bodyStyle: Record<string, string | number | undefined>"],"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","import * as React from 'react';\nimport { marginProperties } 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) {\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,MAAaA,mBAAkD;CAC7D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;ACPD,MAAa,OAAO,MAAM,YACvB,EAAE,UAAU,MAAO,GAAG,SAAS,QAAQ;CACtC,MAAMC,YAAyD;EAC7D,YAAY,OAAO;EACnB,iBAAiB,OAAO;EACzB;AACD,KAAI,MACF,MAAK,MAAM,YAAY,iBAKrB,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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/body",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-canary.0",
|
|
4
4
|
"description": "A React body component to wrap emails",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"typescript": "5.8.3",
|
|
30
|
-
"@react-email/render": "
|
|
30
|
+
"@react-email/render": "2.0.0-canary.1",
|
|
31
31
|
"tsconfig": "0.0.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "
|
|
38
|
-
"build:watch": "
|
|
37
|
+
"build": "tsdown src/index.ts --format esm,cjs --dts --external react",
|
|
38
|
+
"build:watch": "tsdown src/index.ts --format esm,cjs --dts --external react --watch",
|
|
39
39
|
"clean": "rm -rf dist",
|
|
40
40
|
"test": "vitest run",
|
|
41
41
|
"test:watch": "vitest"
|