@maily-to/render 0.0.11 → 0.0.12

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
@@ -82,6 +82,8 @@ interface MailyConfig {
82
82
  */
83
83
  theme?: Partial<ThemeOptions>;
84
84
  }
85
+ declare const DEFAULT_COLUMNS_WIDTH = "100%";
86
+ declare const DEFAULT_COLUMNS_ALIGN = "left";
85
87
  interface RenderOptions {
86
88
  /**
87
89
  * The options object allows you to customize the output of the rendered
@@ -195,4 +197,4 @@ declare class Maily {
195
197
 
196
198
  declare function render(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
197
199
 
198
- export { type AllowedSpacers, type LinkValues, Maily, type MailyConfig, type MarkType, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
200
+ export { type AllowedSpacers, DEFAULT_COLUMNS_ALIGN, DEFAULT_COLUMNS_WIDTH, type LinkValues, Maily, type MailyConfig, type MarkType, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
package/dist/index.d.ts CHANGED
@@ -82,6 +82,8 @@ interface MailyConfig {
82
82
  */
83
83
  theme?: Partial<ThemeOptions>;
84
84
  }
85
+ declare const DEFAULT_COLUMNS_WIDTH = "100%";
86
+ declare const DEFAULT_COLUMNS_ALIGN = "left";
85
87
  interface RenderOptions {
86
88
  /**
87
89
  * The options object allows you to customize the output of the rendered
@@ -195,4 +197,4 @@ declare class Maily {
195
197
 
196
198
  declare function render(content: JSONContent, config?: MailyConfig & RenderOptions): Promise<string>;
197
199
 
198
- export { type AllowedSpacers, type LinkValues, Maily, type MailyConfig, type MarkType, type RenderOptions, type ThemeOptions, type VariableFormatter, type VariableValues, render };
200
+ export { type AllowedSpacers, DEFAULT_COLUMNS_ALIGN, DEFAULT_COLUMNS_WIDTH, 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 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});
3
+ "use strict";var w=Object.defineProperty,K=Object.defineProperties,Y=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var I=(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)&&I(a,n,e[n]);if(O)for(var n of O(e))W.call(e,n)&&I(a,n,e[n]);return a},y=(a,e)=>K(a,G(e));var D=(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&&W.call(a,t)&&(n[t]=a[t]);return n};var Z=(a,e)=>{for(var n in e)w(a,n,{get:e[n],enumerable:!0})},ee=(a,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Q(e))!T.call(a,o)&&o!==n&&w(a,o,{get:()=>e[o],enumerable:!(t=Y(e,o))||t.enumerable});return a};var te=a=>ee(w({},"__esModule",{value:!0}),a);var b=(a,e,n)=>new Promise((t,o)=>{var i=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(i,l);c((n=n.apply(a,e)).next())});var ue={};Z(ue,{DEFAULT_COLUMNS_ALIGN:()=>$,DEFAULT_COLUMNS_WIDTH:()=>U,Maily:()=>v,render:()=>pe});module.exports=te(ue);var k=require("react"),s=require("@react-email/components"),q=require("@react-email/render");var ne=a=>Object.prototype.toString.call(a);var ie=a=>ne(a)==="[object Object]";function re(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)&&re(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 ie(a)&&!Array.isArray(a)}var Se=Symbol("p-void");function L(){return Math.random().toString(36).substr(2,6)}var r=require("react/jsx-runtime");var oe={sm:"8px",md:"16px",lg:"32px",xl:"64px"},C={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var se={h1:{fontSize:"36px",lineHeight:"40px",fontWeight:800},h2:{fontSize:"30px",lineHeight:"36px",fontWeight:700},h3:{fontSize:"24px",lineHeight:"38px",fontWeight:600}};var j={sm:"40px",md:"48px",lg:"64px"},ae={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"}}},le='SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',ce="#ffffff",U="100%",$="left",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=i=>i&&this.isValidUrl(i)&&!i.startsWith("#")&&!i.startsWith("mailto:")&&!i.startsWith("tel:")&&typeof i=="string",o=i=>{var l;if(i.type==="button"){let c=(l=i.attrs)==null?void 0:l.url;t(c)&&c&&n.add(c)}else i.content&&i.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(i=>{o(i)}),n}isValidUrl(e){try{let n=new URL(e);return!0}catch(n){return!1}}render(){return b(this,arguments,function*(e=ae){let n=this.markup();return(0,q.renderAsync)(n,e)})}markup(){let e=this.content.content||[],n=e.map((i,l)=>{let c={prev:e[l-1],next:e[l+1],parent:i},p=this.renderNode(i,c);return p?(0,r.jsx)(k.Fragment,{children:p},L()):null}),{preview:t}=this.config;return(0,r.jsxs)(s.Html,{children:[(0,r.jsxs)(s.Head,{children:[(0,r.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,r.jsx)("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}"}}),(0,r.jsx)("meta",{content:"width=device-width",name:"viewport"}),(0,r.jsx)("meta",{content:"IE=edge",httpEquiv:"X-UA-Compatible"}),(0,r.jsx)("meta",{name:"x-apple-disable-message-reformatting"}),(0,r.jsx)("meta",{content:"telephone=no,address=no,email=no,date=no,url=no",name:"format-detection"}),(0,r.jsx)("meta",{content:"light",name:"color-scheme"}),(0,r.jsx)("meta",{content:"light",name:"supported-color-schemes"})]}),(0,r.jsxs)(s.Body,{style:{margin:0},children:[t?(0,r.jsx)(s.Preview,{id:"__react-email-preview",children:t}):null,(0,r.jsx)(s.Container,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:n}),this.openTrackingPixel?(0,r.jsx)(s.Img,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMarginOverrideConditions(e,n){let{parent:t,prev:o,next:i}=n||{},l=(i==null?void 0:i.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"&&!i,m=(t==null?void 0:t.type)==="section"&&!o,d=(t==null?void 0:t.type)==="column"&&!i,f=(t==null?void 0:t.type)==="column"&&!o;return{isNextSpacer:l,isPrevSpacer:c,isLastSectionElement:u,isFirstSectionElement:m,isParentListItem:p,isLastColumnElement:d,isFirstColumnElement:f}}getMappedContent(e,n){let t=e.content||[];return t.map((o,i)=>{let l=this.renderNode(o,y(h({},n),{next:t[i+1],prev:t[i-1]}));return l?(0,r.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,r.jsx)(r.Fragment,{children:"\xA0"});return(e.marks||[]).reduce((o,i)=>{var c;let l=i.type;if(l in this)return(c=this[l])==null?void 0:c.call(this,i,o);throw new Error(`Mark type "${l}" is not supported.`)},(0,r.jsx)(r.Fragment,{children:n}))}paragraph(e,n){var u,m,d,f;let{attrs:t}=e,o=(t==null?void 0:t.textAlign)||"left",{isNextSpacer:i,isLastSectionElement:l,isParentListItem:c,isLastColumnElement:p}=this.getMarginOverrideConditions(e,n);return(0,r.jsx)(s.Text,{style:h({textAlign:o,marginBottom:c||i||l||p?"0px":"20px",marginTop:"0px",fontSize:(m=(u=this.config.theme)==null?void 0:u.fontSize)==null?void 0:m.paragraph,color:(f=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:f.paragraph},C),children:e.content?this.getMappedContent(e):(0,r.jsx)(r.Fragment,{children:"\xA0"})})}text(e,n){let t=e.text||"&nbsp";return e.marks?this.renderMark(e):(0,r.jsx)(r.Fragment,{children:t})}bold(e,n){return(0,r.jsx)("strong",{children:n})}italic(e,n){return(0,r.jsx)("em",{children:n})}underline(e,n){return(0,r.jsx)("u",{children:n})}strike(e,n){return(0,r.jsx)("s",{style:{textDecoration:"line-through"},children:n})}textStyle(e,n){var i,l;let{attrs:t}=e,{color:o=(l=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:l.paragraph}=t||{};return(0,r.jsx)("span",{style:{color:o},children:n})}link(e,n){var c,p;let{attrs:t}=e,o=(t==null?void 0:t.href)||"#",i=(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,r.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:i,children:n})}heading(e,n){var f,g;let{attrs:t}=e,o=`h${Number(t==null?void 0:t.level)||1}`,i=(t==null?void 0:t.textAlign)||"left",{isNextSpacer:l,isLastSectionElement:c,isLastColumnElement:p}=this.getMarginOverrideConditions(e,n),{fontSize:u,lineHeight:m,fontWeight:d}=se[o];return(0,r.jsx)(s.Heading,{as:o,style:{textAlign:i,color:(g=(f=this.config.theme)==null?void 0:f.colors)==null?void 0:g.heading,marginBottom:l||c||p?"0":"12px",marginTop:0,fontSize:u,lineHeight:m,fontWeight:d},children:this.getMappedContent(e,n)})}variable(e,n){let{id:t,fallback:o}=e.attrs||{},i=this.variableFormatter({variable:t,fallback:o});return this.shouldReplaceVariableValues&&(i=this.variableValues.get(t)||o||i),(0,r.jsx)(r.Fragment,{children:i})}horizontalRule(e,n){return(0,r.jsx)(s.Hr,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(e,n){let{isNextSpacer:t,isLastSectionElement:o,isLastColumnElement:i}=this.getMarginOverrideConditions(e,n);return(0,r.jsx)(s.Container,{children:(0,r.jsx)("ol",{style:{marginTop:"0px",marginBottom:t||o||i?"0":"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(e)})})}bulletList(e,n){let{parent:t,next:o}=n||{},{isLastSectionElement:i,isNextSpacer:l,isLastColumnElement:c}=this.getMarginOverrideConditions(e,{parent:t,next:o});return(0,r.jsx)(s.Container,{style:{maxWidth:"100%"},children:(0,r.jsx)("ul",{style:{marginTop:"0px",marginBottom:i||l||c?"0":"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(e)})})}listItem(e,n){return(0,r.jsx)(s.Container,{style:{maxWidth:"100%"},children:(0,r.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:i,variant:l,buttonColor:c,textColor:p,borderRadius:u,alignment:m="left"}=t||{},d="0px";u==="round"?d="9999px":u==="smooth"&&(d="6px");let{isNextSpacer:f,isLastSectionElement:g,isLastColumnElement:x}=this.getMarginOverrideConditions(e,n),S=this.linkValues.get(i)||this.variableValues.get(i)||i;return(0,r.jsx)(s.Container,{style:{textAlign:m,maxWidth:"100%",marginBottom:f||g||x?"0px":"20px"},children:(0,r.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:d},children:o})})}spacer(e,n){let{attrs:t}=e,{height:o="auto"}=t||{};return(0,r.jsx)(s.Container,{style:{height:oe[o]||o}})}hardBreak(e,n){return(0,r.jsx)("br",{})}logo(e,n){let{attrs:t}=e,{src:o,alt:i,title:l,size:c,alignment:p="left"}=t||{},{isNextSpacer:u,isLastSectionElement:m,isLastColumnElement:d}=this.getMarginOverrideConditions(e,n);return(0,r.jsx)(s.Row,{style:{marginTop:"0px",marginBottom:u||m||d?"0px":"32px"},children:(0,r.jsx)(s.Column,{align:p,children:(0,r.jsx)(s.Img,{alt:i||l||"Logo",src:o,style:{width:j[c]||c,height:j[c]||c},title:l||i||"Logo"})})})}image(e,n){let{attrs:t}=e,{src:o,alt:i,title:l,width:c="auto",height:p="auto",alignment:u="center",externalLink:m=""}=t||{},{isNextSpacer:d,isLastSectionElement:f,isLastColumnElement:g}=this.getMarginOverrideConditions(e,n),x=(0,r.jsx)(s.Img,{alt:i||l||"Image",src:o,style:{height:"100%",width:"100%",maxWidth:c,maxHeight:p,outline:"none",border:"none",textDecoration:"none"},title:l||i||"Image"});return(0,r.jsx)(s.Row,{style:{marginTop:"0px",marginBottom:d||f||g?"0px":"32px"},children:(0,r.jsx)(s.Column,{align:u,children:m?(0,r.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,d,f,g,x,S;let{attrs:t}=e,{textAlign:o="left"}=t||{},{isNextSpacer:i,isLastSectionElement:l,isLastColumnElement:c}=this.getMarginOverrideConditions(e,n);return(0,r.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=(f=(d=this.config.theme)==null?void 0:d.fontSize)==null?void 0:f.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:i||l||c?"0px":"20px",textAlign:o},C),children:this.getMappedContent(e)})}blockquote(e,n){var c,p;let{isNextSpacer:t,isPrevSpacer:o,isLastSectionElement:i,isLastColumnElement:l}=this.getMarginOverrideConditions(e,n);return(0,r.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||i||l?"0px":"20px"},children:this.getMappedContent(e)})}code(e,n){var t,o,i,l;return(0,r.jsx)("code",{style:{backgroundColor:(o=(t=this.config.theme)==null?void 0:t.colors)==null?void 0:o.codeBackground,color:(l=(i=this.config.theme)==null?void 0:i.colors)==null?void 0:l.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:le,fontWeight:400,letterSpacing:0},children:n})}linkCard(e,n){var S,J,M,A,V,_,B,R,P,X,F,z;let{attrs:t}=e,{isNextSpacer:o,isLastSectionElement:i,isLastColumnElement:l}=this.getMarginOverrideConditions(e,n),{title:c,description:p,link:u,linkTitle:m,image:d,badgeText:f,subTitle:g}=t||{},x=this.linkValues.get(u)||this.variableValues.get(u)||u||"#";return(0,r.jsxs)("a",{href:x,rel:"noopener noreferrer",style:{border:"1px solid #eaeaea",borderRadius:"10px",textDecoration:"none",color:"inherit",display:"block",marginBottom:o||i||l?"0px":"20px"},target:"_blank",children:[d?(0,r.jsx)(s.Row,{style:{marginBottom:"6px"},children:(0,r.jsx)(s.Column,{style:{width:"100%",height:"100%"},children:(0,r.jsx)(s.Img,{alt:c||"Link Card",src:d,style:{borderRadius:"10px 10px 0 0",width:"100%",height:"100%",objectFit:"cover"},title:c||"Link Card"})})}):null,(0,r.jsx)(s.Row,{style:{padding:"15px",marginTop:0,marginBottom:0},children:(0,r.jsxs)(s.Column,{style:{verticalAlign:"top"},children:[(0,r.jsxs)(s.Row,{align:void 0,style:{marginBottom:"8px",marginTop:"0px"},width:"auto",children:[(0,r.jsx)(s.Column,{children:(0,r.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})}),f||g?(0,r.jsxs)(s.Column,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[f?(0,r.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:f}):null," ",g&&!f?(0,r.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,r.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,r.jsx)("a",{href:x,rel:"noopener noreferrer",style:{color:(z=(F=this.config.theme)==null?void 0:F.colors)==null?void 0:z.linkCardTitle,fontSize:"14px",fontWeight:600,textDecoration:"underline"},children:m}):null]})]})})]})}section(e,n){let{attrs:t}=e,{borderRadius:o=0,padding:i=0,backgroundColor:l=ce}=t||{};return(0,r.jsx)(s.Container,{style:{backgroundColor:l,borderRadius:o,padding:i},children:this.getMappedContent(e,y(h({},n),{parent:e}))})}columns(e,n){let{attrs:t}=e,{width:o=U,align:i=$}=t||{};return(0,r.jsx)(s.Row,{width:o,align:i,style:{margin:0,padding:0,width:o},children:this.getMappedContent(e,y(h({},n),{parent:e}))})}column(e,n){let{attrs:t}=e,{width:o="50%",verticalAlign:i="top"}=t||{};return(0,r.jsx)(s.Column,{style:{width:o,verticalAlign:i,margin:0,padding:0},children:this.getMappedContent(e,y(h({},n),{parent:e}))})}};function pe(a,e){return b(this,null,function*(){let l=e||{},{theme:n,preview:t}=l,o=D(l,["theme","preview"]),i=new v(a);return i.setPreviewText(t),i.setTheme(n||{}),i.render(o)})}0&&(module.exports={DEFAULT_COLUMNS_ALIGN,DEFAULT_COLUMNS_WIDTH,Maily,render});
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  // @ts-nocheck
2
2
 
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};
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 j=(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)&&j(l,n,e[n]);if(N)for(var n of N(e))q.call(e,n)&&j(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 Ne=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 de={sm:"8px",md:"16px",lg:"32px",xl:"64px"},w={WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"};var fe={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",Se="100%",ye="left",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,d=(t==null?void 0:t.type)==="column"&&!r;return{isNextSpacer:s,isPrevSpacer:a,isLastSectionElement:p,isFirstSectionElement:u,isParentListItem:c,isLastColumnElement:m,isFirstColumnElement:d}}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,d;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:(d=(m=this.config.theme)==null?void 0:m.colors)==null?void 0:d.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 d,f;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}=fe[r];return o(le,{as:r,style:{textAlign:i,color:(f=(d=this.config.theme)==null?void 0:d.colors)==null?void 0:f.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:d,isLastSectionElement:f,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:d||f||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:de[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:d,isLastColumnElement:f}=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||d||f?"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,d,f,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:(f=(d=(m=this.config.theme)==null?void 0:m.fontSize)==null?void 0:d.footer)==null?void 0:f.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,F,z,I,W,D;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:d,subTitle:f}=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})}),d||f?x(b,{style:{paddingLeft:"6px",verticalAlign:"middle"},children:[d?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:d}):null," ",f&&!d?o("span",{style:{fontWeight:"normal",color:(F=(X=this.config.theme)==null?void 0:X.colors)==null?void 0:F.linkCardSubTitle,fontSize:"12px",lineHeight:"12px"},children:f}):null]}):null]}),x(k,{style:g({fontSize:"16px",color:(I=(z=this.config.theme)==null?void 0:z.colors)==null?void 0:I.linkCardDescription,marginTop:"0px",marginBottom:"0px"},w),children:[c," ",u?o("a",{href:h,rel:"noopener noreferrer",style:{color:(D=(W=this.config.theme)==null?void 0:W.colors)==null?void 0:D.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){let{attrs:t}=e,{width:r=Se,align:i=ye}=t||{};return o(v,{width:r,align:i,style:{margin:0,padding:0,width:r},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,margin:0,padding:0},children:this.getMappedContent(e,C(g({},n),{parent:e}))})}};function Fe(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{ye as DEFAULT_COLUMNS_ALIGN,Se as DEFAULT_COLUMNS_WIDTH,M as Maily,Fe as render};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/render",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "description": "A transformer that converts Maily content into HTML email templates.",
6
6
  "sideEffects": false,