@grapesjs/studio-sdk-plugins 1.0.10 → 1.0.11
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/dialogComponent/index.cjs.js +2 -2
- package/dist/dialogComponent/index.es.js +4 -3
- package/dist/dialogComponent/index.umd.js +7 -7
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +4 -3
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +59 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +3891 -2910
- package/dist/index.umd.js +66 -22
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +21 -20
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/listPagesComponent/index.cjs.js +4 -4
- package/dist/listPagesComponent/index.es.js +4 -3
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +4 -2
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/swiperComponent/components/Swiper.d.ts +12 -0
- package/dist/swiperComponent/components/SwiperNavigation.d.ts +7 -0
- package/dist/swiperComponent/components/SwiperPagination.d.ts +3 -0
- package/dist/swiperComponent/components/SwiperScrollbar.d.ts +5 -0
- package/dist/swiperComponent/components/SwiperSlide.d.ts +5 -0
- package/dist/swiperComponent/components/SwiperWrapper.d.ts +5 -0
- package/dist/swiperComponent/index.cjs.d.ts +3 -0
- package/dist/swiperComponent/index.cjs.js +45 -0
- package/dist/swiperComponent/index.d.ts +3 -0
- package/dist/swiperComponent/index.es.d.ts +3 -0
- package/dist/swiperComponent/index.es.js +1082 -0
- package/dist/swiperComponent/index.umd.js +45 -0
- package/dist/swiperComponent/types.d.ts +13 -0
- package/dist/swiperComponent/typesSchema.d.ts +19 -0
- package/dist/swiperComponent/utils.d.ts +23 -0
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +4 -3
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/utils.d.ts +36 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const C="app.grapesjs.com",O="app-stage.grapesjs.com",L=[C,O,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",j="license:check:end",_=()=>typeof window<"u",N=({isDev:n,isStage:l})=>`${n?"":`https://${l?O:C}`}/api`,$=()=>{const n=_()&&window.location.hostname;return!!n&&(L.includes(n)||L.some(l=>n.endsWith(l)))};var f=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(f||{});async function D({path:n,baseApiUrl:l,method:a="GET",headers:t={},params:p,body:s}){const u=`${l||N({isDev:!1,isStage:!1})}${n}`,i={method:a,headers:{"Content-Type":"application/json",...t}};s&&(i.body=JSON.stringify(s));const c=p?new URLSearchParams(p).toString():"",o=c?`?${c}`:"",r=await fetch(`${u}${o}`,i);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}const P={[f.free]:0,[f.startup]:10,[f.business]:20,[f.enterprise]:30};function
|
|
1
|
+
"use strict";require("grapesjs");const C="app.grapesjs.com",O="app-stage.grapesjs.com",L=[C,O,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",j="license:check:end",_=()=>typeof window<"u",N=({isDev:n,isStage:l})=>`${n?"":`https://${l?O:C}`}/api`,$=()=>{const n=_()&&window.location.hostname;return!!n&&(L.includes(n)||L.some(l=>n.endsWith(l)))};var f=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(f||{});async function D({path:n,baseApiUrl:l,method:a="GET",headers:t={},params:p,body:s}){const u=`${l||N({isDev:!1,isStage:!1})}${n}`,i={method:a,headers:{"Content-Type":"application/json",...t}};s&&(i.body=JSON.stringify(s));const c=p?new URLSearchParams(p).toString():"",o=c?`?${c}`:"",r=await fetch(`${u}${o}`,i);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}const P={[f.free]:0,[f.startup]:10,[f.business]:20,[f.enterprise]:30};function q(n){const l=n;return l.init=a=>t=>n(t,a),l}const A=n=>q(n);async function U({editor:n,plan:l,pluginName:a,licenseKey:t,cleanup:p}){let s="",g=!1;const u=$(),i=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),p()},c=(o={})=>{var e;const{error:r,sdkLicense:m}=o,W=(e=o.plan)==null?void 0:e.category;if(!(m||o.license)||r)i(r||"Invalid license");else if(W){const w=P[l],E=P[W];w>E&&i({pluginRequiredPlan:l,licensePlan:W})}};n.on(S,o=>{s=o==null?void 0:o.baseApiUrl,g=!0}),n.on(j,o=>{c(o)}),setTimeout(async()=>{if(!g){if(u)return;if(t){const o=await X({licenseKey:t,pluginName:a,baseApiUrl:s});o&&c(o)}else i("The `licenseKey` option not provided")}},2e3)}async function X(n){const{licenseKey:l,pluginName:a,baseApiUrl:t}=n;try{return(await D({baseApiUrl:t,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(p){return console.error("Error during SDK license check:",p),!1}}const T=(...n)=>n.map(l=>`[data-gjs-type="${l}"]`).join(","),I="dialogComponent",B=function(n,l={}){const{Blocks:a,Components:t}=n,{licenseKey:p}=l,s="gjs-plg-dialog",g="gjs-plg-dialog-overlay",u="gjs-plg-dialog-content",i="gjs-plg-dialog-close",c="gjs-plg-dialog-title",o="gjs-plg-dialog-body",r="gjs-plg-dialog-description",m="gjs-plg-dialog-placeholder";a.add(s,{label:"Dialog",media:`
|
|
2
2
|
<svg viewBox="0 0 24 24">
|
|
3
3
|
<path d="M4 4h16v10H8l-4 4V4z"></path>
|
|
4
4
|
</svg>
|
|
@@ -56,4 +56,4 @@
|
|
|
56
56
|
.${r} {
|
|
57
57
|
margin: 0;
|
|
58
58
|
}
|
|
59
|
-
`}}}),t.addType(m,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:m,"data-type-role":m},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){this.listenTo(this.em,"run:core:preview",()=>{this.el.style.display="none"}),this.listenTo(this.em,"stop:core:preview",()=>{this.el.style.display=""})}}}),U({editor:n,licenseKey:p,plan:f.
|
|
59
|
+
`}}}),t.addType(m,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:m,"data-type-role":m},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){this.listenTo(this.em,"run:core:preview",()=>{this.el.style.display="none"}),this.listenTo(this.em,"stop:core:preview",()=>{this.el.style.display=""})}}}),U({editor:n,licenseKey:p,plan:f.startup,pluginName:I,cleanup:()=>{a.remove(s),t.removeType(s)}})},z=A(B);module.exports=z;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "grapesjs";
|
|
1
2
|
const C = "app.grapesjs.com", O = "app-stage.grapesjs.com", L = [
|
|
2
3
|
C,
|
|
3
4
|
O,
|
|
@@ -362,13 +363,13 @@ const T = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), I = "dialo
|
|
|
362
363
|
}), U({
|
|
363
364
|
editor: n,
|
|
364
365
|
licenseKey: p,
|
|
365
|
-
plan: f.
|
|
366
|
+
plan: f.startup,
|
|
366
367
|
pluginName: I,
|
|
367
368
|
cleanup: () => {
|
|
368
369
|
a.remove(s), t.removeType(s);
|
|
369
370
|
}
|
|
370
371
|
});
|
|
371
|
-
},
|
|
372
|
+
}, H = q(B);
|
|
372
373
|
export {
|
|
373
|
-
|
|
374
|
+
H as default
|
|
374
375
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(m,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(m=typeof globalThis<"u"?globalThis:m||self,m.StudioSdkPlugins_dialogComponent=v())})(this,function(){"use strict";const m="app.grapesjs.com",v="app-stage.grapesjs.com",P=[m,v,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",S="license:check:end",k=()=>typeof window<"u",j=({isDev:n,isStage:
|
|
1
|
+
(function(m,v){typeof exports=="object"&&typeof module<"u"?module.exports=v(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],v):(m=typeof globalThis<"u"?globalThis:m||self,m.StudioSdkPlugins_dialogComponent=v())})(this,function(){"use strict";const m="app.grapesjs.com",v="app-stage.grapesjs.com",P=[m,v,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",S="license:check:end",k=()=>typeof window<"u",j=({isDev:n,isStage:s})=>`${n?"":`https://${s?v:m}`}/api`,_=()=>{const n=k()&&window.location.hostname;return!!n&&(P.includes(n)||P.some(s=>n.endsWith(s)))};var b=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(b||{});async function N({path:n,baseApiUrl:s,method:a="GET",headers:t={},params:p,body:l}){const u=`${s||j({isDev:!1,isStage:!1})}${n}`,i={method:a,headers:{"Content-Type":"application/json",...t}};l&&(i.body=JSON.stringify(l));const c=p?new URLSearchParams(p).toString():"",o=c?`?${c}`:"",r=await fetch(`${u}${o}`,i);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}const C={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function $(n){const s=n;return s.init=a=>t=>n(t,a),s}const D=n=>$(n);async function q({editor:n,plan:s,pluginName:a,licenseKey:t,cleanup:p}){let l="",g=!1;const u=_(),i=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),p()},c=(o={})=>{var e;const{error:r,sdkLicense:W}=o,E=(e=o.plan)==null?void 0:e.category;if(!(W||o.license)||r)i(r||"Invalid license");else if(E){const L=C[s],T=C[E];L>T&&i({pluginRequiredPlan:s,licensePlan:E})}};n.on(O,o=>{l=o==null?void 0:o.baseApiUrl,g=!0}),n.on(S,o=>{c(o)}),setTimeout(async()=>{if(!g){if(u)return;if(t){const o=await A({licenseKey:t,pluginName:a,baseApiUrl:l});o&&c(o)}else i("The `licenseKey` option not provided")}},2e3)}async function A(n){const{licenseKey:s,pluginName:a,baseApiUrl:t}=n;try{return(await N({baseApiUrl:t,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(p){return console.error("Error during SDK license check:",p),!1}}const x=(...n)=>n.map(s=>`[data-gjs-type="${s}"]`).join(","),U="dialogComponent";return D(function(n,s={}){const{Blocks:a,Components:t}=n,{licenseKey:p}=s,l="gjs-plg-dialog",g="gjs-plg-dialog-overlay",u="gjs-plg-dialog-content",i="gjs-plg-dialog-close",c="gjs-plg-dialog-title",o="gjs-plg-dialog-body",r="gjs-plg-dialog-description",W="gjs-plg-dialog-placeholder";a.add(l,{label:"Dialog",media:`
|
|
2
2
|
<svg viewBox="0 0 24 24">
|
|
3
3
|
<path d="M4 4h16v10H8l-4 4V4z"></path>
|
|
4
4
|
</svg>
|
|
5
|
-
`,category:"Extra",content:{type:
|
|
6
|
-
.${
|
|
5
|
+
`,category:"Extra",content:{type:l},activate:!0,...s.block}),t.addType(l,{model:{defaults:{tagName:"div",attributes:{class:l,"data-type-role":l},components:[{type:g},{type:W}],draggable:x("wrapper"),droppable:x(l),styles:`
|
|
6
|
+
.${l} {
|
|
7
7
|
position: relative;
|
|
8
8
|
z-index: 1;
|
|
9
9
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
justify-content: center;
|
|
20
20
|
background-color: rgba(0, 0, 0, 0.5);
|
|
21
21
|
}
|
|
22
|
-
`}}}),t.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:[{type:
|
|
22
|
+
`}}}),t.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:[{type:i},{type:c},{type:o}],droppable:!1,draggable:!1,styles:`
|
|
23
23
|
.${u} {
|
|
24
24
|
position: relative;
|
|
25
25
|
background-color: #fff;
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
height: 600px;
|
|
31
31
|
box-sizing: border-box;
|
|
32
32
|
}
|
|
33
|
-
`}}}),t.addType(
|
|
34
|
-
.${
|
|
33
|
+
`}}}),t.addType(i,{model:{defaults:{tagName:"button",attributes:{class:i,"data-type-role":i},components:"×",droppable:!1,draggable:!1,styles:`
|
|
34
|
+
.${i} {
|
|
35
35
|
position: absolute;
|
|
36
36
|
top: 10px;
|
|
37
37
|
right: 10px;
|
|
@@ -56,4 +56,4 @@
|
|
|
56
56
|
.${r} {
|
|
57
57
|
margin: 0;
|
|
58
58
|
}
|
|
59
|
-
`}}}),t.addType(W,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:W,"data-type-role":W},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){this.listenTo(this.em,"run:core:preview",()=>{this.el.style.display="none"}),this.listenTo(this.em,"stop:core:preview",()=>{this.el.style.display=""})}}}),
|
|
59
|
+
`}}}),t.addType(W,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:W,"data-type-role":W},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){this.listenTo(this.em,"run:core:preview",()=>{this.el.style.display="none"}),this.listenTo(this.em,"stop:core:preview",()=>{this.el.style.display=""})}}}),q({editor:n,licenseKey:p,plan:b.startup,pluginName:U,cleanup:()=>{a.remove(l),t.removeType(l)}})})});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";const P="app.grapesjs.com",B="app-stage.grapesjs.com",N=[P,B,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],D="license:check:start",U="license:check:end",R=()=>typeof window<"u",W=({isDev:t,isStage:a})=>`${t?"":`https://${a?B:P}`}/api`,F=()=>{const t=R()&&window.location.hostname;return!!t&&(N.includes(t)||N.some(a=>t.endsWith(a)))};var x=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(x||{});async function K({path:t,baseApiUrl:a,method:r="GET",headers:c={},params:p,body:h}){const w=`${a||W({isDev:!1,isStage:!1})}${t}`,d={method:r,headers:{"Content-Type":"application/json",...c}};h&&(d.body=JSON.stringify(h));const m=p?new URLSearchParams(p).toString():"",n=m?`?${m}`:"",b=await fetch(`${w}${n}`,d);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}const O={[x.free]:0,[x.startup]:10,[x.business]:20,[x.enterprise]:30};function
|
|
1
|
+
"use strict";require("grapesjs");const P="app.grapesjs.com",B="app-stage.grapesjs.com",N=[P,B,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],D="license:check:start",U="license:check:end",R=()=>typeof window<"u",W=({isDev:t,isStage:a})=>`${t?"":`https://${a?B:P}`}/api`,F=()=>{const t=R()&&window.location.hostname;return!!t&&(N.includes(t)||N.some(a=>t.endsWith(a)))};var x=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(x||{});async function K({path:t,baseApiUrl:a,method:r="GET",headers:c={},params:p,body:h}){const w=`${a||W({isDev:!1,isStage:!1})}${t}`,d={method:r,headers:{"Content-Type":"application/json",...c}};h&&(d.body=JSON.stringify(h));const m=p?new URLSearchParams(p).toString():"",n=m?`?${m}`:"",b=await fetch(`${w}${n}`,d);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}const O={[x.free]:0,[x.startup]:10,[x.business]:20,[x.enterprise]:30};function q(t){const a=t;return a.init=r=>c=>t(c,r),a}const G=t=>q(t);async function Z({editor:t,plan:a,pluginName:r,licenseKey:c,cleanup:p}){let h="",g=!1;const w=F(),d=n=>{console.warn("Cleanup plugin:",r,"Reason:",n),p()},m=(n={})=>{var A;const{error:b,sdkLicense:l}=n,v=(A=n.plan)==null?void 0:A.category;if(!(l||n.license)||b)d(b||"Invalid license");else if(v){const E=O[a],$=O[v];E>$&&d({pluginRequiredPlan:a,licensePlan:v})}};t.on(D,n=>{h=n==null?void 0:n.baseApiUrl,g=!0}),t.on(U,n=>{m(n)}),setTimeout(async()=>{if(!g){if(w)return;if(c){const n=await z({licenseKey:c,pluginName:r,baseApiUrl:h});n&&m(n)}else d("The `licenseKey` option not provided")}},2e3)}async function z(t){const{licenseKey:a,pluginName:r,baseApiUrl:c}=t;try{return(await K({baseApiUrl:c,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:r}})).result||{}}catch(p){return console.error("Error during SDK license check:",p),!1}}const J="gjs-plg-",X="fsLightboxComponent",k="data-fslightbox",C="data-type",Y="fslightbox-open",T="fslightbox",S={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></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>'},Q=function(t,a={}){const{Blocks:r,Components:c}=t,p="Lightbox",h=`${J}${T}`,g={toolbarIconOpen:S.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...a},{block:w,toolbarIconOpen:d,defaultSrc:m}=g,n=function(s){const e=this,i="data-fslightbox",o=window,f=()=>{var H;const u=o.refreshFsLightbox;u==null||u();const j=e.getAttribute(i);if((H=o.fsLightboxInstances)==null||H[j],!o._isEditor)return;Array.from(document.querySelectorAll(`[${i}]`)).forEach(y=>{const L=y.onclick;y.onclick=function(I){I.preventDefault();const M=y;!M.__skipLb&&(L==null||L(I)),M.__skipLb=!0}})};if(o.refreshFsLightbox)f();else{const u=document.createElement("script");u.src=s.cdnScript,u.onload=f,document.head.appendChild(u)}},b=s=>({id:`${T}-open-lb`,label:d,command:()=>{const e=s.getView();e==null||e.toggleLightbox()}}),l="source-type",v={type:"radio",name:l,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:S.image},{id:"video",label:"Video",icon:S.video},{id:"el",label:"Custom Element",icon:S.external}],labelToTitle:!0},V={id:"href-image",name:"href",type:"file",label:"Source Image"},A={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},E={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},$={image:[V],video:[A],el:[E]};c.addType(T,{block:w&&{label:p,media:S.imageLightbox,category:"Extra",select:!0,...g.block},isComponent:s=>{var e;return(e=s.hasAttribute)==null?void 0:e.call(s,k)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:p,icon:S.imageLightbox,classes:h,draggable:(s,e)=>!e.is(T),attributes:{[k]:"lightbox",[C]:"image",href:m},components:{type:"image",src:m},script:n,cdnScript:g.cdnScript,"script-props":["attributes","cdnScript"],[l]:"image",traits:[v,{name:k,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(s,e){var o;const i=(o=e.target)==null?void 0:o.getView();i==null||i.toggleLightbox()}}],styles:`
|
|
2
2
|
.${h} {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
padding: 10px;
|
|
5
5
|
}
|
|
6
|
-
`},init(){const s=[l].map(e=>`change:${e}`).join(" ");this.on(s,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(s,e,i){if(i.adjust)return;const f=this.get(l)==="video"?"video":"image";this.addAttributes({[C]:f,href:""})},adjustSourceType(){const s=this.get(l),e=this.getAttributes().href||"",i={adjust:!0};if(s==="video"){const o=e.includes("youtube.com")?"youtube":"video";this.addAttributes({[C]:o},i)}else s!=="el"&&e.startsWith("#")?this.set(l,"el",i):s==="image"&&this.addAttributes({[C]:"image"},i)},updateTraits(s={}){const{changed:e}=this,{init:i}=s;if(e[v.name]||i){this.removeTrait([V.name,A.name,E.name]);const o=this.get(l)||"image",f=this.getTraitIndex(l)+1;this.addTrait($[o],{at:f})}},initToolbar(){if(!d)return;const{toolbar:s}=this,e=b(this);!s.find(o=>o.id===e.id)&&(s==null||s.unshift(e))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var y;const{em:s,el:e,model:i}=this,{Canvas:o}=s,f=i.getAttributes()[k],{defaultView:u,documentElement:j}=e.ownerDocument,_=(y=u.fsLightboxInstances)==null?void 0:y[f];if(j.classList.contains(Y))_.close();else{e.__skipLb=!1;let L;_.props.onOpen=()=>{L=o.getSpots(),setTimeout(()=>o.removeSpots())},_.props.onClose=()=>{L.forEach(I=>o.addSpot(I.attributes))},e.click()}}}}),
|
|
6
|
+
`},init(){const s=[l].map(e=>`change:${e}`).join(" ");this.on(s,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(s,e,i){if(i.adjust)return;const f=this.get(l)==="video"?"video":"image";this.addAttributes({[C]:f,href:""})},adjustSourceType(){const s=this.get(l),e=this.getAttributes().href||"",i={adjust:!0};if(s==="video"){const o=e.includes("youtube.com")?"youtube":"video";this.addAttributes({[C]:o},i)}else s!=="el"&&e.startsWith("#")?this.set(l,"el",i):s==="image"&&this.addAttributes({[C]:"image"},i)},updateTraits(s={}){const{changed:e}=this,{init:i}=s;if(e[v.name]||i){this.removeTrait([V.name,A.name,E.name]);const o=this.get(l)||"image",f=this.getTraitIndex(l)+1;this.addTrait($[o],{at:f})}},initToolbar(){if(!d)return;const{toolbar:s}=this,e=b(this);!s.find(o=>o.id===e.id)&&(s==null||s.unshift(e))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var y;const{em:s,el:e,model:i}=this,{Canvas:o}=s,f=i.getAttributes()[k],{defaultView:u,documentElement:j}=e.ownerDocument,_=(y=u.fsLightboxInstances)==null?void 0:y[f];if(j.classList.contains(Y))_.close();else{e.__skipLb=!1;let L;_.props.onOpen=()=>{L=o.getSpots(),setTimeout(()=>o.removeSpots())},_.props.onClose=()=>{L.forEach(I=>o.addSpot(I.attributes))},e.click()}}}}),Z({editor:t,plan:x.startup,licenseKey:g.licenseKey,pluginName:X,cleanup:()=>{r.remove(T),c.removeType(T)}})},ee=G(Q);module.exports=ee;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "grapesjs";
|
|
1
2
|
const P = "app.grapesjs.com", B = "app-stage.grapesjs.com", N = [
|
|
2
3
|
P,
|
|
3
4
|
B,
|
|
@@ -276,14 +277,14 @@ const J = "gjs-plg-", X = "fsLightboxComponent", k = "data-fslightbox", C = "dat
|
|
|
276
277
|
}
|
|
277
278
|
}), q({
|
|
278
279
|
editor: t,
|
|
279
|
-
plan: x.
|
|
280
|
+
plan: x.startup,
|
|
280
281
|
licenseKey: g.licenseKey,
|
|
281
282
|
pluginName: X,
|
|
282
283
|
cleanup: () => {
|
|
283
284
|
r.remove(T), c.removeType(T);
|
|
284
285
|
}
|
|
285
286
|
});
|
|
286
|
-
},
|
|
287
|
+
}, te = Z(Q);
|
|
287
288
|
export {
|
|
288
|
-
|
|
289
|
+
te as default
|
|
289
290
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(v,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_fsLightboxComponent=y())})(this,function(){"use strict";const v="app.grapesjs.com",y="app-stage.grapesjs.com",O=[v,y,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],D="license:check:start",U="license:check:end",R=()=>typeof window<"u",W=({isDev:t,isStage:a})=>`${t?"":`https://${a?y:v}`}/api`,F=()=>{const t=R()&&window.location.hostname;return!!t&&(O.includes(t)||O.some(a=>t.endsWith(a)))};var T=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(T||{});async function K({path:t,baseApiUrl:a,method:r="GET",headers:c={},params:
|
|
1
|
+
(function(v,y){typeof exports=="object"&&typeof module<"u"?module.exports=y(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],y):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_fsLightboxComponent=y())})(this,function(){"use strict";const v="app.grapesjs.com",y="app-stage.grapesjs.com",O=[v,y,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],D="license:check:start",U="license:check:end",R=()=>typeof window<"u",W=({isDev:t,isStage:a})=>`${t?"":`https://${a?y:v}`}/api`,F=()=>{const t=R()&&window.location.hostname;return!!t&&(O.includes(t)||O.some(a=>t.endsWith(a)))};var T=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(T||{});async function K({path:t,baseApiUrl:a,method:r="GET",headers:c={},params:p,body:h}){const E=`${a||W({isDev:!1,isStage:!1})}${t}`,d={method:r,headers:{"Content-Type":"application/json",...c}};h&&(d.body=JSON.stringify(h));const m=p?new URLSearchParams(p).toString():"",s=m?`?${m}`:"",b=await fetch(`${E}${s}`,d);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}const P={[T.free]:0,[T.startup]:10,[T.business]:20,[T.enterprise]:30};function q(t){const a=t;return a.init=r=>c=>t(c,r),a}const G=t=>q(t);async function Z({editor:t,plan:a,pluginName:r,licenseKey:c,cleanup:p}){let h="",g=!1;const E=F(),d=s=>{console.warn("Cleanup plugin:",r,"Reason:",s),p()},m=(s={})=>{var _;const{error:b,sdkLicense:l}=s,x=(_=s.plan)==null?void 0:_.category;if(!(l||s.license)||b)d(b||"Invalid license");else if(x){const C=P[a],H=P[x];C>H&&d({pluginRequiredPlan:a,licensePlan:x})}};t.on(D,s=>{h=s==null?void 0:s.baseApiUrl,g=!0}),t.on(U,s=>{m(s)}),setTimeout(async()=>{if(!g){if(E)return;if(c){const s=await z({licenseKey:c,pluginName:r,baseApiUrl:h});s&&m(s)}else d("The `licenseKey` option not provided")}},2e3)}async function z(t){const{licenseKey:a,pluginName:r,baseApiUrl:c}=t;try{return(await K({baseApiUrl:c,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:r}})).result||{}}catch(p){return console.error("Error during SDK license check:",p),!1}}const J="gjs-plg-",X="fsLightboxComponent",k="data-fslightbox",I="data-type",Y="fslightbox-open",L="fslightbox",S={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></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>'};return G(function(t,a={}){const{Blocks:r,Components:c}=t,p="Lightbox",h=`${J}${L}`,g={toolbarIconOpen:S.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...a},{block:E,toolbarIconOpen:d,defaultSrc:m}=g,s=function(n){const e=this,i="data-fslightbox",o=window,f=()=>{var N;const u=o.refreshFsLightbox;u==null||u();const M=e.getAttribute(i);if((N=o.fsLightboxInstances)==null||N[M],!o._isEditor)return;Array.from(document.querySelectorAll(`[${i}]`)).forEach(w=>{const A=w.onclick;w.onclick=function(V){V.preventDefault();const B=w;!B.__skipLb&&(A==null||A(V)),B.__skipLb=!0}})};if(o.refreshFsLightbox)f();else{const u=document.createElement("script");u.src=n.cdnScript,u.onload=f,document.head.appendChild(u)}},b=n=>({id:`${L}-open-lb`,label:d,command:()=>{const e=n.getView();e==null||e.toggleLightbox()}}),l="source-type",x={type:"radio",name:l,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:S.image},{id:"video",label:"Video",icon:S.video},{id:"el",label:"Custom Element",icon:S.external}],labelToTitle:!0},$={id:"href-image",name:"href",type:"file",label:"Source Image"},_={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},C={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},H={image:[$],video:[_],el:[C]};c.addType(L,{block:E&&{label:p,media:S.imageLightbox,category:"Extra",select:!0,...g.block},isComponent:n=>{var e;return(e=n.hasAttribute)==null?void 0:e.call(n,k)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:p,icon:S.imageLightbox,classes:h,draggable:(n,e)=>!e.is(L),attributes:{[k]:"lightbox",[I]:"image",href:m},components:{type:"image",src:m},script:s,cdnScript:g.cdnScript,"script-props":["attributes","cdnScript"],[l]:"image",traits:[x,{name:k,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(n,e){var o;const i=(o=e.target)==null?void 0:o.getView();i==null||i.toggleLightbox()}}],styles:`
|
|
2
2
|
.${h} {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
padding: 10px;
|
|
5
5
|
}
|
|
6
|
-
`},init(){const n=[l].map(e=>`change:${e}`).join(" ");this.on(n,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(n,e,i){if(i.adjust)return;const f=this.get(l)==="video"?"video":"image";this.addAttributes({[I]:f,href:""})},adjustSourceType(){const n=this.get(l),e=this.getAttributes().href||"",i={adjust:!0};if(n==="video"){const o=e.includes("youtube.com")?"youtube":"video";this.addAttributes({[I]:o},i)}else n!=="el"&&e.startsWith("#")?this.set(l,"el",i):n==="image"&&this.addAttributes({[I]:"image"},i)},updateTraits(n={}){const{changed:e}=this,{init:i}=n;if(e[x.name]||i){this.removeTrait([
|
|
6
|
+
`},init(){const n=[l].map(e=>`change:${e}`).join(" ");this.on(n,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(n,e,i){if(i.adjust)return;const f=this.get(l)==="video"?"video":"image";this.addAttributes({[I]:f,href:""})},adjustSourceType(){const n=this.get(l),e=this.getAttributes().href||"",i={adjust:!0};if(n==="video"){const o=e.includes("youtube.com")?"youtube":"video";this.addAttributes({[I]:o},i)}else n!=="el"&&e.startsWith("#")?this.set(l,"el",i):n==="image"&&this.addAttributes({[I]:"image"},i)},updateTraits(n={}){const{changed:e}=this,{init:i}=n;if(e[x.name]||i){this.removeTrait([$.name,_.name,C.name]);const o=this.get(l)||"image",f=this.getTraitIndex(l)+1;this.addTrait(H[o],{at:f})}},initToolbar(){if(!d)return;const{toolbar:n}=this,e=b(this);!n.find(o=>o.id===e.id)&&(n==null||n.unshift(e))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var w;const{em:n,el:e,model:i}=this,{Canvas:o}=n,f=i.getAttributes()[k],{defaultView:u,documentElement:M}=e.ownerDocument,j=(w=u.fsLightboxInstances)==null?void 0:w[f];if(M.classList.contains(Y))j.close();else{e.__skipLb=!1;let A;j.props.onOpen=()=>{A=o.getSpots(),setTimeout(()=>o.removeSpots())},j.props.onClose=()=>{A.forEach(V=>o.addSpot(V.attributes))},e.click()}}}}),Z({editor:t,plan:T.startup,licenseKey:g.licenseKey,pluginName:X,cleanup:()=>{r.remove(L),c.removeType(L)}})})});
|
package/dist/index.cjs.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { default as tableComponent } from './tableComponent';
|
|
|
3
3
|
export { default as listPagesComponent } from './listPagesComponent';
|
|
4
4
|
export { default as fsLightboxComponent } from './fsLightboxComponent';
|
|
5
5
|
export { default as lightGalleryComponent } from './lightGalleryComponent';
|
|
6
|
+
export { default as swiperComponent } from './swiperComponent';
|
|
6
7
|
export { default as rteProseMirror } from './prosemirror';
|