@silexlabs/silex 3.0.0-alpha.127 → 3.0.0-alpha.128

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.
@@ -3864,7 +3864,9 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
3864
3864
  }
3865
3865
 
3866
3866
  .silex-hidden {
3867
- display: none;
3867
+ visibility: hidden;
3868
+ position: absolute;
3869
+ opacity: 0;
3868
3870
  }
3869
3871
 
3870
3872
  .settings-dialog > div {
@@ -301,7 +301,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
301
301
  @click=${()=>this.editor.Commands.stop(Sr)}
302
302
  >Close</button>
303
303
  </footer>
304
- `}}displayPending(t,e){this.errorMessage=null,this.renderDialog(t,e)}displayError(t,e,n){console.info(t),this.errorMessage=t,this.renderDialog(e,n)}async closeDialog(){this.isOpen=!1,this.renderDialog(null,null),this.sender&&this.sender.set("active",0),this.sender=null}async toggleDialog(){this.isOpen?this.closeDialog():this.openDialog()}async openDialog(){this.isOpen=!0;const t=this.editor.Panels.getPanel("options")?.view.el.querySelector(".publish-button");if(t){const e=t.getBoundingClientRect(),n=450,r=20,o=50;this.move({left:e.right-n-r,top:e.bottom+10,width:n,minHeight:o})}else console.error("Unable to find publish button");this.renderDialog(null,Yr.STATUS_NONE)}}var Er;function kr(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}!function(t){t.STARTUP_START="silex:startup:start",t.STARTUP_END="silex:startup:end",t.GRAPESJS_START="silex:grapesjs:start",t.GRAPESJS_END="silex:grapesjs:end",t.PUBLISH_START="silex:publish:start",t.PUBLISH_DATA="silex:publish:data",t.PUBLISH_END="silex:publish:end",t.PUBLISH_ERROR="silex:publish:error",t.PUBLISH_LOGIN_START="silex:publish:login:start",t.PUBLISH_LOGIN_END="silex:publish:login:end",t.ASSET_WRITE_END="silex:asset:write:end",t.WRITE_END="silex:write:end"}(Er||(Er={}));const Ar="tmp-pre-publication-transformer-tohtml",Pr="tmp-pre-publication-transformer-src",jr="tmp-pre-publication-transformer-attributes-src",Mr="tmp-pre-publication-transformer-inline-css",Lr="tmp-pre-publication-transformer-href",Nr="tmp-pre-publication-transformer-tocss",Ir={renderComponent:(t,e)=>e(),renderCssRule:(t,e)=>e(),transformPath:(t,e)=>t,transformPermalink(t,e,n){switch(n){case Pe.HTML:return t;case Pe.CSS:return`../${t.replace(/^\//,"")}`;default:throw new Error(`Unknown initiator ${n}`)}},transformFile:t=>t};function Dr(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${$r(t,r,Ae.ASSET,Pe.CSS)})`}:e}function $r(t,e,n,r){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPermalink?e.transformPermalink(t,n,r)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}function Rr(t,e,n){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPath?e.transformPath(t,n)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}const Hr=window.location.pathname.replace(/\/$/,""),Fr=window.location.origin;function Vr(t,e,n){if(t.startsWith("/assets")){const r=new URL(t,Fr);return r.pathname=r.pathname.replace(/^\/assets/,""),r.pathname=`${Hr}${on}${vn}${Cn}${r.pathname}`,r.searchParams.set("websiteId",e),r.searchParams.set("connectorId",n),`${decodeURIComponent(r.pathname)}${r.search}`}return console.warn("storedToDisplayed: path is not a stored path",t),t}function Ur(t){const e=`${Hr}${on}${vn}${Cn}`;if(t.startsWith(e)){const n=new URL(t,Fr);n.pathname=n.pathname.replace(new RegExp(`^${e}`),""),n.pathname=`${Hr}/assets${n.pathname}`,n.searchParams.delete("websiteId"),n.searchParams.delete("connectorId");const r="/"+n.toString().replace(new RegExp(`^${Fr}${Hr}`),"").replace(/^\//,"");return decodeURIComponent(r)}return console.warn("displayedToStored: path is not a displayed path",t),t}const Br={transformPath(t,e){if(e===Ae.ASSET)return Ur(t)},transformPermalink(t,e){if(e===Ae.ASSET)return Ur(t)}};function zr(t,e,n){const r=t.attributes?.src?{...t,attributes:{...t.attributes,src:Vr(t.attributes.src,e,n)}}:t;return r.components&&(r.components=r.components.map((t=>zr(t,e,n)))),r}function Wr(t){const e=t.attributes?.src?{...t,attributes:{...t.attributes,src:Ur(t.attributes.src)}}:t;return e.components&&(e.components=e.components.map((t=>Wr(t)))),e}const qr="publish",Gr="publish-login",Kr="publish-logout";var Yr;function Zr(t,e){t.PublicationManager=new Qr(t,e)}function Xr(t){switch(t){case Me.IN_PROGRESS:return Yr.STATUS_PENDING;case Me.ERROR:return Yr.STATUS_ERROR;case Me.SUCCESS:return Yr.STATUS_SUCCESS}throw new Error(`Unknown job status ${t}`)}!function(t){t.STATUS_NONE="STATUS_NONE",t.STATUS_PENDING="STATUS_PENDING",t.STATUS_ERROR="STATUS_ERROR",t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_LOGGED_OUT="STATUS_AUTH_ERROR"}(Yr||(Yr={}));const Jr=window.location.origin+window.location.pathname.replace(/\/$/,"");class Qr{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Yr.STATUS_NONE;constructor(t,e){this.editor=t,this.options={appendTo:"options",...e},t.on("storage:start:store",(t=>{t.publication=this.settings})),t.on("storage:end:load",(t=>{this.settings=t.publication??{},$e({type:je.HOSTING,connectorId:this.settings.connector?.connectorId}).then((t=>{})).catch((t=>{this.status=Yr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(qr,(()=>this.startPublication())),t.Commands.add(Gr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Kr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new Tr(t,{appendTo:this.options.appendTo}):console.info("PublicationUi is disabled because no appendTo option is set")}async goLogin(t){if(t.isLoggedIn)return this.settings={...this.settings,connector:t},this.status=Yr.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Yr.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${Jr}${on}${sn}${un}?connectorId=${e}&type=${n}`,"_blank"),new Promise((e=>{const n=async e=>{const r=e.data;"login"===r?.type&&(window.removeEventListener("message",n),r.error?(this.status=Yr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(Er.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Yr.STATUS_NONE,this.editor.store(null),this.dialog&&this.dialog.displayPending(this.job,this.status)))};window.addEventListener("message",n,!1)}))}async goLogout(){try{await Re({type:je.HOSTING,connectorId:this.settings.connector.connectorId}),this.settings={},this.dialog&&this.dialog.displayPending(this.job,this.status)}catch(t){console.error("logout error",t),this.status=Yr.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async startPublication(){if(this.status===Yr.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Yr.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(Er.PUBLISH_START);const t=this.editor.getModel().get("user");if(!t)throw new Error("User not logged in to a storage connector");if(!this.settings.connector?.connectorId)throw new Error("User not logged in to a hosting connector");const e=this.options.websiteId,n=t.storage.connectorId;this.setPublicationTransformers();const r=this.editor.getProjectData(),o=this.editor.getModel().get("settings"),i=(await this.getHtmlFiles(o)).flatMap((t=>[{path:t.htmlPath,content:t.html,type:Ae.HTML},{path:t.cssPath,content:t.css,type:Ae.CSS}])).concat(r.assets.map((t=>{const e=Rr(this.editor,t.src,Ae.ASSET),n=Ur(t.src).replace(/^\/assets\//,"");return{...t,path:e,src:n,type:Ae.ASSET}}))),s={...r,assets:r.assets.map((t=>({...t,src:Ur(t.src)}))),settings:o,publication:this.settings,files:i};this.resetPublicationTransformers(),function(t,e){const n=t.getModel().get("config");e.files=n.publicationTransformers.reduce(((t,n)=>t.map(((t,r)=>{try{return e.pages[r],n.transformFile?n.transformFile(t)??t:t}catch(e){return console.error("Publication transformer: error transforming file",t,e),t}}))),e.files)}(this.editor,s),this.editor.trigger(Er.PUBLISH_DATA,s);try{const[t,r]=await He({websiteId:e,hostingId:this.settings.connector.connectorId,storageId:n,data:s,options:this.settings.options});this.job=r,this.status=Xr(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Yr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Yr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(Er.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(Er.PUBLISH_END,{success:!1,message:t.message})}}async getHtmlFiles(t){return this.editor.Pages.getAll().map((e=>{const n=e.get("settings");function r(e){return(n||{})[e]||(t||[])[e]||""}const o=e.getMainComponent(),i=wr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=$r(this.editor,s,Ae.CSS,Pe.HTML),c=Rr(this.editor,s,Ae.CSS),u=Rr(this.editor,a,Ae.HTML),p=this.editor.getHtml({component:o});return{html:`<!DOCTYPE html>\n<html lang="${r("lang")}">\n<head>\n<meta charset="UTF-8">\n<link rel="stylesheet" href="${l}" />\n${t?.head||""}\n${n?.head||""}\n<title>${r("title")}</title>\n<link rel="icon" href="${r("favicon")}" />\n${["description","og:title","og:description","og:image"].map((t=>`<meta name="${t}" property="${t}" content="${r(t)}"/>`)).join("\n")}\n</head>\n${p}\n</html>`,css:this.editor.getCss({component:o}),cssPath:c,htmlPath:u}}))}async trackProgress(){try{this.job=await Fe({jobId:this.job.jobId}),this.status=Xr(this.job.status)}catch(t){return this.status=Yr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(Er.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(Er.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===Me.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(Er.PUBLISH_END,{success:this.job.status===Me.SUCCESS,message:this.job.message}),this.dialog&&this.dialog.displayPending(this.job,this.status)}setPublicationTransformers(){!function(t){const e=t.getModel().get("config");kr(t,(n=>{if(n.get(Ar))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Ar]=n.toHTML;const o=n.getStyle.bind(n);n[Mr]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Lr]=i,n.set("attributes",{...n.get("attributes"),href:$r(t,i,Ae.HTML,Pe.HTML)})),n.get("attributes").src){n[Pr]=n.get("attributes").src;const e=$r(t,n.get("attributes").src,Ae.ASSET,Pe.HTML);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[jr]=n.get("src");const e=$r(t,n.get("src"),Ae.ASSET,Pe.HTML);n.set("src",e)}n.toHTML=()=>e.publicationTransformers.reduce(((t,e)=>{try{return e.renderComponent?e.renderComponent(n,(()=>t))??t:t}catch(e){return console.error("Publication transformer: error rendering component",n,e),t}}),r()),n.getStyle=()=>Dr(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[Nr])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[Nr]=n.getStyle,n.getStyle=()=>{try{const n=Dr(t,r()),o=e.publicationTransformers.reduce(((t,e)=>({...e.renderCssRule?e.renderCssRule(t,(()=>n))??t:t})),n);return o}catch(t){return console.error("Publication transformer: error rendering style",n,t),r()}}}}))}(this.editor)}resetPublicationTransformers(){!function(t){kr(t,(t=>{t[Ar]&&(t.toHTML=t[Ar],delete t[Ar]),t[Mr]&&(t.getStyle=t[Mr],delete t[Mr]),t[Pr]&&(t.set("attributes",{...t.get("attributes"),src:t[Pr]}),delete t[Pr]),t[jr]&&(t.set("src",t[jr]),delete t[jr]),t[Lr]&&(t.set("attributes",{...t.get("attributes"),href:t[Lr]}),delete t[Lr])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[Nr]&&(t.getStyle=t[Nr],delete t[Nr])}))}(this.editor)}}const to="fa fa-fw fa-paste silex-button",eo=" disabled",no=[{name:"./project-bar",value:or},{name:"grapesjs-style-bg",value:Wn()},{name:"./settings",value:(t,e)=>{try{pr="3.0.0-alpha.127"}catch(t){}console.info("Silex version:",pr),t.Commands.add(ur,{run:(e,n,{page:r})=>{cr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n?.set&&n.set("active",0),t.stopCommand(ur)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r),Gt(At`
304
+ `}}displayPending(t,e){this.errorMessage=null,this.renderDialog(t,e)}displayError(t,e,n){console.info(t),this.errorMessage=t,this.renderDialog(e,n)}async closeDialog(){this.isOpen=!1,this.renderDialog(null,null),this.sender&&this.sender.set("active",0),this.sender=null}async toggleDialog(){this.isOpen?this.closeDialog():this.openDialog()}async openDialog(){this.isOpen=!0;const t=this.editor.Panels.getPanel("options")?.view.el.querySelector(".publish-button");if(t){const e=t.getBoundingClientRect(),n=450,r=20,o=50;this.move({left:e.right-n-r,top:e.bottom+10,width:n,minHeight:o})}else console.error("Unable to find publish button");this.renderDialog(null,Yr.STATUS_NONE)}}var Er;function kr(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}!function(t){t.STARTUP_START="silex:startup:start",t.STARTUP_END="silex:startup:end",t.GRAPESJS_START="silex:grapesjs:start",t.GRAPESJS_END="silex:grapesjs:end",t.PUBLISH_START="silex:publish:start",t.PUBLISH_DATA="silex:publish:data",t.PUBLISH_END="silex:publish:end",t.PUBLISH_ERROR="silex:publish:error",t.PUBLISH_LOGIN_START="silex:publish:login:start",t.PUBLISH_LOGIN_END="silex:publish:login:end",t.ASSET_WRITE_END="silex:asset:write:end",t.WRITE_END="silex:write:end"}(Er||(Er={}));const Ar="tmp-pre-publication-transformer-tohtml",Pr="tmp-pre-publication-transformer-src",jr="tmp-pre-publication-transformer-attributes-src",Mr="tmp-pre-publication-transformer-inline-css",Lr="tmp-pre-publication-transformer-href",Nr="tmp-pre-publication-transformer-tocss",Ir={renderComponent:(t,e)=>e(),renderCssRule:(t,e)=>e(),transformPath:(t,e)=>t,transformPermalink(t,e,n){switch(n){case Pe.HTML:return t;case Pe.CSS:return`../${t.replace(/^\//,"")}`;default:throw new Error(`Unknown initiator ${n}`)}},transformFile:t=>t};function Dr(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${$r(t,r,Ae.ASSET,Pe.CSS)})`}:e}function $r(t,e,n,r){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPermalink?e.transformPermalink(t,n,r)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}function Rr(t,e,n){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>{try{return e.transformPath?e.transformPath(t,n)??t:t}catch(e){return console.error("Publication transformer: error transforming path",t,e),t}}),e)}const Hr=window.location.pathname.replace(/\/$/,""),Fr=window.location.origin;function Vr(t,e,n){if(t.startsWith("/assets")){const r=new URL(t,Fr);return r.pathname=r.pathname.replace(/^\/assets/,""),r.pathname=`${Hr}${on}${vn}${Cn}${r.pathname}`,r.searchParams.set("websiteId",e),r.searchParams.set("connectorId",n),`${decodeURIComponent(r.pathname)}${r.search}`}return console.warn("storedToDisplayed: path is not a stored path",t),t}function Ur(t){const e=`${Hr}${on}${vn}${Cn}`;if(t.startsWith(e)){const n=new URL(t,Fr);n.pathname=n.pathname.replace(new RegExp(`^${e}`),""),n.pathname=`${Hr}/assets${n.pathname}`,n.searchParams.delete("websiteId"),n.searchParams.delete("connectorId");const r="/"+n.toString().replace(new RegExp(`^${Fr}${Hr}`),"").replace(/^\//,"");return decodeURIComponent(r)}return console.warn("displayedToStored: path is not a displayed path",t),t}const Br={transformPath(t,e){if(e===Ae.ASSET)return Ur(t)},transformPermalink(t,e){if(e===Ae.ASSET)return Ur(t)}};function zr(t,e,n){const r=t.attributes?.src?{...t,attributes:{...t.attributes,src:Vr(t.attributes.src,e,n)}}:t;return r.components&&(r.components=r.components.map((t=>zr(t,e,n)))),r}function Wr(t){const e=t.attributes?.src?{...t,attributes:{...t.attributes,src:Ur(t.attributes.src)}}:t;return e.components&&(e.components=e.components.map((t=>Wr(t)))),e}const qr="publish",Gr="publish-login",Kr="publish-logout";var Yr;function Zr(t,e){t.PublicationManager=new Qr(t,e)}function Xr(t){switch(t){case Me.IN_PROGRESS:return Yr.STATUS_PENDING;case Me.ERROR:return Yr.STATUS_ERROR;case Me.SUCCESS:return Yr.STATUS_SUCCESS}throw new Error(`Unknown job status ${t}`)}!function(t){t.STATUS_NONE="STATUS_NONE",t.STATUS_PENDING="STATUS_PENDING",t.STATUS_ERROR="STATUS_ERROR",t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_LOGGED_OUT="STATUS_AUTH_ERROR"}(Yr||(Yr={}));const Jr=window.location.origin+window.location.pathname.replace(/\/$/,"");class Qr{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Yr.STATUS_NONE;constructor(t,e){this.editor=t,this.options={appendTo:"options",...e},t.on("storage:start:store",(t=>{t.publication=this.settings})),t.on("storage:end:load",(t=>{this.settings=t.publication??{},$e({type:je.HOSTING,connectorId:this.settings.connector?.connectorId}).then((t=>{})).catch((t=>{this.status=Yr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(qr,(()=>this.startPublication())),t.Commands.add(Gr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Kr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new Tr(t,{appendTo:this.options.appendTo}):console.info("PublicationUi is disabled because no appendTo option is set")}async goLogin(t){if(t.isLoggedIn)return this.settings={...this.settings,connector:t},this.status=Yr.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Yr.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${Jr}${on}${sn}${un}?connectorId=${e}&type=${n}`,"_blank"),new Promise((e=>{const n=async e=>{const r=e.data;"login"===r?.type&&(window.removeEventListener("message",n),r.error?(this.status=Yr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(Er.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Yr.STATUS_NONE,this.editor.store(null),this.dialog&&this.dialog.displayPending(this.job,this.status)))};window.addEventListener("message",n,!1)}))}async goLogout(){try{await Re({type:je.HOSTING,connectorId:this.settings.connector.connectorId}),this.settings={},this.dialog&&this.dialog.displayPending(this.job,this.status)}catch(t){console.error("logout error",t),this.status=Yr.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async startPublication(){if(this.status===Yr.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Yr.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(Er.PUBLISH_START);const t=this.editor.getModel().get("user");if(!t)throw new Error("User not logged in to a storage connector");if(!this.settings.connector?.connectorId)throw new Error("User not logged in to a hosting connector");const e=this.options.websiteId,n=t.storage.connectorId;this.setPublicationTransformers();const r=this.editor.getProjectData(),o=this.editor.getModel().get("settings"),i=(await this.getHtmlFiles(o)).flatMap((t=>[{path:t.htmlPath,content:t.html,type:Ae.HTML},{path:t.cssPath,content:t.css,type:Ae.CSS}])).concat(r.assets.map((t=>{const e=Rr(this.editor,t.src,Ae.ASSET),n=Ur(t.src).replace(/^\/assets\//,"");return{...t,path:e,src:n,type:Ae.ASSET}}))),s={...r,assets:r.assets.map((t=>({...t,src:Ur(t.src)}))),settings:o,publication:this.settings,files:i};this.resetPublicationTransformers(),function(t,e){const n=t.getModel().get("config");e.files=n.publicationTransformers.reduce(((t,n)=>t.map(((t,r)=>{try{return e.pages[r],n.transformFile?n.transformFile(t)??t:t}catch(e){return console.error("Publication transformer: error transforming file",t,e),t}}))),e.files)}(this.editor,s),this.editor.trigger(Er.PUBLISH_DATA,s);try{const[t,r]=await He({websiteId:e,hostingId:this.settings.connector.connectorId,storageId:n,data:s,options:this.settings.options});this.job=r,this.status=Xr(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Yr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Yr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(Er.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(Er.PUBLISH_END,{success:!1,message:t.message})}}async getHtmlFiles(t){return this.editor.Pages.getAll().map((e=>{const n=e.get("settings");function r(e){return(n||{})[e]||(t||[])[e]||""}const o=e.getMainComponent(),i=wr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=$r(this.editor,s,Ae.CSS,Pe.HTML),c=Rr(this.editor,s,Ae.CSS),u=Rr(this.editor,a,Ae.HTML),p=this.editor.getHtml({component:o});return{html:`<!DOCTYPE html>\n<html lang="${r("lang")}">\n<head>\n<meta charset="UTF-8">\n<link rel="stylesheet" href="${l}" />\n${t?.head||""}\n${n?.head||""}\n<title>${r("title")}</title>\n<link rel="icon" href="${r("favicon")}" />\n${["description","og:title","og:description","og:image"].map((t=>`<meta name="${t}" property="${t}" content="${r(t)}"/>`)).join("\n")}\n</head>\n${p}\n</html>`,css:this.editor.getCss({component:o}),cssPath:c,htmlPath:u}}))}async trackProgress(){try{this.job=await Fe({jobId:this.job.jobId}),this.status=Xr(this.job.status)}catch(t){return this.status=Yr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(Er.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(Er.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===Me.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(Er.PUBLISH_END,{success:this.job.status===Me.SUCCESS,message:this.job.message}),this.dialog&&this.dialog.displayPending(this.job,this.status)}setPublicationTransformers(){!function(t){const e=t.getModel().get("config");kr(t,(n=>{if(n.get(Ar))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Ar]=n.toHTML;const o=n.getStyle.bind(n);n[Mr]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Lr]=i,n.set("attributes",{...n.get("attributes"),href:$r(t,i,Ae.HTML,Pe.HTML)})),n.get("attributes").src){n[Pr]=n.get("attributes").src;const e=$r(t,n.get("attributes").src,Ae.ASSET,Pe.HTML);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[jr]=n.get("src");const e=$r(t,n.get("src"),Ae.ASSET,Pe.HTML);n.set("src",e)}n.toHTML=()=>e.publicationTransformers.reduce(((t,e)=>{try{return e.renderComponent?e.renderComponent(n,(()=>t))??t:t}catch(e){return console.error("Publication transformer: error rendering component",n,e),t}}),r()),n.getStyle=()=>Dr(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[Nr])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[Nr]=n.getStyle,n.getStyle=()=>{try{const n=Dr(t,r()),o=e.publicationTransformers.reduce(((t,e)=>({...e.renderCssRule?e.renderCssRule(t,(()=>n))??t:t})),n);return o}catch(t){return console.error("Publication transformer: error rendering style",n,t),r()}}}}))}(this.editor)}resetPublicationTransformers(){!function(t){kr(t,(t=>{t[Ar]&&(t.toHTML=t[Ar],delete t[Ar]),t[Mr]&&(t.getStyle=t[Mr],delete t[Mr]),t[Pr]&&(t.set("attributes",{...t.get("attributes"),src:t[Pr]}),delete t[Pr]),t[jr]&&(t.set("src",t[jr]),delete t[jr]),t[Lr]&&(t.set("attributes",{...t.get("attributes"),href:t[Lr]}),delete t[Lr])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[Nr]&&(t.getStyle=t[Nr],delete t[Nr])}))}(this.editor)}}const to="fa fa-fw fa-paste silex-button",eo=" disabled",no=[{name:"./project-bar",value:or},{name:"grapesjs-style-bg",value:Wn()},{name:"./settings",value:(t,e)=>{try{pr="3.0.0-alpha.128"}catch(t){}console.info("Silex version:",pr),t.Commands.add(ur,{run:(e,n,{page:r})=>{cr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n?.set&&n.set("active",0),t.stopCommand(ur)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r),Gt(At`
305
305
  <form class="silex-form">
306
306
  <div class="silex-help">
307
307
  ${fr(n)?At`
@@ -318,7 +318,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
318
318
  ${ir.map((t=>At`
319
319
  <li
320
320
  class=${t.id===sr.id?"active":""}
321
- @click=${e=>{e.preventDefault(),sr=t;const n=e.target,r=n.closest("ul"),o=n.closest("section"),i=o.querySelector(`#settings-${t.id}`);Array.from(r.querySelectorAll(".active")).forEach((t=>t.classList.remove("active"))),n.classList.add("active"),Array.from(o.querySelectorAll(".silex-form__hideable")).forEach((t=>t.classList.add("silex-hidden"))),i.classList.remove("silex-hidden")}}
321
+ @click=${e=>{e.preventDefault(),sr=t;const n=e.target,r=n.closest("ul"),o=n.closest("section"),i=o.querySelector(`#settings-${t.id}`);Array.from(r.querySelectorAll(".active")).forEach((t=>t.classList.remove("active"))),n.classList.add("active"),Array.from(o.querySelectorAll(".silex-hideable")).forEach((t=>t.classList.add("silex-hidden"))),i.classList.remove("silex-hidden")}}
322
322
  >
323
323
  ${t.label}
324
324
  </li>
@@ -326,7 +326,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
326
326
  </ul>
327
327
  </aside>
328
328
  <main>
329
- <div id="settings-general" class="silex-form__hideable">
329
+ <div id="settings-general" class="silex-hideable">
330
330
  <div class="gjs-sm-sector-title">General</div>
331
331
  <div class="silex-form__group col2">
332
332
  <label class="silex-form__element">
@@ -341,7 +341,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
341
341
  </label>
342
342
  </div>
343
343
  </div>
344
- <div id="settings-seo" class="silex-form__hideable silex-hidden">
344
+ <div id="settings-seo" class="silex-hideable silex-hidden">
345
345
  <div class="gjs-sm-sector-title">SEO</div>
346
346
  <div class="silex-form__group col2">
347
347
  <label class="silex-form__element">
@@ -361,7 +361,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
361
361
  </label>
362
362
  </div>
363
363
  </div>
364
- <div id="settings-social" class="silex-form__hideable silex-hidden">
364
+ <div id="settings-social" class="silex-hideable silex-hidden">
365
365
  <div class="gjs-sm-sector-title">Social</div>
366
366
  <div class="silex-help">
367
367
  <p>Once your website is live, you can use these tools to test sharing:&nbsp;<a target="_blank" href="https://developers.facebook.com/tools/debug/">Facebook</a>,
@@ -391,7 +391,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
391
391
  </label>
392
392
  </div>
393
393
  </div>
394
- <div id="settings-code" class="silex-form__hideable silex-hidden">
394
+ <div id="settings-code" class="silex-hideable silex-hidden">
395
395
  <div class="gjs-sm-sector-title">Code</div>
396
396
  <div class="silex-form__group">
397
397
  <label class="silex-form__element" id="${ar}">
@@ -127,7 +127,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
127
127
  Array.from(ul.querySelectorAll('.active')).forEach(el => el.classList.remove('active'));
128
128
  li.classList.add('active');
129
129
  // Update hidden
130
- Array.from(section.querySelectorAll('.silex-form__hideable')).forEach(el => el.classList.add('silex-hidden'));
130
+ Array.from(section.querySelectorAll('.silex-hideable')).forEach(el => el.classList.add('silex-hidden'));
131
131
  mainItem.classList.remove('silex-hidden');
132
132
  // This messes up with the save / cancel mechanism
133
133
  // displaySettings(editor, config, model)
@@ -139,7 +139,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
139
139
  </ul>
140
140
  </aside>
141
141
  <main>
142
- <div id="settings-general" class="silex-form__hideable">
142
+ <div id="settings-general" class="silex-hideable">
143
143
  <div class="gjs-sm-sector-title">General</div>
144
144
  <div class="silex-form__group col2">
145
145
  <label class="silex-form__element">
@@ -154,7 +154,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
154
154
  </label>
155
155
  </div>
156
156
  </div>
157
- <div id="settings-seo" class="silex-form__hideable silex-hidden">
157
+ <div id="settings-seo" class="silex-hideable silex-hidden">
158
158
  <div class="gjs-sm-sector-title">SEO</div>
159
159
  <div class="silex-form__group col2">
160
160
  <label class="silex-form__element">
@@ -174,7 +174,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
174
174
  </label>
175
175
  </div>
176
176
  </div>
177
- <div id="settings-social" class="silex-form__hideable silex-hidden">
177
+ <div id="settings-social" class="silex-hideable silex-hidden">
178
178
  <div class="gjs-sm-sector-title">Social</div>
179
179
  <div class="silex-help">
180
180
  <p>Once your website is live, you can use these tools to test sharing:&nbsp;<a target="_blank" href="https://developers.facebook.com/tools/debug/">Facebook</a>,
@@ -204,7 +204,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
204
204
  </label>
205
205
  </div>
206
206
  </div>
207
- <div id="settings-code" class="silex-form__hideable silex-hidden">
207
+ <div id="settings-code" class="silex-hideable silex-hidden">
208
208
  <div class="gjs-sm-sector-title">Code</div>
209
209
  <div class="silex-form__group">
210
210
  <label class="silex-form__element" id="${idCodeWrapper}">
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,UAAU,CAAA;AACrC,OAAO,EAAC,IAAI,EAAC,MAAM,6BAA6B,CAAA;AAIhD,MAAM,SAAS,GAAG,CAAC;QACjB,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,SAAS;KACjB,EAAE;QACD,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,KAAK;KACb,EAAE;QACD,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,QAAQ;KAChB,EAAE;QACD,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,MAAM;KACd,CAAC,CAAA;AACF,IAAI,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAElC,MAAM,aAAa,GAAG,uBAAuB,CAAA;AAC7C,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACxC,IAAI,KAAK,CAAA;AAKT,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAA;AAE9C,IAAI,OAAO,GAAG,IAAI,CAAA;AAClB,IAAI,UAAU,GAAG,IAAI,CAAA;AACrB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;IAC7C,0CAA0C;IAC1C,IAAI;QACF,OAAO,GAAG,OAAO,CAAA;KAClB;IAAC,OAAO,KAAK,EAAE;QACd,oEAAoE;KACrE;IACD,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IACvC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE;QACnC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAE;YACzB,KAAK,GAAG,MA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KAAK,CAAC,CAAA;IAC7C,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;IAClC,OAAO,YAAY,CAAA;AACrB,CAAC;AACD,SAAS,SAAS,CAAC,MAAM;IACvB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,CAAA;IACvC,IAAG,GAAG,EAAE;QACN,YAAY;QACZ,gBAAgB,CAAC,GAAG,EAAE,WAAW,CAAC;aAC/B,SAAS,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;QAC3D,aAAa;QACb,gBAAgB,CAAC,GAAG,EAAE,WAAW,CAAC;aAC/B,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,IAAI,IAAI,EAAE,CAAA;KACtE;SAAM;QACL,gBAAgB;KACjB;AACH,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silexlabs/silex",
3
3
  "description": "Free and easy website builder for everyone.",
4
- "version": "3.0.0-alpha.127",
4
+ "version": "3.0.0-alpha.128",
5
5
  "version:backwardcompat": "3.0.0",
6
6
  "author": {
7
7
  "name": "Alex Hoyau",
@@ -30,7 +30,9 @@
30
30
  }
31
31
 
32
32
  .silex-hidden {
33
- display: none;
33
+ visibility: hidden;
34
+ position: absolute;
35
+ opacity: 0;
34
36
  }
35
37
 
36
38
  // full screen settings
@@ -138,7 +138,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
138
138
  Array.from(ul.querySelectorAll('.active')).forEach(el => el.classList.remove('active'))
139
139
  li.classList.add('active')
140
140
  // Update hidden
141
- Array.from(section.querySelectorAll('.silex-form__hideable')).forEach(el => el.classList.add('silex-hidden'))
141
+ Array.from(section.querySelectorAll('.silex-hideable')).forEach(el => el.classList.add('silex-hidden'))
142
142
  mainItem.classList.remove('silex-hidden')
143
143
  // This messes up with the save / cancel mechanism
144
144
  // displaySettings(editor, config, model)
@@ -150,7 +150,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
150
150
  </ul>
151
151
  </aside>
152
152
  <main>
153
- <div id="settings-general" class="silex-form__hideable">
153
+ <div id="settings-general" class="silex-hideable">
154
154
  <div class="gjs-sm-sector-title">General</div>
155
155
  <div class="silex-form__group col2">
156
156
  <label class="silex-form__element">
@@ -165,7 +165,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
165
165
  </label>
166
166
  </div>
167
167
  </div>
168
- <div id="settings-seo" class="silex-form__hideable silex-hidden">
168
+ <div id="settings-seo" class="silex-hideable silex-hidden">
169
169
  <div class="gjs-sm-sector-title">SEO</div>
170
170
  <div class="silex-form__group col2">
171
171
  <label class="silex-form__element">
@@ -185,7 +185,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
185
185
  </label>
186
186
  </div>
187
187
  </div>
188
- <div id="settings-social" class="silex-form__hideable silex-hidden">
188
+ <div id="settings-social" class="silex-hideable silex-hidden">
189
189
  <div class="gjs-sm-sector-title">Social</div>
190
190
  <div class="silex-help">
191
191
  <p>Once your website is live, you can use these tools to test sharing:&nbsp;<a target="_blank" href="https://developers.facebook.com/tools/debug/">Facebook</a>,
@@ -215,7 +215,7 @@ function displaySettings(editor, config, model = editor.getModel()) {
215
215
  </label>
216
216
  </div>
217
217
  </div>
218
- <div id="settings-code" class="silex-form__hideable silex-hidden">
218
+ <div id="settings-code" class="silex-hideable silex-hidden">
219
219
  <div class="gjs-sm-sector-title">Code</div>
220
220
  <div class="silex-form__group">
221
221
  <label class="silex-form__element" id="${idCodeWrapper}">