@grapesjs/studio-sdk-plugins 1.0.19-rc.0 → 1.0.19
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 +2 -2
- package/dist/accordionComponent/index.es.js +12 -12
- package/dist/accordionComponent/index.umd.js +2 -2
- package/dist/accordionComponent/shared.d.ts +3 -0
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +25 -25
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasEmptyState/shared.d.ts +3 -0
- package/dist/canvasFullSize/index.cjs.js +2 -2
- package/dist/canvasFullSize/index.es.js +26 -26
- package/dist/canvasFullSize/index.umd.js +2 -2
- package/dist/canvasFullSize/shared.d.ts +3 -0
- package/dist/canvasGridMode/index.cjs.js +2 -2
- package/dist/canvasGridMode/index.es.js +42 -42
- package/dist/canvasGridMode/index.umd.js +2 -2
- package/dist/canvasGridMode/shared.d.ts +3 -0
- package/dist/canvasGridMode/utils.d.ts +0 -1
- package/dist/flexComponent/index.cjs.js +6 -6
- package/dist/flexComponent/index.es.js +40 -40
- package/dist/flexComponent/index.umd.js +6 -6
- package/dist/flexComponent/shared.d.ts +3 -0
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +28 -28
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/fsLightboxComponent/shared.d.ts +3 -0
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +97 -77
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/googleFontsAssetProvider/utils.d.ts +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +149 -149
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/iconifyComponent/shared.d.ts +3 -0
- package/dist/index.cjs.js +35 -35
- package/dist/index.es.js +1667 -1644
- package/dist/index.umd.js +29 -29
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +14 -14
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/shared.d.ts +3 -0
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +45 -45
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/lightGalleryComponent/shared.d.ts +3 -0
- package/dist/listPagesComponent/index.cjs.js +3 -3
- package/dist/listPagesComponent/index.es.js +63 -62
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/listPagesComponent/shared.d.ts +3 -0
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +437 -436
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/prosemirror/shared.d.ts +3 -0
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +33 -33
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/rteTinyMce/shared.d.ts +3 -0
- package/dist/swiperComponent/index.cjs.js +1 -1
- package/dist/swiperComponent/index.es.js +4 -4
- package/dist/swiperComponent/index.umd.js +3 -3
- package/dist/swiperComponent/shared.d.ts +3 -0
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +58 -57
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/tableComponent/shared.d.ts +3 -0
- package/dist/types.d.ts +2 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +63 -62
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/shared.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const M="app.grapesjs.com",L="app-stage.grapesjs.com",$=[M,L,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],
|
|
1
|
+
"use strict";const M="app.grapesjs.com",L="app-stage.grapesjs.com",$=[M,L,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],_="license:check:start",B="license:check:end",P=()=>typeof window<"u",V=({isDev:e,isStage:t})=>`${e?"":`https://${t?L:M}`}/api`,G=()=>{const e=P()&&window.location.hostname;return!!e&&($.includes(e)||$.some(t=>e.endsWith(t)))};async function U({path:e,baseApiUrl:t,method:n="GET",headers:s={},params:c,body:a}){const u=`${t||V({isDev:!1,isStage:!1})}${e}`,i={method:n,headers:{"Content-Type":"application/json",...s}};a&&(i.body=JSON.stringify(a));const r=c?new URLSearchParams(c).toString():"",o=r?`?${r}`:"",l=await fetch(`${u}${o}`,i);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 E={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function D(e){const t=e;return t.init=n=>s=>e(s,n),t}const K=e=>D(e);async function W({editor:e,plan:t,pluginName:n,licenseKey:s,cleanup:c}){let a="",p=!1;const u=G(),i=o=>{console.warn("Cleanup plugin:",n,"Reason:",o),c()},r=(o={})=>{var w;const{error:l,sdkLicense:f}=o,g=(w=o.plan)==null?void 0:w.category;if(!(f||o.license)||l)i(l||"Invalid license");else if(g){const I=E[t],N=E[g];I>N&&i({pluginRequiredPlan:t,licensePlan:g})}};e.on(_,o=>{a=o==null?void 0:o.baseApiUrl,p=!0}),e.on(B,o=>{r(o)}),setTimeout(async()=>{if(!p){if(u)return;if(s){const o=await R({licenseKey:s,pluginName:n,baseApiUrl:a});o&&r(o)}else i("The `licenseKey` option not provided")}},2e3)}async function R(e){const{licenseKey:t,pluginName:n,baseApiUrl:s}=e;try{return(await U({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(c){return console.error("Error during SDK license check:",c),!1}}const A=e=>t=>{var n;return((n=t.getAttribute)==null?void 0:n.call(t,T))===e},O=(...e)=>t=>e.some(n=>t.is(n)),j=(...e)=>(t,n)=>e.some(s=>n.is(s)),C="gjs-plg-",T="data-type-role",d="accordion",q=`${d}-group`,m=`${d}-header`,h=`${d}-content`,y=`${d}-marker`,x=`${C}${m}`,k=`${C}${y}`,F=`${C}${h}`,H=`${k}-open`,v={accordion:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',accordionGroup:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',accordionHeader:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',accordionContent:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616v10.769q0 .69-.463 1.153T19.385 19zm0-1h14.769q.23 0 .423-.192t.192-.424V6.616q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192M4 18V6zm2.23-2.116h11.54q.213 0 .356-.143t.143-.357t-.143-.356t-.357-.144H6.231q-.214 0-.357.144q-.143.143-.143.357q0 .213.143.356t.357.144m0-3.385h11.538q.214 0 .357-.143t.143-.357t-.143-.357t-.357-.143H6.231q-.214 0-.357.143T5.731 12t.143.357t.357.143m0-3.384H14q.214 0 .357-.144q.143-.143.143-.356q0-.214-.143-.357T14 8.116H6.23q-.213 0-.356.143t-.143.357t.143.356t.357.144"/></svg>',accordionMarker:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',caret:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},S=(e,t)=>{const{toolbarIconOpen:n=v.eye}=t,s=e.is(d)?e:e.closestType(d);if(!n||!s)return;const{toolbar:c}=e,a={id:"accordion-toggle-open",label:n,command:()=>s.toggleOpen()};!c.find(u=>u.id===a.id)&&(c==null||c.unshift(a))},Y=(e,t)=>{const{Components:n,Blocks:s}=e,{block:c={}}=t,a="Accordion",p=`${C}${d}`,u=function(i={}){const r=this,o=()=>{const{clsMarkerOpen:l}=i,f=r.querySelector('[data-type-role="accordion-marker"]');!f||!l||(r.open?f.classList.add(l):f.classList.remove(l))};r.addEventListener("toggle",()=>{o(),r.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),o()};return n.addType(d,{block:c&&{label:a,media:v.accordion,category:"Extra",select:!0,...c},isComponent:A(d),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:a,classes:p,emptyState:!0,clsMarkerOpen:H,attributes:{[T]:d},droppable:O(m,h),components:[{type:m},{type:h}],"script-props":["clsMarkerOpen"],script:u,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
|
|
2
2
|
.${p}::details-content {
|
|
3
3
|
opacity: 0;
|
|
4
4
|
block-size: 0;
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
.${H} {
|
|
37
37
|
transform: rotateZ(180deg);
|
|
38
38
|
}
|
|
39
|
-
`}}}),()=>{t.removeType(y)}},ee="accordionComponent",te=function(e,t={}){const n=[Y(e,t),J(e,t),Q(e,t),X(e),Z(e)];W({editor:e,licenseKey:t.licenseKey,plan:
|
|
39
|
+
`}}}),()=>{t.removeType(y)}},ee="accordionComponent",te=b.startup,ne=function(e,t={}){const n=[Y(e,t),J(e,t),Q(e,t),X(e),Z(e)];W({editor:e,licenseKey:t.licenseKey,plan:te,pluginName:ee,cleanup:()=>{n.forEach(s=>s())}})},oe=K(ne);module.exports=oe;
|
|
@@ -9,8 +9,8 @@ const M = "app.grapesjs.com", L = "app-stage.grapesjs.com", $ = [
|
|
|
9
9
|
// For stackblitz.com demos
|
|
10
10
|
"-sandpack.codesandbox.io"
|
|
11
11
|
// For Sandpack demos
|
|
12
|
-
],
|
|
13
|
-
const e =
|
|
12
|
+
], _ = "license:check:start", B = "license:check:end", P = () => typeof window < "u", V = ({ isDev: e, isStage: t }) => `${e ? "" : `https://${t ? L : M}`}/api`, G = () => {
|
|
13
|
+
const e = P() && window.location.hostname;
|
|
14
14
|
return !!e && ($.includes(e) || $.some((t) => e.endsWith(t)));
|
|
15
15
|
};
|
|
16
16
|
async function U({
|
|
@@ -21,7 +21,7 @@ async function U({
|
|
|
21
21
|
params: c,
|
|
22
22
|
body: i
|
|
23
23
|
}) {
|
|
24
|
-
const u = `${t ||
|
|
24
|
+
const u = `${t || V({ isDev: !1, isStage: !1 })}${e}`, a = {
|
|
25
25
|
method: n,
|
|
26
26
|
headers: {
|
|
27
27
|
"Content-Type": "application/json",
|
|
@@ -54,7 +54,7 @@ async function W({
|
|
|
54
54
|
cleanup: c
|
|
55
55
|
}) {
|
|
56
56
|
let i = "", p = !1;
|
|
57
|
-
const u =
|
|
57
|
+
const u = G(), a = (o) => {
|
|
58
58
|
console.warn("Cleanup plugin:", n, "Reason:", o), c();
|
|
59
59
|
}, r = (o = {}) => {
|
|
60
60
|
var w;
|
|
@@ -62,13 +62,13 @@ async function W({
|
|
|
62
62
|
if (!(f || o.license) || l)
|
|
63
63
|
a(l || "Invalid license");
|
|
64
64
|
else if (g) {
|
|
65
|
-
const
|
|
66
|
-
|
|
65
|
+
const I = E[t], N = E[g];
|
|
66
|
+
I > N && a({ pluginRequiredPlan: t, licensePlan: g });
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
e.on(
|
|
69
|
+
e.on(_, (o) => {
|
|
70
70
|
i = o == null ? void 0 : o.baseApiUrl, p = !0;
|
|
71
|
-
}), e.on(
|
|
71
|
+
}), e.on(B, (o) => {
|
|
72
72
|
r(o);
|
|
73
73
|
}), setTimeout(async () => {
|
|
74
74
|
if (!p) {
|
|
@@ -336,7 +336,7 @@ const A = (e) => (t) => {
|
|
|
336
336
|
}), () => {
|
|
337
337
|
t.removeType(y);
|
|
338
338
|
};
|
|
339
|
-
}, ee = "accordionComponent", te = function(e, t = {}) {
|
|
339
|
+
}, ee = "accordionComponent", te = b.startup, ne = function(e, t = {}) {
|
|
340
340
|
const n = [
|
|
341
341
|
Y(e, t),
|
|
342
342
|
J(e, t),
|
|
@@ -347,13 +347,13 @@ const A = (e) => (t) => {
|
|
|
347
347
|
W({
|
|
348
348
|
editor: e,
|
|
349
349
|
licenseKey: t.licenseKey,
|
|
350
|
-
plan:
|
|
350
|
+
plan: te,
|
|
351
351
|
pluginName: ee,
|
|
352
352
|
cleanup: () => {
|
|
353
353
|
n.forEach((s) => s());
|
|
354
354
|
}
|
|
355
355
|
});
|
|
356
|
-
},
|
|
356
|
+
}, oe = K(ne);
|
|
357
357
|
export {
|
|
358
|
-
|
|
358
|
+
oe as default
|
|
359
359
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(v,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_accordionComponent=b())})(this,function(){"use strict";const v="app.grapesjs.com",b="app-stage.grapesjs.com",x=[v,b,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],z="license:check:start",_="license:check:end",
|
|
1
|
+
(function(v,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_accordionComponent=b())})(this,function(){"use strict";const v="app.grapesjs.com",b="app-stage.grapesjs.com",x=[v,b,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],z="license:check:start",_="license:check:end",I=()=>typeof window<"u",N=({isDev:e,isStage:n})=>`${e?"":`https://${n?b:v}`}/api`,P=()=>{const e=I()&&window.location.hostname;return!!e&&(x.includes(e)||x.some(n=>e.endsWith(n)))};async function B({path:e,baseApiUrl:n,method:t="GET",headers:s={},params:c,body:l}){const m=`${n||N({isDev:!1,isStage:!1})}${e}`,i={method:t,headers:{"Content-Type":"application/json",...s}};l&&(i.body=JSON.stringify(l));const r=c?new URLSearchParams(c).toString():"",o=r?`?${r}`:"",d=await fetch(`${m}${o}`,i);if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return d.json()}var T=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(T||{});const E={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function V(e){const n=e;return n.init=t=>s=>e(s,t),n}const G=e=>V(e);async function U({editor:e,plan:n,pluginName:t,licenseKey:s,cleanup:c}){let l="",p=!1;const m=P(),i=o=>{console.warn("Cleanup plugin:",t,"Reason:",o),c()},r=(o={})=>{var H;const{error:d,sdkLicense:A}=o,y=(H=o.plan)==null?void 0:H.category;if(!(A||o.license)||d)i(d||"Invalid license");else if(y){const ee=E[n],ne=E[y];ee>ne&&i({pluginRequiredPlan:n,licensePlan:y})}};e.on(z,o=>{l=o==null?void 0:o.baseApiUrl,p=!0}),e.on(_,o=>{r(o)}),setTimeout(async()=>{if(!p){if(m)return;if(s){const o=await D({licenseKey:s,pluginName:t,baseApiUrl:l});o&&r(o)}else i("The `licenseKey` option not provided")}},2e3)}async function D(e){const{licenseKey:n,pluginName:t,baseApiUrl:s}=e;try{return(await B({baseApiUrl:s,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(c){return console.error("Error during SDK license check:",c),!1}}const C=e=>n=>{var t;return((t=n.getAttribute)==null?void 0:t.call(n,q))===e},M=(...e)=>n=>e.some(t=>n.is(t)),K=(...e)=>(n,t)=>e.some(s=>t.is(s)),w="gjs-plg-",q="data-type-role",a="accordion",k=`${a}-group`,u=`${a}-header`,h=`${a}-content`,f=`${a}-marker`,L=`${w}${u}`,$=`${w}${f}`,W=`${w}${h}`,S=`${$}-open`,g={accordion:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V8.154H5v10.23q0 .232.192.424t.423.192"/></svg>',accordionGroup:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M8.116 16h10.769q.23 0 .423-.192t.192-.423V6h-12v9.385q0 .23.192.423t.423.192m0 1q-.69 0-1.153-.462T6.5 15.385V4.615q0-.69.463-1.153T8.116 3h10.769q.69 0 1.153.462t.462 1.153v10.77q0 .69-.462 1.152T18.884 17zm-3 3q-.69 0-1.153-.462T3.5 18.385V6.615h1v11.77q0 .23.192.423t.423.192h11.77v1zM7.5 4v12z"/></svg>',accordionHeader:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M5.616 20q-.691 0-1.153-.462T4 18.384V5.616q0-.691.463-1.153T5.616 4h12.769q.69 0 1.153.463T20 5.616v12.769q0 .69-.462 1.153T18.384 20zm0-1h12.769q.23 0 .423-.192t.192-.424V5.616q0-.231-.192-.424T18.384 5H5.616q-.231 0-.424.192T5 5.616v12.769q0 .23.192.423t.423.192M5 5v14zm2.616 4.192h6q.413 0 .706-.293q.294-.293.294-.707t-.294-.706q-.293-.294-.706-.294h-6q-.414 0-.707.294t-.293.706t.293.707t.707.293"/></svg>',accordionContent:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M4.616 19q-.691 0-1.153-.462T3 17.384V6.616q0-.691.463-1.153T4.615 5h14.77q.69 0 1.152.463T21 6.616v10.769q0 .69-.463 1.153T19.385 19zm0-1h14.769q.23 0 .423-.192t.192-.424V6.616q0-.231-.192-.424T19.385 6H4.615q-.23 0-.423.192T4 6.616v10.769q0 .23.192.423t.423.192M4 18V6zm2.23-2.116h11.54q.213 0 .356-.143t.143-.357t-.143-.356t-.357-.144H6.231q-.214 0-.357.144q-.143.143-.143.357q0 .213.143.356t.357.144m0-3.385h11.538q.214 0 .357-.143t.143-.357t-.143-.357t-.357-.143H6.231q-.214 0-.357.143T5.731 12t.143.357t.357.143m0-3.384H14q.214 0 .357-.144q.143-.143.143-.356q0-.214-.143-.357T14 8.116H6.23q-.213 0-.356.143t-.143.357t.143.356t.357.144"/></svg>',accordionMarker:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="m12 15.596l3.173-3.192H8.827zM5.616 20q-.672 0-1.144-.472T4 18.385V5.615q0-.67.472-1.143Q4.944 4 5.616 4h12.769q.67 0 1.143.472q.472.472.472 1.144v12.769q0 .67-.472 1.143q-.472.472-1.143.472zM5 9v9.385q0 .23.192.423t.423.192h12.77q.23 0 .423-.192t.192-.423V9z"/></svg>',caret:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m7.4 8.6 4.6 4.6 4.6-4.6L18 10l-6 6-6-6 1.4-1.4Z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},O=(e,n)=>{const{toolbarIconOpen:t=g.eye}=n,s=e.is(a)?e:e.closestType(a);if(!t||!s)return;const{toolbar:c}=e,l={id:"accordion-toggle-open",label:t,command:()=>s.toggleOpen()};!c.find(m=>m.id===l.id)&&(c==null||c.unshift(l))},j=(e,n)=>{const{Components:t,Blocks:s}=e,{block:c={}}=n,l="Accordion",p=`${w}${a}`,m=function(i={}){const r=this,o=()=>{const{clsMarkerOpen:d}=i,A=r.querySelector('[data-type-role="accordion-marker"]');!A||!d||(r.open?A.classList.add(d):A.classList.remove(d))};r.addEventListener("toggle",()=>{o(),r.dispatchEvent(new CustomEvent("details-toggle",{bubbles:!0}))}),o()};return t.addType(a,{block:c&&{label:l,media:g.accordion,category:"Extra",select:!0,...c},isComponent:C(a),extendFn:["initToolbar"],model:{defaults:{tagName:"details",name:l,classes:p,emptyState:!0,clsMarkerOpen:S,attributes:{[q]:a},droppable:M(u,h),components:[{type:u},{type:h}],"script-props":["clsMarkerOpen"],script:m,traits:[{type:"checkbox",name:"open",label:"Open"}],styles:`
|
|
2
2
|
.${p}::details-content {
|
|
3
3
|
opacity: 0;
|
|
4
4
|
block-size: 0;
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
.${S} {
|
|
37
37
|
transform: rotateZ(180deg);
|
|
38
38
|
}
|
|
39
|
-
`}}}),()=>{n.removeType(f)}},J="accordionComponent";return G(function(e,n={}){const t=[j(e,n),F(e,n),Y(e,n),Z(e),R(e)];U({editor:e,licenseKey:n.licenseKey,plan:
|
|
39
|
+
`}}}),()=>{n.removeType(f)}},J="accordionComponent",Q=T.startup;return G(function(e,n={}){const t=[j(e,n),F(e,n),Y(e,n),Z(e),R(e)];U({editor:e,licenseKey:n.licenseKey,plan:Q,pluginName:J,cleanup:()=>{t.forEach(s=>s())}})})});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const I="app.grapesjs.com",
|
|
1
|
+
"use strict";const I="app.grapesjs.com",N="app-stage.grapesjs.com",A=[I,N,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],M="license:check:start",P="license:check:end",$=()=>typeof window<"u",D=({isDev:e,isStage:t})=>`${e?"":`https://${t?N:I}`}/api`,_=()=>{const e=$()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(t=>e.endsWith(t)))};function R(e){return typeof e=="function"}async function K({path:e,baseApiUrl:t,method:a="GET",headers:o={},params:i,body:u}){const m=`${t||D({isDev:!1,isStage:!1})}${e}`,p={method:a,headers:{"Content-Type":"application/json",...o}};u&&(p.body=JSON.stringify(u));const d=i?new URLSearchParams(i).toString():"",s=d?`?${d}`:"",c=await fetch(`${m}${s}`,p);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{});const W={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function O(e){const t=e;return t.init=a=>o=>e(o,a),t}const j=e=>O(e);async function G({editor:e,plan:t,pluginName:a,licenseKey:o,cleanup:i}){let u="",h=!1;const m=_(),p=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),i()},d=(s={})=>{var C;const{error:c,sdkLicense:E}=s,v=(C=s.plan)==null?void 0:C.category;if(!(E||s.license)||c)p(c||"Invalid license");else if(v){const L=W[t],T=W[v];L>T&&p({pluginRequiredPlan:t,licensePlan:v})}};e.on(M,s=>{u=s==null?void 0:s.baseApiUrl,h=!0}),e.on(P,s=>{d(s)}),setTimeout(async()=>{if(!h){if(m)return;if(o){const s=await x({licenseKey:o,pluginName:a,baseApiUrl:u});s&&d(s)}else p("The `licenseKey` option not provided")}},2e3)}async function x(e){const{licenseKey:t,pluginName:a,baseApiUrl:o}=e;try{return(await K({baseApiUrl:o,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const F="canvasEmptyState",H=w.startup,q=function(e,t={}){const a=new WeakMap,o=new WeakMap,i=new WeakMap,u=new Set,h=new WeakMap,m={emptyStates:[],...t},p=(n,r)=>{let y=!1;const{isValid:f}=r;return Array.isArray(f)?y=f.some(l=>n.is(l)):R(f)?y=f({component:n,editor:e}):y=n.is(f),y},d=n=>{const r=a.get(n);a.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,y=i.get(n);if(r&&y)s(n);else if(!r&&!y){const f=h.has(n)?h.get(n):m.emptyStates.find(l=>p(n,l));if(h.set(n,f),!f)return;n.views.forEach(l=>{const S=f.render({editor:e,component:n,componentView:l,mount:g=>{o.set(l,g),i.set(n,!0);const k=l.getChildrenContainer();k==null||k.appendChild(g)},unmount:()=>d(l)});a.set(l,()=>{S==null||S();const g=o.get(l);g==null||g.remove()})})}}finally{u.delete(n)}},E=n=>{i.has(n)&&s(n)},v=({model:n})=>{c(n.getComponent())},b=e.Components.events,C=`${b.update}:components`,L="component:mount",T=e.Canvas.events.frameLoadBody,U=b.removed;e.on(C,c),e.on(L,c),e.on(U,E),e.on(T,v),G({editor:e,licenseKey:m.licenseKey,plan:H,pluginName:F,cleanup:()=>{e.off(C,c),e.off(L,c),e.off(U,E),e.off(T,v)}})},B=j(q);module.exports=B;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const I = "app.grapesjs.com",
|
|
1
|
+
const I = "app.grapesjs.com", N = "app-stage.grapesjs.com", A = [
|
|
2
2
|
I,
|
|
3
|
-
|
|
3
|
+
N,
|
|
4
4
|
"localhost",
|
|
5
5
|
"127.0.0.1",
|
|
6
6
|
".local-credentialless.webcontainer.io",
|
|
@@ -9,11 +9,11 @@ const I = "app.grapesjs.com", M = "app-stage.grapesjs.com", W = [
|
|
|
9
9
|
// For stackblitz.com demos
|
|
10
10
|
"-sandpack.codesandbox.io"
|
|
11
11
|
// For Sandpack demos
|
|
12
|
-
],
|
|
13
|
-
const e =
|
|
14
|
-
return !!e && (
|
|
12
|
+
], M = "license:check:start", P = "license:check:end", $ = () => typeof window < "u", D = ({ isDev: e, isStage: t }) => `${e ? "" : `https://${t ? N : I}`}/api`, _ = () => {
|
|
13
|
+
const e = $() && window.location.hostname;
|
|
14
|
+
return !!e && (A.includes(e) || A.some((t) => e.endsWith(t)));
|
|
15
15
|
};
|
|
16
|
-
function
|
|
16
|
+
function R(e) {
|
|
17
17
|
return typeof e == "function";
|
|
18
18
|
}
|
|
19
19
|
async function K({
|
|
@@ -24,7 +24,7 @@ async function K({
|
|
|
24
24
|
params: i,
|
|
25
25
|
body: u
|
|
26
26
|
}) {
|
|
27
|
-
const m = `${t ||
|
|
27
|
+
const m = `${t || D({ isDev: !1, isStage: !1 })}${e}`, p = {
|
|
28
28
|
method: a,
|
|
29
29
|
headers: {
|
|
30
30
|
"Content-Type": "application/json",
|
|
@@ -38,7 +38,7 @@ async function K({
|
|
|
38
38
|
return c.json();
|
|
39
39
|
}
|
|
40
40
|
var w = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(w || {});
|
|
41
|
-
const
|
|
41
|
+
const W = {
|
|
42
42
|
[w.free]: 0,
|
|
43
43
|
[w.startup]: 10,
|
|
44
44
|
[w.business]: 20,
|
|
@@ -49,7 +49,7 @@ function O(e) {
|
|
|
49
49
|
return t.init = (a) => (o) => e(o, a), t;
|
|
50
50
|
}
|
|
51
51
|
const j = (e) => /* @__PURE__ */ O(e);
|
|
52
|
-
async function
|
|
52
|
+
async function G({
|
|
53
53
|
editor: e,
|
|
54
54
|
plan: t,
|
|
55
55
|
pluginName: a,
|
|
@@ -57,7 +57,7 @@ async function x({
|
|
|
57
57
|
cleanup: i
|
|
58
58
|
}) {
|
|
59
59
|
let u = "", h = !1;
|
|
60
|
-
const m =
|
|
60
|
+
const m = _(), p = (s) => {
|
|
61
61
|
console.warn("Cleanup plugin:", a, "Reason:", s), i();
|
|
62
62
|
}, d = (s = {}) => {
|
|
63
63
|
var C;
|
|
@@ -65,26 +65,26 @@ async function x({
|
|
|
65
65
|
if (!(E || s.license) || c)
|
|
66
66
|
p(c || "Invalid license");
|
|
67
67
|
else if (v) {
|
|
68
|
-
const
|
|
69
|
-
|
|
68
|
+
const L = W[t], T = W[v];
|
|
69
|
+
L > T && p({ pluginRequiredPlan: t, licensePlan: v });
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
e.on(
|
|
72
|
+
e.on(M, (s) => {
|
|
73
73
|
u = s == null ? void 0 : s.baseApiUrl, h = !0;
|
|
74
|
-
}), e.on(
|
|
74
|
+
}), e.on(P, (s) => {
|
|
75
75
|
d(s);
|
|
76
76
|
}), setTimeout(async () => {
|
|
77
77
|
if (!h) {
|
|
78
78
|
if (m) return;
|
|
79
79
|
if (o) {
|
|
80
|
-
const s = await
|
|
80
|
+
const s = await x({ licenseKey: o, pluginName: a, baseApiUrl: u });
|
|
81
81
|
s && d(s);
|
|
82
82
|
} else
|
|
83
83
|
p("The `licenseKey` option not provided");
|
|
84
84
|
}
|
|
85
85
|
}, 2e3);
|
|
86
86
|
}
|
|
87
|
-
async function
|
|
87
|
+
async function x(e) {
|
|
88
88
|
const { licenseKey: t, pluginName: a, baseApiUrl: o } = e;
|
|
89
89
|
try {
|
|
90
90
|
return (await K({
|
|
@@ -100,14 +100,14 @@ async function F(e) {
|
|
|
100
100
|
return console.error("Error during SDK license check:", i), !1;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
const
|
|
103
|
+
const F = "canvasEmptyState", H = w.startup, q = function(e, t = {}) {
|
|
104
104
|
const a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new WeakMap(), m = {
|
|
105
105
|
emptyStates: [],
|
|
106
106
|
...t
|
|
107
107
|
}, p = (n, r) => {
|
|
108
108
|
let y = !1;
|
|
109
109
|
const { isValid: f } = r;
|
|
110
|
-
return Array.isArray(f) ? y = f.some((l) => n.is(l)) :
|
|
110
|
+
return Array.isArray(f) ? y = f.some((l) => n.is(l)) : R(f) ? y = f({ component: n, editor: e }) : y = n.is(f), y;
|
|
111
111
|
}, d = (n) => {
|
|
112
112
|
const r = a.get(n);
|
|
113
113
|
a.delete(n), r == null || r();
|
|
@@ -149,17 +149,17 @@ const G = "canvasEmptyState", H = function(e, t = {}) {
|
|
|
149
149
|
i.has(n) && s(n);
|
|
150
150
|
}, v = ({ model: n }) => {
|
|
151
151
|
c(n.getComponent());
|
|
152
|
-
},
|
|
153
|
-
e.on(C, c), e.on(
|
|
152
|
+
}, b = e.Components.events, C = `${b.update}:components`, L = "component:mount", T = e.Canvas.events.frameLoadBody, U = b.removed;
|
|
153
|
+
e.on(C, c), e.on(L, c), e.on(U, E), e.on(T, v), G({
|
|
154
154
|
editor: e,
|
|
155
155
|
licenseKey: m.licenseKey,
|
|
156
|
-
plan:
|
|
157
|
-
pluginName:
|
|
156
|
+
plan: H,
|
|
157
|
+
pluginName: F,
|
|
158
158
|
cleanup: () => {
|
|
159
|
-
e.off(C, c), e.off(
|
|
159
|
+
e.off(C, c), e.off(L, c), e.off(U, E), e.off(T, v);
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
-
},
|
|
162
|
+
}, B = j(q);
|
|
163
163
|
export {
|
|
164
|
-
|
|
164
|
+
B as default
|
|
165
165
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(y,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_canvasEmptyState=v())})(this,function(){"use strict";const y="app.grapesjs.com",v="app-stage.grapesjs.com",
|
|
1
|
+
(function(y,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_canvasEmptyState=v())})(this,function(){"use strict";const y="app.grapesjs.com",v="app-stage.grapesjs.com",W=[y,v,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],P="license:check:start",M="license:check:end",$=()=>typeof window<"u",_=({isDev:e,isStage:t})=>`${e?"":`https://${t?v:y}`}/api`,D=()=>{const e=$()&&window.location.hostname;return!!e&&(W.includes(e)||W.some(t=>e.endsWith(t)))};function R(e){return typeof e=="function"}async function K({path:e,baseApiUrl:t,method:o="GET",headers:a={},params:i,body:u}){const w=`${t||_({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 g=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(g||{});const I={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function j(e){const t=e;return t.init=o=>a=>e(a,o),t}const x=e=>j(e);async function O({editor:e,plan:t,pluginName:o,licenseKey:a,cleanup:i}){let u="",h=!1;const w=D(),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],b=I[C];L>b&&p({pluginRequiredPlan:t,licensePlan:C})}};e.on(P,s=>{u=s==null?void 0:s.baseApiUrl,h=!0}),e.on(M,s=>{d(s)}),setTimeout(async()=>{if(!h){if(w)return;if(a){const s=await G({licenseKey:a,pluginName:o,baseApiUrl:u});s&&d(s)}else p("The `licenseKey` option not provided")}},2e3)}async function G(e){const{licenseKey:t,pluginName:o,baseApiUrl:a}=e;try{return(await K({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",H=g.startup;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)):R(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 A=l.getChildrenContainer();A==null||A.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`,L="component:mount",b=e.Canvas.events.frameLoadBody,N=k.removed;e.on(S,c),e.on(L,c),e.on(N,T),e.on(b,C),O({editor:e,licenseKey:w.licenseKey,plan:H,pluginName:F,cleanup:()=>{e.off(S,c),e.off(L,c),e.off(N,T),e.off(b,C)}})})});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";function F(e,a,n){let t,o,c,p,m;const r=a;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,m=e.apply(c,o),c=o=null)}const s=function(){return c=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),m};return s.clear=function(){t&&(clearTimeout(t),t=null)},s.flush=function(){t&&(m=e.apply(c,o),c=o=null,clearTimeout(t),t=null)},s}const
|
|
1
|
+
"use strict";function F(e,a,n){let t,o,c,p,m;const r=a;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,m=e.apply(c,o),c=o=null)}const s=function(){return c=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),m};return s.clear=function(){t&&(clearTimeout(t),t=null)},s.flush=function(){t&&(m=e.apply(c,o),c=o=null,clearTimeout(t),t=null)},s}const z="app.grapesjs.com",R="app-stage.grapesjs.com",U=[z,R,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],q="license:check:start",G="license:check:end",V=()=>typeof window<"u",X=({isDev:e,isStage:a})=>`${e?"":`https://${a?R:z}`}/api`,Y=()=>{const e=V()&&window.location.hostname;return!!e&&(U.includes(e)||U.some(a=>e.endsWith(a)))};async function B({path:e,baseApiUrl:a,method:n="GET",headers:t={},params:o,body:c}){const m=`${a||X({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(`${m}${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 W={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function Z(e){const a=e;return a.init=n=>t=>e(t,n),a}const J=e=>Z(e);async function Q({editor:e,plan:a,pluginName:n,licenseKey:t,cleanup:o}){let c="",p=!1;const m=Y(),r=s=>{console.warn("Cleanup plugin:",n,"Reason:",s),o()},u=(s={})=>{var C;const{error:l,sdkLicense:D}=s,v=(C=s.plan)==null?void 0:C.category;if(!(D||s.license)||l)r(l||"Invalid license");else if(v){const E=W[a],S=W[v];E>S&&r({pluginRequiredPlan:a,licensePlan:v})}};e.on(q,s=>{c=s==null?void 0:s.baseApiUrl,p=!0}),e.on(G,s=>{u(s)}),setTimeout(async()=>{if(!p){if(m)return;if(t){const s=await ee({licenseKey:t,pluginName:n,baseApiUrl:c});s&&u(s)}else r("The `licenseKey` option not provided")}},2e3)}async function ee(e){const{licenseKey:a,pluginName:n,baseApiUrl:t}=e;try{return(await B({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 k="canvasFullSize",te=b.startup,ne=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:m,canvasTransition:r,deviceMaxWidth:u,deviceMinHeigth:s,frameBorderRadius:l,frameTransition:D}=c,v=`${s}px`,$=n.events,C="core:preview",E=`${t.events.stopCommand}${C}`,S=n.getConfig(),A=`${k}:disable`,_=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",v)});const L=i=>{const w="data-gs-plg-full-size",d=document.querySelector(`style[${w}]`);if(i&&d)return d.remove();const f=d||document.createElement("style"),h=n.getZoomMultiplier();f.setAttribute(w,"true"),f.innerHTML=`
|
|
2
2
|
.gjs-frame-wrapper { transition: width ${D}s !important; }
|
|
3
3
|
.gjs-frame-wrapper__bottom { height: ${p*h}px }
|
|
4
4
|
.gjs-frame { border-radius: ${l}px }
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
[data-gjs-type="wrapper"] { min-height: ${v}; }
|
|
7
7
|
[data-gjs-type="mjml"] { min-height: ${v} !important; }
|
|
8
8
|
[data-gjs-type="mj-body"] { min-height: ${v} !important; }
|
|
9
|
-
`,!f.contains(y)&&f.appendChild(y)}),e.onReady(()=>{const i=n.getSpotsEl(),w=n.getElement(),d=n.getFramesEl(),f=r*1e3,h=w.style;h.overflowX="hidden",d.style.transition=`transform ${r}s`;const y={x:m,y:p};L();const H=()=>i.style.display="none",K=()=>i.style.display="",T=F(()=>{n.fitViewport({zoom:g=>g>100?100:g,ignoreHeight:!0,gap:y}),L(),setTimeout(()=>{var
|
|
9
|
+
`,!f.contains(y)&&f.appendChild(y)}),e.onReady(()=>{const i=n.getSpotsEl(),w=n.getElement(),d=n.getFramesEl(),f=r*1e3,h=w.style;h.overflowX="hidden",d.style.transition=`transform ${r}s`;const y={x:m,y:p};L();const H=()=>i.style.display="none",K=()=>i.style.display="",T=F(()=>{n.fitViewport({zoom:g=>g>100?100:g,ignoreHeight:!0,gap:y}),L(),setTimeout(()=>{var P,x;const{em:g}=e;g.destroyed||((x=(P=e.getSelected())==null?void 0:P.getEl())==null||x.scrollIntoView({block:"nearest"}),e.refresh({tools:!0}),K(),t.isActive(C)?g.stopDefault():g.runDefault())},f)},100),j=new ResizeObserver(()=>{H(),T()});j.observe(w.parentElement);const I=()=>{H(),T()},M=(g={})=>{g.options&&g.options.from!=="fitViewport"&&n.fitViewport({zoom:n.getZoom(),ignoreHeight:!0,gap:y})},N=()=>{h.overflowX="hidden",h.overflowY="auto"},O=()=>{j.disconnect(),T.clear()};e.on(o.events.select,I),e.on($.zoom,M),e.on(E,N),e.on(e.events.destroy,O),T(),t.add(A,()=>{o.devices.reset(_),S.scrollableCanvas=!1,n.getModel().updateDevice(),n.setZoom(100),n.setCoords(0,0),h.overflowY="hidden",L(!0),e.off(o.events.select,I),e.off($.zoom,M),e.off(E,N),O(),t.run("studio:canvasReload")})}),Q({editor:e,licenseKey:c.licenseKey,plan:te,pluginName:k,cleanup:()=>{e.runCommand(A)}})},se=J(ne);module.exports=se;
|
|
@@ -14,9 +14,9 @@ function F(e, a, n) {
|
|
|
14
14
|
t && (m = e.apply(c, o), c = o = null, clearTimeout(t), t = null);
|
|
15
15
|
}, s;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const z = "app.grapesjs.com", R = "app-stage.grapesjs.com", U = [
|
|
18
|
+
z,
|
|
18
19
|
R,
|
|
19
|
-
U,
|
|
20
20
|
"localhost",
|
|
21
21
|
"127.0.0.1",
|
|
22
22
|
".local-credentialless.webcontainer.io",
|
|
@@ -25,11 +25,11 @@ const R = "app.grapesjs.com", U = "app-stage.grapesjs.com", z = [
|
|
|
25
25
|
// For stackblitz.com demos
|
|
26
26
|
"-sandpack.codesandbox.io"
|
|
27
27
|
// For Sandpack demos
|
|
28
|
-
], q = "license:check:start",
|
|
29
|
-
const e =
|
|
30
|
-
return !!e && (
|
|
28
|
+
], q = "license:check:start", G = "license:check:end", V = () => typeof window < "u", X = ({ isDev: e, isStage: a }) => `${e ? "" : `https://${a ? R : z}`}/api`, Y = () => {
|
|
29
|
+
const e = V() && window.location.hostname;
|
|
30
|
+
return !!e && (U.includes(e) || U.some((a) => e.endsWith(a)));
|
|
31
31
|
};
|
|
32
|
-
async function
|
|
32
|
+
async function B({
|
|
33
33
|
path: e,
|
|
34
34
|
baseApiUrl: a,
|
|
35
35
|
method: n = "GET",
|
|
@@ -37,7 +37,7 @@ async function G({
|
|
|
37
37
|
params: o,
|
|
38
38
|
body: c
|
|
39
39
|
}) {
|
|
40
|
-
const m = `${a ||
|
|
40
|
+
const m = `${a || X({ isDev: !1, isStage: !1 })}${e}`, r = {
|
|
41
41
|
method: n,
|
|
42
42
|
headers: {
|
|
43
43
|
"Content-Type": "application/json",
|
|
@@ -51,7 +51,7 @@ async function G({
|
|
|
51
51
|
return l.json();
|
|
52
52
|
}
|
|
53
53
|
var b = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(b || {});
|
|
54
|
-
const
|
|
54
|
+
const W = {
|
|
55
55
|
[b.free]: 0,
|
|
56
56
|
[b.startup]: 10,
|
|
57
57
|
[b.business]: 20,
|
|
@@ -70,7 +70,7 @@ async function Q({
|
|
|
70
70
|
cleanup: o
|
|
71
71
|
}) {
|
|
72
72
|
let c = "", p = !1;
|
|
73
|
-
const m =
|
|
73
|
+
const m = Y(), r = (s) => {
|
|
74
74
|
console.warn("Cleanup plugin:", n, "Reason:", s), o();
|
|
75
75
|
}, u = (s = {}) => {
|
|
76
76
|
var C;
|
|
@@ -78,13 +78,13 @@ async function Q({
|
|
|
78
78
|
if (!(D || s.license) || l)
|
|
79
79
|
r(l || "Invalid license");
|
|
80
80
|
else if (v) {
|
|
81
|
-
const E =
|
|
81
|
+
const E = W[a], S = W[v];
|
|
82
82
|
E > S && r({ pluginRequiredPlan: a, licensePlan: v });
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
e.on(q, (s) => {
|
|
86
86
|
c = s == null ? void 0 : s.baseApiUrl, p = !0;
|
|
87
|
-
}), e.on(
|
|
87
|
+
}), e.on(G, (s) => {
|
|
88
88
|
u(s);
|
|
89
89
|
}), setTimeout(async () => {
|
|
90
90
|
if (!p) {
|
|
@@ -100,7 +100,7 @@ async function Q({
|
|
|
100
100
|
async function ee(e) {
|
|
101
101
|
const { licenseKey: a, pluginName: n, baseApiUrl: t } = e;
|
|
102
102
|
try {
|
|
103
|
-
return (await
|
|
103
|
+
return (await B({
|
|
104
104
|
baseApiUrl: t,
|
|
105
105
|
path: `/sdk/${a || "na"}`,
|
|
106
106
|
method: "POST",
|
|
@@ -113,7 +113,7 @@ async function ee(e) {
|
|
|
113
113
|
return console.error("Error during SDK license check:", o), !1;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
const
|
|
116
|
+
const k = "canvasFullSize", te = b.startup, ne = function(e, a = {}) {
|
|
117
117
|
const { Canvas: n, Commands: t, Devices: o } = e, c = {
|
|
118
118
|
deviceMaxWidth: 1200,
|
|
119
119
|
deviceMinHeigth: 500,
|
|
@@ -131,7 +131,7 @@ const P = "canvasFullSize", te = function(e, a = {}) {
|
|
|
131
131
|
deviceMinHeigth: s,
|
|
132
132
|
frameBorderRadius: l,
|
|
133
133
|
frameTransition: D
|
|
134
|
-
} = c, v = `${s}px`, $ = n.events, C = "core:preview", E = `${t.events.stopCommand}${C}`, S = n.getConfig(), A = `${
|
|
134
|
+
} = c, v = `${s}px`, $ = n.events, C = "core:preview", E = `${t.events.stopCommand}${C}`, S = n.getConfig(), A = `${k}:disable`, _ = o.getAll().map((i) => ({ ...i.attributes }));
|
|
135
135
|
S.scrollableCanvas = !0, o.getAll().map((i) => {
|
|
136
136
|
!i.get("width") && i.set("width", `${u}px`), !i.get("height") && i.set("height", "auto"), !i.get("minHeight") && i.set("minHeight", v);
|
|
137
137
|
});
|
|
@@ -165,40 +165,40 @@ const P = "canvasFullSize", te = function(e, a = {}) {
|
|
|
165
165
|
ignoreHeight: !0,
|
|
166
166
|
gap: y
|
|
167
167
|
}), L(), setTimeout(() => {
|
|
168
|
-
var
|
|
168
|
+
var P, x;
|
|
169
169
|
const { em: g } = e;
|
|
170
|
-
g.destroyed || ((
|
|
170
|
+
g.destroyed || ((x = (P = e.getSelected()) == null ? void 0 : P.getEl()) == null || x.scrollIntoView({ block: "nearest" }), e.refresh({ tools: !0 }), K(), t.isActive(C) ? g.stopDefault() : g.runDefault());
|
|
171
171
|
}, f);
|
|
172
172
|
}, 100), j = new ResizeObserver(() => {
|
|
173
173
|
H(), T();
|
|
174
174
|
});
|
|
175
175
|
j.observe(w.parentElement);
|
|
176
|
-
const
|
|
176
|
+
const I = () => {
|
|
177
177
|
H(), T();
|
|
178
|
-
},
|
|
178
|
+
}, M = (g = {}) => {
|
|
179
179
|
g.options && g.options.from !== "fitViewport" && n.fitViewport({
|
|
180
180
|
zoom: n.getZoom(),
|
|
181
181
|
ignoreHeight: !0,
|
|
182
182
|
gap: y
|
|
183
183
|
});
|
|
184
|
-
},
|
|
184
|
+
}, N = () => {
|
|
185
185
|
h.overflowX = "hidden", h.overflowY = "auto";
|
|
186
|
-
},
|
|
186
|
+
}, O = () => {
|
|
187
187
|
j.disconnect(), T.clear();
|
|
188
188
|
};
|
|
189
|
-
e.on(o.events.select,
|
|
190
|
-
o.devices.reset(_), S.scrollableCanvas = !1, n.getModel().updateDevice(), n.setZoom(100), n.setCoords(0, 0), h.overflowY = "hidden", L(!0), e.off(o.events.select,
|
|
189
|
+
e.on(o.events.select, I), e.on($.zoom, M), e.on(E, N), e.on(e.events.destroy, O), T(), t.add(A, () => {
|
|
190
|
+
o.devices.reset(_), S.scrollableCanvas = !1, n.getModel().updateDevice(), n.setZoom(100), n.setCoords(0, 0), h.overflowY = "hidden", L(!0), e.off(o.events.select, I), e.off($.zoom, M), e.off(E, N), O(), t.run("studio:canvasReload");
|
|
191
191
|
});
|
|
192
192
|
}), Q({
|
|
193
193
|
editor: e,
|
|
194
194
|
licenseKey: c.licenseKey,
|
|
195
|
-
plan:
|
|
196
|
-
pluginName:
|
|
195
|
+
plan: te,
|
|
196
|
+
pluginName: k,
|
|
197
197
|
cleanup: () => {
|
|
198
198
|
e.runCommand(A);
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
|
-
},
|
|
201
|
+
}, se = J(ne);
|
|
202
202
|
export {
|
|
203
|
-
|
|
203
|
+
se as default
|
|
204
204
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(C,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(C=typeof globalThis<"u"?globalThis:C||self,C.StudioSdkPlugins_canvasFullSize=b())})(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 b="app.grapesjs.com",x="app-stage.grapesjs.com",H=[b,x,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],F="license:check:start",K="license:check:end",q=()=>typeof window<"u",
|
|
1
|
+
(function(C,b){typeof exports=="object"&&typeof module<"u"?module.exports=b():typeof define=="function"&&define.amd?define(b):(C=typeof globalThis<"u"?globalThis:C||self,C.StudioSdkPlugins_canvasFullSize=b())})(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 b="app.grapesjs.com",x="app-stage.grapesjs.com",H=[b,x,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],F="license:check:start",K="license:check:end",q=()=>typeof window<"u",G=({isDev:e,isStage:i})=>`${e?"":`https://${i?x:b}`}/api`,V=()=>{const e=q()&&window.location.hostname;return!!e&&(H.includes(e)||H.some(i=>e.endsWith(i)))};async function X({path:e,baseApiUrl:i,method:n="GET",headers:t={},params:o,body:c}){const d=`${i||G({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 S=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(S||{});const P={[S.free]:0,[S.startup]:10,[S.business]:20,[S.enterprise]:30};function Y(e){const i=e;return i.init=n=>t=>e(t,n),i}const B=e=>Y(e);async function Z({editor:e,plan:i,pluginName:n,licenseKey:t,cleanup:o}){let c="",p=!1;const d=V(),r=s=>{console.warn("Cleanup plugin:",n,"Reason:",s),o()},u=(s={})=>{var T;const{error:l,sdkLicense:A}=s,v=(T=s.plan)==null?void 0:T.category;if(!(A||s.license)||l)r(l||"Invalid license");else if(v){const D=P[i],$=P[v];D>$&&r({pluginRequiredPlan:i,licensePlan:v})}};e.on(F,s=>{c=s==null?void 0:s.baseApiUrl,p=!0}),e.on(K,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:i,pluginName:n,baseApiUrl:t}=e;try{return(await X({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 I="canvasFullSize",Q=S.startup;return B(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:A}=c,v=`${s}px`,E=n.events,T="core:preview",D=`${t.events.stopCommand}${T}`,$=n.getConfig(),M=`${I}:disable`,ee=o.getAll().map(a=>({...a.attributes}));$.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",v)});const j=a=>{const y="data-gs-plg-full-size",f=document.querySelector(`style[${y}]`);if(a&&f)return f.remove();const m=f||document.createElement("style"),h=n.getZoomMultiplier();m.setAttribute(y,"true"),m.innerHTML=`
|
|
2
2
|
.gjs-frame-wrapper { transition: width ${A}s !important; }
|
|
3
3
|
.gjs-frame-wrapper__bottom { height: ${p*h}px }
|
|
4
4
|
.gjs-frame { border-radius: ${l}px }
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
[data-gjs-type="wrapper"] { min-height: ${v}; }
|
|
7
7
|
[data-gjs-type="mjml"] { min-height: ${v} !important; }
|
|
8
8
|
[data-gjs-type="mj-body"] { min-height: ${v} !important; }
|
|
9
|
-
`,!m.contains(w)&&m.appendChild(w)}),e.onReady(()=>{const a=n.getSpotsEl(),y=n.getElement(),f=n.getFramesEl(),m=r*1e3,h=y.style;h.overflowX="hidden",f.style.transition=`transform ${r}s`;const w={x:d,y:p};j();const
|
|
9
|
+
`,!m.contains(w)&&m.appendChild(w)}),e.onReady(()=>{const a=n.getSpotsEl(),y=n.getElement(),f=n.getFramesEl(),m=r*1e3,h=y.style;h.overflowX="hidden",f.style.transition=`transform ${r}s`;const w={x:d,y:p};j();const N=()=>a.style.display="none",te=()=>a.style.display="",L=C(()=>{n.fitViewport({zoom:g=>g>100?100:g,ignoreHeight:!0,gap:w}),j(),setTimeout(()=>{var _,R;const{em:g}=e;g.destroyed||((R=(_=e.getSelected())==null?void 0:_.getEl())==null||R.scrollIntoView({block:"nearest"}),e.refresh({tools:!0}),te(),t.isActive(T)?g.stopDefault():g.runDefault())},m)},100),O=new ResizeObserver(()=>{N(),L()});O.observe(y.parentElement);const k=()=>{N(),L()},z=(g={})=>{g.options&&g.options.from!=="fitViewport"&&n.fitViewport({zoom:n.getZoom(),ignoreHeight:!0,gap:w})},U=()=>{h.overflowX="hidden",h.overflowY="auto"},W=()=>{O.disconnect(),L.clear()};e.on(o.events.select,k),e.on(E.zoom,z),e.on(D,U),e.on(e.events.destroy,W),L(),t.add(M,()=>{o.devices.reset(ee),$.scrollableCanvas=!1,n.getModel().updateDevice(),n.setZoom(100),n.setCoords(0,0),h.overflowY="hidden",j(!0),e.off(o.events.select,k),e.off(E.zoom,z),e.off(D,U),W(),t.run("studio:canvasReload")})}),Z({editor:e,licenseKey:c.licenseKey,plan:Q,pluginName:I,cleanup:()=>{e.runCommand(M)}})})});
|