@grapesjs/studio-sdk-plugins 1.0.14 → 1.0.15-rc.1

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 (65) hide show
  1. package/dist/accordionComponent/components/Accordion.d.ts +4 -0
  2. package/dist/accordionComponent/components/AccordionContent.d.ts +3 -0
  3. package/dist/accordionComponent/components/AccordionGroup.d.ts +4 -0
  4. package/dist/accordionComponent/components/AccordionHeader.d.ts +4 -0
  5. package/dist/accordionComponent/components/AccordionMarker.d.ts +3 -0
  6. package/dist/accordionComponent/index.cjs.d.ts +3 -0
  7. package/dist/accordionComponent/index.cjs.js +39 -0
  8. package/dist/accordionComponent/index.d.ts +3 -0
  9. package/dist/accordionComponent/index.es.d.ts +3 -0
  10. package/dist/accordionComponent/index.es.js +360 -0
  11. package/dist/accordionComponent/index.umd.js +39 -0
  12. package/dist/accordionComponent/types.d.ts +6 -0
  13. package/dist/accordionComponent/typesSchema.d.ts +22 -0
  14. package/dist/accordionComponent/utils.d.ts +22 -0
  15. package/dist/canvasEmptyState/index.cjs.js +1 -1
  16. package/dist/canvasEmptyState/index.es.js +15 -15
  17. package/dist/canvasEmptyState/index.umd.js +1 -1
  18. package/dist/canvasFullSize/index.cjs.js +5 -5
  19. package/dist/canvasFullSize/index.es.js +138 -118
  20. package/dist/canvasFullSize/index.umd.js +5 -5
  21. package/dist/canvasFullSize/typesSchema.d.ts +12 -8
  22. package/dist/flexComponent/blocks.d.ts +3 -0
  23. package/dist/flexComponent/components/FlexColumn.d.ts +4 -0
  24. package/dist/flexComponent/components/FlexRow.d.ts +4 -0
  25. package/dist/flexComponent/handlers.d.ts +19 -0
  26. package/dist/flexComponent/index.cjs.d.ts +3 -0
  27. package/dist/flexComponent/index.cjs.js +33 -0
  28. package/dist/flexComponent/index.d.ts +3 -0
  29. package/dist/flexComponent/index.es.d.ts +3 -0
  30. package/dist/flexComponent/index.es.js +715 -0
  31. package/dist/flexComponent/index.umd.js +33 -0
  32. package/dist/flexComponent/resizeDecorator.d.ts +50 -0
  33. package/dist/flexComponent/spots.d.ts +3 -0
  34. package/dist/flexComponent/types.d.ts +32 -0
  35. package/dist/flexComponent/typesSchema.d.ts +112 -0
  36. package/dist/flexComponent/utils.d.ts +63 -0
  37. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  38. package/dist/googleFontsAssetProvider/index.es.js +128 -91
  39. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  40. package/dist/googleFontsAssetProvider/types.d.ts +7 -2
  41. package/dist/googleFontsAssetProvider/utils.d.ts +5 -0
  42. package/dist/iconifyComponent/index.cjs.js +2 -2
  43. package/dist/iconifyComponent/index.es.js +39 -39
  44. package/dist/iconifyComponent/index.umd.js +2 -2
  45. package/dist/index.cjs.d.ts +2 -0
  46. package/dist/index.cjs.js +105 -35
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.es.d.ts +2 -0
  49. package/dist/index.es.js +6286 -5366
  50. package/dist/index.umd.js +105 -35
  51. package/dist/prosemirror/index.cjs.js +1 -1
  52. package/dist/prosemirror/index.es.js +1 -1
  53. package/dist/prosemirror/index.umd.js +1 -1
  54. package/dist/rteTinyMce/index.cjs.js +1 -1
  55. package/dist/rteTinyMce/index.es.js +28 -28
  56. package/dist/rteTinyMce/index.umd.js +1 -1
  57. package/dist/tableComponent/index.cjs.js +1 -1
  58. package/dist/tableComponent/index.es.js +31 -30
  59. package/dist/tableComponent/index.umd.js +1 -1
  60. package/dist/types.d.ts +3 -1
  61. package/dist/utils.d.ts +4 -0
  62. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  63. package/dist/youtubeAssetProvider/index.es.js +11 -11
  64. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  65. package/package.json +2 -2
