@react-email/tailwind 0.0.1 → 0.0.2
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.ts +10 -0
- package/dist/index.js +63 -0
- package/dist/index.mjs +30 -0
- package/package.json +2 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TailwindConfig } from 'tw-to-css';
|
|
3
|
+
|
|
4
|
+
interface TailwindProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
config?: TailwindConfig;
|
|
7
|
+
}
|
|
8
|
+
declare const Tailwind: React.FC<Readonly<TailwindProps>>;
|
|
9
|
+
|
|
10
|
+
export { Tailwind, TailwindProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// src/index.ts
|
|
27
|
+
var src_exports = {};
|
|
28
|
+
__export(src_exports, {
|
|
29
|
+
Tailwind: () => Tailwind
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(src_exports);
|
|
32
|
+
|
|
33
|
+
// src/tailwind.tsx
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_tw_to_css = require("tw-to-css");
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var Tailwind = ({
|
|
38
|
+
children,
|
|
39
|
+
config
|
|
40
|
+
}) => {
|
|
41
|
+
const { twj } = (0, import_tw_to_css.tailwindToCSS)({ config });
|
|
42
|
+
const replaceTailwindStyles = (child) => {
|
|
43
|
+
if (!React.isValidElement(child)) {
|
|
44
|
+
return child;
|
|
45
|
+
}
|
|
46
|
+
const { className, children: childChildren, style, ...rest } = child.props;
|
|
47
|
+
return React.cloneElement(child, {
|
|
48
|
+
...rest,
|
|
49
|
+
children: React.Children.map(childChildren, replaceTailwindStyles),
|
|
50
|
+
style: { ...style, ...className ? twj(className) : {} }
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const tailwindStylesToCSS = React.Children.map(
|
|
54
|
+
children,
|
|
55
|
+
replaceTailwindStyles
|
|
56
|
+
);
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: tailwindStylesToCSS });
|
|
58
|
+
};
|
|
59
|
+
Tailwind.displayName = "Tailwind";
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
Tailwind
|
|
63
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/tailwind.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { tailwindToCSS } from "tw-to-css";
|
|
4
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
5
|
+
var Tailwind = ({
|
|
6
|
+
children,
|
|
7
|
+
config
|
|
8
|
+
}) => {
|
|
9
|
+
const { twj } = tailwindToCSS({ config });
|
|
10
|
+
const replaceTailwindStyles = (child) => {
|
|
11
|
+
if (!React.isValidElement(child)) {
|
|
12
|
+
return child;
|
|
13
|
+
}
|
|
14
|
+
const { className, children: childChildren, style, ...rest } = child.props;
|
|
15
|
+
return React.cloneElement(child, {
|
|
16
|
+
...rest,
|
|
17
|
+
children: React.Children.map(childChildren, replaceTailwindStyles),
|
|
18
|
+
style: { ...style, ...className ? twj(className) : {} }
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
const tailwindStylesToCSS = React.Children.map(
|
|
22
|
+
children,
|
|
23
|
+
replaceTailwindStyles
|
|
24
|
+
);
|
|
25
|
+
return /* @__PURE__ */ jsx(Fragment, { children: tailwindStylesToCSS });
|
|
26
|
+
};
|
|
27
|
+
Tailwind.displayName = "Tailwind";
|
|
28
|
+
export {
|
|
29
|
+
Tailwind
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-email/tailwind",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A React component to wrap emails with Tailwind CSS",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=16.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"tw-to-css": "0.0.
|
|
35
|
+
"tw-to-css": "0.0.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/react": "18.0.20",
|