@maily-to/render 0.0.4 → 0.0.6
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.mjs +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
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,w=Object.prototype.propertyIsEnumerable;var V=(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)&&V(p,t,e[t]);if(b)for(var t of b(e))w.call(e,t)&&V(p,t,e[t]);return p},T=(p,e)=>F(p,B(e));var O=(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&&w.call(p,n)&&(t[n]=p[n]);return t};var k=(p,e,t)=>new Promise((n,o)=>{var r=l=>{try{s(t.next(l))}catch(c){o(c)}},i=l=>{try{s(t.throw(l))}catch(c){o(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,i);s((t=t.apply(p,e)).next())});import{Fragment as L}from"react";import{Text as M,Html as H,Head as P,Body as W,Font as I,Container as f,Link as q,Heading as D,Hr as $,Button as U,Img as N,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 a,jsxs as v}from"react/jsx-runtime";var Q={sm:"8px",md:"16px",lg:"32px",xl:"64px"},J={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 z={sm:"40px",md:"48px",lg:"64px"},_={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=[],n=r=>r&&this.isValidUrl(r)&&!r.startsWith("#")&&!r.startsWith("mailto:")&&!r.startsWith("tel:")&&typeof r=="string",o=r=>{var i;if(r.type==="button"){let s=(i=r.attrs)==null?void 0:i.url;n(s)&&s&&t.push(s)}else r.content&&r.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.push(c)}),s.content&&o(s)})};return e.forEach(r=>{o(r)}),t}isValidUrl(e){try{let t=new URL(e);return!0}catch(t){return!1}}renderSync(e=_){let t=this.markup();return K(t,e)}renderAsync(){return k(this,arguments,function*(e=_){let t=this.markup();return Y(t,e)})}markup(){let e=this.content.content||[],t=e.map((r,i)=>{let s={prev:e[i-1],next:e[i+1],parent:r},l=this.renderNode(r,s);return l?a(L,{children:l},C()):null}),{preview:n}=this.config;return v(H,{children:[v(P,{children:[a(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"}}),a("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}"}})]}),v(W,{children:[n?a(j,{id:"__react-email-preview",children:n}):null,a(f,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:t}),this.openTrackingPixel?a(N,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMappedContent(e,t){var n,o;return(o=(n=e.content)==null?void 0:n.map(r=>{let i=this.renderNode(r,t);return i?a(L,{children:i},C()):null}))==null?void 0:o.filter(r=>r!==null)}renderNode(e,t={}){var o;let n=e.type||"";if(n in this)return(o=this[n])==null?void 0:o.call(this,e,t);throw new Error(`Node type "${n}" is not supported.`)}renderMark(e){let t=e.text||a(y,{children:"\xA0"});return(e.marks||[]).reduce((o,r)=>{var s;let i=r.type;if(i in this)return(s=this[i])==null?void 0:s.call(this,r,o);throw new Error(`Mark type "${i}" is not supported.`)},a(y,{children:t}))}paragraph(e,t){var c,g,m,d;let{attrs:n}=e,o=(n==null?void 0:n.textAlign)||"left",{parent:r,next:i}=t||{},s=(r==null?void 0:r.type)==="listItem",l=(i==null?void 0:i.type)==="spacer";return a(M,{style:S({textAlign:o,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},J),children:e.content?this.getMappedContent(e):a(y,{children:"\xA0"})})}text(e,t){let n=e.text||" ";return e.marks?this.renderMark(e):a(y,{children:n})}bold(e,t){return a("strong",{children:t})}italic(e,t){return a("em",{children:t})}underline(e,t){return a("u",{children:t})}strike(e,t){return a("s",{style:{textDecoration:"line-through"},children:t})}link(e,t){var s,l;let{attrs:n}=e,o=(n==null?void 0:n.href)||"#",r=(n==null?void 0:n.target)||"_blank",i=(n==null?void 0:n.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(o=this.linkValues.get(o)||this.variableValues.get(o)||o),a(q,{href:o,rel:i,style:{fontWeight:500,textDecoration:"underline",color:(l=(s=this.config.theme)==null?void 0:s.colors)==null?void 0:l.heading},target:r,children:t})}heading(e,t){var h,u;let{attrs:n}=e,{next:o,prev:r}=t||{},i=`h${Number(n==null?void 0:n.level)||1}`,s=(n==null?void 0:n.textAlign)||"left",l=(o==null?void 0:o.type)==="spacer",c=(r==null?void 0:r.type)==="spacer",{fontSize:g,lineHeight:m,fontWeight:d}=Z[i];return a(D,{as:i,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:o}=e.attrs||{},r=this.variableFormatter({variable:n,fallback:o});return this.shouldReplaceVariableValues&&(r=this.variableValues.get(n)||o||r),a(y,{children:r})}horizontalRule(e,t){return a($,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(e,t){return a(f,{children:a("ol",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(e)})})}bulletList(e,t){return a(f,{style:{maxWidth:"100%"},children:a("ul",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(e)})})}listItem(e,t){return a(f,{style:{maxWidth:"100%"},children:a("li",{style:S({marginBottom:"8px",paddingLeft:"6px"},J),children:this.getMappedContent(e,T(S({},t),{parent:e}))})})}button(e,t){let{attrs:n}=e,{text:o,url:r,variant:i,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(r)||this.variableValues.get(r)||r;return a(f,{style:{textAlign:g,maxWidth:"100%",marginBottom:h?"0px":"20px"},children:a(U,{href:u,style:{color:String(l),backgroundColor:i==="filled"?String(s):"transparent",borderColor:String(s),padding:i==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:m},children:o})})}spacer(e,t){let{attrs:n}=e,{height:o="auto"}=n||{};return a(f,{style:{height:Q[o]||o}})}hardBreak(e,t){return a("br",{})}logo(e,t){let{attrs:n}=e,{src:o,alt:r,title:i,size:s,alignment:l="left"}=n||{},{next:c}=t||{},g=(c==null?void 0:c.type)==="spacer";return a(R,{style:{marginTop:"0px",marginBottom:g?"0px":"32px"},children:a(X,{align:l,children:a(N,{alt:r||i||"Logo",src:o,style:{width:z[s]||s,height:z[s]||s},title:i||r||"Logo"})})})}image(e,t){let{attrs:n}=e,{src:o,alt:r,title:i,width:s="auto",height:l="auto",alignment:c="center"}=n||{},{next:g}=t||{},m=(g==null?void 0:g.type)==="spacer";return a(R,{style:{marginTop:"0px",marginBottom:m?"0px":"32px"},children:a(X,{align:c,children:a(N,{alt:r||i||"Image",src:o,style:{height:l,width:s},title:i||r||"Image"})})})}footer(e,t){var s,l,c,g,m,d,h,u;let{attrs:n}=e,{textAlign:o="left"}=n||{},{next:r}=t||{},i=(r==null?void 0:r.type)==="spacer";return a(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:i?"0px":"20px",textAlign:o},J),children:this.getMappedContent(e)})}blockquote(e,t){var s,l;let{next:n,prev:o}=t||{},r=(n==null?void 0:n.type)==="spacer",i=(o==null?void 0:o.type)==="spacer";return a("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:i?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(e)})}code(e,t){var n,o,r,i;return a("code",{style:{backgroundColor:(o=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:o.codeBackground,color:(i=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:i.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:te,fontWeight:400,letterSpacing:0},children:t})}};function he(p,e){let i=e||{},{theme:t,preview:n}=i,o=O(i,["theme","preview"]),r=new x(p);return r.setPreviewText(n),r.setTheme(t),r.renderSync(o)}function Se(p,e){return k(this,null,function*(){let i=e||{},{theme:t,preview:n}=i,o=O(i,["theme","preview"]),r=new x(p);return r.setPreviewText(n),r.setTheme(t),r.renderAsync(o)})}export{x as Maily,Se as renderAsync,he as renderSync};
|
|
3
|
+
var A=Object.defineProperty,F=Object.defineProperties;var B=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var V=(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)&&V(p,t,e[t]);if(b)for(var t of b(e))w.call(e,t)&&V(p,t,e[t]);return p},T=(p,e)=>F(p,B(e));var O=(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&&w.call(p,n)&&(t[n]=p[n]);return t};var k=(p,e,t)=>new Promise((n,o)=>{var r=l=>{try{s(t.next(l))}catch(c){o(c)}},i=l=>{try{s(t.throw(l))}catch(c){o(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,i);s((t=t.apply(p,e)).next())});import{Fragment as L}from"react";import{Text as M,Html as H,Head as P,Body as W,Font as I,Container as f,Link as q,Heading as D,Hr as $,Button as U,Img as N,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 a,jsxs as v}from"react/jsx-runtime";var Q={sm:"8px",md:"16px",lg:"32px",xl:"64px"},J={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 z={sm:"40px",md:"48px",lg:"64px"},_={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=[],n=r=>r&&this.isValidUrl(r)&&!r.startsWith("#")&&!r.startsWith("mailto:")&&!r.startsWith("tel:")&&typeof r=="string",o=r=>{var i;if(r.type==="button"){let s=(i=r.attrs)==null?void 0:i.url;n(s)&&s&&t.push(s)}else r.content&&r.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.push(c)}),s.content&&o(s)})};return e.forEach(r=>{o(r)}),t}isValidUrl(e){try{let t=new URL(e);return!0}catch(t){return!1}}renderSync(e=_){let t=this.markup();return K(t,e)}renderAsync(){return k(this,arguments,function*(e=_){let t=this.markup();return Y(t,e)})}markup(){let e=this.content.content||[],t=e.map((r,i)=>{let s={prev:e[i-1],next:e[i+1],parent:r},l=this.renderNode(r,s);return l?a(L,{children:l},C()):null}),{preview:n}=this.config;return v(H,{children:[v(P,{children:[a(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"}}),a("style",{dangerouslySetInnerHTML:{__html:"blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}"}})]}),v(W,{children:[n?a(j,{id:"__react-email-preview",children:n}):null,a(f,{style:{maxWidth:"600px",minWidth:"300px",width:"100%",marginLeft:"auto",marginRight:"auto",padding:"0.5rem"},children:t}),this.openTrackingPixel?a(N,{alt:"",src:this.openTrackingPixel,style:{display:"none",width:"1px",height:"1px"}}):null]})]})}getMappedContent(e,t){var n,o;return(o=(n=e.content)==null?void 0:n.map(r=>{let i=this.renderNode(r,t);return i?a(L,{children:i},C()):null}))==null?void 0:o.filter(r=>r!==null)}renderNode(e,t={}){var o;let n=e.type||"";if(n in this)return(o=this[n])==null?void 0:o.call(this,e,t);throw new Error(`Node type "${n}" is not supported.`)}renderMark(e){let t=e.text||a(y,{children:"\xA0"});return(e.marks||[]).reduce((o,r)=>{var s;let i=r.type;if(i in this)return(s=this[i])==null?void 0:s.call(this,r,o);throw new Error(`Mark type "${i}" is not supported.`)},a(y,{children:t}))}paragraph(e,t){var c,g,m,d;let{attrs:n}=e,o=(n==null?void 0:n.textAlign)||"left",{parent:r,next:i}=t||{},s=(r==null?void 0:r.type)==="listItem",l=(i==null?void 0:i.type)==="spacer";return a(M,{style:S({textAlign:o,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},J),children:e.content?this.getMappedContent(e):a(y,{children:"\xA0"})})}text(e,t){let n=e.text||" ";return e.marks?this.renderMark(e):a(y,{children:n})}bold(e,t){return a("strong",{children:t})}italic(e,t){return a("em",{children:t})}underline(e,t){return a("u",{children:t})}strike(e,t){return a("s",{style:{textDecoration:"line-through"},children:t})}link(e,t){var s,l;let{attrs:n}=e,o=(n==null?void 0:n.href)||"#",r=(n==null?void 0:n.target)||"_blank",i=(n==null?void 0:n.rel)||"noopener noreferrer nofollow";return(typeof this.linkValues=="object"||typeof this.variableValues=="object")&&(o=this.linkValues.get(o)||this.variableValues.get(o)||o),a(q,{href:o,rel:i,style:{fontWeight:500,textDecoration:"underline",color:(l=(s=this.config.theme)==null?void 0:s.colors)==null?void 0:l.heading},target:r,children:t})}heading(e,t){var h,u;let{attrs:n}=e,{next:o,prev:r}=t||{},i=`h${Number(n==null?void 0:n.level)||1}`,s=(n==null?void 0:n.textAlign)||"left",l=(o==null?void 0:o.type)==="spacer",c=(r==null?void 0:r.type)==="spacer",{fontSize:g,lineHeight:m,fontWeight:d}=Z[i];return a(D,{as:i,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:o}=e.attrs||{},r=this.variableFormatter({variable:n,fallback:o});return this.shouldReplaceVariableValues&&(r=this.variableValues.get(n)||o||r),a(y,{children:r})}horizontalRule(e,t){return a($,{style:{marginTop:"32px",marginBottom:"32px"}})}orderedList(e,t){return a(f,{children:a("ol",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"decimal"},children:this.getMappedContent(e)})})}bulletList(e,t){return a(f,{style:{maxWidth:"100%"},children:a("ul",{style:{marginTop:"0px",marginBottom:"20px",paddingLeft:"26px",listStyleType:"disc"},children:this.getMappedContent(e)})})}listItem(e,t){return a(f,{style:{maxWidth:"100%"},children:a("li",{style:S({marginBottom:"8px",paddingLeft:"6px"},J),children:this.getMappedContent(e,T(S({},t),{parent:e}))})})}button(e,t){let{attrs:n}=e,{text:o,url:r,variant:i,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(r)||this.variableValues.get(r)||r;return a(f,{style:{textAlign:g,maxWidth:"100%",marginBottom:h?"0px":"20px"},children:a(U,{href:u,style:{color:String(l),backgroundColor:i==="filled"?String(s):"transparent",borderColor:String(s),padding:i==="filled"?"12px 34px":"10px 34px",borderWidth:"2px",borderStyle:"solid",textDecoration:"none",fontSize:"14px",fontWeight:500,borderRadius:m},children:o})})}spacer(e,t){let{attrs:n}=e,{height:o="auto"}=n||{};return a(f,{style:{height:Q[o]||o}})}hardBreak(e,t){return a("br",{})}logo(e,t){let{attrs:n}=e,{src:o,alt:r,title:i,size:s,alignment:l="left"}=n||{},{next:c}=t||{},g=(c==null?void 0:c.type)==="spacer";return a(R,{style:{marginTop:"0px",marginBottom:g?"0px":"32px"},children:a(X,{align:l,children:a(N,{alt:r||i||"Logo",src:o,style:{width:z[s]||s,height:z[s]||s},title:i||r||"Logo"})})})}image(e,t){let{attrs:n}=e,{src:o,alt:r,title:i,width:s="auto",height:l="auto",alignment:c="center"}=n||{},{next:g}=t||{},m=(g==null?void 0:g.type)==="spacer";return a(R,{style:{marginTop:"0px",marginBottom:m?"0px":"32px"},children:a(X,{align:c,children:a(N,{alt:r||i||"Image",src:o,style:{height:l,width:s},title:i||r||"Image"})})})}footer(e,t){var s,l,c,g,m,d,h,u;let{attrs:n}=e,{textAlign:o="left"}=n||{},{next:r}=t||{},i=(r==null?void 0:r.type)==="spacer";return a(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:i?"0px":"20px",textAlign:o},J),children:this.getMappedContent(e)})}blockquote(e,t){var s,l;let{next:n,prev:o}=t||{},r=(n==null?void 0:n.type)==="spacer",i=(o==null?void 0:o.type)==="spacer";return a("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:i?"0px":"20px",marginBottom:r?"0px":"20px"},children:this.getMappedContent(e)})}code(e,t){var n,o,r,i;return a("code",{style:{backgroundColor:(o=(n=this.config.theme)==null?void 0:n.colors)==null?void 0:o.codeBackground,color:(i=(r=this.config.theme)==null?void 0:r.colors)==null?void 0:i.codeText,padding:"2px 4px",borderRadius:"6px",fontFamily:te,fontWeight:400,letterSpacing:0},children:t})}};function de(p,e){let i=e||{},{theme:t,preview:n}=i,o=O(i,["theme","preview"]),r=new x(p);return r.setPreviewText(n),r.setTheme(t),r.renderSync(o)}function xe(p,e){return k(this,null,function*(){let i=e||{},{theme:t,preview:n}=i,o=O(i,["theme","preview"]),r=new x(p);return r.setPreviewText(n),r.setTheme(t),r.renderAsync(o)})}export{x as Maily,xe as renderAsync,de as renderSync};
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div align="center"><img height="150" src="https://maily.to/brand/icon.svg" /></div>
|
|
2
2
|
<br>
|
|
3
3
|
|
|
4
|
-
<div align="center"><strong>@
|
|
4
|
+
<div align="center"><strong>@maily-to/render</strong></div>
|
|
5
5
|
<div align="center">Transform <a href="https://maily.to">Maily</a> content into HTML email templates.</div>
|
|
6
6
|
<br />
|
|
7
7
|
|