@silexlabs/silex 3.0.0-alpha.132 → 3.0.0-alpha.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/client/grapesjs/resize-panel.d.ts +1 -0
- package/dist/client/css/admin.css +21 -6
- package/dist/client/js/main.js +2 -2
- package/dist/plugins/client/client/grapesjs/index.js +2 -0
- package/dist/plugins/client/client/grapesjs/index.js.map +1 -1
- package/dist/plugins/client/client/grapesjs/resize-panel.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/resize-panel.js +22 -0
- package/dist/plugins/client/client/grapesjs/resize-panel.js.map +1 -0
- package/dist/server/server/api/websiteApi.js +0 -1
- package/package.json +1 -1
- package/src/css/_variables.scss +2 -1
- package/src/css/footer.scss +1 -1
- package/src/css/grapesjs.scss +9 -2
- package/src/css/silex.scss +13 -0
- package/src/ts/client/grapesjs/index.ts +2 -0
- package/src/ts/client/grapesjs/resize-panel.ts +21 -0
- package/src/ts/server/api/websiteApi.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (editor: any): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
1
2
|
/* Normalize css */
|
|
2
3
|
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
|
|
3
4
|
/* Document
|
|
@@ -315,6 +316,7 @@ template {
|
|
|
315
316
|
--quaternaryColor: #A291FF;
|
|
316
317
|
--darkerPrimaryColor: #292929;
|
|
317
318
|
--lighterPrimaryColor: #575757;
|
|
319
|
+
--viewsPanelWidth: 25%;
|
|
318
320
|
}
|
|
319
321
|
|
|
320
322
|
/* stylelint-disable */
|
|
@@ -3863,6 +3865,15 @@ See http://bgrins.github.io/spectrum/themes/ for instructions.
|
|
|
3863
3865
|
width: 100%;
|
|
3864
3866
|
}
|
|
3865
3867
|
|
|
3868
|
+
.silex-workspace .gjs-pn-viewsOptions {
|
|
3869
|
+
z-index: 9999;
|
|
3870
|
+
right: 0;
|
|
3871
|
+
left: auto;
|
|
3872
|
+
}
|
|
3873
|
+
.silex-workspace .gjs-pn-viewsOptions .viewsOptions__size-btn::before {
|
|
3874
|
+
content: "←";
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3866
3877
|
.silex-hidden {
|
|
3867
3878
|
/* do not really hide, because it breaks the code editor init in the site settings + for animation */
|
|
3868
3879
|
visibility: hidden;
|
|
@@ -4084,7 +4095,7 @@ form.silex-form .silex-form__group.col2 {
|
|
|
4084
4095
|
.gjs-pn-footer {
|
|
4085
4096
|
bottom: 0;
|
|
4086
4097
|
left: 35px;
|
|
4087
|
-
right:
|
|
4098
|
+
right: var(--viewsPanelWidth);
|
|
4088
4099
|
display: flex;
|
|
4089
4100
|
justify-content: space-between;
|
|
4090
4101
|
align-items: center;
|
|
@@ -4534,7 +4545,7 @@ iframe.enable-squeeze.silex-squeeze-left {
|
|
|
4534
4545
|
}
|
|
4535
4546
|
|
|
4536
4547
|
.gjs-cv-canvas {
|
|
4537
|
-
width: calc(
|
|
4548
|
+
width: calc(100% - var(--viewsPanelWidth) - 35px);
|
|
4538
4549
|
}
|
|
4539
4550
|
|
|
4540
4551
|
.gjs-pn-devices-c {
|
|
@@ -4544,10 +4555,6 @@ iframe.enable-squeeze.silex-squeeze-left {
|
|
|
4544
4555
|
display: none;
|
|
4545
4556
|
}
|
|
4546
4557
|
|
|
4547
|
-
.gjs-pn-views-container {
|
|
4548
|
-
width: 15%;
|
|
4549
|
-
}
|
|
4550
|
-
|
|
4551
4558
|
.gjs-editor {
|
|
4552
4559
|
font-family: "Ubuntu", sans-serif;
|
|
4553
4560
|
font-size: 0.75rem;
|
|
@@ -4583,6 +4590,14 @@ iframe.enable-squeeze.silex-squeeze-left {
|
|
|
4583
4590
|
justify-content: unset;
|
|
4584
4591
|
}
|
|
4585
4592
|
|
|
4593
|
+
.gjs-pn-views-container, .gjs-pn-views {
|
|
4594
|
+
width: var(--viewsPanelWidth);
|
|
4595
|
+
}
|
|
4596
|
+
|
|
4597
|
+
.gjs-pn-options {
|
|
4598
|
+
right: var(--viewsPanelWidth);
|
|
4599
|
+
}
|
|
4600
|
+
|
|
4586
4601
|
/*
|
|
4587
4602
|
*/
|
|
4588
4603
|
.gjs-editor-cont .fa {
|
package/dist/client/js/main.js
CHANGED
|
@@ -379,7 +379,7 @@ var silex;(()=>{var t={99:function(t){"undefined"!=typeof globalThis?globalThis:
|
|
|
379
379
|
@click=${()=>this.editor.Commands.stop(Tr)}
|
|
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,Zr.STATUS_NONE)}}function Ar(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}const Pr="tmp-pre-publication-transformer-tohtml",jr="tmp-pre-publication-transformer-src",Mr="tmp-pre-publication-transformer-attributes-src",Lr="tmp-pre-publication-transformer-inline-css",Nr="tmp-pre-publication-transformer-href",Ir="tmp-pre-publication-transformer-tocss",Dr={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 $r(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${Rr(t,r,Ae.ASSET,Pe.CSS)})`}:e}function Rr(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 Hr(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 Fr=window.location.pathname.replace(/\/$/,""),Vr=window.location.origin;function Ur(t,e,n){if(t.startsWith("/assets")){const r=new URL(t,Vr);return r.pathname=r.pathname.replace(/^\/assets/,""),r.pathname=`${Fr}${on}${vn}${Cn}${r.pathname}`,r.searchParams.set("websiteId",e),r.searchParams.set("connectorId",n),`${decodeURIComponent(r.pathname)}${r.search}`}return console.warn("storedToDisplayed: path is not a stored path",t),t}function Br(t){const e=`${Fr}${on}${vn}${Cn}`;if(t.startsWith(e)){const n=new URL(t,Vr);n.pathname=n.pathname.replace(new RegExp(`^${e}`),""),n.pathname=`${Fr}/assets${n.pathname}`,n.searchParams.delete("websiteId"),n.searchParams.delete("connectorId");const r="/"+n.toString().replace(new RegExp(`^${Vr}${Fr}`),"").replace(/^\//,"");return decodeURIComponent(r)}return console.warn("displayedToStored: path is not a displayed path",t),t}const zr={transformPath(t,e){if(e===Ae.ASSET)return Br(t)},transformPermalink(t,e){if(e===Ae.ASSET)return Br(t)}};function Wr(t,e,n){const r=t.attributes?.src?{...t,attributes:{...t.attributes,src:Ur(t.attributes.src,e,n)}}:t;return r.components&&(r.components=r.components.map((t=>Wr(t,e,n)))),r}function qr(t){const e=t.attributes?.src?{...t,attributes:{...t.attributes,src:Br(t.attributes.src)}}:t;return e.components&&(e.components=e.components.map((t=>qr(t)))),e}const Gr="publish",Kr="publish-login",Yr="publish-logout";var Zr;function Xr(t,e){t.PublicationManager=new to(t,e)}function Jr(t){switch(t){case Me.IN_PROGRESS:return Zr.STATUS_PENDING;case Me.ERROR:return Zr.STATUS_ERROR;case Me.SUCCESS:return Zr.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"}(Zr||(Zr={}));const Qr=window.location.origin+window.location.pathname.replace(/\/$/,"");class to{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Zr.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=Zr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(Gr,(()=>this.startPublication())),t.Commands.add(Kr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Yr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new kr(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=Zr.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Zr.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${Qr}${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=Zr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(lr.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Zr.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=Zr.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async startPublication(){if(this.status===Zr.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Zr.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(lr.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=Hr(this.editor,t.src,Ae.ASSET),n=Br(t.src).replace(/^\/assets\//,"");return{...t,path:e,src:n,type:Ae.ASSET}}))),s={...r,assets:r.assets.map((t=>({...t,src:Br(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(lr.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=Jr(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Zr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Zr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(lr.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(lr.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=xr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=Rr(this.editor,s,Ae.CSS,Pe.HTML),c=Hr(this.editor,s,Ae.CSS),u=Hr(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=Jr(this.job.status)}catch(t){return this.status=Zr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(lr.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(lr.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===Me.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(lr.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");Ar(t,(n=>{if(n.get(Pr))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Pr]=n.toHTML;const o=n.getStyle.bind(n);n[Lr]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Nr]=i,n.set("attributes",{...n.get("attributes"),href:Rr(t,i,Ae.HTML,Pe.HTML)})),n.get("attributes").src){n[jr]=n.get("attributes").src;const e=Rr(t,n.get("attributes").src,Ae.ASSET,Pe.HTML);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[Mr]=n.get("src");const e=Rr(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=()=>$r(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[Ir])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[Ir]=n.getStyle,n.getStyle=()=>{try{const n=$r(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){Ar(t,(t=>{t[Pr]&&(t.toHTML=t[Pr],delete t[Pr]),t[Lr]&&(t.getStyle=t[Lr],delete t[Lr]),t[jr]&&(t.set("attributes",{...t.get("attributes"),src:t[jr]}),delete t[jr]),t[Mr]&&(t.set("src",t[Mr]),delete t[Mr]),t[Nr]&&(t.set("attributes",{...t.get("attributes"),href:t[Nr]}),delete t[Nr])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[Ir]&&(t.getStyle=t[Ir],delete t[Ir])}))}(this.editor)}}const eo="fa fa-fw fa-paste silex-button",no=" disabled",ro=[{name:"./project-bar",value:or},{name:"grapesjs-style-bg",value:Wn()},{name:"./settings",value:(t,e)=>{try{hr="3.0.0-alpha.132"}catch(t){}console.info("Silex version:",hr),t.Commands.add(fr,{run:(e,n,{page:r})=>{dr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n?.set&&n.set("active",0),t.stopCommand(fr)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r);const o=sr(n)?cr:ur;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,Zr.STATUS_NONE)}}function Ar(t,e){t.Pages.getAll().forEach((t=>{t.getMainComponent().onAll((t=>e(t)))}))}const Pr="tmp-pre-publication-transformer-tohtml",jr="tmp-pre-publication-transformer-src",Mr="tmp-pre-publication-transformer-attributes-src",Lr="tmp-pre-publication-transformer-inline-css",Nr="tmp-pre-publication-transformer-href",Ir="tmp-pre-publication-transformer-tocss",Dr={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 $r(t,e){const n=e["background-image"],r=n?.match(/url\(["']?(.*?)["']?\)/)?.pop();return r?{...e,"background-image":`url(${Rr(t,r,Ae.ASSET,Pe.CSS)})`}:e}function Rr(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 Hr(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 Fr=window.location.pathname.replace(/\/$/,""),Vr=window.location.origin;function Ur(t,e,n){if(t.startsWith("/assets")){const r=new URL(t,Vr);return r.pathname=r.pathname.replace(/^\/assets/,""),r.pathname=`${Fr}${on}${vn}${Cn}${r.pathname}`,r.searchParams.set("websiteId",e),r.searchParams.set("connectorId",n),`${decodeURIComponent(r.pathname)}${r.search}`}return console.warn("storedToDisplayed: path is not a stored path",t),t}function Br(t){const e=`${Fr}${on}${vn}${Cn}`;if(t.startsWith(e)){const n=new URL(t,Vr);n.pathname=n.pathname.replace(new RegExp(`^${e}`),""),n.pathname=`${Fr}/assets${n.pathname}`,n.searchParams.delete("websiteId"),n.searchParams.delete("connectorId");const r="/"+n.toString().replace(new RegExp(`^${Vr}${Fr}`),"").replace(/^\//,"");return decodeURIComponent(r)}return console.warn("displayedToStored: path is not a displayed path",t),t}const zr={transformPath(t,e){if(e===Ae.ASSET)return Br(t)},transformPermalink(t,e){if(e===Ae.ASSET)return Br(t)}};function Wr(t,e,n){const r=t.attributes?.src?{...t,attributes:{...t.attributes,src:Ur(t.attributes.src,e,n)}}:t;return r.components&&(r.components=r.components.map((t=>Wr(t,e,n)))),r}function qr(t){const e=t.attributes?.src?{...t,attributes:{...t.attributes,src:Br(t.attributes.src)}}:t;return e.components&&(e.components=e.components.map((t=>qr(t)))),e}const Gr="publish",Kr="publish-login",Yr="publish-logout";var Zr;function Xr(t,e){t.PublicationManager=new to(t,e)}function Jr(t){switch(t){case Me.IN_PROGRESS:return Zr.STATUS_PENDING;case Me.ERROR:return Zr.STATUS_ERROR;case Me.SUCCESS:return Zr.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"}(Zr||(Zr={}));const Qr=window.location.origin+window.location.pathname.replace(/\/$/,"");class to{editor;dialog;_settings;get settings(){return this._settings}set settings(t){this._settings=t,this.dialog&&(this.dialog.settings=t)}options;job=null;status=Zr.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=Zr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login",this.job,this.status)}))})),t.Commands.add(Gr,(()=>this.startPublication())),t.Commands.add(Kr,((t,e,n)=>this.goLogin(n))),t.Commands.add(Yr,(()=>this.goLogout())),this.options.appendTo?this.dialog=new kr(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=Zr.STATUS_NONE,this.editor.store(null),void(this.dialog&&this.dialog.displayPending(this.job,this.status));this.settings={},this.status=Zr.STATUS_LOGGED_OUT,this.dialog&&this.dialog.displayPending(this.job,this.status);const e=t.connectorId,n=t.type;return window.open(t.oauthUrl||`${Qr}${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=Zr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError(r.message,this.job,this.status)):(this.editor.trigger(lr.PUBLISH_LOGIN_END),this.settings.connector=t,this.settings.options=r.options,this.status=Zr.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=Zr.STATUS_ERROR,this.dialog&&this.dialog.displayError(t.message,this.job,this.status)}}async startPublication(){if(this.status===Zr.STATUS_PENDING)throw new Error("Publication is already in progress");this.status=Zr.STATUS_PENDING,this.job=null,this.dialog&&this.dialog.displayPending(this.job,this.status),this.editor.trigger(lr.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=Hr(this.editor,t.src,Ae.ASSET),n=Br(t.src).replace(/^\/assets\//,"");return{...t,path:e,src:n,type:Ae.ASSET}}))),s={...r,assets:r.assets.map((t=>({...t,src:Br(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(lr.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=Jr(this.job.status),this.trackProgress()}catch(t){return console.error("publish error",t),401===t.code||401===t.httpStatusCode?(this.status=Zr.STATUS_LOGGED_OUT,this.settings={},this.dialog&&this.dialog.displayError("Please login.",this.job,this.status)):(this.status=Zr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status)),this.editor.trigger(lr.PUBLISH_ERROR,{success:!1,message:t.message}),void this.editor.trigger(lr.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=xr(e.get("name")),s=`/css/${i}.css`,a=`/${i}.html`,l=Rr(this.editor,s,Ae.CSS,Pe.HTML),c=Hr(this.editor,s,Ae.CSS),u=Hr(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=Jr(this.job.status)}catch(t){return this.status=Zr.STATUS_ERROR,this.dialog&&this.dialog.displayError(`An error occured, your site is not published. ${t.message}`,this.job,this.status),this.editor.trigger(lr.PUBLISH_END,{success:!1,message:t.message}),void this.editor.trigger(lr.PUBLISH_ERROR,{success:!1,message:t.message})}this.job.status===Me.IN_PROGRESS?setTimeout((()=>this.trackProgress()),2e3):this.editor.trigger(lr.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");Ar(t,(n=>{if(n.get(Pr))console.warn("Publication transformer: HTML transform already altered",n);else{const r=n.toHTML.bind(n);n[Pr]=n.toHTML;const o=n.getStyle.bind(n);n[Lr]=n.getStyle;const i=n.get("attributes").href;if(i?.startsWith("./")&&(n[Nr]=i,n.set("attributes",{...n.get("attributes"),href:Rr(t,i,Ae.HTML,Pe.HTML)})),n.get("attributes").src){n[jr]=n.get("attributes").src;const e=Rr(t,n.get("attributes").src,Ae.ASSET,Pe.HTML);n.set("attributes",{...n.get("attributes"),src:e})}if(n.get("src")){n[Mr]=n.get("src");const e=Rr(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=()=>$r(t,o())}}))}(this.editor),function(t){const e=t.getModel().get("config");t.Css.getAll().forEach((n=>{if(n[Ir])console.warn("Publication transformer: CSS transform already altered",n);else{const r=n.getStyle.bind(n);n[Ir]=n.getStyle,n.getStyle=()=>{try{const n=$r(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){Ar(t,(t=>{t[Pr]&&(t.toHTML=t[Pr],delete t[Pr]),t[Lr]&&(t.getStyle=t[Lr],delete t[Lr]),t[jr]&&(t.set("attributes",{...t.get("attributes"),src:t[jr]}),delete t[jr]),t[Mr]&&(t.set("src",t[Mr]),delete t[Mr]),t[Nr]&&(t.set("attributes",{...t.get("attributes"),href:t[Nr]}),delete t[Nr])}))}(this.editor),function(t){t.Css.getAll().forEach((t=>{t[Ir]&&(t.getStyle=t[Ir],delete t[Ir])}))}(this.editor)}}const eo="fa fa-fw fa-paste silex-button",no=" disabled",ro=[{name:"./project-bar",value:or},{name:"grapesjs-style-bg",value:Wn()},{name:"./settings",value:(t,e)=>{try{hr="3.0.0-alpha.134"}catch(t){}console.info("Silex version:",hr),t.Commands.add(fr,{run:(e,n,{page:r})=>{dr=t.Modal.open({title:r?"Page settings":"Site Settings",content:"",attributes:{class:"settings-dialog"}}).onceClose((()=>{n?.set&&n.set("active",0),t.stopCommand(fr)})),function(t,e,n=t.getModel()){const r=n.get("settings")||{};n.set("settings",r);const o=sr(n)?cr:ur;let i=o[0];Gt(At`
|
|
383
383
|
<form class="silex-form">
|
|
384
384
|
<div class="silex-help">
|
|
385
385
|
${sr(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:Or},{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:Xr},{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:Ur(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:Wr(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}${Ur(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:Br(t.src)}:t)),e.pages=e.pages.map((t=>({...t,frames:t.frames.map((t=>({...t,component:qr(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}${Br(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: </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:(t,e)=>{e={labelSrc:"Image URL",placeholderSrc:"https://example.com/image.jpg",...e},t.TraitManager.addType("src",{events:{change:"onChange"},templateInput:()=>`\n <div class="gjs-field gjs-field-trad">\n <label class="gjs-label">${e.labelSrc}</label>\n <input type="text" class="gjs-field" placeholder="${e.placeholderSrc}" />\n </div>\n `,getInputEl(){return this.inputEl||(this.inputEl=this.templateInput()),this.inputEl},onValueChange(){this.setValue(this.getInputEl().value)},setValue(t){this.getInputEl().value=t},getValue(){return this.getInputEl().value}}),t.DomComponents.addType("image",{model:{defaults:{...t.DomComponents.getType("image").model.prototype.defaults,traits:[...t.DomComponents.getType("image").model.prototype.defaults.traits.filter((t=>!["href","tag-name","src"].includes(t.name))),"src"]}}}),t.on("load",(()=>{const e=t.StyleManager.addSector("image",{name:"Image",open:!1,properties:[{label:"object-fit",property:"object-fit",type:"select",default:"",options:[{id:"",label:""},{id:"fill",label:"fill"},{id:"contain",label:"contain"},{id:"cover",label:"cover"},{id:"none",label:"none"},{id:"scale-down",label:"scale-down"},{id:"initial",label:"initial"},{id:"inherit",label:"inherit"},{id:"auto",label:"auto"}]},{label:"object-position",property:"object-position",type:"select",default:"",options:[{id:"",label:""},{id:"left top",label:"left top"},{id:"left center",label:"left center"},{id:"left bottom",label:"left bottom"},{id:"right top",label:"right top"},{id:"right center",label:"right center"},{id:"right bottom",label:"right bottom"},{id:"center top",label:"center top"},{id:"center center",label:"center center"},{id:"center bottom",label:"center bottom"},{id:"initial",label:"initial"},{id:"inherit",label:"inherit"},{id:"unset",label:"unset"}]}]},{at:1});let n=!1;t.on("component:selected",(t=>{t&&"image"===t.get("type")?n=!0:(n=!1,e.set("visible",!1))})),e.on("change:visible",((t,r)=>{e.get("visible")!==n&&e.set("visible",n)}))}))}},{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:Vn},{name:"grapesjs-style-border",value:Bn()}];ro.filter((t=>"function"!=typeof t.value)).forEach((t=>{throw new Error(`Plugin ${t.name} could not be loaded correctly (${t.value})`)}));const oo="#333333",io="#ddd",so="#8873FE",ao="#A291FF",lo="#363636",co="#575757",uo="Containers",po="Components";function fo(t,e,n){return{container:"#gjs",height:"100%",showOffsets:!0,showDevices:!0,layerManager:{appendTo:".layer-manager-container"},blockManager:{appendTo:".block-manager-container"},assetManager:{upload:`${n}${on}${vn}${Sn}/?websiteId=${t}${e?`&connectorId=${e}`:""}`},storageManager:{autoload:!1,type:"connector",options:{connector:{id:t,connectorId:e}}},cssIcons:"./css/all.min.css",canvasCss:`\n :root {\n --primaryColor: ${oo};\n --secondaryColor: ${io};\n --tertiaryColor: ${so};\n --quaternaryColor: ${ao};\n --darkerPrimaryColor: ${lo};\n --lighterPrimaryColor: ${co};\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",wr,_r]},plugins:ro.map((t=>t.value)),pluginsOpts:{[S().toString()]:{blocks:["text","image","video","map"],category:uo},[or.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:Gn,buttons:[{className:"pages__add-page fa fa-file",command:Kn,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:()=>{ho.runCommand(Ce.cmdOpenFonts)}},{id:"settings-dialog-btn",className:"page-panel-btn fa-solid fa-gears",attributes:{title:"Settings"},command:fr},{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}]},[Xr.toString()]:{appendTo:"options",websiteId:t},[Zn.toString()]:{cmdOpenNewPageDialog:nr,cmdOpenSettings:fr,appendTo:".page-panel-container"},[M().toString()]:{enableCount:!1,enablePerformance:!1},[N()]:{appendBefore:".gjs-sm-sectors"},[Or.toString()]:{onError:t=>console.warn("Links errors:",t)},[P().toString()]:{blockLabel:"HTML",blockCustomCode:{category:po}},[we.toString()]:{appendTo:".symbols-list-container",emptyText:"No symbol yet.",primaryColor:oo,secondaryColor:io,highlightColor:so},[Se().toString()]:{api_key:"AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc"},[Rn.toString()]:{id:t},[Vn.toString()]:{time:5e3}}}}let ho,go;async function vo(t){if(ho)throw new Error("Grapesjs editor already created");return new Promise(((e,n)=>{try{ho=x.init(t)}catch(t){console.error("Error initializing GrapesJs with plugins:",ro,t),n(t)}["text"].forEach((t=>ho.Blocks.get(t)?.set("category","Basics"))),["image","video"].forEach((t=>ho.Blocks.get(t)?.set("category","Media"))),["map"].forEach((t=>ho.Blocks.get(t)?.set("category","Components"))),ho.Blocks.render([]),ho.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()}}}(ho,{modalImportLabel:"",modalImportContent:"Paste a web page HTML code here.",modalImportButton:"Import",modalImportTitle:"Import from website"})),ho.on("load",(()=>{const t=ho.Panels.getPanel("views");t.buttons.remove("open-blocks"),t.buttons.remove("open-layers"),ho.Panels.getPanel("options").buttons.remove("export-template"),ho.BlockManager.render(null),ho.StyleManager.addProperty("extra",{extend:"filter"}),e(ho)}))}))}function mo(){return ho}class yo 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;grapesJsConfig={plugins:[],pluginsOpts:{}};clientConfigUrl=`${this.rootUrl}/${rn}`;initGrapesConfig(){const t=fo(this.websiteId,this.storageId,this.rootUrl);this.grapesJsConfig={...this.grapesJsConfig,...t,plugins:[...this.grapesJsConfig.plugins,...t.plugins],pluginsOpts:{...this.grapesJsConfig.pluginsOpts,...t.pluginsOpts}}}getEditor(){return mo()}publicationTransformers=[zr,Dr];resetPublicationTransformers(){this.publicationTransformers=[zr]}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?cr:ur;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?cr:ur,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 bo(t={}){go=new yo,Object.assign(go,t),await go.addPlugin(go.clientConfigUrl,{}),go.debug&&console.warn("Silex starting in debug mode.",{config:go}),go.emit(lr.STARTUP_START),go.initGrapesConfig(),go.emit(lr.GRAPESJS_START);try{await vo(go.grapesJsConfig)}catch(t){throw console.error("Error starting Silex",t),t}const e=mo();e.getModel().set("config",go),go.emit(lr.GRAPESJS_END,{editor:e}),e.I18n.setLocale(go.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"),go.emit(lr.STARTUP_END,{editor:e,config:go})}),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:Or},{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:Xr},{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:Ur(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:Wr(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}${Ur(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:Br(t.src)}:t)),e.pages=e.pages.map((t=>({...t,frames:t.frames.map((t=>({...t,component:qr(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}${Br(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: </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:(t,e)=>{e={labelSrc:"Image URL",placeholderSrc:"https://example.com/image.jpg",...e},t.TraitManager.addType("src",{events:{change:"onChange"},templateInput:()=>`\n <div class="gjs-field gjs-field-trad">\n <label class="gjs-label">${e.labelSrc}</label>\n <input type="text" class="gjs-field" placeholder="${e.placeholderSrc}" />\n </div>\n `,getInputEl(){return this.inputEl||(this.inputEl=this.templateInput()),this.inputEl},onValueChange(){this.setValue(this.getInputEl().value)},setValue(t){this.getInputEl().value=t},getValue(){return this.getInputEl().value}}),t.DomComponents.addType("image",{model:{defaults:{...t.DomComponents.getType("image").model.prototype.defaults,traits:[...t.DomComponents.getType("image").model.prototype.defaults.traits.filter((t=>!["href","tag-name","src"].includes(t.name))),"src"]}}}),t.on("load",(()=>{const e=t.StyleManager.addSector("image",{name:"Image",open:!1,properties:[{label:"object-fit",property:"object-fit",type:"select",default:"",options:[{id:"",label:""},{id:"fill",label:"fill"},{id:"contain",label:"contain"},{id:"cover",label:"cover"},{id:"none",label:"none"},{id:"scale-down",label:"scale-down"},{id:"initial",label:"initial"},{id:"inherit",label:"inherit"},{id:"auto",label:"auto"}]},{label:"object-position",property:"object-position",type:"select",default:"",options:[{id:"",label:""},{id:"left top",label:"left top"},{id:"left center",label:"left center"},{id:"left bottom",label:"left bottom"},{id:"right top",label:"right top"},{id:"right center",label:"right center"},{id:"right bottom",label:"right bottom"},{id:"center top",label:"center top"},{id:"center center",label:"center center"},{id:"center bottom",label:"center bottom"},{id:"initial",label:"initial"},{id:"inherit",label:"inherit"},{id:"unset",label:"unset"}]}]},{at:1});let n=!1;t.on("component:selected",(t=>{t&&"image"===t.get("type")?n=!0:(n=!1,e.set("visible",!1))})),e.on("change:visible",((t,r)=>{e.get("visible")!==n&&e.set("visible",n)}))}))}},{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:Vn},{name:"grapesjs-style-border",value:Bn()},{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%")}})}}];ro.filter((t=>"function"!=typeof t.value)).forEach((t=>{throw new Error(`Plugin ${t.name} could not be loaded correctly (${t.value})`)}));const oo="#333333",io="#ddd",so="#8873FE",ao="#A291FF",lo="#363636",co="#575757",uo="Containers",po="Components";function fo(t,e,n){return{container:"#gjs",height:"100%",showOffsets:!0,showDevices:!0,layerManager:{appendTo:".layer-manager-container"},blockManager:{appendTo:".block-manager-container"},assetManager:{upload:`${n}${on}${vn}${Sn}/?websiteId=${t}${e?`&connectorId=${e}`:""}`},storageManager:{autoload:!1,type:"connector",options:{connector:{id:t,connectorId:e}}},cssIcons:"./css/all.min.css",canvasCss:`\n :root {\n --primaryColor: ${oo};\n --secondaryColor: ${io};\n --tertiaryColor: ${so};\n --quaternaryColor: ${ao};\n --darkerPrimaryColor: ${lo};\n --lighterPrimaryColor: ${co};\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",wr,_r]},plugins:ro.map((t=>t.value)),pluginsOpts:{[S().toString()]:{blocks:["text","image","video","map"],category:uo},[or.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:Gn,buttons:[{className:"pages__add-page fa fa-file",command:Kn,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:()=>{ho.runCommand(Ce.cmdOpenFonts)}},{id:"settings-dialog-btn",className:"page-panel-btn fa-solid fa-gears",attributes:{title:"Settings"},command:fr},{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}]},[Xr.toString()]:{appendTo:"options",websiteId:t},[Zn.toString()]:{cmdOpenNewPageDialog:nr,cmdOpenSettings:fr,appendTo:".page-panel-container"},[M().toString()]:{enableCount:!1,enablePerformance:!1},[N()]:{appendBefore:".gjs-sm-sectors"},[Or.toString()]:{onError:t=>console.warn("Links errors:",t)},[P().toString()]:{blockLabel:"HTML",blockCustomCode:{category:po}},[we.toString()]:{appendTo:".symbols-list-container",emptyText:"No symbol yet.",primaryColor:oo,secondaryColor:io,highlightColor:so},[Se().toString()]:{api_key:"AIzaSyAdJTYSLPlKz4w5Iqyy-JAF2o8uQKd1FKc"},[Rn.toString()]:{id:t},[Vn.toString()]:{time:5e3}}}}let ho,go;async function vo(t){if(ho)throw new Error("Grapesjs editor already created");return new Promise(((e,n)=>{try{ho=x.init(t)}catch(t){console.error("Error initializing GrapesJs with plugins:",ro,t),n(t)}["text"].forEach((t=>ho.Blocks.get(t)?.set("category","Basics"))),["image","video"].forEach((t=>ho.Blocks.get(t)?.set("category","Media"))),["map"].forEach((t=>ho.Blocks.get(t)?.set("category","Components"))),ho.Blocks.render([]),ho.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()}}}(ho,{modalImportLabel:"",modalImportContent:"Paste a web page HTML code here.",modalImportButton:"Import",modalImportTitle:"Import from website"})),ho.on("load",(()=>{const t=ho.Panels.getPanel("views");t.buttons.remove("open-blocks"),t.buttons.remove("open-layers"),ho.Panels.getPanel("options").buttons.remove("export-template"),ho.BlockManager.render(null),ho.StyleManager.addProperty("extra",{extend:"filter"}),e(ho)}))}))}function mo(){return ho}class yo 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;grapesJsConfig={plugins:[],pluginsOpts:{}};clientConfigUrl=`${this.rootUrl}/${rn}`;initGrapesConfig(){const t=fo(this.websiteId,this.storageId,this.rootUrl);this.grapesJsConfig={...this.grapesJsConfig,...t,plugins:[...this.grapesJsConfig.plugins,...t.plugins],pluginsOpts:{...this.grapesJsConfig.pluginsOpts,...t.pluginsOpts}}}getEditor(){return mo()}publicationTransformers=[zr,Dr];resetPublicationTransformers(){this.publicationTransformers=[zr]}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?cr:ur;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?cr:ur,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 bo(t={}){go=new yo,Object.assign(go,t),await go.addPlugin(go.clientConfigUrl,{}),go.debug&&console.warn("Silex starting in debug mode.",{config:go}),go.emit(lr.STARTUP_START),go.initGrapesConfig(),go.emit(lr.GRAPESJS_START);try{await vo(go.grapesJsConfig)}catch(t){throw console.error("Error starting Silex",t),t}const e=mo();e.getModel().set("config",go),go.emit(lr.GRAPESJS_END,{editor:e}),e.I18n.setLocale(go.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"),go.emit(lr.STARTUP_END,{editor:e,config:go})}),100)}}console.info("\nSilex client loaded\n")})(),silex=r})();
|
|
@@ -41,6 +41,7 @@ import cssPropsPlugin from './css-props';
|
|
|
41
41
|
import rateLimitPlugin from '@silexlabs/grapesjs-storage-rate-limit';
|
|
42
42
|
import borderPugin from 'grapesjs-style-border';
|
|
43
43
|
import backgroundPlugin from 'grapesjs-style-bg';
|
|
44
|
+
import resizePanelPlugin from './resize-panel';
|
|
44
45
|
import { pagePanelPlugin, cmdTogglePages, cmdAddPage } from './page-panel';
|
|
45
46
|
import { newPageDialog, cmdOpenNewPageDialog } from './new-page-dialog';
|
|
46
47
|
import { projectBarPlugin } from './project-bar';
|
|
@@ -83,6 +84,7 @@ const plugins = [
|
|
|
83
84
|
{ name: './footer', value: footerPlugin },
|
|
84
85
|
{ name: '@silexlabs/grapesjs-storage-rate-limit', value: rateLimitPlugin },
|
|
85
86
|
{ name: 'grapesjs-style-border', value: borderPugin },
|
|
87
|
+
{ name: './resize-panel', value: resizePanelPlugin }
|
|
86
88
|
];
|
|
87
89
|
// Check that all plugins are loaded correctly
|
|
88
90
|
plugins
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ts/client/grapesjs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,QAAwD,MAAM,UAAU,CAAA;AAC/E,OAAO,UAAU,MAAM,cAAc,CAAA;AAErC;;;GAGG;AAEH,uBAAuB;AACvB,UAAU;AACV,uBAAuB;AACvB,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AACrD,OAAO,iBAAiB,MAAM,uBAAuB,CAAA;AACrD,OAAO,UAAU,MAAM,uBAAuB,CAAA;AAC9C,OAAO,UAAU,MAAM,sBAAsB,CAAA;AA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CAAA;YACnC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;YAEnC,yBAAyB;YACzB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAA;YAEnE,kDAAkD;YAClD,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAEhC,8BAA8B;YAC9B,MAAM,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAA;YAE9D,2BAA2B;YAC3B,OAAO,CAAC,MAAM,CAAC,CAAA;QACjB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function (editor: any): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default function (editor) {
|
|
2
|
+
console.log('resize-panel.ts');
|
|
3
|
+
editor.Panels.addPanel({
|
|
4
|
+
id: 'viewsOptions',
|
|
5
|
+
buttons: [{
|
|
6
|
+
id: 'resize',
|
|
7
|
+
// icon for arrow left
|
|
8
|
+
className: 'viewsOptions__size-btn',
|
|
9
|
+
command: 'resize-panel',
|
|
10
|
+
attributes: { title: 'Resize panel' },
|
|
11
|
+
}],
|
|
12
|
+
});
|
|
13
|
+
editor.Commands.add('resize-panel', {
|
|
14
|
+
run: (editor, sender) => {
|
|
15
|
+
document.documentElement.style.setProperty('--viewsPanelWidth', '40%');
|
|
16
|
+
},
|
|
17
|
+
stop: (editor, sender) => {
|
|
18
|
+
document.documentElement.style.setProperty('--viewsPanelWidth', '20%');
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=resize-panel.js.map
|
|
@@ -0,0 +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"}
|
package/package.json
CHANGED
package/src/css/_variables.scss
CHANGED
|
@@ -11,7 +11,7 @@ $topBarHeight: 40px;
|
|
|
11
11
|
$projectBarWidth: 35px;
|
|
12
12
|
$projectPanelWidth: 13%;
|
|
13
13
|
$projectPanelMinWidth: 150px;
|
|
14
|
-
$viewsPanelWidth:
|
|
14
|
+
$viewsPanelWidth: 25%; // 15% is grapesjs default
|
|
15
15
|
$footerHeight: 30px;
|
|
16
16
|
$transitionSpeedMedium: .15s;
|
|
17
17
|
$transitionSpeedSlow: .30s;
|
|
@@ -30,4 +30,5 @@ $fontFamily: 'Ubuntu', sans-serif;
|
|
|
30
30
|
--quaternaryColor: #{$quaternaryColor};
|
|
31
31
|
--darkerPrimaryColor: #{$darkerPrimaryColor};
|
|
32
32
|
--lighterPrimaryColor: #{$lighterPrimaryColor};
|
|
33
|
+
--viewsPanelWidth: #{$viewsPanelWidth};
|
|
33
34
|
}
|
package/src/css/footer.scss
CHANGED
package/src/css/grapesjs.scss
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
left: auto;
|
|
37
37
|
}
|
|
38
38
|
.#{$cv-prefix}canvas {
|
|
39
|
-
width: calc(100% -
|
|
39
|
+
width: calc(100% - var(--viewsPanelWidth) - $projectBarWidth);
|
|
40
40
|
}
|
|
41
41
|
.#{$pn-prefix}devices-c {
|
|
42
42
|
display: flex;
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
.#{$pn-prefix}views-container {
|
|
48
|
-
width: $viewsPanelWidth;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
.gjs-editor {
|
|
@@ -83,6 +82,14 @@
|
|
|
83
82
|
justify-content: unset;
|
|
84
83
|
}
|
|
85
84
|
|
|
85
|
+
.gjs-pn-views-container, .gjs-pn-views {
|
|
86
|
+
width: var(--viewsPanelWidth);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.gjs-pn-options {
|
|
90
|
+
right: var(--viewsPanelWidth);
|
|
91
|
+
}
|
|
92
|
+
|
|
86
93
|
/*
|
|
87
94
|
*/
|
|
88
95
|
// Font awesome 5 fix
|
package/src/css/silex.scss
CHANGED
|
@@ -29,6 +29,19 @@
|
|
|
29
29
|
width: 100%;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// Resize options panel button
|
|
33
|
+
.silex-workspace {
|
|
34
|
+
.gjs-pn-viewsOptions {
|
|
35
|
+
z-index: 9999;
|
|
36
|
+
right: 0;
|
|
37
|
+
left: auto;
|
|
38
|
+
|
|
39
|
+
.viewsOptions__size-btn::before {
|
|
40
|
+
content: '←';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
32
45
|
.silex-hidden {
|
|
33
46
|
/* do not really hide, because it breaks the code editor init in the site settings + for animation */
|
|
34
47
|
visibility: hidden;
|
|
@@ -44,6 +44,7 @@ import cssPropsPlugin from './css-props'
|
|
|
44
44
|
import rateLimitPlugin from '@silexlabs/grapesjs-storage-rate-limit'
|
|
45
45
|
import borderPugin from 'grapesjs-style-border'
|
|
46
46
|
import backgroundPlugin from 'grapesjs-style-bg'
|
|
47
|
+
import resizePanelPlugin from './resize-panel'
|
|
47
48
|
|
|
48
49
|
import { pagePanelPlugin, cmdTogglePages, cmdAddPage } from './page-panel'
|
|
49
50
|
import { newPageDialog, cmdOpenNewPageDialog } from './new-page-dialog'
|
|
@@ -89,6 +90,7 @@ const plugins = [
|
|
|
89
90
|
{name: './footer', value: footerPlugin},
|
|
90
91
|
{name: '@silexlabs/grapesjs-storage-rate-limit', value: rateLimitPlugin},
|
|
91
92
|
{name: 'grapesjs-style-border', value: borderPugin},
|
|
93
|
+
{name: './resize-panel', value: resizePanelPlugin}
|
|
92
94
|
]
|
|
93
95
|
// Check that all plugins are loaded correctly
|
|
94
96
|
plugins
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default function(editor) {
|
|
2
|
+
console.log('resize-panel.ts')
|
|
3
|
+
editor.Panels.addPanel({
|
|
4
|
+
id: 'viewsOptions',
|
|
5
|
+
buttons: [{
|
|
6
|
+
id: 'resize',
|
|
7
|
+
// icon for arrow left
|
|
8
|
+
className: 'viewsOptions__size-btn',
|
|
9
|
+
command: 'resize-panel',
|
|
10
|
+
attributes: { title: 'Resize panel' },
|
|
11
|
+
}],
|
|
12
|
+
})
|
|
13
|
+
editor.Commands.add('resize-panel', {
|
|
14
|
+
run: (editor, sender) => {
|
|
15
|
+
document.documentElement.style.setProperty('--viewsPanelWidth', '40%')
|
|
16
|
+
},
|
|
17
|
+
stop: (editor, sender) => {
|
|
18
|
+
document.documentElement.style.setProperty('--viewsPanelWidth', '20%')
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
}
|