@grapesjs/studio-sdk-plugins 1.0.9 → 1.0.10

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/api.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- export declare function api({ path, method, headers, body }: {
1
+ export declare function api({ path, baseApiUrl, method, headers, params, body }: {
2
2
  path: string;
3
+ baseApiUrl?: string;
3
4
  method: RequestInit['method'];
4
5
  headers?: RequestInit['headers'];
5
6
  body?: RequestInit['body'];
7
+ params?: Record<string, any>;
6
8
  }): Promise<Record<string, any>>;
@@ -1,14 +1,14 @@
1
- "use strict";const b="app.grapesjs.com",w="app-stage.grapesjs.com",W=[b,w,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",k="license:check:end",L=()=>typeof window<"u",x=({isDev:n,isStage:t})=>`${n?"":`https://${t?w:b}`}/api`,_=()=>{const n=L()&&window.location.hostname;return!!n&&(W.includes(n)||W.some(t=>n.endsWith(t)))},j=()=>(L()&&window.location.hostname)===b;var N={};const D=N.NODE_ENV!=="production";async function $({path:n,method:t="GET",headers:l={},body:o}){const s=`${x({isDev:D,isStage:!j()})}${n}`,a={method:t,headers:{"Content-Type":"application/json",...l}};o&&(a.body=JSON.stringify(o));const i=await fetch(s,a);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.json()}function X(n){const t=n;return t.init=l=>o=>n(o,l),t}const q=n=>X(n);async function A({editor:n,pluginName:t,licenseKey:l,cleanup:o}){let g=!1;const s=_();n.on(S,()=>{g=!0}),n.on(k,({sdkLicense:a})=>{a||o()}),setTimeout(async()=>{if(!g){if(s)return;l&&await I({licenseKey:l,pluginName:t})||o()}},2e3)}async function I({licenseKey:n,pluginName:t}){try{const l=await $({path:`/sdk/${n}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:t})}),{license:o}=l.result||{};return!!o}catch(l){return console.error("Error during SDK license check:",l),!1}}const E=(...n)=>n.map(t=>`[data-gjs-type="${t}"]`).join(","),B="dialogComponent",U=function(n,t={}){const{Blocks:l,Components:o}=n,{licenseKey:g}=t,s="gjs-plg-dialog",a="gjs-plg-dialog-overlay",i="gjs-plg-dialog-content",h="gjs-plg-dialog-close",u="gjs-plg-dialog-title",y="gjs-plg-dialog-body",m="gjs-plg-dialog-description",f="gjs-plg-dialog-placeholder";l.add(s,{label:"Dialog",media:`
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 A(n){const l=n;return l.init=a=>t=>n(t,a),l}const q=n=>A(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>
5
- `,category:"Extra",content:{type:s},activate:!0,...t.block}),o.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:[{type:a},{type:f}],draggable:E("wrapper"),droppable:E(s),styles:`
5
+ `,category:"Extra",content:{type:s},activate:!0,...l.block}),t.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:[{type:g},{type:m}],draggable:T("wrapper"),droppable:T(s),styles:`
6
6
  .${s} {
7
7
  position: relative;
8
8
  z-index: 1;
9
9
  }
10
- `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(r){var e;(e=r.getSelected())==null||e.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(r){const e=this;function T(c){const p=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),d=e.querySelector('[data-type-role="gjs-plg-dialog-close"]');function v(){p.style.display="none"}c?(e._onCloseWhenPressingX=v,d.addEventListener("click",e._onCloseWhenPressingX)):(d.removeEventListener("click",e._onCloseWhenPressingX),e._onCloseWhenPressingX=null)}function C(c){const p=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function d(v){v.key==="Escape"&&(p.style.display="none")}c?(e._onCloseWhenPressingEsc=d,e.addEventListener("keydown",e._onCloseWhenPressingEsc)):(e.removeEventListener("keydown",e._onCloseWhenPressingEsc),e._onCloseWhenPressingEsc=null)}function P(c){const p=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function d(){p.style.display="flex"}c?(e._onOpenWhenLeavingWindow=d,document.addEventListener("mouseleave",e._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",e._onOpenWhenLeavingWindow),e._onOpenWhenLeavingWindow=null)}function O(c){const p=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function d(){const v=document.documentElement.scrollTop;c&&v>=Number(c)&&(p.style.display="flex")}c?(e._onOpenWhenScrollingToLevel=d,document.addEventListener("scroll",e._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",e._onOpenWhenScrollingToLevel),e._onOpenWhenScrollingToLevel=null)}T(r.closeWhenPressingX),C(r.closeWhenPressingEsc),P(r.openWhenLeavingWindow),O(r.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const e=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');e.style.display="flex"})}},view:{onActive(){const r=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');r.style.display="flex"}}}),o.addType(a,{model:{defaults:{tagName:"div",attributes:{class:a,"data-type-role":a},components:{type:i},droppable:!1,draggable:!1,styles:`
11
- .${a} {
10
+ `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(d){var e;(e=d.getSelected())==null||e.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(d){const e=this;function w(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),y=e.querySelector('[data-type-role="gjs-plg-dialog-close"]');function b(){v.style.display="none"}h?(e._onCloseWhenPressingX=b,y.addEventListener("click",e._onCloseWhenPressingX)):(y.removeEventListener("click",e._onCloseWhenPressingX),e._onCloseWhenPressingX=null)}function E(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(b){b.key==="Escape"&&(v.style.display="none")}h?(e._onCloseWhenPressingEsc=y,e.addEventListener("keydown",e._onCloseWhenPressingEsc)):(e.removeEventListener("keydown",e._onCloseWhenPressingEsc),e._onCloseWhenPressingEsc=null)}function x(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){v.style.display="flex"}h?(e._onOpenWhenLeavingWindow=y,document.addEventListener("mouseleave",e._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",e._onOpenWhenLeavingWindow),e._onOpenWhenLeavingWindow=null)}function k(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){const b=document.documentElement.scrollTop;h&&b>=Number(h)&&(v.style.display="flex")}h?(e._onOpenWhenScrollingToLevel=y,document.addEventListener("scroll",e._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",e._onOpenWhenScrollingToLevel),e._onOpenWhenScrollingToLevel=null)}w(d.closeWhenPressingX),E(d.closeWhenPressingEsc),x(d.openWhenLeavingWindow),k(d.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const e=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');e.style.display="flex"})}},view:{onActive(){const d=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');d.style.display="flex"}}}),t.addType(g,{model:{defaults:{tagName:"div",attributes:{class:g,"data-type-role":g},components:{type:u},droppable:!1,draggable:!1,styles:`
11
+ .${g} {
12
12
  position: fixed;
13
13
  top: 0;
14
14
  left: 0;
@@ -19,8 +19,8 @@
19
19
  justify-content: center;
20
20
  background-color: rgba(0, 0, 0, 0.5);
21
21
  }
22
- `}}}),o.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:[{type:h},{type:u},{type:y}],droppable:!1,draggable:!1,styles:`
23
- .${i} {
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
+ .${u} {
24
24
  position: relative;
25
25
  background-color: #fff;
26
26
  border-radius: 10px;
@@ -30,8 +30,8 @@
30
30
  height: 600px;
31
31
  box-sizing: border-box;
32
32
  }
33
- `}}}),o.addType(h,{model:{defaults:{tagName:"button",attributes:{class:h,"data-type-role":h},components:"&times;",droppable:!1,draggable:!1,styles:`
34
- .${h} {
33
+ `}}}),t.addType(i,{model:{defaults:{tagName:"button",attributes:{class:i,"data-type-role":i},components:"&times;",droppable:!1,draggable:!1,styles:`
34
+ .${i} {
35
35
  position: absolute;
36
36
  top: 10px;
37
37
  right: 10px;
@@ -42,18 +42,18 @@
42
42
  font-size: 20px;
43
43
  cursor: pointer;
44
44
  }
45
- `}}}),o.addType(u,{model:{defaults:{tagName:"h2",attributes:{class:u,"data-type-role":u},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
46
- .${u} {
45
+ `}}}),t.addType(c,{model:{defaults:{tagName:"h2",attributes:{class:c,"data-type-role":c},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
46
+ .${c} {
47
47
  margin: 0;
48
48
  padding: 0 40px 20px 0;
49
49
  }
50
- `}}}),o.addType(y,{model:{defaults:{tagName:"div",attributes:{class:y,"data-type-role":y},components:[{type:m}],styles:`
51
- .${y} {
50
+ `}}}),t.addType(o,{model:{defaults:{tagName:"div",attributes:{class:o,"data-type-role":o},components:[{type:r}],styles:`
51
+ .${o} {
52
52
  height: 90%;
53
53
  overflow: auto;
54
54
  }
55
- `}}}),o.addType(m,{model:{defaults:{tagName:"p",attributes:{class:m,"data-type-role":m},components:"This is a customizable dialog!",editable:!0,styles:`
56
- .${m} {
55
+ `}}}),t.addType(r,{model:{defaults:{tagName:"p",attributes:{class:r,"data-type-role":r},components:"This is a customizable dialog!",editable:!0,styles:`
56
+ .${r} {
57
57
  margin: 0;
58
58
  }
59
- `}}}),o.addType(f,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:f,"data-type-role":f},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=""})}}}),A({editor:n,licenseKey:g,pluginName:B,cleanup:()=>{l.remove(s),o.removeType(s)}})},z=q(U);module.exports=z;
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.free,pluginName:I,cleanup:()=>{a.remove(s),t.removeType(s)}})},z=q(B);module.exports=z;
@@ -1,6 +1,6 @@
1
- const b = "app.grapesjs.com", w = "app-stage.grapesjs.com", W = [
2
- b,
3
- w,
1
+ const C = "app.grapesjs.com", O = "app-stage.grapesjs.com", L = [
2
+ C,
3
+ O,
4
4
  "localhost",
5
5
  "127.0.0.1",
6
6
  ".local-credentialless.webcontainer.io",
@@ -9,73 +9,97 @@ const b = "app.grapesjs.com", w = "app-stage.grapesjs.com", W = [
9
9
  // For stackblitz.com demos
10
10
  "-sandpack.codesandbox.io"
11
11
  // For Sandpack demos
12
- ], S = "license:check:start", k = "license:check:end", L = () => typeof window < "u", x = ({ isDev: n, isStage: t }) => `${n ? "" : `https://${t ? w : b}`}/api`, _ = () => {
13
- const n = L() && window.location.hostname;
14
- return !!n && (W.includes(n) || W.some((t) => n.endsWith(t)));
15
- }, j = () => (L() && window.location.hostname) === b;
16
- var N = {};
17
- const D = N.NODE_ENV !== "production";
18
- async function $({
12
+ ], S = "license:check:start", j = "license:check:end", _ = () => typeof window < "u", N = ({ isDev: n, isStage: l }) => `${n ? "" : `https://${l ? O : C}`}/api`, $ = () => {
13
+ const n = _() && window.location.hostname;
14
+ return !!n && (L.includes(n) || L.some((l) => n.endsWith(l)));
15
+ };
16
+ var f = /* @__PURE__ */ ((n) => (n.free = "free", n.startup = "startup", n.business = "business", n.enterprise = "enterprise", n))(f || {});
17
+ async function D({
19
18
  path: n,
20
- method: t = "GET",
21
- headers: l = {},
22
- body: o
19
+ baseApiUrl: l,
20
+ method: a = "GET",
21
+ headers: t = {},
22
+ params: p,
23
+ body: s
23
24
  }) {
24
- const s = `${x({ isDev: D, isStage: !j() })}${n}`, a = {
25
- method: t,
25
+ const u = `${l || N({ isDev: !1, isStage: !1 })}${n}`, i = {
26
+ method: a,
26
27
  headers: {
27
28
  "Content-Type": "application/json",
28
- ...l
29
+ ...t
29
30
  }
30
31
  };
31
- o && (a.body = JSON.stringify(o));
32
- const i = await fetch(s, a);
33
- if (!i.ok)
34
- throw new Error(`HTTP error! status: ${i.status}`);
35
- return i.json();
32
+ s && (i.body = JSON.stringify(s));
33
+ const c = p ? new URLSearchParams(p).toString() : "", o = c ? `?${c}` : "", r = await fetch(`${u}${o}`, i);
34
+ if (!r.ok)
35
+ throw new Error(`HTTP error! status: ${r.status}`);
36
+ return r.json();
36
37
  }
37
- function X(n) {
38
- const t = n;
39
- return t.init = (l) => (o) => n(o, l), t;
38
+ const P = {
39
+ [f.free]: 0,
40
+ [f.startup]: 10,
41
+ [f.business]: 20,
42
+ [f.enterprise]: 30
43
+ };
44
+ function A(n) {
45
+ const l = n;
46
+ return l.init = (a) => (t) => n(t, a), l;
40
47
  }
41
- const q = (n) => /* @__PURE__ */ X(n);
42
- async function A({
48
+ const q = (n) => /* @__PURE__ */ A(n);
49
+ async function U({
43
50
  editor: n,
44
- pluginName: t,
45
- licenseKey: l,
46
- cleanup: o
51
+ plan: l,
52
+ pluginName: a,
53
+ licenseKey: t,
54
+ cleanup: p
47
55
  }) {
48
- let g = !1;
49
- const s = _();
50
- n.on(S, () => {
51
- g = !0;
52
- }), n.on(k, ({ sdkLicense: a }) => {
53
- a || o();
56
+ let s = "", g = !1;
57
+ const u = $(), i = (o) => {
58
+ console.warn("Cleanup plugin:", a, "Reason:", o), p();
59
+ }, c = (o = {}) => {
60
+ var e;
61
+ const { error: r, sdkLicense: m } = o, W = (e = o.plan) == null ? void 0 : e.category;
62
+ if (!(m || o.license) || r)
63
+ i(r || "Invalid license");
64
+ else if (W) {
65
+ const w = P[l], E = P[W];
66
+ w > E && i({ pluginRequiredPlan: l, licensePlan: W });
67
+ }
68
+ };
69
+ n.on(S, (o) => {
70
+ s = o == null ? void 0 : o.baseApiUrl, g = !0;
71
+ }), n.on(j, (o) => {
72
+ c(o);
54
73
  }), setTimeout(async () => {
55
74
  if (!g) {
56
- if (s) return;
57
- l && await I({ licenseKey: l, pluginName: t }) || o();
75
+ if (u) return;
76
+ if (t) {
77
+ const o = await X({ licenseKey: t, pluginName: a, baseApiUrl: s });
78
+ o && c(o);
79
+ } else
80
+ i("The `licenseKey` option not provided");
58
81
  }
59
82
  }, 2e3);
60
83
  }
61
- async function I({ licenseKey: n, pluginName: t }) {
84
+ async function X(n) {
85
+ const { licenseKey: l, pluginName: a, baseApiUrl: t } = n;
62
86
  try {
63
- const l = await $({
64
- path: `/sdk/${n}`,
87
+ return (await D({
88
+ baseApiUrl: t,
89
+ path: `/sdk/${l || "na"}`,
65
90
  method: "POST",
66
- body: JSON.stringify({
91
+ params: {
67
92
  d: window.location.hostname,
68
- pn: t
69
- })
70
- }), { license: o } = l.result || {};
71
- return !!o;
72
- } catch (l) {
73
- return console.error("Error during SDK license check:", l), !1;
93
+ pn: a
94
+ }
95
+ })).result || {};
96
+ } catch (p) {
97
+ return console.error("Error during SDK license check:", p), !1;
74
98
  }
75
99
  }
76
- const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialogComponent", U = function(n, t = {}) {
77
- const { Blocks: l, Components: o } = n, { licenseKey: g } = t, s = "gjs-plg-dialog", a = "gjs-plg-dialog-overlay", i = "gjs-plg-dialog-content", h = "gjs-plg-dialog-close", u = "gjs-plg-dialog-title", y = "gjs-plg-dialog-body", m = "gjs-plg-dialog-description", f = "gjs-plg-dialog-placeholder";
78
- l.add(s, {
100
+ const T = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), I = "dialogComponent", B = function(n, l = {}) {
101
+ 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";
102
+ a.add(s, {
79
103
  label: "Dialog",
80
104
  media: `
81
105
  <svg viewBox="0 0 24 24">
@@ -85,15 +109,15 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
85
109
  category: "Extra",
86
110
  content: { type: s },
87
111
  activate: !0,
88
- ...t.block
89
- }), o.addType(s, {
112
+ ...l.block
113
+ }), t.addType(s, {
90
114
  model: {
91
115
  defaults: {
92
116
  tagName: "div",
93
117
  attributes: { class: s, "data-type-role": s },
94
- components: [{ type: a }, { type: f }],
95
- draggable: E("wrapper"),
96
- droppable: E(s),
118
+ components: [{ type: g }, { type: m }],
119
+ draggable: T("wrapper"),
120
+ droppable: T(s),
97
121
  styles: `
98
122
  .${s} {
99
123
  position: relative;
@@ -106,9 +130,9 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
106
130
  label: "Open dialog",
107
131
  name: "onActive",
108
132
  changeProp: !0,
109
- command(r) {
133
+ command(d) {
110
134
  var e;
111
- (e = r.getSelected()) == null || e.trigger("active");
135
+ (e = d.getSelected()) == null || e.trigger("active");
112
136
  }
113
137
  },
114
138
  {
@@ -146,38 +170,38 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
146
170
  "openWhenLeavingWindow",
147
171
  "openWhenScrollingToLevel"
148
172
  ],
149
- script: function(r) {
173
+ script: function(d) {
150
174
  const e = this;
151
- function T(c) {
152
- const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'), d = e.querySelector('[data-type-role="gjs-plg-dialog-close"]');
153
- function v() {
154
- p.style.display = "none";
175
+ function w(h) {
176
+ const v = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'), y = e.querySelector('[data-type-role="gjs-plg-dialog-close"]');
177
+ function b() {
178
+ v.style.display = "none";
155
179
  }
156
- c ? (e._onCloseWhenPressingX = v, d.addEventListener("click", e._onCloseWhenPressingX)) : (d.removeEventListener("click", e._onCloseWhenPressingX), e._onCloseWhenPressingX = null);
180
+ h ? (e._onCloseWhenPressingX = b, y.addEventListener("click", e._onCloseWhenPressingX)) : (y.removeEventListener("click", e._onCloseWhenPressingX), e._onCloseWhenPressingX = null);
157
181
  }
158
- function C(c) {
159
- const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
160
- function d(v) {
161
- v.key === "Escape" && (p.style.display = "none");
182
+ function E(h) {
183
+ const v = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
184
+ function y(b) {
185
+ b.key === "Escape" && (v.style.display = "none");
162
186
  }
163
- c ? (e._onCloseWhenPressingEsc = d, e.addEventListener("keydown", e._onCloseWhenPressingEsc)) : (e.removeEventListener("keydown", e._onCloseWhenPressingEsc), e._onCloseWhenPressingEsc = null);
187
+ h ? (e._onCloseWhenPressingEsc = y, e.addEventListener("keydown", e._onCloseWhenPressingEsc)) : (e.removeEventListener("keydown", e._onCloseWhenPressingEsc), e._onCloseWhenPressingEsc = null);
164
188
  }
165
- function P(c) {
166
- const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
167
- function d() {
168
- p.style.display = "flex";
189
+ function x(h) {
190
+ const v = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
191
+ function y() {
192
+ v.style.display = "flex";
169
193
  }
170
- c ? (e._onOpenWhenLeavingWindow = d, document.addEventListener("mouseleave", e._onOpenWhenLeavingWindow)) : (document.removeEventListener("mouseleave", e._onOpenWhenLeavingWindow), e._onOpenWhenLeavingWindow = null);
194
+ h ? (e._onOpenWhenLeavingWindow = y, document.addEventListener("mouseleave", e._onOpenWhenLeavingWindow)) : (document.removeEventListener("mouseleave", e._onOpenWhenLeavingWindow), e._onOpenWhenLeavingWindow = null);
171
195
  }
172
- function O(c) {
173
- const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
174
- function d() {
175
- const v = document.documentElement.scrollTop;
176
- c && v >= Number(c) && (p.style.display = "flex");
196
+ function k(h) {
197
+ const v = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
198
+ function y() {
199
+ const b = document.documentElement.scrollTop;
200
+ h && b >= Number(h) && (v.style.display = "flex");
177
201
  }
178
- c ? (e._onOpenWhenScrollingToLevel = d, document.addEventListener("scroll", e._onOpenWhenScrollingToLevel)) : (document.removeEventListener("scroll", e._onOpenWhenScrollingToLevel), e._onOpenWhenScrollingToLevel = null);
202
+ h ? (e._onOpenWhenScrollingToLevel = y, document.addEventListener("scroll", e._onOpenWhenScrollingToLevel)) : (document.removeEventListener("scroll", e._onOpenWhenScrollingToLevel), e._onOpenWhenScrollingToLevel = null);
179
203
  }
180
- T(r.closeWhenPressingX), C(r.closeWhenPressingEsc), P(r.openWhenLeavingWindow), O(r.openWhenScrollingToLevel);
204
+ w(d.closeWhenPressingX), E(d.closeWhenPressingEsc), x(d.openWhenLeavingWindow), k(d.openWhenScrollingToLevel);
181
205
  }
182
206
  },
183
207
  init() {
@@ -196,20 +220,20 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
196
220
  },
197
221
  view: {
198
222
  onActive() {
199
- const r = this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
200
- r.style.display = "flex";
223
+ const d = this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
224
+ d.style.display = "flex";
201
225
  }
202
226
  }
203
- }), o.addType(a, {
227
+ }), t.addType(g, {
204
228
  model: {
205
229
  defaults: {
206
230
  tagName: "div",
207
- attributes: { class: a, "data-type-role": a },
208
- components: { type: i },
231
+ attributes: { class: g, "data-type-role": g },
232
+ components: { type: u },
209
233
  droppable: !1,
210
234
  draggable: !1,
211
235
  styles: `
212
- .${a} {
236
+ .${g} {
213
237
  position: fixed;
214
238
  top: 0;
215
239
  left: 0;
@@ -223,16 +247,16 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
223
247
  `
224
248
  }
225
249
  }
226
- }), o.addType(i, {
250
+ }), t.addType(u, {
227
251
  model: {
228
252
  defaults: {
229
253
  tagName: "div",
230
- attributes: { class: i, "data-type-role": i },
231
- components: [{ type: h }, { type: u }, { type: y }],
254
+ attributes: { class: u, "data-type-role": u },
255
+ components: [{ type: i }, { type: c }, { type: o }],
232
256
  droppable: !1,
233
257
  draggable: !1,
234
258
  styles: `
235
- .${i} {
259
+ .${u} {
236
260
  position: relative;
237
261
  background-color: #fff;
238
262
  border-radius: 10px;
@@ -245,16 +269,16 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
245
269
  `
246
270
  }
247
271
  }
248
- }), o.addType(h, {
272
+ }), t.addType(i, {
249
273
  model: {
250
274
  defaults: {
251
275
  tagName: "button",
252
- attributes: { class: h, "data-type-role": h },
276
+ attributes: { class: i, "data-type-role": i },
253
277
  components: "&times;",
254
278
  droppable: !1,
255
279
  draggable: !1,
256
280
  styles: `
257
- .${h} {
281
+ .${i} {
258
282
  position: absolute;
259
283
  top: 10px;
260
284
  right: 10px;
@@ -268,59 +292,59 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
268
292
  `
269
293
  }
270
294
  }
271
- }), o.addType(u, {
295
+ }), t.addType(c, {
272
296
  model: {
273
297
  defaults: {
274
298
  tagName: "h2",
275
- attributes: { class: u, "data-type-role": u },
299
+ attributes: { class: c, "data-type-role": c },
276
300
  components: "Dialog Title",
277
301
  editable: !0,
278
302
  droppable: !1,
279
303
  draggable: !1,
280
304
  styles: `
281
- .${u} {
305
+ .${c} {
282
306
  margin: 0;
283
307
  padding: 0 40px 20px 0;
284
308
  }
285
309
  `
286
310
  }
287
311
  }
288
- }), o.addType(y, {
312
+ }), t.addType(o, {
289
313
  model: {
290
314
  defaults: {
291
315
  tagName: "div",
292
- attributes: { class: y, "data-type-role": y },
293
- components: [{ type: m }],
316
+ attributes: { class: o, "data-type-role": o },
317
+ components: [{ type: r }],
294
318
  styles: `
295
- .${y} {
319
+ .${o} {
296
320
  height: 90%;
297
321
  overflow: auto;
298
322
  }
299
323
  `
300
324
  }
301
325
  }
302
- }), o.addType(m, {
326
+ }), t.addType(r, {
303
327
  model: {
304
328
  defaults: {
305
329
  tagName: "p",
306
- attributes: { class: m, "data-type-role": m },
330
+ attributes: { class: r, "data-type-role": r },
307
331
  components: "This is a customizable dialog!",
308
332
  editable: !0,
309
333
  styles: `
310
- .${m} {
334
+ .${r} {
311
335
  margin: 0;
312
336
  }
313
337
  `
314
338
  }
315
339
  }
316
- }), o.addType(f, {
340
+ }), t.addType(m, {
317
341
  model: {
318
342
  toHTML() {
319
343
  return "";
320
344
  },
321
345
  defaults: {
322
346
  tagName: "button",
323
- attributes: { class: f, "data-type-role": f },
347
+ attributes: { class: m, "data-type-role": m },
324
348
  components: "Dialog (click me to open)",
325
349
  droppable: !1,
326
350
  draggable: !1
@@ -335,15 +359,16 @@ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialo
335
359
  });
336
360
  }
337
361
  }
338
- }), A({
362
+ }), U({
339
363
  editor: n,
340
- licenseKey: g,
341
- pluginName: B,
364
+ licenseKey: p,
365
+ plan: f.free,
366
+ pluginName: I,
342
367
  cleanup: () => {
343
- l.remove(s), o.removeType(s);
368
+ a.remove(s), t.removeType(s);
344
369
  }
345
370
  });
346
- }, H = q(U);
371
+ }, z = q(B);
347
372
  export {
348
- H as default
373
+ z as default
349
374
  };
@@ -1,14 +1,14 @@
1
- (function(p,h){typeof exports=="object"&&typeof module<"u"?module.exports=h():typeof define=="function"&&define.amd?define(h):(p=typeof globalThis<"u"?globalThis:p||self,p.StudioSdkPlugins_dialogComponent=h())})(this,function(){"use strict";const p="app.grapesjs.com",h="app-stage.grapesjs.com",E=[p,h,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],C="license:check:start",L="license:check:end",w=()=>typeof window<"u",P=({isDev:n,isStage:t})=>`${n?"":`https://${t?h:p}`}/api`,S=()=>{const n=w()&&window.location.hostname;return!!n&&(E.includes(n)||E.some(t=>n.endsWith(t)))},O=()=>(w()&&window.location.hostname)===p;var k={};const x=k.NODE_ENV!=="production";async function _({path:n,method:t="GET",headers:l={},body:o}){const s=`${P({isDev:x,isStage:!O()})}${n}`,i={method:t,headers:{"Content-Type":"application/json",...l}};o&&(i.body=JSON.stringify(o));const a=await fetch(s,i);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}function j(n){const t=n;return t.init=l=>o=>n(o,l),t}const N=n=>j(n);async function D({editor:n,pluginName:t,licenseKey:l,cleanup:o}){let u=!1;const s=S();n.on(C,()=>{u=!0}),n.on(L,({sdkLicense:i})=>{i||o()}),setTimeout(async()=>{if(!u){if(s)return;l&&await $({licenseKey:l,pluginName:t})||o()}},2e3)}async function $({licenseKey:n,pluginName:t}){try{const l=await _({path:`/sdk/${n}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:t})}),{license:o}=l.result||{};return!!o}catch(l){return console.error("Error during SDK license check:",l),!1}}const T=(...n)=>n.map(t=>`[data-gjs-type="${t}"]`).join(","),X="dialogComponent";return N(function(n,t={}){const{Blocks:l,Components:o}=n,{licenseKey:u}=t,s="gjs-plg-dialog",i="gjs-plg-dialog-overlay",a="gjs-plg-dialog-content",y="gjs-plg-dialog-close",f="gjs-plg-dialog-title",m="gjs-plg-dialog-body",v="gjs-plg-dialog-description",W="gjs-plg-dialog-placeholder";l.add(s,{label:"Dialog",media:`
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:l})=>`${n?"":`https://${l?v:m}`}/api`,_=()=>{const n=k()&&window.location.hostname;return!!n&&(P.includes(n)||P.some(l=>n.endsWith(l)))};var b=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(b||{});async function N({path:n,baseApiUrl:l,method:i="GET",headers:t={},params:p,body:s}){const u=`${l||j({isDev:!1,isStage:!1})}${n}`,a={method:i,headers:{"Content-Type":"application/json",...t}};s&&(a.body=JSON.stringify(s));const c=p?new URLSearchParams(p).toString():"",o=c?`?${c}`:"",r=await fetch(`${u}${o}`,a);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 l=n;return l.init=i=>t=>n(t,i),l}const D=n=>$(n);async function A({editor:n,plan:l,pluginName:i,licenseKey:t,cleanup:p}){let s="",g=!1;const u=_(),a=o=>{console.warn("Cleanup plugin:",i,"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)a(r||"Invalid license");else if(E){const L=C[l],T=C[E];L>T&&a({pluginRequiredPlan:l,licensePlan:E})}};n.on(O,o=>{s=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 q({licenseKey:t,pluginName:i,baseApiUrl:s});o&&c(o)}else a("The `licenseKey` option not provided")}},2e3)}async function q(n){const{licenseKey:l,pluginName:i,baseApiUrl:t}=n;try{return(await N({baseApiUrl:t,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(p){return console.error("Error during SDK license check:",p),!1}}const x=(...n)=>n.map(l=>`[data-gjs-type="${l}"]`).join(","),U="dialogComponent";return D(function(n,l={}){const{Blocks:i,Components:t}=n,{licenseKey:p}=l,s="gjs-plg-dialog",g="gjs-plg-dialog-overlay",u="gjs-plg-dialog-content",a="gjs-plg-dialog-close",c="gjs-plg-dialog-title",o="gjs-plg-dialog-body",r="gjs-plg-dialog-description",W="gjs-plg-dialog-placeholder";i.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>
5
- `,category:"Extra",content:{type:s},activate:!0,...t.block}),o.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:[{type:i},{type:W}],draggable:T("wrapper"),droppable:T(s),styles:`
5
+ `,category:"Extra",content:{type:s},activate:!0,...l.block}),t.addType(s,{model:{defaults:{tagName:"div",attributes:{class:s,"data-type-role":s},components:[{type:g},{type:W}],draggable:x("wrapper"),droppable:x(s),styles:`
6
6
  .${s} {
7
7
  position: relative;
8
8
  z-index: 1;
9
9
  }
10
- `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(r){var e;(e=r.getSelected())==null||e.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(r){const e=this;function q(d){const g=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),c=e.querySelector('[data-type-role="gjs-plg-dialog-close"]');function b(){g.style.display="none"}d?(e._onCloseWhenPressingX=b,c.addEventListener("click",e._onCloseWhenPressingX)):(c.removeEventListener("click",e._onCloseWhenPressingX),e._onCloseWhenPressingX=null)}function A(d){const g=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function c(b){b.key==="Escape"&&(g.style.display="none")}d?(e._onCloseWhenPressingEsc=c,e.addEventListener("keydown",e._onCloseWhenPressingEsc)):(e.removeEventListener("keydown",e._onCloseWhenPressingEsc),e._onCloseWhenPressingEsc=null)}function I(d){const g=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function c(){g.style.display="flex"}d?(e._onOpenWhenLeavingWindow=c,document.addEventListener("mouseleave",e._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",e._onOpenWhenLeavingWindow),e._onOpenWhenLeavingWindow=null)}function B(d){const g=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function c(){const b=document.documentElement.scrollTop;d&&b>=Number(d)&&(g.style.display="flex")}d?(e._onOpenWhenScrollingToLevel=c,document.addEventListener("scroll",e._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",e._onOpenWhenScrollingToLevel),e._onOpenWhenScrollingToLevel=null)}q(r.closeWhenPressingX),A(r.closeWhenPressingEsc),I(r.openWhenLeavingWindow),B(r.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const e=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');e.style.display="flex"})}},view:{onActive(){const r=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');r.style.display="flex"}}}),o.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:{type:a},droppable:!1,draggable:!1,styles:`
11
- .${i} {
10
+ `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(d){var e;(e=d.getSelected())==null||e.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(d){const e=this;function L(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),y=e.querySelector('[data-type-role="gjs-plg-dialog-close"]');function w(){f.style.display="none"}h?(e._onCloseWhenPressingX=w,y.addEventListener("click",e._onCloseWhenPressingX)):(y.removeEventListener("click",e._onCloseWhenPressingX),e._onCloseWhenPressingX=null)}function T(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(w){w.key==="Escape"&&(f.style.display="none")}h?(e._onCloseWhenPressingEsc=y,e.addEventListener("keydown",e._onCloseWhenPressingEsc)):(e.removeEventListener("keydown",e._onCloseWhenPressingEsc),e._onCloseWhenPressingEsc=null)}function X(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){f.style.display="flex"}h?(e._onOpenWhenLeavingWindow=y,document.addEventListener("mouseleave",e._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",e._onOpenWhenLeavingWindow),e._onOpenWhenLeavingWindow=null)}function I(h){const f=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){const w=document.documentElement.scrollTop;h&&w>=Number(h)&&(f.style.display="flex")}h?(e._onOpenWhenScrollingToLevel=y,document.addEventListener("scroll",e._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",e._onOpenWhenScrollingToLevel),e._onOpenWhenScrollingToLevel=null)}L(d.closeWhenPressingX),T(d.closeWhenPressingEsc),X(d.openWhenLeavingWindow),I(d.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const e=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');e.style.display="flex"})}},view:{onActive(){const d=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');d.style.display="flex"}}}),t.addType(g,{model:{defaults:{tagName:"div",attributes:{class:g,"data-type-role":g},components:{type:u},droppable:!1,draggable:!1,styles:`
11
+ .${g} {
12
12
  position: fixed;
13
13
  top: 0;
14
14
  left: 0;
@@ -19,8 +19,8 @@
19
19
  justify-content: center;
20
20
  background-color: rgba(0, 0, 0, 0.5);
21
21
  }
22
- `}}}),o.addType(a,{model:{defaults:{tagName:"div",attributes:{class:a,"data-type-role":a},components:[{type:y},{type:f},{type:m}],droppable:!1,draggable:!1,styles:`
23
- .${a} {
22
+ `}}}),t.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:[{type:a},{type:c},{type:o}],droppable:!1,draggable:!1,styles:`
23
+ .${u} {
24
24
  position: relative;
25
25
  background-color: #fff;
26
26
  border-radius: 10px;
@@ -30,8 +30,8 @@
30
30
  height: 600px;
31
31
  box-sizing: border-box;
32
32
  }
33
- `}}}),o.addType(y,{model:{defaults:{tagName:"button",attributes:{class:y,"data-type-role":y},components:"&times;",droppable:!1,draggable:!1,styles:`
34
- .${y} {
33
+ `}}}),t.addType(a,{model:{defaults:{tagName:"button",attributes:{class:a,"data-type-role":a},components:"&times;",droppable:!1,draggable:!1,styles:`
34
+ .${a} {
35
35
  position: absolute;
36
36
  top: 10px;
37
37
  right: 10px;
@@ -42,18 +42,18 @@
42
42
  font-size: 20px;
43
43
  cursor: pointer;
44
44
  }
45
- `}}}),o.addType(f,{model:{defaults:{tagName:"h2",attributes:{class:f,"data-type-role":f},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
46
- .${f} {
45
+ `}}}),t.addType(c,{model:{defaults:{tagName:"h2",attributes:{class:c,"data-type-role":c},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
46
+ .${c} {
47
47
  margin: 0;
48
48
  padding: 0 40px 20px 0;
49
49
  }
50
- `}}}),o.addType(m,{model:{defaults:{tagName:"div",attributes:{class:m,"data-type-role":m},components:[{type:v}],styles:`
51
- .${m} {
50
+ `}}}),t.addType(o,{model:{defaults:{tagName:"div",attributes:{class:o,"data-type-role":o},components:[{type:r}],styles:`
51
+ .${o} {
52
52
  height: 90%;
53
53
  overflow: auto;
54
54
  }
55
- `}}}),o.addType(v,{model:{defaults:{tagName:"p",attributes:{class:v,"data-type-role":v},components:"This is a customizable dialog!",editable:!0,styles:`
56
- .${v} {
55
+ `}}}),t.addType(r,{model:{defaults:{tagName:"p",attributes:{class:r,"data-type-role":r},components:"This is a customizable dialog!",editable:!0,styles:`
56
+ .${r} {
57
57
  margin: 0;
58
58
  }
59
- `}}}),o.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=""})}}}),D({editor:n,licenseKey:u,pluginName:X,cleanup:()=>{l.remove(s),o.removeType(s)}})})});
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=""})}}}),A({editor:n,licenseKey:p,plan:b.free,pluginName:U,cleanup:()=>{i.remove(s),t.removeType(s)}})})});