@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.
- package/dist/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`)},init(){const{em:
|
|
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
|
|
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",
|
|
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",
|
|
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
|
-
],
|
|
15
|
-
|
|
16
|
-
|
|
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
|
|
19
|
-
return typeof
|
|
22
|
+
function k(t) {
|
|
23
|
+
return typeof t == "function";
|
|
20
24
|
}
|
|
21
|
-
async function
|
|
22
|
-
path:
|
|
25
|
+
async function tt({
|
|
26
|
+
path: t,
|
|
23
27
|
baseApiUrl: a,
|
|
24
|
-
method:
|
|
28
|
+
method: u = "GET",
|
|
25
29
|
headers: l = {},
|
|
26
|
-
params:
|
|
27
|
-
body:
|
|
30
|
+
params: i,
|
|
31
|
+
body: o
|
|
28
32
|
}) {
|
|
29
|
-
const n = `${a ||
|
|
30
|
-
method:
|
|
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
|
-
|
|
37
|
-
const d =
|
|
38
|
-
if (!
|
|
39
|
-
throw new Error(`HTTP error! status: ${
|
|
40
|
-
return
|
|
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
|
|
46
|
+
var G = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(G || {});
|
|
43
47
|
const W = {
|
|
44
|
-
[
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
+
[G.free]: 0,
|
|
49
|
+
[G.startup]: 10,
|
|
50
|
+
[G.business]: 20,
|
|
51
|
+
[G.enterprise]: 30
|
|
48
52
|
};
|
|
49
|
-
function
|
|
50
|
-
const a =
|
|
51
|
-
return a.init = (
|
|
53
|
+
function et(t) {
|
|
54
|
+
const a = t;
|
|
55
|
+
return a.init = (u) => (l) => t(l, u), a;
|
|
52
56
|
}
|
|
53
|
-
const
|
|
54
|
-
async function
|
|
55
|
-
editor:
|
|
57
|
+
const nt = (t) => /* @__PURE__ */ et(t);
|
|
58
|
+
async function ot({
|
|
59
|
+
editor: t,
|
|
56
60
|
plan: a,
|
|
57
|
-
pluginName:
|
|
61
|
+
pluginName: u,
|
|
58
62
|
licenseKey: l,
|
|
59
|
-
|
|
63
|
+
onLicenseCheckResponse: i,
|
|
64
|
+
cleanup: o
|
|
60
65
|
}) {
|
|
61
|
-
let s = "",
|
|
62
|
-
const
|
|
63
|
-
console.warn("Cleanup plugin:",
|
|
64
|
-
},
|
|
65
|
-
var
|
|
66
|
-
const { error:
|
|
67
|
-
if (!(
|
|
68
|
-
|
|
69
|
-
else if (
|
|
70
|
-
const
|
|
71
|
-
|
|
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
|
-
|
|
75
|
-
s =
|
|
76
|
-
}),
|
|
77
|
-
|
|
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 (!
|
|
80
|
-
if (
|
|
84
|
+
if (!n) {
|
|
85
|
+
if (g) return;
|
|
81
86
|
if (l) {
|
|
82
|
-
const
|
|
83
|
-
|
|
87
|
+
const e = await st({ licenseKey: l, pluginName: u, baseApiUrl: s });
|
|
88
|
+
i == null || i(e), e && c(e);
|
|
84
89
|
} else
|
|
85
|
-
|
|
90
|
+
d("The `licenseKey` option not provided");
|
|
86
91
|
}
|
|
87
92
|
}, 2e3);
|
|
88
93
|
}
|
|
89
|
-
async function
|
|
90
|
-
const { licenseKey: a, pluginName:
|
|
94
|
+
async function st(t) {
|
|
95
|
+
const { licenseKey: a, pluginName: u, baseApiUrl: l } = t;
|
|
91
96
|
try {
|
|
92
|
-
return (await
|
|
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:
|
|
103
|
+
pn: u
|
|
99
104
|
}
|
|
100
105
|
})).result || {};
|
|
101
|
-
} catch (
|
|
102
|
-
return console.error("Error during SDK license check:",
|
|
106
|
+
} catch (i) {
|
|
107
|
+
return console.error("Error during SDK license check:", i), !1;
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
|
-
const
|
|
106
|
-
var d,
|
|
107
|
-
const l =
|
|
108
|
-
if (!
|
|
109
|
-
const n =
|
|
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:
|
|
112
|
-
component:
|
|
113
|
-
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:
|
|
122
|
+
guideMatched: t,
|
|
118
123
|
canvasView: a
|
|
119
124
|
}) {
|
|
120
|
-
var
|
|
121
|
-
const
|
|
122
|
-
let l = 0,
|
|
123
|
-
const { guide: n, matched:
|
|
124
|
-
return
|
|
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
|
|
127
|
-
guideMatched:
|
|
131
|
+
function lt({
|
|
132
|
+
guideMatched: t,
|
|
128
133
|
component: a,
|
|
129
|
-
canvasView:
|
|
134
|
+
canvasView: u
|
|
130
135
|
}) {
|
|
131
|
-
const l =
|
|
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
|
|
134
|
-
let
|
|
135
|
-
|
|
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
|
|
139
|
-
let
|
|
140
|
-
|
|
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
|
|
144
|
-
snapping:
|
|
148
|
+
function X({
|
|
149
|
+
snapping: t,
|
|
145
150
|
editor: a,
|
|
146
|
-
props:
|
|
151
|
+
props: u
|
|
147
152
|
}) {
|
|
148
|
-
var
|
|
149
|
-
const { command: l, guidesMatched:
|
|
150
|
-
if (!
|
|
151
|
-
const A = n.getElBoxRect(
|
|
152
|
-
|
|
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
|
|
155
|
-
let
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
const { x: A, y: D } = B({ guideMatched:
|
|
159
|
-
|
|
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) >=
|
|
162
|
-
return
|
|
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
|
|
165
|
-
snapping:
|
|
169
|
+
function dt({
|
|
170
|
+
snapping: t,
|
|
166
171
|
props: a,
|
|
167
|
-
editor:
|
|
172
|
+
editor: u
|
|
168
173
|
}) {
|
|
169
|
-
const { x: l, y:
|
|
170
|
-
|
|
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
|
|
173
|
-
const { Commands:
|
|
174
|
-
|
|
175
|
-
run: (
|
|
176
|
-
...
|
|
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:
|
|
181
|
-
|
|
182
|
-
const d = !!(
|
|
183
|
-
let
|
|
184
|
-
const
|
|
185
|
-
const { component:
|
|
186
|
-
let D =
|
|
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 } =
|
|
189
|
-
O ? (D = [O.matched.componentEl], T = [B({ guideMatched: O, canvasView:
|
|
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 (
|
|
192
|
-
if (
|
|
193
|
-
if (!
|
|
194
|
-
|
|
196
|
+
if (c)
|
|
197
|
+
if (C.opts.event.shiftKey)
|
|
198
|
+
if (!r)
|
|
199
|
+
r = _[0];
|
|
195
200
|
else {
|
|
196
|
-
const
|
|
197
|
-
(I === "x" && (n == null ? void 0 : n.x) || I === "y" && (n == null ? void 0 : n.y)) && (
|
|
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
|
-
|
|
201
|
-
const
|
|
205
|
+
r = null;
|
|
206
|
+
const L = {
|
|
202
207
|
id: $,
|
|
203
208
|
type: $,
|
|
204
|
-
component:
|
|
205
|
-
componentView:
|
|
209
|
+
component: h,
|
|
210
|
+
componentView: N,
|
|
206
211
|
originComponent: A,
|
|
207
212
|
matchedComponents: D,
|
|
208
213
|
originMatchedDistances: T
|
|
209
214
|
};
|
|
210
|
-
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
|
|
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
|
-
|
|
217
|
-
}, v = (
|
|
218
|
-
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
}, x = (
|
|
222
|
-
|
|
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
|
-
[
|
|
225
|
-
v(
|
|
226
|
-
const
|
|
227
|
-
x(
|
|
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
|
-
|
|
234
|
+
t.on(K, h);
|
|
230
235
|
}],
|
|
231
|
-
[
|
|
232
|
-
if (
|
|
233
|
-
const
|
|
234
|
-
|
|
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(([
|
|
238
|
-
editor:
|
|
242
|
+
M.forEach(([p, h]) => t.on(p, h)), ot({
|
|
243
|
+
editor: t,
|
|
239
244
|
licenseKey: a.licenseKey,
|
|
240
|
-
plan:
|
|
241
|
-
pluginName:
|
|
245
|
+
plan: ct,
|
|
246
|
+
pluginName: it,
|
|
242
247
|
cleanup: () => {
|
|
243
|
-
|
|
248
|
+
y({ enabled: !1 }), M.forEach(([p, h]) => t.off(p, h));
|
|
244
249
|
}
|
|
245
250
|
});
|
|
246
|
-
},
|
|
251
|
+
}, Et = nt(gt);
|
|
247
252
|
export {
|
|
248
|
-
|
|
253
|
+
Et as default
|
|
249
254
|
};
|