@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36

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.
Files changed (88) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +175 -162
  3. package/dist/accordionComponent/index.umd.js +7 -7
  4. package/dist/aiChat/index.cjs.js +64 -64
  5. package/dist/aiChat/index.es.js +5785 -5757
  6. package/dist/aiChat/index.js +64 -64
  7. package/dist/aiChat/index.umd.js +63 -63
  8. package/dist/animationComponent/index.cjs.js +3 -3
  9. package/dist/animationComponent/index.es.js +204 -191
  10. package/dist/animationComponent/index.umd.js +3 -3
  11. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  12. package/dist/canvasAbsoluteMode/index.es.js +183 -170
  13. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  14. package/dist/canvasEmptyState/index.cjs.js +1 -1
  15. package/dist/canvasEmptyState/index.es.js +134 -121
  16. package/dist/canvasEmptyState/index.umd.js +1 -1
  17. package/dist/canvasFullSize/index.cjs.js +9 -9
  18. package/dist/canvasFullSize/index.es.js +165 -152
  19. package/dist/canvasFullSize/index.umd.js +9 -9
  20. package/dist/canvasGridMode/index.cjs.js +5 -5
  21. package/dist/canvasGridMode/index.es.js +245 -232
  22. package/dist/canvasGridMode/index.umd.js +4 -4
  23. package/dist/canvasScreenshot/index.cjs.js +1 -1
  24. package/dist/canvasScreenshot/index.es.js +155 -142
  25. package/dist/canvasScreenshot/index.umd.js +1 -1
  26. package/dist/dataSourceEjs/index.cjs.js +9 -9
  27. package/dist/dataSourceEjs/index.es.js +257 -244
  28. package/dist/dataSourceEjs/index.umd.js +9 -9
  29. package/dist/dataSourceHandlebars/index.cjs.js +8 -8
  30. package/dist/dataSourceHandlebars/index.es.js +216 -203
  31. package/dist/dataSourceHandlebars/index.umd.js +7 -7
  32. package/dist/dialogComponent/index.cjs.js +14 -14
  33. package/dist/dialogComponent/index.es.js +141 -128
  34. package/dist/dialogComponent/index.umd.js +14 -14
  35. package/dist/flexComponent/index.cjs.js +13 -13
  36. package/dist/flexComponent/index.es.js +484 -471
  37. package/dist/flexComponent/index.umd.js +13 -13
  38. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  39. package/dist/fsLightboxComponent/index.es.js +173 -160
  40. package/dist/fsLightboxComponent/index.umd.js +3 -3
  41. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  42. package/dist/googleFontsAssetProvider/index.es.js +160 -147
  43. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  44. package/dist/iconifyComponent/index.cjs.js +2 -2
  45. package/dist/iconifyComponent/index.es.js +196 -183
  46. package/dist/iconifyComponent/index.umd.js +2 -2
  47. package/dist/index.cjs.js +25 -25
  48. package/dist/index.es.js +121 -108
  49. package/dist/index.umd.js +18 -18
  50. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  51. package/dist/layoutSidebarButtons/index.es.js +157 -144
  52. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  53. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  54. package/dist/lightGalleryComponent/index.es.js +245 -232
  55. package/dist/lightGalleryComponent/index.umd.js +1 -1
  56. package/dist/linkImageComponent/index.cjs.js +2 -2
  57. package/dist/linkImageComponent/index.es.js +106 -93
  58. package/dist/linkImageComponent/index.umd.js +2 -2
  59. package/dist/listPagesComponent/index.cjs.js +5 -5
  60. package/dist/listPagesComponent/index.es.js +157 -144
  61. package/dist/listPagesComponent/index.umd.js +5 -5
  62. package/dist/presetPrintable/index.cjs.js +3 -3
  63. package/dist/presetPrintable/index.es.js +181 -168
  64. package/dist/presetPrintable/index.umd.js +3 -3
  65. package/dist/prosemirror/index.cjs.js +7 -7
  66. package/dist/prosemirror/index.es.js +385 -372
  67. package/dist/prosemirror/index.umd.js +8 -8
  68. package/dist/rendererReact/index.cjs.js +1 -1
  69. package/dist/rendererReact/index.es.js +200 -187
  70. package/dist/rendererReact/index.js +1 -1
  71. package/dist/rendererReact/index.umd.js +1 -1
  72. package/dist/rteTinyMce/index.cjs.js +2 -2
  73. package/dist/rteTinyMce/index.es.js +118 -105
  74. package/dist/rteTinyMce/index.umd.js +2 -2
  75. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  76. package/dist/shapeDividerComponent/index.es.js +129 -116
  77. package/dist/shapeDividerComponent/index.umd.js +4 -4
  78. package/dist/swiperComponent/index.cjs.js +9 -9
  79. package/dist/swiperComponent/index.es.js +203 -190
  80. package/dist/swiperComponent/index.umd.js +7 -7
  81. package/dist/tableComponent/index.cjs.js +1 -1
  82. package/dist/tableComponent/index.es.js +257 -244
  83. package/dist/tableComponent/index.umd.js +1 -1
  84. package/dist/types.d.ts +1 -1
  85. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  86. package/dist/youtubeAssetProvider/index.es.js +121 -108
  87. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  88. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- (function(b,I){typeof exports=="object"&&typeof module<"u"?module.exports=I():typeof define=="function"&&define.amd?define(I):(b=typeof globalThis<"u"?globalThis:b||self,b.StudioSdkPlugins_animationComponent=I())})(this,function(){"use strict";const b="app.grapesjs.com",I="app-stage.grapesjs.com",C=[b,"app2.grapesjs.com",I,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",G="license:check:end",V=()=>typeof window<"u",B=({isDev:t,isStage:n,isPlatform:a})=>`${t?"":`https://${n?I:b}`}/${a?"platform-api":"api"}`,M=()=>{const t=V()&&window.location.hostname;return!!t&&(C.includes(t)||C.some(n=>t.endsWith(n)))};async function F({path:t,baseApiUrl:n,method:a="GET",headers:s={},params:o,body:i}){const m=`${n||B({isDev:!1,isStage:!1})}${t}`,l={method:a,headers:{"Content-Type":"application/json",...s}};i&&(l.body=JSON.stringify(i));const p=o?new URLSearchParams(o).toString():"",y=p?`?${p}`:"",e=await fetch(`${m}${y}`,l);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.json()}var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{});const D={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function X(t){const n=t;return n.init=a=>s=>t(s,a),n}const _=t=>X(t);async function j({editor:t,plan:n,pluginName:a,licenseKey:s,onLicenseCheckResponse:o,cleanup:i}){let r="",m=!1;const l=M(),p=e=>{console.warn("Cleanup plugin:",a,"Reason:",e),i()},y=(e={})=>{var U;const{error:c,sdkLicense:f}=e,h=(U=e.plan)==null?void 0:U.category;if(!(f||e.license)||c)p(c||"Invalid license");else if(h){const N=D[n],et=D[h];N>et&&p({pluginRequiredPlan:n,licensePlan:h})}};t.on(O,e=>{r=e==null?void 0:e.baseApiUrl,m=!0}),t.on(G,e=>{o==null||o(e),y(e)}),setTimeout(async()=>{if(!m){if(l)return;if(s){const e=await $({licenseKey:s,pluginName:a,baseApiUrl:r});o==null||o(e),e&&y(e)}else p("The `licenseKey` option not provided")}},2e3)}async function $(t){const{licenseKey:n,pluginName:a,baseApiUrl:s}=t;try{return(await F({baseApiUrl:s,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const W=(...t)=>n=>t.some(a=>n.is(a));var d=(t=>(t.name="animation-name",t.duration="animation-duration",t.delay="animation-delay",t.iterationCount="animation-iteration-count",t.timingFunction="animation-timing-function",t.fillMode="animation-fill-mode",t))(d||{}),S=(t=>(t.onScroll="--animation-on-scroll",t.threshold="--animation-threshold",t.repeat="--animation-repeat",t))(S||{});const u="animation",w="animation-group",T="animation:update",A="animation-group:update",L={category:{id:"animations",label:"Animations"},select:!0},k=t=>(t==null?void 0:t.getType())===u,E=t=>(t==null?void 0:t.getType())===w,P=t=>k(t)||E(t),x={isVisible:({component:t})=>k(t)},Y={isVisible:({component:t})=>E(t)},H={isVisible:({component:t})=>k(t)&&E(t==null?void 0:t.parent())?!1:P(t)},z={isVisible:({component:t,sector:n})=>{var a;return k(t)&&E(t==null?void 0:t.parent())?!1:P(t)&&((a=n.getProperty(S.onScroll))==null?void 0:a.getValue())==="true"}},R={animation:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M16.5 14a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13"/><path fill="currentColor" d="M17.14 15.98a8.5 8.5 0 0 1-9.12-9.12 6.5 6.5 0 1 0 9.12 9.12"/><path fill="currentColor" d="M12.64 20.48a8.5 8.5 0 0 1-9.12-9.12 6.5 6.5 0 1 0 9.12 9.12"/></svg>',animationGroup:'<svg viewBox="0 0 24 24"><path d="M4 2a2 2 0 0 0-2 2v10h2V4h10V2H4m4 4a2 2 0 0 0-2 2v10h2V8h10V6H8m4 4a2 2 0 0 0-2 2v8c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-8Z"/></svg>'},K=function(t){const n=this;let a=null;const s=()=>{a==null||a.disconnect(),a=null},o=()=>{s();const i=n.style;i.animationName="",requestAnimationFrame(()=>{const r=getComputedStyle(n),m=r.getPropertyValue("animation-name").trim(),l=r.getPropertyValue("--animation-on-scroll").trim()!=="false",p=parseFloat(r.getPropertyValue("--animation-threshold").trim())||.2,y=r.getPropertyValue("--animation-repeat").trim()==="true",e=()=>{i.animationName="none",n.offsetWidth,i.animationName=m,i.animationPlayState="running"};if(!m||m==="none"){i.animationName="none",i.animationPlayState="paused";return}if(!l){e();return}i.animationPlayState="paused",a=new IntersectionObserver(c=>{c.forEach(f=>{f.isIntersecting&&(e(),!y&&s())})},{threshold:p}),a.observe(n)})};n.addEventListener(t.animationUpdateEvent,o),o()},q=(t,n)=>{const{Components:a,Blocks:s,Canvas:o}=t,{block:i={},animationList:r=[]}=n,m=t.Components.events,l="Animation",p=Object.values(S),y=Object.values(d);return a.addType(u,{block:i?{label:l,media:R.animation,content:{type:u},...L,...i}:void 0,model:{defaults:{emptyState:!0,name:l,traits:[],script:K,animationUpdateEvent:T,"script-props":["animationUpdateEvent"],styles:r.map(e=>e.css).join(`
2
- `)},init(){const{em:e}=this;this.addStyle({[d.name]:"fadeIn",[d.duration]:"1s",[d.fillMode]:"both",...n.animationStyle,...this.getStyle()}),this.listenTo(e,m.mount,c=>{var h;if(c!==this)return;((h=this.parent())==null?void 0:h.get("type"))!==w||p.forEach(g=>this.removeStyle(g))})}},view:{events:()=>({animationstart:"onAnimationStart",animationend:"onAnimationEnd"}),init(){const{model:e}=this;this.listenTo(e,m.styleUpdate,this.handleStyleChange)},onAnimationStart(){var c;if((c=this.cmpSpots)!=null&&c.length)return;const e=o.getSpots({component:this.model});this.cmpSpots=e,o.removeSpots(e),this.el.ownerDocument.body.style.overflowX="hidden"},onAnimationEnd(){const e=this.cmpSpots||[];o.spots.add(e),this.cmpSpots=[],this.el.ownerDocument.body.style.overflowX=""},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(T))},handleStyleChange(e,c){Object.keys((c==null?void 0:c.style)||{}).some(g=>y.includes(g)||p.includes(g))&&this.triggerAnimation()},onRender(){this.triggerAnimation()}}}),()=>{s.remove(u),a.removeType(u)}},J=function(t){const n=this,a="--animation-on-scroll",s="--animation-threshold",o="--animation-repeat";let i=null;const r=()=>{i==null||i.disconnect(),i=null},m=()=>{r();const l=getComputedStyle(n),p=l.getPropertyValue(a).trim()!=="false",y=parseFloat(l.getPropertyValue(s).trim())||.2,e=l.getPropertyValue(o).trim()==="true",c=()=>{Array.from(n.children).forEach(f=>{f instanceof HTMLElement&&typeof f.dispatchEvent=="function"&&f.dispatchEvent(new CustomEvent(A,{bubbles:!1}))})};if(!p){c();return}i=new IntersectionObserver(f=>{f.forEach(h=>{h.isIntersecting?(c(),!e&&r()):e&&Array.from(n.children).forEach(g=>{g instanceof HTMLElement&&getComputedStyle(g).getPropertyValue(a).trim()!=="false"&&(g.style.opacity="0",g.style.animationPlayState="paused")})})},{threshold:y}),i.observe(n)};n.addEventListener(t.animationGroupUpdateEvent,m),m()},Q=(t,n)=>{const{Components:a,Blocks:s}=t,{blockGroup:o={}}=n,i="Animation Group";return a.addType(w,{block:o?{label:i,media:R.animationGroup,content:{type:w,components:[{type:u},{type:u},{type:u}]},...L,...o}:void 0,model:{defaults:{name:i,emptyState:!0,traits:[],script:J,animationGroupUpdateEvent:A,"script-props":["animationGroupUpdateEvent"],droppable:W(u)},init(){this.addStyle({...n.animationGroupStyle,...this.getStyle()});const r=this.components();this.listenTo(r,"add remove",this.updateChildrenStaggerStyles),this.updateChildrenStaggerStyles()},updateChildrenStaggerStyles(){this.components().forEach((r,m)=>{r.is(u)&&r.addStyle({"--stagger-index":m.toString(),[d.delay]:"calc(var(--stagger-index, 0) * var(--stagger-delay, 0.3s))"},{partial:!0})})}},view:{init(){const{model:r}=this;this.listenTo(r,"component:styleUpdate",this.handleStyleChange)},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(A))},handleStyleChange(){this.triggerAnimation(),this.model.updateChildrenStaggerStyles()},onRender(){this.triggerAnimation()}}}),()=>{s.remove(w),a.removeType(w)}},tt="animationComponent",nt=v.startup,Z=[{id:"flash",name:"Flash",css:`@keyframes flash {
1
+ (function(b,I){typeof exports=="object"&&typeof module<"u"?module.exports=I():typeof define=="function"&&define.amd?define(I):(b=typeof globalThis<"u"?globalThis:b||self,b.StudioSdkPlugins_animationComponent=I())})(this,function(){"use strict";const b="app.grapesjs.com",I="app-stage.grapesjs.com",T=[b,"app2.grapesjs.com",I,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],M="license:check:end",N=()=>typeof window<"u",F=({isDev:t,isStage:e,isPlatform:a})=>`${t?"":`https://${e?I:b}`}/${a?"platform-api":"api"}`,V=()=>{const t=N()&&window.location.hostname;return!!t&&(T.includes(t)||T.some(e=>t.endsWith(e)))};async function X({path:t,baseApiUrl:e,method:a="GET",headers:r={},params:i,body:o}){const s=`${e||F({isDev:!1,isStage:!1})}${t}`,p={method:a,headers:{"Content-Type":"application/json",...r}};o&&(p.body=JSON.stringify(o));const d=i?new URLSearchParams(i).toString():"",f=d?`?${d}`:"",n=await fetch(`${s}${f}`,p);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{}),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||{});const S={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function j(t){const e=t;return e.init=a=>r=>t(r,a),e}const _=t=>j(t);async function $({editor:t,plan:e,pluginName:a,licenseKey:r,onLicenseCheckResponse:i,cleanup:o}){let l="",s;const p=n=>{console.warn("Cleanup plugin:",a,"Reason:",n),o()},d=(n={})=>{var E;const{error:c,sdkLicense:u}=n,h=(E=n.plan)==null?void 0:E.category;if(!(u||n.license)||c)p(c||"Invalid license");else if(h){const Z=S[e],at=S[h];Z>at&&p({pluginRequiredPlan:e,licensePlan:h})}};t.Commands.has(w.settings)&&(s=t.runCommand(w.settings),l=(s==null?void 0:s.baseUrl)||"");const f=n=>{i==null||i(n),n&&d(n)};if(!s){t.onReady(async()=>{if(!V())if(r){const n=await Y({licenseKey:r,pluginName:a,baseApiUrl:l});f(n)}else p("The `licenseKey` option not provided")});return}if(s.licensePlan||s.licenseError){const n=C(s);f(n);return}t.on(M,n=>f(n))}const C=t=>({sdkLicense:t.license,license:t.license,error:t.licenseError,plan:t.licensePlan});async function Y(t){const{licenseKey:e,pluginName:a,baseApiUrl:r}=t;try{return(await X({baseApiUrl:r,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const W=(...t)=>e=>t.some(a=>e.is(a));var m=(t=>(t.name="animation-name",t.duration="animation-duration",t.delay="animation-delay",t.iterationCount="animation-iteration-count",t.timingFunction="animation-timing-function",t.fillMode="animation-fill-mode",t))(m||{}),x=(t=>(t.onScroll="--animation-on-scroll",t.threshold="--animation-threshold",t.repeat="--animation-repeat",t))(x||{});const g="animation",A="animation-group",L="animation:update",D="animation-group:update",U={category:{id:"animations",label:"Animations"},select:!0},P=t=>(t==null?void 0:t.getType())===g,R=t=>(t==null?void 0:t.getType())===A,G=t=>P(t)||R(t),k={isVisible:({component:t})=>P(t)},H={isVisible:({component:t})=>R(t)},K={isVisible:({component:t})=>P(t)&&R(t==null?void 0:t.parent())?!1:G(t)},O={isVisible:({component:t,sector:e})=>{var a;return P(t)&&R(t==null?void 0:t.parent())?!1:G(t)&&((a=e.getProperty(x.onScroll))==null?void 0:a.getValue())==="true"}},z={animation:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M16.5 14a6.5 6.5 0 1 0 0-13 6.5 6.5 0 0 0 0 13"/><path fill="currentColor" d="M17.14 15.98a8.5 8.5 0 0 1-9.12-9.12 6.5 6.5 0 1 0 9.12 9.12"/><path fill="currentColor" d="M12.64 20.48a8.5 8.5 0 0 1-9.12-9.12 6.5 6.5 0 1 0 9.12 9.12"/></svg>',animationGroup:'<svg viewBox="0 0 24 24"><path d="M4 2a2 2 0 0 0-2 2v10h2V4h10V2H4m4 4a2 2 0 0 0-2 2v10h2V8h10V6H8m4 4a2 2 0 0 0-2 2v8c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-8Z"/></svg>'},q=function(t){const e=this;let a=null;const r=()=>{a==null||a.disconnect(),a=null},i=()=>{r();const o=e.style;o.animationName="",requestAnimationFrame(()=>{const l=getComputedStyle(e),s=l.getPropertyValue("animation-name").trim(),p=l.getPropertyValue("--animation-on-scroll").trim()!=="false",d=parseFloat(l.getPropertyValue("--animation-threshold").trim())||.2,f=l.getPropertyValue("--animation-repeat").trim()==="true",n=()=>{o.animationName="none",e.offsetWidth,o.animationName=s,o.animationPlayState="running"};if(!s||s==="none"){o.animationName="none",o.animationPlayState="paused";return}if(!p){n();return}o.animationPlayState="paused",a=new IntersectionObserver(c=>{c.forEach(u=>{u.isIntersecting&&(n(),!f&&r())})},{threshold:d}),a.observe(e)})};e.addEventListener(t.animationUpdateEvent,i),i()},J=(t,e)=>{const{Components:a,Blocks:r,Canvas:i}=t,{block:o={},animationList:l=[]}=e,s=t.Components.events,p="Animation",d=Object.values(x),f=Object.values(m);return a.addType(g,{block:o?{label:p,media:z.animation,content:{type:g},...U,...o}:void 0,model:{defaults:{emptyState:!0,name:p,traits:[],script:q,animationUpdateEvent:L,"script-props":["animationUpdateEvent"],styles:l.map(n=>n.css).join(`
2
+ `)},init(){const{em:n}=this;this.addStyle({[m.name]:"fadeIn",[m.duration]:"1s",[m.fillMode]:"both",...e.animationStyle,...this.getStyle()}),this.listenTo(n,s.mount,c=>{var h;if(c!==this)return;((h=this.parent())==null?void 0:h.get("type"))!==A||d.forEach(y=>this.removeStyle(y))})}},view:{events:()=>({animationstart:"onAnimationStart",animationend:"onAnimationEnd"}),init(){const{model:n}=this;this.listenTo(n,s.styleUpdate,this.handleStyleChange)},onAnimationStart(){var c;if((c=this.cmpSpots)!=null&&c.length)return;const n=i.getSpots({component:this.model});this.cmpSpots=n,i.removeSpots(n),this.el.ownerDocument.body.style.overflowX="hidden"},onAnimationEnd(){const n=this.cmpSpots||[];i.spots.add(n),this.cmpSpots=[],this.el.ownerDocument.body.style.overflowX=""},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(L))},handleStyleChange(n,c){Object.keys((c==null?void 0:c.style)||{}).some(y=>f.includes(y)||d.includes(y))&&this.triggerAnimation()},onRender(){this.triggerAnimation()}}}),()=>{r.remove(g),a.removeType(g)}},Q=function(t){const e=this,a="--animation-on-scroll",r="--animation-threshold",i="--animation-repeat";let o=null;const l=()=>{o==null||o.disconnect(),o=null},s=()=>{l();const p=getComputedStyle(e),d=p.getPropertyValue(a).trim()!=="false",f=parseFloat(p.getPropertyValue(r).trim())||.2,n=p.getPropertyValue(i).trim()==="true",c=()=>{Array.from(e.children).forEach(u=>{u instanceof HTMLElement&&typeof u.dispatchEvent=="function"&&u.dispatchEvent(new CustomEvent(D,{bubbles:!1}))})};if(!d){c();return}o=new IntersectionObserver(u=>{u.forEach(h=>{h.isIntersecting?(c(),!n&&l()):n&&Array.from(e.children).forEach(y=>{y instanceof HTMLElement&&getComputedStyle(y).getPropertyValue(a).trim()!=="false"&&(y.style.opacity="0",y.style.animationPlayState="paused")})})},{threshold:f}),o.observe(e)};e.addEventListener(t.animationGroupUpdateEvent,s),s()},tt=(t,e)=>{const{Components:a,Blocks:r}=t,{blockGroup:i={}}=e,o="Animation Group";return a.addType(A,{block:i?{label:o,media:z.animationGroup,content:{type:A,components:[{type:g},{type:g},{type:g}]},...U,...i}:void 0,model:{defaults:{name:o,emptyState:!0,traits:[],script:Q,animationGroupUpdateEvent:D,"script-props":["animationGroupUpdateEvent"],droppable:W(g)},init(){this.addStyle({...e.animationGroupStyle,...this.getStyle()});const l=this.components();this.listenTo(l,"add remove",this.updateChildrenStaggerStyles),this.updateChildrenStaggerStyles()},updateChildrenStaggerStyles(){this.components().forEach((l,s)=>{l.is(g)&&l.addStyle({"--stagger-index":s.toString(),[m.delay]:"calc(var(--stagger-index, 0) * var(--stagger-delay, 0.3s))"},{partial:!0})})}},view:{init(){const{model:l}=this;this.listenTo(l,"component:styleUpdate",this.handleStyleChange)},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(D))},handleStyleChange(){this.triggerAnimation(),this.model.updateChildrenStaggerStyles()},onRender(){this.triggerAnimation()}}}),()=>{r.remove(A),a.removeType(A)}},et="animationComponent",nt=v.startup,B=[{id:"flash",name:"Flash",css:`@keyframes flash {
3
3
  0%, 50%, to {
4
4
  opacity:1
5
5
  }
@@ -516,4 +516,4 @@
516
516
  transform: scale3d(.475, .475, .475) translate3d(0, -60px, 0);
517
517
  animation-timing-function:cubic-bezier(.175, .885, .32, 1)
518
518
  }
519
- }`}];return _(function(t,n={}){var o;const a=((o=n.animations)==null?void 0:o.call(n,{items:Z}))||Z,s=[q(t,{...n,animationList:a}),Q(t,n)];t.Styles.addSector("animation",{name:"Animation",properties:[{...x,name:"Type",property:d.name,type:"select",full:!0,default:"fadeIn",options:a},{...x,name:"Duration",property:d.duration,type:"number",units:["s"],min:.1,max:10,step:.1,default:"1s"},{...x,name:"Delay",property:d.delay,type:"number",units:["s"],min:0,max:10,step:.1,default:"1s"},{...x,name:"Iteration Count",property:d.iterationCount,type:"select",default:"1",options:[{id:"1",name:"One time"},{id:"infinite",name:"Infinite"}]},{...x,name:"Timing",property:d.timingFunction,type:"select",default:"ease",options:[{id:"ease",name:"Ease"},{id:"ease-in",name:"Ease in"},{id:"ease-out",name:"Ease out"},{id:"ease-in-out",name:"Ease in out"},{id:"linear",name:"Linear"}]},{...Y,name:"Stagger Delay",property:"--stagger-delay",type:"slider",units:["s"],min:.1,max:5,step:.1,default:"0.3s"},{...H,name:"Animate on Scroll",property:S.onScroll,type:"radio",default:"true",options:[{name:"Yes",id:"true"},{name:"No",id:"false"}]},{...z,name:"Scroll Threshold",property:S.threshold,type:"number",full:!0,min:.1,max:1,step:.01,default:"0.2"},{...z,name:"Repeat on Scroll",property:S.repeat,type:"radio",default:"false",options:[{name:"Yes",id:"true"},{name:"No",id:"false"}]}]}),j({editor:t,licenseKey:n.licenseKey,plan:nt,pluginName:tt,cleanup:()=>{s.forEach(i=>i())}})})});
519
+ }`}];return _(function(t,e={}){var i;const a=((i=e.animations)==null?void 0:i.call(e,{items:B}))||B,r=[J(t,{...e,animationList:a}),tt(t,e)];t.Styles.addSector("animation",{name:"Animation",properties:[{...k,name:"Type",property:m.name,type:"select",full:!0,default:"fadeIn",options:a},{...k,name:"Duration",property:m.duration,type:"number",units:["s"],min:.1,max:10,step:.1,default:"1s"},{...k,name:"Delay",property:m.delay,type:"number",units:["s"],min:0,max:10,step:.1,default:"1s"},{...k,name:"Iteration Count",property:m.iterationCount,type:"select",default:"1",options:[{id:"1",name:"One time"},{id:"infinite",name:"Infinite"}]},{...k,name:"Timing",property:m.timingFunction,type:"select",default:"ease",options:[{id:"ease",name:"Ease"},{id:"ease-in",name:"Ease in"},{id:"ease-out",name:"Ease out"},{id:"ease-in-out",name:"Ease in out"},{id:"linear",name:"Linear"}]},{...H,name:"Stagger Delay",property:"--stagger-delay",type:"slider",units:["s"],min:.1,max:5,step:.1,default:"0.3s"},{...K,name:"Animate on Scroll",property:x.onScroll,type:"radio",default:"true",options:[{name:"Yes",id:"true"},{name:"No",id:"false"}]},{...O,name:"Scroll Threshold",property:x.threshold,type:"number",full:!0,min:.1,max:1,step:.01,default:"0.2"},{...O,name:"Repeat on Scroll",property:x.repeat,type:"radio",default:"false",options:[{name:"Yes",id:"true"},{name:"No",id:"false"}]}]}),$({editor:t,licenseKey:e.licenseKey,plan:nt,pluginName:et,cleanup:()=>{r.forEach(o=>o())}})})});
@@ -1 +1 @@
1
- "use strict";const V="app.grapesjs.com",H="app-stage.grapesjs.com",j="app2.grapesjs.com",F="app-stage2.grapesjs.com",U=[V,j,H,F,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],q="license:check:start",J="license:check:end",z=()=>typeof window<"u",Q=({isDev:t,isStage:a,isPlatform:u})=>`${t?"":`https://${a?H:V}`}/${u?"platform-api":"api"}`,Z=()=>{const t=z()&&window.location.hostname;return!!t&&(U.includes(t)||U.some(a=>t.endsWith(a)))};function k(t){return typeof t=="function"}async function tt({path:t,baseApiUrl:a,method:u="GET",headers:l={},params:i,body:o}){const n=`${a||Q({isDev:!1,isStage:!1})}${t}`,g={method:u,headers:{"Content-Type":"application/json",...l}};o&&(g.body=JSON.stringify(o));const d=i?new URLSearchParams(i).toString():"",c=d?`?${d}`:"",e=await fetch(`${n}${c}`,g);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.json()}var G=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(G||{});const W={[G.free]:0,[G.startup]:10,[G.business]:20,[G.enterprise]:30};function et(t){const a=t;return a.init=u=>l=>t(l,u),a}const nt=t=>et(t);async function ot({editor:t,plan:a,pluginName:u,licenseKey:l,onLicenseCheckResponse:i,cleanup:o}){let s="",n=!1;const g=Z(),d=e=>{console.warn("Cleanup plugin:",u,"Reason:",e),o()},c=(e={})=>{var b;const{error:r,sdkLicense:f}=e,y=(b=e.plan)==null?void 0:b.category;if(!(f||e.license)||r)d(r||"Invalid license");else if(y){const v=W[a],E=W[y];v>E&&d({pluginRequiredPlan:a,licensePlan:y})}};t.on(q,e=>{s=e==null?void 0:e.baseApiUrl,n=!0}),t.on(J,e=>{i==null||i(e),c(e)}),setTimeout(async()=>{if(!n){if(g)return;if(l){const e=await st({licenseKey:l,pluginName:u,baseApiUrl:s});i==null||i(e),e&&c(e)}else d("The `licenseKey` option not provided")}},2e3)}async function st(t){const{licenseKey:a,pluginName:u,baseApiUrl:l}=t;try{return(await tt({baseApiUrl:l,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:u}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const it="canvasAbsoluteMode",ct=G.startup,at=(t,a,u)=>{var d,c;const l=u.enableAbsolute??(e=>e.hasAbsolute),o=(Array.isArray(a)?a:a?[a]:[...t.getSelectedAll()])[0],s=((c=(d=o==null?void 0:o.delegate)==null?void 0:d.move)==null?void 0:c.call(d,o))||o;if(!s)return;const n=s.getEl();return{result:k(l)?l({component:s,hasAbsolute:!!n&&getComputedStyle(n).position==="absolute"}):!1,component:s,dmode:s.get("dmode")}};function B({guideMatched:t,canvasView:a}){var C;const u=t.guide.x===void 0?"y":"x";let l=0,i=0,o=0,s=0;const{guide:n,matched:g}=t,d=a.getElBoxRect(n.componentView.el),c=a.getElBoxRect(((C=g.componentView)==null?void 0:C.el)||g.componentEl),e=d.y,r=d.y+d.height,f=d.x,y=d.x+d.width,S=c.y,b=c.y+c.height,v=c.x,E=c.x+c.width,x=Math.max(0,e-b),m=Math.max(0,S-r),w=Math.max(0,f-E),M=Math.max(0,v-y),p=x>m,h=w>M,_=n.type;return u==="x"&&(_==="l"?(l=f,p?(i=b,o=x):(i=r,o=m)):_==="r"?(l=y,p?(i=b,o=x):(i=r,o=m)):_==="x"&&(l=f-(f-y)/2,p?(i=b,o=x):(i=r,o=m))),u==="y"&&(_==="t"?(i=e,h?(l=E,s=w):(l=y,s=M)):_==="b"?(i=r,h?(l=E,s=w):(l=y,s=M)):_==="y"&&(i=e-(e-r)/2,h?(l=E,s=w):(l=y,s=M))),{axis:u,x:l,y:i,width:s,height:o}}function lt({guideMatched:t,component:a,canvasView:u}){const l=t.guide.x===void 0?"x":"y",{guide:i,matched:o}=t,s=i.type,n=o.type,g=u.getElementPos(i.componentView.el).rect,d=u.getElementPos(o.componentView.el).rect;if(l==="x"){const c=g.height,e=d.top,r=d.top+d.height;let f=0;s==="t"?n==="t"?f=e-c:n==="b"?f=r-c:n==="y"&&(f=e-c-(e-r)/2):s==="b"?n==="t"?f=e-c*2:n==="b"?f=r-c*2:n==="y"&&(f=e-c*2-(e-r)/2):s==="y"&&(n==="t"?f=e-c*1.5:n==="b"?f=r-c*1.5:n==="y"&&(f=e-c*1.5-(e-r)/2)),a.addStyle({top:`${f-5}px`},{partial:!0})}if(l==="y"){const c=g.width,e=d.left,r=d.left+d.width;let f=0;s==="l"?n==="l"?f=e:n==="r"?f=r:n==="x"&&(f=e-(e-r)/2):s==="r"?n==="l"?f=e-c:n==="r"?f=r-c:n==="x"&&(f=e-c-(e-r)/2):s==="x"&&(n==="l"?f=e-c/2:n==="r"&&(f=r-c/2)),a.addStyle({left:`${f}px`},{partial:!0})}}function X({snapping:t,editor:a,props:u}){var N,P;const{command:l,guidesMatched:i}=u,o=u.component,s=o.getEl(),n=a.Canvas.getCanvasView(),{x:g,y:d}=t??{x:10,y:10},c=l.opts.event,e=c.clientX,r=c.clientY;if(!o.__lastSnappedPosition){const A=n.getElBoxRect(s),D=e-A.x,T=r-A.y;o.__lastSnappedPosition={left:A.x,top:A.y},o.__dragOffset={x:D,y:T}}const f=((N=o.__dragOffset)==null?void 0:N.x)||0,y=((P=o.__dragOffset)==null?void 0:P.y)||0,S=o.__lastSnappedPosition,b=e-S.left-f,v=r-S.top-y;let E=S.left,x=S.top;const m=i==null?void 0:i[0],w=(m==null?void 0:m.guide.type)==="l",M=(m==null?void 0:m.guide.type)==="x",p=(m==null?void 0:m.guide.type)==="r",h=(m==null?void 0:m.guide.type)==="t",_=(m==null?void 0:m.guide.type)==="b",C=(m==null?void 0:m.guide.type)==="y";if(m){const{x:A,y:D}=B({guideMatched:m,canvasView:n}),T=s.offsetWidth,L=s.offsetHeight;w?E=A:p?E=A-T:M?E=A-T/2:h?x=D:_?x=D-L:C&&(x=D-L/2),o.__lastSnappedGuideMatched=m}else Math.abs(b)>=g&&(E=Math.round((S.left+b)/g)*g,o.__lastSnappedGuideMatched=null),Math.abs(v)>=d&&(x=Math.round((S.top+v)/d)*d,o.__lastSnappedGuideMatched=null);return o.addStyle({left:`${E}px`,top:`${x}px`},{partial:!0}),o.__lastSnappedPosition={left:E,top:x},{x:E,y:x,guideMatched:o.__lastSnappedGuideMatched}}function dt({snapping:t,props:a,editor:u}){const{x:l,y:i}=X({snapping:t,props:a,editor:u}),o=a.component;o.addStyle({left:`${l}px`,top:`${i}px`}),delete o.__lastSnappedPosition,delete o.__lastSnappedGuideMatched}const ft="core:component-drag",rt="studio:setDragAbsolute",pt="dmode:start",Y="dmode:move",K="dmode:end",$="dragAbsolute",ut="select",mt="hover",ht="spacing",gt=function(t,a={}){const{Commands:u}=t,l=u.events,i=u.getConfig().defaultOptions??{},o=`${l.runBeforeCommand}tlb-move`;i[ft]={run:p=>({...p,skipGuidesRender:!0})};const{snapping:s,locking:n,globalAbsolute:g=!0}=a;g&&t.setDragMode("absolute");const d=!!(s!=null&&s.x||s!=null&&s.y),c=!!(n!=null&&n.x||n!=null&&n.y),{Canvas:e}=t;let r=null;const f=p=>{const{component:h,guidesMatched:_,command:C}=p,N=h.view,P=t.Canvas.getCanvasView(),A=h.getEl();let D=_.map(O=>O.matched.componentEl),T=_.map(O=>B({guideMatched:O,canvasView:P}));if(d){const{guideMatched:O}=X({snapping:s,props:p,editor:t});O?(D=[O.matched.componentEl],T=[B({guideMatched:O,canvasView:P})]):(D=[],T=[])}if(c)if(C.opts.event.shiftKey)if(!r)r=_[0];else{const R=r,I=R.guide.x===void 0?"x":"y";(I==="x"&&(n==null?void 0:n.x)||I==="y"&&(n==null?void 0:n.y))&&(lt({guideMatched:R,component:h,canvasView:P}),D=[R.matched.componentEl],T=[B({guideMatched:R,canvasView:P})])}else r=null;const L={id:$,type:$,component:h,componentView:N,originComponent:A,matchedComponents:D,originMatchedDistances:T};e.addSpot(L)},y=({enabled:p})=>{t.runCommand(rt,{enabled:p})},S=({type:p})=>{e.removeSpots({type:p})},b=()=>{S({type:ut}),S({type:mt}),S({type:ht})},v=p=>{y({enabled:!0}),f(p),b()},E=p=>{f(p),b()},x=p=>{S({type:$}),d&&dt({snapping:s,props:p,editor:t}),y({enabled:!1})},M=[[pt,p=>{v(p),t.on(Y,E);const h=()=>{x(p),t.off(Y,E),t.off(K,h)};t.on(K,h)}],[o,p=>{if(g)return;const h=p.options.target,_=at(t,h,a);_!=null&&_.result&&!_.dmode&&(p.options.mode="absolute")}]];M.forEach(([p,h])=>t.on(p,h)),ot({editor:t,licenseKey:a.licenseKey,plan:ct,pluginName:it,cleanup:()=>{y({enabled:!1}),M.forEach(([p,h])=>t.off(p,h))}})},yt=nt(gt);module.exports=yt;
1
+ "use strict";const K="app.grapesjs.com",k="app-stage.grapesjs.com",H="app2.grapesjs.com",q="app-stage2.grapesjs.com",W=[K,H,k,q,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],J="license:check:end",z=()=>typeof window<"u",Q=({isDev:e,isStage:a,isPlatform:u})=>`${e?"":`https://${a?k:K}`}/${u?"platform-api":"api"}`,Z=()=>{const e=z()&&window.location.hostname;return!!e&&(W.includes(e)||W.some(a=>e.endsWith(a)))};function C(e){return typeof e=="function"}async function ee({path:e,baseApiUrl:a,method:u="GET",headers:c={},params:l,body:s}){const t=`${a||Q({isDev:!1,isStage:!1})}${e}`,h={method:u,headers:{"Content-Type":"application/json",...c}};s&&(h.body=JSON.stringify(s));const d=l?new URLSearchParams(l).toString():"",i=d?`?${d}`:"",o=await fetch(`${t}${i}`,h);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var B=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(B||{}),U=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(U||{});const V={[B.free]:0,[B.startup]:10,[B.business]:20,[B.enterprise]:30};function te(e){const a=e;return a.init=u=>c=>e(c,u),a}const oe=e=>te(e);async function se({editor:e,plan:a,pluginName:u,licenseKey:c,onLicenseCheckResponse:l,cleanup:s}){let n="",t;const h=o=>{console.warn("Cleanup plugin:",u,"Reason:",o),s()},d=(o={})=>{var A;const{error:p,sdkLicense:r}=o,b=(A=o.plan)==null?void 0:A.category;if(!(r||o.license)||p)h(p||"Invalid license");else if(b){const R=V[a],E=V[b];R>E&&h({pluginRequiredPlan:a,licensePlan:b})}};e.Commands.has(U.settings)&&(t=e.runCommand(U.settings),n=(t==null?void 0:t.baseUrl)||"");const i=o=>{l==null||l(o),o&&d(o)};if(!t){e.onReady(async()=>{if(!Z())if(c){const o=await ie({licenseKey:c,pluginName:u,baseApiUrl:n});i(o)}else h("The `licenseKey` option not provided")});return}if(t.licensePlan||t.licenseError){const o=ne(t);i(o);return}e.on(J,o=>i(o))}const ne=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function ie(e){const{licenseKey:a,pluginName:u,baseApiUrl:c}=e;try{return(await ee({baseApiUrl:c,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:u}})).result||{}}catch(l){return console.error("Error during SDK license check:",l),!1}}const ae="canvasAbsoluteMode",le=B.startup,ce=(e,a,u)=>{var d,i;const c=u.enableAbsolute??(o=>o.hasAbsolute),s=(Array.isArray(a)?a:a?[a]:[...e.getSelectedAll()])[0],n=((i=(d=s==null?void 0:s.delegate)==null?void 0:d.move)==null?void 0:i.call(d,s))||s;if(!n)return;const t=n.getEl();return{result:C(c)?c({component:n,hasAbsolute:!!t&&getComputedStyle(t).position==="absolute"}):!1,component:n,dmode:n.get("dmode")}};function I({guideMatched:e,canvasView:a}){var w;const u=e.guide.x===void 0?"y":"x";let c=0,l=0,s=0,n=0;const{guide:t,matched:h}=e,d=a.getElBoxRect(t.componentView.el),i=a.getElBoxRect(((w=h.componentView)==null?void 0:w.el)||h.componentEl),o=d.y,p=d.y+d.height,r=d.x,b=d.x+d.width,v=i.y,A=i.y+i.height,R=i.x,E=i.x+i.width,T=Math.max(0,o-A),g=Math.max(0,v-p),G=Math.max(0,r-E),D=Math.max(0,R-b),f=T>g,y=G>D,x=t.type;return u==="x"&&(x==="l"?(c=r,f?(l=A,s=T):(l=p,s=g)):x==="r"?(c=b,f?(l=A,s=T):(l=p,s=g)):x==="x"&&(c=r-(r-b)/2,f?(l=A,s=T):(l=p,s=g))),u==="y"&&(x==="t"?(l=o,y?(c=E,n=G):(c=b,n=D)):x==="b"?(l=p,y?(c=E,n=G):(c=b,n=D)):x==="y"&&(l=o-(o-p)/2,y?(c=E,n=G):(c=b,n=D))),{axis:u,x:c,y:l,width:n,height:s}}function re({guideMatched:e,component:a,canvasView:u}){const c=e.guide.x===void 0?"x":"y",{guide:l,matched:s}=e,n=l.type,t=s.type,h=u.getElementPos(l.componentView.el).rect,d=u.getElementPos(s.componentView.el).rect;if(c==="x"){const i=h.height,o=d.top,p=d.top+d.height;let r=0;n==="t"?t==="t"?r=o-i:t==="b"?r=p-i:t==="y"&&(r=o-i-(o-p)/2):n==="b"?t==="t"?r=o-i*2:t==="b"?r=p-i*2:t==="y"&&(r=o-i*2-(o-p)/2):n==="y"&&(t==="t"?r=o-i*1.5:t==="b"?r=p-i*1.5:t==="y"&&(r=o-i*1.5-(o-p)/2)),a.addStyle({top:`${r-5}px`},{partial:!0})}if(c==="y"){const i=h.width,o=d.left,p=d.left+d.width;let r=0;n==="l"?t==="l"?r=o:t==="r"?r=p:t==="x"&&(r=o-(o-p)/2):n==="r"?t==="l"?r=o-i:t==="r"?r=p-i:t==="x"&&(r=o-i-(o-p)/2):n==="x"&&(t==="l"?r=o-i/2:t==="r"&&(r=p-i/2)),a.addStyle({left:`${r}px`},{partial:!0})}}function X({snapping:e,editor:a,props:u}){var S,L;const{command:c,guidesMatched:l}=u,s=u.component,n=s.getEl(),t=a.Canvas.getCanvasView(),{x:h,y:d}=e??{x:10,y:10},i=c.opts.event,o=i.clientX,p=i.clientY;if(!s.__lastSnappedPosition){const P=t.getElBoxRect(n),_=o-P.x,M=p-P.y;s.__lastSnappedPosition={left:P.x,top:P.y},s.__dragOffset={x:_,y:M}}const r=((S=s.__dragOffset)==null?void 0:S.x)||0,b=((L=s.__dragOffset)==null?void 0:L.y)||0,v=s.__lastSnappedPosition,A=o-v.left-r,R=p-v.top-b;let E=v.left,T=v.top;const g=l==null?void 0:l[0],G=(g==null?void 0:g.guide.type)==="l",D=(g==null?void 0:g.guide.type)==="x",f=(g==null?void 0:g.guide.type)==="r",y=(g==null?void 0:g.guide.type)==="t",x=(g==null?void 0:g.guide.type)==="b",w=(g==null?void 0:g.guide.type)==="y";if(g){const{x:P,y:_}=I({guideMatched:g,canvasView:t}),M=n.offsetWidth,m=n.offsetHeight;G?E=P:f?E=P-M:D?E=P-M/2:y?T=_:x?T=_-m:w&&(T=_-m/2),s.__lastSnappedGuideMatched=g}else Math.abs(A)>=h&&(E=Math.round((v.left+A)/h)*h,s.__lastSnappedGuideMatched=null),Math.abs(R)>=d&&(T=Math.round((v.top+R)/d)*d,s.__lastSnappedGuideMatched=null);return s.addStyle({left:`${E}px`,top:`${T}px`},{partial:!0}),s.__lastSnappedPosition={left:E,top:T},{x:E,y:T,guideMatched:s.__lastSnappedGuideMatched}}function de({snapping:e,props:a,editor:u}){const{x:c,y:l}=X({snapping:e,props:a,editor:u}),s=a.component;s.addStyle({left:`${c}px`,top:`${l}px`}),delete s.__lastSnappedPosition,delete s.__lastSnappedGuideMatched}const pe="core:component-drag",fe="studio:setDragAbsolute",ue="dmode:start",j="dmode:move",F="dmode:end",$="dragAbsolute",ge="select",he="hover",ye="spacing",be=function(e,a={}){const{Commands:u}=e,c=u.events,l=u.getConfig().defaultOptions??{},s=`${c.runBeforeCommand}tlb-move`;l[pe]={run:f=>({...f,skipGuidesRender:!0})};const{snapping:n,locking:t,globalAbsolute:h=!0}=a;h&&e.setDragMode("absolute");const d=!!(n!=null&&n.x||n!=null&&n.y),i=!!(t!=null&&t.x||t!=null&&t.y),{Canvas:o}=e;let p=null;const r=f=>{const{component:y,guidesMatched:x,command:w}=f,S=y.view,L=e.Canvas.getCanvasView(),P=y.getEl();let _=x.map(O=>O.matched.componentEl),M=x.map(O=>I({guideMatched:O,canvasView:L}));if(d){const{guideMatched:O}=X({snapping:n,props:f,editor:e});O?(_=[O.matched.componentEl],M=[I({guideMatched:O,canvasView:L})]):(_=[],M=[])}if(i)if(w.opts.event.shiftKey)if(!p)p=x[0];else{const N=p,Y=N.guide.x===void 0?"x":"y";(Y==="x"&&(t==null?void 0:t.x)||Y==="y"&&(t==null?void 0:t.y))&&(re({guideMatched:N,component:y,canvasView:L}),_=[N.matched.componentEl],M=[I({guideMatched:N,canvasView:L})])}else p=null;const m={id:$,type:$,component:y,componentView:S,originComponent:P,matchedComponents:_,originMatchedDistances:M};o.addSpot(m)},b=({enabled:f})=>{e.runCommand(fe,{enabled:f})},v=({type:f})=>{o.removeSpots({type:f})},A=()=>{v({type:ge}),v({type:he}),v({type:ye})},R=f=>{b({enabled:!0}),r(f),A()},E=f=>{r(f),A()},T=f=>{v({type:$}),d&&de({snapping:n,props:f,editor:e}),b({enabled:!1})},D=[[ue,f=>{R(f),e.on(j,E);const y=()=>{T(f),e.off(j,E),e.off(F,y)};e.on(F,y)}],[s,f=>{if(h)return;const y=f.options.target,x=ce(e,y,a);x!=null&&x.result&&!x.dmode&&(f.options.mode="absolute")}]];D.forEach(([f,y])=>e.on(f,y)),se({editor:e,licenseKey:a.licenseKey,plan:le,pluginName:ae,cleanup:()=>{b({enabled:!1}),D.forEach(([f,y])=>e.off(f,y))}})},Ee=oe(be);module.exports=Ee;
@@ -1,8 +1,8 @@
1
- const V = "app.grapesjs.com", H = "app-stage.grapesjs.com", j = "app2.grapesjs.com", F = "app-stage2.grapesjs.com", U = [
2
- V,
3
- j,
1
+ const K = "app.grapesjs.com", k = "app-stage.grapesjs.com", H = "app2.grapesjs.com", q = "app-stage2.grapesjs.com", W = [
2
+ K,
4
3
  H,
5
- F,
4
+ k,
5
+ q,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -11,91 +11,104 @@ const V = "app.grapesjs.com", H = "app-stage.grapesjs.com", j = "app2.grapesjs.c
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], q = "license:check:start", J = "license:check:end", z = () => typeof window < "u", Q = ({
15
- isDev: t,
14
+ ], J = "license:check:end", z = () => typeof window < "u", Q = ({
15
+ isDev: e,
16
16
  isStage: a,
17
17
  isPlatform: u
18
- }) => `${t ? "" : `https://${a ? H : V}`}/${u ? "platform-api" : "api"}`, Z = () => {
19
- const t = z() && window.location.hostname;
20
- return !!t && (U.includes(t) || U.some((a) => t.endsWith(a)));
18
+ }) => `${e ? "" : `https://${a ? k : K}`}/${u ? "platform-api" : "api"}`, Z = () => {
19
+ const e = z() && window.location.hostname;
20
+ return !!e && (W.includes(e) || W.some((a) => e.endsWith(a)));
21
21
  };
