easy-email-pro-core 1.13.0 → 1.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs.js +1 -1
- package/lib/index.es.js +1 -1
- package/package.json +1 -1
package/lib/index.cjs.js
CHANGED
|
@@ -61,7 +61,7 @@ You passed in: '`+this.raw_options[i]+"'");return u},t.prototype._is_valid_selec
|
|
|
61
61
|
<mj-column width="150px">
|
|
62
62
|
<mj-image target="_blank" alt="easy email pro" href="https://www.easyemail.pro/?utm_source=brand_logo&utm_client_id=${tt.clientId}" padding="5px 10px" container-background-color="#fafafa" src="http://res.cloudinary.com/dfite2e16/image/upload/v1705375075/uio9f0l7sejkp5atsdza.png" />
|
|
63
63
|
</mj-column>
|
|
64
|
-
</mj-section>`)),p=p.replace(/\<!-- GLOBAL_EXTRACT_HEADER --\>/,d),To(e)||(p=p.replace(/\<mj-html-attributes\>([\w\W]*?)\<\/mj-html-attributes\>/,"")),a?oi.html(p,{indent_size:2}):p}static elementToMjml(e,r){return at.unescape(Zi.renderToStaticMarkup(S.createElement(rt,{universalElements:r.universalElements,mode:r.mode,context:{content:r.pageElement},displayMode:r.displayMode||"desktop-mobile",keepEmptyAttributes:!!r.keepEmptyAttributes,mergetagsData:r.mergetagsData,attributesVariables:r.attributesVariables},S.createElement(le,{node:j.cloneDeep(e)}))))}static mjmlToBlockElement(e){const i=new DOMParser().parseFromString(e,"text/html"),n=a=>{if(a.nodeType===8)return oe.getBlockByType(Y.RAW).create({data:{content:a.textContent||""}});if(a.nodeType===3)return{text:a.textContent||""};if(a.nodeType!==1)throw new Error("Invalid");const u=a;let o={},l=u.tagName.toLocaleLowerCase().replace("mj-","");const c=u.getAttribute("style"),h=c==null?void 0:c.split(";").map(m=>{const E=m.split(":");return{[E[0]]:E[1]}}).reduce((m,E)=>H(H({},m),E),{});let _=u.getAttributeNames().filter(m=>!m.startsWith("element-")).reduce((m,E)=>W(H({},m),{[E]:u.getAttribute(E)||""}),{});u.getAttribute("element-type")&&(l=u.getAttribute("element-type")),u.getAttribute("element-data")&&(o=JSON.parse(decodeURIComponent(u.getAttribute("element-data")))),u.getAttribute("element-attributes")&&(_=JSON.parse(decodeURIComponent(u.getAttribute("element-attributes")))||{});const f=oe.getBlockByType(l);if(!f){const m=H({text:u.textContent||""},h),E=g=>{const p=g.tagName.toLowerCase();p==="strong"?m.bold=!0:p==="em"?m.italic=!0:p==="u"?m.underline=!0:p==="del"?m.strikethrough=!0:p==="a"&&(m.link={href:u.getAttribute("href")||"",blank:u.getAttribute("target")==="_blank"})};return[...u.children].forEach(E),m}const D=f.void?[]:u.childNodes.length>0?[...u.childNodes].map(n):[];return{type:l,data:o,attributes:_,children:D}};return n(i.body.firstChild)}static isPageDataVariable(e){return/\$var\(([\s\S]+)\)/g.test(e)}};let Le=qi;ne(Le,"version","0.14.0"),ne(Le,"getPageDataVariables",(e,r)=>{var i;return((i=e.data.variables)==null?void 0:i.reduce((n,a)=>W(H({},n),{[a.name]:a.value}),H({},r)))||H({},r)}),ne(Le,"renderWithPageVariables",(e,r,i)=>{if(!r)return e;const n=j.cloneDeep(e);if(typeof n=="string")return n.replace(/\$var\(([\s\S]+)\)/g,(u,o)=>j.get(r,o,""));const a=u=>{j.forOwn(u,(o,l)=>{typeof o=="object"?(l!=="children"||i)&&a(o):typeof o=="string"&&(u[l]=o.replace(/\$var\(([\s\S]+)\)/g,(c,h)=>j.get(r,h,"")))})};return a(n),n}),ne(Le,"getUniversalElements",ko),ne(Le,"transformUniversalElements",So);const $a=S.createContext({}),mi=()=>S.useContext($a),rt=t=>{const e=S.useMemo(()=>{const r=Le.getPageDataVariables(t.context.content,t.attributesVariables||{});return W(H({},t),{pageVariables:r})},[t]);return S.createElement($a.Provider,{value:e},t.children)};var Va=(t=>(t.RESPONSIVE="RESPONSIVE",t.TEMPLATE_ENGINE="TEMPLATE_ENGINE",t))(Va||{});class Br{constructor(){ne(this,"enabledResponsive",!0)}}ne(Br,"type","RESPONSIVE");class Tr{}ne(Tr,"type","TEMPLATE_ENGINE");class ja{}const He=class{static registerPlugins(e){e.forEach(r=>{He.registerPlugin(r)})}static registerPlugin(e){const r=new e;r instanceof Br?(He.enabledResponsive=r.enabledResponsive,He.generateResponsive=r.generateResponsive):r instanceof Tr?(He.generateIterationTemplate=r.generateIterationTemplate,He.generateConditionTemplate=r.generateConditionTemplate,He.generateVariable=r.generateVariable,He.isVariable=r.isVariable,He.renderWithData=r.renderWithData):r instanceof ja&&r.generateElement()}};let me=He;ne(me,"enabledResponsive",!1),ne(me,"generateResponsive",e=>{const r=oe.getBlockByType(e.node.type),{mode:i,children:n,context:a,idx:u,node:o,keepEmptyAttributes:l,mergetagsData:c}=e;return r.render(W(H({},e),{mode:i,children:n,context:a,idx:u,node:o,keepEmptyAttributes:l,mergetagsData:c}))}),ne(me,"generateIterationTemplate",(e,r)=>r),ne(me,"isVariable",e=>!1),ne(me,"generateConditionTemplate",(e,r)=>r),ne(me,"generateVariable",e=>e),ne(me,"renderWithData",(e,r)=>e);const le=t=>{var x,k,b,w,y;const{children:e,node:r,idx:i}=t,{mode:n,context:a,displayMode:u,keepEmptyAttributes:o,mergetagsData:l,pageVariables:c}=mi(),h=oe.getBlockByType(r.type);if(!h)throw new Error(`${r.type} block is not registered`);let _=W(H({},r),{attributes:H({},r.attributes),mobileAttributes:H({},r.mobileAttributes)});const f=j.get(_,"attributes.css-class")||"";n==="production"&&j.set(_,"attributes.css-class",f.replace(qa,"").replace(di,""));const D=(x=_.attributes["mj-class"])==null?void 0:x.trim();if(D&&a.content.data.classAttributes){const T={},s=D.split(" ").map(v=>v.trim()).filter(Boolean);Object.values(s).forEach(v=>{j.get(a.content.data.classAttributes,v)&&Object.assign(T,j.get(a.content.data.classAttributes,v))}),_.attributes=G(T,_.attributes)}const m=(k=a.content.data.blockAttributes)==null?void 0:k[_.type];m&&(_.attributes=G(m,_.attributes));const E=(b=a.content.data.categoryAttributes)==null?void 0:b[h.category];a.content.data.globalAttributes&&(_.attributes=G(a.content.data.globalAttributes,_.attributes)),E&&(_.attributes=G(E,_.attributes));const g=oe.getBlockByType(_.type).defaultData.attributes;if(g&&(_.attributes=G(g,_.attributes)),Z.isSectionElement(r)||Z.isWrapperElement(r)){const T=a.content.attributes["content-background-color"];T&&(_.attributes=G({"background-color":T},_.attributes))}let d=c;Z.isWidgetElement(_)?(d=G(c,_.data.input),_=Le.renderWithPageVariables(_,d,!0)):_=Le.renderWithPageVariables(_,d);let A=me.generateResponsive({mode:n,children:e,context:a,idx:i,node:_,keepEmptyAttributes:o,mergetagsData:l,displayMode:u});if(n==="production"){const T=(w=r.logic)==null?void 0:w.condition,s=(y=r.logic)==null?void 0:y.iteration;s&&s.enabled&&(A=me.generateIterationTemplate(s,A)),T&&T.enabled&&(A=me.generateConditionTemplate(j.cloneDeep(T),A))}return S.createElement(S.Fragment,null,A)},ze=({node:t})=>{let e=t.text;const r={};return e?(t.bold&&(e=S.createElement("strong",null,e)),t.italic&&(e=S.createElement("em",null,e)),t.underline&&(e=S.createElement("u",null,e)),t.strikethrough&&(e=S.createElement("del",null,e)),t.link&&(e=S.createElement("a",{href:t.link.href,target:t.link.blank?"_blank":void 0},e)),t.color&&(r.color=t.color),t.bgColor&&(r.backgroundColor=t.bgColor),t.fontSize&&(r.fontSize=t.fontSize),t.fontFamily&&(r.fontFamily=t.fontFamily),j.isString(e)&&Object.keys(r).length===0?S.createElement(S.Fragment,null,e):S.createElement("span",{style:r},e)):null};function fe(t){const{params:e,params:{node:r,idx:i,children:n,keepEmptyAttributes:a},tag:u,children:o}=t,l=o||n,c=$s(e,{keepEmptyAttributes:a,removeDefaultAttributes:e.mode==="production"}),h=S.createElement(S.Fragment,null,`<${u}${c?` ${c}`:""}>`,l||r.children.map((_,f)=>{if(Z.isTextNode(_)){const D=_.text.replace(/ {2}/g," ");return Z.isTextListElement(r)?S.createElement(S.Fragment,{key:f},"<li>",S.createElement(ze,W(H({key:f},e),{node:W(H({},_),{text:D})})),"</li>"):S.createElement(ze,W(H({key:f},e),{node:W(H({},_),{text:D})}))}return S.createElement(le,W(H({key:f},e),{idx:i?Z.getChildIdx(i,f):null,node:_}))}),`</${u}>`);return S.createElement(S.Fragment,null,h)}const Wa=t=>{if(S.isValidElement(t)||j.isString(t)||j.isUndefined(t)||j.isNumber(t)||j.isBoolean(t)||t===null||Array.isArray(t)&&t.every(e=>Wa(e)))return!0};function ae(t){return!!Wa(t)}function bi(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.WRAPPER,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Ga(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SECTION,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Ka(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.GROUP,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Xa(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.COLUMN,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Ya(t){const u=t,{data:e,children:r,idx:i}=u,n=ce(u,["data","children","idx"]),a={type:U.BUTTON,data:e||{},attributes:H({},n),children:ae(r)?[]:r||[]};return S.createElement(le,{idx:i,node:a,children:ae(r)?r:null})}function Qa(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.IMAGE,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function kr(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.TEXT,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Za(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SPACER,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Oe(t){const u=t,{data:e,children:r,idx:i}=u,n=ce(u,["data","children","idx"]),a={type:U.RAW,data:e||{content:r||""},attributes:H({},n),children:ae(r)?[]:r||[]};return S.createElement(le,{idx:i,node:a,children:ae(r)?r:null})}function Ja(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.DIVIDER,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function es(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.NAVBAR,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function ts(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.NAVBAR_LINK,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function rs(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SOCIAL,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function is(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SOCIAL_ELEMENT,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function ns(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.HERO,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Go(t){const u=t,{tagName:e,children:r,idx:i}=u,n=ce(u,["tagName","children","idx"]),a={type:U.HTML_NODE,data:{tagName:e},attributes:H({},n),children:ae(r)?[]:r||[]};return S.createElement(le,{idx:i,node:a,children:ae(r)?r:null})}function Ko(t){const a=t,{idx:e,children:r}=a,i=ce(a,["idx","children"]),n={type:Y.FOR_EACH,data:H({},i),attributes:{},children:ae(r)?[]:r||[]};return S.createElement(le,{idx:e,node:n,children:ae(r)?r:null})}function Xo(t){const a=t,{idx:e,children:r}=a,i=ce(a,["idx","children"]),n={type:Y.SHOW,data:W(H({},i),{component:r}),attributes:{},children:[]};return S.createElement(le,{idx:e,node:n,children:r})}function Yo(t){const u=t,{tagName:e,idx:r,children:i}=u,n=ce(u,["tagName","idx","children"]),a={type:Y.HTML_DOM_NODE,data:{tagName:e},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}const Qo=({node:t})=>S.createElement(le,{node:W(H({},t),{attributes:W(H({},t.attributes),{"css-class":ft(t.attributes["css-class"],di)})})}),Zo=Object.freeze(Object.defineProperty({__proto__:null,BasicBlock:fe,BlockRenderer:le,Button:Ya,Column:Xa,ContentLeaf:ze,Divider:Ja,ForEach:Ko,Group:Ka,Hero:ns,HtmlDomNode:Yo,HtmlNode:Go,Image:Qa,Navbar:es,NavbarLink:ts,Raw:Oe,Section:Ga,Show:Xo,SlateNodePlaceholder:Qo,Social:rs,SocialElement:is,Spacer:Za,Text:kr,Wrapper:bi},Symbol.toStringTag,{value:"Module"})),Jo={attributes:{width:"600px","margin-top":"30px","margin-bottom":"30px","link-text-decoration":"underline"},data:{breakpoint:"480px"}},e0={get name(){return K("Page")},defaultData:Jo,type:U.PAGE,create:t=>{const e={type:U.PAGE,data:{breakpoint:"480px",globalAttributes:{"font-family":"Arial, sans-serif"}},attributes:{},children:[]};return G(e,t)},category:z.PAGE,render(t){var g,p,d,A,x,k;const{node:e,node:{data:r,attributes:i},mode:n}=t,a=r.breakpoint?`<mj-breakpoint width="${r.breakpoint}" />`:"",u=[...r.headStyles||[]];n==="testing"?u.unshift({content:Na}):(u.unshift({content:wo}),u.unshift({content:Co,inline:"inline"}));const o=u.map(b=>`<mj-style ${b.inline?'inline="inline"':""}>${b.content}</mj-style>`).join(`
|
|
64
|
+
</mj-section>`)),p=p.replace(/\<!-- GLOBAL_EXTRACT_HEADER --\>/,d),To(e)||(p=p.replace(/\<mj-html-attributes\>([\w\W]*?)\<\/mj-html-attributes\>/,"")),a?oi.html(p,{indent_size:2}):p}static elementToMjml(e,r){return at.unescape(Zi.renderToStaticMarkup(S.createElement(rt,{universalElements:r.universalElements,mode:r.mode,context:{content:r.pageElement},displayMode:r.displayMode||"desktop-mobile",keepEmptyAttributes:!!r.keepEmptyAttributes,mergetagsData:r.mergetagsData,attributesVariables:r.attributesVariables},S.createElement(le,{node:j.cloneDeep(e)}))))}static mjmlToBlockElement(e){const i=new DOMParser().parseFromString(e,"text/html"),n=a=>{if(a.nodeType===8)return oe.getBlockByType(Y.RAW).create({data:{content:a.textContent||""}});if(a.nodeType===3)return{text:a.textContent||""};if(a.nodeType!==1)throw new Error("Invalid");const u=a;let o={},l=u.tagName.toLocaleLowerCase().replace("mj-","");const c=u.getAttribute("style"),h=c==null?void 0:c.split(";").map(m=>{const E=m.split(":");return{[E[0]]:E[1]}}).reduce((m,E)=>H(H({},m),E),{});let _=u.getAttributeNames().filter(m=>!m.startsWith("element-")).reduce((m,E)=>W(H({},m),{[E]:u.getAttribute(E)||""}),{});u.getAttribute("element-type")&&(l=u.getAttribute("element-type")),u.getAttribute("element-data")&&(o=JSON.parse(decodeURIComponent(u.getAttribute("element-data")))),u.getAttribute("element-attributes")&&(_=JSON.parse(decodeURIComponent(u.getAttribute("element-attributes")))||{});const f=oe.getBlockByType(l);if(!f){const m=H({text:u.textContent||""},h),E=g=>{const p=g.tagName.toLowerCase();p==="strong"?m.bold=!0:p==="em"?m.italic=!0:p==="u"?m.underline=!0:p==="del"?m.strikethrough=!0:p==="a"&&(m.link={href:u.getAttribute("href")||"",blank:u.getAttribute("target")==="_blank"})};return[...u.children].forEach(E),m}const D=f.void?[]:u.childNodes.length>0?[...u.childNodes].map(n):[];return{type:l,data:o,attributes:_,children:D}};return n(i.body.firstChild)}static isPageDataVariable(e){return/\$var\(([\s\S]+)\)/g.test(e)}};let Le=qi;ne(Le,"version","0.14.0"),ne(Le,"getPageDataVariables",(e,r)=>{var i;return((i=e.data.variables)==null?void 0:i.reduce((n,a)=>W(H({},n),{[a.name]:a.value}),H({},r)))||H({},r)}),ne(Le,"renderWithPageVariables",(e,r,i)=>{if(!r)return e;const n=j.cloneDeep(e);if(typeof n=="string")return n.replace(/\$var\(([\s\S]+)\)/g,(u,o)=>j.get(r,o,""));const a=u=>{j.forOwn(u,(o,l)=>{typeof o=="object"?(l!=="children"||i)&&a(o):typeof o=="string"&&(u[l]=o.replace(/\$var\(([\s\S]+)\)/g,(c,h)=>j.get(r,h,"")))})};return a(n),n}),ne(Le,"getUniversalElements",ko),ne(Le,"transformUniversalElements",So);const $a=S.createContext({}),mi=()=>S.useContext($a),rt=t=>{const e=S.useMemo(()=>{const r=Le.getPageDataVariables(t.context.content,t.attributesVariables||{});return W(H({},t),{pageVariables:r})},[t]);return S.createElement($a.Provider,{value:e},t.children)};var Va=(t=>(t.RESPONSIVE="RESPONSIVE",t.TEMPLATE_ENGINE="TEMPLATE_ENGINE",t))(Va||{});class Br{constructor(){ne(this,"enabledResponsive",!0)}}ne(Br,"type","RESPONSIVE");class Tr{}ne(Tr,"type","TEMPLATE_ENGINE");class ja{}const He=class{static registerPlugins(e){e.forEach(r=>{He.registerPlugin(r)})}static registerPlugin(e){const r=new e;r instanceof Br?(He.enabledResponsive=r.enabledResponsive,He.generateResponsive=r.generateResponsive):r instanceof Tr?(He.generateIterationTemplate=r.generateIterationTemplate,He.generateConditionTemplate=r.generateConditionTemplate,He.generateVariable=r.generateVariable,He.isVariable=r.isVariable,He.renderWithData=r.renderWithData):r instanceof ja&&r.generateElement()}};let me=He;ne(me,"enabledResponsive",!1),ne(me,"generateResponsive",e=>{const r=oe.getBlockByType(e.node.type),{mode:i,children:n,context:a,idx:u,node:o,keepEmptyAttributes:l,mergetagsData:c}=e;return r.render(W(H({},e),{mode:i,children:n,context:a,idx:u,node:o,keepEmptyAttributes:l,mergetagsData:c}))}),ne(me,"generateIterationTemplate",(e,r)=>r),ne(me,"isVariable",e=>!1),ne(me,"generateConditionTemplate",(e,r)=>r),ne(me,"generateVariable",e=>e),ne(me,"renderWithData",(e,r)=>e);const le=t=>{var x,k,b,w,y;const{children:e,node:r,idx:i}=t,{mode:n,context:a,displayMode:u,keepEmptyAttributes:o,mergetagsData:l,pageVariables:c}=mi(),h=oe.getBlockByType(r.type);if(!h)throw new Error(`${r.type} block is not registered`);let _=W(H({},r),{attributes:H({},r.attributes),mobileAttributes:H({},r.mobileAttributes)});const f=j.get(_,"attributes.css-class")||"";n==="production"&&f&&j.set(_,"attributes.css-class",f.replace(qa,"").replace(di,""));const D=(x=_.attributes["mj-class"])==null?void 0:x.trim();if(D&&a.content.data.classAttributes){const T={},s=D.split(" ").map(v=>v.trim()).filter(Boolean);Object.values(s).forEach(v=>{j.get(a.content.data.classAttributes,v)&&Object.assign(T,j.get(a.content.data.classAttributes,v))}),_.attributes=G(T,_.attributes)}const m=(k=a.content.data.blockAttributes)==null?void 0:k[_.type];m&&(_.attributes=G(m,_.attributes));const E=(b=a.content.data.categoryAttributes)==null?void 0:b[h.category];a.content.data.globalAttributes&&(_.attributes=G(a.content.data.globalAttributes,_.attributes)),E&&(_.attributes=G(E,_.attributes));const g=oe.getBlockByType(_.type).defaultData.attributes;if(g&&(_.attributes=G(g,_.attributes)),Z.isSectionElement(r)||Z.isWrapperElement(r)){const T=a.content.attributes["content-background-color"];T&&(_.attributes=G({"background-color":T},_.attributes))}let d=c;Z.isWidgetElement(_)?(d=G(c,_.data.input),_=Le.renderWithPageVariables(_,d,!0)):_=Le.renderWithPageVariables(_,d);let A=me.generateResponsive({mode:n,children:e,context:a,idx:i,node:_,keepEmptyAttributes:o,mergetagsData:l,displayMode:u});if(n==="production"){const T=(w=r.logic)==null?void 0:w.condition,s=(y=r.logic)==null?void 0:y.iteration;s&&s.enabled&&(A=me.generateIterationTemplate(s,A)),T&&T.enabled&&(A=me.generateConditionTemplate(j.cloneDeep(T),A))}return S.createElement(S.Fragment,null,A)},ze=({node:t})=>{let e=t.text;const r={};return e?(t.bold&&(e=S.createElement("strong",null,e)),t.italic&&(e=S.createElement("em",null,e)),t.underline&&(e=S.createElement("u",null,e)),t.strikethrough&&(e=S.createElement("del",null,e)),t.link&&(e=S.createElement("a",{href:t.link.href,target:t.link.blank?"_blank":void 0},e)),t.color&&(r.color=t.color),t.bgColor&&(r.backgroundColor=t.bgColor),t.fontSize&&(r.fontSize=t.fontSize),t.fontFamily&&(r.fontFamily=t.fontFamily),j.isString(e)&&Object.keys(r).length===0?S.createElement(S.Fragment,null,e):S.createElement("span",{style:r},e)):null};function fe(t){const{params:e,params:{node:r,idx:i,children:n,keepEmptyAttributes:a},tag:u,children:o}=t,l=o||n,c=$s(e,{keepEmptyAttributes:a,removeDefaultAttributes:e.mode==="production"}),h=S.createElement(S.Fragment,null,`<${u}${c?` ${c}`:""}>`,l||r.children.map((_,f)=>{if(Z.isTextNode(_)){const D=_.text.replace(/ {2}/g," ");return Z.isTextListElement(r)?S.createElement(S.Fragment,{key:f},"<li>",S.createElement(ze,W(H({key:f},e),{node:W(H({},_),{text:D})})),"</li>"):S.createElement(ze,W(H({key:f},e),{node:W(H({},_),{text:D})}))}return S.createElement(le,W(H({key:f},e),{idx:i?Z.getChildIdx(i,f):null,node:_}))}),`</${u}>`);return S.createElement(S.Fragment,null,h)}const Wa=t=>{if(S.isValidElement(t)||j.isString(t)||j.isUndefined(t)||j.isNumber(t)||j.isBoolean(t)||t===null||Array.isArray(t)&&t.every(e=>Wa(e)))return!0};function ae(t){return!!Wa(t)}function bi(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.WRAPPER,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Ga(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SECTION,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Ka(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.GROUP,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Xa(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.COLUMN,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Ya(t){const u=t,{data:e,children:r,idx:i}=u,n=ce(u,["data","children","idx"]),a={type:U.BUTTON,data:e||{},attributes:H({},n),children:ae(r)?[]:r||[]};return S.createElement(le,{idx:i,node:a,children:ae(r)?r:null})}function Qa(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.IMAGE,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function kr(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.TEXT,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Za(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SPACER,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Oe(t){const u=t,{data:e,children:r,idx:i}=u,n=ce(u,["data","children","idx"]),a={type:U.RAW,data:e||{content:r||""},attributes:H({},n),children:ae(r)?[]:r||[]};return S.createElement(le,{idx:i,node:a,children:ae(r)?r:null})}function Ja(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.DIVIDER,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function es(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.NAVBAR,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function ts(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.NAVBAR_LINK,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function rs(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SOCIAL,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function is(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.SOCIAL_ELEMENT,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function ns(t){const u=t,{data:e,idx:r,children:i}=u,n=ce(u,["data","idx","children"]),a={type:U.HERO,data:e||{},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}function Go(t){const u=t,{tagName:e,children:r,idx:i}=u,n=ce(u,["tagName","children","idx"]),a={type:U.HTML_NODE,data:{tagName:e},attributes:H({},n),children:ae(r)?[]:r||[]};return S.createElement(le,{idx:i,node:a,children:ae(r)?r:null})}function Ko(t){const a=t,{idx:e,children:r}=a,i=ce(a,["idx","children"]),n={type:Y.FOR_EACH,data:H({},i),attributes:{},children:ae(r)?[]:r||[]};return S.createElement(le,{idx:e,node:n,children:ae(r)?r:null})}function Xo(t){const a=t,{idx:e,children:r}=a,i=ce(a,["idx","children"]),n={type:Y.SHOW,data:W(H({},i),{component:r}),attributes:{},children:[]};return S.createElement(le,{idx:e,node:n,children:r})}function Yo(t){const u=t,{tagName:e,idx:r,children:i}=u,n=ce(u,["tagName","idx","children"]),a={type:Y.HTML_DOM_NODE,data:{tagName:e},attributes:H({},n),children:ae(i)?[]:i||[]};return S.createElement(le,{idx:r,node:a,children:ae(i)?i:null})}const Qo=({node:t})=>S.createElement(le,{node:W(H({},t),{attributes:W(H({},t.attributes),{"css-class":ft(t.attributes["css-class"],di)})})}),Zo=Object.freeze(Object.defineProperty({__proto__:null,BasicBlock:fe,BlockRenderer:le,Button:Ya,Column:Xa,ContentLeaf:ze,Divider:Ja,ForEach:Ko,Group:Ka,Hero:ns,HtmlDomNode:Yo,HtmlNode:Go,Image:Qa,Navbar:es,NavbarLink:ts,Raw:Oe,Section:Ga,Show:Xo,SlateNodePlaceholder:Qo,Social:rs,SocialElement:is,Spacer:Za,Text:kr,Wrapper:bi},Symbol.toStringTag,{value:"Module"})),Jo={attributes:{width:"600px","margin-top":"30px","margin-bottom":"30px","link-text-decoration":"underline"},data:{breakpoint:"480px"}},e0={get name(){return K("Page")},defaultData:Jo,type:U.PAGE,create:t=>{const e={type:U.PAGE,data:{breakpoint:"480px",globalAttributes:{"font-family":"Arial, sans-serif"}},attributes:{},children:[]};return G(e,t)},category:z.PAGE,render(t){var g,p,d,A,x,k;const{node:e,node:{data:r,attributes:i},mode:n}=t,a=r.breakpoint?`<mj-breakpoint width="${r.breakpoint}" />`:"",u=[...r.headStyles||[]];n==="testing"?u.unshift({content:Na}):(u.unshift({content:wo}),u.unshift({content:Co,inline:"inline"}));const o=u.map(b=>`<mj-style ${b.inline?'inline="inline"':""}>${b.content}</mj-style>`).join(`
|
|
65
65
|
`)||"",l={color:((g=i["link-color"])==null?void 0:g.trim())||"inherit","font-weight":(p=i["link-font-weight"])==null?void 0:p.trim(),"text-decoration":(d=i["link-text-decoration"])==null?void 0:d.trim(),"font-style":(A=i["link-font-style"])==null?void 0:A.trim()},h=`<mj-style>.mjbody a, .mjbody a:hover, .mjbody a:active, .mjbody a[href], .mjbody a[href]:hover, .mjbody a[href]:active {${Object.keys(l).map(b=>{const w=l;return w[b]?`${b}: ${w[b]}`:""}).filter(Boolean).join(";")}}</mj-style>`,_=i["background-color"]?`background-color="${i["background-color"]}"`:"",f=i["margin-top"]&&i["margin-top"]!=="0px"?`<mj-section padding="0px"><mj-column><mj-spacer height="${i["margin-top"]}"></mj-spacer></mj-column></mj-section>`:"",D=i["margin-bottom"]&&i["margin-bottom"]!=="0px"?`<mj-section padding="0px"><mj-column><mj-spacer height="${i["margin-top"]}"></mj-spacer></mj-column></mj-section>`:"",m=r.preheader?`<mj-preview>${r.preheader}</mj-preview>`:"",E=i.width||"600px";return S.createElement(S.Fragment,null,`
|
|
66
66
|
<mjml>
|
|
67
67
|
<mj-head>
|
package/lib/index.es.js
CHANGED
|
@@ -6701,7 +6701,7 @@ const ue = (t) => {
|
|
|
6701
6701
|
mobileAttributes: H({}, r.mobileAttributes)
|
|
6702
6702
|
});
|
|
6703
6703
|
const f = ge(_, "attributes.css-class") || "";
|
|
6704
|
-
n === "production" && ft(
|
|
6704
|
+
n === "production" && f && ft(
|
|
6705
6705
|
_,
|
|
6706
6706
|
"attributes.css-class",
|
|
6707
6707
|
f.replace(ko, "").replace(Ia, "")
|