@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33

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 (130) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +161 -156
  3. package/dist/accordionComponent/index.umd.js +9 -9
  4. package/dist/aiChat/chatManager.d.ts +15 -0
  5. package/dist/aiChat/clientTools.d.ts +3 -3
  6. package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
  7. package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
  8. package/dist/aiChat/components/AiChatError.d.ts +2 -1
  9. package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
  10. package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
  11. package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
  12. package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
  13. package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
  14. package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
  15. package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
  16. package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
  17. package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
  18. package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
  19. package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
  20. package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
  21. package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
  22. package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
  23. package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
  24. package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
  25. package/dist/aiChat/components/index.d.ts +24 -25
  26. package/dist/aiChat/components/utils.d.ts +12 -4
  27. package/dist/aiChat/index.cjs.d.ts +5 -0
  28. package/dist/aiChat/index.cjs.js +453 -0
  29. package/dist/aiChat/index.d.ts +4 -3
  30. package/dist/aiChat/index.es.d.ts +5 -0
  31. package/dist/aiChat/index.es.js +30930 -0
  32. package/dist/aiChat/index.js +453 -0
  33. package/dist/aiChat/index.umd.js +453 -0
  34. package/dist/aiChat/locales/en.d.ts +64 -0
  35. package/dist/aiChat/server/index.cjs.d.ts +4 -0
  36. package/dist/aiChat/server/index.cjs.js +309 -0
  37. package/dist/aiChat/server/index.d.ts +0 -50
  38. package/dist/aiChat/server/index.es.d.ts +4 -0
  39. package/dist/aiChat/server/index.es.js +876 -0
  40. package/dist/aiChat/server/index.js +309 -0
  41. package/dist/aiChat/server/index.umd.js +309 -0
  42. package/dist/aiChat/server/stream.d.ts +0 -6
  43. package/dist/aiChat/server/tools.d.ts +157 -51
  44. package/dist/aiChat/server/types.d.ts +108 -64
  45. package/dist/aiChat/types.d.ts +148 -108
  46. package/dist/aiChat/typesSchema.d.ts +238 -25
  47. package/dist/animationComponent/index.cjs.js +3 -3
  48. package/dist/animationComponent/index.es.js +174 -169
  49. package/dist/animationComponent/index.umd.js +3 -3
  50. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  51. package/dist/canvasAbsoluteMode/index.es.js +161 -156
  52. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  53. package/dist/canvasEmptyState/index.cjs.js +1 -1
  54. package/dist/canvasEmptyState/index.es.js +113 -108
  55. package/dist/canvasEmptyState/index.umd.js +1 -1
  56. package/dist/canvasFullSize/index.cjs.js +9 -9
  57. package/dist/canvasFullSize/index.es.js +137 -132
  58. package/dist/canvasFullSize/index.umd.js +9 -9
  59. package/dist/canvasGridMode/index.cjs.js +4 -4
  60. package/dist/canvasGridMode/index.es.js +168 -163
  61. package/dist/canvasGridMode/index.umd.js +8 -8
  62. package/dist/canvasScreenshot/index.cjs.js +1 -1
  63. package/dist/canvasScreenshot/index.es.js +132 -127
  64. package/dist/canvasScreenshot/index.umd.js +1 -1
  65. package/dist/dataSourceEjs/index.cjs.js +5 -5
  66. package/dist/dataSourceEjs/index.es.js +151 -146
  67. package/dist/dataSourceEjs/index.umd.js +5 -5
  68. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  69. package/dist/dataSourceHandlebars/index.es.js +91 -86
  70. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  71. package/dist/dialogComponent/index.cjs.js +16 -16
  72. package/dist/dialogComponent/index.es.js +117 -112
  73. package/dist/dialogComponent/index.umd.js +16 -16
  74. package/dist/flexComponent/index.cjs.js +11 -11
  75. package/dist/flexComponent/index.es.js +416 -411
  76. package/dist/flexComponent/index.umd.js +11 -11
  77. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  78. package/dist/fsLightboxComponent/index.es.js +152 -147
  79. package/dist/fsLightboxComponent/index.umd.js +3 -3
  80. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  81. package/dist/googleFontsAssetProvider/index.es.js +127 -122
  82. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  83. package/dist/iconifyComponent/index.cjs.js +2 -2
  84. package/dist/iconifyComponent/index.es.js +170 -165
  85. package/dist/iconifyComponent/index.umd.js +2 -2
  86. package/dist/index.cjs.js +1 -1
  87. package/dist/index.es.js +27 -22
  88. package/dist/index.umd.js +1 -1
  89. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  90. package/dist/layoutSidebarButtons/index.es.js +156 -151
  91. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  92. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  93. package/dist/lightGalleryComponent/index.es.js +197 -192
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/linkImageComponent/index.cjs.js +2 -2
  96. package/dist/linkImageComponent/index.es.js +86 -81
  97. package/dist/linkImageComponent/index.umd.js +2 -2
  98. package/dist/listPagesComponent/index.cjs.js +5 -5
  99. package/dist/listPagesComponent/index.es.js +121 -116
  100. package/dist/listPagesComponent/index.umd.js +5 -5
  101. package/dist/presetPrintable/index.cjs.js +4 -4
  102. package/dist/presetPrintable/index.es.js +180 -175
  103. package/dist/presetPrintable/index.umd.js +4 -4
  104. package/dist/prosemirror/index.cjs.js +6 -6
  105. package/dist/prosemirror/index.es.js +128 -123
  106. package/dist/prosemirror/index.umd.js +8 -8
  107. package/dist/rendererReact/index.cjs.js +1 -1
  108. package/dist/rendererReact/index.es.js +127 -122
  109. package/dist/rendererReact/index.js +1 -1
  110. package/dist/rendererReact/index.umd.js +1 -1
  111. package/dist/rteTinyMce/index.cjs.js +2 -2
  112. package/dist/rteTinyMce/index.es.js +160 -155
  113. package/dist/rteTinyMce/index.umd.js +2 -2
  114. package/dist/shapeDividerComponent/index.cjs.js +25 -25
  115. package/dist/shapeDividerComponent/index.es.js +127 -122
  116. package/dist/shapeDividerComponent/index.umd.js +25 -25
  117. package/dist/swiperComponent/index.cjs.js +9 -9
  118. package/dist/swiperComponent/index.es.js +197 -192
  119. package/dist/swiperComponent/index.umd.js +9 -9
  120. package/dist/tableComponent/index.cjs.js +1 -1
  121. package/dist/tableComponent/index.es.js +227 -222
  122. package/dist/tableComponent/index.umd.js +1 -1
  123. package/dist/types.d.ts +1 -1
  124. package/dist/utils.d.ts +12 -1
  125. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  126. package/dist/youtubeAssetProvider/index.es.js +124 -119
  127. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  128. package/package.json +5 -2
  129. package/dist/aiChat/components/AiChatInput.d.ts +0 -17
  130. package/dist/aiChat/server/stream-utils.d.ts +0 -16