22
- function k(t) {
23
- return typeof t == "function";
22
+ function C(e) {
23
+ return typeof e == "function";
24
24
  }
25
- async function tt({
26
- path: t,
25
+ async function ee({
26
+ path: e,
27
27
  baseApiUrl: a,
28
28
  method: u = "GET",
29
- headers: l = {},
30
- params: i,
31
- body: o
29
+ headers: c = {},
30
+ params: l,
31
+ body: s
32
32
  }) {
33
- const n = `${a || Q({ isDev: !1, isStage: !1 })}${t}`, g = {
33
+ const t = `${a || Q({ isDev: !1, isStage: !1 })}${e}`, h = {
34
34
  method: u,
35
35
  headers: {
36
36
  "Content-Type": "application/json",
37
- ...l
37
+ ...c
38
38
  }
39
39
  };
40
- o && (g.body = JSON.stringify(o));
41
- const d = i ? new URLSearchParams(i).toString() : "", c = d ? `?${d}` : "", e = await fetch(`${n}${c}`, g);
42
- if (!e.ok)
43
- throw new Error(`HTTP error! status: ${e.status}`);
44
- return e.json();
40
+ s && (h.body = JSON.stringify(s));
41
+ const d = l ? new URLSearchParams(l).toString() : "", i = d ? `?${d}` : "", o = await fetch(`${t}${i}`, h);
42
+ if (!o.ok)
43
+ throw new Error(`HTTP error! status: ${o.status}`);
44
+ return o.json();
45
45
  }
46
- var G = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(G || {});
47
- const W = {
48
- [G.free]: 0,
49
- [G.startup]: 10,
50
- [G.business]: 20,
51
- [G.enterprise]: 30
46
+ var B = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(B || {}), U = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", e.sidebarLeftSet = "studio:sidebarLeft:set", e.sidebarLeftGet = "studio:sidebarLeft:get", e.sidebarLeftToggle = "studio:sidebarLeft:toggle", e.sidebarRightSet = "studio:sidebarRight:set", e.sidebarRightGet = "studio:sidebarRight:get", e.sidebarRightToggle = "studio:sidebarRight:toggle", e.sidebarTopSet = "studio:sidebarTop:set", e.sidebarTopGet = "studio:sidebarTop:get", e.sidebarTopToggle = "studio:sidebarTop:toggle", e.sidebarBottomSet = "studio:sidebarBottom:set", e.sidebarBottomGet = "studio:sidebarBottom:get", e.sidebarBottomToggle = "studio:sidebarBottom:toggle", e.symbolAdd = "studio:symbolAdd", e.symbolDetach = "studio:symbolDetach", e.symbolOverride = "studio:symbolOverride", e.symbolPropagateStyles = "studio:propagateStyles", e.getPagesConfig = "studio:getPagesConfig", e.setPagesConfig = "studio:setPagesConfig", e.getPageSettings = "studio:getPageSettings", e.setPageSettings = "studio:setPageSettings", e.clearPage = "studio:clearPage", e.projectFiles = "studio:projectFiles", e.validateCode = "studio:validateCode", e.canvasReload = "studio:canvasReload", e.getBlocksPanel = "studio:getBlocksPanel", e.setBlocksPanel = "studio:setBlocksPanel", e.getStateContextMenu = "studio:getStateContextMenu", e.setStateContextMenu = "studio:setStateContextMenu", e.contextMenuComponent = "studio:contextMenuComponent", e.layoutAdd = "studio:layoutAdd", e.layoutRemove = "studio:layoutRemove", e.layoutToggle = "studio:layoutToggle", e.layoutUpdate = "studio:layoutUpdate", e.layoutGet = "studio:layoutGet", e.layoutConfigGet = "studio:layoutConfigGet", e.layoutConfigSet = "studio:layoutConfigSet", e.layoutComponentAdd = "studio:layoutComponentAdd", e.layoutComponentGet = "studio:layoutComponentGet", e.layoutComponentRemove = "studio:layoutComponentRemove", e.layoutComponentRender = "studio:layoutComponentRender", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.settings = "studio:settings", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e.fontManagerOpen = "studio:fontManagerOpen", e.menuFontLoad = "studio:menuFontLoad", e.toggleStateDataSource = "studio:toggleStateDataSource", e.getStateDataSource = "studio:getStateDataSource", e.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", e.dataSourceSetImporter = "studio:dataSourceSetImporter", e.dataSourceSetExporter = "studio:dataSourceSetExporter", e.setDragAbsolute = "studio:setDragAbsolute", e))(U || {});
47
+ const V = {
48
+ [B.free]: 0,
49
+ [B.startup]: 10,
50
+ [B.business]: 20,
51
+ [B.enterprise]: 30
52
52
  };
53
- function et(t) {
54
- const a = t;
55
- return a.init = (u) => (l) => t(l, u), a;
53
+ function te(e) {
54
+ const a = e;
55
+ return a.init = (u) => (c) => e(c, u), a;
56
56
  }
57
- const nt = (t) => /* @__PURE__ */ et(t);
58
- async function ot({
59
- editor: t,
57
+ const oe = (e) => /* @__PURE__ */ te(e);
58
+ async function se({
59
+ editor: e,
60
60
  plan: a,
61
61
  pluginName: u,
62
- licenseKey: l,
63
- onLicenseCheckResponse: i,
64
- cleanup: o
62
+ licenseKey: c,
63
+ onLicenseCheckResponse: l,
64
+ cleanup: s
65
65
  }) {
66
- let s = "", n = !1;
67
- const g = Z(), d = (e) => {
68
- console.warn("Cleanup plugin:", u, "Reason:", e), o();
69
- }, c = (e = {}) => {
70
- var b;
71
- const { error: r, sdkLicense: f } = e, y = (b = e.plan) == null ? void 0 : b.category;
72
- if (!(f || e.license) || r)
73
- d(r || "Invalid license");
74
- else if (y) {
75
- const v = W[a], E = W[y];
76
- v > E && d({ pluginRequiredPlan: a, licensePlan: y });
66
+ let n = "", t;
67
+ const h = (o) => {
68
+ console.warn("Cleanup plugin:", u, "Reason:", o), s();
69
+ }, d = (o = {}) => {
70
+ var A;
71
+ const { error: p, sdkLicense: r } = o, b = (A = o.plan) == null ? void 0 : A.category;
72
+ if (!(r || o.license) || p)
73
+ h(p || "Invalid license");
74
+ else if (b) {
75
+ const R = V[a], E = V[b];
76
+ R > E && h({ pluginRequiredPlan: a, licensePlan: b });
77
77
  }
78
78
  };
79
- t.on(q, (e) => {
80
- s = e == null ? void 0 : e.baseApiUrl, n = !0;
81
- }), t.on(J, (e) => {
82
- i == null || i(e), c(e);
83
- }), setTimeout(async () => {
84
- if (!n) {
85
- if (g) return;
86
- if (l) {
87
- const e = await st({ licenseKey: l, pluginName: u, baseApiUrl: s });
88
- i == null || i(e), e && c(e);
89
- } else
90
- d("The `licenseKey` option not provided");
91
- }
92
- }, 2e3);
79
+ e.Commands.has(U.settings) && (t = e.runCommand(U.settings), n = (t == null ? void 0 : t.baseUrl) || "");
80
+ const i = (o) => {
81
+ l == null || l(o), o && d(o);
82
+ };
83
+ if (!t) {
84
+ e.onReady(async () => {
85
+ if (!Z())
86
+ if (c) {
87
+ const o = await ie({ licenseKey: c, pluginName: u, baseApiUrl: n });
88
+ i(o);
89
+ } else
90
+ h("The `licenseKey` option not provided");
91
+ });
92
+ return;
93
+ }
94
+ if (t.licensePlan || t.licenseError) {
95
+ const o = ne(t);
96
+ i(o);
97
+ return;
98
+ }
99
+ e.on(J, (o) => i(o));
93
100
  }
94
- async function st(t) {
95
- const { licenseKey: a, pluginName: u, baseApiUrl: l } = t;
101
+ const ne = (e) => ({
102
+ sdkLicense: e.license,
103
+ license: e.license,
104
+ error: e.licenseError,
105
+ plan: e.licensePlan
106
+ });
107
+ async function ie(e) {
108
+ const { licenseKey: a, pluginName: u, baseApiUrl: c } = e;
96
109
  try {
97
- return (await tt({
98
- baseApiUrl: l,
110
+ return (await ee({
111
+ baseApiUrl: c,
99
112
  path: `/sdk/${a || "na"}`,
100
113
  method: "POST",
101
114
  params: {
@@ -103,152 +116,152 @@ async function st(t) {
103
116
  pn: u
104
117
  }
105
118
  })).result || {};
106
- } catch (i) {
107
- return console.error("Error during SDK license check:", i), !1;
119
+ } catch (l) {
120
+ return console.error("Error during SDK license check:", l), !1;
108
121
  }
109
122
  }
110
- const it = "canvasAbsoluteMode", ct = G.startup, at = (t, a, u) => {
111
- var d, c;
112
- const l = u.enableAbsolute ?? ((e) => e.hasAbsolute), o = (Array.isArray(a) ? a : a ? [a] : [...t.getSelectedAll()])[0], s = ((c = (d = o == null ? void 0 : o.delegate) == null ? void 0 : d.move) == null ? void 0 : c.call(d, o)) || o;
113
- if (!s) return;
114
- const n = s.getEl();
123
+ const ae = "canvasAbsoluteMode", le = B.startup, ce = (e, a, u) => {
124
+ var d, i;
125
+ const c = u.enableAbsolute ?? ((o) => o.hasAbsolute), s = (Array.isArray(a) ? a : a ? [a] : [...e.getSelectedAll()])[0], n = ((i = (d = s == null ? void 0 : s.delegate) == null ? void 0 : d.move) == null ? void 0 : i.call(d, s)) || s;
126
+ if (!n) return;
127
+ const t = n.getEl();
115
128
  return {
116
- result: k(l) ? l({ component: s, hasAbsolute: !!n && getComputedStyle(n).position === "absolute" }) : !1,
117
- component: s,
118
- dmode: s.get("dmode")
129
+ result: C(c) ? c({ component: n, hasAbsolute: !!t && getComputedStyle(t).position === "absolute" }) : !1,
130
+ component: n,
131
+ dmode: n.get("dmode")
119
132
  };
120
133
  };
121
- function B({
122
- guideMatched: t,
134
+ function I({
135
+ guideMatched: e,
123
136
  canvasView: a
124
137
  }) {
125
- var C;
126
- const u = t.guide.x === void 0 ? "y" : "x";
127
- let l = 0, i = 0, o = 0, s = 0;
128
- const { guide: n, matched: g } = t, d = a.getElBoxRect(n.componentView.el), c = a.getElBoxRect(((C = g.componentView) == null ? void 0 : C.el) || g.componentEl), e = d.y, r = d.y + d.height, f = d.x, y = d.x + d.width, S = c.y, b = c.y + c.height, v = c.x, E = c.x + c.width, x = Math.max(0, e - b), m = Math.max(0, S - r), w = Math.max(0, f - E), M = Math.max(0, v - y), p = x > m, h = w > M, _ = n.type;
129
- return u === "x" && (_ === "l" ? (l = f, p ? (i = b, o = x) : (i = r, o = m)) : _ === "r" ? (l = y, p ? (i = b, o = x) : (i = r, o = m)) : _ === "x" && (l = f - (f - y) / 2, p ? (i = b, o = x) : (i = r, o = m))), u === "y" && (_ === "t" ? (i = e, h ? (l = E, s = w) : (l = y, s = M)) : _ === "b" ? (i = r, h ? (l = E, s = w) : (l = y, s = M)) : _ === "y" && (i = e - (e - r) / 2, h ? (l = E, s = w) : (l = y, s = M))), { axis: u, x: l, y: i, width: s, height: o };
138
+ var w;
139
+ const u = e.guide.x === void 0 ? "y" : "x";
140
+ let c = 0, l = 0, s = 0, n = 0;
141
+ const { guide: t, matched: h } = e, d = a.getElBoxRect(t.componentView.el), i = a.getElBoxRect(((w = h.componentView) == null ? void 0 : w.el) || h.componentEl), o = d.y, p = d.y + d.height, r = d.x, b = d.x + d.width, v = i.y, A = i.y + i.height, R = i.x, E = i.x + i.width, T = Math.max(0, o - A), g = Math.max(0, v - p), G = Math.max(0, r - E), D = Math.max(0, R - b), f = T > g, y = G > D, x = t.type;
142
+ return u === "x" && (x === "l" ? (c = r, f ? (l = A, s = T) : (l = p, s = g)) : x === "r" ? (c = b, f ? (l = A, s = T) : (l = p, s = g)) : x === "x" && (c = r - (r - b) / 2, f ? (l = A, s = T) : (l = p, s = g))), u === "y" && (x === "t" ? (l = o, y ? (c = E, n = G) : (c = b, n = D)) : x === "b" ? (l = p, y ? (c = E, n = G) : (c = b, n = D)) : x === "y" && (l = o - (o - p) / 2, y ? (c = E, n = G) : (c = b, n = D))), { axis: u, x: c, y: l, width: n, height: s };
130
143
  }
131
- function lt({
132
- guideMatched: t,
144
+ function re({
145
+ guideMatched: e,
133
146
  component: a,
134
147
  canvasView: u
135
148
  }) {
136
- const l = t.guide.x === void 0 ? "x" : "y", { guide: i, matched: o } = t, s = i.type, n = o.type, g = u.getElementPos(i.componentView.el).rect, d = u.getElementPos(o.componentView.el).rect;
137
- if (l === "x") {
138
- const c = g.height, e = d.top, r = d.top + d.height;
139
- let f = 0;
140
- s === "t" ? n === "t" ? f = e - c : n === "b" ? f = r - c : n === "y" && (f = e - c - (e - r) / 2) : s === "b" ? n === "t" ? f = e - c * 2 : n === "b" ? f = r - c * 2 : n === "y" && (f = e - c * 2 - (e - r) / 2) : s === "y" && (n === "t" ? f = e - c * 1.5 : n === "b" ? f = r - c * 1.5 : n === "y" && (f = e - c * 1.5 - (e - r) / 2)), a.addStyle({ top: `${f - 5}px` }, { partial: !0 });
149
+ const c = e.guide.x === void 0 ? "x" : "y", { guide: l, matched: s } = e, n = l.type, t = s.type, h = u.getElementPos(l.componentView.el).rect, d = u.getElementPos(s.componentView.el).rect;
150
+ if (c === "x") {
151
+ const i = h.height, o = d.top, p = d.top + d.height;
152
+ let r = 0;
153
+ n === "t" ? t === "t" ? r = o - i : t === "b" ? r = p - i : t === "y" && (r = o - i - (o - p) / 2) : n === "b" ? t === "t" ? r = o - i * 2 : t === "b" ? r = p - i * 2 : t === "y" && (r = o - i * 2 - (o - p) / 2) : n === "y" && (t === "t" ? r = o - i * 1.5 : t === "b" ? r = p - i * 1.5 : t === "y" && (r = o - i * 1.5 - (o - p) / 2)), a.addStyle({ top: `${r - 5}px` }, { partial: !0 });
141
154
  }
142
- if (l === "y") {
143
- const c = g.width, e = d.left, r = d.left + d.width;
144
- let f = 0;
145
- s === "l" ? n === "l" ? f = e : n === "r" ? f = r : n === "x" && (f = e - (e - r) / 2) : s === "r" ? n === "l" ? f = e - c : n === "r" ? f = r - c : n === "x" && (f = e - c - (e - r) / 2) : s === "x" && (n === "l" ? f = e - c / 2 : n === "r" && (f = r - c / 2)), a.addStyle({ left: `${f}px` }, { partial: !0 });
155
+ if (c === "y") {
156
+ const i = h.width, o = d.left, p = d.left + d.width;
157
+ let r = 0;
158
+ n === "l" ? t === "l" ? r = o : t === "r" ? r = p : t === "x" && (r = o - (o - p) / 2) : n === "r" ? t === "l" ? r = o - i : t === "r" ? r = p - i : t === "x" && (r = o - i - (o - p) / 2) : n === "x" && (t === "l" ? r = o - i / 2 : t === "r" && (r = p - i / 2)), a.addStyle({ left: `${r}px` }, { partial: !0 });
146
159
  }
147
160
  }
148
161
  function X({
149
- snapping: t,
162
+ snapping: e,
150
163
  editor: a,
151
164
  props: u
152
165
  }) {
153
- var N, P;
154
- const { command: l, guidesMatched: i } = u, o = u.component, s = o.getEl(), n = a.Canvas.getCanvasView(), { x: g, y: d } = t ?? { x: 10, y: 10 }, c = l.opts.event, e = c.clientX, r = c.clientY;
155
- if (!o.__lastSnappedPosition) {
156
- const A = n.getElBoxRect(s), D = e - A.x, T = r - A.y;
157
- o.__lastSnappedPosition = { left: A.x, top: A.y }, o.__dragOffset = { x: D, y: T };
166
+ var S, L;
167
+ const { command: c, guidesMatched: l } = u, s = u.component, n = s.getEl(), t = a.Canvas.getCanvasView(), { x: h, y: d } = e ?? { x: 10, y: 10 }, i = c.opts.event, o = i.clientX, p = i.clientY;
168
+ if (!s.__lastSnappedPosition) {
169
+ const P = t.getElBoxRect(n), _ = o - P.x, M = p - P.y;
170
+ s.__lastSnappedPosition = { left: P.x, top: P.y }, s.__dragOffset = { x: _, y: M };
158
171
  }
159
- const f = ((N = o.__dragOffset) == null ? void 0 : N.x) || 0, y = ((P = o.__dragOffset) == null ? void 0 : P.y) || 0, S = o.__lastSnappedPosition, b = e - S.left - f, v = r - S.top - y;
160
- let E = S.left, x = S.top;
161
- const m = i == null ? void 0 : i[0], w = (m == null ? void 0 : m.guide.type) === "l", M = (m == null ? void 0 : m.guide.type) === "x", p = (m == null ? void 0 : m.guide.type) === "r", h = (m == null ? void 0 : m.guide.type) === "t", _ = (m == null ? void 0 : m.guide.type) === "b", C = (m == null ? void 0 : m.guide.type) === "y";
162
- if (m) {
163
- const { x: A, y: D } = B({ guideMatched: m, canvasView: n }), T = s.offsetWidth, L = s.offsetHeight;
164
- w ? E = A : p ? E = A - T : M ? E = A - T / 2 : h ? x = D : _ ? x = D - L : C && (x = D - L / 2), o.__lastSnappedGuideMatched = m;
172
+ const r = ((S = s.__dragOffset) == null ? void 0 : S.x) || 0, b = ((L = s.__dragOffset) == null ? void 0 : L.y) || 0, v = s.__lastSnappedPosition, A = o - v.left - r, R = p - v.top - b;
173
+ let E = v.left, T = v.top;
174
+ const g = l == null ? void 0 : l[0], G = (g == null ? void 0 : g.guide.type) === "l", D = (g == null ? void 0 : g.guide.type) === "x", f = (g == null ? void 0 : g.guide.type) === "r", y = (g == null ? void 0 : g.guide.type) === "t", x = (g == null ? void 0 : g.guide.type) === "b", w = (g == null ? void 0 : g.guide.type) === "y";
175
+ if (g) {
176
+ const { x: P, y: _ } = I({ guideMatched: g, canvasView: t }), M = n.offsetWidth, m = n.offsetHeight;
177
+ G ? E = P : f ? E = P - M : D ? E = P - M / 2 : y ? T = _ : x ? T = _ - m : w && (T = _ - m / 2), s.__lastSnappedGuideMatched = g;
165
178
  } else
166
- Math.abs(b) >= g && (E = Math.round((S.left + b) / g) * g, o.__lastSnappedGuideMatched = null), Math.abs(v) >= d && (x = Math.round((S.top + v) / d) * d, o.__lastSnappedGuideMatched = null);
167
- return o.addStyle({ left: `${E}px`, top: `${x}px` }, { partial: !0 }), o.__lastSnappedPosition = { left: E, top: x }, { x: E, y: x, guideMatched: o.__lastSnappedGuideMatched };
179
+ Math.abs(A) >= h && (E = Math.round((v.left + A) / h) * h, s.__lastSnappedGuideMatched = null), Math.abs(R) >= d && (T = Math.round((v.top + R) / d) * d, s.__lastSnappedGuideMatched = null);
180
+ return s.addStyle({ left: `${E}px`, top: `${T}px` }, { partial: !0 }), s.__lastSnappedPosition = { left: E, top: T }, { x: E, y: T, guideMatched: s.__lastSnappedGuideMatched };
168
181
  }
169
- function dt({
170
- snapping: t,
182
+ function de({
183
+ snapping: e,
171
184
  props: a,
172
185
  editor: u
173
186
  }) {
174
- const { x: l, y: i } = X({ snapping: t, props: a, editor: u }), o = a.component;
175
- o.addStyle({ left: `${l}px`, top: `${i}px` }), delete o.__lastSnappedPosition, delete o.__lastSnappedGuideMatched;
187
+ const { x: c, y: l } = X({ snapping: e, props: a, editor: u }), s = a.component;
188
+ s.addStyle({ left: `${c}px`, top: `${l}px` }), delete s.__lastSnappedPosition, delete s.__lastSnappedGuideMatched;
176
189
  }
177
- const ft = "core:component-drag", rt = "studio:setDragAbsolute", pt = "dmode:start", Y = "dmode:move", K = "dmode:end", $ = "dragAbsolute", ut = "select", mt = "hover", ht = "spacing", gt = function(t, a = {}) {
178
- const { Commands: u } = t, l = u.events, i = u.getConfig().defaultOptions ?? {}, o = `${l.runBeforeCommand}tlb-move`;
179
- i[ft] = {
180
- run: (p) => ({
181
- ...p,
190
+ const pe = "core:component-drag", fe = "studio:setDragAbsolute", ue = "dmode:start", j = "dmode:move", F = "dmode:end", $ = "dragAbsolute", ge = "select", he = "hover", ye = "spacing", be = function(e, a = {}) {
191
+ const { Commands: u } = e, c = u.events, l = u.getConfig().defaultOptions ?? {}, s = `${c.runBeforeCommand}tlb-move`;
192
+ l[pe] = {
193
+ run: (f) => ({
194
+ ...f,
182
195
  skipGuidesRender: !0
183
196
  })
184
197
  };
185
- const { snapping: s, locking: n, globalAbsolute: g = !0 } = a;
186
- g && t.setDragMode("absolute");
187
- const d = !!(s != null && s.x || s != null && s.y), c = !!(n != null && n.x || n != null && n.y), { Canvas: e } = t;
188
- let r = null;
189
- const f = (p) => {
190
- const { component: h, guidesMatched: _, command: C } = p, N = h.view, P = t.Canvas.getCanvasView(), A = h.getEl();
191
- let D = _.map((O) => O.matched.componentEl), T = _.map((O) => B({ guideMatched: O, canvasView: P }));
198
+ const { snapping: n, locking: t, globalAbsolute: h = !0 } = a;
199
+ h && e.setDragMode("absolute");
200
+ const d = !!(n != null && n.x || n != null && n.y), i = !!(t != null && t.x || t != null && t.y), { Canvas: o } = e;
201
+ let p = null;
202
+ const r = (f) => {
203
+ const { component: y, guidesMatched: x, command: w } = f, S = y.view, L = e.Canvas.getCanvasView(), P = y.getEl();
204
+ let _ = x.map((O) => O.matched.componentEl), M = x.map((O) => I({ guideMatched: O, canvasView: L }));
192
205
  if (d) {
193
- const { guideMatched: O } = X({ snapping: s, props: p, editor: t });
194
- O ? (D = [O.matched.componentEl], T = [B({ guideMatched: O, canvasView: P })]) : (D = [], T = []);
206
+ const { guideMatched: O } = X({ snapping: n, props: f, editor: e });
207
+ O ? (_ = [O.matched.componentEl], M = [I({ guideMatched: O, canvasView: L })]) : (_ = [], M = []);
195
208
  }
196
- if (c)
197
- if (C.opts.event.shiftKey)
198
- if (!r)
199
- r = _[0];
209
+ if (i)
210
+ if (w.opts.event.shiftKey)
211
+ if (!p)
212
+ p = x[0];
200
213
  else {
201
- const R = r, I = R.guide.x === void 0 ? "x" : "y";
202
- (I === "x" && (n == null ? void 0 : n.x) || I === "y" && (n == null ? void 0 : n.y)) && (lt({ guideMatched: R, component: h, canvasView: P }), D = [R.matched.componentEl], T = [B({ guideMatched: R, canvasView: P })]);
214
+ const N = p, Y = N.guide.x === void 0 ? "x" : "y";
215
+ (Y === "x" && (t == null ? void 0 : t.x) || Y === "y" && (t == null ? void 0 : t.y)) && (re({ guideMatched: N, component: y, canvasView: L }), _ = [N.matched.componentEl], M = [I({ guideMatched: N, canvasView: L })]);
203
216
  }
204
217
  else
205
- r = null;
206
- const L = {
218
+ p = null;
219
+ const m = {
207
220
  id: $,
208
221
  type: $,
209
- component: h,
210
- componentView: N,
211
- originComponent: A,
212
- matchedComponents: D,
213
- originMatchedDistances: T
222
+ component: y,
223
+ componentView: S,
224
+ originComponent: P,
225
+ matchedComponents: _,
226
+ originMatchedDistances: M
214
227
  };
215
- e.addSpot(L);
216
- }, y = ({ enabled: p }) => {
217
- t.runCommand(rt, { enabled: p });
218
- }, S = ({ type: p }) => {
219
- e.removeSpots({ type: p });
220
- }, b = () => {
221
- S({ type: ut }), S({ type: mt }), S({ type: ht });
222
- }, v = (p) => {
223
- y({ enabled: !0 }), f(p), b();
224
- }, E = (p) => {
225
- f(p), b();
226
- }, x = (p) => {
227
- S({ type: $ }), d && dt({ snapping: s, props: p, editor: t }), y({ enabled: !1 });
228
- }, M = [
229
- [pt, (p) => {
230
- v(p), t.on(Y, E);
231
- const h = () => {
232
- x(p), t.off(Y, E), t.off(K, h);
228
+ o.addSpot(m);
229
+ }, b = ({ enabled: f }) => {
230
+ e.runCommand(fe, { enabled: f });
231
+ }, v = ({ type: f }) => {
232
+ o.removeSpots({ type: f });
233
+ }, A = () => {
234
+ v({ type: ge }), v({ type: he }), v({ type: ye });
235
+ }, R = (f) => {
236
+ b({ enabled: !0 }), r(f), A();
237
+ }, E = (f) => {
238
+ r(f), A();
239
+ }, T = (f) => {
240
+ v({ type: $ }), d && de({ snapping: n, props: f, editor: e }), b({ enabled: !1 });
241
+ }, D = [
242
+ [ue, (f) => {
243
+ R(f), e.on(j, E);
244
+ const y = () => {
245
+ T(f), e.off(j, E), e.off(F, y);
233
246
  };
234
- t.on(K, h);
247
+ e.on(F, y);
235
248
  }],
236
- [o, (p) => {
237
- if (g) return;
238
- const h = p.options.target, _ = at(t, h, a);
239
- _ != null && _.result && !_.dmode && (p.options.mode = "absolute");
249
+ [s, (f) => {
250
+ if (h) return;
251
+ const y = f.options.target, x = ce(e, y, a);
252
+ x != null && x.result && !x.dmode && (f.options.mode = "absolute");
240
253
  }]
241
254
  ];
242
- M.forEach(([p, h]) => t.on(p, h)), ot({
243
- editor: t,
255
+ D.forEach(([f, y]) => e.on(f, y)), se({
256
+ editor: e,
244
257
  licenseKey: a.licenseKey,
245
- plan: ct,
246
- pluginName: it,
258
+ plan: le,
259
+ pluginName: ae,
247
260
  cleanup: () => {
248
- y({ enabled: !1 }), M.forEach(([p, h]) => t.off(p, h));
261
+ b({ enabled: !1 }), D.forEach(([f, y]) => e.off(f, y));
249
262
  }
250
263
  });
251
- }, Et = nt(gt);
264
+ }, xe = oe(be);
252
265
  export {
253
- Et as default
266
+ xe as default
254
267
  };