@react-email/heading
Advanced tools
| {"version":3,"file":"index.d.mts","names":[],"sources":["../src/utils/as.ts","../src/utils/spaces.ts","../src/heading.tsx"],"sourcesContent":[],"mappings":";;;KAAY,sBACS,KAAA,CAAM,wBACd,KAAA,CAAM,wBACN,KAAA,CAAM,cAAc,eACpB,KAAA,CAAM,cAAc,eACpB,KAAA,CAAM,cAAc,eACpB,KAAA,CAAM,cAAc,OAE5B,KAAA,CAAM,sBAAsB;OACtB;MAEN,KAAA,CAAM,sBAAsB;EAXrB,EAAA,EAYF,EAZI;CAAA,CAAA,GAAA,CAcT,KAAA,CAAM,qBAdG,CAcmB,EAdnB,CAAA,GAAA;MAeJ,EAdW;MAgBhB,KAAA,CAAM,qBAfQ,CAec,EAfd,CAAA,GAAA;MAgBT,EAfG;MAiBR,KAAA,CAAM,qBAjBsB,CAiBA,EAjBA,CAAA,GAAA;MAkBvB,EAjBG;MAmBR,KAAA,CAAM,qBAnBsB,CAmBA,EAnBA,CAAA,GAAA;MAoBvB,EAnBG;;;;UCII,MAAA;EDTL,CAAA,CAAA,EAAA,MAAE,GAAA,MAAA;EAAA,EAAA,CAAA,EAAA,MAAA,GAAA,MAAA;KACO,EAAA,MAAM,GAAA,MAAA;KACd,EAAA,MAAM,GAAA,MAAA;KACN,EAAA,MAAM,GAAA,MAAA;KAAc,EAAA,MAAA,GAAA,MAAA;KACpB,EAAA,MAAM,GAAA,MAAA;;;;AAJP,KEKA,SAAA,GAAY,EFLV,CAAA,IAAA,EAAA,IAAA,EAAA,IAAA,EAAA,IAAA,EAAA,IAAA,EAAA,IAAA,CAAA;AAAA,KEMF,YAAA,GAAe,SFNb,GEMyB,MFNzB;AACO,cEOR,OFPc,EEOP,OAAA,CAAA,yBFPO,CAAA,CEOP,IFPO,CEOP,QFPO,CEOP,OAAA,CAAA,eFPO,CEOP,kBFPO,CAAA,GEOP,OAAA,CAAA,cFPO,CEOP,kBFPO,CAAA,GAAA;KACd,EAAA,IAAM,GAAA,SAAA;UACN,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UACpB,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UACpB,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UACpB,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UAEA,CAAA,EAAA,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAA5B,IAAA;UACM,CAAA,EAAA,KAAA,CAAA,CAAA,wBAAA,mBAAA,CAAA,CAAA"} |
| {"version":3,"file":"index.d.ts","names":[],"sources":["../src/utils/as.ts","../src/utils/spaces.ts","../src/heading.tsx"],"sourcesContent":[],"mappings":";;;KAAY,sBACS,KAAA,CAAM,wBACd,KAAA,CAAM,wBACN,KAAA,CAAM,cAAc,eACpB,KAAA,CAAM,cAAc,eACpB,KAAA,CAAM,cAAc,eACpB,KAAA,CAAM,cAAc,OAE5B,KAAA,CAAM,sBAAsB;OACtB;MAEN,KAAA,CAAM,sBAAsB;EAXrB,EAAA,EAYF,EAZI;CAAA,CAAA,GAAA,CAcT,KAAA,CAAM,qBAdG,CAcmB,EAdnB,CAAA,GAAA;MAeJ,EAdW;MAgBhB,KAAA,CAAM,qBAfQ,CAec,EAfd,CAAA,GAAA;MAgBT,EAfG;MAiBR,KAAA,CAAM,qBAjBsB,CAiBA,EAjBA,CAAA,GAAA;MAkBvB,EAjBG;MAmBR,KAAA,CAAM,qBAnBsB,CAmBA,EAnBA,CAAA,GAAA;MAoBvB,EAnBG;;;;UCII,MAAA;EDTL,CAAA,CAAA,EAAA,MAAE,GAAA,MAAA;EAAA,EAAA,CAAA,EAAA,MAAA,GAAA,MAAA;KACO,EAAA,MAAM,GAAA,MAAA;KACd,EAAA,MAAM,GAAA,MAAA;KACN,EAAA,MAAM,GAAA,MAAA;KAAc,EAAA,MAAA,GAAA,MAAA;KACpB,EAAA,MAAM,GAAA,MAAA;;;;AAJP,KEKA,SAAA,GAAY,EFLV,CAAA,IAAA,EAAA,IAAA,EAAA,IAAA,EAAA,IAAA,EAAA,IAAA,EAAA,IAAA,CAAA;AAAA,KEMF,YAAA,GAAe,SFNb,GEMyB,MFNzB;AACO,cEOR,OFPc,EEOP,OAAA,CAAA,yBFPO,CAAA,CEOP,IFPO,CEOP,QFPO,CEOP,OAAA,CAAA,eFPO,CEOP,kBFPO,CAAA,GEOP,OAAA,CAAA,cFPO,CEOP,kBFPO,CAAA,GAAA;KACd,EAAA,IAAM,GAAA,SAAA;UACN,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UACpB,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UACpB,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UACpB,CAAA,EAAM,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAAc,IAAA;UAEA,CAAA,EAAA,KAAA,CAAA,OAAA,SAAA,wBAAA,mBAAA,CAAA,yBAAA,mBAAA,CAAA,GAAA;MAA5B,IAAA;UACM,CAAA,EAAA,KAAA,CAAA,CAAA,wBAAA,mBAAA,CAAA,CAAA"} |
| {"version":3,"file":"index.mjs","names":[],"sources":["../src/utils/spaces.ts","../src/heading.tsx"],"sourcesContent":["import type React from 'react';\n\ntype MarginCSSProperty = React.CSSProperties[\n | 'margin'\n | 'marginLeft'\n | 'marginRight'\n | 'marginTop'\n | 'marginBottom'];\n\nexport interface Margin {\n m?: number | string;\n mx?: number | string;\n my?: number | string;\n mt?: number | string;\n mr?: number | string;\n mb?: number | string;\n ml?: number | string;\n}\n\nexport const withMargin = (props: Margin) => {\n const nonEmptyStyles = [\n withSpace(props.m, ['margin']),\n withSpace(props.mx, ['marginLeft', 'marginRight']),\n withSpace(props.my, ['marginTop', 'marginBottom']),\n withSpace(props.mt, ['marginTop']),\n withSpace(props.mr, ['marginRight']),\n withSpace(props.mb, ['marginBottom']),\n withSpace(props.ml, ['marginLeft']),\n ].filter((s) => Object.keys(s).length);\n\n const mergedStyles = nonEmptyStyles.reduce((acc, style) => {\n return { ...acc, ...style };\n }, {});\n return mergedStyles;\n};\n\nexport const withSpace = (\n value: number | string | undefined,\n properties: MarginCSSProperty[],\n) => {\n return properties.reduce((styles, property) => {\n // Check to ensure string value is a valid number\n if (!Number.isNaN(Number.parseFloat(value as string))) {\n return { ...styles, [property as keyof MarginCSSProperty]: `${value}px` };\n }\n return styles;\n }, {});\n};\n","import * as React from 'react';\nimport type { As } from './utils/as';\nimport type { Margin } from './utils/spaces';\nimport { withMargin } from './utils/spaces';\n\nexport type HeadingAs = As<'h1', 'h2', 'h3', 'h4', 'h5', 'h6'>;\nexport type HeadingProps = HeadingAs & Margin;\n\nexport const Heading = React.forwardRef<\n HTMLHeadingElement,\n Readonly<HeadingProps>\n>(\n (\n { as: Tag = 'h1', children, style, m, mx, my, mt, mr, mb, ml, ...props },\n ref,\n ) => {\n return (\n <Tag\n {...props}\n ref={ref}\n style={{ ...withMargin({ m, mx, my, mt, mr, mb, ml }), ...style }}\n >\n {children}\n </Tag>\n );\n },\n);\n\nHeading.displayName = 'Heading';\n(Heading as any).tailwindTreatAsElement = true;\n"],"mappings":";;;;AAmBA,MAAa,cAAc,UAAkB;AAc3C,QAbuB;EACrB,UAAU,MAAM,GAAG,CAAC,SAAS,CAAC;EAC9B,UAAU,MAAM,IAAI,CAAC,cAAc,cAAc,CAAC;EAClD,UAAU,MAAM,IAAI,CAAC,aAAa,eAAe,CAAC;EAClD,UAAU,MAAM,IAAI,CAAC,YAAY,CAAC;EAClC,UAAU,MAAM,IAAI,CAAC,cAAc,CAAC;EACpC,UAAU,MAAM,IAAI,CAAC,eAAe,CAAC;EACrC,UAAU,MAAM,IAAI,CAAC,aAAa,CAAC;EACpC,CAAC,QAAQ,MAAM,OAAO,KAAK,EAAE,CAAC,OAAO,CAEF,QAAQ,KAAK,UAAU;AACzD,SAAO;GAAE,GAAG;GAAK,GAAG;GAAO;IAC1B,EAAE,CAAC;;AAIR,MAAa,aACX,OACA,eACG;AACH,QAAO,WAAW,QAAQ,QAAQ,aAAa;AAE7C,MAAI,CAAC,OAAO,MAAM,OAAO,WAAW,MAAgB,CAAC,CACnD,QAAO;GAAE,GAAG;IAAS,WAAsC,GAAG,MAAM;GAAK;AAE3E,SAAO;IACN,EAAE,CAAC;;;;;ACtCR,MAAa,UAAU,MAAM,YAKzB,EAAE,IAAI,MAAM,MAAM,UAAU,OAAO,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,GAAI,GAAG,SACjE,QACG;AACH,QACE,oBAAC;EACC,GAAI;EACC;EACL,OAAO;GAAE,GAAG,WAAW;IAAE;IAAG;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI,CAAC;GAAE,GAAG;GAAO;EAEhE;GACG;EAGX;AAED,QAAQ,cAAc;AACtB,AAAC,QAAgB,yBAAyB"} |
+29
-25
@@ -1,43 +0,47 @@ | ||
| import * as React$1 from 'react'; | ||
| import * as React$1 from "react"; | ||
| //#region src/utils/as.d.ts | ||
| type As<DefaultTag extends React.ElementType, T1 extends React.ElementType, T2 extends React.ElementType = T1, T3 extends React.ElementType = T1, T4 extends React.ElementType = T1, T5 extends React.ElementType = T1> = (React.ComponentPropsWithRef<DefaultTag> & { | ||
| as?: DefaultTag; | ||
| as?: DefaultTag; | ||
| }) | (React.ComponentPropsWithRef<T1> & { | ||
| as: T1; | ||
| as: T1; | ||
| }) | (React.ComponentPropsWithRef<T2> & { | ||
| as: T2; | ||
| as: T2; | ||
| }) | (React.ComponentPropsWithRef<T3> & { | ||
| as: T3; | ||
| as: T3; | ||
| }) | (React.ComponentPropsWithRef<T4> & { | ||
| as: T4; | ||
| as: T4; | ||
| }) | (React.ComponentPropsWithRef<T5> & { | ||
| as: T5; | ||
| as: T5; | ||
| }); | ||
| //#endregion | ||
| //#region src/utils/spaces.d.ts | ||
| interface Margin { | ||
| m?: number | string; | ||
| mx?: number | string; | ||
| my?: number | string; | ||
| mt?: number | string; | ||
| mr?: number | string; | ||
| mb?: number | string; | ||
| ml?: number | string; | ||
| m?: number | string; | ||
| mx?: number | string; | ||
| my?: number | string; | ||
| mt?: number | string; | ||
| mr?: number | string; | ||
| mb?: number | string; | ||
| ml?: number | string; | ||
| } | ||
| type HeadingAs = As<"h1", "h2", "h3", "h4", "h5", "h6">; | ||
| //#endregion | ||
| //#region src/heading.d.ts | ||
| type HeadingAs = As<'h1', 'h2', 'h3', 'h4', 'h5', 'h6'>; | ||
| type HeadingProps = HeadingAs & Margin; | ||
| declare const Heading: React$1.ForwardRefExoticComponent<(Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as?: "h1" | undefined; | ||
| as?: "h1" | undefined; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h2"; | ||
| as: "h2"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h3"; | ||
| as: "h3"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h4"; | ||
| as: "h4"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h5"; | ||
| as: "h5"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h6"; | ||
| as: "h6"; | ||
| } & Margin>, "ref">) & React$1.RefAttributes<HTMLHeadingElement>>; | ||
| export { Heading, type HeadingAs, type HeadingProps }; | ||
| //#endregion | ||
| export { Heading, HeadingAs, HeadingProps }; | ||
| //# sourceMappingURL=index.d.mts.map |
+29
-25
@@ -1,43 +0,47 @@ | ||
| import * as React$1 from 'react'; | ||
| import * as React$1 from "react"; | ||
| //#region src/utils/as.d.ts | ||
| type As<DefaultTag extends React.ElementType, T1 extends React.ElementType, T2 extends React.ElementType = T1, T3 extends React.ElementType = T1, T4 extends React.ElementType = T1, T5 extends React.ElementType = T1> = (React.ComponentPropsWithRef<DefaultTag> & { | ||
| as?: DefaultTag; | ||
| as?: DefaultTag; | ||
| }) | (React.ComponentPropsWithRef<T1> & { | ||
| as: T1; | ||
| as: T1; | ||
| }) | (React.ComponentPropsWithRef<T2> & { | ||
| as: T2; | ||
| as: T2; | ||
| }) | (React.ComponentPropsWithRef<T3> & { | ||
| as: T3; | ||
| as: T3; | ||
| }) | (React.ComponentPropsWithRef<T4> & { | ||
| as: T4; | ||
| as: T4; | ||
| }) | (React.ComponentPropsWithRef<T5> & { | ||
| as: T5; | ||
| as: T5; | ||
| }); | ||
| //#endregion | ||
| //#region src/utils/spaces.d.ts | ||
| interface Margin { | ||
| m?: number | string; | ||
| mx?: number | string; | ||
| my?: number | string; | ||
| mt?: number | string; | ||
| mr?: number | string; | ||
| mb?: number | string; | ||
| ml?: number | string; | ||
| m?: number | string; | ||
| mx?: number | string; | ||
| my?: number | string; | ||
| mt?: number | string; | ||
| mr?: number | string; | ||
| mb?: number | string; | ||
| ml?: number | string; | ||
| } | ||
| type HeadingAs = As<"h1", "h2", "h3", "h4", "h5", "h6">; | ||
| //#endregion | ||
| //#region src/heading.d.ts | ||
| type HeadingAs = As<'h1', 'h2', 'h3', 'h4', 'h5', 'h6'>; | ||
| type HeadingProps = HeadingAs & Margin; | ||
| declare const Heading: React$1.ForwardRefExoticComponent<(Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as?: "h1" | undefined; | ||
| as?: "h1" | undefined; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h2"; | ||
| as: "h2"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h3"; | ||
| as: "h3"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h4"; | ||
| as: "h4"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h5"; | ||
| as: "h5"; | ||
| } & Margin>, "ref"> | Omit<Readonly<React$1.ClassAttributes<HTMLHeadingElement> & React$1.HTMLAttributes<HTMLHeadingElement> & { | ||
| as: "h6"; | ||
| as: "h6"; | ||
| } & Margin>, "ref">) & React$1.RefAttributes<HTMLHeadingElement>>; | ||
| export { Heading, type HeadingAs, type HeadingProps }; | ||
| //#endregion | ||
| export { Heading, HeadingAs, HeadingProps }; | ||
| //# sourceMappingURL=index.d.ts.map |
+67
-99
@@ -1,113 +0,81 @@ | ||
| "use strict"; | ||
| //#region rolldown:runtime | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __defProps = Object.defineProperties; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
| var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
| var __spreadValues = (a, b) => { | ||
| for (var prop in b || (b = {})) | ||
| if (__hasOwnProp.call(b, prop)) | ||
| __defNormalProp(a, prop, b[prop]); | ||
| if (__getOwnPropSymbols) | ||
| for (var prop of __getOwnPropSymbols(b)) { | ||
| if (__propIsEnum.call(b, prop)) | ||
| __defNormalProp(a, prop, b[prop]); | ||
| } | ||
| return a; | ||
| }; | ||
| var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
| var __objRest = (source, exclude) => { | ||
| var target = {}; | ||
| for (var prop in source) | ||
| if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) | ||
| target[prop] = source[prop]; | ||
| if (source != null && __getOwnPropSymbols) | ||
| for (var prop of __getOwnPropSymbols(source)) { | ||
| if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) | ||
| target[prop] = source[prop]; | ||
| } | ||
| return target; | ||
| }; | ||
| var __export = (target, all) => { | ||
| for (var name in all) | ||
| __defProp(target, name, { get: all[name], enumerable: true }); | ||
| }; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (let key of __getOwnPropNames(from)) | ||
| if (!__hasOwnProp.call(to, key) && key !== except) | ||
| __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
| } | ||
| return to; | ||
| if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { | ||
| key = keys[i]; | ||
| if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { | ||
| get: ((k) => from[k]).bind(null, key), | ||
| enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable | ||
| }); | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
| // If the importer is in node compatibility mode or this is not an ESM | ||
| // file that has been converted to a CommonJS file using a Babel- | ||
| // compatible transform (i.e. "__esModule" has not been set), then set | ||
| // "default" to the CommonJS "module.exports" for node compatibility. | ||
| isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
| mod | ||
| )); | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { | ||
| value: mod, | ||
| enumerable: true | ||
| }) : target, mod)); | ||
| // src/index.ts | ||
| var src_exports = {}; | ||
| __export(src_exports, { | ||
| Heading: () => Heading | ||
| }); | ||
| module.exports = __toCommonJS(src_exports); | ||
| //#endregion | ||
| let react = require("react"); | ||
| react = __toESM(react); | ||
| let react_jsx_runtime = require("react/jsx-runtime"); | ||
| react_jsx_runtime = __toESM(react_jsx_runtime); | ||
| // src/heading.tsx | ||
| var React = __toESM(require("react")); | ||
| // src/utils/spaces.ts | ||
| var withMargin = (props) => { | ||
| const nonEmptyStyles = [ | ||
| withSpace(props.m, ["margin"]), | ||
| withSpace(props.mx, ["marginLeft", "marginRight"]), | ||
| withSpace(props.my, ["marginTop", "marginBottom"]), | ||
| withSpace(props.mt, ["marginTop"]), | ||
| withSpace(props.mr, ["marginRight"]), | ||
| withSpace(props.mb, ["marginBottom"]), | ||
| withSpace(props.ml, ["marginLeft"]) | ||
| ].filter((s) => Object.keys(s).length); | ||
| const mergedStyles = nonEmptyStyles.reduce((acc, style) => { | ||
| return __spreadValues(__spreadValues({}, acc), style); | ||
| }, {}); | ||
| return mergedStyles; | ||
| //#region src/utils/spaces.ts | ||
| const withMargin = (props) => { | ||
| return [ | ||
| withSpace(props.m, ["margin"]), | ||
| withSpace(props.mx, ["marginLeft", "marginRight"]), | ||
| withSpace(props.my, ["marginTop", "marginBottom"]), | ||
| withSpace(props.mt, ["marginTop"]), | ||
| withSpace(props.mr, ["marginRight"]), | ||
| withSpace(props.mb, ["marginBottom"]), | ||
| withSpace(props.ml, ["marginLeft"]) | ||
| ].filter((s) => Object.keys(s).length).reduce((acc, style) => { | ||
| return { | ||
| ...acc, | ||
| ...style | ||
| }; | ||
| }, {}); | ||
| }; | ||
| var withSpace = (value, properties) => { | ||
| return properties.reduce((styles, property) => { | ||
| if (!isNaN(parseFloat(value))) { | ||
| return __spreadProps(__spreadValues({}, styles), { [property]: `${value}px` }); | ||
| } | ||
| return styles; | ||
| }, {}); | ||
| const withSpace = (value, properties) => { | ||
| return properties.reduce((styles, property) => { | ||
| if (!Number.isNaN(Number.parseFloat(value))) return { | ||
| ...styles, | ||
| [property]: `${value}px` | ||
| }; | ||
| return styles; | ||
| }, {}); | ||
| }; | ||
| // src/heading.tsx | ||
| var import_jsx_runtime = require("react/jsx-runtime"); | ||
| var Heading = React.forwardRef( | ||
| (_a, ref) => { | ||
| var _b = _a, { as: Tag = "h1", children, style, m, mx, my, mt, mr, mb, ml } = _b, props = __objRest(_b, ["as", "children", "style", "m", "mx", "my", "mt", "mr", "mb", "ml"]); | ||
| return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( | ||
| Tag, | ||
| __spreadProps(__spreadValues({}, props), { | ||
| ref, | ||
| style: __spreadValues(__spreadValues({}, withMargin({ m, mx, my, mt, mr, mb, ml })), style), | ||
| children | ||
| }) | ||
| ); | ||
| } | ||
| ); | ||
| //#endregion | ||
| //#region src/heading.tsx | ||
| const Heading = react.forwardRef(({ as: Tag = "h1", children, style, m, mx, my, mt, mr, mb, ml,...props }, ref) => { | ||
| return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, { | ||
| ...props, | ||
| ref, | ||
| style: { | ||
| ...withMargin({ | ||
| m, | ||
| mx, | ||
| my, | ||
| mt, | ||
| mr, | ||
| mb, | ||
| ml | ||
| }), | ||
| ...style | ||
| }, | ||
| children | ||
| }); | ||
| }); | ||
| Heading.displayName = "Heading"; | ||
| // Annotate the CommonJS export names for ESM import in node: | ||
| 0 && (module.exports = { | ||
| Heading | ||
| }); | ||
| Heading.tailwindTreatAsElement = true; | ||
| //#endregion | ||
| exports.Heading = Heading; |
+51
-73
@@ -1,79 +0,57 @@ | ||
| var __defProp = Object.defineProperty; | ||
| var __defProps = Object.defineProperties; | ||
| var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
| var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
| var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
| var __spreadValues = (a, b) => { | ||
| for (var prop in b || (b = {})) | ||
| if (__hasOwnProp.call(b, prop)) | ||
| __defNormalProp(a, prop, b[prop]); | ||
| if (__getOwnPropSymbols) | ||
| for (var prop of __getOwnPropSymbols(b)) { | ||
| if (__propIsEnum.call(b, prop)) | ||
| __defNormalProp(a, prop, b[prop]); | ||
| } | ||
| return a; | ||
| }; | ||
| var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
| var __objRest = (source, exclude) => { | ||
| var target = {}; | ||
| for (var prop in source) | ||
| if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) | ||
| target[prop] = source[prop]; | ||
| if (source != null && __getOwnPropSymbols) | ||
| for (var prop of __getOwnPropSymbols(source)) { | ||
| if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) | ||
| target[prop] = source[prop]; | ||
| } | ||
| return target; | ||
| }; | ||
| // src/heading.tsx | ||
| import * as React from "react"; | ||
| import { jsx } from "react/jsx-runtime"; | ||
| // src/utils/spaces.ts | ||
| var withMargin = (props) => { | ||
| const nonEmptyStyles = [ | ||
| withSpace(props.m, ["margin"]), | ||
| withSpace(props.mx, ["marginLeft", "marginRight"]), | ||
| withSpace(props.my, ["marginTop", "marginBottom"]), | ||
| withSpace(props.mt, ["marginTop"]), | ||
| withSpace(props.mr, ["marginRight"]), | ||
| withSpace(props.mb, ["marginBottom"]), | ||
| withSpace(props.ml, ["marginLeft"]) | ||
| ].filter((s) => Object.keys(s).length); | ||
| const mergedStyles = nonEmptyStyles.reduce((acc, style) => { | ||
| return __spreadValues(__spreadValues({}, acc), style); | ||
| }, {}); | ||
| return mergedStyles; | ||
| //#region src/utils/spaces.ts | ||
| const withMargin = (props) => { | ||
| return [ | ||
| withSpace(props.m, ["margin"]), | ||
| withSpace(props.mx, ["marginLeft", "marginRight"]), | ||
| withSpace(props.my, ["marginTop", "marginBottom"]), | ||
| withSpace(props.mt, ["marginTop"]), | ||
| withSpace(props.mr, ["marginRight"]), | ||
| withSpace(props.mb, ["marginBottom"]), | ||
| withSpace(props.ml, ["marginLeft"]) | ||
| ].filter((s) => Object.keys(s).length).reduce((acc, style) => { | ||
| return { | ||
| ...acc, | ||
| ...style | ||
| }; | ||
| }, {}); | ||
| }; | ||
| var withSpace = (value, properties) => { | ||
| return properties.reduce((styles, property) => { | ||
| if (!isNaN(parseFloat(value))) { | ||
| return __spreadProps(__spreadValues({}, styles), { [property]: `${value}px` }); | ||
| } | ||
| return styles; | ||
| }, {}); | ||
| const withSpace = (value, properties) => { | ||
| return properties.reduce((styles, property) => { | ||
| if (!Number.isNaN(Number.parseFloat(value))) return { | ||
| ...styles, | ||
| [property]: `${value}px` | ||
| }; | ||
| return styles; | ||
| }, {}); | ||
| }; | ||
| // src/heading.tsx | ||
| import { jsx } from "react/jsx-runtime"; | ||
| var Heading = React.forwardRef( | ||
| (_a, ref) => { | ||
| var _b = _a, { as: Tag = "h1", children, style, m, mx, my, mt, mr, mb, ml } = _b, props = __objRest(_b, ["as", "children", "style", "m", "mx", "my", "mt", "mr", "mb", "ml"]); | ||
| return /* @__PURE__ */ jsx( | ||
| Tag, | ||
| __spreadProps(__spreadValues({}, props), { | ||
| ref, | ||
| style: __spreadValues(__spreadValues({}, withMargin({ m, mx, my, mt, mr, mb, ml })), style), | ||
| children | ||
| }) | ||
| ); | ||
| } | ||
| ); | ||
| //#endregion | ||
| //#region src/heading.tsx | ||
| const Heading = React.forwardRef(({ as: Tag = "h1", children, style, m, mx, my, mt, mr, mb, ml,...props }, ref) => { | ||
| return /* @__PURE__ */ jsx(Tag, { | ||
| ...props, | ||
| ref, | ||
| style: { | ||
| ...withMargin({ | ||
| m, | ||
| mx, | ||
| my, | ||
| mt, | ||
| mr, | ||
| mb, | ||
| ml | ||
| }), | ||
| ...style | ||
| }, | ||
| children | ||
| }); | ||
| }); | ||
| Heading.displayName = "Heading"; | ||
| export { | ||
| Heading | ||
| }; | ||
| Heading.tailwindTreatAsElement = true; | ||
| //#endregion | ||
| export { Heading }; | ||
| //# sourceMappingURL=index.mjs.map |
+8
-10
| { | ||
| "name": "@react-email/heading", | ||
| "version": "0.0.15", | ||
| "version": "0.0.16-tailwindv4.0", | ||
| "description": "A block of heading text", | ||
@@ -41,6 +41,5 @@ "sideEffects": false, | ||
| "devDependencies": { | ||
| "typescript": "5.1.6", | ||
| "@react-email/render": "1.0.3", | ||
| "tsconfig": "0.0.0", | ||
| "eslint-config-custom": "0.0.0" | ||
| "typescript": "5.8.3", | ||
| "@react-email/render": "1.3.1", | ||
| "tsconfig": "0.0.0" | ||
| }, | ||
@@ -51,9 +50,8 @@ "publishConfig": { | ||
| "scripts": { | ||
| "build": "tsup src/index.ts --format esm,cjs --dts --external react", | ||
| "build": "tsdown src/index.ts --format esm,cjs --dts --external react", | ||
| "build:watch": "tsdown src/index.ts --format esm,cjs --dts --external react --watch", | ||
| "clean": "rm -rf dist", | ||
| "dev": "tsup src/index.ts --format esm,cjs --dts --external react --watch", | ||
| "lint": "eslint .", | ||
| "test:watch": "vitest", | ||
| "test": "vitest run" | ||
| "test": "vitest run", | ||
| "test:watch": "vitest" | ||
| } | ||
| } |
+3
-4
@@ -7,7 +7,6 @@  | ||
| <div align="center"> | ||
| <a href="https://react.email">Website</a> | ||
| <a href="https://react.email">Website</a> | ||
| <span> · </span> | ||
| <a href="https://github.com/resend/react-email">GitHub</a> | ||
| <span> · </span> | ||
| <a href="https://react.email/discord">Discord</a> | ||
| <a href="https://github.com/resend/react-email">GitHub</a> | ||
| </div> | ||
@@ -14,0 +13,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
19020
17.98%3
-25%10
42.86%174
-22.32%52
-1.89%1
Infinity%