@@ -1,5 +1,5 @@
1
- (function(h,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(h=typeof globalThis<"u"?globalThis:h||self,h.StudioSdkPlugins_animationComponent=b())})(this,function(){"use strict";const h="app.grapesjs.com",b="app-stage.grapesjs.com",A=[h,"app2.grapesjs.com",b,"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})=>`${t?"":`https://${n?b:h}`}/api`,M=()=>{const t=V()&&window.location.hostname;return!!t&&(A.includes(t)||A.some(n=>t.endsWith(n)))};async function F({path:t,baseApiUrl:n,method:e="GET",headers:r={},params:i,body:a}){const c=`${n||B({isDev:!1,isStage:!1})}${t}`,l={method:e,headers:{"Content-Type":"application/json",...r}};a&&(l.body=JSON.stringify(a));const f=i?new URLSearchParams(i).toString():"",s=f?`?${f}`:"",o=await fetch(`${c}${s}`,l);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var I=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(I||{});const U={[I.free]:0,[I.startup]:10,[I.business]:20,[I.enterprise]:30};function X(t){const n=t;return n.init=e=>r=>t(r,e),n}const _=t=>X(t);async function j({editor:t,plan:n,pluginName:e,licenseKey:r,cleanup:i}){let a="",m=!1;const c=M(),l=s=>{console.warn("Cleanup plugin:",e,"Reason:",s),i()},f=(s={})=>{var u;const{error:o,sdkLicense:p}=s,d=(u=s.plan)==null?void 0:u.category;if(!(p||s.license)||o)l(o||"Invalid license");else if(d){const Z=U[n],N=U[d];Z>N&&l({pluginRequiredPlan:n,licensePlan:d})}};t.on(O,s=>{a=s==null?void 0:s.baseApiUrl,m=!0}),t.on(G,s=>{f(s)}),setTimeout(async()=>{if(!m){if(c)return;if(r){const s=await W({licenseKey:r,pluginName:e,baseApiUrl:a});s&&f(s)}else l("The `licenseKey` option not provided")}},2e3)}async function W(t){const{licenseKey:n,pluginName:e,baseApiUrl:r}=t;try{return(await F({baseApiUrl:r,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:e}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const Y=(...t)=>n=>t.some(e=>n.is(e));var y=(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))(y||{}),v=(t=>(t.onScroll="--animation-on-scroll",t.threshold="--animation-threshold",t.repeat="--animation-repeat",t))(v||{});const g="animation",S="animation-group",L="animation:update",E="animation-group:update",D={category:{id:"animations",label:"Animations"},select:!0},x=t=>(t==null?void 0:t.getType())===g,C=t=>(t==null?void 0:t.getType())===S,R=t=>x(t)||C(t),w={isVisible:({component:t})=>x(t)},$={isVisible:({component:t})=>C(t)},H={isVisible:({component:t})=>x(t)&&C(t==null?void 0:t.parent())?!1:R(t)},T={isVisible:({component:t,sector:n})=>{var e;return x(t)&&C(t==null?void 0:t.parent())?!1:R(t)&&((e=n.getProperty(v.onScroll))==null?void 0:e.getValue())==="true"}},P={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 e=null;const r=()=>{e==null||e.disconnect(),e=null},i=()=>{r();const a=n.style;a.animationName="",requestAnimationFrame(()=>{const m=getComputedStyle(n),c=m.getPropertyValue("animation-name").trim(),l=m.getPropertyValue("--animation-on-scroll").trim()!=="false",f=parseFloat(m.getPropertyValue("--animation-threshold").trim())||.2,s=m.getPropertyValue("--animation-repeat").trim()==="true",o=()=>{a.animationName="none",n.offsetWidth,a.animationName=c,a.animationPlayState="running"};if(!c||c==="none"){a.animationName="none",a.animationPlayState="paused";return}if(!l){o();return}a.animationPlayState="paused",e=new IntersectionObserver(p=>{p.forEach(d=>{d.isIntersecting&&(o(),!s&&r())})},{threshold:f}),e.observe(n)})};n.addEventListener(t.animationUpdateEvent,i),i()},q=(t,n)=>{const{Components:e,Blocks:r,Canvas:i}=t,{block:a={},animationList:m=[]}=n,c=t.Components.events,l="Animation",f=Object.values(v),s=Object.values(y);return e.addType(g,{block:a?{label:l,media:P.animation,content:{type:g},...D,...a}:void 0,model:{defaults:{emptyState:!0,name:l,traits:[],script:K,animationUpdateEvent:L,"script-props":["animationUpdateEvent"],styles:m.map(o=>o.css).join(`
2
- `)},init(){const{em:o}=this;this.addStyle({[y.name]:"fadeIn",[y.duration]:"1s",[y.fillMode]:"both",...n.animationStyle,...this.getStyle()}),this.listenTo(o,c.mount,p=>{var k;if(p!==this)return;((k=this.parent())==null?void 0:k.get("type"))!==S||f.forEach(u=>this.removeStyle(u))})}},view:{events:()=>({animationstart:"onAnimationStart",animationend:"onAnimationEnd"}),init(){const{model:o}=this;this.listenTo(o,c.styleUpdate,this.handleStyleChange)},onAnimationStart(){var p;if((p=this.cmpSpots)!=null&&p.length)return;const o=i.getSpots({component:this.model});this.cmpSpots=o,i.removeSpots(o),this.el.ownerDocument.body.style.overflowX="hidden"},onAnimationEnd(){const o=this.cmpSpots||[];i.spots.add(o),this.cmpSpots=[],this.el.ownerDocument.body.style.overflowX=""},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(L))},handleStyleChange(o,p){Object.keys((p==null?void 0:p.style)||{}).some(u=>s.includes(u)||f.includes(u))&&this.triggerAnimation()},onRender(){this.triggerAnimation()}}}),()=>{r.remove(g),e.removeType(g)}},J=function(t){const n=this,e="--animation-on-scroll",r="--animation-threshold",i="--animation-repeat";let a=null;const m=()=>{a==null||a.disconnect(),a=null},c=()=>{m();const l=getComputedStyle(n),f=l.getPropertyValue(e).trim()!=="false",s=parseFloat(l.getPropertyValue(r).trim())||.2,o=l.getPropertyValue(i).trim()==="true",p=()=>{Array.from(n.children).forEach(d=>{d instanceof HTMLElement&&typeof d.dispatchEvent=="function"&&d.dispatchEvent(new CustomEvent(E,{bubbles:!1}))})};if(!f){p();return}a=new IntersectionObserver(d=>{d.forEach(k=>{k.isIntersecting?(p(),!o&&m()):o&&Array.from(n.children).forEach(u=>{u instanceof HTMLElement&&getComputedStyle(u).getPropertyValue(e).trim()!=="false"&&(u.style.opacity="0",u.style.animationPlayState="paused")})})},{threshold:s}),a.observe(n)};n.addEventListener(t.animationGroupUpdateEvent,c),c()},Q=(t,n)=>{const{Components:e,Blocks:r}=t,{blockGroup:i={}}=n,a="Animation Group";return e.addType(S,{block:i?{label:a,media:P.animationGroup,content:{type:S,components:[{type:g},{type:g},{type:g}]},...D,...i}:void 0,model:{defaults:{name:a,emptyState:!0,traits:[],script:J,animationGroupUpdateEvent:E,"script-props":["animationGroupUpdateEvent"],droppable:Y(g)},init(){this.addStyle({...n.animationGroupStyle,...this.getStyle()});const m=this.components();this.listenTo(m,"add remove",this.updateChildrenStaggerStyles),this.updateChildrenStaggerStyles()},updateChildrenStaggerStyles(){this.components().forEach((m,c)=>{m.is(g)&&m.addStyle({"--stagger-index":c.toString(),[y.delay]:"calc(var(--stagger-index, 0) * var(--stagger-delay, 0.3s))"},{partial:!0})})}},view:{init(){const{model:m}=this;this.listenTo(m,"component:styleUpdate",this.handleStyleChange)},triggerAnimation(){this.el.dispatchEvent(new CustomEvent(E))},handleStyleChange(){this.triggerAnimation(),this.model.updateChildrenStaggerStyles()},onRender(){this.triggerAnimation()}}}),()=>{r.remove(S),e.removeType(S)}},tt="animationComponent",nt=I.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",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 {
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 i;const e=((i=n.animations)==null?void 0:i.call(n,{items:z}))||z,r=[q(t,{...n,animationList:e}),Q(t,n)];t.Styles.addSector("animation",{name:"Animation",properties:[{...w,name:"Type",property:y.name,type:"select",full:!0,default:"fadeIn",options:e},{...w,name:"Duration",property:y.duration,type:"number",units:["s"],min:.1,max:10,step:.1,default:"1s"},{...w,name:"Delay",property:y.delay,type:"number",units:["s"],min:0,max:10,step:.1,default:"1s"},{...w,name:"Iteration Count",property:y.iterationCount,type:"select",default:"1",options:[{id:"1",name:"One time"},{id:"infinite",name:"Infinite"}]},{...w,name:"Timing",property:y.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"}]},{...$,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:v.onScroll,type:"radio",default:"true",options:[{name:"Yes",id:"true"},{name:"No",id:"false"}]},{...T,name:"Scroll Threshold",property:v.threshold,type:"number",full:!0,min:.1,max:1,step:.01,default:"0.2"},{...T,name:"Repeat on Scroll",property:v.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:()=>{r.forEach(a=>a())}})})});
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())}})})});
@@ -1 +1 @@
1
- "use strict";const V="app.grapesjs.com",k="app-stage.grapesjs.com",X="app2.grapesjs.com",j="app-stage2.grapesjs.com",U=[V,X,k,j,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],F="license:check:start",q="license:check:end",J=()=>typeof window<"u",z=({isDev:e,isStage:a})=>`${e?"":`https://${a?k:V}`}/api`,Q=()=>{const e=J()&&window.location.hostname;return!!e&&(U.includes(e)||U.some(a=>e.endsWith(a)))};function Z(e){return typeof e=="function"}async function ee({path:e,baseApiUrl:a,method:h="GET",headers:l={},params:f,body:s}){const n=`${a||z({isDev:!1,isStage:!1})}${e}`,m={method:h,headers:{"Content-Type":"application/json",...l}};s&&(m.body=JSON.stringify(s));const d=f?new URLSearchParams(f).toString():"",t=d?`?${d}`:"",c=await fetch(`${n}${t}`,m);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}var L=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(L||{});const W={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function te(e){const a=e;return a.init=h=>l=>e(l,h),a}const ne=e=>te(e);async function se({editor:e,plan:a,pluginName:h,licenseKey:l,cleanup:f}){let s="",o=!1;const n=Q(),m=t=>{console.warn("Cleanup plugin:",h,"Reason:",t),f()},d=(t={})=>{var E;const{error:c,sdkLicense:p}=t,i=(E=t.plan)==null?void 0:E.category;if(!(p||t.license)||c)m(c||"Invalid license");else if(i){const b=W[a],v=W[i];b>v&&m({pluginRequiredPlan:a,licensePlan:i})}};e.on(F,t=>{s=t==null?void 0:t.baseApiUrl,o=!0}),e.on(q,t=>{d(t)}),setTimeout(async()=>{if(!o){if(n)return;if(l){const t=await oe({licenseKey:l,pluginName:h,baseApiUrl:s});t&&d(t)}else m("The `licenseKey` option not provided")}},2e3)}async function oe(e){const{licenseKey:a,pluginName:h,baseApiUrl:l}=e;try{return(await ee({baseApiUrl:l,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:h}})).result||{}}catch(f){return console.error("Error during SDK license check:",f),!1}}const ce="canvasAbsoluteMode",ie=L.startup,ae=(e,a,h)=>{var d,t;const l=h.enableAbsolute??(c=>c.hasAbsolute),s=(Array.isArray(a)?a:a?[a]:[...e.getSelectedAll()])[0],o=((t=(d=s==null?void 0:s.delegate)==null?void 0:d.move)==null?void 0:t.call(d,s))||s;if(!o)return;const n=o.getEl();return{result:Z(l)?l({component:o,hasAbsolute:!!n&&getComputedStyle(n).position==="absolute"}):!1,component:o,dmode:o.get("dmode")}};function B({guideMatched:e,canvasView:a}){var P;const h=e.guide.x===void 0?"y":"x";let l=0,f=0,s=0,o=0;const{guide:n,matched:m}=e,d=a.getElBoxRect(n.componentView.el),t=a.getElBoxRect(((P=m.componentView)==null?void 0:P.el)||m.componentEl),c=d.y,p=d.y+d.height,i=d.x,S=d.x+d.width,E=t.y,b=t.y+t.height,v=t.x,_=t.x+t.width,x=Math.max(0,c-b),u=Math.max(0,E-p),C=Math.max(0,i-_),M=Math.max(0,v-S),r=x>u,g=C>M,y=n.type;return h==="x"&&(y==="l"?(l=i,r?(f=b,s=x):(f=p,s=u)):y==="r"?(l=S,r?(f=b,s=x):(f=p,s=u)):y==="x"&&(l=i-(i-S)/2,r?(f=b,s=x):(f=p,s=u))),h==="y"&&(y==="t"?(f=c,g?(l=_,o=C):(l=S,o=M)):y==="b"?(f=p,g?(l=_,o=C):(l=S,o=M)):y==="y"&&(f=c-(c-p)/2,g?(l=_,o=C):(l=S,o=M))),{axis:h,x:l,y:f,width:o,height:s}}function le({guideMatched:e,component:a,canvasView:h}){const l=e.guide.x===void 0?"x":"y",{guide:f,matched:s}=e,o=f.type,n=s.type,m=h.getElementPos(f.componentView.el).rect,d=h.getElementPos(s.componentView.el).rect;if(l==="x"){const t=m.height,c=d.top,p=d.top+d.height;let i=0;o==="t"?n==="t"?i=c-t:n==="b"?i=p-t:n==="y"&&(i=c-t-(c-p)/2):o==="b"?n==="t"?i=c-t*2:n==="b"?i=p-t*2:n==="y"&&(i=c-t*2-(c-p)/2):o==="y"&&(n==="t"?i=c-t*1.5:n==="b"?i=p-t*1.5:n==="y"&&(i=c-t*1.5-(c-p)/2)),a.addStyle({top:`${i-5}px`},{partial:!0})}if(l==="y"){const t=m.width,c=d.left,p=d.left+d.width;let i=0;o==="l"?n==="l"?i=c:n==="r"?i=p:n==="x"&&(i=c-(c-p)/2):o==="r"?n==="l"?i=c-t:n==="r"?i=p-t:n==="x"&&(i=c-t-(c-p)/2):o==="x"&&(n==="l"?i=c-t/2:n==="r"&&(i=p-t/2)),a.addStyle({left:`${i}px`},{partial:!0})}}function H({snapping:e,editor:a,props:h}){var R,w;const{command:l,guidesMatched:f}=h,s=h.component,o=s.getEl(),n=a.Canvas.getCanvasView(),{x:m,y:d}=e??{x:10,y:10},t=l.opts.event,c=t.clientX,p=t.clientY;if(!s.__lastSnappedPosition){const A=n.getElBoxRect(o),D=c-A.x,T=p-A.y;s.__lastSnappedPosition={left:A.x,top:A.y},s.__dragOffset={x:D,y:T}}const i=((R=s.__dragOffset)==null?void 0:R.x)||0,S=((w=s.__dragOffset)==null?void 0:w.y)||0,E=s.__lastSnappedPosition,b=c-E.left-i,v=p-E.top-S;let _=E.left,x=E.top;const u=f==null?void 0:f[0],C=(u==null?void 0:u.guide.type)==="l",M=(u==null?void 0:u.guide.type)==="x",r=(u==null?void 0:u.guide.type)==="r",g=(u==null?void 0:u.guide.type)==="t",y=(u==null?void 0:u.guide.type)==="b",P=(u==null?void 0:u.guide.type)==="y";if(u){const{x:A,y:D}=B({guideMatched:u,canvasView:n}),T=o.offsetWidth,G=o.offsetHeight;C?_=A:r?_=A-T:M?_=A-T/2:g?x=D:y?x=D-G:P&&(x=D-G/2),s.__lastSnappedGuideMatched=u}else Math.abs(b)>=m&&(_=Math.round((E.left+b)/m)*m,s.__lastSnappedGuideMatched=null),Math.abs(v)>=d&&(x=Math.round((E.top+v)/d)*d,s.__lastSnappedGuideMatched=null);return s.addStyle({left:`${_}px`,top:`${x}px`},{partial:!0}),s.__lastSnappedPosition={left:_,top:x},{x:_,y:x,guideMatched:s.__lastSnappedGuideMatched}}function de({snapping:e,props:a,editor:h}){const{x:l,y:f}=H({snapping:e,props:a,editor:h}),s=a.component;s.addStyle({left:`${l}px`,top:`${f}px`}),delete s.__lastSnappedPosition,delete s.__lastSnappedGuideMatched}const fe="core:component-drag",re="studio:setDragAbsolute",pe="dmode:start",Y="dmode:move",K="dmode:end",$="dragAbsolute",ue="select",he="hover",me="spacing",ge=function(e,a={}){const{Commands:h}=e,l=h.events,f=h.getConfig().defaultOptions??{},s=`${l.runBeforeCommand}tlb-move`;f[fe]={run:r=>({...r,skipGuidesRender:!0})};const{snapping:o,locking:n,globalAbsolute:m=!0}=a;m&&e.setDragMode("absolute");const d=!!(o!=null&&o.x||o!=null&&o.y),t=!!(n!=null&&n.x||n!=null&&n.y),{Canvas:c}=e;let p=null;const i=r=>{const{component:g,guidesMatched:y,command:P}=r,R=g.view,w=e.Canvas.getCanvasView(),A=g.getEl();let D=y.map(O=>O.matched.componentEl),T=y.map(O=>B({guideMatched:O,canvasView:w}));if(d){const{guideMatched:O}=H({snapping:o,props:r,editor:e});O?(D=[O.matched.componentEl],T=[B({guideMatched:O,canvasView:w})]):(D=[],T=[])}if(t)if(P.opts.event.shiftKey)if(!p)p=y[0];else{const N=p,I=N.guide.x===void 0?"x":"y";(I==="x"&&(n==null?void 0:n.x)||I==="y"&&(n==null?void 0:n.y))&&(le({guideMatched:N,component:g,canvasView:w}),D=[N.matched.componentEl],T=[B({guideMatched:N,canvasView:w})])}else p=null;const G={id:$,type:$,component:g,componentView:R,originComponent:A,matchedComponents:D,originMatchedDistances:T};c.addSpot(G)},S=({enabled:r})=>{e.runCommand(re,{enabled:r})},E=({type:r})=>{c.removeSpots({type:r})},b=()=>{E({type:ue}),E({type:he}),E({type:me})},v=r=>{S({enabled:!0}),i(r),b()},_=r=>{i(r),b()},x=r=>{E({type:$}),d&&de({snapping:o,props:r,editor:e}),S({enabled:!1})},M=[[pe,r=>{v(r),e.on(Y,_);const g=()=>{x(r),e.off(Y,_),e.off(K,g)};e.on(K,g)}],[s,r=>{if(m)return;const g=r.options.target,y=ae(e,g,a);y!=null&&y.result&&!y.dmode&&(r.options.mode="absolute")}]];M.forEach(([r,g])=>e.on(r,g)),se({editor:e,licenseKey:a.licenseKey,plan:ie,pluginName:ce,cleanup:()=>{S({enabled:!1}),M.forEach(([r,g])=>e.off(r,g))}})},ye=ne(ge);module.exports=ye;
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,8 +1,8 @@
1
- const V = "app.grapesjs.com", k = "app-stage.grapesjs.com", X = "app2.grapesjs.com", j = "app-stage2.grapesjs.com", U = [
1
+ const V = "app.grapesjs.com", H = "app-stage.grapesjs.com", j = "app2.grapesjs.com", F = "app-stage2.grapesjs.com", U = [
2
2
  V,
3
- X,
4
- k,
5
3
  j,
4
+ H,
5
+ F,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -11,239 +11,244 @@ const V = "app.grapesjs.com", k = "app-stage.grapesjs.com", X = "app2.grapesjs.c
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], F = "license:check:start", q = "license:check:end", J = () => typeof window < "u", z = ({ isDev: e, isStage: a }) => `${e ? "" : `https://${a ? k : V}`}/api`, Q = () => {
15
- const e = J() && window.location.hostname;
16
- return !!e && (U.includes(e) || U.some((a) => e.endsWith(a)));
14
+ ], q = "license:check:start", J = "license:check:end", z = () => typeof window < "u", Q = ({
15
+ isDev: t,
16
+ isStage: a,
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)));
17
21
  };
18
- function Z(e) {
19
- return typeof e == "function";
22
+ function k(t) {
23
+ return typeof t == "function";
20
24
  }
21
- async function ee({
22
- path: e,
25
+ async function tt({
26
+ path: t,
23
27
  baseApiUrl: a,
24
- method: h = "GET",
28
+ method: u = "GET",
25
29
  headers: l = {},
26
- params: f,
27
- body: s
30
+ params: i,
31
+ body: o
28
32
  }) {
29
- const n = `${a || z({ isDev: !1, isStage: !1 })}${e}`, m = {
30
- method: h,
33
+ const n = `${a || Q({ isDev: !1, isStage: !1 })}${t}`, g = {
34
+ method: u,
31
35
  headers: {
32
36
  "Content-Type": "application/json",
33
37
  ...l
34
38
  }
35
39
  };
36
- s && (m.body = JSON.stringify(s));
37
- const d = f ? new URLSearchParams(f).toString() : "", t = d ? `?${d}` : "", c = await fetch(`${n}${t}`, m);
38
- if (!c.ok)
39
- throw new Error(`HTTP error! status: ${c.status}`);
40
- return c.json();
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();
41
45
  }
42
- var L = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(L || {});
46
+ var G = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(G || {});
43
47
  const W = {
44
- [L.free]: 0,
45
- [L.startup]: 10,
46
- [L.business]: 20,
47
- [L.enterprise]: 30
48
+ [G.free]: 0,
49
+ [G.startup]: 10,
50
+ [G.business]: 20,
51
+ [G.enterprise]: 30
48
52
  };
49
- function te(e) {
50
- const a = e;
51
- return a.init = (h) => (l) => e(l, h), a;
53
+ function et(t) {
54
+ const a = t;
55
+ return a.init = (u) => (l) => t(l, u), a;
52
56
  }
53
- const ne = (e) => /* @__PURE__ */ te(e);
54
- async function se({
55
- editor: e,
57
+ const nt = (t) => /* @__PURE__ */ et(t);
58
+ async function ot({
59
+ editor: t,
56
60
  plan: a,
57
- pluginName: h,
61
+ pluginName: u,
58
62
  licenseKey: l,
59
- cleanup: f
63
+ onLicenseCheckResponse: i,
64
+ cleanup: o
60
65
  }) {
61
- let s = "", o = !1;
62
- const n = Q(), m = (t) => {
63
- console.warn("Cleanup plugin:", h, "Reason:", t), f();
64
- }, d = (t = {}) => {
65
- var E;
66
- const { error: c, sdkLicense: p } = t, i = (E = t.plan) == null ? void 0 : E.category;
67
- if (!(p || t.license) || c)
68
- m(c || "Invalid license");
69
- else if (i) {
70
- const b = W[a], v = W[i];
71
- b > v && m({ pluginRequiredPlan: a, licensePlan: i });
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 });
72
77
  }
73
78
  };
74
- e.on(F, (t) => {
75
- s = t == null ? void 0 : t.baseApiUrl, o = !0;
76
- }), e.on(q, (t) => {
77
- d(t);
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);
78
83
  }), setTimeout(async () => {
79
- if (!o) {
80
- if (n) return;
84
+ if (!n) {
85
+ if (g) return;
81
86
  if (l) {
82
- const t = await oe({ licenseKey: l, pluginName: h, baseApiUrl: s });
83
- t && d(t);
87
+ const e = await st({ licenseKey: l, pluginName: u, baseApiUrl: s });
88
+ i == null || i(e), e && c(e);
84
89
  } else
85
- m("The `licenseKey` option not provided");
90
+ d("The `licenseKey` option not provided");
86
91
  }
87
92
  }, 2e3);
88
93
  }
89
- async function oe(e) {
90
- const { licenseKey: a, pluginName: h, baseApiUrl: l } = e;
94
+ async function st(t) {
95
+ const { licenseKey: a, pluginName: u, baseApiUrl: l } = t;
91
96
  try {
92
- return (await ee({
97
+ return (await tt({
93
98
  baseApiUrl: l,
94
99
  path: `/sdk/${a || "na"}`,
95
100
  method: "POST",
96
101
  params: {
97
102
  d: window.location.hostname,
98
- pn: h
103
+ pn: u
99
104
  }
100
105
  })).result || {};
101
- } catch (f) {
102
- return console.error("Error during SDK license check:", f), !1;
106
+ } catch (i) {
107
+ return console.error("Error during SDK license check:", i), !1;
103
108
  }
104
109
  }
105
- const ce = "canvasAbsoluteMode", ie = L.startup, ae = (e, a, h) => {
106
- var d, t;
107
- const l = h.enableAbsolute ?? ((c) => c.hasAbsolute), s = (Array.isArray(a) ? a : a ? [a] : [...e.getSelectedAll()])[0], o = ((t = (d = s == null ? void 0 : s.delegate) == null ? void 0 : d.move) == null ? void 0 : t.call(d, s)) || s;
108
- if (!o) return;
109
- const n = o.getEl();
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();
110
115
  return {
111
- result: Z(l) ? l({ component: o, hasAbsolute: !!n && getComputedStyle(n).position === "absolute" }) : !1,
112
- component: o,
113
- dmode: o.get("dmode")
116
+ result: k(l) ? l({ component: s, hasAbsolute: !!n && getComputedStyle(n).position === "absolute" }) : !1,
117
+ component: s,
118
+ dmode: s.get("dmode")
114
119
  };
115
120
  };
116
121
  function B({
117
- guideMatched: e,
122
+ guideMatched: t,
118
123
  canvasView: a
119
124
  }) {
120
- var P;
121
- const h = e.guide.x === void 0 ? "y" : "x";
122
- let l = 0, f = 0, s = 0, o = 0;
123
- const { guide: n, matched: m } = e, d = a.getElBoxRect(n.componentView.el), t = a.getElBoxRect(((P = m.componentView) == null ? void 0 : P.el) || m.componentEl), c = d.y, p = d.y + d.height, i = d.x, S = d.x + d.width, E = t.y, b = t.y + t.height, v = t.x, _ = t.x + t.width, x = Math.max(0, c - b), u = Math.max(0, E - p), C = Math.max(0, i - _), M = Math.max(0, v - S), r = x > u, g = C > M, y = n.type;
124
- return h === "x" && (y === "l" ? (l = i, r ? (f = b, s = x) : (f = p, s = u)) : y === "r" ? (l = S, r ? (f = b, s = x) : (f = p, s = u)) : y === "x" && (l = i - (i - S) / 2, r ? (f = b, s = x) : (f = p, s = u))), h === "y" && (y === "t" ? (f = c, g ? (l = _, o = C) : (l = S, o = M)) : y === "b" ? (f = p, g ? (l = _, o = C) : (l = S, o = M)) : y === "y" && (f = c - (c - p) / 2, g ? (l = _, o = C) : (l = S, o = M))), { axis: h, x: l, y: f, width: o, height: s };
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 };
125
130
  }
126
- function le({
127
- guideMatched: e,
131
+ function lt({
132
+ guideMatched: t,
128
133
  component: a,
129
- canvasView: h
134
+ canvasView: u
130
135
  }) {
131
- const l = e.guide.x === void 0 ? "x" : "y", { guide: f, matched: s } = e, o = f.type, n = s.type, m = h.getElementPos(f.componentView.el).rect, d = h.getElementPos(s.componentView.el).rect;
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;
132
137
  if (l === "x") {
133
- const t = m.height, c = d.top, p = d.top + d.height;
134
- let i = 0;
135
- o === "t" ? n === "t" ? i = c - t : n === "b" ? i = p - t : n === "y" && (i = c - t - (c - p) / 2) : o === "b" ? n === "t" ? i = c - t * 2 : n === "b" ? i = p - t * 2 : n === "y" && (i = c - t * 2 - (c - p) / 2) : o === "y" && (n === "t" ? i = c - t * 1.5 : n === "b" ? i = p - t * 1.5 : n === "y" && (i = c - t * 1.5 - (c - p) / 2)), a.addStyle({ top: `${i - 5}px` }, { partial: !0 });
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 });
136
141
  }
137
142
  if (l === "y") {
138
- const t = m.width, c = d.left, p = d.left + d.width;
139
- let i = 0;
140
- o === "l" ? n === "l" ? i = c : n === "r" ? i = p : n === "x" && (i = c - (c - p) / 2) : o === "r" ? n === "l" ? i = c - t : n === "r" ? i = p - t : n === "x" && (i = c - t - (c - p) / 2) : o === "x" && (n === "l" ? i = c - t / 2 : n === "r" && (i = p - t / 2)), a.addStyle({ left: `${i}px` }, { partial: !0 });
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 });
141
146
  }
142
147
  }
143
- function H({
144
- snapping: e,
148
+ function X({
149
+ snapping: t,
145
150
  editor: a,
146
- props: h
151
+ props: u
147
152
  }) {
148
- var R, w;
149
- const { command: l, guidesMatched: f } = h, s = h.component, o = s.getEl(), n = a.Canvas.getCanvasView(), { x: m, y: d } = e ?? { x: 10, y: 10 }, t = l.opts.event, c = t.clientX, p = t.clientY;
150
- if (!s.__lastSnappedPosition) {
151
- const A = n.getElBoxRect(o), D = c - A.x, T = p - A.y;
152
- s.__lastSnappedPosition = { left: A.x, top: A.y }, s.__dragOffset = { x: D, y: T };
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 };
153
158
  }
154
- const i = ((R = s.__dragOffset) == null ? void 0 : R.x) || 0, S = ((w = s.__dragOffset) == null ? void 0 : w.y) || 0, E = s.__lastSnappedPosition, b = c - E.left - i, v = p - E.top - S;
155
- let _ = E.left, x = E.top;
156
- const u = f == null ? void 0 : f[0], C = (u == null ? void 0 : u.guide.type) === "l", M = (u == null ? void 0 : u.guide.type) === "x", r = (u == null ? void 0 : u.guide.type) === "r", g = (u == null ? void 0 : u.guide.type) === "t", y = (u == null ? void 0 : u.guide.type) === "b", P = (u == null ? void 0 : u.guide.type) === "y";
157
- if (u) {
158
- const { x: A, y: D } = B({ guideMatched: u, canvasView: n }), T = o.offsetWidth, G = o.offsetHeight;
159
- C ? _ = A : r ? _ = A - T : M ? _ = A - T / 2 : g ? x = D : y ? x = D - G : P && (x = D - G / 2), s.__lastSnappedGuideMatched = u;
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;
160
165
  } else
161
- Math.abs(b) >= m && (_ = Math.round((E.left + b) / m) * m, s.__lastSnappedGuideMatched = null), Math.abs(v) >= d && (x = Math.round((E.top + v) / d) * d, s.__lastSnappedGuideMatched = null);
162
- return s.addStyle({ left: `${_}px`, top: `${x}px` }, { partial: !0 }), s.__lastSnappedPosition = { left: _, top: x }, { x: _, y: x, guideMatched: s.__lastSnappedGuideMatched };
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 };
163
168
  }
164
- function de({
165
- snapping: e,
169
+ function dt({
170
+ snapping: t,
166
171
  props: a,
167
- editor: h
172
+ editor: u
168
173
  }) {
169
- const { x: l, y: f } = H({ snapping: e, props: a, editor: h }), s = a.component;
170
- s.addStyle({ left: `${l}px`, top: `${f}px` }), delete s.__lastSnappedPosition, delete s.__lastSnappedGuideMatched;
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;
171
176
  }
172
- const fe = "core:component-drag", re = "studio:setDragAbsolute", pe = "dmode:start", Y = "dmode:move", K = "dmode:end", $ = "dragAbsolute", ue = "select", he = "hover", me = "spacing", ge = function(e, a = {}) {
173
- const { Commands: h } = e, l = h.events, f = h.getConfig().defaultOptions ?? {}, s = `${l.runBeforeCommand}tlb-move`;
174
- f[fe] = {
175
- run: (r) => ({
176
- ...r,
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,
177
182
  skipGuidesRender: !0
178
183
  })
179
184
  };
180
- const { snapping: o, locking: n, globalAbsolute: m = !0 } = a;
181
- m && e.setDragMode("absolute");
182
- const d = !!(o != null && o.x || o != null && o.y), t = !!(n != null && n.x || n != null && n.y), { Canvas: c } = e;
183
- let p = null;
184
- const i = (r) => {
185
- const { component: g, guidesMatched: y, command: P } = r, R = g.view, w = e.Canvas.getCanvasView(), A = g.getEl();
186
- let D = y.map((O) => O.matched.componentEl), T = y.map((O) => B({ guideMatched: O, canvasView: w }));
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 }));
187
192
  if (d) {
188
- const { guideMatched: O } = H({ snapping: o, props: r, editor: e });
189
- O ? (D = [O.matched.componentEl], T = [B({ guideMatched: O, canvasView: w })]) : (D = [], T = []);
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 = []);
190
195
  }
191
- if (t)
192
- if (P.opts.event.shiftKey)
193
- if (!p)
194
- p = y[0];
196
+ if (c)
197
+ if (C.opts.event.shiftKey)
198
+ if (!r)
199
+ r = _[0];
195
200
  else {
196
- const N = p, I = N.guide.x === void 0 ? "x" : "y";
197
- (I === "x" && (n == null ? void 0 : n.x) || I === "y" && (n == null ? void 0 : n.y)) && (le({ guideMatched: N, component: g, canvasView: w }), D = [N.matched.componentEl], T = [B({ guideMatched: N, canvasView: w })]);
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 })]);
198
203
  }
199
204
  else
200
- p = null;
201
- const G = {
205
+ r = null;
206
+ const L = {
202
207
  id: $,
203
208
  type: $,
204
- component: g,
205
- componentView: R,
209
+ component: h,
210
+ componentView: N,
206
211
  originComponent: A,
207
212
  matchedComponents: D,
208
213
  originMatchedDistances: T
209
214
  };
210
- c.addSpot(G);
211
- }, S = ({ enabled: r }) => {
212
- e.runCommand(re, { enabled: r });
213
- }, E = ({ type: r }) => {
214
- c.removeSpots({ type: r });
215
+ e.addSpot(L);
216
+ }, y = ({ enabled: p }) => {
217
+ t.runCommand(rt, { enabled: p });
218
+ }, S = ({ type: p }) => {
219
+ e.removeSpots({ type: p });
215
220
  }, b = () => {
216
- E({ type: ue }), E({ type: he }), E({ type: me });
217
- }, v = (r) => {
218
- S({ enabled: !0 }), i(r), b();
219
- }, _ = (r) => {
220
- i(r), b();
221
- }, x = (r) => {
222
- E({ type: $ }), d && de({ snapping: o, props: r, editor: e }), S({ enabled: !1 });
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 });
223
228
  }, M = [
224
- [pe, (r) => {
225
- v(r), e.on(Y, _);
226
- const g = () => {
227
- x(r), e.off(Y, _), e.off(K, g);
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
233
  };
229
- e.on(K, g);
234
+ t.on(K, h);
230
235
  }],
231
- [s, (r) => {
232
- if (m) return;
233
- const g = r.options.target, y = ae(e, g, a);
234
- y != null && y.result && !y.dmode && (r.options.mode = "absolute");
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");
235
240
  }]
236
241
  ];
237
- M.forEach(([r, g]) => e.on(r, g)), se({
238
- editor: e,
242
+ M.forEach(([p, h]) => t.on(p, h)), ot({
243
+ editor: t,
239
244
  licenseKey: a.licenseKey,
240
- plan: ie,
241
- pluginName: ce,
245
+ plan: ct,
246
+ pluginName: it,
242
247
  cleanup: () => {
243
- S({ enabled: !1 }), M.forEach(([r, g]) => e.off(r, g));
248
+ y({ enabled: !1 }), M.forEach(([p, h]) => t.off(p, h));
244
249
  }
245
250
  });
246
- }, Ee = ne(ge);
251
+ }, Et = nt(gt);
247
252
  export {
248
- Ee as default
253
+ Et as default
249
254
  };