@maily-to/render 0.0.9 → 0.0.11

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 CHANGED
@@ -10,22 +10,27 @@ interface MarkType {
10
10
  declare const allowedSpacers: readonly ["sm", "md", "lg", "xl"];
11
11
  type AllowedSpacers = (typeof allowedSpacers)[number];
12
12
  interface ThemeOptions {
13
- colors?: {
14
- heading?: string;
15
- paragraph?: string;
16
- horizontal?: string;
17
- footer?: string;
18
- blockquoteBorder?: string;
19
- codeBackground?: string;
20
- codeText?: string;
21
- };
22
- fontSize?: {
23
- paragraph?: string;
24
- footer?: {
25
- size?: string;
26
- lineHeight?: string;
13
+ colors?: Partial<{
14
+ heading: string;
15
+ paragraph: string;
16
+ horizontal: string;
17
+ footer: string;
18
+ blockquoteBorder: string;
19
+ codeBackground: string;
20
+ codeText: string;
21
+ linkCardTitle: string;
22
+ linkCardDescription: string;
23
+ linkCardBadgeText: string;
24
+ linkCardBadgeBackground: string;
25
+ linkCardSubTitle: string;
26
+ }>;
27
+ fontSize?: Partial<{
28
+ paragraph: string;
29
+ footer: {
30
+ size: string;
31
+ lineHeight: string;
27
32
  };
28
- };
33
+ }>;
29
34
  }
30
35
  interface MailyConfig {
31
36
  /**
@@ -43,10 +48,10 @@ interface MailyConfig {
43
48
  * ```js
44
49
  * {
45
50
  * colors: {
46
- * heading: 'rgb(17, 24, 39)',
47
- * paragraph: 'rgb(55, 65, 81)',
48
- * horizontal: 'rgb(234, 234, 234)',
49
- * footer: 'rgb(100, 116, 139)',
51
+ * heading: '#111827',
52
+ * paragraph: '#374151',
53
+ * horizontal: '#EAEAEA',
54
+ * footer: '#64748B',
50
55
  * },
51
56
  * fontSize: {
52
57
  * paragraph: '15px',
@@ -63,7 +68,7 @@ interface MailyConfig {
63
68
  * const maily = new Maily(content, {
64
69
  * theme: {
65
70
  * colors: {
66
- * heading: 'rgb(17, 24, 39)',
71
+ * heading: '#111827',
67
72
  * },
68
73
  * fontSize: {
69
74
  * footer: {
@@ -75,7 +80,7 @@ interface MailyConfig {
75
80
  * });
76
81
  * ```
77
82
  */
78
- theme?: ThemeOptions;
83
+ theme?: Partial<ThemeOptions>;
79
84
  }
80
85
  interface RenderOptions {
81
86
  /**
@@ -107,7 +112,7 @@ declare class Maily {
107
112
  private openTrackingPixel;
108
113
  constructor(content?: JSONContent);
109
114
  setPreviewText(preview?: string): void;
110
- setTheme(theme?: ThemeOptions): void;
115
+ setTheme(theme: Partial<ThemeOptions>): void;
111
116
  setVariableFormatter(formatter: VariableFormatter): void;
112
117
  /**
113
118
  * `setVariableValue` will set the variable value.
@@ -150,13 +155,13 @@ declare class Maily {
150
155
  setShouldReplaceVariableValues(shouldReplace: boolean): void;
151
156
  getAllLinks(): Set<string>;
152
157
  private isValidUrl;
153
- renderSync(options?: RenderOptions): string;
154
- renderAsync(options?: RenderOptions): Promise<string>;
158
+ render(options?: RenderOptions): Promise<string>;
155
159
  /**
156
160
  * `markup` will render the JSON content into React Email markup.
157
161
  * and return the raw React Tree.
158
162
  */
159
163
  markup(): react_jsx_runtime.JSX.Element;
164
+ private getMarginOverrideConditions;
160
165
  private getMappedContent;
161
166
  private renderNode;
162
167
  private renderMark;
@@ -166,6 +171,7 @@ declare class Maily {
166
171
  private italic;
167
172
  private underline;
168
173
  private strike;
174
+ private textStyle;
169
175
  private link;
170
176
  private heading;
171
177
  private variable;
@@ -181,10 +187,12 @@ declare class Maily {
181
187
  private footer;
182
188
  private blockquote;
183
189
  private code;
190
+ private linkCard;
191
+ private section;
192
+ private columns;
193
+ private column;
184
194
  }
185
195
 
186
- declare function renderSync(content: JSONContent, config?: MailyConfig & RenderOptions): string;
196
+ declare function render(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
187
197
 
188
- declare function renderAsync(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
189
-
190
- export { type AllowedSpacers, type LinkValues, Maily, type MailyConfig, type MarkType, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, renderAsync, renderSync };
198
+ export { type AllowedSpacers, type LinkValues, Maily, type MailyConfig, type MarkType, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
package/dist/index.d.ts CHANGED
@@ -10,22 +10,27 @@ interface MarkType {
10
10
  declare const allowedSpacers: readonly ["sm", "md", "lg", "xl"];
11
11
  type AllowedSpacers = (typeof allowedSpacers)[number];
12
12
  interface ThemeOptions {
13
- colors?: {
14
- heading?: string;
15
- paragraph?: string;
16
- horizontal?: string;
17
- footer?: string;
18
- blockquoteBorder?: string;
19
- codeBackground?: string;
20
- codeText?: string;
21
- };
22
- fontSize?: {
23
- paragraph?: string;
24
- footer?: {
25
- size?: string;
26
- lineHeight?: string;
13
+ colors?: Partial<{
14
+ heading: string;
15
+ paragraph: string;
16
+ horizontal: string;
17
+ footer: string;
18
+ blockquoteBorder: string;
19
+ codeBackground: string;
20
+ codeText: string;
21
+ linkCardTitle: string;
22
+ linkCardDescription: string;
23
+ linkCardBadgeText: string;
24
+ linkCardBadgeBackground: string;
25
+ linkCardSubTitle: string;
26
+ }>;
27
+ fontSize?: Partial<{
28
+ paragraph: string;
29
+ footer: {
30
+ size: string;
31
+ lineHeight: string;
27
32
  };
28
- };
33
+ }>;
29
34
  }
30
35
  interface MailyConfig {
31
36
  /**
@@ -43,10 +48,10 @@ interface MailyConfig {
43
48
  * ```js
44
49
  * {
45
50
  * colors: {
46
- * heading: 'rgb(17, 24, 39)',
47
- * paragraph: 'rgb(55, 65, 81)',
48
- * horizontal: 'rgb(234, 234, 234)',
49
- * footer: 'rgb(100, 116, 139)',
51
+ * heading: '#111827',
52
+ * paragraph: '#374151',
53
+ * horizontal: '#EAEAEA',
54
+ * footer: '#64748B',
50
55
  * },
51
56
  * fontSize: {
52
57
  * paragraph: '15px',
@@ -63,7 +68,7 @@ interface MailyConfig {
63
68
  * const maily = new Maily(content, {
64
69
  * theme: {
65
70
  * colors: {
66
- * heading: 'rgb(17, 24, 39)',
71
+ * heading: '#111827',
67
72
  * },
68
73
  * fontSize: {
69
74
  * footer: {
@@ -75,7 +80,7 @@ interface MailyConfig {
75
80
  * });
76
81
  * ```
77
82
  */
78
- theme?: ThemeOptions;
83
+ theme?: Partial<ThemeOptions>;
79
84
  }
80
85
  interface RenderOptions {
81
86
  /**
@@ -107,7 +112,7 @@ declare class Maily {
107
112
  private openTrackingPixel;
108
113
  constructor(content?: JSONContent);
109
114
  setPreviewText(preview?: string): void;
110
- setTheme(theme?: ThemeOptions): void;
115
+ setTheme(theme: Partial<ThemeOptions>): void;
111
116
  setVariableFormatter(formatter: VariableFormatter): void;
112
117
  /**
113
118
  * `setVariableValue` will set the variable value.
@@ -150,13 +155,13 @@ declare class Maily {
150
155
  setShouldReplaceVariableValues(shouldReplace: boolean): void;
151
156
  getAllLinks(): Set<string>;
152
157
  private isValidUrl;
153
- renderSync(options?: RenderOptions): string;
154
- renderAsync(options?: RenderOptions): Promise<string>;
158
+ render(options?: RenderOptions): Promise<string>;
155
159
  /**
156
160
  * `markup` will render the JSON content into React Email markup.
157
161
  * and return the raw React Tree.
158
162
  */
159
163
  markup(): react_jsx_runtime.JSX.Element;
164
+ private getMarginOverrideConditions;
160
165
  private getMappedContent;
161
166
  private renderNode;
162
167
  private renderMark;
@@ -166,6 +171,7 @@ declare class Maily {
166
171
  private italic;
167
172
  private underline;
168
173
  private strike;
174
+ private textStyle;
169
175
  private link;
170
176
  private heading;
171
177
  private variable;
@@ -181,10 +187,12 @@ declare class Maily {
181
187
  private footer;
182
188
  private blockquote;
183
189
  private code;
190
+ private linkCard;
191
+ private section;
192
+ private columns;
193
+ private column;
184
194
  }
185
195
 
186
- declare function renderSync(content: JSONContent, config?: MailyConfig & RenderOptions): string;
196
+ declare function render(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
187
197
 
188
- declare function renderAsync(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
189
-
190
- export { type AllowedSpacers, type LinkValues, Maily, type MailyConfig, type MarkType, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, renderAsync, renderSync };
198
+ export { type AllowedSpacers, type LinkValues, Maily, type MailyConfig, type MarkType, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // @ts-nocheck
2
2
 
3
- "use strict";var _=Object.create;var S=Object.defineProperty,z=Object.defineProperties,A=Object.getOwnPropertyDescriptor,F=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertyNames,b=Object.getOwnPropertySymbols,H=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var E=(l,e,t)=>e in l?S(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t,y=(l,e)=>{for(var t in e||(e={}))v.call(e,t)&&E(l,t,e[t]);if(b)for(var t of b(e))V.call(e,t)&&E(l,t,e[t]);return l},T=(l,e)=>z(l,F(e));var k=(l,e)=>{var t={};for(var n in l)v.call(l,n)&&e.indexOf(n)<0&&(t[n]=l[n]);if(l!=null&&b)for(var n of b(l))e.indexOf(n)<0&&V.call(l,n)&&(t[n]=l[n]);return t};var W=(l,e)=>{for(var t in e)S(l,t,{get:e[t],enumerable:!0})},L=(l,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of B(e))!v.call(l,r)&&r!==t&&S(l,r,{get:()=>e[r],enumerable:!(n=A(e,r))||n.enumerable});return l};var P=(l,e,t)=>(t=l!=null?_(H(l)):{},L(e||!l||!l.__esModule?S(t,"default",{value:l,enumerable:!0}):t,l)),I=l=>L(S({},"__esModule",{value:!0}),l);var O=(l,e,t)=>new Promise((n,r)=>{var o=c=>{try{s(t.next(c))}catch(g){r(g)}},a=c=>{try{s(t.throw(c))}catch(g){r(g)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((t=t.apply(l,e)).next())});var Y={};W(Y,{Maily:()=>x,renderAsync:()=>K,renderSync:()=>j});module.exports=I(Y);var w=require("react"),p=require("@react-email/components"),C=require("@react-email/render"),X=P(require("lodash/merge"));function N(){return Math.random().toString(36).substr(2,6)}var i=require("react/jsx-runtime");var D={sm:"8px",md:"16px",lg:"32px",xl:"64px"},J={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var q={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var M={sm:"40px",md:"48px",lg:"64px"},R={pretty:!1,plainText:!1},U={colors:{heading:"rgb(17, 24, 39)",paragraph:"rgb(55, 65, 81)",horizontal:"rgb(234, 234, 234)",footer:"rgb(100, 116, 139)",blockquoteBorder:"rgb(209, 213, 219)",codeBackground:"rgb(239, 239, 239)",codeText:"rgb(17, 24, 39)"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},$='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',x=class{constructor(e={type:"doc",content:[]}){this.config={theme:U};this.variableFormatter=({variable:e,fallback:t})=>t?`{{${e},fallback=${t}}}`:`{{${e}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.content=e}setPreviewText(e){this.config.preview=e}setTheme(e){this.config.theme=(0,X.default)(this.config.theme,e)}setVariableFormatter(e){this.variableFormatter=e}setVariableValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(e,t)}setVariableValues(e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(e).forEach(([t,n])=>{this.setVariableValue(t,n)})}setLinkValue(e,t){this.linkValues.set(e,t)}setLinkValues(e){Object.entries(e).forEach(([t,n])=>{this.setLinkValue(t,n)})}setOpenTrackingPixel(e){this.openTrackingPixel=e}setShouldReplaceVariableValues(e){this.shouldReplaceVariableValues=e}getAllLinks(){let e=this.content.content||[],t=new Set,n=o=>o&&this.isValidUrl(o)&&!o.startsWith("#")&&!o.startsWith("mailto:")&&!o.startsWith("tel:")&&typeof o=="string",r=o=>{var a;if(o.type==="button"){let s=(a=o.attrs)==null?void 0:a.url;n(s)&&s&&t.add(s)}else o.content&&o.content.forEach(s=>{s.marks&&s.marks.forEach(c=>{var m;let g=(m=c.attrs)==null?void 0:m.href;c.type==="link"&&n(g)&&t.add(g)}),s.content&&r(s)})};return e.forEach(o=>{r(o)}),t}isValidUrl(e){try{let t=new URL(e);return!0}catch(t){return!1}}renderSync(e=R){let t=this.markup();return(0,C.render)(t,e)}renderAsync(){return O(this,arguments,function*(e=R){let t=this.markup();return(0,C.renderAsync)(t,e)})}markup(){let e=this.content.content||[],t=e.map((o,a)=>{let s={prev:e[a-1],next:e[a+1],parent:o},c=this.renderNode(o,s);return c?(0,i.jsx)(w.Fragment,{children:c},N()):null}),{preview:n}=this.config;return(0,i.jsxs)(p.Html,{children:[(0,i.jsxs)(p.Head,{children:[(0,i.jsx)(p.Font,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}"}}),(0,i.jsx)("meta",{content:"width=device-width",name:"viewport"}),(0,i.jsx)("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),(0,i.jsx)("meta",{name:"x-apple-disable-message-reformatting"}),(0,i.jsx)("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),(0,i.jsx)("meta",{content:"light",name:"color-scheme"}),(0,i.jsx)("meta",{content:"light",name:"supported-color-schemes"})]}),(0,i.jsxs)(p.Body,{children:[n?(0,i.jsx)(p.Preview,{id:"__react-email-preview",children:n}):null,(0,i.jsx)(p.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:t}),this.openTrackingPixel?(0,i.jsx)(p.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMappedContent(e,t){var n;return(n=e.content)==null?void 0:n.map(r=>{let o=this.renderNode(r,t);return o?(0,i.jsx)(w.Fragment,{children:o},N()):null}).filter(r=>r!==null)}renderNode(e,t={}){var r;let n=e.type||"";if(n in this)return(r=this[n])==null?void 0:r.call(this,e,t);throw new Error(`Node type "${n}" is not supported.`)}renderMark(e){let t=e.text||(0,i.jsx)(i.Fragment,{children:"\xA0"});return(e.marks||[]).reduce((r,o)=>{var s;let a=o.type;if(a in this)return(s=this[a])==null?void 0:s.call(this,o,r);throw new Error(`Mark type "${a}" is not supported.`)},(0,i.jsx)(i.Fragment,{children:t}))}paragraph(e,t){var g,m,d,h;let{attrs:n}=e,r=(n==null?void 0:n.textAlign)||"left",{parent:o,next:a}=t||{},s=(o==null?void 0:o.type)==="listItem",c=(a==null?void 0:a.type)==="spacer";return(0,i.jsx)(p.Text,{style:y({textAlign:r,marginBottom:s||c?"0px":"20px",marginTop:"0px",fontSize:(m=(g=this.config.theme)==null?void 0:g.fontSize)==null?void 0:m.paragraph,color:(h=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:h.paragraph},J),children:e.content?this.getMappedContent(e):(0,i.jsx)(i.Fragment,{children:"\xA0"})})}text(e,t){let n=e.text||"&nbsp";return e.marks?this.renderMark(e):(0,i.jsx)(i.Fragment,{children:n})}bold(e,t){return(0,i.jsx)("strong",{children:t})}italic(e,t){return(0,i.jsx)("em",{children:t})}underline(e,t){return(0,i.jsx)("u",{children:t})}strike(e,t){return(0,i.jsx)("s",{style:{textDecoration:"line-through"},children:t})}link(e,t){var s,c;let{attrs:n}=e,r=(n==null?void 0:n.href)||"#",o=(n==null?void 0:n.target)||"_blank",a=(n==null?void 0:n.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(r=this.linkValues.get(r)||this.variableValues.get(r)||r),(0,i.jsx)(p.Link,{href:r,rel:a,style:{fontWeight:500,textDecoration:"underline",color:(c=(s=this.config.theme)==null?void 0:s.colors)==null?void 0:c.heading},target:o,children:t})}heading(e,t){var u,f;let{attrs:n}=e,{next:r,prev:o}=t||{},a=`h${Number(n==null?void 0:n.level)||1}`,s=(n==null?void 0:n.textAlign)||"left",c=(r==null?void 0:r.type)==="spacer",g=(o==null?void 0:o.type)==="spacer",{fontSize:m,lineHeight:d,fontWeight:h}=q[a];return(0,i.jsx)(p.Heading,{as:a,style:{textAlign:s,color:(f=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:f.heading,marginBottom:c?"0px":"12px",marginTop:"0px",fontSize:m,lineHeight:d,fontWeight:h},children:this.getMappedContent(e)})}variable(e,t){let{id:n,fallback:r}=e.attrs||{},o=this.variableFormatter({variable:n,fallback:r});return this.shouldReplaceVariableValues&&(o=this.variableValues.get(n)||r||o),(0,i.jsx)(i.Fragment,{children:o})}horizontalRule(e,t){return(0,i.jsx)(p.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(e,t){return(0,i.jsx)(p.Container,{children:(0,i.jsx)("ol",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(e)})})}bulletList(e,t){return(0,i.jsx)(p.Container,{style:{maxWidth:"100%"},children:(0,i.jsx)("ul",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(e)})})}listItem(e,t){return(0,i.jsx)(p.Container,{style:{maxWidth:"100%"},children:(0,i.jsx)("li",{style:y({marginBottom:"8px",paddingLeft:"6px"},J),children:this.getMappedContent(e,T(y({},t),{parent:e}))})})}button(e,t){let{attrs:n}=e,{text:r,url:o,variant:a,buttonColor:s,textColor:c,borderRadius:g,alignment:m="left"}=n||{},d="0px";g==="round"?d="9999px":g==="smooth"&&(d="6px");let{next:h}=t||{},u=(h==null?void 0:h.type)==="spacer",f=this.linkValues.get(o)||this.variableValues.get(o)||o;return(0,i.jsx)(p.Container,{style:{textAlign:m,maxWidth:"100%",marginBottom:u?"0px":"20px"},children:(0,i.jsx)(p.Button,{href:f,style:{color:String(c),backgroundColor:a==="filled"?String(s):"transparent",borderColor:String(s),padding:a==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:d},children:r})})}spacer(e,t){let{attrs:n}=e,{height:r="auto"}=n||{};return(0,i.jsx)(p.Container,{style:{height:D[r]||r}})}hardBreak(e,t){return(0,i.jsx)("br",{})}logo(e,t){let{attrs:n}=e,{src:r,alt:o,title:a,size:s,alignment:c="left"}=n||{},{next:g}=t||{},m=(g==null?void 0:g.type)==="spacer";return(0,i.jsx)(p.Row,{style:{marginTop:"0px",marginBottom:m?"0px":"32px"},children:(0,i.jsx)(p.Column,{align:c,children:(0,i.jsx)(p.Img,{alt:o||a||"Logo",src:r,style:{width:M[s]||s,height:M[s]||s},title:a||o||"Logo"})})})}image(e,t){let{attrs:n}=e,{src:r,alt:o,title:a,width:s="auto",height:c="auto",alignment:g="center",externalLink:m=""}=n||{},{next:d}=t||{},h=(d==null?void 0:d.type)==="spacer",u=(0,i.jsx)(p.Img,{alt:o||a||"Image",src:r,style:{height:c,width:s,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none"},title:a||o||"Image"});return(0,i.jsx)(p.Row,{style:{marginTop:"0px",marginBottom:h?"0px":"32px"},children:(0,i.jsx)(p.Column,{align:g,children:m?(0,i.jsx)("a",{href:m,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:u}):u})})}footer(e,t){var s,c,g,m,d,h,u,f;let{attrs:n}=e,{textAlign:r="left"}=n||{},{next:o}=t||{},a=(o==null?void 0:o.type)==="spacer";return(0,i.jsx)(p.Text,{style:y({fontSize:(g=(c=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:c.footer)==null?void 0:g.size,lineHeight:(h=(d=(m=this.config.theme)==null?void 0:m.fontSize)==null?void 0:d.footer)==null?void 0:h.lineHeight,color:(f=(u=this.config.theme)==null?void 0:u.colors)==null?void 0:f.footer,marginTop:"0px",marginBottom:a?"0px":"20px",textAlign:r},J),children:this.getMappedContent(e)})}blockquote(e,t){var s,c;let{next:n,prev:r}=t||{},o=(n==null?void 0:n.type)==="spacer",a=(r==null?void 0:r.type)==="spacer";return(0,i.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(c=(s=this.config.theme)==null?void 0:s.colors)==null?void 0:c.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:a?"0px":"20px",marginBottom:o?"0px":"20px"},children:this.getMappedContent(e)})}code(e,t){var n,r,o,a;return(0,i.jsx)("code",{style:{backgroundColor:(r=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:r.codeBackground,color:(a=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:a.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:$,fontWeight:400,letterSpacing:0},children:t})}};function j(l,e){let a=e||{},{theme:t,preview:n}=a,r=k(a,["theme","preview"]),o=new x(l);return o.setPreviewText(n),o.setTheme(t),o.renderSync(r)}function K(l,e){return O(this,null,function*(){let a=e||{},{theme:t,preview:n}=a,r=k(a,["theme","preview"]),o=new x(l);return o.setPreviewText(n),o.setTheme(t),o.renderAsync(r)})}0&&(module.exports={Maily,renderAsync,renderSync});
3
+ "use strict";var w=Object.defineProperty,U=Object.defineProperties,$=Object.getOwnPropertyDescriptor,K=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var W=(a,e,n)=>e in a?w(a,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[e]=n,h=(a,e)=>{for(var n in e||(e={}))T.call(e,n)&&W(a,n,e[n]);if(O)for(var n of O(e))I.call(e,n)&&W(a,n,e[n]);return a},y=(a,e)=>U(a,K(e));var j=(a,e)=>{var n={};for(var t in a)T.call(a,t)&&e.indexOf(t)<0&&(n[t]=a[t]);if(a!=null&&O)for(var t of O(a))e.indexOf(t)<0&&I.call(a,t)&&(n[t]=a[t]);return n};var G=(a,e)=>{for(var n in e)w(a,n,{get:e[n],enumerable:!0})},Q=(a,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Y(e))!T.call(a,o)&&o!==n&&w(a,o,{get:()=>e[o],enumerable:!(t=$(e,o))||t.enumerable});return a};var Z=a=>Q(w({},"__esModule",{value:!0}),a);var b=(a,e,n)=>new Promise((t,o)=>{var r=p=>{try{c(n.next(p))}catch(u){o(u)}},l=p=>{try{c(n.throw(p))}catch(u){o(u)}},c=p=>p.done?t(p.value):Promise.resolve(p.value).then(r,l);c((n=n.apply(a,e)).next())});var ce={};G(ce,{Maily:()=>v,render:()=>le});module.exports=Z(ce);var k=require("react"),s=require("@react-email/components"),q=require("@react-email/render");var ee=a=>Object.prototype.toString.call(a);var te=a=>ee(a)==="[object Object]";function ne(a){return Object.keys(a)}function N(a,...e){if(!e.length)return a;let n=e.shift();return n===void 0?a:(E(a)&&E(n)&&ne(n).forEach(t=>{t==="__proto__"||t==="constructor"||t==="prototype"||(E(n[t])?(a[t]||(a[t]={}),E(a[t])?N(a[t],n[t]):a[t]=n[t]):a[t]=n[t])}),N(a,...e))}function E(a){return te(a)&&!Array.isArray(a)}var he=Symbol("p-void");function L(){return Math.random().toString(36).substr(2,6)}var i=require("react/jsx-runtime");var ie={sm:"8px",md:"16px",lg:"32px",xl:"64px"},C={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var re={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var D={sm:"40px",md:"48px",lg:"64px"},oe={pretty:!1,plainText:!1},H={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},se='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',ae="#ffffff",v=class{constructor(e={type:"doc",content:[]}){this.config={theme:H};this.variableFormatter=({variable:e,fallback:n})=>n?`{{${e},fallback=${n}}}`:`{{${e}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.content=e}setPreviewText(e){this.config.preview=e}setTheme(e){this.config.theme=N(this.config.theme||H,e)}setVariableFormatter(e){this.variableFormatter=e}setVariableValue(e,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(e,n)}setVariableValues(e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(e).forEach(([n,t])=>{this.setVariableValue(n,t)})}setLinkValue(e,n){this.linkValues.set(e,n)}setLinkValues(e){Object.entries(e).forEach(([n,t])=>{this.setLinkValue(n,t)})}setOpenTrackingPixel(e){this.openTrackingPixel=e}setShouldReplaceVariableValues(e){this.shouldReplaceVariableValues=e}getAllLinks(){let e=this.content.content||[],n=new Set,t=r=>r&&this.isValidUrl(r)&&!r.startsWith("#")&&!r.startsWith("mailto:")&&!r.startsWith("tel:")&&typeof r=="string",o=r=>{var l;if(r.type==="button"){let c=(l=r.attrs)==null?void 0:l.url;t(c)&&c&&n.add(c)}else r.content&&r.content.forEach(c=>{c.marks&&c.marks.forEach(p=>{var m;let u=(m=p.attrs)==null?void 0:m.href;p.type==="link"&&t(u)&&n.add(u)}),c.content&&o(c)})};return e.forEach(r=>{o(r)}),n}isValidUrl(e){try{let n=new URL(e);return!0}catch(n){return!1}}render(){return b(this,arguments,function*(e=oe){let n=this.markup();return(0,q.renderAsync)(n,e)})}markup(){let e=this.content.content||[],n=e.map((r,l)=>{let c={prev:e[l-1],next:e[l+1],parent:r},p=this.renderNode(r,c);return p?(0,i.jsx)(k.Fragment,{children:p},L()):null}),{preview:t}=this.config;return(0,i.jsxs)(s.Html,{children:[(0,i.jsxs)(s.Head,{children:[(0,i.jsx)(s.Font,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),(0,i.jsx)("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}"}}),(0,i.jsx)("meta",{content:"width=device-width",name:"viewport"}),(0,i.jsx)("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),(0,i.jsx)("meta",{name:"x-apple-disable-message-reformatting"}),(0,i.jsx)("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),(0,i.jsx)("meta",{content:"light",name:"color-scheme"}),(0,i.jsx)("meta",{content:"light",name:"supported-color-schemes"})]}),(0,i.jsxs)(s.Body,{style:{margin:0},children:[t?(0,i.jsx)(s.Preview,{id:"__react-email-preview",children:t}):null,(0,i.jsx)(s.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:n}),this.openTrackingPixel?(0,i.jsx)(s.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMarginOverrideConditions(e,n){let{parent:t,prev:o,next:r}=n||{},l=(r==null?void 0:r.type)==="spacer",c=(o==null?void 0:o.type)==="spacer",p=(t==null?void 0:t.type)==="listItem",u=(t==null?void 0:t.type)==="section"&&!r,m=(t==null?void 0:t.type)==="section"&&!o,f=(t==null?void 0:t.type)==="column"&&!r,d=(t==null?void 0:t.type)==="column"&&!o;return{isNextSpacer:l,isPrevSpacer:c,isLastSectionElement:u,isFirstSectionElement:m,isParentListItem:p,isLastColumnElement:f,isFirstColumnElement:d}}getMappedContent(e,n){let t=e.content||[];return t.map((o,r)=>{let l=this.renderNode(o,y(h({},n),{next:t[r+1],prev:t[r-1]}));return l?(0,i.jsx)(k.Fragment,{children:l},L()):null}).filter(o=>o!==null)}renderNode(e,n={}){var o;let t=e.type||"";if(t in this)return(o=this[t])==null?void 0:o.call(this,e,n);throw new Error(`Node type "${t}" is not supported.`)}renderMark(e){let n=e.text||(0,i.jsx)(i.Fragment,{children:"\xA0"});return(e.marks||[]).reduce((o,r)=>{var c;let l=r.type;if(l in this)return(c=this[l])==null?void 0:c.call(this,r,o);throw new Error(`Mark type "${l}" is not supported.`)},(0,i.jsx)(i.Fragment,{children:n}))}paragraph(e,n){var u,m,f,d;let{attrs:t}=e,o=(t==null?void 0:t.textAlign)||"left",{isNextSpacer:r,isLastSectionElement:l,isParentListItem:c,isLastColumnElement:p}=this.getMarginOverrideConditions(e,n);return(0,i.jsx)(s.Text,{style:h({textAlign:o,marginBottom:c||r||l||p?"0px":"20px",marginTop:"0px",fontSize:(m=(u=this.config.theme)==null?void 0:u.fontSize)==null?void 0:m.paragraph,color:(d=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:d.paragraph},C),children:e.content?this.getMappedContent(e):(0,i.jsx)(i.Fragment,{children:"\xA0"})})}text(e,n){let t=e.text||"&nbsp";return e.marks?this.renderMark(e):(0,i.jsx)(i.Fragment,{children:t})}bold(e,n){return(0,i.jsx)("strong",{children:n})}italic(e,n){return(0,i.jsx)("em",{children:n})}underline(e,n){return(0,i.jsx)("u",{children:n})}strike(e,n){return(0,i.jsx)("s",{style:{textDecoration:"line-through"},children:n})}textStyle(e,n){var r,l;let{attrs:t}=e,{color:o=(l=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:l.paragraph}=t||{};return(0,i.jsx)("span",{style:{color:o},children:n})}link(e,n){var c,p;let{attrs:t}=e,o=(t==null?void 0:t.href)||"#",r=(t==null?void 0:t.target)||"_blank",l=(t==null?void 0:t.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(o=this.linkValues.get(o)||this.variableValues.get(o)||o),(0,i.jsx)(s.Link,{href:o,rel:l,style:{fontWeight:500,textDecoration:"underline",color:(p=(c=this.config.theme)==null?void 0:c.colors)==null?void 0:p.heading},target:r,children:n})}heading(e,n){var d,g;let{attrs:t}=e,o=`h${Number(t==null?void 0:t.level)||1}`,r=(t==null?void 0:t.textAlign)||"left",{isNextSpacer:l,isLastSectionElement:c,isLastColumnElement:p}=this.getMarginOverrideConditions(e,n),{fontSize:u,lineHeight:m,fontWeight:f}=re[o];return(0,i.jsx)(s.Heading,{as:o,style:{textAlign:r,color:(g=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:g.heading,marginBottom:l||c||p?"0":"12px",marginTop:0,fontSize:u,lineHeight:m,fontWeight:f},children:this.getMappedContent(e,n)})}variable(e,n){let{id:t,fallback:o}=e.attrs||{},r=this.variableFormatter({variable:t,fallback:o});return this.shouldReplaceVariableValues&&(r=this.variableValues.get(t)||o||r),(0,i.jsx)(i.Fragment,{children:r})}horizontalRule(e,n){return(0,i.jsx)(s.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(e,n){let{isNextSpacer:t,isLastSectionElement:o,isLastColumnElement:r}=this.getMarginOverrideConditions(e,n);return(0,i.jsx)(s.Container,{children:(0,i.jsx)("ol",{style:{marginTop:"0px",marginBottom:t||o||r?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(e)})})}bulletList(e,n){let{parent:t,next:o}=n||{},{isLastSectionElement:r,isNextSpacer:l,isLastColumnElement:c}=this.getMarginOverrideConditions(e,{parent:t,next:o});return(0,i.jsx)(s.Container,{style:{maxWidth:"100%"},children:(0,i.jsx)("ul",{style:{marginTop:"0px",marginBottom:r||l||c?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(e)})})}listItem(e,n){return(0,i.jsx)(s.Container,{style:{maxWidth:"100%"},children:(0,i.jsx)("li",{style:h({marginBottom:"8px",paddingLeft:"6px"},C),children:this.getMappedContent(e,y(h({},n),{parent:e}))})})}button(e,n){let{attrs:t}=e,{text:o,url:r,variant:l,buttonColor:c,textColor:p,borderRadius:u,alignment:m="left"}=t||{},f="0px";u==="round"?f="9999px":u==="smooth"&&(f="6px");let{isNextSpacer:d,isLastSectionElement:g,isLastColumnElement:x}=this.getMarginOverrideConditions(e,n),S=this.linkValues.get(r)||this.variableValues.get(r)||r;return(0,i.jsx)(s.Container,{style:{textAlign:m,maxWidth:"100%",marginBottom:d||g||x?"0px":"20px"},children:(0,i.jsx)(s.Button,{href:S,style:{color:String(p),backgroundColor:l==="filled"?String(c):"transparent",borderColor:String(c),padding:l==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:f},children:o})})}spacer(e,n){let{attrs:t}=e,{height:o="auto"}=t||{};return(0,i.jsx)(s.Container,{style:{height:ie[o]||o}})}hardBreak(e,n){return(0,i.jsx)("br",{})}logo(e,n){let{attrs:t}=e,{src:o,alt:r,title:l,size:c,alignment:p="left"}=t||{},{isNextSpacer:u,isLastSectionElement:m,isLastColumnElement:f}=this.getMarginOverrideConditions(e,n);return(0,i.jsx)(s.Row,{style:{marginTop:"0px",marginBottom:u||m||f?"0px":"32px"},children:(0,i.jsx)(s.Column,{align:p,children:(0,i.jsx)(s.Img,{alt:r||l||"Logo",src:o,style:{width:D[c]||c,height:D[c]||c},title:l||r||"Logo"})})})}image(e,n){let{attrs:t}=e,{src:o,alt:r,title:l,width:c="auto",height:p="auto",alignment:u="center",externalLink:m=""}=t||{},{isNextSpacer:f,isLastSectionElement:d,isLastColumnElement:g}=this.getMarginOverrideConditions(e,n),x=(0,i.jsx)(s.Img,{alt:r||l||"Image",src:o,style:{height:"100%",width:"100%",maxWidth:c,maxHeight:p,outline:"none",border:"none",textDecoration:"none"},title:l||r||"Image"});return(0,i.jsx)(s.Row,{style:{marginTop:"0px",marginBottom:f||d||g?"0px":"32px"},children:(0,i.jsx)(s.Column,{align:u,children:m?(0,i.jsx)("a",{href:m,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:x}):x})})}footer(e,n){var p,u,m,f,d,g,x,S;let{attrs:t}=e,{textAlign:o="left"}=t||{},{isNextSpacer:r,isLastSectionElement:l,isLastColumnElement:c}=this.getMarginOverrideConditions(e,n);return(0,i.jsx)(s.Text,{style:h({fontSize:(m=(u=(p=this.config.theme)==null?void 0:p.fontSize)==null?void 0:u.footer)==null?void 0:m.size,lineHeight:(g=(d=(f=this.config.theme)==null?void 0:f.fontSize)==null?void 0:d.footer)==null?void 0:g.lineHeight,color:(S=(x=this.config.theme)==null?void 0:x.colors)==null?void 0:S.footer,marginTop:"0px",marginBottom:r||l||c?"0px":"20px",textAlign:o},C),children:this.getMappedContent(e)})}blockquote(e,n){var c,p;let{isNextSpacer:t,isPrevSpacer:o,isLastSectionElement:r,isLastColumnElement:l}=this.getMarginOverrideConditions(e,n);return(0,i.jsx)("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(p=(c=this.config.theme)==null?void 0:c.colors)==null?void 0:p.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:o?"0px":"20px",marginBottom:t||r||l?"0px":"20px"},children:this.getMappedContent(e)})}code(e,n){var t,o,r,l;return(0,i.jsx)("code",{style:{backgroundColor:(o=(t=this.config.theme)==null?void 0:t.colors)==null?void 0:o.codeBackground,color:(l=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:l.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:se,fontWeight:400,letterSpacing:0},children:n})}linkCard(e,n){var S,J,M,A,V,_,B,R,P,X,z,F;let{attrs:t}=e,{isNextSpacer:o,isLastSectionElement:r,isLastColumnElement:l}=this.getMarginOverrideConditions(e,n),{title:c,description:p,link:u,linkTitle:m,image:f,badgeText:d,subTitle:g}=t||{},x=this.linkValues.get(u)||this.variableValues.get(u)||u||"#";return(0,i.jsxs)("a",{href:x,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:o||r||l?"0px":"20px"},target:"_blank",children:[f?(0,i.jsx)(s.Row,{style:{marginBottom:"6px"},children:(0,i.jsx)(s.Column,{style:{width:"100%",height:"100%"},children:(0,i.jsx)(s.Img,{alt:c||"Link Card",src:f,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:c||"Link Card"})})}):null,(0,i.jsx)(s.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,i.jsxs)(s.Column,{style:{verticalAlign:"top"},children:[(0,i.jsxs)(s.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,i.jsx)(s.Column,{children:(0,i.jsx)(s.Text,{style:h({fontSize:"18px",fontWeight:600,color:(J=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:J.linkCardTitle,margin:"0px"},C),children:c})}),d||g?(0,i.jsxs)(s.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[d?(0,i.jsx)("span",{style:{fontWeight:600,color:(A=(M=this.config.theme)==null?void 0:M.colors)==null?void 0:A.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(_=(V=this.config.theme)==null?void 0:V.colors)==null?void 0:_.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:d}):null," ",g&&!d?(0,i.jsx)("span",{style:{fontWeight:"normal",color:(R=(B=this.config.theme)==null?void 0:B.colors)==null?void 0:R.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:g}):null]}):null]}),(0,i.jsxs)(s.Text,{style:h({fontSize:"16px",color:(X=(P=this.config.theme)==null?void 0:P.colors)==null?void 0:X.linkCardDescription,marginTop:"0px",marginBottom:"0px"},C),children:[p," ",m?(0,i.jsx)("a",{href:x,rel:"noopener noreferrer",style:{color:(F=(z=this.config.theme)==null?void 0:z.colors)==null?void 0:F.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:m}):null]})]})})]})}section(e,n){let{attrs:t}=e,{borderRadius:o=0,padding:r=0,backgroundColor:l=ae}=t||{};return(0,i.jsx)(s.Container,{style:{backgroundColor:l,borderRadius:o,padding:r},children:this.getMappedContent(e,y(h({},n),{parent:e}))})}columns(e,n){return(0,i.jsx)(s.Row,{children:this.getMappedContent(e,y(h({},n),{parent:e}))})}column(e,n){let{attrs:t}=e,{width:o="50%",verticalAlign:r="top"}=t||{};return(0,i.jsx)(s.Column,{style:{width:o,verticalAlign:r},children:this.getMappedContent(e,y(h({},n),{parent:e}))})}};function le(a,e){return b(this,null,function*(){let l=e||{},{theme:n,preview:t}=l,o=j(l,["theme","preview"]),r=new v(a);return r.setPreviewText(t),r.setTheme(n||{}),r.render(o)})}0&&(module.exports={Maily,render});
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  // @ts-nocheck
2
2
 
3
- var A=Object.defineProperty,F=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var w=(p,e,t)=>e in p?A(p,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):p[e]=t,S=(p,e)=>{for(var t in e||(e={}))E.call(e,t)&&w(p,t,e[t]);if(b)for(var t of b(e))V.call(e,t)&&w(p,t,e[t]);return p},T=(p,e)=>F(p,B(e));var k=(p,e)=>{var t={};for(var n in p)E.call(p,n)&&e.indexOf(n)<0&&(t[n]=p[n]);if(p!=null&&b)for(var n of b(p))e.indexOf(n)<0&&V.call(p,n)&&(t[n]=p[n]);return t};var O=(p,e,t)=>new Promise((n,r)=>{var o=l=>{try{s(t.next(l))}catch(c){r(c)}},a=l=>{try{s(t.throw(l))}catch(c){r(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((t=t.apply(p,e)).next())});import{Fragment as L}from"react";import{Text as M,Html as H,Head as W,Body as P,Font as I,Container as f,Link as D,Heading as q,Hr as U,Button as $,Img as v,Preview as j,Row as R,Column as X}from"@react-email/components";import{render as K,renderAsync as Y}from"@react-email/render";import G from"lodash/merge";function C(){return Math.random().toString(36).substr(2,6)}import{Fragment as y,jsx as i,jsxs as J}from"react/jsx-runtime";var Q={sm:"8px",md:"16px",lg:"32px",xl:"64px"},N={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var Z={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var _={sm:"40px",md:"48px",lg:"64px"},z={pretty:!1,plainText:!1},ee={colors:{heading:"rgb(17, 24, 39)",paragraph:"rgb(55, 65, 81)",horizontal:"rgb(234, 234, 234)",footer:"rgb(100, 116, 139)",blockquoteBorder:"rgb(209, 213, 219)",codeBackground:"rgb(239, 239, 239)",codeText:"rgb(17, 24, 39)"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},te='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',x=class{constructor(e={type:"doc",content:[]}){this.config={theme:ee};this.variableFormatter=({variable:e,fallback:t})=>t?`{{${e},fallback=${t}}}`:`{{${e}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.content=e}setPreviewText(e){this.config.preview=e}setTheme(e){this.config.theme=G(this.config.theme,e)}setVariableFormatter(e){this.variableFormatter=e}setVariableValue(e,t){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(e,t)}setVariableValues(e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(e).forEach(([t,n])=>{this.setVariableValue(t,n)})}setLinkValue(e,t){this.linkValues.set(e,t)}setLinkValues(e){Object.entries(e).forEach(([t,n])=>{this.setLinkValue(t,n)})}setOpenTrackingPixel(e){this.openTrackingPixel=e}setShouldReplaceVariableValues(e){this.shouldReplaceVariableValues=e}getAllLinks(){let e=this.content.content||[],t=new Set,n=o=>o&&this.isValidUrl(o)&&!o.startsWith("#")&&!o.startsWith("mailto:")&&!o.startsWith("tel:")&&typeof o=="string",r=o=>{var a;if(o.type==="button"){let s=(a=o.attrs)==null?void 0:a.url;n(s)&&s&&t.add(s)}else o.content&&o.content.forEach(s=>{s.marks&&s.marks.forEach(l=>{var g;let c=(g=l.attrs)==null?void 0:g.href;l.type==="link"&&n(c)&&t.add(c)}),s.content&&r(s)})};return e.forEach(o=>{r(o)}),t}isValidUrl(e){try{let t=new URL(e);return!0}catch(t){return!1}}renderSync(e=z){let t=this.markup();return K(t,e)}renderAsync(){return O(this,arguments,function*(e=z){let t=this.markup();return Y(t,e)})}markup(){let e=this.content.content||[],t=e.map((o,a)=>{let s={prev:e[a-1],next:e[a+1],parent:o},l=this.renderNode(o,s);return l?i(L,{children:l},C()):null}),{preview:n}=this.config;return J(H,{children:[J(W,{children:[i(I,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),i("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}"}}),i("meta",{content:"width=device-width",name:"viewport"}),i("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),i("meta",{name:"x-apple-disable-message-reformatting"}),i("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),i("meta",{content:"light",name:"color-scheme"}),i("meta",{content:"light",name:"supported-color-schemes"})]}),J(P,{children:[n?i(j,{id:"__react-email-preview",children:n}):null,i(f,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:t}),this.openTrackingPixel?i(v,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMappedContent(e,t){var n;return(n=e.content)==null?void 0:n.map(r=>{let o=this.renderNode(r,t);return o?i(L,{children:o},C()):null}).filter(r=>r!==null)}renderNode(e,t={}){var r;let n=e.type||"";if(n in this)return(r=this[n])==null?void 0:r.call(this,e,t);throw new Error(`Node type "${n}" is not supported.`)}renderMark(e){let t=e.text||i(y,{children:"\xA0"});return(e.marks||[]).reduce((r,o)=>{var s;let a=o.type;if(a in this)return(s=this[a])==null?void 0:s.call(this,o,r);throw new Error(`Mark type "${a}" is not supported.`)},i(y,{children:t}))}paragraph(e,t){var c,g,m,d;let{attrs:n}=e,r=(n==null?void 0:n.textAlign)||"left",{parent:o,next:a}=t||{},s=(o==null?void 0:o.type)==="listItem",l=(a==null?void 0:a.type)==="spacer";return i(M,{style:S({textAlign:r,marginBottom:s||l?"0px":"20px",marginTop:"0px",fontSize:(g=(c=this.config.theme)==null?void 0:c.fontSize)==null?void 0:g.paragraph,color:(d=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:d.paragraph},N),children:e.content?this.getMappedContent(e):i(y,{children:"\xA0"})})}text(e,t){let n=e.text||"&nbsp";return e.marks?this.renderMark(e):i(y,{children:n})}bold(e,t){return i("strong",{children:t})}italic(e,t){return i("em",{children:t})}underline(e,t){return i("u",{children:t})}strike(e,t){return i("s",{style:{textDecoration:"line-through"},children:t})}link(e,t){var s,l;let{attrs:n}=e,r=(n==null?void 0:n.href)||"#",o=(n==null?void 0:n.target)||"_blank",a=(n==null?void 0:n.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(r=this.linkValues.get(r)||this.variableValues.get(r)||r),i(D,{href:r,rel:a,style:{fontWeight:500,textDecoration:"underline",color:(l=(s=this.config.theme)==null?void 0:s.colors)==null?void 0:l.heading},target:o,children:t})}heading(e,t){var h,u;let{attrs:n}=e,{next:r,prev:o}=t||{},a=`h${Number(n==null?void 0:n.level)||1}`,s=(n==null?void 0:n.textAlign)||"left",l=(r==null?void 0:r.type)==="spacer",c=(o==null?void 0:o.type)==="spacer",{fontSize:g,lineHeight:m,fontWeight:d}=Z[a];return i(q,{as:a,style:{textAlign:s,color:(u=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:u.heading,marginBottom:l?"0px":"12px",marginTop:"0px",fontSize:g,lineHeight:m,fontWeight:d},children:this.getMappedContent(e)})}variable(e,t){let{id:n,fallback:r}=e.attrs||{},o=this.variableFormatter({variable:n,fallback:r});return this.shouldReplaceVariableValues&&(o=this.variableValues.get(n)||r||o),i(y,{children:o})}horizontalRule(e,t){return i(U,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(e,t){return i(f,{children:i("ol",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(e)})})}bulletList(e,t){return i(f,{style:{maxWidth:"100%"},children:i("ul",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(e)})})}listItem(e,t){return i(f,{style:{maxWidth:"100%"},children:i("li",{style:S({marginBottom:"8px",paddingLeft:"6px"},N),children:this.getMappedContent(e,T(S({},t),{parent:e}))})})}button(e,t){let{attrs:n}=e,{text:r,url:o,variant:a,buttonColor:s,textColor:l,borderRadius:c,alignment:g="left"}=n||{},m="0px";c==="round"?m="9999px":c==="smooth"&&(m="6px");let{next:d}=t||{},h=(d==null?void 0:d.type)==="spacer",u=this.linkValues.get(o)||this.variableValues.get(o)||o;return i(f,{style:{textAlign:g,maxWidth:"100%",marginBottom:h?"0px":"20px"},children:i($,{href:u,style:{color:String(l),backgroundColor:a==="filled"?String(s):"transparent",borderColor:String(s),padding:a==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:m},children:r})})}spacer(e,t){let{attrs:n}=e,{height:r="auto"}=n||{};return i(f,{style:{height:Q[r]||r}})}hardBreak(e,t){return i("br",{})}logo(e,t){let{attrs:n}=e,{src:r,alt:o,title:a,size:s,alignment:l="left"}=n||{},{next:c}=t||{},g=(c==null?void 0:c.type)==="spacer";return i(R,{style:{marginTop:"0px",marginBottom:g?"0px":"32px"},children:i(X,{align:l,children:i(v,{alt:o||a||"Logo",src:r,style:{width:_[s]||s,height:_[s]||s},title:a||o||"Logo"})})})}image(e,t){let{attrs:n}=e,{src:r,alt:o,title:a,width:s="auto",height:l="auto",alignment:c="center",externalLink:g=""}=n||{},{next:m}=t||{},d=(m==null?void 0:m.type)==="spacer",h=i(v,{alt:o||a||"Image",src:r,style:{height:l,width:s,maxWidth:"100%",outline:"none",border:"none",textDecoration:"none"},title:a||o||"Image"});return i(R,{style:{marginTop:"0px",marginBottom:d?"0px":"32px"},children:i(X,{align:c,children:g?i("a",{href:g,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:h}):h})})}footer(e,t){var s,l,c,g,m,d,h,u;let{attrs:n}=e,{textAlign:r="left"}=n||{},{next:o}=t||{},a=(o==null?void 0:o.type)==="spacer";return i(M,{style:S({fontSize:(c=(l=(s=this.config.theme)==null?void 0:s.fontSize)==null?void 0:l.footer)==null?void 0:c.size,lineHeight:(d=(m=(g=this.config.theme)==null?void 0:g.fontSize)==null?void 0:m.footer)==null?void 0:d.lineHeight,color:(u=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:u.footer,marginTop:"0px",marginBottom:a?"0px":"20px",textAlign:r},N),children:this.getMappedContent(e)})}blockquote(e,t){var s,l;let{next:n,prev:r}=t||{},o=(n==null?void 0:n.type)==="spacer",a=(r==null?void 0:r.type)==="spacer";return i("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(l=(s=this.config.theme)==null?void 0:s.colors)==null?void 0:l.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:a?"0px":"20px",marginBottom:o?"0px":"20px"},children:this.getMappedContent(e)})}code(e,t){var n,r,o,a;return i("code",{style:{backgroundColor:(r=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:r.codeBackground,color:(a=(o=this.config.theme)==null?void 0:o.colors)==null?void 0:a.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:te,fontWeight:400,letterSpacing:0},children:t})}};function de(p,e){let a=e||{},{theme:t,preview:n}=a,r=k(a,["theme","preview"]),o=new x(p);return o.setPreviewText(n),o.setTheme(t),o.renderSync(r)}function xe(p,e){return O(this,null,function*(){let a=e||{},{theme:t,preview:n}=a,r=k(a,["theme","preview"]),o=new x(p);return o.setPreviewText(n),o.setTheme(t),o.renderAsync(r)})}export{x as Maily,xe as renderAsync,de as renderSync};
3
+ var G=Object.defineProperty,Q=Object.defineProperties;var Z=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var D=(l,e,n)=>e in l?G(l,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):l[e]=n,g=(l,e)=>{for(var n in e||(e={}))H.call(e,n)&&D(l,n,e[n]);if(N)for(var n of N(e))q.call(e,n)&&D(l,n,e[n]);return l},C=(l,e)=>Q(l,Z(e));var U=(l,e)=>{var n={};for(var t in l)H.call(l,t)&&e.indexOf(t)<0&&(n[t]=l[t]);if(l!=null&&N)for(var t of N(l))e.indexOf(t)<0&&q.call(l,t)&&(n[t]=l[t]);return n};var O=(l,e,n)=>new Promise((t,r)=>{var i=c=>{try{a(n.next(c))}catch(p){r(p)}},s=c=>{try{a(n.throw(c))}catch(p){r(p)}},a=c=>c.done?t(c.value):Promise.resolve(c.value).then(i,s);a((n=n.apply(l,e)).next())});import{Fragment as $}from"react";import{Text as k,Html as ie,Head as re,Body as oe,Font as se,Container as y,Link as ae,Heading as le,Hr as ce,Button as pe,Img as J,Preview as ue,Row as v,Column as b}from"@react-email/components";import{renderAsync as me}from"@react-email/render";var ee=l=>Object.prototype.toString.call(l);var te=l=>ee(l)==="[object Object]";function ne(l){return Object.keys(l)}function L(l,...e){if(!e.length)return l;let n=e.shift();return n===void 0?l:(T(l)&&T(n)&&ne(n).forEach(t=>{t==="__proto__"||t==="constructor"||t==="prototype"||(T(n[t])?(l[t]||(l[t]={}),T(l[t])?L(l[t],n[t]):l[t]=n[t]):l[t]=n[t])}),L(l,...e))}function T(l){return te(l)&&!Array.isArray(l)}var we=Symbol("p-void");function A(){return Math.random().toString(36).substr(2,6)}import{Fragment as E,jsx as o,jsxs as x}from"react/jsx-runtime";var fe={sm:"8px",md:"16px",lg:"32px",xl:"64px"},w={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var de={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var K={sm:"40px",md:"48px",lg:"64px"},ge={pretty:!1,plainText:!1},Y={colors:{heading:"#111827",paragraph:"#374151",horizontal:"#EAEAEA",footer:"#64748B",blockquoteBorder:"#D1D5DB",codeBackground:"#EFEFEF",codeText:"#111827",linkCardTitle:"#111827",linkCardDescription:"#6B7280",linkCardBadgeText:"#111827",linkCardBadgeBackground:"#FEF08A",linkCardSubTitle:"#6B7280"},fontSize:{paragraph:"15px",footer:{size:"14px",lineHeight:"24px"}}},he='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',xe="#ffffff",M=class{constructor(e={type:"doc",content:[]}){this.config={theme:Y};this.variableFormatter=({variable:e,fallback:n})=>n?`{{${e},fallback=${n}}}`:`{{${e}}}`;this.shouldReplaceVariableValues=!1;this.variableValues=new Map;this.linkValues=new Map;this.content=e}setPreviewText(e){this.config.preview=e}setTheme(e){this.config.theme=L(this.config.theme||Y,e)}setVariableFormatter(e){this.variableFormatter=e}setVariableValue(e,n){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),this.variableValues.set(e,n)}setVariableValues(e){this.shouldReplaceVariableValues||(this.shouldReplaceVariableValues=!0),Object.entries(e).forEach(([n,t])=>{this.setVariableValue(n,t)})}setLinkValue(e,n){this.linkValues.set(e,n)}setLinkValues(e){Object.entries(e).forEach(([n,t])=>{this.setLinkValue(n,t)})}setOpenTrackingPixel(e){this.openTrackingPixel=e}setShouldReplaceVariableValues(e){this.shouldReplaceVariableValues=e}getAllLinks(){let e=this.content.content||[],n=new Set,t=i=>i&&this.isValidUrl(i)&&!i.startsWith("#")&&!i.startsWith("mailto:")&&!i.startsWith("tel:")&&typeof i=="string",r=i=>{var s;if(i.type==="button"){let a=(s=i.attrs)==null?void 0:s.url;t(a)&&a&&n.add(a)}else i.content&&i.content.forEach(a=>{a.marks&&a.marks.forEach(c=>{var u;let p=(u=c.attrs)==null?void 0:u.href;c.type==="link"&&t(p)&&n.add(p)}),a.content&&r(a)})};return e.forEach(i=>{r(i)}),n}isValidUrl(e){try{let n=new URL(e);return!0}catch(n){return!1}}render(){return O(this,arguments,function*(e=ge){let n=this.markup();return me(n,e)})}markup(){let e=this.content.content||[],n=e.map((i,s)=>{let a={prev:e[s-1],next:e[s+1],parent:i},c=this.renderNode(i,a);return c?o($,{children:c},A()):null}),{preview:t}=this.config;return x(ie,{children:[x(re,{children:[o(se,{fallbackFontFamily:"sans-serif",fontFamily:"Inter",fontStyle:"normal",fontWeight:400,webFont:{url:"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19",format:"woff2"}}),o("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}"}}),o("meta",{content:"width=device-width",name:"viewport"}),o("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),o("meta",{name:"x-apple-disable-message-reformatting"}),o("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),o("meta",{content:"light",name:"color-scheme"}),o("meta",{content:"light",name:"supported-color-schemes"})]}),x(oe,{style:{margin:0},children:[t?o(ue,{id:"__react-email-preview",children:t}):null,o(y,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:n}),this.openTrackingPixel?o(J,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMarginOverrideConditions(e,n){let{parent:t,prev:r,next:i}=n||{},s=(i==null?void 0:i.type)==="spacer",a=(r==null?void 0:r.type)==="spacer",c=(t==null?void 0:t.type)==="listItem",p=(t==null?void 0:t.type)==="section"&&!i,u=(t==null?void 0:t.type)==="section"&&!r,m=(t==null?void 0:t.type)==="column"&&!i,f=(t==null?void 0:t.type)==="column"&&!r;return{isNextSpacer:s,isPrevSpacer:a,isLastSectionElement:p,isFirstSectionElement:u,isParentListItem:c,isLastColumnElement:m,isFirstColumnElement:f}}getMappedContent(e,n){let t=e.content||[];return t.map((r,i)=>{let s=this.renderNode(r,C(g({},n),{next:t[i+1],prev:t[i-1]}));return s?o($,{children:s},A()):null}).filter(r=>r!==null)}renderNode(e,n={}){var r;let t=e.type||"";if(t in this)return(r=this[t])==null?void 0:r.call(this,e,n);throw new Error(`Node type "${t}" is not supported.`)}renderMark(e){let n=e.text||o(E,{children:"\xA0"});return(e.marks||[]).reduce((r,i)=>{var a;let s=i.type;if(s in this)return(a=this[s])==null?void 0:a.call(this,i,r);throw new Error(`Mark type "${s}" is not supported.`)},o(E,{children:n}))}paragraph(e,n){var p,u,m,f;let{attrs:t}=e,r=(t==null?void 0:t.textAlign)||"left",{isNextSpacer:i,isLastSectionElement:s,isParentListItem:a,isLastColumnElement:c}=this.getMarginOverrideConditions(e,n);return o(k,{style:g({textAlign:r,marginBottom:a||i||s||c?"0px":"20px",marginTop:"0px",fontSize:(u=(p=this.config.theme)==null?void 0:p.fontSize)==null?void 0:u.paragraph,color:(f=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:f.paragraph},w),children:e.content?this.getMappedContent(e):o(E,{children:"\xA0"})})}text(e,n){let t=e.text||"&nbsp";return e.marks?this.renderMark(e):o(E,{children:t})}bold(e,n){return o("strong",{children:n})}italic(e,n){return o("em",{children:n})}underline(e,n){return o("u",{children:n})}strike(e,n){return o("s",{style:{textDecoration:"line-through"},children:n})}textStyle(e,n){var i,s;let{attrs:t}=e,{color:r=(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.paragraph}=t||{};return o("span",{style:{color:r},children:n})}link(e,n){var a,c;let{attrs:t}=e,r=(t==null?void 0:t.href)||"#",i=(t==null?void 0:t.target)||"_blank",s=(t==null?void 0:t.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(r=this.linkValues.get(r)||this.variableValues.get(r)||r),o(ae,{href:r,rel:s,style:{fontWeight:500,textDecoration:"underline",color:(c=(a=this.config.theme)==null?void 0:a.colors)==null?void 0:c.heading},target:i,children:n})}heading(e,n){var f,d;let{attrs:t}=e,r=`h${Number(t==null?void 0:t.level)||1}`,i=(t==null?void 0:t.textAlign)||"left",{isNextSpacer:s,isLastSectionElement:a,isLastColumnElement:c}=this.getMarginOverrideConditions(e,n),{fontSize:p,lineHeight:u,fontWeight:m}=de[r];return o(le,{as:r,style:{textAlign:i,color:(d=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:d.heading,marginBottom:s||a||c?"0":"12px",marginTop:0,fontSize:p,lineHeight:u,fontWeight:m},children:this.getMappedContent(e,n)})}variable(e,n){let{id:t,fallback:r}=e.attrs||{},i=this.variableFormatter({variable:t,fallback:r});return this.shouldReplaceVariableValues&&(i=this.variableValues.get(t)||r||i),o(E,{children:i})}horizontalRule(e,n){return o(ce,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(e,n){let{isNextSpacer:t,isLastSectionElement:r,isLastColumnElement:i}=this.getMarginOverrideConditions(e,n);return o(y,{children:o("ol",{style:{marginTop:"0px",marginBottom:t||r||i?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(e)})})}bulletList(e,n){let{parent:t,next:r}=n||{},{isLastSectionElement:i,isNextSpacer:s,isLastColumnElement:a}=this.getMarginOverrideConditions(e,{parent:t,next:r});return o(y,{style:{maxWidth:"100%"},children:o("ul",{style:{marginTop:"0px",marginBottom:i||s||a?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(e)})})}listItem(e,n){return o(y,{style:{maxWidth:"100%"},children:o("li",{style:g({marginBottom:"8px",paddingLeft:"6px"},w),children:this.getMappedContent(e,C(g({},n),{parent:e}))})})}button(e,n){let{attrs:t}=e,{text:r,url:i,variant:s,buttonColor:a,textColor:c,borderRadius:p,alignment:u="left"}=t||{},m="0px";p==="round"?m="9999px":p==="smooth"&&(m="6px");let{isNextSpacer:f,isLastSectionElement:d,isLastColumnElement:h}=this.getMarginOverrideConditions(e,n),S=this.linkValues.get(i)||this.variableValues.get(i)||i;return o(y,{style:{textAlign:u,maxWidth:"100%",marginBottom:f||d||h?"0px":"20px"},children:o(pe,{href:S,style:{color:String(c),backgroundColor:s==="filled"?String(a):"transparent",borderColor:String(a),padding:s==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:m},children:r})})}spacer(e,n){let{attrs:t}=e,{height:r="auto"}=t||{};return o(y,{style:{height:fe[r]||r}})}hardBreak(e,n){return o("br",{})}logo(e,n){let{attrs:t}=e,{src:r,alt:i,title:s,size:a,alignment:c="left"}=t||{},{isNextSpacer:p,isLastSectionElement:u,isLastColumnElement:m}=this.getMarginOverrideConditions(e,n);return o(v,{style:{marginTop:"0px",marginBottom:p||u||m?"0px":"32px"},children:o(b,{align:c,children:o(J,{alt:i||s||"Logo",src:r,style:{width:K[a]||a,height:K[a]||a},title:s||i||"Logo"})})})}image(e,n){let{attrs:t}=e,{src:r,alt:i,title:s,width:a="auto",height:c="auto",alignment:p="center",externalLink:u=""}=t||{},{isNextSpacer:m,isLastSectionElement:f,isLastColumnElement:d}=this.getMarginOverrideConditions(e,n),h=o(J,{alt:i||s||"Image",src:r,style:{height:"100%",width:"100%",maxWidth:a,maxHeight:c,outline:"none",border:"none",textDecoration:"none"},title:s||i||"Image"});return o(v,{style:{marginTop:"0px",marginBottom:m||f||d?"0px":"32px"},children:o(b,{align:p,children:u?o("a",{href:u,rel:"noopener noreferrer",style:{display:"block",maxWidth:"100%",textDecoration:"none"},target:"_blank",children:h}):h})})}footer(e,n){var c,p,u,m,f,d,h,S;let{attrs:t}=e,{textAlign:r="left"}=t||{},{isNextSpacer:i,isLastSectionElement:s,isLastColumnElement:a}=this.getMarginOverrideConditions(e,n);return o(k,{style:g({fontSize:(u=(p=(c=this.config.theme)==null?void 0:c.fontSize)==null?void 0:p.footer)==null?void 0:u.size,lineHeight:(d=(f=(m=this.config.theme)==null?void 0:m.fontSize)==null?void 0:f.footer)==null?void 0:d.lineHeight,color:(S=(h=this.config.theme)==null?void 0:h.colors)==null?void 0:S.footer,marginTop:"0px",marginBottom:i||s||a?"0px":"20px",textAlign:r},w),children:this.getMappedContent(e)})}blockquote(e,n){var a,c;let{isNextSpacer:t,isPrevSpacer:r,isLastSectionElement:i,isLastColumnElement:s}=this.getMarginOverrideConditions(e,n);return o("blockquote",{style:{borderLeftWidth:"4px",borderLeftStyle:"solid",borderLeftColor:(c=(a=this.config.theme)==null?void 0:a.colors)==null?void 0:c.blockquoteBorder,paddingLeft:"16px",marginLeft:"0px",marginRight:"0px",marginTop:r?"0px":"20px",marginBottom:t||i||s?"0px":"20px"},children:this.getMappedContent(e)})}code(e,n){var t,r,i,s;return o("code",{style:{backgroundColor:(r=(t=this.config.theme)==null?void 0:t.colors)==null?void 0:r.codeBackground,color:(s=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:s.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:he,fontWeight:400,letterSpacing:0},children:n})}linkCard(e,n){var S,V,_,B,R,P,X,z,F,W,I,j;let{attrs:t}=e,{isNextSpacer:r,isLastSectionElement:i,isLastColumnElement:s}=this.getMarginOverrideConditions(e,n),{title:a,description:c,link:p,linkTitle:u,image:m,badgeText:f,subTitle:d}=t||{},h=this.linkValues.get(p)||this.variableValues.get(p)||p||"#";return x("a",{href:h,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:r||i||s?"0px":"20px"},target:"_blank",children:[m?o(v,{style:{marginBottom:"6px"},children:o(b,{style:{width:"100%",height:"100%"},children:o(J,{alt:a||"Link Card",src:m,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:a||"Link Card"})})}):null,o(v,{style:{padding:"15px",marginTop:0,marginBottom:0},children:x(b,{style:{verticalAlign:"top"},children:[x(v,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[o(b,{children:o(k,{style:g({fontSize:"18px",fontWeight:600,color:(V=(S=this.config.theme)==null?void 0:S.colors)==null?void 0:V.linkCardTitle,margin:"0px"},w),children:a})}),f||d?x(b,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[f?o("span",{style:{fontWeight:600,color:(B=(_=this.config.theme)==null?void 0:_.colors)==null?void 0:B.linkCardBadgeText,padding:"4px 8px",borderRadius:"8px",backgroundColor:(P=(R=this.config.theme)==null?void 0:R.colors)==null?void 0:P.linkCardBadgeBackground,fontSize:"12px",lineHeight:"12px"},children:f}):null," ",d&&!f?o("span",{style:{fontWeight:"normal",color:(z=(X=this.config.theme)==null?void 0:X.colors)==null?void 0:z.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:d}):null]}):null]}),x(k,{style:g({fontSize:"16px",color:(W=(F=this.config.theme)==null?void 0:F.colors)==null?void 0:W.linkCardDescription,marginTop:"0px",marginBottom:"0px"},w),children:[c," ",u?o("a",{href:h,rel:"noopener noreferrer",style:{color:(j=(I=this.config.theme)==null?void 0:I.colors)==null?void 0:j.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:u}):null]})]})})]})}section(e,n){let{attrs:t}=e,{borderRadius:r=0,padding:i=0,backgroundColor:s=xe}=t||{};return o(y,{style:{backgroundColor:s,borderRadius:r,padding:i},children:this.getMappedContent(e,C(g({},n),{parent:e}))})}columns(e,n){return o(v,{children:this.getMappedContent(e,C(g({},n),{parent:e}))})}column(e,n){let{attrs:t}=e,{width:r="50%",verticalAlign:i="top"}=t||{};return o(b,{style:{width:r,verticalAlign:i},children:this.getMappedContent(e,C(g({},n),{parent:e}))})}};function Pe(l,e){return O(this,null,function*(){let s=e||{},{theme:n,preview:t}=s,r=U(s,["theme","preview"]),i=new M(l);return i.setPreviewText(t),i.setTheme(n||{}),i.render(r)})}export{M as Maily,Pe as render};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/render",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "private": false,
5
5
  "description": "A transformer that converts Maily content into HTML email templates.",
6
6
  "sideEffects": false,
@@ -47,21 +47,21 @@
47
47
  "node": ">=18.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@babel/preset-react": "^7.23.3",
51
- "@tiptap/core": "^2.1.13",
52
- "@types/lodash": "^4.14.202",
53
- "@types/react": "^18.2.42",
50
+ "@antfu/utils": "^0.7.10",
51
+ "@babel/preset-react": "^7.24.7",
52
+ "@tiptap/core": "^2.6.6",
53
+ "@types/lodash": "^4.17.7",
54
+ "@types/react": "^18.3.5",
54
55
  "eslint-config-custom": "workspace:*",
55
56
  "tsconfig": "workspace:*",
56
- "typescript": "^5.3.3"
57
+ "typescript": "^5.5.4"
57
58
  },
58
59
  "dependencies": {
59
- "@react-email/components": "^0.0.11",
60
- "@react-email/render": "^0.0.9",
61
- "lodash": "^4.17.21"
60
+ "@react-email/components": "^0.0.25",
61
+ "@react-email/render": "^1.0.1"
62
62
  },
63
63
  "peerDependencies": {
64
- "react": "18.2.0"
64
+ "react": "^18.3.1"
65
65
  },
66
66
  "publishConfig": {
67
67
  "access": "public"