@grapesjs/studio-sdk-plugins 1.0.36 → 1.0.38-rc.0
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/accordionComponent/index.cjs.js +4 -4
- package/dist/accordionComponent/index.es.js +83 -70
- package/dist/accordionComponent/index.umd.js +5 -5
- package/dist/aiChat/clientToolsProcessors.d.ts +1 -2
- package/dist/aiChat/components/utils.d.ts +1 -0
- package/dist/aiChat/components/utilsTw.d.ts +11 -0
- package/dist/aiChat/index.cjs.js +85 -85
- package/dist/aiChat/index.es.js +11151 -10258
- package/dist/aiChat/index.js +85 -85
- package/dist/aiChat/index.umd.js +86 -86
- package/dist/aiChat/locales/en.d.ts +11 -0
- package/dist/aiChat/projectGeneration.d.ts +17 -0
- package/dist/aiChat/server/index.cjs.js +1 -1
- package/dist/aiChat/server/index.es.js +1 -1
- package/dist/aiChat/server/index.js +1 -1
- package/dist/aiChat/server/index.umd.js +1 -1
- package/dist/aiChat/types.d.ts +1 -1
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +57 -44
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +63 -50
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +60 -47
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +3 -3
- package/dist/canvasFullSize/index.es.js +49 -36
- package/dist/canvasFullSize/index.umd.js +5 -5
- package/dist/canvasGridMode/index.cjs.js +2 -2
- package/dist/canvasGridMode/index.es.js +251 -233
- package/dist/canvasGridMode/index.umd.js +4 -4
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +42 -29
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +3 -3
- package/dist/dataSourceEjs/index.es.js +51 -38
- package/dist/dataSourceEjs/index.umd.js +3 -3
- package/dist/dataSourceHandlebars/index.cjs.js +2 -2
- package/dist/dataSourceHandlebars/index.es.js +152 -139
- package/dist/dataSourceHandlebars/index.umd.js +4 -4
- package/dist/dialogComponent/index.cjs.js +9 -9
- package/dist/dialogComponent/index.es.js +73 -60
- package/dist/dialogComponent/index.umd.js +3 -3
- package/dist/flexComponent/index.cjs.js +6 -6
- package/dist/flexComponent/index.es.js +83 -70
- package/dist/flexComponent/index.umd.js +6 -6
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +67 -54
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +92 -79
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +52 -39
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +42 -42
- package/dist/index.es.js +1167 -1149
- package/dist/index.umd.js +42 -42
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +82 -69
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +98 -85
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +71 -58
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +3 -3
- package/dist/listPagesComponent/index.es.js +49 -36
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/presetPrintable/index.cjs.js +5 -5
- package/dist/presetPrintable/index.es.js +126 -113
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +97 -84
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +149 -137
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +92 -79
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +3 -3
- package/dist/shapeDividerComponent/index.es.js +38 -25
- package/dist/shapeDividerComponent/index.umd.js +3 -3
- package/dist/swiperComponent/index.cjs.js +5 -5
- package/dist/swiperComponent/index.es.js +106 -93
- package/dist/swiperComponent/index.umd.js +5 -5
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +167 -154
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +35 -22
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +2 -2
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";const ue="app.grapesjs.com",de="app-stage.grapesjs.com",Pe="app2.grapesjs.com",me="app-stage2.grapesjs.com",ae=[ue,Pe,de,me,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ze="license:check:end",Se=()=>typeof window<"u",xe=({isDev:t,isStage:e,isPlatform:s})=>`${t?"":`https://${e?de:ue}`}/${s?"platform-api":"api"}`,ve=()=>{const t=Se()&&window.location.hostname;return!!t&&(ae.includes(t)||ae.some(e=>t.endsWith(e)))};function Re(t){return typeof t=="function"}async function we({path:t,baseApiUrl:e,method:s="GET",headers:n={},params:a,body:i}){const l=`${e||xe({isDev:!1,isStage:!1})}${t}`,p={method:s,headers:{"Content-Type":"application/json",...n}};i&&(p.body=JSON.stringify(i));const g=a?new URLSearchParams(a).toString():"",f=g?`?${g}`:"",r=await fetch(`${l}${f}`,p);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var L=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(L||{}),W=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.dialogImportCode="studio:dialogImportCode",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.settings="studio:settings",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(W||{}),ge=(t=>(t.web="web",t.email="email",t.document="document",t.react="react",t))(ge||{});const ie={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function Ge(t){const e=t;return e.init=s=>n=>t(n,s),e}const Ce=t=>Ge(t);async function Ie({editor:t,plan:e,pluginName:s,licenseKey:n,onLicenseCheckResponse:a,cleanup:i}){let o="",l;const p=r=>{console.warn("Cleanup plugin:",s,"Reason:",r),i()},g=(r={})=>{var v;const{error:h,sdkLicense:I}=r,b=(v=r.plan)==null?void 0:v.category;if(!(I||r.license)||h)p(h||"Invalid license");else if(b){const G=ie[e],m=ie[b];G>m&&p({pluginRequiredPlan:e,licensePlan:b})}};t.Commands.has(W.settings)&&(l=t.runCommand(W.settings),o=(l==null?void 0:l.baseUrl)||"");const f=r=>{a==null||a(r),r&&g(r)};if(!l){t.onReady(async()=>{if(!ve())if(n){const r=await Ee({licenseKey:n,pluginName:s,baseApiUrl:o});f(r)}else p("The `licenseKey` option not provided")});return}if(l.licensePlan||l.licenseError){const r=Te(l);f(r);return}t.on(ze,r=>f(r))}const Te=t=>({sdkLicense:t.license,license:t.license,error:t.licenseError,plan:t.licensePlan});async function Ee(t){const{licenseKey:e,pluginName:s,baseApiUrl:n}=t;try{return(await we({baseApiUrl:n,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const he=t=>e=>{var s;return((s=e.getAttribute)==null?void 0:s.call(e,se))===t},Ae=(...t)=>e=>t.some(s=>e.is(s)),Le=(...t)=>(e,s)=>t.some(n=>s.is(n)),fe="gjs-plg-",se="data-type-role",D=class D{constructor(e){this.config=e}getSize(e){var s;return(s=this.config)!=null&&s.getSize?this.config.getSize(e):ne(e.componentColumn,D.CSS_FLEX_BASIS)}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:a,partial:i}=e;n.addStyle({[D.CSS_FLEX_BASIS]:a},{partial:i})}}};D.CSS_FLEX_BASIS="flex-basis";let K=D;const j=class j{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var s;return(s=this.config)!=null&&s.getGap?this.config.getGap(e):ne(e.componentRow,j.CSS_GAP)}setGap(e){var s;if((s=this.config)!=null&&s.setGap)this.config.setGap(e);else{const{componentRow:n,gapValue:a,partial:i}=e;n.addStyle({[j.CSS_GAP]:a},{partial:i})}}};j.CSS_GAP="gap";let J=j;const U=class U{constructor(e){this.config=e}getParentSize(e){var i;if((i=this.config)!=null&&i.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,a=s.getEl();return a?n?a.clientHeight:a.clientWidth:0}isLayoutVertical(e){var n;if((n=this.config)!=null&&n.isParentVertical)return this.config.isParentVertical(e);const s=ne(e.componentRow,U.CSS_FLEX_DIRECTION,!0);return s==="column"||s==="column-reverse"}};U.CSS_FLEX_DIRECTION="flex-direction";let q=U;const N=class N{constructor(e){this.config=e}getSize(e){var n;if((n=this.config)!=null&&n.getSize)return this.config.getSize(e);const s=e.componentColumn;if(s.is(N.MJML_COLUMN_TYPE)){const i=s.getAttributes().width;if(i&&(i.includes("%")||!isNaN(parseFloat(i))))return parseFloat(i);const o=s.parent();return 100/(o?o.components().length:1)}return 0}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:a,partial:i}=e;n.is(N.MJML_COLUMN_TYPE)&&n.addAttributes({width:`${parseFloat(a)}%`},{partial:i})}}};N.MJML_COLUMN_TYPE="mj-column";let Z=N;const X=class X{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var n;if((n=this.config)!=null&&n.getGap)return this.config.getGap(e);const{componentRow:s}=e;if(s.is(X.MJML_SECTION_TYPE)){const a=s.getAttributes();if(a&&a.padding)return parseInt(a.padding,10)||0}return 0}setGap(e){var s,n;(n=(s=this.config)==null?void 0:s.setGap)==null||n.call(s,e)}};X.MJML_SECTION_TYPE="mj-section";let Q=X;class Me{constructor(e){this.config=e}getParentSize(e){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,a=s.getEl();if(!a)return 0;let i=a;if(a.tagName!=="TABLE"){const l=a.querySelectorAll("table");l.length&&(i=l[0])}return n?i.clientHeight:i.clientWidth}isLayoutVertical(e){var s;return(s=this.config)!=null&&s.isParentVertical?this.config.isParentVertical(e):!1}}class M{constructor(){this.handlerCache=new Map}static getInstance(){return M.instance||(M.instance=new M),M.instance}getHandlers(e){const s=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(s)||($(e)?this.handlerCache.set(s,{sizeHandler:new Z(e),gapHandler:new Q(e),parentSizeHandler:new Me(e)}):this.handlerCache.set(s,{sizeHandler:new K(e),gapHandler:new J(e),parentSizeHandler:new q(e)})),this.handlerCache.get(s)}}function T(t){return M.getInstance().getHandlers(t)}const oe=t=>{t.style.display="none"},re=t=>{t.style.display="block"},H=t=>+parseFloat(`${t}`).toFixed(2),$=t=>t.projectType===ge.email,$e=t=>t?["top","bottom"]:["left","right"],He=t=>{const e=t.parent();return e?e.components().models.indexOf(t)===0:!1},Ve=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.indexOf(t)===s.length-1},De=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.length>1&&t.index()===s.length-1},je=(t,e,s,n)=>{const i=t+(s?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return i>=0&&i<n?i:-1},O=t=>t==="top"||t==="bottom",Ne=(t,e)=>!!(He(t)&&(e==="left"||e==="top")||Ve(t)&&(e==="right"||e==="bottom")),Be=t=>{const e=t.parent();return e?e.components().models.length>1:!1},le=(t,e)=>t==="right"||t==="bottom"?e>0:e<0,ne=(t,e,s=!1)=>{const n=!s,a=t.getEl();if(!a)return n?0:"";const o=window.getComputedStyle(a)[e]||"";if(n){let l;return typeof o=="string"?(l=parseFloat(o.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(o)||0,l}return o},ce=(t,e,s)=>{const n=ee({componentRow:t,isVertical:e},s),a=t.components().models;return n*(a.length-1)},B=(t,e)=>T(e).parentSizeHandler.isLayoutVertical({componentRow:t}),F=(t,e)=>T(e).sizeHandler.getSize(t),ee=(t,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:s,parentSizeHandler:n}=T(e);if(!s.isGapSupported())return 0;const a=s.getGap(t),i=n.getParentSize(t);return a/100*i},te=(t,e)=>T(e).parentSizeHandler.getParentSize(t),V=(t,e)=>{T(e).sizeHandler.setSize(t)},ye=(t,e)=>{const s=F(t,e);V({...t,sizeValue:`${s}%`,partial:!1},e)},be=(t,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:s}=T(e);s.isGapSupported()&&s.setGap(t)},Fe=(t,e)=>{const s=t.getStyle().gap;if(!s)return;const n=t.components().models,a={componentRow:t,isVertical:B(t,e)};n.map(i=>ye({...a,componentColumn:i},e)),be({...a,gapValue:String(s),partial:!1},e)};function _e(t,e){const{Blocks:s}=t,{typeColumn:n,typeRow:a,blocks:i}=e;if(i===!1||$(e))return;const o=r=>({type:a,components:r.map(h=>({type:n,style:{"flex-basis":`${h}%`}}))}),l=r=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
|
|
1
|
+
"use strict";const ue="app.grapesjs.com",de="app-stage.grapesjs.com",Pe="app2.grapesjs.com",me="app-stage2.grapesjs.com",ae=[ue,Pe,de,me,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],ze="license:check:end",Se=()=>typeof window<"u",xe=({isDev:t,isStage:e,isPlatform:s})=>`${t?"":`https://${e?de:ue}`}/${s?"platform-api":"api"}`,ve=()=>{if(!Se())return"";const{hostname:t}=window.location;if(t)return t;try{return window.parent.location.hostname||""}catch{return""}},we=()=>{const t=ve();return!!t&&(ae.includes(t)||ae.some(e=>t.endsWith(e)))};function Re(t){return typeof t=="function"}async function Ge({path:t,baseApiUrl:e,method:s="GET",headers:n={},params:a,body:i}){const l=`${e||xe({isDev:!1,isStage:!1})}${t}`,p={method:s,headers:{"Content-Type":"application/json",...n}};i&&(p.body=JSON.stringify(i));const g=a?new URLSearchParams(a).toString():"",f=g?`?${g}`:"",r=await fetch(`${l}${f}`,p);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var L=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(L||{}),W=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.dialogImportCode="studio:dialogImportCode",t.openEditCode="studio:openEditCode",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.settings="studio:settings",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(W||{}),ge=(t=>(t.web="web",t.email="email",t.document="document",t.react="react",t))(ge||{});const ie={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function Ce(t){const e=t;return e.init=s=>n=>t(n,s),e}const Ie=t=>Ce(t);async function Te({editor:t,plan:e,pluginName:s,licenseKey:n,onLicenseCheckResponse:a,cleanup:i}){let o="",l;const p=r=>{console.warn("Cleanup plugin:",s,"Reason:",r),i()},g=(r={})=>{var v;const{error:h,sdkLicense:I}=r,b=(v=r.plan)==null?void 0:v.category;if(!(I||r.license)||h)p(h||"Invalid license");else if(b){const G=ie[e],m=ie[b];G>m&&p({pluginRequiredPlan:e,licensePlan:b})}};t.Commands.has(W.settings)&&(l=t.runCommand(W.settings),o=(l==null?void 0:l.baseUrl)||"");const f=r=>{a==null||a(r),r&&g(r)};if(!l){t.onReady(async()=>{if(!we())if(n){const r=await Ae({licenseKey:n,pluginName:s,baseApiUrl:o});f(r)}else p("The `licenseKey` option not provided")});return}if(l.licensePlan||l.licenseError){const r=Ee(l);f(r);return}t.on(ze,r=>f(r))}const Ee=t=>({sdkLicense:t.license,license:t.license,error:t.licenseError,plan:t.licensePlan});async function Ae(t){const{licenseKey:e,pluginName:s,baseApiUrl:n}=t;try{return(await Ge({baseApiUrl:n,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const he=t=>e=>{var s;return((s=e.getAttribute)==null?void 0:s.call(e,se))===t},Le=(...t)=>e=>t.some(s=>e.is(s)),Me=(...t)=>(e,s)=>t.some(n=>s.is(n)),fe="gjs-plg-",se="data-type-role",D=class D{constructor(e){this.config=e}getSize(e){var s;return(s=this.config)!=null&&s.getSize?this.config.getSize(e):ne(e.componentColumn,D.CSS_FLEX_BASIS)}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:a,partial:i}=e;n.addStyle({[D.CSS_FLEX_BASIS]:a},{partial:i})}}};D.CSS_FLEX_BASIS="flex-basis";let K=D;const j=class j{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var s;return(s=this.config)!=null&&s.getGap?this.config.getGap(e):ne(e.componentRow,j.CSS_GAP)}setGap(e){var s;if((s=this.config)!=null&&s.setGap)this.config.setGap(e);else{const{componentRow:n,gapValue:a,partial:i}=e;n.addStyle({[j.CSS_GAP]:a},{partial:i})}}};j.CSS_GAP="gap";let J=j;const U=class U{constructor(e){this.config=e}getParentSize(e){var i;if((i=this.config)!=null&&i.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,a=s.getEl();return a?n?a.clientHeight:a.clientWidth:0}isLayoutVertical(e){var n;if((n=this.config)!=null&&n.isParentVertical)return this.config.isParentVertical(e);const s=ne(e.componentRow,U.CSS_FLEX_DIRECTION,!0);return s==="column"||s==="column-reverse"}};U.CSS_FLEX_DIRECTION="flex-direction";let q=U;const N=class N{constructor(e){this.config=e}getSize(e){var n;if((n=this.config)!=null&&n.getSize)return this.config.getSize(e);const s=e.componentColumn;if(s.is(N.MJML_COLUMN_TYPE)){const i=s.getAttributes().width;if(i&&(i.includes("%")||!isNaN(parseFloat(i))))return parseFloat(i);const o=s.parent();return 100/(o?o.components().length:1)}return 0}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:a,partial:i}=e;n.is(N.MJML_COLUMN_TYPE)&&n.addAttributes({width:`${parseFloat(a)}%`},{partial:i})}}};N.MJML_COLUMN_TYPE="mj-column";let Z=N;const X=class X{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var n;if((n=this.config)!=null&&n.getGap)return this.config.getGap(e);const{componentRow:s}=e;if(s.is(X.MJML_SECTION_TYPE)){const a=s.getAttributes();if(a&&a.padding)return parseInt(a.padding,10)||0}return 0}setGap(e){var s,n;(n=(s=this.config)==null?void 0:s.setGap)==null||n.call(s,e)}};X.MJML_SECTION_TYPE="mj-section";let Q=X;class $e{constructor(e){this.config=e}getParentSize(e){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,a=s.getEl();if(!a)return 0;let i=a;if(a.tagName!=="TABLE"){const l=a.querySelectorAll("table");l.length&&(i=l[0])}return n?i.clientHeight:i.clientWidth}isLayoutVertical(e){var s;return(s=this.config)!=null&&s.isParentVertical?this.config.isParentVertical(e):!1}}class M{constructor(){this.handlerCache=new Map}static getInstance(){return M.instance||(M.instance=new M),M.instance}getHandlers(e){const s=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(s)||($(e)?this.handlerCache.set(s,{sizeHandler:new Z(e),gapHandler:new Q(e),parentSizeHandler:new $e(e)}):this.handlerCache.set(s,{sizeHandler:new K(e),gapHandler:new J(e),parentSizeHandler:new q(e)})),this.handlerCache.get(s)}}function T(t){return M.getInstance().getHandlers(t)}const oe=t=>{t.style.display="none"},re=t=>{t.style.display="block"},H=t=>+parseFloat(`${t}`).toFixed(2),$=t=>t.projectType===ge.email,He=t=>t?["top","bottom"]:["left","right"],Ve=t=>{const e=t.parent();return e?e.components().models.indexOf(t)===0:!1},De=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.indexOf(t)===s.length-1},je=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.length>1&&t.index()===s.length-1},Ne=(t,e,s,n)=>{const i=t+(s?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return i>=0&&i<n?i:-1},O=t=>t==="top"||t==="bottom",Be=(t,e)=>!!(Ve(t)&&(e==="left"||e==="top")||De(t)&&(e==="right"||e==="bottom")),Fe=t=>{const e=t.parent();return e?e.components().models.length>1:!1},le=(t,e)=>t==="right"||t==="bottom"?e>0:e<0,ne=(t,e,s=!1)=>{const n=!s,a=t.getEl();if(!a)return n?0:"";const o=window.getComputedStyle(a)[e]||"";if(n){let l;return typeof o=="string"?(l=parseFloat(o.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(o)||0,l}return o},ce=(t,e,s)=>{const n=ee({componentRow:t,isVertical:e},s),a=t.components().models;return n*(a.length-1)},B=(t,e)=>T(e).parentSizeHandler.isLayoutVertical({componentRow:t}),F=(t,e)=>T(e).sizeHandler.getSize(t),ee=(t,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:s,parentSizeHandler:n}=T(e);if(!s.isGapSupported())return 0;const a=s.getGap(t),i=n.getParentSize(t);return a/100*i},te=(t,e)=>T(e).parentSizeHandler.getParentSize(t),V=(t,e)=>{T(e).sizeHandler.setSize(t)},ye=(t,e)=>{const s=F(t,e);V({...t,sizeValue:`${s}%`,partial:!1},e)},be=(t,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:s}=T(e);s.isGapSupported()&&s.setGap(t)},_e=(t,e)=>{const s=t.getStyle().gap;if(!s)return;const n=t.components().models,a={componentRow:t,isVertical:B(t,e)};n.map(i=>ye({...a,componentColumn:i},e)),be({...a,gapValue:String(s),partial:!1},e)};function Oe(t,e){const{Blocks:s}=t,{typeColumn:n,typeRow:a,blocks:i}=e;if(i===!1||$(e))return;const o=r=>({type:a,components:r.map(h=>({type:n,style:{"flex-basis":`${h}%`}}))}),l=r=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
|
|
2
2
|
${r.map(h=>`<div style="flex-basis: ${h}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
|
|
3
|
-
</div>`,p=(r,h)=>({id:`flex-row-${h.join("-")}`,label:r,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(h),content:o(h)}),g=[p("1 Column",[100]),p("2 Columns 50/50",[50,50]),p("2 Columns 25/75",[25,75]),p("2 Columns 75/25",[75,25]),p("3 Columns",[33.33,33.33,33.33]),p("3 Columns 50/25/25",[50,25,25]),p("3 Columns 25/50/25",[25,50,25]),p("3 Columns 25/25/50",[25,25,50]),p("4 Columns",[25,25,25,25]),p("5 Columns",[20,20,20,20,20])],f=Re(i)?i({blocks:g}):g;return f.forEach(r=>s.add(r.id,r)),()=>{f.forEach(r=>s.remove(r.id))}}const
|
|
3
|
+
</div>`,p=(r,h)=>({id:`flex-row-${h.join("-")}`,label:r,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(h),content:o(h)}),g=[p("1 Column",[100]),p("2 Columns 50/50",[50,50]),p("2 Columns 25/75",[25,75]),p("2 Columns 75/25",[75,25]),p("3 Columns",[33.33,33.33,33.33]),p("3 Columns 50/25/25",[50,25,25]),p("3 Columns 25/50/25",[25,50,25]),p("3 Columns 25/25/50",[25,25,50]),p("4 Columns",[25,25,25,25]),p("5 Columns",[20,20,20,20,20])],f=Re(i)?i({blocks:g}):g;return f.forEach(r=>s.add(r.id,r)),()=>{f.forEach(r=>s.remove(r.id))}}const ke=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:a,extendTypeColumn:i}=e,o=`${fe}${a}`,p=!!a&&!!s.getType(a)&&!i;if(!(!a||p||$(e)))return s.addType(a,{isComponent:he(a),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:Me(n),attributes:{[se]:a},styles:`
|
|
4
4
|
.${o} {
|
|
5
5
|
flex-grow: 1;
|
|
6
6
|
}
|
|
7
|
-
`}}}),()=>{s.removeType(a)}},
|
|
7
|
+
`}}}),()=>{s.removeType(a)}},Ue=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:a,extendTypeRow:i}=e,o=`${fe}${n}`,p=!!n&&!!s.getType(n)&&!i;if(!(!n||p||$(e)))return s.addType(n,{isComponent:he(n),model:{defaults:{name:"Row",classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[se]:n},droppable:Le(a),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:e.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:e.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
|
|
8
8
|
.${o} {
|
|
9
9
|
display: flex;
|
|
10
10
|
align-items: stretch;
|
|
11
11
|
flex-wrap: nowrap;
|
|
12
12
|
}
|
|
13
|
-
`}}}),()=>{s.removeType(n)}},
|
|
13
|
+
`}}}),()=>{s.removeType(n)}},Xe="flexComponent",Ye=L.startup;class We{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(e){this.resizableChildTypes.add(e)}registerGapAdjustableParent(e){this.gapAdjustableParentTypes.add(e)}registerTypeRelationship(e,s){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(s),this.registerResizableChild(s),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,s){const n=e.get("type"),a=s.get("type");return this.typeRelationships.has(n)?this.typeRelationships.get(n).has(a):!1}}class Ke{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeState=new WeakMap}getState(e){return this.resizeState.has(e)||this.resizeState.set(e,{}),this.resizeState.get(e)}clearState(e){return this.resizeState.delete(e)}startResize(e,s,n){const{opts:a}=this,i=this.getState(e);i.direction=s,i.startX=n.clientX,i.startY=n.clientY,i.resizing=!0,i.lastSnappedPercent=void 0;const o=e.parent();if(!o||!this.registry.isValidRelationship(o,e))return;i.snapEnabled=o.get("snap")??a.snapEnabled,i.snapDivisions=o.get("snap-divisions")??a.snapDivisions??12;const l=o.components().models,p=l.findIndex(h=>h.cid===e.cid),g=B(o,a),f=Ne(p,s,g,l.length);f!==-1&&(i.adjacentIdx=f);const r={componentColumn:e,componentRow:o,isVertical:g};if(i.startPercent=F(r,a),typeof i.adjacentIdx<"u"){const h=l[i.adjacentIdx];i.neighborStartPercent=F({...r,componentColumn:h},a)}}updateResizeByDelta(e,s,n){const a=this.getState(e),i=e.parent();!a.resizing||!i||(a.snapEnabled?this.updateSnapResize(e,s,n):this.updateContinuesResize(e,s,n))}finishResize(e){const s=e.parent(),n=s==null?void 0:s.components().models,a={componentRow:s,isVertical:!!s&&B(s,this.opts)};n==null||n.forEach(i=>ye({...a,componentColumn:i},this.opts)),this.clearState(e)}updateContinuesResize(e,s,n){const a=this.getState(e),i=e.parent(),{opts:o}=this;if(!i)return;const l=o.minItemPercent??0,p=O(s),g=te({componentRow:i,isVertical:p},o),f=ce(i,p,this.opts),h=100-f/g*100,I=n/(g-f)*h,{startPercent:b=0,neighborStartPercent:x=0}=a,v={componentRow:i,isVertical:p,componentColumn:e,partial:!0},G=le(s,n)?b+Math.abs(I):b-Math.abs(I);if(typeof a.adjacentIdx<"u"){const m=i.components().models[a.adjacentIdx],w=b+x,z=w-l,c=Math.min(z,Math.max(l,G)),u=w-c;V({...v,sizeValue:`${H(c)}%`},o),V({...v,componentColumn:m,sizeValue:`${H(u)}%`},o)}else{const m=Math.max(l,Math.min(h,G));V({...v,sizeValue:`${H(m)}%`},o)}}updateSnapResize(e,s,n){const a=this.getState(e),i=e.parent(),o=O(s),l=te({componentRow:i,isVertical:o},this.opts),p=ce(i,o,this.opts),g=l-p,f=n/g*100,r=le(s,n),{startPercent:h=0,snapDivisions:I=12}=a,b=r?h+Math.abs(f):h-Math.abs(f),x=100/I,v=Math.floor(b/x)*x,G=Math.ceil(b/x)*x,m=Math.abs(G-b),w=Math.abs(b-v),z=x*.2,S=m<w?G:v;if(S>0&&S<100&&(m<z||w<z)&&a.lastSnappedPercent!==S){a.lastSnappedPercent=S;let y=Math.abs(S-h)/100*g;(r&&(s==="left"||s==="top")||!r&&(s==="right"||s==="bottom"))&&(y=-y),this.updateContinuesResize(e,s,y)}else m>=z&&w>=z&&(a.lastSnappedPercent=void 0)}}class Je{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n}updateGapByDelta(e,s,n,a){if(!this.registry.isGapAdjustableParent(e))return;const{opts:i}=this,o=Math.max(0,n+s),l=te({componentRow:e,isVertical:a},i),p=o/l*100,g=e.components().models,f=g.length-1,r={componentRow:e,isVertical:a},h=g.reduce((z,S)=>z+F({...r,componentColumn:S},i),0),b=100-p*f,x=i.minItemPercent||5;if(b<x*g.length)return;const G=100-f*p,m=h-G,w={componentRow:e,isVertical:a,partial:!0};g.map(z=>{const S=F({...r,componentColumn:z},i),c=S-S/h*m;V({...w,componentColumn:z,sizeValue:`${H(c)}%`},i)}),be({...w,gapValue:`${H(p)}%`},i)}finishGapAdjust(e){_e(e,this.opts)}}class qe{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeHandler=new Ke(e,s,n),this.gapHandler=new Je(e,s,n)}startResize(e,s,n){this.resizeHandler.startResize(e,s,n)}updateResizeByDelta(e,s,n){this.resizeHandler.updateResizeByDelta(e,s,n)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,s,n,a){this.gapHandler.updateGapByDelta(e,s,n,a)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const s=e.parent();return s?this.registry.isValidRelationship(s,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const k="gs-flex-spots",pe=`${k}__handle-size`,Ze=`${k}__handle-gap`;function Qe(t,e){const{Canvas:s}=t,n="flex-resize-spot";let a,i,o,l,p=null,g=null;const f=new We,r=new qe(t,f,e),h=()=>{var c;a=document.createElement("div"),a.className=k,a.style.display="none",i=document.createElement("div"),i.className=`${k}__handles`,i.style.position="absolute",i.style.pointerEvents="none",i.style.zIndex="21",o={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(o).forEach(([u,y])=>{const P=u,d=O(P);y.className=`${pe} ${pe}-${P} gjs-resizer-h gjs-cv-unscale`,y.style.cssText=`
|
|
14
14
|
pointer-events: all;
|
|
15
15
|
position: absolute;
|
|
16
16
|
z-index: 1;
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
${P==="right"?"right: 0px;":""}
|
|
21
21
|
${P==="top"?"top: 0px;":""}
|
|
22
22
|
${P==="bottom"?"bottom: 0px;":""}
|
|
23
|
-
`,y.addEventListener("pointerdown",I(P)),i.appendChild(y)}),!e.disableGapHandler&&!$(e)&&(l=document.createElement("div"),l.className=
|
|
23
|
+
`,y.addEventListener("pointerdown",I(P)),i.appendChild(y)}),!e.disableGapHandler&&!$(e)&&(l=document.createElement("div"),l.className=Ze,l.style.cssText=`
|
|
24
24
|
position: absolute;
|
|
25
25
|
background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
|
|
26
26
|
border-width: 2px;
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
pointer-events: all;
|
|
31
31
|
max-width: 3rem;
|
|
32
32
|
max-height: 3rem;
|
|
33
|
-
`,l.addEventListener("pointerdown",b()),i.appendChild(l)),a.append(i),(c=s.getSpotsEl())==null||c.appendChild(a)},I=c=>u=>{if(!p)return;u.stopPropagation(),u.preventDefault(),r.startResize(p,c,u);const y=u.clientX,P=u.clientY;u.target.setPointerCapture(u.pointerId);const d=E=>{const C=t.Canvas.getZoomMultiplier(),A=(E.clientX-y)*C,_=(E.clientY-P)*C,Y=O(c)?_:A;r.updateResizeByDelta(p,c,Y)},
|
|
33
|
+
`,l.addEventListener("pointerdown",b()),i.appendChild(l)),a.append(i),(c=s.getSpotsEl())==null||c.appendChild(a)},I=c=>u=>{if(!p)return;u.stopPropagation(),u.preventDefault(),r.startResize(p,c,u);const y=u.clientX,P=u.clientY;u.target.setPointerCapture(u.pointerId);const d=E=>{const C=t.Canvas.getZoomMultiplier(),A=(E.clientX-y)*C,_=(E.clientY-P)*C,Y=O(c)?_:A;r.updateResizeByDelta(p,c,Y)},R=()=>{r.finishResize(p),u.target.releasePointerCapture(u.pointerId),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",R)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",R)},b=()=>c=>{if(!g)return;const u=g;c.stopPropagation(),c.preventDefault();const y=B(u,e),P=ee({componentRow:u,isVertical:y},e),d=c.clientX,R=c.clientY;c.target.setPointerCapture(c.pointerId);const E=A=>{const _=t.Canvas.getZoomMultiplier(),Y=y?(A.clientY-R)*_:(A.clientX-d)*_;r.updateGapByDelta(u,Y,P,y)},C=()=>{r.finishGapAdjust(u),c.target.releasePointerCapture(c.pointerId),document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",C)};document.addEventListener("pointermove",E),document.addEventListener("pointerup",C)},x=c=>{const u=c.component;if(!u||!a||(p=u,g=u.parent(),!g))return;const y=g;re(a);const P=c.getStyle();i&&Object.assign(i.style,P);const d=B(y,e),R=He(d);if(Object.values(o).forEach(oe),R.forEach(C=>{if(Be(u,C))return;const A=o[C];re(A)}),T(e).gapHandler.isGapSupported()&&l&&Fe(u)){const C=ee({componentRow:y,isVertical:d},e);v(C,d,je(u))}},v=(c,u,y=!1)=>{const P=e.gapHandleSize,d=l.style;if(u){d.height=`${P}px`;const R=l.offsetHeight;y?(d.top=`-${(c+R)/2}px`,d.bottom=""):(d.bottom=`-${(c+R)/2}px`,d.top=""),d.width="50%",d.left="50%",d.transform="translateX(-50%)",d.cursor="row-resize"}else{d.width=`${P}px`;const R=l.offsetWidth;y?(d.left=`-${(c+R)/2}px`,d.right=""):(d.right=`-${(c+R)/2}px`,d.left=""),d.height="50%",d.top="50%",d.transform="translateY(-50%)",d.cursor="col-resize"}},G=()=>{a&&(oe(a),p=null,g=null)},m=()=>{s.removeSpots({type:n});const c=t.getSelected(),u=c==null?void 0:c.parent();c&&u&&f.isValidRelationship(u,c)?s.addSpot({type:n,component:c}):G()},w=()=>{const c=s.getSpots().filter(u=>u.type===n)[0];c&&x(c)},z=(c,u)=>{f.registerTypeRelationship(c,u)};t.onReady(()=>{h(),$(e)?z("mj-section","mj-column"):z(e.typeRow,e.typeColumn)});const S="component:toggled";return t.on(s.events.spot,w),t.on(S,m),()=>{t.off(s.events.spot,w),t.off(S,m)}}const et=function(t,e={}){const s={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},n=[Ue(t,s),ke(t,s)],a=Qe(t,s),i=Oe(t,s);Te({editor:t,licenseKey:s.licenseKey,plan:Ye,pluginName:Xe,cleanup:()=>{n.forEach(o=>o==null?void 0:o()),a(),i==null||i()}})},tt=Ie(et);module.exports=tt;
|
|
@@ -9,20 +9,33 @@ const ue = "app.grapesjs.com", de = "app-stage.grapesjs.com", Pe = "app2.grapesj
|
|
|
9
9
|
// For stackblitz.com demos
|
|
10
10
|
".local.webcontainer.io",
|
|
11
11
|
// For stackblitz.com demos
|
|
12
|
-
"-sandpack.codesandbox.io"
|
|
12
|
+
"-sandpack.codesandbox.io",
|
|
13
13
|
// For Sandpack demos
|
|
14
|
+
".claudemcpcontent.com",
|
|
15
|
+
// For Claude mcp app
|
|
16
|
+
".web-sandbox.oaiusercontent.com"
|
|
17
|
+
// For OpenAI mcp app
|
|
14
18
|
], ze = "license:check:end", Se = () => typeof window < "u", xe = ({
|
|
15
19
|
isDev: t,
|
|
16
20
|
isStage: e,
|
|
17
21
|
isPlatform: s
|
|
18
22
|
}) => `${t ? "" : `https://${e ? de : ue}`}/${s ? "platform-api" : "api"}`, ve = () => {
|
|
19
|
-
|
|
23
|
+
if (!Se()) return "";
|
|
24
|
+
const { hostname: t } = window.location;
|
|
25
|
+
if (t) return t;
|
|
26
|
+
try {
|
|
27
|
+
return window.parent.location.hostname || "";
|
|
28
|
+
} catch {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
}, we = () => {
|
|
32
|
+
const t = ve();
|
|
20
33
|
return !!t && (ae.includes(t) || ae.some((e) => t.endsWith(e)));
|
|
21
34
|
};
|
|
22
35
|
function Re(t) {
|
|
23
36
|
return typeof t == "function";
|
|
24
37
|
}
|
|
25
|
-
async function
|
|
38
|
+
async function Ge({
|
|
26
39
|
path: t,
|
|
27
40
|
baseApiUrl: e,
|
|
28
41
|
method: s = "GET",
|
|
@@ -43,19 +56,19 @@ async function we({
|
|
|
43
56
|
throw new Error(`HTTP error! status: ${r.status}`);
|
|
44
57
|
return r.json();
|
|
45
58
|
}
|
|
46
|
-
var L = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(L || {}), W = /* @__PURE__ */ ((t) => (t.toastAdd = "studio:toastAdd", t.toastRemove = "studio:toastRemove", t.dialogOpen = "studio:dialogOpen", t.dialogClose = "studio:dialogClose", t.dialogExportCode = "studio:dialogExportCode", t.dialogImportCode = "studio:dialogImportCode", t.sidebarLeftSet = "studio:sidebarLeft:set", t.sidebarLeftGet = "studio:sidebarLeft:get", t.sidebarLeftToggle = "studio:sidebarLeft:toggle", t.sidebarRightSet = "studio:sidebarRight:set", t.sidebarRightGet = "studio:sidebarRight:get", t.sidebarRightToggle = "studio:sidebarRight:toggle", t.sidebarTopSet = "studio:sidebarTop:set", t.sidebarTopGet = "studio:sidebarTop:get", t.sidebarTopToggle = "studio:sidebarTop:toggle", t.sidebarBottomSet = "studio:sidebarBottom:set", t.sidebarBottomGet = "studio:sidebarBottom:get", t.sidebarBottomToggle = "studio:sidebarBottom:toggle", t.symbolAdd = "studio:symbolAdd", t.symbolDetach = "studio:symbolDetach", t.symbolOverride = "studio:symbolOverride", t.symbolPropagateStyles = "studio:propagateStyles", t.getPagesConfig = "studio:getPagesConfig", t.setPagesConfig = "studio:setPagesConfig", t.getPageSettings = "studio:getPageSettings", t.setPageSettings = "studio:setPageSettings", t.clearPage = "studio:clearPage", t.projectFiles = "studio:projectFiles", t.validateCode = "studio:validateCode", t.canvasReload = "studio:canvasReload", t.getBlocksPanel = "studio:getBlocksPanel", t.setBlocksPanel = "studio:setBlocksPanel", t.getStateContextMenu = "studio:getStateContextMenu", t.setStateContextMenu = "studio:setStateContextMenu", t.contextMenuComponent = "studio:contextMenuComponent", t.layoutAdd = "studio:layoutAdd", t.layoutRemove = "studio:layoutRemove", t.layoutToggle = "studio:layoutToggle", t.layoutUpdate = "studio:layoutUpdate", t.layoutGet = "studio:layoutGet", t.layoutConfigGet = "studio:layoutConfigGet", t.layoutConfigSet = "studio:layoutConfigSet", t.layoutComponentAdd = "studio:layoutComponentAdd", t.layoutComponentGet = "studio:layoutComponentGet", t.layoutComponentRemove = "studio:layoutComponentRemove", t.layoutComponentRender = "studio:layoutComponentRender", t.getStateTheme = "studio:getStateTheme", t.setStateTheme = "studio:setStateTheme", t.settings = "studio:settings", t.assetProviderGet = "studio:assetProviderGet", t.assetProviderAdd = "studio:assetProviderAdd", t.assetProviderRemove = "studio:assetProviderRemove", t.fontGet = "studio:fontGet", t.fontAdd = "studio:fontAdd", t.fontRemove = "studio:fontRemove", t.fontManagerOpen = "studio:fontManagerOpen", t.menuFontLoad = "studio:menuFontLoad", t.toggleStateDataSource = "studio:toggleStateDataSource", t.getStateDataSource = "studio:getStateDataSource", t.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", t.dataSourceSetImporter = "studio:dataSourceSetImporter", t.dataSourceSetExporter = "studio:dataSourceSetExporter", t.setDragAbsolute = "studio:setDragAbsolute", t))(W || {}), ge = /* @__PURE__ */ ((t) => (t.web = "web", t.email = "email", t.document = "document", t.react = "react", t))(ge || {});
|
|
59
|
+
var L = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(L || {}), W = /* @__PURE__ */ ((t) => (t.toastAdd = "studio:toastAdd", t.toastRemove = "studio:toastRemove", t.dialogOpen = "studio:dialogOpen", t.dialogClose = "studio:dialogClose", t.dialogExportCode = "studio:dialogExportCode", t.dialogImportCode = "studio:dialogImportCode", t.openEditCode = "studio:openEditCode", t.sidebarLeftSet = "studio:sidebarLeft:set", t.sidebarLeftGet = "studio:sidebarLeft:get", t.sidebarLeftToggle = "studio:sidebarLeft:toggle", t.sidebarRightSet = "studio:sidebarRight:set", t.sidebarRightGet = "studio:sidebarRight:get", t.sidebarRightToggle = "studio:sidebarRight:toggle", t.sidebarTopSet = "studio:sidebarTop:set", t.sidebarTopGet = "studio:sidebarTop:get", t.sidebarTopToggle = "studio:sidebarTop:toggle", t.sidebarBottomSet = "studio:sidebarBottom:set", t.sidebarBottomGet = "studio:sidebarBottom:get", t.sidebarBottomToggle = "studio:sidebarBottom:toggle", t.symbolAdd = "studio:symbolAdd", t.symbolDetach = "studio:symbolDetach", t.symbolOverride = "studio:symbolOverride", t.symbolPropagateStyles = "studio:propagateStyles", t.getPagesConfig = "studio:getPagesConfig", t.setPagesConfig = "studio:setPagesConfig", t.getPageSettings = "studio:getPageSettings", t.setPageSettings = "studio:setPageSettings", t.clearPage = "studio:clearPage", t.projectFiles = "studio:projectFiles", t.validateCode = "studio:validateCode", t.canvasReload = "studio:canvasReload", t.getBlocksPanel = "studio:getBlocksPanel", t.setBlocksPanel = "studio:setBlocksPanel", t.getStateContextMenu = "studio:getStateContextMenu", t.setStateContextMenu = "studio:setStateContextMenu", t.contextMenuComponent = "studio:contextMenuComponent", t.layoutAdd = "studio:layoutAdd", t.layoutRemove = "studio:layoutRemove", t.layoutToggle = "studio:layoutToggle", t.layoutUpdate = "studio:layoutUpdate", t.layoutGet = "studio:layoutGet", t.layoutConfigGet = "studio:layoutConfigGet", t.layoutConfigSet = "studio:layoutConfigSet", t.layoutComponentAdd = "studio:layoutComponentAdd", t.layoutComponentGet = "studio:layoutComponentGet", t.layoutComponentRemove = "studio:layoutComponentRemove", t.layoutComponentRender = "studio:layoutComponentRender", t.getStateTheme = "studio:getStateTheme", t.setStateTheme = "studio:setStateTheme", t.settings = "studio:settings", t.assetProviderGet = "studio:assetProviderGet", t.assetProviderAdd = "studio:assetProviderAdd", t.assetProviderRemove = "studio:assetProviderRemove", t.fontGet = "studio:fontGet", t.fontAdd = "studio:fontAdd", t.fontRemove = "studio:fontRemove", t.fontManagerOpen = "studio:fontManagerOpen", t.menuFontLoad = "studio:menuFontLoad", t.toggleStateDataSource = "studio:toggleStateDataSource", t.getStateDataSource = "studio:getStateDataSource", t.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", t.dataSourceSetImporter = "studio:dataSourceSetImporter", t.dataSourceSetExporter = "studio:dataSourceSetExporter", t.setDragAbsolute = "studio:setDragAbsolute", t))(W || {}), ge = /* @__PURE__ */ ((t) => (t.web = "web", t.email = "email", t.document = "document", t.react = "react", t))(ge || {});
|
|
47
60
|
const ie = {
|
|
48
61
|
[L.free]: 0,
|
|
49
62
|
[L.startup]: 10,
|
|
50
63
|
[L.business]: 20,
|
|
51
64
|
[L.enterprise]: 30
|
|
52
65
|
};
|
|
53
|
-
function
|
|
66
|
+
function Ce(t) {
|
|
54
67
|
const e = t;
|
|
55
68
|
return e.init = (s) => (n) => t(n, s), e;
|
|
56
69
|
}
|
|
57
|
-
const
|
|
58
|
-
async function
|
|
70
|
+
const Ie = (t) => /* @__PURE__ */ Ce(t);
|
|
71
|
+
async function Te({
|
|
59
72
|
editor: t,
|
|
60
73
|
plan: e,
|
|
61
74
|
pluginName: s,
|
|
@@ -82,9 +95,9 @@ async function Ie({
|
|
|
82
95
|
};
|
|
83
96
|
if (!l) {
|
|
84
97
|
t.onReady(async () => {
|
|
85
|
-
if (!
|
|
98
|
+
if (!we())
|
|
86
99
|
if (n) {
|
|
87
|
-
const r = await
|
|
100
|
+
const r = await Ae({ licenseKey: n, pluginName: s, baseApiUrl: o });
|
|
88
101
|
f(r);
|
|
89
102
|
} else
|
|
90
103
|
p("The `licenseKey` option not provided");
|
|
@@ -92,22 +105,22 @@ async function Ie({
|
|
|
92
105
|
return;
|
|
93
106
|
}
|
|
94
107
|
if (l.licensePlan || l.licenseError) {
|
|
95
|
-
const r =
|
|
108
|
+
const r = Ee(l);
|
|
96
109
|
f(r);
|
|
97
110
|
return;
|
|
98
111
|
}
|
|
99
112
|
t.on(ze, (r) => f(r));
|
|
100
113
|
}
|
|
101
|
-
const
|
|
114
|
+
const Ee = (t) => ({
|
|
102
115
|
sdkLicense: t.license,
|
|
103
116
|
license: t.license,
|
|
104
117
|
error: t.licenseError,
|
|
105
118
|
plan: t.licensePlan
|
|
106
119
|
});
|
|
107
|
-
async function
|
|
120
|
+
async function Ae(t) {
|
|
108
121
|
const { licenseKey: e, pluginName: s, baseApiUrl: n } = t;
|
|
109
122
|
try {
|
|
110
|
-
return (await
|
|
123
|
+
return (await Ge({
|
|
111
124
|
baseApiUrl: n,
|
|
112
125
|
path: `/sdk/${e || "na"}`,
|
|
113
126
|
method: "POST",
|
|
@@ -123,7 +136,7 @@ async function Ee(t) {
|
|
|
123
136
|
const he = (t) => (e) => {
|
|
124
137
|
var s;
|
|
125
138
|
return ((s = e.getAttribute) == null ? void 0 : s.call(e, se)) === t;
|
|
126
|
-
},
|
|
139
|
+
}, Le = (...t) => (e) => t.some((s) => e.is(s)), Me = (...t) => (e, s) => t.some((n) => s.is(n)), fe = "gjs-plg-", se = "data-type-role", D = class D {
|
|
127
140
|
constructor(e) {
|
|
128
141
|
this.config = e;
|
|
129
142
|
}
|
|
@@ -239,7 +252,7 @@ const X = class X {
|
|
|
239
252
|
};
|
|
240
253
|
X.MJML_SECTION_TYPE = "mj-section";
|
|
241
254
|
let Q = X;
|
|
242
|
-
class
|
|
255
|
+
class $e {
|
|
243
256
|
constructor(e) {
|
|
244
257
|
this.config = e;
|
|
245
258
|
}
|
|
@@ -272,7 +285,7 @@ class M {
|
|
|
272
285
|
return this.handlerCache.has(s) || ($(e) ? this.handlerCache.set(s, {
|
|
273
286
|
sizeHandler: new Z(e),
|
|
274
287
|
gapHandler: new Q(e),
|
|
275
|
-
parentSizeHandler: new
|
|
288
|
+
parentSizeHandler: new $e(e)
|
|
276
289
|
}) : this.handlerCache.set(s, {
|
|
277
290
|
sizeHandler: new K(e),
|
|
278
291
|
gapHandler: new J(e),
|
|
@@ -287,23 +300,23 @@ const oe = (t) => {
|
|
|
287
300
|
t.style.display = "none";
|
|
288
301
|
}, re = (t) => {
|
|
289
302
|
t.style.display = "block";
|
|
290
|
-
}, H = (t) => +parseFloat(`${t}`).toFixed(2), $ = (t) => t.projectType === ge.email,
|
|
303
|
+
}, H = (t) => +parseFloat(`${t}`).toFixed(2), $ = (t) => t.projectType === ge.email, He = (t) => t ? ["top", "bottom"] : ["left", "right"], Ve = (t) => {
|
|
291
304
|
const e = t.parent();
|
|
292
305
|
return e ? e.components().models.indexOf(t) === 0 : !1;
|
|
293
|
-
},
|
|
306
|
+
}, De = (t) => {
|
|
294
307
|
const e = t.parent();
|
|
295
308
|
if (!e) return !1;
|
|
296
309
|
const s = e.components().models;
|
|
297
310
|
return s.indexOf(t) === s.length - 1;
|
|
298
|
-
},
|
|
311
|
+
}, je = (t) => {
|
|
299
312
|
const e = t.parent();
|
|
300
313
|
if (!e) return !1;
|
|
301
314
|
const s = e.components().models;
|
|
302
315
|
return s.length > 1 && t.index() === s.length - 1;
|
|
303
|
-
},
|
|
316
|
+
}, Ne = (t, e, s, n) => {
|
|
304
317
|
const i = t + (s ? e === "top" ? -1 : e === "bottom" ? 1 : 0 : e === "left" ? -1 : e === "right" ? 1 : 0);
|
|
305
318
|
return i >= 0 && i < n ? i : -1;
|
|
306
|
-
}, O = (t) => t === "top" || t === "bottom",
|
|
319
|
+
}, O = (t) => t === "top" || t === "bottom", Be = (t, e) => !!(Ve(t) && (e === "left" || e === "top") || De(t) && (e === "right" || e === "bottom")), Fe = (t) => {
|
|
307
320
|
const e = t.parent();
|
|
308
321
|
return e ? e.components().models.length > 1 : !1;
|
|
309
322
|
}, le = (t, e) => t === "right" || t === "bottom" ? e > 0 : e < 0, ne = (t, e, s = !1) => {
|
|
@@ -334,13 +347,13 @@ const oe = (t) => {
|
|
|
334
347
|
if (e != null && e.disableGapHandler) return;
|
|
335
348
|
const { gapHandler: s } = T(e);
|
|
336
349
|
s.isGapSupported() && s.setGap(t);
|
|
337
|
-
},
|
|
350
|
+
}, _e = (t, e) => {
|
|
338
351
|
const s = t.getStyle().gap;
|
|
339
352
|
if (!s) return;
|
|
340
353
|
const n = t.components().models, a = { componentRow: t, isVertical: B(t, e) };
|
|
341
354
|
n.map((i) => ye({ ...a, componentColumn: i }, e)), be({ ...a, gapValue: String(s), partial: !1 }, e);
|
|
342
355
|
};
|
|
343
|
-
function
|
|
356
|
+
function Oe(t, e) {
|
|
344
357
|
const { Blocks: s } = t, { typeColumn: n, typeRow: a, blocks: i } = e;
|
|
345
358
|
if (i === !1 || $(e)) return;
|
|
346
359
|
const o = (r) => ({
|
|
@@ -376,7 +389,7 @@ function _e(t, e) {
|
|
|
376
389
|
f.forEach((r) => s.remove(r.id));
|
|
377
390
|
};
|
|
378
391
|
}
|
|
379
|
-
const
|
|
392
|
+
const ke = (t, e) => {
|
|
380
393
|
const { Components: s } = t, { typeRow: n, typeColumn: a, extendTypeColumn: i } = e, o = `${fe}${a}`, p = !!a && !!s.getType(a) && !i;
|
|
381
394
|
if (!(!a || p || $(e)))
|
|
382
395
|
return s.addType(a, {
|
|
@@ -388,7 +401,7 @@ const Oe = (t, e) => {
|
|
|
388
401
|
emptyState: !0,
|
|
389
402
|
classes: o,
|
|
390
403
|
icon: '<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',
|
|
391
|
-
draggable:
|
|
404
|
+
draggable: Me(n),
|
|
392
405
|
attributes: { [se]: a },
|
|
393
406
|
styles: `
|
|
394
407
|
.${o} {
|
|
@@ -400,7 +413,7 @@ const Oe = (t, e) => {
|
|
|
400
413
|
}), () => {
|
|
401
414
|
s.removeType(a);
|
|
402
415
|
};
|
|
403
|
-
},
|
|
416
|
+
}, Ue = (t, e) => {
|
|
404
417
|
const { Components: s } = t, { typeRow: n, typeColumn: a, extendTypeRow: i } = e, o = `${fe}${n}`, p = !!n && !!s.getType(n) && !i;
|
|
405
418
|
if (!(!n || p || $(e)))
|
|
406
419
|
return s.addType(n, {
|
|
@@ -412,7 +425,7 @@ const Oe = (t, e) => {
|
|
|
412
425
|
icon: '<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',
|
|
413
426
|
emptyState: { styleIn: "width: 100%" },
|
|
414
427
|
attributes: { [se]: n },
|
|
415
|
-
droppable:
|
|
428
|
+
droppable: Le(a),
|
|
416
429
|
traits: [
|
|
417
430
|
// {
|
|
418
431
|
// type: 'number',
|
|
@@ -470,8 +483,8 @@ const Oe = (t, e) => {
|
|
|
470
483
|
}), () => {
|
|
471
484
|
s.removeType(n);
|
|
472
485
|
};
|
|
473
|
-
},
|
|
474
|
-
class
|
|
486
|
+
}, Xe = "flexComponent", Ye = L.startup;
|
|
487
|
+
class We {
|
|
475
488
|
constructor() {
|
|
476
489
|
this.resizableChildTypes = /* @__PURE__ */ new Set(), this.gapAdjustableParentTypes = /* @__PURE__ */ new Set(), this.typeRelationships = /* @__PURE__ */ new Map();
|
|
477
490
|
}
|
|
@@ -495,7 +508,7 @@ class Ye {
|
|
|
495
508
|
return this.typeRelationships.has(n) ? this.typeRelationships.get(n).has(a) : !1;
|
|
496
509
|
}
|
|
497
510
|
}
|
|
498
|
-
class
|
|
511
|
+
class Ke {
|
|
499
512
|
constructor(e, s, n) {
|
|
500
513
|
this.editor = e, this.registry = s, this.opts = n, this.resizeState = /* @__PURE__ */ new WeakMap();
|
|
501
514
|
}
|
|
@@ -511,7 +524,7 @@ class We {
|
|
|
511
524
|
const o = e.parent();
|
|
512
525
|
if (!o || !this.registry.isValidRelationship(o, e)) return;
|
|
513
526
|
i.snapEnabled = o.get("snap") ?? a.snapEnabled, i.snapDivisions = o.get("snap-divisions") ?? a.snapDivisions ?? 12;
|
|
514
|
-
const l = o.components().models, p = l.findIndex((h) => h.cid === e.cid), g = B(o, a), f =
|
|
527
|
+
const l = o.components().models, p = l.findIndex((h) => h.cid === e.cid), g = B(o, a), f = Ne(p, s, g, l.length);
|
|
515
528
|
f !== -1 && (i.adjacentIdx = f);
|
|
516
529
|
const r = { componentColumn: e, componentRow: o, isVertical: g };
|
|
517
530
|
if (i.startPercent = F(r, a), typeof i.adjacentIdx < "u") {
|
|
@@ -532,7 +545,7 @@ class We {
|
|
|
532
545
|
if (!i) return;
|
|
533
546
|
const l = o.minItemPercent ?? 0, p = O(s), g = te({ componentRow: i, isVertical: p }, o), f = ce(i, p, this.opts), h = 100 - f / g * 100, I = n / (g - f) * h, { startPercent: b = 0, neighborStartPercent: x = 0 } = a, v = { componentRow: i, isVertical: p, componentColumn: e, partial: !0 }, G = le(s, n) ? b + Math.abs(I) : b - Math.abs(I);
|
|
534
547
|
if (typeof a.adjacentIdx < "u") {
|
|
535
|
-
const m = i.components().models[a.adjacentIdx],
|
|
548
|
+
const m = i.components().models[a.adjacentIdx], w = b + x, z = w - l, c = Math.min(z, Math.max(l, G)), u = w - c;
|
|
536
549
|
V({ ...v, sizeValue: `${H(c)}%` }, o), V(
|
|
537
550
|
{ ...v, componentColumn: m, sizeValue: `${H(u)}%` },
|
|
538
551
|
o
|
|
@@ -543,15 +556,15 @@ class We {
|
|
|
543
556
|
}
|
|
544
557
|
}
|
|
545
558
|
updateSnapResize(e, s, n) {
|
|
546
|
-
const a = this.getState(e), i = e.parent(), o = O(s), l = te({ componentRow: i, isVertical: o }, this.opts), p = ce(i, o, this.opts), g = l - p, f = n / g * 100, r = le(s, n), { startPercent: h = 0, snapDivisions: I = 12 } = a, b = r ? h + Math.abs(f) : h - Math.abs(f), x = 100 / I, v = Math.floor(b / x) * x, G = Math.ceil(b / x) * x, m = Math.abs(G - b),
|
|
547
|
-
if (S > 0 && S < 100 && (m < z ||
|
|
559
|
+
const a = this.getState(e), i = e.parent(), o = O(s), l = te({ componentRow: i, isVertical: o }, this.opts), p = ce(i, o, this.opts), g = l - p, f = n / g * 100, r = le(s, n), { startPercent: h = 0, snapDivisions: I = 12 } = a, b = r ? h + Math.abs(f) : h - Math.abs(f), x = 100 / I, v = Math.floor(b / x) * x, G = Math.ceil(b / x) * x, m = Math.abs(G - b), w = Math.abs(b - v), z = x * 0.2, S = m < w ? G : v;
|
|
560
|
+
if (S > 0 && S < 100 && (m < z || w < z) && a.lastSnappedPercent !== S) {
|
|
548
561
|
a.lastSnappedPercent = S;
|
|
549
562
|
let y = Math.abs(S - h) / 100 * g;
|
|
550
563
|
(r && (s === "left" || s === "top") || !r && (s === "right" || s === "bottom")) && (y = -y), this.updateContinuesResize(e, s, y);
|
|
551
|
-
} else m >= z &&
|
|
564
|
+
} else m >= z && w >= z && (a.lastSnappedPercent = void 0);
|
|
552
565
|
}
|
|
553
566
|
}
|
|
554
|
-
class
|
|
567
|
+
class Je {
|
|
555
568
|
constructor(e, s, n) {
|
|
556
569
|
this.editor = e, this.registry = s, this.opts = n;
|
|
557
570
|
}
|
|
@@ -563,19 +576,19 @@ class Ke {
|
|
|
563
576
|
), b = 100 - p * f, x = i.minItemPercent || 5;
|
|
564
577
|
if (b < x * g.length)
|
|
565
578
|
return;
|
|
566
|
-
const G = 100 - f * p, m = h - G,
|
|
579
|
+
const G = 100 - f * p, m = h - G, w = { componentRow: e, isVertical: a, partial: !0 };
|
|
567
580
|
g.map((z) => {
|
|
568
581
|
const S = F({ ...r, componentColumn: z }, i), c = S - S / h * m;
|
|
569
|
-
V({ ...
|
|
570
|
-
}), be({ ...
|
|
582
|
+
V({ ...w, componentColumn: z, sizeValue: `${H(c)}%` }, i);
|
|
583
|
+
}), be({ ...w, gapValue: `${H(p)}%` }, i);
|
|
571
584
|
}
|
|
572
585
|
finishGapAdjust(e) {
|
|
573
|
-
|
|
586
|
+
_e(e, this.opts);
|
|
574
587
|
}
|
|
575
588
|
}
|
|
576
|
-
class
|
|
589
|
+
class qe {
|
|
577
590
|
constructor(e, s, n) {
|
|
578
|
-
this.editor = e, this.registry = s, this.opts = n, this.resizeHandler = new
|
|
591
|
+
this.editor = e, this.registry = s, this.opts = n, this.resizeHandler = new Ke(e, s, n), this.gapHandler = new Je(e, s, n);
|
|
579
592
|
}
|
|
580
593
|
startResize(e, s, n) {
|
|
581
594
|
this.resizeHandler.startResize(e, s, n);
|
|
@@ -600,11 +613,11 @@ class Je {
|
|
|
600
613
|
return this.registry.isGapAdjustableParent(e);
|
|
601
614
|
}
|
|
602
615
|
}
|
|
603
|
-
const k = "gs-flex-spots", pe = `${k}__handle-size`,
|
|
604
|
-
function
|
|
616
|
+
const k = "gs-flex-spots", pe = `${k}__handle-size`, Ze = `${k}__handle-gap`;
|
|
617
|
+
function Qe(t, e) {
|
|
605
618
|
const { Canvas: s } = t, n = "flex-resize-spot";
|
|
606
619
|
let a, i, o, l, p = null, g = null;
|
|
607
|
-
const f = new
|
|
620
|
+
const f = new We(), r = new qe(t, f, e), h = () => {
|
|
608
621
|
var c;
|
|
609
622
|
a = document.createElement("div"), a.className = k, a.style.display = "none", i = document.createElement("div"), i.className = `${k}__handles`, i.style.position = "absolute", i.style.pointerEvents = "none", i.style.zIndex = "21", o = {
|
|
610
623
|
left: document.createElement("div"),
|
|
@@ -624,7 +637,7 @@ function Ze(t, e) {
|
|
|
624
637
|
${P === "top" ? "top: 0px;" : ""}
|
|
625
638
|
${P === "bottom" ? "bottom: 0px;" : ""}
|
|
626
639
|
`, y.addEventListener("pointerdown", I(P)), i.appendChild(y);
|
|
627
|
-
}), !e.disableGapHandler && !$(e) && (l = document.createElement("div"), l.className =
|
|
640
|
+
}), !e.disableGapHandler && !$(e) && (l = document.createElement("div"), l.className = Ze, l.style.cssText = `
|
|
628
641
|
position: absolute;
|
|
629
642
|
background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
|
|
630
643
|
border-width: 2px;
|
|
@@ -643,18 +656,18 @@ function Ze(t, e) {
|
|
|
643
656
|
const d = (E) => {
|
|
644
657
|
const C = t.Canvas.getZoomMultiplier(), A = (E.clientX - y) * C, _ = (E.clientY - P) * C, Y = O(c) ? _ : A;
|
|
645
658
|
r.updateResizeByDelta(p, c, Y);
|
|
646
|
-
},
|
|
647
|
-
r.finishResize(p), u.target.releasePointerCapture(u.pointerId), document.removeEventListener("pointermove", d), document.removeEventListener("pointerup",
|
|
659
|
+
}, R = () => {
|
|
660
|
+
r.finishResize(p), u.target.releasePointerCapture(u.pointerId), document.removeEventListener("pointermove", d), document.removeEventListener("pointerup", R);
|
|
648
661
|
};
|
|
649
|
-
document.addEventListener("pointermove", d), document.addEventListener("pointerup",
|
|
662
|
+
document.addEventListener("pointermove", d), document.addEventListener("pointerup", R);
|
|
650
663
|
}, b = () => (c) => {
|
|
651
664
|
if (!g) return;
|
|
652
665
|
const u = g;
|
|
653
666
|
c.stopPropagation(), c.preventDefault();
|
|
654
|
-
const y = B(u, e), P = ee({ componentRow: u, isVertical: y }, e), d = c.clientX,
|
|
667
|
+
const y = B(u, e), P = ee({ componentRow: u, isVertical: y }, e), d = c.clientX, R = c.clientY;
|
|
655
668
|
c.target.setPointerCapture(c.pointerId);
|
|
656
669
|
const E = (A) => {
|
|
657
|
-
const _ = t.Canvas.getZoomMultiplier(), Y = y ? (A.clientY -
|
|
670
|
+
const _ = t.Canvas.getZoomMultiplier(), Y = y ? (A.clientY - R) * _ : (A.clientX - d) * _;
|
|
658
671
|
r.updateGapByDelta(u, Y, P, y);
|
|
659
672
|
}, C = () => {
|
|
660
673
|
r.finishGapAdjust(u), c.target.releasePointerCapture(c.pointerId), document.removeEventListener("pointermove", E), document.removeEventListener("pointerup", C);
|
|
@@ -667,25 +680,25 @@ function Ze(t, e) {
|
|
|
667
680
|
re(a);
|
|
668
681
|
const P = c.getStyle();
|
|
669
682
|
i && Object.assign(i.style, P);
|
|
670
|
-
const d = B(y, e),
|
|
671
|
-
if (Object.values(o).forEach(oe),
|
|
672
|
-
if (
|
|
683
|
+
const d = B(y, e), R = He(d);
|
|
684
|
+
if (Object.values(o).forEach(oe), R.forEach((C) => {
|
|
685
|
+
if (Be(u, C)) return;
|
|
673
686
|
const A = o[C];
|
|
674
687
|
re(A);
|
|
675
|
-
}), T(e).gapHandler.isGapSupported() && l &&
|
|
688
|
+
}), T(e).gapHandler.isGapSupported() && l && Fe(u)) {
|
|
676
689
|
const C = ee({ componentRow: y, isVertical: d }, e);
|
|
677
|
-
v(C, d,
|
|
690
|
+
v(C, d, je(u));
|
|
678
691
|
}
|
|
679
692
|
}, v = (c, u, y = !1) => {
|
|
680
693
|
const P = e.gapHandleSize, d = l.style;
|
|
681
694
|
if (u) {
|
|
682
695
|
d.height = `${P}px`;
|
|
683
|
-
const
|
|
684
|
-
y ? (d.top = `-${(c +
|
|
696
|
+
const R = l.offsetHeight;
|
|
697
|
+
y ? (d.top = `-${(c + R) / 2}px`, d.bottom = "") : (d.bottom = `-${(c + R) / 2}px`, d.top = ""), d.width = "50%", d.left = "50%", d.transform = "translateX(-50%)", d.cursor = "row-resize";
|
|
685
698
|
} else {
|
|
686
699
|
d.width = `${P}px`;
|
|
687
|
-
const
|
|
688
|
-
y ? (d.left = `-${(c +
|
|
700
|
+
const R = l.offsetWidth;
|
|
701
|
+
y ? (d.left = `-${(c + R) / 2}px`, d.right = "") : (d.right = `-${(c + R) / 2}px`, d.left = ""), d.height = "50%", d.top = "50%", d.transform = "translateY(-50%)", d.cursor = "col-resize";
|
|
689
702
|
}
|
|
690
703
|
}, G = () => {
|
|
691
704
|
a && (oe(a), p = null, g = null);
|
|
@@ -693,7 +706,7 @@ function Ze(t, e) {
|
|
|
693
706
|
s.removeSpots({ type: n });
|
|
694
707
|
const c = t.getSelected(), u = c == null ? void 0 : c.parent();
|
|
695
708
|
c && u && f.isValidRelationship(u, c) ? s.addSpot({ type: n, component: c }) : G();
|
|
696
|
-
},
|
|
709
|
+
}, w = () => {
|
|
697
710
|
const c = s.getSpots().filter((u) => u.type === n)[0];
|
|
698
711
|
c && x(c);
|
|
699
712
|
}, z = (c, u) => {
|
|
@@ -703,11 +716,11 @@ function Ze(t, e) {
|
|
|
703
716
|
h(), $(e) ? z("mj-section", "mj-column") : z(e.typeRow, e.typeColumn);
|
|
704
717
|
});
|
|
705
718
|
const S = "component:toggled";
|
|
706
|
-
return t.on(s.events.spot,
|
|
707
|
-
t.off(s.events.spot,
|
|
719
|
+
return t.on(s.events.spot, w), t.on(S, m), () => {
|
|
720
|
+
t.off(s.events.spot, w), t.off(S, m);
|
|
708
721
|
};
|
|
709
722
|
}
|
|
710
|
-
const
|
|
723
|
+
const et = function(t, e = {}) {
|
|
711
724
|
const s = {
|
|
712
725
|
typeRow: "flex-row",
|
|
713
726
|
typeColumn: "flex-column",
|
|
@@ -715,17 +728,17 @@ const Qe = function(t, e = {}) {
|
|
|
715
728
|
snapDivisions: 12,
|
|
716
729
|
minItemPercent: 5,
|
|
717
730
|
...e
|
|
718
|
-
}, n = [
|
|
719
|
-
|
|
731
|
+
}, n = [Ue(t, s), ke(t, s)], a = Qe(t, s), i = Oe(t, s);
|
|
732
|
+
Te({
|
|
720
733
|
editor: t,
|
|
721
734
|
licenseKey: s.licenseKey,
|
|
722
|
-
plan:
|
|
723
|
-
pluginName:
|
|
735
|
+
plan: Ye,
|
|
736
|
+
pluginName: Xe,
|
|
724
737
|
cleanup: () => {
|
|
725
738
|
n.forEach((o) => o == null ? void 0 : o()), a(), i == null || i();
|
|
726
739
|
}
|
|
727
740
|
});
|
|
728
|
-
},
|
|
741
|
+
}, tt = Ie(et);
|
|
729
742
|
export {
|
|
730
|
-
|
|
743
|
+
tt as default
|
|
731
744
|
};
|