@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 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(C,N){typeof exports=="object"&&typeof module<"u"?module.exports=N():typeof define=="function"&&define.amd?define(N):(C=typeof globalThis<"u"?globalThis:C||self,C.StudioSdkPlugins_canvasAbsoluteMode=N())})(this,function(){"use strict";const C="app.grapesjs.com",N="app-stage.grapesjs.com",W=[C,"app2.grapesjs.com",N,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],X="license:check:start",F="license:check:end",q=()=>typeof window<"u",J=({isDev:t,isStage:a,isPlatform:u})=>`${t?"":`https://${a?N:C}`}/${u?"platform-api":"api"}`,k=()=>{const t=q()&&window.location.hostname;return!!t&&(W.includes(t)||W.some(a=>t.endsWith(a)))};function z(t){return typeof t=="function"}async function Q({path:t,baseApiUrl:a,method:u="GET",headers:l={},params:i,body:o}){const n=`${a||J({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 Y={[G.free]:0,[G.startup]:10,[G.business]:20,[G.enterprise]:30};function Z(t){const a=t;return a.init=u=>l=>t(l,u),a}const tt=t=>Z(t);async function et({editor:t,plan:a,pluginName:u,licenseKey:l,onLicenseCheckResponse:i,cleanup:o}){let s="",n=!1;const g=k(),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=Y[a],E=Y[y];v>E&&d({pluginRequiredPlan:a,licensePlan:y})}};t.on(X,e=>{s=e==null?void 0:e.baseApiUrl,n=!0}),t.on(F,e=>{i==null||i(e),c(e)}),setTimeout(async()=>{if(!n){if(g)return;if(l){const e=await nt({licenseKey:l,pluginName:u,baseApiUrl:s});i==null||i(e),e&&c(e)}else d("The `licenseKey` option not provided")}},2e3)}async function nt(t){const{licenseKey:a,pluginName:u,baseApiUrl:l}=t;try{return(await Q({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 ot="canvasAbsoluteMode",st=G.startup,it=(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:z(l)?l({component:s,hasAbsolute:!!n&&getComputedStyle(n).position==="absolute"}):!1,component:s,dmode:s.get("dmode")}};function L({guideMatched:t,canvasView:a}){var R;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(((R=g.componentView)==null?void 0:R.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 ct({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 K({snapping:t,editor:a,props:u}){var B,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=((B=o.__dragOffset)==null?void 0:B.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",R=(m==null?void 0:m.guide.type)==="y";if(m){const{x:A,y:D}=L({guideMatched:m,canvasView:n}),T=s.offsetWidth,I=s.offsetHeight;w?E=A:p?E=A-T:M?E=A-T/2:h?x=D:_?x=D-I:R&&(x=D-I/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 at({snapping:t,props:a,editor:u}){const{x:l,y:i}=K({snapping:t,props:a,editor:u}),o=a.component;o.addStyle({left:`${l}px`,top:`${i}px`}),delete o.__lastSnappedPosition,delete o.__lastSnappedGuideMatched}const lt="core:component-drag",dt="studio:setDragAbsolute",ft="dmode:start",V="dmode:move",j="dmode:end",U="dragAbsolute",rt="select",pt="hover",ut="spacing";return tt(function(t,a={}){const{Commands:u}=t,l=u.events,i=u.getConfig().defaultOptions??{},o=`${l.runBeforeCommand}tlb-move`;i[lt]={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:R}=p,B=h.view,P=t.Canvas.getCanvasView(),A=h.getEl();let D=_.map(O=>O.matched.componentEl),T=_.map(O=>L({guideMatched:O,canvasView:P}));if(d){const{guideMatched:O}=K({snapping:s,props:p,editor:t});O?(D=[O.matched.componentEl],T=[L({guideMatched:O,canvasView:P})]):(D=[],T=[])}if(c)if(R.opts.event.shiftKey)if(!r)r=_[0];else{const $=r,H=$.guide.x===void 0?"x":"y";(H==="x"&&(n==null?void 0:n.x)||H==="y"&&(n==null?void 0:n.y))&&(ct({guideMatched:$,component:h,canvasView:P}),D=[$.matched.componentEl],T=[L({guideMatched:$,canvasView:P})])}else r=null;const I={id:U,type:U,component:h,componentView:B,originComponent:A,matchedComponents:D,originMatchedDistances:T};e.addSpot(I)},y=({enabled:p})=>{t.runCommand(dt,{enabled:p})},S=({type:p})=>{e.removeSpots({type:p})},b=()=>{S({type:rt}),S({type:pt}),S({type:ut})},v=p=>{y({enabled:!0}),f(p),b()},E=p=>{f(p),b()},x=p=>{S({type:U}),d&&at({snapping:s,props:p,editor:t}),y({enabled:!1})},M=[[ft,p=>{v(p),t.on(V,E);const h=()=>{x(p),t.off(V,E),t.off(j,h)};t.on(j,h)}],[o,p=>{if(g)return;const h=p.options.target,_=it(t,h,a);_!=null&&_.result&&!_.dmode&&(p.options.mode="absolute")}]];M.forEach(([p,h])=>t.on(p,h)),et({editor:t,licenseKey:a.licenseKey,plan:st,pluginName:ot,cleanup:()=>{y({enabled:!1}),M.forEach(([p,h])=>t.off(p,h))}})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const W="app.grapesjs.com",D="app-stage.grapesjs.com",P="app2.grapesjs.com",$="app-stage2.grapesjs.com",U=[W,P,D,$,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],_="license:check:start",L="license:check:end",O=()=>typeof window<"u",j=({isDev:t,isStage:a,isPlatform:o})=>`${t?"":`https://${a?D:W}`}/${o?"platform-api":"api"}`,K=()=>{const t=O()&&window.location.hostname;return!!t&&(U.includes(t)||U.some(a=>t.endsWith(a)))};function G(t){return typeof t=="function"}async function k({path:t,baseApiUrl:a,method:o="GET",headers:i={},params:s,body:f}){const d=`${a||j({isDev:!1,isStage:!1})}${t}`,g={method:o,headers:{"Content-Type":"application/json",...i}};f&&(g.body=JSON.stringify(f));const l=s?new URLSearchParams(s).toString():"",h=l?`?${l}`:"",n=await fetch(`${d}${h}`,g);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var w=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(w||{});const M={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function x(t){const a=t;return a.init=o=>i=>t(i,o),a}const F=t=>x(t);async function H({editor:t,plan:a,pluginName:o,licenseKey:i,onLicenseCheckResponse:s,cleanup:f}){let p="",d=!1;const g=K(),l=n=>{console.warn("Cleanup plugin:",o,"Reason:",n),f()},h=(n={})=>{var T;const{error:E,sdkLicense:S}=n,y=(T=n.plan)==null?void 0:T.category;if(!(S||n.license)||E)l(E||"Invalid license");else if(y){const b=M[a],A=M[y];b>A&&l({pluginRequiredPlan:a,licensePlan:y})}};t.on(_,n=>{p=n==null?void 0:n.baseApiUrl,d=!0}),t.on(L,n=>{s==null||s(n),h(n)}),setTimeout(async()=>{if(!d){if(g)return;if(i){const n=await q({licenseKey:i,pluginName:o,baseApiUrl:p});s==null||s(n),n&&h(n)}else l("The `licenseKey` option not provided")}},2e3)}async function q(t){const{licenseKey:a,pluginName:o,baseApiUrl:i}=t;try{return(await k({baseApiUrl:i,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const B="canvasEmptyState",J=w.startup,z=function(t,a={}){const o=new WeakMap,i=new WeakMap,s=new WeakMap,f=new Set,p=new WeakMap,d={emptyStates:[],...a},g=(e,c)=>{let m=!1;const{isValid:u}=c;return Array.isArray(u)?m=u.some(r=>e.is(r)):G(u)?m=u({component:e,editor:t}):m=e.is(u),m},l=e=>{const c=o.get(e);o.delete(e),c==null||c()},h=e=>{e.views.forEach(c=>l(c)),s.delete(e)},n=e=>{if(!(!e||f.has(e)))try{f.add(e);const c=e.components().length>0,m=s.get(e);if(c&&m)h(e);else if(!c&&!m){const u=p.has(e)?p.get(e):d.emptyStates.find(r=>g(e,r));if(p.set(e,u),!u)return;e.views.forEach(r=>{const I=u.render({editor:t,component:e,componentView:r,mount:v=>{i.set(r,v),s.set(e,!0);const N=r.getChildrenContainer();N==null||N.appendChild(v)},unmount:()=>l(r)});o.set(r,()=>{I==null||I();const v=i.get(r);v==null||v.remove()})})}}finally{f.delete(e)}},E=e=>{s.has(e)&&h(e)},S=({model:e})=>{n(e.getComponent())},y=t.Components.events,C=`${y.update}:components`,T="component:mount",b=t.Canvas.events.frameLoadBody,A=y.removed;t.on(C,n),t.on(T,n),t.on(A,E),t.on(b,S),H({editor:t,licenseKey:d.licenseKey,plan:J,pluginName:B,cleanup:()=>{t.off(C,n),t.off(T,n),t.off(A,E),t.off(b,S)}})},Q=F(z);module.exports=Q;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
U,
|
|
1
|
+
const W = "app.grapesjs.com", D = "app-stage.grapesjs.com", P = "app2.grapesjs.com", $ = "app-stage2.grapesjs.com", U = [
|
|
3
2
|
W,
|
|
4
|
-
|
|
3
|
+
P,
|
|
5
4
|
D,
|
|
5
|
+
$,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
8
8
|
".local-credentialless.webcontainer.io",
|
|
@@ -11,157 +11,162 @@ const U = "app.grapesjs.com", M = "app-stage.grapesjs.com", W = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
], _ = "license:check:start", L = "license:check:end", O = () => typeof window < "u", j = ({
|
|
15
|
+
isDev: t,
|
|
16
|
+
isStage: a,
|
|
17
|
+
isPlatform: o
|
|
18
|
+
}) => `${t ? "" : `https://${a ? D : W}`}/${o ? "platform-api" : "api"}`, K = () => {
|
|
19
|
+
const t = O() && window.location.hostname;
|
|
20
|
+
return !!t && (U.includes(t) || U.some((a) => t.endsWith(a)));
|
|
17
21
|
};
|
|
18
|
-
function
|
|
19
|
-
return typeof
|
|
22
|
+
function G(t) {
|
|
23
|
+
return typeof t == "function";
|
|
20
24
|
}
|
|
21
|
-
async function
|
|
22
|
-
path:
|
|
23
|
-
baseApiUrl:
|
|
24
|
-
method:
|
|
25
|
-
headers:
|
|
26
|
-
params:
|
|
27
|
-
body:
|
|
25
|
+
async function k({
|
|
26
|
+
path: t,
|
|
27
|
+
baseApiUrl: a,
|
|
28
|
+
method: o = "GET",
|
|
29
|
+
headers: i = {},
|
|
30
|
+
params: s,
|
|
31
|
+
body: f
|
|
28
32
|
}) {
|
|
29
|
-
const
|
|
30
|
-
method:
|
|
33
|
+
const d = `${a || j({ isDev: !1, isStage: !1 })}${t}`, g = {
|
|
34
|
+
method: o,
|
|
31
35
|
headers: {
|
|
32
36
|
"Content-Type": "application/json",
|
|
33
|
-
...
|
|
37
|
+
...i
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
39
|
-
throw new Error(`HTTP error! status: ${
|
|
40
|
-
return
|
|
40
|
+
f && (g.body = JSON.stringify(f));
|
|
41
|
+
const l = s ? new URLSearchParams(s).toString() : "", h = l ? `?${l}` : "", n = await fetch(`${d}${h}`, g);
|
|
42
|
+
if (!n.ok)
|
|
43
|
+
throw new Error(`HTTP error! status: ${n.status}`);
|
|
44
|
+
return n.json();
|
|
41
45
|
}
|
|
42
|
-
var w = /* @__PURE__ */ ((
|
|
43
|
-
const
|
|
46
|
+
var w = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(w || {});
|
|
47
|
+
const M = {
|
|
44
48
|
[w.free]: 0,
|
|
45
49
|
[w.startup]: 10,
|
|
46
50
|
[w.business]: 20,
|
|
47
51
|
[w.enterprise]: 30
|
|
48
52
|
};
|
|
49
|
-
function
|
|
50
|
-
const
|
|
51
|
-
return
|
|
53
|
+
function x(t) {
|
|
54
|
+
const a = t;
|
|
55
|
+
return a.init = (o) => (i) => t(i, o), a;
|
|
52
56
|
}
|
|
53
|
-
const
|
|
54
|
-
async function
|
|
55
|
-
editor:
|
|
56
|
-
plan:
|
|
57
|
-
pluginName:
|
|
58
|
-
licenseKey:
|
|
59
|
-
|
|
57
|
+
const F = (t) => /* @__PURE__ */ x(t);
|
|
58
|
+
async function H({
|
|
59
|
+
editor: t,
|
|
60
|
+
plan: a,
|
|
61
|
+
pluginName: o,
|
|
62
|
+
licenseKey: i,
|
|
63
|
+
onLicenseCheckResponse: s,
|
|
64
|
+
cleanup: f
|
|
60
65
|
}) {
|
|
61
|
-
let
|
|
62
|
-
const g =
|
|
63
|
-
console.warn("Cleanup plugin:",
|
|
64
|
-
},
|
|
65
|
-
var
|
|
66
|
-
const { error:
|
|
67
|
-
if (!(
|
|
68
|
-
|
|
66
|
+
let p = "", d = !1;
|
|
67
|
+
const g = K(), l = (n) => {
|
|
68
|
+
console.warn("Cleanup plugin:", o, "Reason:", n), f();
|
|
69
|
+
}, h = (n = {}) => {
|
|
70
|
+
var T;
|
|
71
|
+
const { error: E, sdkLicense: S } = n, y = (T = n.plan) == null ? void 0 : T.category;
|
|
72
|
+
if (!(S || n.license) || E)
|
|
73
|
+
l(E || "Invalid license");
|
|
69
74
|
else if (y) {
|
|
70
|
-
const
|
|
71
|
-
|
|
75
|
+
const b = M[a], A = M[y];
|
|
76
|
+
b > A && l({ pluginRequiredPlan: a, licensePlan: y });
|
|
72
77
|
}
|
|
73
78
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}),
|
|
77
|
-
|
|
79
|
+
t.on(_, (n) => {
|
|
80
|
+
p = n == null ? void 0 : n.baseApiUrl, d = !0;
|
|
81
|
+
}), t.on(L, (n) => {
|
|
82
|
+
s == null || s(n), h(n);
|
|
78
83
|
}), setTimeout(async () => {
|
|
79
|
-
if (!
|
|
84
|
+
if (!d) {
|
|
80
85
|
if (g) return;
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
s &&
|
|
86
|
+
if (i) {
|
|
87
|
+
const n = await q({ licenseKey: i, pluginName: o, baseApiUrl: p });
|
|
88
|
+
s == null || s(n), n && h(n);
|
|
84
89
|
} else
|
|
85
|
-
|
|
90
|
+
l("The `licenseKey` option not provided");
|
|
86
91
|
}
|
|
87
92
|
}, 2e3);
|
|
88
93
|
}
|
|
89
|
-
async function
|
|
90
|
-
const { licenseKey:
|
|
94
|
+
async function q(t) {
|
|
95
|
+
const { licenseKey: a, pluginName: o, baseApiUrl: i } = t;
|
|
91
96
|
try {
|
|
92
|
-
return (await
|
|
93
|
-
baseApiUrl:
|
|
94
|
-
path: `/sdk/${
|
|
97
|
+
return (await k({
|
|
98
|
+
baseApiUrl: i,
|
|
99
|
+
path: `/sdk/${a || "na"}`,
|
|
95
100
|
method: "POST",
|
|
96
101
|
params: {
|
|
97
102
|
d: window.location.hostname,
|
|
98
|
-
pn:
|
|
103
|
+
pn: o
|
|
99
104
|
}
|
|
100
105
|
})).result || {};
|
|
101
|
-
} catch (
|
|
102
|
-
return console.error("Error during SDK license check:",
|
|
106
|
+
} catch (s) {
|
|
107
|
+
return console.error("Error during SDK license check:", s), !1;
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
|
-
const
|
|
106
|
-
const
|
|
110
|
+
const B = "canvasEmptyState", J = w.startup, z = function(t, a = {}) {
|
|
111
|
+
const o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new WeakMap(), d = {
|
|
107
112
|
emptyStates: [],
|
|
108
|
-
...
|
|
109
|
-
},
|
|
113
|
+
...a
|
|
114
|
+
}, g = (e, c) => {
|
|
110
115
|
let m = !1;
|
|
111
|
-
const { isValid:
|
|
112
|
-
return Array.isArray(
|
|
113
|
-
},
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
if (!(!
|
|
116
|
+
const { isValid: u } = c;
|
|
117
|
+
return Array.isArray(u) ? m = u.some((r) => e.is(r)) : G(u) ? m = u({ component: e, editor: t }) : m = e.is(u), m;
|
|
118
|
+
}, l = (e) => {
|
|
119
|
+
const c = o.get(e);
|
|
120
|
+
o.delete(e), c == null || c();
|
|
121
|
+
}, h = (e) => {
|
|
122
|
+
e.views.forEach((c) => l(c)), s.delete(e);
|
|
123
|
+
}, n = (e) => {
|
|
124
|
+
if (!(!e || f.has(e)))
|
|
120
125
|
try {
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
else if (!
|
|
126
|
-
const
|
|
127
|
-
if (
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
editor:
|
|
131
|
-
component:
|
|
132
|
-
componentView:
|
|
126
|
+
f.add(e);
|
|
127
|
+
const c = e.components().length > 0, m = s.get(e);
|
|
128
|
+
if (c && m)
|
|
129
|
+
h(e);
|
|
130
|
+
else if (!c && !m) {
|
|
131
|
+
const u = p.has(e) ? p.get(e) : d.emptyStates.find((r) => g(e, r));
|
|
132
|
+
if (p.set(e, u), !u) return;
|
|
133
|
+
e.views.forEach((r) => {
|
|
134
|
+
const I = u.render({
|
|
135
|
+
editor: t,
|
|
136
|
+
component: e,
|
|
137
|
+
componentView: r,
|
|
133
138
|
mount: (v) => {
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
139
|
+
i.set(r, v), s.set(e, !0);
|
|
140
|
+
const N = r.getChildrenContainer();
|
|
141
|
+
N == null || N.appendChild(v);
|
|
137
142
|
},
|
|
138
|
-
unmount: () =>
|
|
143
|
+
unmount: () => l(r)
|
|
139
144
|
});
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const v =
|
|
145
|
+
o.set(r, () => {
|
|
146
|
+
I == null || I();
|
|
147
|
+
const v = i.get(r);
|
|
143
148
|
v == null || v.remove();
|
|
144
149
|
});
|
|
145
150
|
});
|
|
146
151
|
}
|
|
147
152
|
} finally {
|
|
148
|
-
|
|
153
|
+
f.delete(e);
|
|
149
154
|
}
|
|
150
|
-
}, E = (
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
editor:
|
|
157
|
-
licenseKey:
|
|
158
|
-
plan:
|
|
159
|
-
pluginName:
|
|
155
|
+
}, E = (e) => {
|
|
156
|
+
s.has(e) && h(e);
|
|
157
|
+
}, S = ({ model: e }) => {
|
|
158
|
+
n(e.getComponent());
|
|
159
|
+
}, y = t.Components.events, C = `${y.update}:components`, T = "component:mount", b = t.Canvas.events.frameLoadBody, A = y.removed;
|
|
160
|
+
t.on(C, n), t.on(T, n), t.on(A, E), t.on(b, S), H({
|
|
161
|
+
editor: t,
|
|
162
|
+
licenseKey: d.licenseKey,
|
|
163
|
+
plan: J,
|
|
164
|
+
pluginName: B,
|
|
160
165
|
cleanup: () => {
|
|
161
|
-
|
|
166
|
+
t.off(C, n), t.off(T, n), t.off(A, E), t.off(b, S);
|
|
162
167
|
}
|
|
163
168
|
});
|
|
164
|
-
},
|
|
169
|
+
}, Q = F(z);
|
|
165
170
|
export {
|
|
166
|
-
|
|
171
|
+
Q as default
|
|
167
172
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_canvasEmptyState=g())})(this,function(){"use strict";const y="app.grapesjs.com",g="app-stage.grapesjs.com",
|
|
1
|
+
(function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_canvasEmptyState=g())})(this,function(){"use strict";const y="app.grapesjs.com",g="app-stage.grapesjs.com",P=[y,"app2.grapesjs.com",g,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],_="license:check:start",W="license:check:end",O=()=>typeof window<"u",$=({isDev:t,isStage:a,isPlatform:o})=>`${t?"":`https://${a?g:y}`}/${o?"platform-api":"api"}`,L=()=>{const t=O()&&window.location.hostname;return!!t&&(P.includes(t)||P.some(a=>t.endsWith(a)))};function j(t){return typeof t=="function"}async function G({path:t,baseApiUrl:a,method:o="GET",headers:i={},params:s,body:f}){const p=`${a||$({isDev:!1,isStage:!1})}${t}`,w={method:o,headers:{"Content-Type":"application/json",...i}};f&&(w.body=JSON.stringify(f));const l=s?new URLSearchParams(s).toString():"",h=l?`?${l}`:"",n=await fetch(`${p}${h}`,w);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{});const U={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function K(t){const a=t;return a.init=o=>i=>t(i,o),a}const k=t=>K(t);async function x({editor:t,plan:a,pluginName:o,licenseKey:i,onLicenseCheckResponse:s,cleanup:f}){let d="",p=!1;const w=L(),l=n=>{console.warn("Cleanup plugin:",o,"Reason:",n),f()},h=(n={})=>{var A;const{error:T,sdkLicense:b}=n,E=(A=n.plan)==null?void 0:A.category;if(!(b||n.license)||T)l(T||"Invalid license");else if(E){const I=U[a],N=U[E];I>N&&l({pluginRequiredPlan:a,licensePlan:E})}};t.on(_,n=>{d=n==null?void 0:n.baseApiUrl,p=!0}),t.on(W,n=>{s==null||s(n),h(n)}),setTimeout(async()=>{if(!p){if(w)return;if(i){const n=await F({licenseKey:i,pluginName:o,baseApiUrl:d});s==null||s(n),n&&h(n)}else l("The `licenseKey` option not provided")}},2e3)}async function F(t){const{licenseKey:a,pluginName:o,baseApiUrl:i}=t;try{return(await G({baseApiUrl:i,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const H="canvasEmptyState",q=v.startup;return k(function(t,a={}){const o=new WeakMap,i=new WeakMap,s=new WeakMap,f=new Set,d=new WeakMap,p={emptyStates:[],...a},w=(e,c)=>{let m=!1;const{isValid:u}=c;return Array.isArray(u)?m=u.some(r=>e.is(r)):j(u)?m=u({component:e,editor:t}):m=e.is(u),m},l=e=>{const c=o.get(e);o.delete(e),c==null||c()},h=e=>{e.views.forEach(c=>l(c)),s.delete(e)},n=e=>{if(!(!e||f.has(e)))try{f.add(e);const c=e.components().length>0,m=s.get(e);if(c&&m)h(e);else if(!c&&!m){const u=d.has(e)?d.get(e):p.emptyStates.find(r=>w(e,r));if(d.set(e,u),!u)return;e.views.forEach(r=>{const M=u.render({editor:t,component:e,componentView:r,mount:S=>{i.set(r,S),s.set(e,!0);const C=r.getChildrenContainer();C==null||C.appendChild(S)},unmount:()=>l(r)});o.set(r,()=>{M==null||M();const S=i.get(r);S==null||S.remove()})})}}finally{f.delete(e)}},T=e=>{s.has(e)&&h(e)},b=({model:e})=>{n(e.getComponent())},E=t.Components.events,D=`${E.update}:components`,A="component:mount",I=t.Canvas.events.frameLoadBody,N=E.removed;t.on(D,n),t.on(A,n),t.on(N,T),t.on(I,b),x({editor:t,licenseKey:p.licenseKey,plan:q,pluginName:H,cleanup:()=>{t.off(D,n),t.off(A,n),t.off(N,T),t.off(I,b)}})})});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";function
|
|
2
|
-
.gjs-frame-wrapper { transition: width ${
|
|
3
|
-
.gjs-frame-wrapper__bottom { height: ${
|
|
4
|
-
.gjs-frame { border-radius: ${
|
|
5
|
-
`,!p&&document.body.appendChild(f)};
|
|
1
|
+
"use strict";function Y(t,i,e){let a,s,r,m,c;const d=i;function l(){const o=Date.now()-m;o<d&&o>=0?a=setTimeout(l,d-o):(a=null,c=t.apply(r,s),r=s=null)}const h=function(){return r=this,s=arguments,m=Date.now(),a||(a=setTimeout(l,d)),c};return h.clear=function(){a&&(clearTimeout(a),a=null)},h.flush=function(){a&&(c=t.apply(r,s),r=s=null,clearTimeout(a),a=null)},h}const L="app.grapesjs.com",F="app-stage.grapesjs.com",k="app2.grapesjs.com",J="app-stage2.grapesjs.com",O=[L,k,F,J,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Q="license:check:start",tt="license:check:end",et=()=>typeof window<"u",nt=({isDev:t,isStage:i,isPlatform:e})=>`${t?"":`https://${i?F:L}`}/${e?"platform-api":"api"}`,st=()=>{const t=et()&&window.location.hostname;return!!t&&(O.includes(t)||O.some(i=>t.endsWith(i)))};async function ot({path:t,baseApiUrl:i,method:e="GET",headers:a={},params:s,body:r}){const c=`${i||nt({isDev:!1,isStage:!1})}${t}`,d={method:e,headers:{"Content-Type":"application/json",...a}};r&&(d.body=JSON.stringify(r));const l=s?new URLSearchParams(s).toString():"",h=l?`?${l}`:"",o=await fetch(`${c}${h}`,d);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{});const U={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function at(t){const i=t;return i.init=e=>a=>t(a,e),i}const it=t=>at(t);async function rt({editor:t,plan:i,pluginName:e,licenseKey:a,onLicenseCheckResponse:s,cleanup:r}){let m="",c=!1;const d=st(),l=o=>{console.warn("Cleanup plugin:",e,"Reason:",o),r()},h=(o={})=>{var b;const{error:g,sdkLicense:E}=o,w=(b=o.plan)==null?void 0:b.category;if(!(E||o.license)||g)l(g||"Invalid license");else if(w){const T=U[i],x=U[w];T>x&&l({pluginRequiredPlan:i,licensePlan:w})}};t.on(Q,o=>{m=o==null?void 0:o.baseApiUrl,c=!0}),t.on(tt,o=>{s==null||s(o),h(o)}),setTimeout(async()=>{if(!c){if(d)return;if(a){const o=await ct({licenseKey:a,pluginName:e,baseApiUrl:m});s==null||s(o),o&&h(o)}else l("The `licenseKey` option not provided")}},2e3)}async function ct(t){const{licenseKey:i,pluginName:e,baseApiUrl:a}=t;try{return(await ot({baseApiUrl:a,path:`/sdk/${i||"na"}`,method:"POST",params:{d:window.location.hostname,pn:e}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const W="data-gs-plg-",z="canvasFullSize",lt=v.startup,ut=(t,i)=>{const{rule:e,ruleView:a}=i,{style:s}=e.attributes;if(s&&s[t]){const r=s[t],m=/([0-9.]+)(vh|dvh|lvh|svh)/g,c=m.test(r),d=a.frameView.model;if(c&&d.hasAutoHeight()){const l=r.replace(m,(o,g)=>`${window.innerHeight*(parseFloat(g)/100)}px`),h=e.toCSS({style:{...s,[t]:l}});i.css=h}}},pt=t=>{["height","min-height","max-height"].forEach(i=>ut(i,t))},mt=function(t,i={}){const{Canvas:e,Commands:a,Devices:s,Css:r}=t,m={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...i},{canvasOffsetY:c,canvasOffsetX:d,canvasTransition:l,deviceMaxWidth:h,deviceMinHeigth:o,deviceFixedHeight:g,frameBorderRadius:E,frameTransition:w}=m,y=`${o}px`,b=e.events,T="core:preview",x=`${a.events.stopCommand}${T}`,H=e.getConfig(),_=`${z}:disable`,K=s.getAll().map(n=>({...n.attributes})),G=l*1e3,M={x:d,y:c};let S={},P,$;H.scrollableCanvas=!g,s.getAll().map(n=>{!n.get("width")&&n.set("width",`${h}px`),!n.get("height")&&n.set("height",g?"100vh":"auto"),!n.get("minHeight")&&n.set("minHeight",y)});const V=n=>{const u=`${W}canvas-full-size`,p=document.querySelector(`style[${u}]`);if(n&&p)return p.remove();const f=p||document.createElement("style"),D=e.getZoomMultiplier();f.setAttribute(u,"true"),f.innerHTML=`
|
|
2
|
+
.gjs-frame-wrapper { transition: width ${w}s !important; }
|
|
3
|
+
.gjs-frame-wrapper__bottom { height: ${c*D}px }
|
|
4
|
+
.gjs-frame { border-radius: ${E}px }
|
|
5
|
+
`,!p&&document.body.appendChild(f)};t.on(b.frameLoadHead,n=>{if(!H.scrollableCanvas)return;const{window:u}=n,p=u.document,f=p.head,D=`${W}canvas-full-size-wrappers`,C=f.querySelector(`style[${D}]`)||p.createElement("style");C.setAttribute(D,"true"),C.innerHTML=`
|
|
6
6
|
body { height: auto !important; }
|
|
7
|
-
[data-gjs-type="wrapper"] { min-height: ${
|
|
8
|
-
[data-gjs-type="mjml"] { min-height: ${
|
|
9
|
-
[data-gjs-type="mj-body"] { min-height: ${
|
|
10
|
-
`,!f.contains(
|
|
7
|
+
[data-gjs-type="wrapper"] { min-height: ${y} !important; }
|
|
8
|
+
[data-gjs-type="mjml"] { min-height: ${y} !important; }
|
|
9
|
+
[data-gjs-type="mj-body"] { min-height: ${y} !important; }
|
|
10
|
+
`,!f.contains(C)&&f.appendChild(C)});const j=()=>P.style.display="none",R=()=>P.style.display="",Z=()=>{var f;if(!g)return;const n=e.getZoomMultiplier(),p=e.getRect().height*n-c*2;(f=s.getSelected())==null||f.set("height",`${Math.max(p,o)}px`),e.fitViewport({zoom:e.getZoom(),gap:M})},A=Y(()=>{e.fitViewport({zoom:n=>n>100?100:n,ignoreHeight:!0,gap:M}),Z(),V(),setTimeout(()=>{var u,p;const{em:n}=t;n.destroyed||((p=(u=t.getSelected())==null?void 0:u.getEl())==null||p.scrollIntoView({block:"nearest"}),t.refresh({tools:!0}),R(),a.isActive(T)?n.stopDefault():n.runDefault())},G)},100),q=(n={})=>{n.options&&n.options.from!=="fitViewport"&&e.fitViewport({zoom:e.getZoom(),ignoreHeight:!0,gap:M})},B=()=>{j(),A()},X=()=>{S.overflowX="hidden",S.overflowY="auto"},I=()=>{$==null||$.disconnect(),A.clear()},N=[[s.events.select,B],[b.zoom,q],[x,X],[t.events.destroy,I],[r.events.mountBefore,pt]];a.add(_,()=>{s.devices.reset(K),H.scrollableCanvas=!1,e.getModel().updateDevice(),e.setZoom(100),e.setCoords(0,0),S.overflowY="hidden",V(!0),N.forEach(([n,u])=>t.off(n,u)),I(),a.run("studio:canvasReload")}),N.forEach(([n,u])=>t.on(n,u)),t.onReady(()=>{const n=e.getElement(),u=e.getFramesEl(),p=e.getCanvasView();P=e.getSpotsEl(),S=n.style,S.overflowX="hidden",u.style.transition=`transform ${l}s`,document.removeEventListener("keypress",p.onKeyPress),V(),$=new ResizeObserver(()=>{j(),A()}),$.observe(n.parentElement),A()}),rt({editor:t,licenseKey:m.licenseKey,plan:lt,pluginName:z,cleanup:()=>{t.runCommand(_)}})},dt=it(mt);module.exports=dt;
|