@silexlabs/silex 3.0.0-alpha.141 → 3.0.0-alpha.142

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.
@@ -1,4 +1,4 @@
1
- import { ConnectorData, PublicationJobData, PublicationSettings, WebsiteFile, WebsiteId, WebsiteSettings } from '../../types';
1
+ import { ConnectorData, PublicationData, PublicationJobData, PublicationSettings, WebsiteFile, WebsiteId, WebsiteSettings } from '../../types';
2
2
  import { Editor } from 'grapesjs';
3
3
  import { PublicationUi } from './PublicationUi';
4
4
  /**
@@ -60,6 +60,7 @@ export declare class PublicationManager {
60
60
  constructor(editor: PublishableEditor, opts: PublicationManagerOptions);
61
61
  goLogin(connector: ConnectorData): Promise<unknown>;
62
62
  goLogout(): Promise<void>;
63
+ getPublicationData(): Promise<PublicationData>;
63
64
  /**
64
65
  * Start the publication process
65
66
  * This is the command "publish"
@@ -379,7 +379,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
379
379
  @click=${()=>this.editor.Commands.stop(kr)}
380
380
  >Close</button>
381
381
  </footer>
382
- `}}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,Jr.STATUS_NONE)}}function jr(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}const Mr="tmp-pre-publication-transformer-tohtml",Lr="tmp-pre-publication-transformer-src",Nr="tmp-pre-publication-transformer-attributes-src",Ir="tmp-pre-publication-transformer-inline-css",Dr="tmp-pre-publication-transformer-href",$r="tmp-pre-publication-transformer-tocss",Rr={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 Hr(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${Fr(t,r,Ae.ASSET,Pe.CSS)})`}:e}function Fr(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 Vr(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 Ur=window.location.pathname.replace(/\/$/,""),Br=window.location.origin;function zr(t,e,n){if(t.startsWith("/assets")){const r=new URL(t,Br);return r.pathname=r.pathname.replace(/^\/assets/,""),r.pathname=`${Ur}${on}${vn}${Cn}${r.pathname}`,r.searchParams.set("websiteId",e),r.searchParams.set("connectorId",n),`${decodeURIComponent(r.pathname)}${r.search}`}return t.startsWith("<svg")||t.startsWith("data:image")||console.warn("storedToDisplayed: path is not a stored path",t),t}function Wr(t){const e=`${Ur}${on}${vn}${Cn}`;if(t.startsWith(e)){const n=new URL(t,Br);n.pathname=n.pathname.replace(new RegExp(`^${e}`),""),n.pathname=`${Ur}/assets${n.pathname}`,n.searchParams.delete("websiteId"),n.searchParams.delete("connectorId");const r="/"+n.toString().replace(new RegExp(`^${Br}${Ur}`),"").replace(/^\//,"");return decodeURIComponent(r)}return t.startsWith("<svg")||t.startsWith("data:image")||console.warn("displayedToStored: path is not a displayed path",t),t}const qr={transformPath(t,e){if(e===Ae.ASSET)return Wr(t)},transformPermalink(t,e){if(e===Ae.ASSET)return Wr(t)}};function Gr(t,e,n){const r=t.attributes?.src?{...t,attributes:{...t.attributes,src:zr(t.attributes.src,e,n)}}:t;return r.components&&(r.components=r.components.map((t=>Gr(t,e,n)))),r}function Kr(t){const e=t.attributes?.src?{...t,attributes:{...t.attributes,src:Wr(t.attributes.src)}}:t;return e.components&&(e.components=e.components.map((t=>Kr(t)))),e}const Yr="publish",Zr="publish-login",Xr="publish-logout";var Jr;function Qr(t,e){t.PublicationManager=new no(t,e)}function to(t){switch(t){case Me.IN_PROGRESS:return Jr.STATUS_PENDING;case Me.ERROR:return Jr.STATUS_ERROR;case Me.SUCCESS:return Jr.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"}(Jr||(Jr={}));const eo=window.location.origin+window.location.pathname.replace(/\/$/,"");class no{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Jr.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=Jr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(Yr,(()=>this.startPublication())),t.Commands.add(Zr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Xr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new Pr(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=Jr.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Jr.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${eo}${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=Jr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(ur.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Jr.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=Jr.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async startPublication(){if(this.status===Jr.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Jr.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(ur.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=Vr(this.editor,t.src,Ae.ASSET),n=Wr(t.src).replace(/^\/assets\//,"");return{...t,path:e,src:n,type:Ae.ASSET}}))),s={...r,assets:r.assets.map((t=>({...t,src:Wr(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(ur.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=to(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Jr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Jr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(ur.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(ur.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=Sr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=Fr(this.editor,s,Ae.CSS,Pe.HTML),c=Vr(this.editor,s,Ae.CSS),u=Vr(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=to(this.job.status)}catch(t){return this.status=Jr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(ur.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(ur.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===Me.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(ur.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");jr(t,(n=>{if(n.get(Mr))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Mr]=n.toHTML;const o=n.getStyle.bind(n);n[Ir]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Dr]=i,n.set("attributes",{...n.get("attributes"),href:Fr(t,i,Ae.HTML,Pe.HTML)})),n.get("attributes").src){n[Lr]=n.get("attributes").src;const e=Fr(t,n.get("attributes").src,Ae.ASSET,Pe.HTML);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[Nr]=n.get("src");const e=Fr(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=()=>Hr(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[$r])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[$r]=n.getStyle,n.getStyle=()=>{try{const n=Hr(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){jr(t,(t=>{t[Mr]&&(t.toHTML=t[Mr],delete t[Mr]),t[Ir]&&(t.getStyle=t[Ir],delete t[Ir]),t[Lr]&&(t.set("attributes",{...t.get("attributes"),src:t[Lr]}),delete t[Lr]),t[Nr]&&(t.set("src",t[Nr]),delete t[Nr]),t[Dr]&&(t.set("attributes",{...t.get("attributes"),href:t[Dr]}),delete t[Dr])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[$r]&&(t.getStyle=t[$r],delete t[$r])}))}(this.editor)}}const ro="fa fa-fw fa-paste silex-button",oo=" disabled",io=[{name:"./project-bar",value:ir},{name:"grapesjs-style-bg",value:qn()},{name:"./settings",value:(t,e)=>{try{vr="3.0.0-alpha.141"}catch(t){}console.info("Silex version:",vr),t.Commands.add(gr,{run:(e,n,{page:r})=>{hr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n?.set&&n.set("active",0),t.stopCommand(gr)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r);const o=lr(n)?pr:dr;let i=o[0];Gt(At`
382
+ `}}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,Jr.STATUS_NONE)}}function jr(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}const Mr="tmp-pre-publication-transformer-tohtml",Lr="tmp-pre-publication-transformer-src",Nr="tmp-pre-publication-transformer-attributes-src",Ir="tmp-pre-publication-transformer-inline-css",Dr="tmp-pre-publication-transformer-href",$r="tmp-pre-publication-transformer-tocss",Rr={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 Hr(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${Fr(t,r,Ae.ASSET,Pe.CSS)})`}:e}function Fr(t,e,n,r){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>e.transformPermalink?e.transformPermalink(t,n,r)??t:t),e)}function Vr(t,e,n){return t.getModel().get("config").publicationTransformers.reduce(((t,e)=>e.transformPath?e.transformPath(t,n)??t:t),e)}const Ur=window.location.pathname.replace(/\/$/,""),Br=window.location.origin;function zr(t,e,n){if(t.startsWith("/assets")){const r=new URL(t,Br);return r.pathname=r.pathname.replace(/^\/assets/,""),r.pathname=`${Ur}${on}${vn}${Cn}${r.pathname}`,r.searchParams.set("websiteId",e),r.searchParams.set("connectorId",n),`${decodeURIComponent(r.pathname)}${r.search}`}return t.startsWith("<svg")||t.startsWith("data:image")||console.warn("storedToDisplayed: path is not a stored path",t),t}function Wr(t){const e=`${Ur}${on}${vn}${Cn}`;if(t.startsWith(e)){const n=new URL(t,Br);n.pathname=n.pathname.replace(new RegExp(`^${e}`),""),n.pathname=`${Ur}/assets${n.pathname}`,n.searchParams.delete("websiteId"),n.searchParams.delete("connectorId");const r="/"+n.toString().replace(new RegExp(`^${Br}${Ur}`),"").replace(/^\//,"");return decodeURIComponent(r)}return t.startsWith("<svg")||t.startsWith("data:image")||console.warn("displayedToStored: path is not a displayed path",t),t}const qr={transformPath(t,e){if(e===Ae.ASSET)return Wr(t)},transformPermalink(t,e){if(e===Ae.ASSET)return Wr(t)}};function Gr(t,e,n){const r=t.attributes?.src?{...t,attributes:{...t.attributes,src:zr(t.attributes.src,e,n)}}:t;return r.components&&(r.components=r.components.map((t=>Gr(t,e,n)))),r}function Kr(t){const e=t.attributes?.src?{...t,attributes:{...t.attributes,src:Wr(t.attributes.src)}}:t;return e.components&&(e.components=e.components.map((t=>Kr(t)))),e}const Yr="publish",Zr="publish-login",Xr="publish-logout";var Jr;function Qr(t,e){t.PublicationManager=new no(t,e)}function to(t){switch(t){case Me.IN_PROGRESS:return Jr.STATUS_PENDING;case Me.ERROR:return Jr.STATUS_ERROR;case Me.SUCCESS:return Jr.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"}(Jr||(Jr={}));const eo=window.location.origin+window.location.pathname.replace(/\/$/,"");class no{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Jr.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=Jr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(Yr,(()=>this.startPublication())),t.Commands.add(Zr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Xr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new Pr(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=Jr.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Jr.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${eo}${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=Jr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(ur.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Jr.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=Jr.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async getPublicationData(){this.setPublicationTransformers();const t=this.editor.getProjectData(),e=this.editor.getModel().get("settings"),n=(await this.getHtmlFiles(e)).flatMap((t=>[{path:t.htmlPath,content:t.html,type:Ae.HTML},{path:t.cssPath,content:t.css,type:Ae.CSS}])).concat(t.assets.map((t=>{const e=Vr(this.editor,t.src,Ae.ASSET),n=Wr(t.src).replace(/^\/assets\//,"");return{...t,path:e,src:n,type:Ae.ASSET}}))),r={...t,assets:t.assets.map((t=>({...t,src:Wr(t.src)}))),settings:e,publication:this.settings,files:n};return this.resetPublicationTransformers(),function(t,e){const n=t.getModel().get("config");e.files=n.publicationTransformers.reduce(((t,n)=>t.map(((t,r)=>(e.pages[r],n.transformFile?n.transformFile(t)??t:t)))),e.files)}(this.editor,r),this.editor.trigger(ur.PUBLISH_DATA,r),r}async startPublication(){try{if(this.status===Jr.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Jr.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(ur.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,r=await this.getPublicationData(),[o,i]=await He({websiteId:e,hostingId:this.settings.connector.connectorId,storageId:n,data:r,options:this.settings.options});this.job=i,this.status=to(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Jr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Jr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(ur.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(ur.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=Sr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=Fr(this.editor,s,Ae.CSS,Pe.HTML),c=Vr(this.editor,s,Ae.CSS),u=Vr(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=to(this.job.status)}catch(t){return this.status=Jr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(ur.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(ur.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===Me.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(ur.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");jr(t,(n=>{if(n.get(Mr))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Mr]=n.toHTML;const o=n.getStyle.bind(n);n[Ir]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Dr]=i,n.set("attributes",{...n.get("attributes"),href:Fr(t,i,Ae.HTML,Pe.HTML)})),n.get("attributes").src){n[Lr]=n.get("attributes").src;const e=Fr(t,n.get("attributes").src,Ae.ASSET,Pe.HTML);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[Nr]=n.get("src");const e=Fr(t,n.get("src"),Ae.ASSET,Pe.HTML);n.set("src",e)}n.toHTML=()=>e.publicationTransformers.reduce(((t,e)=>e.renderComponent?e.renderComponent(n,(()=>t))??t:t),r()),n.getStyle=()=>Hr(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[$r])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[$r]=n.getStyle,n.getStyle=()=>{const n=Hr(t,r()),o=e.publicationTransformers.reduce(((t,e)=>({...e.renderCssRule?e.renderCssRule(t,(()=>n))??t:t})),n);return o}}}))}(this.editor)}resetPublicationTransformers(){!function(t){jr(t,(t=>{t[Mr]&&(t.toHTML=t[Mr],delete t[Mr]),t[Ir]&&(t.getStyle=t[Ir],delete t[Ir]),t[Lr]&&(t.set("attributes",{...t.get("attributes"),src:t[Lr]}),delete t[Lr]),t[Nr]&&(t.set("src",t[Nr]),delete t[Nr]),t[Dr]&&(t.set("attributes",{...t.get("attributes"),href:t[Dr]}),delete t[Dr])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[$r]&&(t.getStyle=t[$r],delete t[$r])}))}(this.editor)}}const ro="fa fa-fw fa-paste silex-button",oo=" disabled",io=[{name:"./project-bar",value:ir},{name:"grapesjs-style-bg",value:qn()},{name:"./settings",value:(t,e)=>{try{vr="3.0.0-alpha.142"}catch(t){}console.info("Silex version:",vr),t.Commands.add(gr,{run:(e,n,{page:r})=>{hr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n?.set&&n.set("active",0),t.stopCommand(gr)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r);const o=lr(n)?pr:dr;let i=o[0];Gt(At`
383
383
  <form class="silex-form">
384
384
  <div class="silex-help">
385
385
  ${lr(n)?At`
@@ -432,4 +432,4 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
432
432
  <option value="${t}" ?selected=${e.toUpperCase()===t}>${t}</option>
433
433
  `))}
434
434
  </select>
435
- `,t)}function r(e){n(e,t.getSelected()?.get("tagName")||"")}t.DomComponents.getTypes().map((e=>{t.DomComponents.addType(e.id,{model:{defaults:{traits:[...t.DomComponents.getType(e.id).model.prototype.defaults.traits,{label:"Tag name",type:"tag-name",name:"tag-name"}]}}})})),t.TraitManager.addType("tag-name",{createInput({trait:e}){const n=document.createElement("div");return t.on("page",(()=>r(n))),r(n),n},onEvent({elInput:t,component:e,event:n}){const r=t.querySelector("#semantic__select").value;e.get("tagName").toUpperCase()===r.toUpperCase()||e.set("tagName",r)},onUpdate({elInput:t,component:e}){n(t,e.get("tagName"))}})}},{name:"./rich-text",value:(t,e)=>{}},{name:"grapesjs-style-filter",value:T()},{name:"grapesjs-plugin-forms",value:k()},{name:"grapesjs-custom-code",value:P()},{name:"./internal-links",value:Er},{name:"@silexlabs/grapesjs-ui-suggest-classes",value:M()},{name:"@silexlabs/grapesjs-filter-styles",value:N()},{name:"./symbolDialogs",value:(t,e)=>{t.Commands.add(Oe,{run:(e,n)=>{const r=prompt("Label",function(e){let n=1;for(;t.Symbols.find((t=>t.get("label")===e+n));)n++;return e+n}("Symbol "));t.runCommand(be,{label:r,icon:"fa-gem"})}})}},{name:"@silexlabs/grapesjs-symbols",value:we},{name:"./PublicationManager",value:Qr},{name:"./storage",value:t=>{function e(e){const n="string"==typeof e?JSON.parse(e):e;if(console.error("Error with loading or saving website or uploading asset",n,n instanceof Te),!(n instanceof Te))return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`});switch(console.error("ApiError",n.httpStatusCode,n.message),n.httpStatusCode){case 404:return t.Modal.open({title:"Website not found",content:`This website could not be found.<br><hr>${n.message}`});case 403:return t.Modal.open({title:"Access denied",content:`You are not allowed to access this website.<br><hr>${n.message}`});case 401:return void t.trigger(Mn);default:return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`})}}t.Storage.add("connector",{async load(e){try{const i=await Ln(t)??await Nn(t,je.STORAGE,e.connectorId);if(!i)throw new Te("Not logged in",401);const s=await Be({websiteId:e.id,connectorId:i.storage.connectorId});return s.assets&&(s.assets=(n=s.assets,r=e.id,o=i.storage.connectorId,n.map((t=>t.src?{...t,src:zr(t.src,r,o)}:t)))),s.pages&&(s.pages=function(t,e,n){return t.map((t=>({...t,frames:t.frames.map((t=>({...t,component:Gr(t.component,e,n)})))})))}(s.pages,e.id,i.storage.connectorId)),s.styles&&(s.styles=function(t,e,n){return new RegExp(/(.*)(url\((["']?)([^"']+?)\1\))*(.*)/,"g"),t.map((t=>{if(t.style&&t.style["background-image"]){const r=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,r,o)=>`url(${r}${zr(o,e,n)}${r})`));return{...t,style:{...t.style,"background-image":r}}}return t}))}(s.styles,e.id,i.storage.connectorId)),s}catch(n){throw 401===n.httpStatusCode&&(t.once(Pn,(async()=>{try{t.StorageManager.setAutosave(!1);const n=await t.Storage.load(e);t.StorageManager.setAutosave(!0),t.loadProjectData(n)}catch(t){throw console.error("connectorPlugin load error",t),t}})),t.Commands.run(En)),console.error("connectorPlugin load error",n),n}var n,r,o},async store(e,n){try{if(await Ln(t)){const r=await Ln(t);e.assets=e.assets.map((t=>t.src?{...t,src:Wr(t.src)}:t)),e.pages=e.pages.map((t=>({...t,frames:t.frames.map((t=>({...t,component:Kr(t.component)})))}))),e.styles=e.styles.map((t=>{if(t.style&&t.style["background-image"]){const e=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,e,n)=>`url(${e}${Wr(n)}${e})`));return{...t,style:{...t.style,"background-image":e}}}return t})),await ze({websiteId:n.id,connectorId:r.storage.connectorId,data:e})}else t.once(Pn,(()=>t.Storage.store())),t.Commands.run(En)}catch(t){throw console.error("connectorPlugin store error",t),t}}}),t.on("storage:error:load",(t=>{e(t)})),t.on("storage:error:store",(t=>{e(t)})),t.on("asset:upload:end",(e=>{t.store()})),t.on("asset:upload:error",(t=>{e(t)}))}},{name:"./LoginDialog",value:Rn},{name:"@silexlabs/grapesjs-loading",value:xe()},{name:"./breadcrumbs",value:function(t,e){let n;var r;function o(){let e=t.getSelected()??t.Pages.getSelected().getMainComponent();if(!n)return;for(n.innerHTML="";e;){const t=i(e);n.prepend(t),e=e.parent()}const r=document.createElement("span");r.innerHTML="<h3>Selection:&nbsp;</h3>",n.prepend(r)}function i(e){const n=document.createElement("span");return e.model,n.onclick=()=>{t.select(e)},n.classList.add("breadcrumb"),n.innerHTML=`<span>${e.getName()??e.get("tagName")}</span>`,n}r=t=>{n=document.createElement("div"),n.id="breadcrumbs-container",t.prepend(n);const e=document.createElement("style");e.innerHTML='\n #breadcrumbs-container {\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 10px;\n font-size: 12px;\n color: #999;\n overflow-x: auto;\n overflow-y: hidden;\n }\n #breadcrumbs-container h3 {\n font-size: inherit;\n margin: 0;\n }\n #breadcrumbs-container .breadcrumb {\n margin: 0 5px;\n font-size: 14px;\n line-height: 1;\n cursor: pointer;\n white-space: nowrap;\n }\n #breadcrumbs-container .breadcrumb::after {\n content: "➔";\n margin-left: 10px;\n }\n\n #breadcrumbs-container .breadcrumb:last-child::after {\n content: "";\n }\n ',t.prepend(e),o()},Hn?r(Hn):Fn.push(r),t.on("component:selected style:target component:drag:end",(()=>o()))}},{name:"./img",value:Vn},{name:"./css-props",value:(t,e)=>{t.on("load",(()=>{t.StyleManager.addProperty("dimension",{name:"Min width",property:"min-width",type:"integer",units:["px","%","em"],default:"auto",fixedValues:["inherit","initial","unset","none","max-content","min-content","fit-content"]},{at:2}),t.StyleManager.addProperty("dimension",{name:"Max height",property:"max-height",type:"integer",units:["px","%","em"],default:"auto",fixedValues:["inherit","initial","unset","none","max-content","min-content","fit-content"]},{at:5}),t.StyleManager.addProperty("dimension",{name:"Overflow",property:"overflow",type:"composite",properties:[{name:"Overflow X",type:"radio",options:[{value:"auto",name:"auto"},{value:"hidden",name:"hidden"},{value:"visible",name:"visible"},{value:"scroll",name:"scroll"}]},{name:"Overflow Y",type:"radio",options:[{value:"auto",name:"auto"},{value:"hidden",name:"hidden"},{value:"visible",name:"visible"},{value:"scroll",name:"scroll"}]}],info:"The overflow CSS property sets what to do when an element's content is too big to fit in its block formatting context. It is a shorthand for overflow-x and overflow-y."},{at:6}),t.StyleManager.addProperty("extra",{name:"Z index",property:"z-index",type:"slider",step:1,min:-1e4,max:1e4,units:[],info:"Stacking order of the element",default:"auto",fixedValues:["auto","unset","initial","inherit","revert"]},{at:1}),t.StyleManager.addProperty("extra",{name:"Pointer events",property:"pointer-events",type:"select",defaults:"auto",options:[{value:"auto",name:"auto"},{value:"none",name:"none"},{value:"visiblePainted",name:"visiblePainted"},{value:"visibleFill",name:"visibleFill"},{value:"visibleStroke",name:"visibleStroke"},{value:"visible",name:"visible"},{value:"painted",name:"painted"},{value:"fill",name:"fill"},{value:"stroke",name:"stroke"},{value:"all",name:"all"}],info:"The pointer-events CSS property sets under what circumstances (if any) a particular graphic element can become the target of pointer events."},{at:2}),t.StyleManager.addProperty("extra",{name:"Cursor",property:"cursor",type:"select",defaults:"auto",options:[{value:"auto",name:"auto"},{value:"default",name:"default"},{value:"none",name:"none"},{value:"context-menu",name:"context-menu"},{value:"help",name:"help"},{value:"pointer",name:"pointer"},{value:"progress",name:"progress"},{value:"wait",name:"wait"},{value:"cell",name:"cell"},{value:"crosshair",name:"crosshair"},{value:"text",name:"text"},{value:"vertical-text",name:"vertical-text"},{value:"alias",name:"alias"},{value:"copy",name:"copy"},{value:"move",name:"move"},{value:"no-drop",name:"no-drop"},{value:"not-allowed",name:"not-allowed"},{value:"grab",name:"grab"},{value:"grabbing",name:"grabbing"},{value:"all-scroll",name:"all-scroll"},{value:"col-resize",name:"col-resize"},{value:"row-resize",name:"row-resize"},{value:"n-resize",name:"n-resize"},{value:"e-resize",name:"e-resize"},{value:"s-resize",name:"s-resize"},{value:"w-resize",name:"w-resize"},{value:"ne-resize",name:"ne-resize"},{value:"nw-resize",name:"nw-resize"},{value:"se-resize",name:"se-resize"},{value:"sw-resize",name:"sw-resize"},{value:"ew-resize",name:"ew-resize"},{value:"ns-resize",name:"ns-resize"},{value:"nesw-resize",name:"nesw-resize"},{value:"nwse-resize",name:"nwse-resize"},{value:"zoom-in",name:"zoom-in"},{value:"zoom-out",name:"zoom-out"}],info:"The cursor CSS property sets the type of mouse cursor, if any, to show when the mouse pointer is over an element."},{at:3}),t.StyleManager.addProperty("extra",{name:"Column count",property:"column-count",type:"integer",units:[],info:"The column-count CSS property breaks an element's content into the specified number of columns.",default:"auto",fixedValues:["auto","inherit","initial","revert","unset"],min:1},{at:4}),t.StyleManager.addProperty("extra",{name:"Column width",property:"column-width",type:"integer",units:["px","%","em"],info:"The column-width CSS property suggests an optimal column width. This is not a absolute value but a mere hint. Browser will adjust the width of the element automatically.",default:"auto",fixedValues:["auto","inherit","initial","revert","unset"]},{at:5}),t.StyleManager.addProperty("extra",{name:"Column gap",property:"column-gap",type:"integer",units:["px","%","em"],info:"The column-gap CSS property sets the size of the gap (gutter) between an element's columns.",default:"normal",fixedValues:["normal","inherit","initial","revert","unset"]},{at:5}),t.StyleManager.addProperty("extra",{name:"Column rule",property:"column-rule",type:"composite",properties:[{name:"Column rule width",property:"column-rule-width",type:"integer",units:["px","%","em"],info:"The column-rule-width CSS property sets the width of the line drawn between columns in a multi-column layout.",default:"medium",fixedValues:["medium","thin","thick","inherit","initial","revert","unset"]},{name:"Column rule style",property:"column-rule-style",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"hidden",name:"hidden"},{value:"dotted",name:"dotted"},{value:"dashed",name:"dashed"},{value:"solid",name:"solid"},{value:"double",name:"double"},{value:"groove",name:"groove"},{value:"ridge",name:"ridge"},{value:"inset",name:"inset"},{value:"outset",name:"outset"},{value:"inherit",name:"inherit"}],info:"The column-rule-style CSS property sets the style of the line drawn between columns in a multi-column layout."},{name:"Column rule color",property:"column-rule-color",type:"color",defaults:"none",info:"The column-rule-color CSS property sets the color of the line drawn between columns in a multi-column layout."}]},{at:6}),t.StyleManager.addProperty("extra",{name:"Column span",property:"column-span",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"all",name:"all"}],info:"The column-span CSS property makes it possible for an element to span across all columns when its value is set to all."},{at:7}),t.StyleManager.addProperty("decorations",{name:"Outline",property:"outline",type:"composite",properties:[{name:"Outline width",property:"outline-width",type:"integer",units:["px","%","em"],info:"The outline-width CSS property sets the thickness of an element's outline. An outline is a line that is drawn around an element, outside the border.",default:"medium",fixedValues:["medium","thin","thick","inherit","initial","revert","unset"]},{name:"Outline style",property:"outline-style",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"hidden",name:"hidden"},{value:"dotted",name:"dotted"},{value:"dashed",name:"dashed"},{value:"solid",name:"solid"},{value:"double",name:"double"},{value:"groove",name:"groove"},{value:"ridge",name:"ridge"},{value:"inset",name:"inset"},{value:"outset",name:"outset"}],info:"The outline-style CSS property sets the style of an element's outline. An outline is a line that is drawn around an element, outside the border."},{name:"Outline color",property:"outline-color",type:"color",defaults:"none",info:"The outline-color CSS property sets the color of an element's outline."}]},{at:8}),t.StyleManager.addProperty("typography",{name:"Word break",property:"word-break",type:"select",defaults:"normal",options:[{value:"normal",name:"normal"},{value:"break-all",name:"break-all"},{value:"keep-all",name:"keep-all"},{value:"break-word",name:"break-word"}],info:"The word-break CSS property sets whether line breaks appear wherever the text would otherwise overflow its content box."},{at:7}),t.StyleManager.addProperty("typography",{name:"Word wrap",property:"word-wrap",type:"radio",defaults:"normal",options:[{value:"normal",name:"normal"},{value:"break-word",name:"break-word"}],info:"The word-wrap CSS property sets whether the line may be broken within a word in order to prevent overflow when an otherwise unbreakable string is too long to fit in its containing box."},{at:8}),t.StyleManager.addProperty("typography",{name:"White space",property:"white-space",type:"select",defaults:"normal",options:[{value:"normal",name:"normal"},{value:"nowrap",name:"nowrap"},{value:"pre",name:"pre"},{value:"pre-wrap",name:"pre-wrap"},{value:"pre-line",name:"pre-line"},{value:"break-spaces",name:"break-spaces"}],info:"The white-space CSS property sets how white space inside an element is handled."},{at:9}),t.StyleManager.addProperty("typography",{name:"Text decoration",property:"text-decoration",type:"composite",properties:[{name:"Text decoration line",property:"text-decoration-line",type:"select",defaults:"none",fixedValues:["auto","inherit","initial","revert","unset"],options:[{value:"none",name:"none"},{value:"underline",name:"underline"},{value:"overline",name:"overline"},{value:"line-through",name:"line-through"},{value:"blink",name:"blink"}],info:"The text-decoration CSS property sets the appearance of decorative lines on text."},{name:"Text decoration style",property:"text-decoration-style",type:"select",defaults:"solid",options:[{value:"solid",name:"solid"},{value:"double",name:"double"},{value:"dotted",name:"dotted"},{value:"dashed",name:"dashed"},{value:"wavy",name:"wavy"}],info:"The text-decoration-style CSS property sets the style of the lines specified by text-decoration-line. The style applies to all lines, there is no way to define different styles for each of the lines."},{name:"Text decoration color",property:"text-decoration-color",type:"color",defaults:"initial",fixedValues:["inherit","initial","revert","unset"],info:"The text-decoration-color CSS property sets the color of decorations added to text by text-decoration-line."},{name:"Text decoration thickness",property:"text-decoration-thickness",type:"integer",units:["px","%","em"],info:"The text-decoration-thickness CSS property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline.",default:"auto",fixedValues:["auto","inherit","initial","revert","unset"]}]},{at:10}),t.StyleManager.addProperty("typography",{name:"Text transform",property:"text-transform",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"capitalize",name:"capitalize"},{value:"uppercase",name:"uppercase"},{value:"lowercase",name:"lowercase"}],info:"The text-transform CSS property sets how to capitalize an element's text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized."},{at:11}),t.StyleManager.addProperty("typography",{name:"Text overflow",property:"text-overflow",type:"select",defaults:"clip",options:[{value:"clip",name:"clip"},{value:"ellipsis",name:"ellipsis"}],info:"The text-overflow CSS property sets how hidden overflow content is signaled to users. It can be clipped, display an ellipsis ('…', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string. It covers the two long-hand properties text-overflow-clip and text-overflow-string."},{at:12}),t.StyleManager.addProperty("general",{name:"Visibility",property:"visibility",type:"select",defaults:"visible",options:[{value:"visible",name:"visible"},{value:"hidden",name:"hidden"},{value:"collapse",name:"collapse"}],info:"The visibility CSS property shows or hides an element without changing the layout of a document. The property can also hide rows or columns in a <table>."},{at:1});const e=t.StyleManager.addProperty("general",{name:"Content",property:"content",type:"text",defaults:"none",info:"The content CSS property replaces an element with a generated value. Objects inserted using the content property are anonymous replaced elements.",full:!0,visible:!1},{at:0});function n(){const n=t.SelectorManager.getState();["before","after"].includes(n)?e.set("visible",!0):e.set("visible",!1)}t.on("selector:state component:selected component:styleUpdate style:sector:update",((t,e)=>setTimeout((()=>n())))),t.StyleManager.getSector("general").on("change",(()=>n())),t.SelectorManager.states.add({name:"before",label:"Before"}),t.SelectorManager.states.add({name:"after",label:"After"}),t.SelectorManager.states.add({name:"active",label:"Active"}),t.SelectorManager.states.add({name:"first-child",label:"First child"}),t.SelectorManager.states.add({name:"last-child",label:"Last child"}),t.SelectorManager.states.add({name:"focus",label:"Focus"}),t.SelectorManager.states.add({name:"visited",label:"Visited"}),t.SelectorManager.states.add({name:"link",label:"Link"}),t.SelectorManager.states.add({name:"first-letter",label:"First letter"}),t.SelectorManager.states.add({name:"first-line",label:"First line"}),t.SelectorManager.states.add({name:"selection",label:"Selection"}),t.SelectorManager.states.add({name:"empty",label:"Empty"}),t.SelectorManager.states.add({name:"enabled",label:"Enabled"}),t.SelectorManager.states.add({name:"disabled",label:"Disabled"}),t.SelectorManager.states.add({name:"checked",label:"Checked"}),t.SelectorManager.states.add({name:"indeterminate",label:"Indeterminate"}),t.SelectorManager.states.add({name:"placeholder-shown",label:"Placeholder shown"}),t.SelectorManager.states.add({name:"placeholder",label:"Placeholder"}),t.SelectorManager.states.add({name:"default",label:"Default"}),t.SelectorManager.states.add({name:"valid",label:"Valid"}),t.SelectorManager.states.add({name:"invalid",label:"Invalid"}),t.SelectorManager.states.add({name:"in-range",label:"In range"}),t.SelectorManager.states.add({name:"out-of-range",label:"Out of range"}),t.SelectorManager.states.add({name:"required",label:"Required"}),t.SelectorManager.states.add({name:"optional",label:"Optional"}),t.SelectorManager.states.add({name:"read-only",label:"Read only"}),t.SelectorManager.states.add({name:"read-write",label:"Read write"})}))}},{name:"./footer",value:function(t,e){const n=t.Panels.addPanel({id:"footer",visible:!0,buttons:[]});setTimeout((()=>{Hn=n.view?.el,Fn.forEach((t=>t(Hn))),Fn=[]}))}},{name:"@silexlabs/grapesjs-storage-rate-limit",value:Un},{name:"grapesjs-style-border",value:zn()},{name:"./resize-panel",value:function(t){console.log("resize-panel.ts"),t.Panels.addPanel({id:"viewsOptions",buttons:[{id:"resize",className:"viewsOptions__size-btn",command:"resize-panel",attributes:{title:"Resize panel"}}]}),t.Commands.add("resize-panel",{run:(t,e)=>{document.documentElement.style.setProperty("--viewsPanelWidth","40%")},stop:(t,e)=>{document.documentElement.style.setProperty("--viewsPanelWidth","20%")}})}}];io.filter((t=>"function"!=typeof t.value)).forEach((t=>{throw new Error(`Plugin ${t.name} could not be loaded correctly (${t.value})`)}));const so="#333333",ao="#ddd",lo="#8873FE",co="#A291FF",uo="#363636",po="#575757",fo="Containers",ho="Components";function go(t){const{websiteId:e,storageId:n,rootUrl:r}=t;return{container:"#gjs",height:"100%",showOffsets:!0,showDevices:!0,layerManager:{appendTo:".layer-manager-container"},blockManager:{appendTo:".block-manager-container"},assetManager:{upload:`${r}${on}${vn}${Sn}/?websiteId=${e}${n?`&connectorId=${n}`:""}`},storageManager:{autoload:!1,type:"connector",options:{connector:{id:e,connectorId:n}}},cssIcons:"./css/all.min.css",canvasCss:`\n :root {\n --primaryColor: ${so};\n --secondaryColor: ${ao};\n --tertiaryColor: ${lo};\n --quaternaryColor: ${co};\n --darkerPrimaryColor: ${uo};\n --lighterPrimaryColor: ${po};\n }\n .gjs-frame-selected {\n box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.5) !important; // Change to red border\n }\n .gjs-selected {\n outline: 2px solid var(--tertiaryColor) !important;\n outline-offset: -2px;\n }\n `,richTextEditor:{actions:["bold","italic","underline","strikethrough","link","wrap",xr,Cr]},plugins:io.map((t=>t.value)),pluginsOpts:{[S().toString()]:{blocks:["text","image","video","map"],category:fo},[ir.toString()]:{panels:[{id:"dash",className:"logo",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"block-manager-btn",className:"block-manager-btn fa fa-fw fa-plus",attributes:{title:"Blocks",containerClassName:"block-manager-container"},command:"open-blocks"},{id:"symbols-btn",className:"symbols-btn fa-regular fa-gem",attributes:{title:"Symbols",containerClassName:"symbols-list-container"},command:"open-symbols",buttons:[{id:"symbol-create-button",className:"pages__add-page fa-solid fa-plus",label:"Create symbol from selection",command:Oe}]},{id:"page-panel-btn",className:"page-panel-btn fa fa-fw fa-file",attributes:{title:"Pages",containerClassName:"page-panel-container"},command:Kn,buttons:[{className:"pages__add-page fa fa-file",command:Yn,text:"+"}]},{id:"layer-manager-btn",className:"layer-manager-btn fa-solid fa-layer-group",attributes:{title:"Layers",containerClassName:"layer-manager-container"},command:"open-layers"},{id:"font-dialog-btn",className:"font-manager-btn fa-solid fa-font",attributes:{title:"Fonts"},command:()=>{vo.runCommand(Ce.cmdOpenFonts)}},{id:"settings-dialog-btn",className:"page-panel-btn fa-solid fa-gears",attributes:{title:"Settings"},command:gr},{id:"spacer",attributes:{},className:"project-bar-spacer"},{id:"dash2",className:"fa-solid fa-house",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"help",className:"fa fa-fw fa-question-circle",attributes:{title:"Documentation"},command:()=>{window.open("https://docs.silex.me/","_blank")}},{id:"logout-button",className:"page-panel-btn fa fa-fw fa-sign-out",attributes:{title:"Sign out"},command:kn}]},[Qr.toString()]:{appendTo:"options",websiteId:e},[Xn.toString()]:{cmdOpenNewPageDialog:rr,cmdOpenSettings:gr,appendTo:".page-panel-container"},[M().toString()]:{enableCount:!1,enablePerformance:!1},[N()]:{appendBefore:".gjs-sm-sectors"},[Er.toString()]:{onError:t=>console.warn("Links errors:",t)},[P().toString()]:{blockLabel:"HTML",blockCustomCode:{category:ho}},[we.toString()]:{appendTo:".symbols-list-container",emptyText:"No symbol yet.",primaryColor:so,secondaryColor:ao,highlightColor:lo},[Se().toString()]:{api_key:"AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc"},[Rn.toString()]:{id:e},[Un.toString()]:{time:5e3},[Vn.toString()]:{replacedElements:t.replacedElements}}}}let vo,mo;async function yo(t){if(vo)throw new Error("Grapesjs editor already created");return new Promise(((e,n)=>{try{vo=x.init(t)}catch(t){console.error("Error initializing GrapesJs with plugins:",io,t),n(t)}["text"].forEach((t=>vo.Blocks.get(t)?.set("category","Basics"))),["image","video"].forEach((t=>vo.Blocks.get(t)?.set("category","Media"))),["map"].forEach((t=>vo.Blocks.get(t)?.set("category","Components"))),vo.Blocks.render([]),vo.Commands.add("gjs-open-import-webpage",function(t,e){const n=t.getConfig("stylePrefix"),r=t.Modal,o=t.CodeManager.getViewer("CodeMirror").clone(),i=document.createElement("div"),s=e.modalImportLabel,a=e.modalImportContent;let l=o.editor;const c=document.createElement("button");return c.type="button",c.innerHTML=e.modalImportButton,c.className=`${n}btn-prim ${n}btn-import`,c.onclick=e=>{t.setComponents(l.getValue().trim()),r.close()},o.set({codeName:"htmlmixed",theme:"hopscotch",readOnly:0,...e.importViewerOptions}),{run(u){if(!l){const t=document.createElement("textarea");if(s){const t=document.createElement("div");t.className=`${n}import-label`,t.innerHTML=s,i.appendChild(t)}i.appendChild(t),i.appendChild(c),o.init(t),l=o.editor}r.setTitle(e.modalImportTitle),r.setContent(i);const p="function"==typeof a?a(t):a;o.setContent(p||""),r.open().getModel().once("change:open",(()=>t.stopCommand(this.id))),l.refresh()},stop(){r.close()}}}(vo,{modalImportLabel:"",modalImportContent:"Paste a web page HTML code here.",modalImportButton:"Import",modalImportTitle:"Import from website"})),vo.on("load",(()=>{const t=vo.Panels.getPanel("views");t.buttons.remove("open-blocks"),t.buttons.remove("open-layers"),vo.Panels.getPanel("options").buttons.remove("export-template"),vo.Panels.getPanel("options").buttons.remove("fullscreen"),vo.BlockManager.render(null),vo.StyleManager.addProperty("extra",{extend:"filter"}),e(vo)}))}))}function bo(){return vo}class wo extends m{api=e;websiteId=new URL(location.href).searchParams.get("id")??en;storageId=new URL(location.href).searchParams.get("connectorId");lang=new URL(location.href).searchParams.get("lang")??nn;rootUrl=window.location.origin+window.location.pathname.replace(/\/$/,"");debug=!1;replacedElements=["img","video","iframe","embed","object","audio","canvas"];grapesJsConfig={plugins:[],pluginsOpts:{}};clientConfigUrl=`${this.rootUrl}/${rn}`;initGrapesConfig(){const t=go(this);this.grapesJsConfig={...this.grapesJsConfig,...t,plugins:[...this.grapesJsConfig.plugins,...t.plugins],pluginsOpts:{...this.grapesJsConfig.pluginsOpts,...t.pluginsOpts}}}getEditor(){return bo()}publicationTransformers=[qr,Rr];resetPublicationTransformers(){this.publicationTransformers=[qr]}addPublicationTransformers(t){Array.isArray(t)||(t=[t]),t.forEach((t=>{!function(t){const e=["renderComponent","renderCssRule","transformFile","transformPermalink","transformPath"];Object.keys(t).forEach((t=>{if(!e.includes(t))throw new Error(`Publication transformer: unknown property ${t}`)})),e.forEach((e=>{if("function"!=typeof t[e]&&void 0!==t[e])throw new Error(`Publication transformer: ${e} must be a function`)}))}(t)})),this.publicationTransformers=this.publicationTransformers.concat(t)}addSettings(t,e,n="last"){!function(t,e,n){const r="site"===e?pr:dr;if("first"===n)r.unshift(t);else if("last"===n)r.push(t);else{if("number"!=typeof n)throw new Error("Invalid position for settings section");r.splice(n,0,t)}}(t,e,n)}removeSettings(t,e){!function(t,e){const n="site"===e?pr:dr,r=n.findIndex((e=>e.id===t));if(-1===r)throw new Error(`Cannot find section with id ${t}`);n.splice(r,1)}(t,e)}}async function _o(t={}){mo=new wo,Object.assign(mo,t),await mo.addPlugin(mo.clientConfigUrl,{}),mo.debug&&console.warn("Silex starting in debug mode.",{config:mo}),mo.emit(ur.STARTUP_START),mo.initGrapesConfig(),mo.emit(ur.GRAPESJS_START);try{await yo(mo.grapesJsConfig)}catch(t){throw console.error("Error starting Silex",t),t}const e=bo();e.getModel().set("config",mo),mo.emit(ur.GRAPESJS_END,{editor:e}),e.I18n.setLocale(mo.lang),e.StorageManager.setAutosave(!1);try{await e.load(null)}catch(t){t.httpStatusCode}finally{setTimeout((()=>{e.editor.set("changesCount",0),e.StorageManager.setAutosave(!0),document.querySelector(".silex-loader").classList.add("silex-dialog-hide"),document.querySelector("#gjs").classList.remove("silex-dialog-hide"),mo.emit(ur.STARTUP_END,{editor:e,config:mo})}),100)}}console.info("\nSilex client loaded\n")})(),silex=r})();
435
+ `,t)}function r(e){n(e,t.getSelected()?.get("tagName")||"")}t.DomComponents.getTypes().map((e=>{t.DomComponents.addType(e.id,{model:{defaults:{traits:[...t.DomComponents.getType(e.id).model.prototype.defaults.traits,{label:"Tag name",type:"tag-name",name:"tag-name"}]}}})})),t.TraitManager.addType("tag-name",{createInput({trait:e}){const n=document.createElement("div");return t.on("page",(()=>r(n))),r(n),n},onEvent({elInput:t,component:e,event:n}){const r=t.querySelector("#semantic__select").value;e.get("tagName").toUpperCase()===r.toUpperCase()||e.set("tagName",r)},onUpdate({elInput:t,component:e}){n(t,e.get("tagName"))}})}},{name:"./rich-text",value:(t,e)=>{}},{name:"grapesjs-style-filter",value:T()},{name:"grapesjs-plugin-forms",value:k()},{name:"grapesjs-custom-code",value:P()},{name:"./internal-links",value:Er},{name:"@silexlabs/grapesjs-ui-suggest-classes",value:M()},{name:"@silexlabs/grapesjs-filter-styles",value:N()},{name:"./symbolDialogs",value:(t,e)=>{t.Commands.add(Oe,{run:(e,n)=>{const r=prompt("Label",function(e){let n=1;for(;t.Symbols.find((t=>t.get("label")===e+n));)n++;return e+n}("Symbol "));t.runCommand(be,{label:r,icon:"fa-gem"})}})}},{name:"@silexlabs/grapesjs-symbols",value:we},{name:"./PublicationManager",value:Qr},{name:"./storage",value:t=>{function e(e){const n="string"==typeof e?JSON.parse(e):e;if(console.error("Error with loading or saving website or uploading asset",n,n instanceof Te),!(n instanceof Te))return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`});switch(console.error("ApiError",n.httpStatusCode,n.message),n.httpStatusCode){case 404:return t.Modal.open({title:"Website not found",content:`This website could not be found.<br><hr>${n.message}`});case 403:return t.Modal.open({title:"Access denied",content:`You are not allowed to access this website.<br><hr>${n.message}`});case 401:return void t.trigger(Mn);default:return t.Modal.open({title:"Error",content:`An error occured.<br>${n.message}`})}}t.Storage.add("connector",{async load(e){try{const i=await Ln(t)??await Nn(t,je.STORAGE,e.connectorId);if(!i)throw new Te("Not logged in",401);const s=await Be({websiteId:e.id,connectorId:i.storage.connectorId});return s.assets&&(s.assets=(n=s.assets,r=e.id,o=i.storage.connectorId,n.map((t=>t.src?{...t,src:zr(t.src,r,o)}:t)))),s.pages&&(s.pages=function(t,e,n){return t.map((t=>({...t,frames:t.frames.map((t=>({...t,component:Gr(t.component,e,n)})))})))}(s.pages,e.id,i.storage.connectorId)),s.styles&&(s.styles=function(t,e,n){return new RegExp(/(.*)(url\((["']?)([^"']+?)\1\))*(.*)/,"g"),t.map((t=>{if(t.style&&t.style["background-image"]){const r=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,r,o)=>`url(${r}${zr(o,e,n)}${r})`));return{...t,style:{...t.style,"background-image":r}}}return t}))}(s.styles,e.id,i.storage.connectorId)),s}catch(n){throw 401===n.httpStatusCode&&(t.once(Pn,(async()=>{try{t.StorageManager.setAutosave(!1);const n=await t.Storage.load(e);t.StorageManager.setAutosave(!0),t.loadProjectData(n)}catch(t){throw console.error("connectorPlugin load error",t),t}})),t.Commands.run(En)),console.error("connectorPlugin load error",n),n}var n,r,o},async store(e,n){try{if(await Ln(t)){const r=await Ln(t);e.assets=e.assets.map((t=>t.src?{...t,src:Wr(t.src)}:t)),e.pages=e.pages.map((t=>({...t,frames:t.frames.map((t=>({...t,component:Kr(t.component)})))}))),e.styles=e.styles.map((t=>{if(t.style&&t.style["background-image"]){const e=t.style["background-image"].replace(/url\((['"]?)([^'"]+)\1\)/g,((t,e,n)=>`url(${e}${Wr(n)}${e})`));return{...t,style:{...t.style,"background-image":e}}}return t})),await ze({websiteId:n.id,connectorId:r.storage.connectorId,data:e})}else t.once(Pn,(()=>t.Storage.store())),t.Commands.run(En)}catch(t){throw console.error("connectorPlugin store error",t),t}}}),t.on("storage:error:load",(t=>{e(t)})),t.on("storage:error:store",(t=>{e(t)})),t.on("asset:upload:end",(e=>{t.store()})),t.on("asset:upload:error",(t=>{e(t)}))}},{name:"./LoginDialog",value:Rn},{name:"@silexlabs/grapesjs-loading",value:xe()},{name:"./breadcrumbs",value:function(t,e){let n;var r;function o(){let e=t.getSelected()??t.Pages.getSelected().getMainComponent();if(!n)return;for(n.innerHTML="";e;){const t=i(e);n.prepend(t),e=e.parent()}const r=document.createElement("span");r.innerHTML="<h3>Selection:&nbsp;</h3>",n.prepend(r)}function i(e){const n=document.createElement("span");return e.model,n.onclick=()=>{t.select(e)},n.classList.add("breadcrumb"),n.innerHTML=`<span>${e.getName()??e.get("tagName")}</span>`,n}r=t=>{n=document.createElement("div"),n.id="breadcrumbs-container",t.prepend(n);const e=document.createElement("style");e.innerHTML='\n #breadcrumbs-container {\n display: flex;\n align-items: center;\n height: 100%;\n padding: 0 10px;\n font-size: 12px;\n color: #999;\n overflow-x: auto;\n overflow-y: hidden;\n }\n #breadcrumbs-container h3 {\n font-size: inherit;\n margin: 0;\n }\n #breadcrumbs-container .breadcrumb {\n margin: 0 5px;\n font-size: 14px;\n line-height: 1;\n cursor: pointer;\n white-space: nowrap;\n }\n #breadcrumbs-container .breadcrumb::after {\n content: "➔";\n margin-left: 10px;\n }\n\n #breadcrumbs-container .breadcrumb:last-child::after {\n content: "";\n }\n ',t.prepend(e),o()},Hn?r(Hn):Fn.push(r),t.on("component:selected style:target component:drag:end",(()=>o()))}},{name:"./img",value:Vn},{name:"./css-props",value:(t,e)=>{t.on("load",(()=>{t.StyleManager.addProperty("dimension",{name:"Min width",property:"min-width",type:"integer",units:["px","%","em"],default:"auto",fixedValues:["inherit","initial","unset","none","max-content","min-content","fit-content"]},{at:2}),t.StyleManager.addProperty("dimension",{name:"Max height",property:"max-height",type:"integer",units:["px","%","em"],default:"auto",fixedValues:["inherit","initial","unset","none","max-content","min-content","fit-content"]},{at:5}),t.StyleManager.addProperty("dimension",{name:"Overflow",property:"overflow",type:"composite",properties:[{name:"Overflow X",type:"radio",options:[{value:"auto",name:"auto"},{value:"hidden",name:"hidden"},{value:"visible",name:"visible"},{value:"scroll",name:"scroll"}]},{name:"Overflow Y",type:"radio",options:[{value:"auto",name:"auto"},{value:"hidden",name:"hidden"},{value:"visible",name:"visible"},{value:"scroll",name:"scroll"}]}],info:"The overflow CSS property sets what to do when an element's content is too big to fit in its block formatting context. It is a shorthand for overflow-x and overflow-y."},{at:6}),t.StyleManager.addProperty("extra",{name:"Z index",property:"z-index",type:"slider",step:1,min:-1e4,max:1e4,units:[],info:"Stacking order of the element",default:"auto",fixedValues:["auto","unset","initial","inherit","revert"]},{at:1}),t.StyleManager.addProperty("extra",{name:"Pointer events",property:"pointer-events",type:"select",defaults:"auto",options:[{value:"auto",name:"auto"},{value:"none",name:"none"},{value:"visiblePainted",name:"visiblePainted"},{value:"visibleFill",name:"visibleFill"},{value:"visibleStroke",name:"visibleStroke"},{value:"visible",name:"visible"},{value:"painted",name:"painted"},{value:"fill",name:"fill"},{value:"stroke",name:"stroke"},{value:"all",name:"all"}],info:"The pointer-events CSS property sets under what circumstances (if any) a particular graphic element can become the target of pointer events."},{at:2}),t.StyleManager.addProperty("extra",{name:"Cursor",property:"cursor",type:"select",defaults:"auto",options:[{value:"auto",name:"auto"},{value:"default",name:"default"},{value:"none",name:"none"},{value:"context-menu",name:"context-menu"},{value:"help",name:"help"},{value:"pointer",name:"pointer"},{value:"progress",name:"progress"},{value:"wait",name:"wait"},{value:"cell",name:"cell"},{value:"crosshair",name:"crosshair"},{value:"text",name:"text"},{value:"vertical-text",name:"vertical-text"},{value:"alias",name:"alias"},{value:"copy",name:"copy"},{value:"move",name:"move"},{value:"no-drop",name:"no-drop"},{value:"not-allowed",name:"not-allowed"},{value:"grab",name:"grab"},{value:"grabbing",name:"grabbing"},{value:"all-scroll",name:"all-scroll"},{value:"col-resize",name:"col-resize"},{value:"row-resize",name:"row-resize"},{value:"n-resize",name:"n-resize"},{value:"e-resize",name:"e-resize"},{value:"s-resize",name:"s-resize"},{value:"w-resize",name:"w-resize"},{value:"ne-resize",name:"ne-resize"},{value:"nw-resize",name:"nw-resize"},{value:"se-resize",name:"se-resize"},{value:"sw-resize",name:"sw-resize"},{value:"ew-resize",name:"ew-resize"},{value:"ns-resize",name:"ns-resize"},{value:"nesw-resize",name:"nesw-resize"},{value:"nwse-resize",name:"nwse-resize"},{value:"zoom-in",name:"zoom-in"},{value:"zoom-out",name:"zoom-out"}],info:"The cursor CSS property sets the type of mouse cursor, if any, to show when the mouse pointer is over an element."},{at:3}),t.StyleManager.addProperty("extra",{name:"Column count",property:"column-count",type:"integer",units:[],info:"The column-count CSS property breaks an element's content into the specified number of columns.",default:"auto",fixedValues:["auto","inherit","initial","revert","unset"],min:1},{at:4}),t.StyleManager.addProperty("extra",{name:"Column width",property:"column-width",type:"integer",units:["px","%","em"],info:"The column-width CSS property suggests an optimal column width. This is not a absolute value but a mere hint. Browser will adjust the width of the element automatically.",default:"auto",fixedValues:["auto","inherit","initial","revert","unset"]},{at:5}),t.StyleManager.addProperty("extra",{name:"Column gap",property:"column-gap",type:"integer",units:["px","%","em"],info:"The column-gap CSS property sets the size of the gap (gutter) between an element's columns.",default:"normal",fixedValues:["normal","inherit","initial","revert","unset"]},{at:5}),t.StyleManager.addProperty("extra",{name:"Column rule",property:"column-rule",type:"composite",properties:[{name:"Column rule width",property:"column-rule-width",type:"integer",units:["px","%","em"],info:"The column-rule-width CSS property sets the width of the line drawn between columns in a multi-column layout.",default:"medium",fixedValues:["medium","thin","thick","inherit","initial","revert","unset"]},{name:"Column rule style",property:"column-rule-style",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"hidden",name:"hidden"},{value:"dotted",name:"dotted"},{value:"dashed",name:"dashed"},{value:"solid",name:"solid"},{value:"double",name:"double"},{value:"groove",name:"groove"},{value:"ridge",name:"ridge"},{value:"inset",name:"inset"},{value:"outset",name:"outset"},{value:"inherit",name:"inherit"}],info:"The column-rule-style CSS property sets the style of the line drawn between columns in a multi-column layout."},{name:"Column rule color",property:"column-rule-color",type:"color",defaults:"none",info:"The column-rule-color CSS property sets the color of the line drawn between columns in a multi-column layout."}]},{at:6}),t.StyleManager.addProperty("extra",{name:"Column span",property:"column-span",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"all",name:"all"}],info:"The column-span CSS property makes it possible for an element to span across all columns when its value is set to all."},{at:7}),t.StyleManager.addProperty("decorations",{name:"Outline",property:"outline",type:"composite",properties:[{name:"Outline width",property:"outline-width",type:"integer",units:["px","%","em"],info:"The outline-width CSS property sets the thickness of an element's outline. An outline is a line that is drawn around an element, outside the border.",default:"medium",fixedValues:["medium","thin","thick","inherit","initial","revert","unset"]},{name:"Outline style",property:"outline-style",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"hidden",name:"hidden"},{value:"dotted",name:"dotted"},{value:"dashed",name:"dashed"},{value:"solid",name:"solid"},{value:"double",name:"double"},{value:"groove",name:"groove"},{value:"ridge",name:"ridge"},{value:"inset",name:"inset"},{value:"outset",name:"outset"}],info:"The outline-style CSS property sets the style of an element's outline. An outline is a line that is drawn around an element, outside the border."},{name:"Outline color",property:"outline-color",type:"color",defaults:"none",info:"The outline-color CSS property sets the color of an element's outline."}]},{at:8}),t.StyleManager.addProperty("typography",{name:"Word break",property:"word-break",type:"select",defaults:"normal",options:[{value:"normal",name:"normal"},{value:"break-all",name:"break-all"},{value:"keep-all",name:"keep-all"},{value:"break-word",name:"break-word"}],info:"The word-break CSS property sets whether line breaks appear wherever the text would otherwise overflow its content box."},{at:7}),t.StyleManager.addProperty("typography",{name:"Word wrap",property:"word-wrap",type:"radio",defaults:"normal",options:[{value:"normal",name:"normal"},{value:"break-word",name:"break-word"}],info:"The word-wrap CSS property sets whether the line may be broken within a word in order to prevent overflow when an otherwise unbreakable string is too long to fit in its containing box."},{at:8}),t.StyleManager.addProperty("typography",{name:"White space",property:"white-space",type:"select",defaults:"normal",options:[{value:"normal",name:"normal"},{value:"nowrap",name:"nowrap"},{value:"pre",name:"pre"},{value:"pre-wrap",name:"pre-wrap"},{value:"pre-line",name:"pre-line"},{value:"break-spaces",name:"break-spaces"}],info:"The white-space CSS property sets how white space inside an element is handled."},{at:9}),t.StyleManager.addProperty("typography",{name:"Text decoration",property:"text-decoration",type:"composite",properties:[{name:"Text decoration line",property:"text-decoration-line",type:"select",defaults:"none",fixedValues:["auto","inherit","initial","revert","unset"],options:[{value:"none",name:"none"},{value:"underline",name:"underline"},{value:"overline",name:"overline"},{value:"line-through",name:"line-through"},{value:"blink",name:"blink"}],info:"The text-decoration CSS property sets the appearance of decorative lines on text."},{name:"Text decoration style",property:"text-decoration-style",type:"select",defaults:"solid",options:[{value:"solid",name:"solid"},{value:"double",name:"double"},{value:"dotted",name:"dotted"},{value:"dashed",name:"dashed"},{value:"wavy",name:"wavy"}],info:"The text-decoration-style CSS property sets the style of the lines specified by text-decoration-line. The style applies to all lines, there is no way to define different styles for each of the lines."},{name:"Text decoration color",property:"text-decoration-color",type:"color",defaults:"initial",fixedValues:["inherit","initial","revert","unset"],info:"The text-decoration-color CSS property sets the color of decorations added to text by text-decoration-line."},{name:"Text decoration thickness",property:"text-decoration-thickness",type:"integer",units:["px","%","em"],info:"The text-decoration-thickness CSS property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline.",default:"auto",fixedValues:["auto","inherit","initial","revert","unset"]}]},{at:10}),t.StyleManager.addProperty("typography",{name:"Text transform",property:"text-transform",type:"select",defaults:"none",options:[{value:"none",name:"none"},{value:"capitalize",name:"capitalize"},{value:"uppercase",name:"uppercase"},{value:"lowercase",name:"lowercase"}],info:"The text-transform CSS property sets how to capitalize an element's text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized."},{at:11}),t.StyleManager.addProperty("typography",{name:"Text overflow",property:"text-overflow",type:"select",defaults:"clip",options:[{value:"clip",name:"clip"},{value:"ellipsis",name:"ellipsis"}],info:"The text-overflow CSS property sets how hidden overflow content is signaled to users. It can be clipped, display an ellipsis ('…', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string. It covers the two long-hand properties text-overflow-clip and text-overflow-string."},{at:12}),t.StyleManager.addProperty("general",{name:"Visibility",property:"visibility",type:"select",defaults:"visible",options:[{value:"visible",name:"visible"},{value:"hidden",name:"hidden"},{value:"collapse",name:"collapse"}],info:"The visibility CSS property shows or hides an element without changing the layout of a document. The property can also hide rows or columns in a <table>."},{at:1});const e=t.StyleManager.addProperty("general",{name:"Content",property:"content",type:"text",defaults:"none",info:"The content CSS property replaces an element with a generated value. Objects inserted using the content property are anonymous replaced elements.",full:!0,visible:!1},{at:0});function n(){const n=t.SelectorManager.getState();["before","after"].includes(n)?e.set("visible",!0):e.set("visible",!1)}t.on("selector:state component:selected component:styleUpdate style:sector:update",((t,e)=>setTimeout((()=>n())))),t.StyleManager.getSector("general").on("change",(()=>n())),t.SelectorManager.states.add({name:"before",label:"Before"}),t.SelectorManager.states.add({name:"after",label:"After"}),t.SelectorManager.states.add({name:"active",label:"Active"}),t.SelectorManager.states.add({name:"first-child",label:"First child"}),t.SelectorManager.states.add({name:"last-child",label:"Last child"}),t.SelectorManager.states.add({name:"focus",label:"Focus"}),t.SelectorManager.states.add({name:"visited",label:"Visited"}),t.SelectorManager.states.add({name:"link",label:"Link"}),t.SelectorManager.states.add({name:"first-letter",label:"First letter"}),t.SelectorManager.states.add({name:"first-line",label:"First line"}),t.SelectorManager.states.add({name:"selection",label:"Selection"}),t.SelectorManager.states.add({name:"empty",label:"Empty"}),t.SelectorManager.states.add({name:"enabled",label:"Enabled"}),t.SelectorManager.states.add({name:"disabled",label:"Disabled"}),t.SelectorManager.states.add({name:"checked",label:"Checked"}),t.SelectorManager.states.add({name:"indeterminate",label:"Indeterminate"}),t.SelectorManager.states.add({name:"placeholder-shown",label:"Placeholder shown"}),t.SelectorManager.states.add({name:"placeholder",label:"Placeholder"}),t.SelectorManager.states.add({name:"default",label:"Default"}),t.SelectorManager.states.add({name:"valid",label:"Valid"}),t.SelectorManager.states.add({name:"invalid",label:"Invalid"}),t.SelectorManager.states.add({name:"in-range",label:"In range"}),t.SelectorManager.states.add({name:"out-of-range",label:"Out of range"}),t.SelectorManager.states.add({name:"required",label:"Required"}),t.SelectorManager.states.add({name:"optional",label:"Optional"}),t.SelectorManager.states.add({name:"read-only",label:"Read only"}),t.SelectorManager.states.add({name:"read-write",label:"Read write"})}))}},{name:"./footer",value:function(t,e){const n=t.Panels.addPanel({id:"footer",visible:!0,buttons:[]});setTimeout((()=>{Hn=n.view?.el,Fn.forEach((t=>t(Hn))),Fn=[]}))}},{name:"@silexlabs/grapesjs-storage-rate-limit",value:Un},{name:"grapesjs-style-border",value:zn()},{name:"./resize-panel",value:function(t){t.Panels.addPanel({id:"viewsOptions",buttons:[{id:"resize",className:"viewsOptions__size-btn",command:"resize-panel",attributes:{title:"Resize panel"}}]}),t.Commands.add("resize-panel",{run:(t,e)=>{document.documentElement.style.setProperty("--viewsPanelWidth","40%")},stop:(t,e)=>{document.documentElement.style.setProperty("--viewsPanelWidth","20%")}})}}];io.filter((t=>"function"!=typeof t.value)).forEach((t=>{throw new Error(`Plugin ${t.name} could not be loaded correctly (${t.value})`)}));const so="#333333",ao="#ddd",lo="#8873FE",co="#A291FF",uo="#363636",po="#575757",fo="Containers",ho="Components";function go(t){const{websiteId:e,storageId:n,rootUrl:r}=t;return{container:"#gjs",height:"100%",showOffsets:!0,showDevices:!0,layerManager:{appendTo:".layer-manager-container"},blockManager:{appendTo:".block-manager-container"},assetManager:{upload:`${r}${on}${vn}${Sn}/?websiteId=${e}${n?`&connectorId=${n}`:""}`},storageManager:{autoload:!1,type:"connector",options:{connector:{id:e,connectorId:n}}},cssIcons:"./css/all.min.css",canvasCss:`\n :root {\n --primaryColor: ${so};\n --secondaryColor: ${ao};\n --tertiaryColor: ${lo};\n --quaternaryColor: ${co};\n --darkerPrimaryColor: ${uo};\n --lighterPrimaryColor: ${po};\n }\n .gjs-frame-selected {\n box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.5) !important; // Change to red border\n }\n .gjs-selected {\n outline: 2px solid var(--tertiaryColor) !important;\n outline-offset: -2px;\n }\n `,richTextEditor:{actions:["bold","italic","underline","strikethrough","link","wrap",xr,Cr]},plugins:io.map((t=>t.value)),pluginsOpts:{[S().toString()]:{blocks:["text","image","video","map"],category:fo},[ir.toString()]:{panels:[{id:"dash",className:"logo",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"block-manager-btn",className:"block-manager-btn fa fa-fw fa-plus",attributes:{title:"Blocks",containerClassName:"block-manager-container"},command:"open-blocks"},{id:"symbols-btn",className:"symbols-btn fa-regular fa-gem",attributes:{title:"Symbols",containerClassName:"symbols-list-container"},command:"open-symbols",buttons:[{id:"symbol-create-button",className:"pages__add-page fa-solid fa-plus",label:"Create symbol from selection",command:Oe}]},{id:"page-panel-btn",className:"page-panel-btn fa fa-fw fa-file",attributes:{title:"Pages",containerClassName:"page-panel-container"},command:Kn,buttons:[{className:"pages__add-page fa fa-file",command:Yn,text:"+"}]},{id:"layer-manager-btn",className:"layer-manager-btn fa-solid fa-layer-group",attributes:{title:"Layers",containerClassName:"layer-manager-container"},command:"open-layers"},{id:"font-dialog-btn",className:"font-manager-btn fa-solid fa-font",attributes:{title:"Fonts"},command:()=>{vo.runCommand(Ce.cmdOpenFonts)}},{id:"settings-dialog-btn",className:"page-panel-btn fa-solid fa-gears",attributes:{title:"Settings"},command:gr},{id:"spacer",attributes:{},className:"project-bar-spacer"},{id:"dash2",className:"fa-solid fa-house",attributes:{title:"Dashboard"},command:()=>{window.location.href="/"}},{id:"help",className:"fa fa-fw fa-question-circle",attributes:{title:"Documentation"},command:()=>{window.open("https://docs.silex.me/","_blank")}},{id:"logout-button",className:"page-panel-btn fa fa-fw fa-sign-out",attributes:{title:"Sign out"},command:kn}]},[Qr.toString()]:{appendTo:"options",websiteId:e},[Xn.toString()]:{cmdOpenNewPageDialog:rr,cmdOpenSettings:gr,appendTo:".page-panel-container"},[M().toString()]:{enableCount:!1,enablePerformance:!1},[N()]:{appendBefore:".gjs-sm-sectors"},[Er.toString()]:{onError:t=>console.warn("Links errors:",t)},[P().toString()]:{blockLabel:"HTML",blockCustomCode:{category:ho}},[we.toString()]:{appendTo:".symbols-list-container",emptyText:"No symbol yet.",primaryColor:so,secondaryColor:ao,highlightColor:lo},[Se().toString()]:{api_key:"AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc"},[Rn.toString()]:{id:e},[Un.toString()]:{time:5e3},[Vn.toString()]:{replacedElements:t.replacedElements}}}}let vo,mo;async function yo(t){if(vo)throw new Error("Grapesjs editor already created");return new Promise(((e,n)=>{try{vo=x.init(t)}catch(t){console.error("Error initializing GrapesJs with plugins:",io,t),n(t)}["text"].forEach((t=>vo.Blocks.get(t)?.set("category","Basics"))),["image","video"].forEach((t=>vo.Blocks.get(t)?.set("category","Media"))),["map"].forEach((t=>vo.Blocks.get(t)?.set("category","Components"))),vo.Blocks.render([]),vo.Commands.add("gjs-open-import-webpage",function(t,e){const n=t.getConfig("stylePrefix"),r=t.Modal,o=t.CodeManager.getViewer("CodeMirror").clone(),i=document.createElement("div"),s=e.modalImportLabel,a=e.modalImportContent;let l=o.editor;const c=document.createElement("button");return c.type="button",c.innerHTML=e.modalImportButton,c.className=`${n}btn-prim ${n}btn-import`,c.onclick=e=>{t.setComponents(l.getValue().trim()),r.close()},o.set({codeName:"htmlmixed",theme:"hopscotch",readOnly:0,...e.importViewerOptions}),{run(u){if(!l){const t=document.createElement("textarea");if(s){const t=document.createElement("div");t.className=`${n}import-label`,t.innerHTML=s,i.appendChild(t)}i.appendChild(t),i.appendChild(c),o.init(t),l=o.editor}r.setTitle(e.modalImportTitle),r.setContent(i);const p="function"==typeof a?a(t):a;o.setContent(p||""),r.open().getModel().once("change:open",(()=>t.stopCommand(this.id))),l.refresh()},stop(){r.close()}}}(vo,{modalImportLabel:"",modalImportContent:"Paste a web page HTML code here.",modalImportButton:"Import",modalImportTitle:"Import from website"})),vo.on("load",(()=>{const t=vo.Panels.getPanel("views");t.buttons.remove("open-blocks"),t.buttons.remove("open-layers"),vo.Panels.getPanel("options").buttons.remove("export-template"),vo.Panels.getPanel("options").buttons.remove("fullscreen"),vo.BlockManager.render(null),vo.StyleManager.addProperty("extra",{extend:"filter"}),e(vo)}))}))}function bo(){return vo}class wo extends m{api=e;websiteId=new URL(location.href).searchParams.get("id")??en;storageId=new URL(location.href).searchParams.get("connectorId");lang=new URL(location.href).searchParams.get("lang")??nn;rootUrl=window.location.origin+window.location.pathname.replace(/\/$/,"");debug=!1;replacedElements=["img","video","iframe","embed","object","audio","canvas"];grapesJsConfig={plugins:[],pluginsOpts:{}};clientConfigUrl=`${this.rootUrl}/${rn}`;initGrapesConfig(){const t=go(this);this.grapesJsConfig={...this.grapesJsConfig,...t,plugins:[...this.grapesJsConfig.plugins,...t.plugins],pluginsOpts:{...this.grapesJsConfig.pluginsOpts,...t.pluginsOpts}}}getEditor(){return bo()}publicationTransformers=[qr,Rr];resetPublicationTransformers(){this.publicationTransformers=[qr]}addPublicationTransformers(t){Array.isArray(t)||(t=[t]),t.forEach((t=>{!function(t){const e=["renderComponent","renderCssRule","transformFile","transformPermalink","transformPath"];Object.keys(t).forEach((t=>{if(!e.includes(t))throw new Error(`Publication transformer: unknown property ${t}`)})),e.forEach((e=>{if("function"!=typeof t[e]&&void 0!==t[e])throw new Error(`Publication transformer: ${e} must be a function`)}))}(t)})),this.publicationTransformers=this.publicationTransformers.concat(t)}addSettings(t,e,n="last"){!function(t,e,n){const r="site"===e?pr:dr;if("first"===n)r.unshift(t);else if("last"===n)r.push(t);else{if("number"!=typeof n)throw new Error("Invalid position for settings section");r.splice(n,0,t)}}(t,e,n)}removeSettings(t,e){!function(t,e){const n="site"===e?pr:dr,r=n.findIndex((e=>e.id===t));if(-1===r)throw new Error(`Cannot find section with id ${t}`);n.splice(r,1)}(t,e)}}async function _o(t={}){mo=new wo,Object.assign(mo,t),await mo.addPlugin(mo.clientConfigUrl,{}),mo.debug&&console.warn("Silex starting in debug mode.",{config:mo}),mo.emit(ur.STARTUP_START),mo.initGrapesConfig(),mo.emit(ur.GRAPESJS_START);try{await yo(mo.grapesJsConfig)}catch(t){throw console.error("Error starting Silex",t),t}const e=bo();e.getModel().set("config",mo),mo.emit(ur.GRAPESJS_END,{editor:e}),e.I18n.setLocale(mo.lang),e.StorageManager.setAutosave(!1);try{await e.load(null)}catch(t){t.httpStatusCode}finally{setTimeout((()=>{e.editor.set("changesCount",0),e.StorageManager.setAutosave(!0),document.querySelector(".silex-loader").classList.add("silex-dialog-hide"),document.querySelector("#gjs").classList.remove("silex-dialog-hide"),mo.emit(ur.STARTUP_END,{editor:e,config:mo})}),100)}}console.info("\nSilex client loaded\n")})(),silex=r})();
@@ -1,4 +1,4 @@
1
- import { ConnectorData, PublicationJobData, PublicationSettings, WebsiteFile, WebsiteId, WebsiteSettings } from '../../types';
1
+ import { ConnectorData, PublicationData, PublicationJobData, PublicationSettings, WebsiteFile, WebsiteId, WebsiteSettings } from '../../types';
2
2
  import { Editor } from 'grapesjs';
3
3
  import { PublicationUi } from './PublicationUi';
4
4
  /**
@@ -60,6 +60,7 @@ export declare class PublicationManager {
60
60
  constructor(editor: PublishableEditor, opts: PublicationManagerOptions);
61
61
  goLogin(connector: ConnectorData): Promise<unknown>;
62
62
  goLogout(): Promise<void>;
63
+ getPublicationData(): Promise<PublicationData>;
63
64
  /**
64
65
  * Start the publication process
65
66
  * This is the command "publish"
@@ -194,25 +194,7 @@ export class PublicationManager {
194
194
  this.dialog && this.dialog.displayError(e.message, this.job, this.status);
195
195
  }
196
196
  }
197
- /**
198
- * Start the publication process
199
- * This is the command "publish"
200
- */
201
- async startPublication() {
202
- if (this.status === PublicationStatus.STATUS_PENDING)
203
- throw new Error('Publication is already in progress');
204
- this.status = PublicationStatus.STATUS_PENDING;
205
- this.job = null;
206
- this.dialog && this.dialog.displayPending(this.job, this.status);
207
- this.editor.trigger(ClientEvent.PUBLISH_START);
208
- // User and where to publish
209
- const storageUser = this.editor.getModel().get('user');
210
- if (!storageUser)
211
- throw new Error('User not logged in to a storage connector');
212
- if (!this.settings.connector?.connectorId)
213
- throw new Error('User not logged in to a hosting connector');
214
- const websiteId = this.options.websiteId;
215
- const storageId = storageUser.storage.connectorId;
197
+ async getPublicationData() {
216
198
  // Data to publish
217
199
  // See assetUrl.ts which is a default transformer, always present
218
200
  this.setPublicationTransformers();
@@ -263,9 +245,35 @@ export class PublicationManager {
263
245
  files,
264
246
  };
265
247
  this.resetPublicationTransformers();
248
+ // Let plugins transform the data
266
249
  transformFiles(this.editor, data);
267
250
  this.editor.trigger(ClientEvent.PUBLISH_DATA, data);
251
+ // Return the data
252
+ return data;
253
+ }
254
+ /**
255
+ * Start the publication process
256
+ * This is the command "publish"
257
+ */
258
+ async startPublication() {
268
259
  try {
260
+ if (this.status === PublicationStatus.STATUS_PENDING)
261
+ throw new Error('Publication is already in progress');
262
+ this.status = PublicationStatus.STATUS_PENDING;
263
+ this.job = null;
264
+ this.dialog && this.dialog.displayPending(this.job, this.status);
265
+ this.editor.trigger(ClientEvent.PUBLISH_START);
266
+ // User and where to publish
267
+ const storageUser = this.editor.getModel().get('user');
268
+ if (!storageUser)
269
+ throw new Error('User not logged in to a storage connector');
270
+ if (!this.settings.connector?.connectorId)
271
+ throw new Error('User not logged in to a hosting connector');
272
+ const websiteId = this.options.websiteId;
273
+ const storageId = storageUser.storage.connectorId;
274
+ // Get the data to publish
275
+ const data = await this.getPublicationData();
276
+ // Use the publication API
269
277
  const [url, job] = await publish({
270
278
  websiteId,
271
279
  hostingId: this.settings.connector.connectorId,
@@ -1 +1 @@
1
- {"version":3,"file":"PublicationManager.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/PublicationManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAsG,kBAAkB,EAAiB,aAAa,EAAiB,SAAS,EAAE,SAAS,EAAkH,MAAM,aAAa,CAAA;AAEvU,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC7K,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C;;;;;;;;;GASG;AAEH,YAAY;AACZ,MAAM,CAAC,MAAM,mBA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WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;SAC5H;QACD,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IAClE,CAAC;IAEO,0BAA0B;QAChC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC7B,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC;IAEO,4BAA4B;QAClC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAClC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClC,CAAC;CACF"}
@@ -1,5 +1,4 @@
1
1
  export default function (editor) {
2
- console.log('resize-panel.ts');
3
2
  editor.Panels.addPanel({
4
3
  id: 'viewsOptions',
5
4
  buttons: [{
@@ -1 +1 @@
1
- {"version":3,"file":"resize-panel.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/resize-panel.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAU,MAAM;IAC5B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;IAC9B,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACrB,EAAE,EAAE,cAAc;QAClB,OAAO,EAAE,CAAC;gBACR,EAAE,EAAE,QAAQ;gBACZ,sBAAsB;gBACtB,SAAS,EAAE,wBAAwB;gBACnC,OAAO,EAAE,cAAc;gBACvB,UAAU,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE;aACtC,CAAC;KACH,CAAC,CAAA;IACF,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE;QAClC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YACtB,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAA;QACxE,CAAC;QACD,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YACvB,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAA;QACxE,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"resize-panel.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/resize-panel.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,WAAU,MAAM;IAC5B,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACrB,EAAE,EAAE,cAAc;QAClB,OAAO,EAAE,CAAC;gBACR,EAAE,EAAE,QAAQ;gBACZ,sBAAsB;gBACtB,SAAS,EAAE,wBAAwB;gBACnC,OAAO,EAAE,cAAc;gBACvB,UAAU,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE;aACtC,CAAC;KACH,CAAC,CAAA;IACF,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE;QAClC,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YACtB,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAA;QACxE,CAAC;QACD,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;YACvB,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAA;QACxE,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -122,14 +122,8 @@ export function renderComponents(editor) {
122
122
  c.set('src', src);
123
123
  }
124
124
  c.toHTML = () => {
125
- return config.publicationTransformers.reduce((xxx, transformer) => {
126
- try {
127
- return transformer.renderComponent ? transformer.renderComponent(c, () => xxx) ?? xxx : xxx;
128
- }
129
- catch (e) {
130
- console.error('Publication transformer: error rendering component', c, e);
131
- return xxx;
132
- }
125
+ return config.publicationTransformers.reduce((html, transformer) => {
126
+ return transformer.renderComponent ? transformer.renderComponent(c, () => html) ?? html : html;
133
127
  }, initialToHTML());
134
128
  };
135
129
  c.getStyle = () => transformBgImage(editor, initialGetStyle());
@@ -150,19 +144,13 @@ export function renderCssRules(editor) {
150
144
  const initialGetStyle = style.getStyle.bind(style);
151
145
  style[ATTRIBUTE_METHOD_STORE_CSS] = style.getStyle;
152
146
  style.getStyle = () => {
153
- try {
154
- const initialStyle = transformBgImage(editor, initialGetStyle());
155
- const result = config.publicationTransformers.reduce((s, transformer) => {
156
- return {
157
- ...transformer.renderCssRule ? transformer.renderCssRule(s, () => initialStyle) ?? s : s,
158
- };
159
- }, initialStyle);
160
- return result;
161
- }
162
- catch (e) {
163
- console.error('Publication transformer: error rendering style', style, e);
164
- return initialGetStyle();
165
- }
147
+ const initialStyle = transformBgImage(editor, initialGetStyle());
148
+ const result = config.publicationTransformers.reduce((s, transformer) => {
149
+ return {
150
+ ...transformer.renderCssRule ? transformer.renderCssRule(s, () => initialStyle) ?? s : s,
151
+ };
152
+ }, initialStyle);
153
+ return result;
166
154
  };
167
155
  }
168
156
  });
@@ -189,14 +177,8 @@ export function transformFiles(editor, data) {
189
177
  const config = editor.getModel().get('config');
190
178
  data.files = config.publicationTransformers.reduce((files, transformer) => {
191
179
  return files.map((file, idx) => {
192
- try {
193
- const page = data.pages[idx] ?? null;
194
- return transformer.transformFile ? transformer.transformFile(file) ?? file : file;
195
- }
196
- catch (e) {
197
- console.error('Publication transformer: error transforming file', file, e);
198
- return file;
199
- }
180
+ const page = data.pages[idx] ?? null;
181
+ return transformer.transformFile ? transformer.transformFile(file) ?? file : file;
200
182
  });
201
183
  }, data.files);
202
184
  }
@@ -207,25 +189,13 @@ export function transformFiles(editor, data) {
207
189
  export function transformPermalink(editor, path, type, initiator) {
208
190
  const config = editor.getModel().get('config');
209
191
  return config.publicationTransformers.reduce((result, transformer) => {
210
- try {
211
- return transformer.transformPermalink ? transformer.transformPermalink(result, type, initiator) ?? result : result;
212
- }
213
- catch (e) {
214
- console.error('Publication transformer: error transforming path', result, e);
215
- return result;
216
- }
192
+ return transformer.transformPermalink ? transformer.transformPermalink(result, type, initiator) ?? result : result;
217
193
  }, path);
218
194
  }
219
195
  export function transformPath(editor, path, type) {
220
196
  const config = editor.getModel().get('config');
221
197
  return config.publicationTransformers.reduce((result, transformer) => {
222
- try {
223
- return transformer.transformPath ? transformer.transformPath(result, type) ?? result : result;
224
- }
225
- catch (e) {
226
- console.error('Publication transformer: error transforming path', result, e);
227
- return result;
228
- }
198
+ return transformer.transformPath ? transformer.transformPath(result, type) ?? result : result;
229
199
  }, path);
230
200
  }
231
201
  export function resetRenderComponents(editor) {
@@ -1 +1 @@
1
- {"version":3,"file":"publication-transformers.js","sourceRoot":"","sources":["../../../../src/ts/client/publication-transformers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAkB,kBAAkB,EAA+B,SAAS,EAAmB,MAAM,UAAU,CAAA;AACtH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B;;;;;;GAMG;AAEH,mFAAmF;AACnF,MAAM,2BAA2B,GAAG,wCAAwC,CAAA;AAC5E,MAAM,0BAA0B,GAAG,qCAAqC,CAAA;AACxE,MAAM,qCAAqC,GAAG,gDAAgD,CAAA;AAC9F,MAAM,iCAAiC,GAAG,4CAA4C,CAAA;AACtF,MAAM,2BAA2B,GAAG,sCAAsC,CAAA;AAC1E,MAAM,0BAA0B,GAAG,uCAAuC,CAAA;AAmB1E,MAAM,CAAC,MAAM,6BAA6B,GAA2B;IACnE,4DAA4D;IAC5D,eAAe,CAAC,SAAoB,EAAE,MAAoB;QACxD,OAAO,MAAM,EAAE,CAAA;IACjB,CAAC;IACD,wDAAwD;IACxD,aAAa,CAAC,IAAa,EAAE,WAAgC;QAC3D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A;YAC1C,OAAO,CAAC,CAAC,0BAA0B,CAAC,CAAA;SACrC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"publication-transformers.js","sourceRoot":"","sources":["../../../../src/ts/client/publication-transformers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAkB,kBAAkB,EAA+B,SAAS,EAAmB,MAAM,UAAU,CAAA;AACtH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B;;;;;;GAMG;AAEH,mFAAmF;AACnF,MAAM,2BAA2B,GAAG,wCAAwC,CAAA;AAC5E,MAAM,0BAA0B,GAAG,qCAAqC,CAAA;AACxE,MAAM,qCAAqC,GAAG,gDAAgD,CAAA;AAC9F,MAAM,iCAAiC,GAAG,4CAA4C,CAAA;AACtF,MAAM,2BAA2B,GAAG,sCAAsC,CAAA;AAC1E,MAAM,0BAA0B,GAAG,uCAAuC,CAAA;AAmB1E,MAAM,CAAC,MAAM,6BAA6B,GAA2B;IACnE,4DAA4D;IAC5D,eAAe,CAAC,SAAoB,EAAE,MAAoB;QACxD,OAAO,MAAM,EAAE,CAAA;IACjB,CAAC;IACD,wDAAwD;IACxD,aAAa,CAAC,IAAa,EAAE,WAAgC;QAC3D,OAAO,WAAW,EAAE,CAAA;IACtB,CAAC;IACD,mCAAmC;IACnC,aAAa,CAAC,IAAY,EAAE,IAAwB;QAClD,OAAO,IAAI,CAAA;IACb,CAAC;IACD,oBAAoB;IACpB,kBAAkB,CAAC,IAAY,EAAE,IAAwB,EAAE,SAAoB;QAC7E,QAAO,SAAS,EAAE;YAClB,KAAK,SAAS,CAAC,IAAI;gBACjB,OAAO,IAAI,CAAA;YACb,KAAK,SAAS,CAAC,GAAG;gBAChB,gEAAgE;gBAChE,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAA;YACxC;gBACE,MAAM,IAAI,KAAK,CAAC,qBAAqB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AC,CAAC,QAAQ,GAAG,CAAC,CAAC,0BAA0B,CAAC,CAAA;YAC1C,OAAO,CAAC,CAAC,0BAA0B,CAAC,CAAA;SACrC;IACH,CAAC,CAAC,CAAA;AACJ,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.141",
4
+ "version": "3.0.0-alpha.142",
5
5
  "version:backwardcompat": "3.0.0",
6
6
  "author": {
7
7
  "name": "Alex Hoyau",
@@ -78,7 +78,7 @@
78
78
  "release": "",
79
79
  "watch": "npm-watch",
80
80
  "start": "node dist/server/server/",
81
- "start:debug": "cross-env SILEX_FS_ROOT=`pwd`/.silex cross-env SILEX_DEBUG=true nodemon --watch dist/server dist/server/server/",
81
+ "start:debug": "cross-env SILEX_FS_ROOT=`pwd`/.silex cross-env SILEX_DEBUG=true SILEX_CLIENT_CONFIG=examples/client-config-transformers.js nodemon --watch dist/server dist/server/server/",
82
82
  "prepublishOnly": "$npm_execpath run lint && $npm_execpath test && $npm_execpath run build",
83
83
  "preversion": "$npm_execpath run prepublishOnly",
84
84
  "build": "run-s build:css:release build:html build:client:release build:server:release build:plugins:client build:plugins:server",
@@ -211,22 +211,7 @@ export class PublicationManager {
211
211
  }
212
212
  }
213
213
 
214
- /**
215
- * Start the publication process
216
- * This is the command "publish"
217
- */
218
- async startPublication() {
219
- if (this.status === PublicationStatus.STATUS_PENDING) throw new Error('Publication is already in progress')
220
- this.status = PublicationStatus.STATUS_PENDING
221
- this.job = null
222
- this.dialog && this.dialog.displayPending(this.job, this.status)
223
- this.editor.trigger(ClientEvent.PUBLISH_START)
224
- // User and where to publish
225
- const storageUser = this.editor.getModel().get('user') as ConnectorUser
226
- if(!storageUser) throw new Error('User not logged in to a storage connector')
227
- if(!this.settings.connector?.connectorId) throw new Error('User not logged in to a hosting connector')
228
- const websiteId = this.options.websiteId
229
- const storageId = storageUser.storage.connectorId
214
+ async getPublicationData(): Promise<PublicationData> {
230
215
  // Data to publish
231
216
  // See assetUrl.ts which is a default transformer, always present
232
217
  this.setPublicationTransformers()
@@ -277,9 +262,33 @@ export class PublicationManager {
277
262
  files,
278
263
  }
279
264
  this.resetPublicationTransformers()
265
+ // Let plugins transform the data
280
266
  transformFiles(this.editor, data)
281
267
  this.editor.trigger(ClientEvent.PUBLISH_DATA, data)
268
+ // Return the data
269
+ return data
270
+ }
271
+
272
+ /**
273
+ * Start the publication process
274
+ * This is the command "publish"
275
+ */
276
+ async startPublication() {
282
277
  try {
278
+ if (this.status === PublicationStatus.STATUS_PENDING) throw new Error('Publication is already in progress')
279
+ this.status = PublicationStatus.STATUS_PENDING
280
+ this.job = null
281
+ this.dialog && this.dialog.displayPending(this.job, this.status)
282
+ this.editor.trigger(ClientEvent.PUBLISH_START)
283
+ // User and where to publish
284
+ const storageUser = this.editor.getModel().get('user') as ConnectorUser
285
+ if(!storageUser) throw new Error('User not logged in to a storage connector')
286
+ if(!this.settings.connector?.connectorId) throw new Error('User not logged in to a hosting connector')
287
+ const websiteId = this.options.websiteId
288
+ const storageId = storageUser.storage.connectorId
289
+ // Get the data to publish
290
+ const data = await this.getPublicationData()
291
+ // Use the publication API
283
292
  const [url, job] = await publish({
284
293
  websiteId,
285
294
  hostingId: this.settings.connector.connectorId,
@@ -1,5 +1,4 @@
1
1
  export default function(editor) {
2
- console.log('resize-panel.ts')
3
2
  editor.Panels.addPanel({
4
3
  id: 'viewsOptions',
5
4
  buttons: [{
@@ -148,13 +148,8 @@ export function renderComponents(editor: Editor) {
148
148
  c.set('src', src)
149
149
  }
150
150
  c.toHTML = () => {
151
- return config.publicationTransformers.reduce((xxx: string, transformer: PublicationTransformer) => {
152
- try {
153
- return transformer.renderComponent ? transformer.renderComponent(c, () => xxx) ?? xxx : xxx
154
- } catch (e) {
155
- console.error('Publication transformer: error rendering component', c, e)
156
- return xxx
157
- }
151
+ return config.publicationTransformers.reduce((html: string, transformer: PublicationTransformer) => {
152
+ return transformer.renderComponent ? transformer.renderComponent(c, () => html) ?? html : html
158
153
  }, initialToHTML())
159
154
  }
160
155
  c.getStyle = () => transformBgImage(editor, initialGetStyle())
@@ -175,18 +170,13 @@ export function renderCssRules(editor: Editor) {
175
170
  const initialGetStyle = style.getStyle.bind(style)
176
171
  style[ATTRIBUTE_METHOD_STORE_CSS] = style.getStyle
177
172
  style.getStyle = () => {
178
- try {
179
- const initialStyle = transformBgImage(editor, initialGetStyle())
180
- const result = config.publicationTransformers.reduce((s: CssRule, transformer: PublicationTransformer) => {
181
- return {
182
- ...transformer.renderCssRule ? transformer.renderCssRule(s, () => initialStyle) ?? s : s,
183
- }
184
- }, initialStyle)
185
- return result
186
- } catch (e) {
187
- console.error('Publication transformer: error rendering style', style, e)
188
- return initialGetStyle()
189
- }
173
+ const initialStyle = transformBgImage(editor, initialGetStyle())
174
+ const result = config.publicationTransformers.reduce((s: CssRule, transformer: PublicationTransformer) => {
175
+ return {
176
+ ...transformer.renderCssRule ? transformer.renderCssRule(s, () => initialStyle) ?? s : s,
177
+ }
178
+ }, initialStyle)
179
+ return result
190
180
  }
191
181
  }
192
182
  })
@@ -215,13 +205,8 @@ export function transformFiles(editor: Editor, data: PublicationData) {
215
205
  const config = editor.getModel().get('config')
216
206
  data.files = config.publicationTransformers.reduce((files: ClientSideFile[], transformer: PublicationTransformer) => {
217
207
  return files.map((file, idx) => {
218
- try {
219
- const page = data.pages[idx] ?? null
220
- return transformer.transformFile ? transformer.transformFile(file) as ClientSideFile ?? file : file
221
- } catch (e) {
222
- console.error('Publication transformer: error transforming file', file, e)
223
- return file
224
- }
208
+ const page = data.pages[idx] ?? null
209
+ return transformer.transformFile ? transformer.transformFile(file) as ClientSideFile ?? file : file
225
210
  })
226
211
  }, data.files)
227
212
  }
@@ -233,24 +218,14 @@ export function transformFiles(editor: Editor, data: PublicationData) {
233
218
  export function transformPermalink(editor: Editor, path: string, type: ClientSideFileType, initiator: Initiator): string {
234
219
  const config = editor.getModel().get('config')
235
220
  return config.publicationTransformers.reduce((result: string, transformer: PublicationTransformer) => {
236
- try {
237
- return transformer.transformPermalink ? transformer.transformPermalink(result, type, initiator) ?? result : result
238
- } catch (e) {
239
- console.error('Publication transformer: error transforming path', result, e)
240
- return result
241
- }
221
+ return transformer.transformPermalink ? transformer.transformPermalink(result, type, initiator) ?? result : result
242
222
  }, path)
243
223
  }
244
224
 
245
225
  export function transformPath(editor: Editor, path: string, type: ClientSideFileType): string {
246
226
  const config = editor.getModel().get('config')
247
227
  return config.publicationTransformers.reduce((result: string, transformer: PublicationTransformer) => {
248
- try {
249
- return transformer.transformPath ? transformer.transformPath(result, type) ?? result : result
250
- } catch (e) {
251
- console.error('Publication transformer: error transforming path', result, e)
252
- return result
253
- }
228
+ return transformer.transformPath ? transformer.transformPath(result, type) ?? result : result
254
229
  }, path)
255
230
  }
256
231