@@ -25,7 +25,7 @@ async function K({
25
25
  params: i,
26
26
  body: u
27
27
  }) {
28
- const v = `${t || P({ isDev: !1, isStage: !1 })}${e}`, p = {
28
+ const y = `${t || P({ isDev: !1, isStage: !1 })}${e}`, p = {
29
29
  method: a,
30
30
  headers: {
31
31
  "Content-Type": "application/json",
@@ -33,7 +33,7 @@ async function K({
33
33
  }
34
34
  };
35
35
  u && (p.body = JSON.stringify(u));
36
- const d = i ? new URLSearchParams(i).toString() : "", s = d ? `?${d}` : "", c = await fetch(`${v}${s}`, p);
36
+ const d = i ? new URLSearchParams(i).toString() : "", s = d ? `?${d}` : "", c = await fetch(`${y}${s}`, p);
37
37
  if (!c.ok)
38
38
  throw new Error(`HTTP error! status: ${c.status}`);
39
39
  return c.json();
@@ -58,16 +58,16 @@ async function x({
58
58
  cleanup: i
59
59
  }) {
60
60
  let u = "", h = !1;
61
- const v = R(), p = (s) => {
61
+ const y = R(), p = (s) => {
62
62
  console.warn("Cleanup plugin:", a, "Reason:", s), i();
63
63
  }, d = (s = {}) => {
64
64
  var C;
65
- const { error: c, sdkLicense: E } = s, y = (C = s.plan) == null ? void 0 : C.category;
65
+ const { error: c, sdkLicense: E } = s, v = (C = s.plan) == null ? void 0 : C.category;
66
66
  if (!(E || s.license) || c)
67
67
  p(c || "Invalid license");
68
- else if (y) {
69
- const b = A[t], L = A[y];
70
- b > L && p({ pluginRequiredPlan: t, licensePlan: y });
68
+ else if (v) {
69
+ const T = A[t], b = A[v];
70
+ T > b && p({ pluginRequiredPlan: t, licensePlan: v });
71
71
  }
72
72
  };
73
73
  e.on($, (s) => {
@@ -76,7 +76,7 @@ async function x({
76
76
  d(s);
77
77
  }), setTimeout(async () => {
78
78
  if (!h) {
79
- if (v) return;
79
+ if (y) return;
80
80
  if (o) {
81
81
  const s = await F({ licenseKey: o, pluginName: a, baseApiUrl: u });
82
82
  s && d(s);
@@ -102,7 +102,7 @@ async function F(e) {
102
102
  }
103
103
  }
104
104
  const G = "canvasEmptyState", H = function(e, t = {}) {
105
- const a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new WeakMap(), v = {
105
+ const a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new WeakMap(), y = {
106
106
  emptyStates: [],
107
107
  ...t
108
108
  }, p = (n, r) => {
@@ -122,7 +122,7 @@ const G = "canvasEmptyState", H = function(e, t = {}) {
122
122
  if (r && m)
123
123
  s(n);
124
124
  else if (!r && !m) {
125
- const f = h.has(n) ? h.get(n) : v.emptyStates.find((l) => p(n, l));
125
+ const f = h.has(n) ? h.get(n) : y.emptyStates.find((l) => p(n, l));
126
126
  if (h.set(n, f), !f) return;
127
127
  n.views.forEach((l) => {
128
128
  const S = f.render({
@@ -148,16 +148,16 @@ const G = "canvasEmptyState", H = function(e, t = {}) {
148
148
  }
149
149
  }, E = (n) => {
150
150
  i.has(n) && s(n);
151
- }, y = ({ model: n }) => {
151
+ }, v = ({ model: n }) => {
152
152
  c(n.getComponent());
153
- }, T = e.Components.events, C = `${T.update}:components`, b = "component:mount", L = e.Canvas.events.frameLoadBody, U = T.removed || T.remove;
154
- e.on(C, c), e.on(b, c), e.on(U, E), e.on(L, y), x({
153
+ }, L = e.Components.events, C = `${L.update}:components`, T = "component:mount", b = e.Canvas.events.frameLoadBody, U = L.removed;
154
+ e.on(C, c), e.on(T, c), e.on(U, E), e.on(b, v), x({
155
155
  editor: e,
156
- licenseKey: v.licenseKey,
156
+ licenseKey: y.licenseKey,
157
157
  plan: w.startup,
158
158
  pluginName: G,
159
159
  cleanup: () => {
160
- e.off(C, c), e.off(b, c), e.off(U, E), e.off(L, y);
160
+ e.off(C, c), e.off(T, c), e.off(U, E), e.off(b, v);
161
161
  }
162
162
  });
163
163
  }, B = j(H);
@@ -1 +1 @@
1
- (function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],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",A=[y,g,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],$="license:check:start",N="license:check:end",P=()=>typeof window<"u",D=({isDev:e,isStage:t})=>`${e?"":`https://${t?g:y}`}/api`,_=()=>{const e=P()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(t=>e.endsWith(t)))};function j(e){return typeof e=="function"}async function R({path:e,baseApiUrl:t,method:o="GET",headers:a={},params:i,body:u}){const w=`${t||D({isDev:!1,isStage:!1})}${e}`,p={method:o,headers:{"Content-Type":"application/json",...a}};u&&(p.body=JSON.stringify(u));const d=i?new URLSearchParams(i).toString():"",s=d?`?${d}`:"",c=await fetch(`${w}${s}`,p);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{});const I={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function K(e){const t=e;return t.init=o=>a=>e(a,o),t}const x=e=>K(e);async function O({editor:e,plan:t,pluginName:o,licenseKey:a,cleanup:i}){let u="",h=!1;const w=_(),p=s=>{console.warn("Cleanup plugin:",o,"Reason:",s),i()},d=(s={})=>{var S;const{error:c,sdkLicense:T}=s,C=(S=s.plan)==null?void 0:S.category;if(!(T||s.license)||c)p(c||"Invalid license");else if(C){const L=I[t],k=I[C];L>k&&p({pluginRequiredPlan:t,licensePlan:C})}};e.on($,s=>{u=s==null?void 0:s.baseApiUrl,h=!0}),e.on(N,s=>{d(s)}),setTimeout(async()=>{if(!h){if(w)return;if(a){const s=await q({licenseKey:a,pluginName:o,baseApiUrl:u});s&&d(s)}else p("The `licenseKey` option not provided")}},2e3)}async function q(e){const{licenseKey:t,pluginName:o,baseApiUrl:a}=e;try{return(await R({baseApiUrl:a,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const F="canvasEmptyState";return x(function(e,t={}){const o=new WeakMap,a=new WeakMap,i=new WeakMap,u=new Set,h=new WeakMap,w={emptyStates:[],...t},p=(n,r)=>{let m=!1;const{isValid:f}=r;return Array.isArray(f)?m=f.some(l=>n.is(l)):j(f)?m=f({component:n,editor:e}):m=n.is(f),m},d=n=>{const r=o.get(n);o.delete(n),r==null||r()},s=n=>{n.views.forEach(r=>d(r)),i.delete(n)},c=n=>{if(!(!n||u.has(n)))try{u.add(n);const r=n.components().length>0,m=i.get(n);if(r&&m)s(n);else if(!r&&!m){const f=h.has(n)?h.get(n):w.emptyStates.find(l=>p(n,l));if(h.set(n,f),!f)return;n.views.forEach(l=>{const U=f.render({editor:e,component:n,componentView:l,mount:E=>{a.set(l,E),i.set(n,!0);const W=l.getChildrenContainer();W==null||W.appendChild(E)},unmount:()=>d(l)});o.set(l,()=>{U==null||U();const E=a.get(l);E==null||E.remove()})})}}finally{u.delete(n)}},T=n=>{i.has(n)&&s(n)},C=({model:n})=>{c(n.getComponent())},b=e.Components.events,S=`${b.update}:components`,L="component:mount",k=e.Canvas.events.frameLoadBody,M=b.removed||b.remove;e.on(S,c),e.on(L,c),e.on(M,T),e.on(k,C),O({editor:e,licenseKey:w.licenseKey,plan:v.startup,pluginName:F,cleanup:()=>{e.off(S,c),e.off(L,c),e.off(M,T),e.off(k,C)}})})});
1
+ (function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],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",A=[y,g,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],$="license:check:start",N="license:check:end",P=()=>typeof window<"u",D=({isDev:e,isStage:t})=>`${e?"":`https://${t?g:y}`}/api`,_=()=>{const e=P()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(t=>e.endsWith(t)))};function j(e){return typeof e=="function"}async function R({path:e,baseApiUrl:t,method:o="GET",headers:a={},params:i,body:u}){const w=`${t||D({isDev:!1,isStage:!1})}${e}`,p={method:o,headers:{"Content-Type":"application/json",...a}};u&&(p.body=JSON.stringify(u));const d=i?new URLSearchParams(i).toString():"",s=d?`?${d}`:"",c=await fetch(`${w}${s}`,p);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{});const I={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function K(e){const t=e;return t.init=o=>a=>e(a,o),t}const x=e=>K(e);async function O({editor:e,plan:t,pluginName:o,licenseKey:a,cleanup:i}){let u="",h=!1;const w=_(),p=s=>{console.warn("Cleanup plugin:",o,"Reason:",s),i()},d=(s={})=>{var S;const{error:c,sdkLicense:T}=s,C=(S=s.plan)==null?void 0:S.category;if(!(T||s.license)||c)p(c||"Invalid license");else if(C){const b=I[t],L=I[C];b>L&&p({pluginRequiredPlan:t,licensePlan:C})}};e.on($,s=>{u=s==null?void 0:s.baseApiUrl,h=!0}),e.on(N,s=>{d(s)}),setTimeout(async()=>{if(!h){if(w)return;if(a){const s=await q({licenseKey:a,pluginName:o,baseApiUrl:u});s&&d(s)}else p("The `licenseKey` option not provided")}},2e3)}async function q(e){const{licenseKey:t,pluginName:o,baseApiUrl:a}=e;try{return(await R({baseApiUrl:a,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const F="canvasEmptyState";return x(function(e,t={}){const o=new WeakMap,a=new WeakMap,i=new WeakMap,u=new Set,h=new WeakMap,w={emptyStates:[],...t},p=(n,r)=>{let m=!1;const{isValid:f}=r;return Array.isArray(f)?m=f.some(l=>n.is(l)):j(f)?m=f({component:n,editor:e}):m=n.is(f),m},d=n=>{const r=o.get(n);o.delete(n),r==null||r()},s=n=>{n.views.forEach(r=>d(r)),i.delete(n)},c=n=>{if(!(!n||u.has(n)))try{u.add(n);const r=n.components().length>0,m=i.get(n);if(r&&m)s(n);else if(!r&&!m){const f=h.has(n)?h.get(n):w.emptyStates.find(l=>p(n,l));if(h.set(n,f),!f)return;n.views.forEach(l=>{const U=f.render({editor:e,component:n,componentView:l,mount:E=>{a.set(l,E),i.set(n,!0);const W=l.getChildrenContainer();W==null||W.appendChild(E)},unmount:()=>d(l)});o.set(l,()=>{U==null||U();const E=a.get(l);E==null||E.remove()})})}}finally{u.delete(n)}},T=n=>{i.has(n)&&s(n)},C=({model:n})=>{c(n.getComponent())},k=e.Components.events,S=`${k.update}:components`,b="component:mount",L=e.Canvas.events.frameLoadBody,M=k.removed;e.on(S,c),e.on(b,c),e.on(M,T),e.on(L,C),O({editor:e,licenseKey:w.licenseKey,plan:v.startup,pluginName:F,cleanup:()=>{e.off(S,c),e.off(b,c),e.off(M,T),e.off(L,C)}})})});
@@ -1,5 +1,5 @@
1
- "use strict";require("grapesjs");function L(e,o,s){let t,i,a,f,m;const l=o;function p(){const r=Date.now()-f;r<l&&r>=0?t=setTimeout(p,l-r):(t=null,m=e.apply(a,i),a=i=null)}const n=function(){return a=this,i=arguments,f=Date.now(),t||(t=setTimeout(p,l)),m};return n.clear=function(){t&&(clearTimeout(t),t=null)},n.flush=function(){t&&(m=e.apply(a,i),a=i=null,clearTimeout(t),t=null)},n}const $="app.grapesjs.com",D="app-stage.grapesjs.com",C=[$,D,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",x="license:check:end",A=()=>typeof window<"u",I=({isDev:e,isStage:o})=>`${e?"":`https://${o?D:$}`}/api`,k=()=>{const e=A()&&window.location.hostname;return!!e&&(C.includes(e)||C.some(o=>e.endsWith(o)))};async function H({path:e,baseApiUrl:o,method:s="GET",headers:t={},params:i,body:a}){const m=`${o||I({isDev:!1,isStage:!1})}${e}`,l={method:s,headers:{"Content-Type":"application/json",...t}};a&&(l.body=JSON.stringify(a));const p=i?new URLSearchParams(i).toString():"",n=p?`?${p}`:"",r=await fetch(`${m}${n}`,l);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{});const S={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function M(e){const o=e;return o.init=s=>t=>e(t,s),o}const N=e=>M(e);async function U({editor:e,plan:o,pluginName:s,licenseKey:t,cleanup:i}){let a="",f=!1;const m=k(),l=n=>{console.warn("Cleanup plugin:",s,"Reason:",n),i()},p=(n={})=>{var d;const{error:r,sdkLicense:c}=n,u=(d=n.plan)==null?void 0:d.category;if(!(c||n.license)||r)l(r||"Invalid license");else if(u){const b=S[o],g=S[u];b>g&&l({pluginRequiredPlan:o,licensePlan:u})}};e.on(O,n=>{a=n==null?void 0:n.baseApiUrl,f=!0}),e.on(x,n=>{p(n)}),setTimeout(async()=>{if(!f){if(m)return;if(t){const n=await W({licenseKey:t,pluginName:s,baseApiUrl:a});n&&p(n)}else l("The `licenseKey` option not provided")}},2e3)}async function W(e){const{licenseKey:o,pluginName:s,baseApiUrl:t}=e;try{return(await H({baseApiUrl:t,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const R="canvasFullSize",_=function(e,o={}){const{Canvas:s,Commands:t}=e,i={deviceMaxWidth:1200,deviceMinHeigth:500,deviceBorderRadius:5,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,...o},{canvasOffsetY:a,canvasOffsetX:f,canvasTransition:m,deviceMaxWidth:l,deviceMinHeigth:p,deviceBorderRadius:n}=i;s.getConfig().scrollableCanvas=!0,e.Devices.getAll().map(c=>{!c.get("width")&&c.set("width",`${l}px`),!c.get("height")&&c.set("height","auto"),!c.get("minHeight")&&c.set("minHeight",`${p}px`)});const r=()=>{const c="data-gs-plg-full-size",u=document.querySelector(`style[${c}]`),h=u||document.createElement("style"),d=s.getZoomMultiplier();h.setAttribute(c,"true"),h.innerHTML=`
2
- .gjs-frame-wrapper { transition: none !important; }
3
- .gjs-frame-wrapper__bottom { height: ${a*d}px }
4
- .gjs-frame { border-radius: ${n}px }
5
- `,!u&&document.body.appendChild(h)};e.onReady(()=>{const c=s.getSpotsEl(),u=s.getElement(),h=s.getFramesEl();u.style.overflowX="hidden",h.style.transition=`transform ${m}s`,r();const d=()=>c.style.display="none",b=()=>c.style.display="",g=L(()=>{const v={x:f,y:a};s.getCanvasView().clearOff(),s.fitViewport({zoom:y=>y>100?100:y,ignoreHeight:!0,gap:v}),r(),setTimeout(()=>{var y,T;e.em.destroyed||((T=(y=e.getSelected())==null?void 0:y.getEl())==null||T.scrollIntoView({block:"nearest"}),e.refresh({tools:!0}),b())},310)},100),E=new ResizeObserver(()=>{d(),g()});E.observe(u.parentElement),e.on(e.Devices.events.select,()=>{d(),g()}),e.on(s.events.zoom,(v={})=>{v.options&&v.options.from!=="fitViewport"&&s.fitViewport({zoom:s.getZoom(),ignoreHeight:!0,gap:{x:f,y:a}})}),e.on(`${t.events.stopCommand}core:preview`,()=>{u.style.overflowX="hidden",u.style.overflowY="auto"}),e.on(e.events.destroy,()=>{E.disconnect(),g.clear()}),g()}),U({editor:e,licenseKey:i.licenseKey,plan:w.startup,pluginName:R,cleanup:()=>{}})},z=N(_);module.exports=z;
1
+ "use strict";require("grapesjs");function j(e,a,n){let t,o,c,p,d;const r=a;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,d=e.apply(c,o),c=o=null)}const s=function(){return c=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),d};return s.clear=function(){t&&(clearTimeout(t),t=null)},s.flush=function(){t&&(d=e.apply(c,o),c=o=null,clearTimeout(t),t=null)},s}const R="app.grapesjs.com",U="app-stage.grapesjs.com",k=[R,U,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],K="license:check:start",q="license:check:end",F=()=>typeof window<"u",V=({isDev:e,isStage:a})=>`${e?"":`https://${a?U:R}`}/api`,X=()=>{const e=F()&&window.location.hostname;return!!e&&(k.includes(e)||k.some(a=>e.endsWith(a)))};async function Y({path:e,baseApiUrl:a,method:n="GET",headers:t={},params:o,body:c}){const d=`${a||V({isDev:!1,isStage:!1})}${e}`,r={method:n,headers:{"Content-Type":"application/json",...t}};c&&(r.body=JSON.stringify(c));const u=o?new URLSearchParams(o).toString():"",s=u?`?${u}`:"",l=await fetch(`${d}${s}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}var b=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(b||{});const z={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function B(e){const a=e;return a.init=n=>t=>e(t,n),a}const G=e=>B(e);async function Z({editor:e,plan:a,pluginName:n,licenseKey:t,cleanup:o}){let c="",p=!1;const d=X(),r=s=>{console.warn("Cleanup plugin:",n,"Reason:",s),o()},u=(s={})=>{var C;const{error:l,sdkLicense:D}=s,y=(C=s.plan)==null?void 0:C.category;if(!(D||s.license)||l)r(l||"Invalid license");else if(y){const S=z[a],T=z[y];S>T&&r({pluginRequiredPlan:a,licensePlan:y})}};e.on(K,s=>{c=s==null?void 0:s.baseApiUrl,p=!0}),e.on(q,s=>{u(s)}),setTimeout(async()=>{if(!p){if(d)return;if(t){const s=await J({licenseKey:t,pluginName:n,baseApiUrl:c});s&&u(s)}else r("The `licenseKey` option not provided")}},2e3)}async function J(e){const{licenseKey:a,pluginName:n,baseApiUrl:t}=e;try{return(await Y({baseApiUrl:t,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const N="canvasFullSize",Q=function(e,a={}){const{Canvas:n,Commands:t,Devices:o}=e,c={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...a},{canvasOffsetY:p,canvasOffsetX:d,canvasTransition:r,deviceMaxWidth:u,deviceMinHeigth:s,frameBorderRadius:l,frameTransition:D}=c,y=`${s}px`,E=n.events,C=`${t.events.stopCommand}core:preview`,S=n.getConfig(),T=`${N}:disable`,P=o.getAll().map(i=>({...i.attributes}));S.scrollableCanvas=!0,o.getAll().map(i=>{!i.get("width")&&i.set("width",`${u}px`),!i.get("height")&&i.set("height","auto"),!i.get("minHeight")&&i.set("minHeight",y)});const L=i=>{const v="data-gs-plg-full-size",f=document.querySelector(`style[${v}]`);if(i&&f)return f.remove();const m=f||document.createElement("style"),h=n.getZoomMultiplier();m.setAttribute(v,"true"),m.innerHTML=`
2
+ .gjs-frame-wrapper { transition: width ${D}s !important; }
3
+ .gjs-frame-wrapper__bottom { height: ${p*h}px }
4
+ .gjs-frame { border-radius: ${l}px }
5
+ `,!f&&document.body.appendChild(m)};e.on(E.frameLoadHead,i=>{if(!S.scrollableCanvas)return;const{window:v}=i,f=v.document,m=f.head,h="data-gs-plg-wrapper-style",w=m.querySelector(`style[${h}]`)||f.createElement("style");w.setAttribute(h,"true"),w.innerHTML=`[data-gjs-type="wrapper"] { min-height: ${y}; }`,!m.contains(w)&&m.appendChild(w)}),e.onReady(()=>{const i=n.getSpotsEl(),v=n.getElement(),f=n.getFramesEl(),m=r*1e3,h=v.style;h.overflowX="hidden",f.style.transition=`transform ${r}s`;const w={x:d,y:p};L();const A=()=>i.style.display="none",_=()=>i.style.display="",$=j(()=>{n.fitViewport({zoom:g=>g>100?100:g,ignoreHeight:!0,gap:w}),L(),setTimeout(()=>{var g,W;e.em.destroyed||((W=(g=e.getSelected())==null?void 0:g.getEl())==null||W.scrollIntoView({block:"nearest"}),e.refresh({tools:!0}),_())},m)},100),H=new ResizeObserver(()=>{A(),$()});H.observe(v.parentElement);const M=()=>{A(),$()},O=(g={})=>{g.options&&g.options.from!=="fitViewport"&&n.fitViewport({zoom:n.getZoom(),ignoreHeight:!0,gap:w})},x=()=>{h.overflowX="hidden",h.overflowY="auto"},I=()=>{H.disconnect(),$.clear()};e.on(o.events.select,M),e.on(E.zoom,O),e.on(C,x),e.on(e.events.destroy,I),$(),t.add(T,()=>{o.devices.reset(P),S.scrollableCanvas=!1,n.getModel().updateDevice(),n.setZoom(100),n.setCoords(0,0),h.overflowY="hidden",L(!0),e.off(o.events.select,M),e.off(E.zoom,O),e.off(C,x),I(),t.run("studio:canvasReload")})}),Z({editor:e,licenseKey:c.licenseKey,plan:b.startup,pluginName:N,cleanup:()=>{e.runCommand(T)}})},ee=G(Q);module.exports=ee;
@@ -1,23 +1,23 @@
1
1
  import "grapesjs";
2
- function L(e, o, s) {
3
- let t, i, a, f, m;
4
- const l = o;
5
- function p() {
6
- const r = Date.now() - f;
7
- r < l && r >= 0 ? t = setTimeout(p, l - r) : (t = null, m = e.apply(a, i), a = i = null);
2
+ function j(e, a, n) {
3
+ let t, o, c, p, d;
4
+ const r = a;
5
+ function u() {
6
+ const l = Date.now() - p;
7
+ l < r && l >= 0 ? t = setTimeout(u, r - l) : (t = null, d = e.apply(c, o), c = o = null);
8
8
  }
9
- const n = function() {
10
- return a = this, i = arguments, f = Date.now(), t || (t = setTimeout(p, l)), m;
9
+ const s = function() {
10
+ return c = this, o = arguments, p = Date.now(), t || (t = setTimeout(u, r)), d;
11
11
  };
12
- return n.clear = function() {
12
+ return s.clear = function() {
13
13
  t && (clearTimeout(t), t = null);
14
- }, n.flush = function() {
15
- t && (m = e.apply(a, i), a = i = null, clearTimeout(t), t = null);
16
- }, n;
14
+ }, s.flush = function() {
15
+ t && (d = e.apply(c, o), c = o = null, clearTimeout(t), t = null);
16
+ }, s;
17
17
  }
18
- const $ = "app.grapesjs.com", D = "app-stage.grapesjs.com", C = [
19
- $,
20
- D,
18
+ const R = "app.grapesjs.com", U = "app-stage.grapesjs.com", k = [
19
+ R,
20
+ U,
21
21
  "localhost",
22
22
  "127.0.0.1",
23
23
  ".local-credentialless.webcontainer.io",
@@ -26,155 +26,175 @@ const $ = "app.grapesjs.com", D = "app-stage.grapesjs.com", C = [
26
26
  // For stackblitz.com demos
27
27
  "-sandpack.codesandbox.io"
28
28
  // For Sandpack demos
29
- ], O = "license:check:start", x = "license:check:end", A = () => typeof window < "u", I = ({ isDev: e, isStage: o }) => `${e ? "" : `https://${o ? D : $}`}/api`, k = () => {
30
- const e = A() && window.location.hostname;
31
- return !!e && (C.includes(e) || C.some((o) => e.endsWith(o)));
29
+ ], K = "license:check:start", F = "license:check:end", q = () => typeof window < "u", V = ({ isDev: e, isStage: a }) => `${e ? "" : `https://${a ? U : R}`}/api`, X = () => {
30
+ const e = q() && window.location.hostname;
31
+ return !!e && (k.includes(e) || k.some((a) => e.endsWith(a)));
32
32
  };
33
- async function H({
33
+ async function Y({
34
34
  path: e,
35
- baseApiUrl: o,
36
- method: s = "GET",
35
+ baseApiUrl: a,
36
+ method: n = "GET",
37
37
  headers: t = {},
38
- params: i,
39
- body: a
38
+ params: o,
39
+ body: c
40
40
  }) {
41
- const m = `${o || I({ isDev: !1, isStage: !1 })}${e}`, l = {
42
- method: s,
41
+ const d = `${a || V({ isDev: !1, isStage: !1 })}${e}`, r = {
42
+ method: n,
43
43
  headers: {
44
44
  "Content-Type": "application/json",
45
45
  ...t
46
46
  }
47
47
  };
48
- a && (l.body = JSON.stringify(a));
49
- const p = i ? new URLSearchParams(i).toString() : "", n = p ? `?${p}` : "", r = await fetch(`${m}${n}`, l);
50
- if (!r.ok)
51
- throw new Error(`HTTP error! status: ${r.status}`);
52
- return r.json();
48
+ c && (r.body = JSON.stringify(c));
49
+ const u = o ? new URLSearchParams(o).toString() : "", s = u ? `?${u}` : "", l = await fetch(`${d}${s}`, r);
50
+ if (!l.ok)
51
+ throw new Error(`HTTP error! status: ${l.status}`);
52
+ return l.json();
53
53
  }
54
- var w = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(w || {});
55
- const S = {
56
- [w.free]: 0,
57
- [w.startup]: 10,
58
- [w.business]: 20,
59
- [w.enterprise]: 30
54
+ var b = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(b || {});
55
+ const z = {
56
+ [b.free]: 0,
57
+ [b.startup]: 10,
58
+ [b.business]: 20,
59
+ [b.enterprise]: 30
60
60
  };
61
- function M(e) {
62
- const o = e;
63
- return o.init = (s) => (t) => e(t, s), o;
61
+ function B(e) {
62
+ const a = e;
63
+ return a.init = (n) => (t) => e(t, n), a;
64
64
  }
65
- const N = (e) => /* @__PURE__ */ M(e);
66
- async function U({
65
+ const G = (e) => /* @__PURE__ */ B(e);
66
+ async function Z({
67
67
  editor: e,
68
- plan: o,
69
- pluginName: s,
68
+ plan: a,
69
+ pluginName: n,
70
70
  licenseKey: t,
71
- cleanup: i
71
+ cleanup: o
72
72
  }) {
73
- let a = "", f = !1;
74
- const m = k(), l = (n) => {
75
- console.warn("Cleanup plugin:", s, "Reason:", n), i();
76
- }, p = (n = {}) => {
77
- var d;
78
- const { error: r, sdkLicense: c } = n, u = (d = n.plan) == null ? void 0 : d.category;
79
- if (!(c || n.license) || r)
80
- l(r || "Invalid license");
81
- else if (u) {
82
- const b = S[o], g = S[u];
83
- b > g && l({ pluginRequiredPlan: o, licensePlan: u });
73
+ let c = "", p = !1;
74
+ const d = X(), r = (s) => {
75
+ console.warn("Cleanup plugin:", n, "Reason:", s), o();
76
+ }, u = (s = {}) => {
77
+ var C;
78
+ const { error: l, sdkLicense: D } = s, y = (C = s.plan) == null ? void 0 : C.category;
79
+ if (!(D || s.license) || l)
80
+ r(l || "Invalid license");
81
+ else if (y) {
82
+ const S = z[a], T = z[y];
83
+ S > T && r({ pluginRequiredPlan: a, licensePlan: y });
84
84
  }
85
85
  };
86
- e.on(O, (n) => {
87
- a = n == null ? void 0 : n.baseApiUrl, f = !0;
88
- }), e.on(x, (n) => {
89
- p(n);
86
+ e.on(K, (s) => {
87
+ c = s == null ? void 0 : s.baseApiUrl, p = !0;
88
+ }), e.on(F, (s) => {
89
+ u(s);
90
90
  }), setTimeout(async () => {
91
- if (!f) {
92
- if (m) return;
91
+ if (!p) {
92
+ if (d) return;
93
93
  if (t) {
94
- const n = await W({ licenseKey: t, pluginName: s, baseApiUrl: a });
95
- n && p(n);
94
+ const s = await J({ licenseKey: t, pluginName: n, baseApiUrl: c });
95
+ s && u(s);
96
96
  } else
97
- l("The `licenseKey` option not provided");
97
+ r("The `licenseKey` option not provided");
98
98
  }
99
99
  }, 2e3);
100
100
  }
101
- async function W(e) {
102
- const { licenseKey: o, pluginName: s, baseApiUrl: t } = e;
101
+ async function J(e) {
102
+ const { licenseKey: a, pluginName: n, baseApiUrl: t } = e;
103
103
  try {
104
- return (await H({
104
+ return (await Y({
105
105
  baseApiUrl: t,
106
- path: `/sdk/${o || "na"}`,
106
+ path: `/sdk/${a || "na"}`,
107
107
  method: "POST",
108
108
  params: {
109
109
  d: window.location.hostname,
110
- pn: s
110
+ pn: n
111
111
  }
112
112
  })).result || {};
113
- } catch (i) {
114
- return console.error("Error during SDK license check:", i), !1;
113
+ } catch (o) {
114
+ return console.error("Error during SDK license check:", o), !1;
115
115
  }
116
116
  }
117
- const R = "canvasFullSize", _ = function(e, o = {}) {
118
- const { Canvas: s, Commands: t } = e, i = {
117
+ const N = "canvasFullSize", Q = function(e, a = {}) {
118
+ const { Canvas: n, Commands: t, Devices: o } = e, c = {
119
119
  deviceMaxWidth: 1200,
120
120
  deviceMinHeigth: 500,
121
- deviceBorderRadius: 5,
122
121
  canvasOffsetY: 30,
123
122
  canvasOffsetX: 50,
124
123
  canvasTransition: 0.3,
125
- ...o
126
- }, { canvasOffsetY: a, canvasOffsetX: f, canvasTransition: m, deviceMaxWidth: l, deviceMinHeigth: p, deviceBorderRadius: n } = i;
127
- s.getConfig().scrollableCanvas = !0, e.Devices.getAll().map((c) => {
128
- !c.get("width") && c.set("width", `${l}px`), !c.get("height") && c.set("height", "auto"), !c.get("minHeight") && c.set("minHeight", `${p}px`);
124
+ frameBorderRadius: 5,
125
+ frameTransition: 0.3,
126
+ ...a
127
+ }, {
128
+ canvasOffsetY: p,
129
+ canvasOffsetX: d,
130
+ canvasTransition: r,
131
+ deviceMaxWidth: u,
132
+ deviceMinHeigth: s,
133
+ frameBorderRadius: l,
134
+ frameTransition: D
135
+ } = c, y = `${s}px`, E = n.events, C = `${t.events.stopCommand}core:preview`, S = n.getConfig(), T = `${N}:disable`, P = o.getAll().map((i) => ({ ...i.attributes }));
136
+ S.scrollableCanvas = !0, o.getAll().map((i) => {
137
+ !i.get("width") && i.set("width", `${u}px`), !i.get("height") && i.set("height", "auto"), !i.get("minHeight") && i.set("minHeight", y);
129
138
  });
130
- const r = () => {
131
- const c = "data-gs-plg-full-size", u = document.querySelector(`style[${c}]`), h = u || document.createElement("style"), d = s.getZoomMultiplier();
132
- h.setAttribute(c, "true"), h.innerHTML = `
133
- .gjs-frame-wrapper { transition: none !important; }
134
- .gjs-frame-wrapper__bottom { height: ${a * d}px }
135
- .gjs-frame { border-radius: ${n}px }
136
- `, !u && document.body.appendChild(h);
139
+ const L = (i) => {
140
+ const v = "data-gs-plg-full-size", f = document.querySelector(`style[${v}]`);
141
+ if (i && f)
142
+ return f.remove();
143
+ const m = f || document.createElement("style"), h = n.getZoomMultiplier();
144
+ m.setAttribute(v, "true"), m.innerHTML = `
145
+ .gjs-frame-wrapper { transition: width ${D}s !important; }
146
+ .gjs-frame-wrapper__bottom { height: ${p * h}px }
147
+ .gjs-frame { border-radius: ${l}px }
148
+ `, !f && document.body.appendChild(m);
137
149
  };
138
- e.onReady(() => {
139
- const c = s.getSpotsEl(), u = s.getElement(), h = s.getFramesEl();
140
- u.style.overflowX = "hidden", h.style.transition = `transform ${m}s`, r();
141
- const d = () => c.style.display = "none", b = () => c.style.display = "", g = L(() => {
142
- const v = { x: f, y: a };
143
- s.getCanvasView().clearOff(), s.fitViewport({
144
- // @ts-expect-error not yet available
145
- zoom: (y) => y > 100 ? 100 : y,
150
+ e.on(E.frameLoadHead, (i) => {
151
+ if (!S.scrollableCanvas) return;
152
+ const { window: v } = i, f = v.document, m = f.head, h = "data-gs-plg-wrapper-style", w = m.querySelector(`style[${h}]`) || f.createElement("style");
153
+ w.setAttribute(h, "true"), w.innerHTML = `[data-gjs-type="wrapper"] { min-height: ${y}; }`, !m.contains(w) && m.appendChild(w);
154
+ }), e.onReady(() => {
155
+ const i = n.getSpotsEl(), v = n.getElement(), f = n.getFramesEl(), m = r * 1e3, h = v.style;
156
+ h.overflowX = "hidden", f.style.transition = `transform ${r}s`;
157
+ const w = { x: d, y: p };
158
+ L();
159
+ const A = () => i.style.display = "none", _ = () => i.style.display = "", $ = j(() => {
160
+ n.fitViewport({
161
+ zoom: (g) => g > 100 ? 100 : g,
146
162
  ignoreHeight: !0,
147
- gap: v
148
- }), r(), setTimeout(() => {
149
- var y, T;
150
- e.em.destroyed || ((T = (y = e.getSelected()) == null ? void 0 : y.getEl()) == null || T.scrollIntoView({ block: "nearest" }), e.refresh({ tools: !0 }), b());
151
- }, 310);
152
- }, 100), E = new ResizeObserver(() => {
153
- d(), g();
163
+ gap: w
164
+ }), L(), setTimeout(() => {
165
+ var g, W;
166
+ e.em.destroyed || ((W = (g = e.getSelected()) == null ? void 0 : g.getEl()) == null || W.scrollIntoView({ block: "nearest" }), e.refresh({ tools: !0 }), _());
167
+ }, m);
168
+ }, 100), H = new ResizeObserver(() => {
169
+ A(), $();
154
170
  });
155
- E.observe(u.parentElement), e.on(e.Devices.events.select, () => {
156
- d(), g();
157
- }), e.on(s.events.zoom, (v = {}) => {
158
- v.options && v.options.from !== "fitViewport" && s.fitViewport({
159
- // @ts-expect-error not yet available
160
- zoom: s.getZoom(),
171
+ H.observe(v.parentElement);
172
+ const M = () => {
173
+ A(), $();
174
+ }, O = (g = {}) => {
175
+ g.options && g.options.from !== "fitViewport" && n.fitViewport({
176
+ zoom: n.getZoom(),
161
177
  ignoreHeight: !0,
162
- gap: { x: f, y: a }
178
+ gap: w
163
179
  });
164
- }), e.on(`${t.events.stopCommand}core:preview`, () => {
165
- u.style.overflowX = "hidden", u.style.overflowY = "auto";
166
- }), e.on(e.events.destroy, () => {
167
- E.disconnect(), g.clear();
168
- }), g();
169
- }), U({
180
+ }, x = () => {
181
+ h.overflowX = "hidden", h.overflowY = "auto";
182
+ }, I = () => {
183
+ H.disconnect(), $.clear();
184
+ };
185
+ e.on(o.events.select, M), e.on(E.zoom, O), e.on(C, x), e.on(e.events.destroy, I), $(), t.add(T, () => {
186
+ o.devices.reset(P), S.scrollableCanvas = !1, n.getModel().updateDevice(), n.setZoom(100), n.setCoords(0, 0), h.overflowY = "hidden", L(!0), e.off(o.events.select, M), e.off(E.zoom, O), e.off(C, x), I(), t.run("studio:canvasReload");
187
+ });
188
+ }), Z({
170
189
  editor: e,
171
- licenseKey: i.licenseKey,
172
- plan: w.startup,
173
- pluginName: R,
190
+ licenseKey: c.licenseKey,
191
+ plan: b.startup,
192
+ pluginName: N,
174
193
  cleanup: () => {
194
+ e.runCommand(T);
175
195
  }
176
196
  });
177
- }, j = N(_);
197
+ }, te = G(Q);
178
198
  export {
179
- j as default
199
+ te as default
180
200
  };
@@ -1,5 +1,5 @@
1
- (function(v,h){typeof exports=="object"&&typeof module<"u"?module.exports=h(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],h):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_canvasFullSize=h())})(this,function(){"use strict";function v(e,o,s){let t,i,a,f,d;const l=o;function p(){const r=Date.now()-f;r<l&&r>=0?t=setTimeout(p,l-r):(t=null,d=e.apply(a,i),a=i=null)}const n=function(){return a=this,i=arguments,f=Date.now(),t||(t=setTimeout(p,l)),d};return n.clear=function(){t&&(clearTimeout(t),t=null)},n.flush=function(){t&&(d=e.apply(a,i),a=i=null,clearTimeout(t),t=null)},n}const h="app.grapesjs.com",S="app-stage.grapesjs.com",C=[h,S,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],L="license:check:start",O="license:check:end",k=()=>typeof window<"u",A=({isDev:e,isStage:o})=>`${e?"":`https://${o?S:h}`}/api`,I=()=>{const e=k()&&window.location.hostname;return!!e&&(C.includes(e)||C.some(o=>e.endsWith(o)))};async function j({path:e,baseApiUrl:o,method:s="GET",headers:t={},params:i,body:a}){const d=`${o||A({isDev:!1,isStage:!1})}${e}`,l={method:s,headers:{"Content-Type":"application/json",...t}};a&&(l.body=JSON.stringify(a));const p=i?new URLSearchParams(i).toString():"",n=p?`?${p}`:"",r=await fetch(`${d}${n}`,l);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var g=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(g||{});const $={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function H(e){const o=e;return o.init=s=>t=>e(t,s),o}const M=e=>H(e);async function N({editor:e,plan:o,pluginName:s,licenseKey:t,cleanup:i}){let a="",f=!1;const d=I(),l=n=>{console.warn("Cleanup plugin:",s,"Reason:",n),i()},p=(n={})=>{var m;const{error:r,sdkLicense:c}=n,u=(m=n.plan)==null?void 0:m.category;if(!(c||n.license)||r)l(r||"Invalid license");else if(u){const T=$[o],w=$[u];T>w&&l({pluginRequiredPlan:o,licensePlan:u})}};e.on(L,n=>{a=n==null?void 0:n.baseApiUrl,f=!0}),e.on(O,n=>{p(n)}),setTimeout(async()=>{if(!f){if(d)return;if(t){const n=await U({licenseKey:t,pluginName:s,baseApiUrl:a});n&&p(n)}else l("The `licenseKey` option not provided")}},2e3)}async function U(e){const{licenseKey:o,pluginName:s,baseApiUrl:t}=e;try{return(await j({baseApiUrl:t,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const W="canvasFullSize";return M(function(e,o={}){const{Canvas:s,Commands:t}=e,i={deviceMaxWidth:1200,deviceMinHeigth:500,deviceBorderRadius:5,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,...o},{canvasOffsetY:a,canvasOffsetX:f,canvasTransition:d,deviceMaxWidth:l,deviceMinHeigth:p,deviceBorderRadius:n}=i;s.getConfig().scrollableCanvas=!0,e.Devices.getAll().map(c=>{!c.get("width")&&c.set("width",`${l}px`),!c.get("height")&&c.set("height","auto"),!c.get("minHeight")&&c.set("minHeight",`${p}px`)});const r=()=>{const c="data-gs-plg-full-size",u=document.querySelector(`style[${c}]`),y=u||document.createElement("style"),m=s.getZoomMultiplier();y.setAttribute(c,"true"),y.innerHTML=`
2
- .gjs-frame-wrapper { transition: none !important; }
3
- .gjs-frame-wrapper__bottom { height: ${a*m}px }
4
- .gjs-frame { border-radius: ${n}px }
5
- `,!u&&document.body.appendChild(y)};e.onReady(()=>{const c=s.getSpotsEl(),u=s.getElement(),y=s.getFramesEl();u.style.overflowX="hidden",y.style.transition=`transform ${d}s`,r();const m=()=>c.style.display="none",T=()=>c.style.display="",w=v(()=>{const E={x:f,y:a};s.getCanvasView().clearOff(),s.fitViewport({zoom:b=>b>100?100:b,ignoreHeight:!0,gap:E}),r(),setTimeout(()=>{var b,D;e.em.destroyed||((D=(b=e.getSelected())==null?void 0:b.getEl())==null||D.scrollIntoView({block:"nearest"}),e.refresh({tools:!0}),T())},310)},100),x=new ResizeObserver(()=>{m(),w()});x.observe(u.parentElement),e.on(e.Devices.events.select,()=>{m(),w()}),e.on(s.events.zoom,(E={})=>{E.options&&E.options.from!=="fitViewport"&&s.fitViewport({zoom:s.getZoom(),ignoreHeight:!0,gap:{x:f,y:a}})}),e.on(`${t.events.stopCommand}core:preview`,()=>{u.style.overflowX="hidden",u.style.overflowY="auto"}),e.on(e.events.destroy,()=>{x.disconnect(),w.clear()}),w()}),N({editor:e,licenseKey:i.licenseKey,plan:g.startup,pluginName:W,cleanup:()=>{}})})});
1
+ (function(C,y){typeof exports=="object"&&typeof module<"u"?module.exports=y(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],y):(C=typeof globalThis<"u"?globalThis:C||self,C.StudioSdkPlugins_canvasFullSize=y())})(this,function(){"use strict";function C(e,i,n){let t,o,c,p,d;const r=i;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,d=e.apply(c,o),c=o=null)}const s=function(){return c=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),d};return s.clear=function(){t&&(clearTimeout(t),t=null)},s.flush=function(){t&&(d=e.apply(c,o),c=o=null,clearTimeout(t),t=null)},s}const y="app.grapesjs.com",H="app-stage.grapesjs.com",M=[y,H,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],U="license:check:start",_="license:check:end",F=()=>typeof window<"u",K=({isDev:e,isStage:i})=>`${e?"":`https://${i?H:y}`}/api`,q=()=>{const e=F()&&window.location.hostname;return!!e&&(M.includes(e)||M.some(i=>e.endsWith(i)))};async function V({path:e,baseApiUrl:i,method:n="GET",headers:t={},params:o,body:c}){const d=`${i||K({isDev:!1,isStage:!1})}${e}`,r={method:n,headers:{"Content-Type":"application/json",...t}};c&&(r.body=JSON.stringify(c));const u=o?new URLSearchParams(o).toString():"",s=u?`?${u}`:"",l=await fetch(`${d}${s}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}var b=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(b||{});const O={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function X(e){const i=e;return i.init=n=>t=>e(t,n),i}const Y=e=>X(e);async function B({editor:e,plan:i,pluginName:n,licenseKey:t,cleanup:o}){let c="",p=!1;const d=q(),r=s=>{console.warn("Cleanup plugin:",n,"Reason:",s),o()},u=(s={})=>{var T;const{error:l,sdkLicense:x}=s,S=(T=s.plan)==null?void 0:T.category;if(!(x||s.license)||l)r(l||"Invalid license");else if(S){const E=O[i],D=O[S];E>D&&r({pluginRequiredPlan:i,licensePlan:S})}};e.on(U,s=>{c=s==null?void 0:s.baseApiUrl,p=!0}),e.on(_,s=>{u(s)}),setTimeout(async()=>{if(!p){if(d)return;if(t){const s=await G({licenseKey:t,pluginName:n,baseApiUrl:c});s&&u(s)}else r("The `licenseKey` option not provided")}},2e3)}async function G(e){const{licenseKey:i,pluginName:n,baseApiUrl:t}=e;try{return(await V({baseApiUrl:t,path:`/sdk/${i||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const j="canvasFullSize";return Y(function(e,i={}){const{Canvas:n,Commands:t,Devices:o}=e,c={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...i},{canvasOffsetY:p,canvasOffsetX:d,canvasTransition:r,deviceMaxWidth:u,deviceMinHeigth:s,frameBorderRadius:l,frameTransition:x}=c,S=`${s}px`,$=n.events,T=`${t.events.stopCommand}core:preview`,E=n.getConfig(),D=`${j}:disable`,Z=o.getAll().map(a=>({...a.attributes}));E.scrollableCanvas=!0,o.getAll().map(a=>{!a.get("width")&&a.set("width",`${u}px`),!a.get("height")&&a.set("height","auto"),!a.get("minHeight")&&a.set("minHeight",S)});const A=a=>{const v="data-gs-plg-full-size",f=document.querySelector(`style[${v}]`);if(a&&f)return f.remove();const m=f||document.createElement("style"),h=n.getZoomMultiplier();m.setAttribute(v,"true"),m.innerHTML=`
2
+ .gjs-frame-wrapper { transition: width ${x}s !important; }
3
+ .gjs-frame-wrapper__bottom { height: ${p*h}px }
4
+ .gjs-frame { border-radius: ${l}px }
5
+ `,!f&&document.body.appendChild(m)};e.on($.frameLoadHead,a=>{if(!E.scrollableCanvas)return;const{window:v}=a,f=v.document,m=f.head,h="data-gs-plg-wrapper-style",w=m.querySelector(`style[${h}]`)||f.createElement("style");w.setAttribute(h,"true"),w.innerHTML=`[data-gjs-type="wrapper"] { min-height: ${S}; }`,!m.contains(w)&&m.appendChild(w)}),e.onReady(()=>{const a=n.getSpotsEl(),v=n.getElement(),f=n.getFramesEl(),m=r*1e3,h=v.style;h.overflowX="hidden",f.style.transition=`transform ${r}s`;const w={x:d,y:p};A();const k=()=>a.style.display="none",J=()=>a.style.display="",L=C(()=>{n.fitViewport({zoom:g=>g>100?100:g,ignoreHeight:!0,gap:w}),A(),setTimeout(()=>{var g,R;e.em.destroyed||((R=(g=e.getSelected())==null?void 0:g.getEl())==null||R.scrollIntoView({block:"nearest"}),e.refresh({tools:!0}),J())},m)},100),z=new ResizeObserver(()=>{k(),L()});z.observe(v.parentElement);const I=()=>{k(),L()},W=(g={})=>{g.options&&g.options.from!=="fitViewport"&&n.fitViewport({zoom:n.getZoom(),ignoreHeight:!0,gap:w})},N=()=>{h.overflowX="hidden",h.overflowY="auto"},P=()=>{z.disconnect(),L.clear()};e.on(o.events.select,I),e.on($.zoom,W),e.on(T,N),e.on(e.events.destroy,P),L(),t.add(D,()=>{o.devices.reset(Z),E.scrollableCanvas=!1,n.getModel().updateDevice(),n.setZoom(100),n.setCoords(0,0),h.overflowY="hidden",A(!0),e.off(o.events.select,I),e.off($.zoom,W),e.off(T,N),P(),t.run("studio:canvasReload")})}),B({editor:e,licenseKey:c.licenseKey,plan:b.startup,pluginName:j,cleanup:()=>{e.runCommand(D)}})})});
@@ -1,5 +1,13 @@
1
1
  import { SDKPluginOptions } from '../utils';
2
2
  export interface CanvasFullSizeOptions extends SDKPluginOptions {
3
+ /**
4
+ * @default 1200
5
+ */
6
+ deviceMaxWidth?: number;
7
+ /**
8
+ * @default 500
9
+ */
10
+ deviceMinHeigth?: number;
3
11
  /**
4
12
  * @default 30
5
13
  */
@@ -13,15 +21,11 @@ export interface CanvasFullSizeOptions extends SDKPluginOptions {
13
21
  */
14
22
  canvasTransition?: number;
15
23
  /**
16
- * @default 1200
17
- */
18
- deviceMaxWidth?: number;
19
- /**
20
- * @default 1200
24
+ * @default 5
21
25
  */
22
- deviceMinHeigth?: number;
26
+ frameBorderRadius?: number;
23
27
  /**
24
- * @default 5
28
+ * @default 0.3
25
29
  */
26
- deviceBorderRadius?: number;
30
+ frameTransition?: number;
27
31
  }
@@ -0,0 +1,3 @@
1
+ import { Editor } from '../types';
2
+ import { FlexComponentOptions } from './types';
3
+ export default function loadBlocks(editor: Editor, opts: FlexComponentOptions): (() => void) | undefined;
@@ -0,0 +1,4 @@
1
+ import { Editor } from '../../types';
2
+ import { FlexComponentOptions } from '../types';
3
+ declare const loadFlexColumn: (editor: Editor, opts: FlexComponentOptions) => (() => void) | undefined;
4
+ export default loadFlexColumn;
@@ -0,0 +1,4 @@
1
+ import { Editor } from '../../types';
2
+ import { FlexComponentOptions } from '../types';
3
+ declare const loadFlexRow: (editor: Editor, opts: FlexComponentOptions) => (() => void) | undefined;
4
+ export default loadFlexRow;
@@ -0,0 +1,19 @@
1
+ import { FlexComponentOptions, FlexGetGapFnProps, FlexGetParentSizeFnProps, FlexGetSizeFnProps, FlexIsParentVerticalFnProps, FlexSetGapFnProps, FlexSetSizeFnProps } from './types';
2
+ export interface SizeHandler {
3
+ getSize(props: FlexGetSizeFnProps): number;
4
+ setSize(props: FlexSetSizeFnProps): void;
5
+ }
6
+ export interface GapHandler {
7
+ getGap(props: FlexGetGapFnProps): number;
8
+ setGap(props: FlexSetGapFnProps): void;
9
+ isGapSupported(): boolean;
10
+ }
11
+ export interface ParentSizeHandler {
12
+ getParentSize(props: FlexGetParentSizeFnProps): number;
13
+ isLayoutVertical(props: FlexIsParentVerticalFnProps): boolean;
14
+ }
15
+ export declare function getHandlers(config: FlexComponentOptions): {
16
+ sizeHandler: SizeHandler;
17
+ gapHandler: GapHandler;
18
+ parentSizeHandler: ParentSizeHandler;
19
+ };
@@ -0,0 +1,3 @@
1
+ import { FlexComponentOptions } from './types';
2
+ declare const _default: import('../utils').PluginWithInit<FlexComponentOptions>;
3
+ export default _default;