@grapesjs/studio-sdk-plugins 1.0.8 → 1.0.9-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/dialogComponent/index.cjs.js +4 -4
  2. package/dist/dialogComponent/index.es.js +27 -28
  3. package/dist/dialogComponent/index.umd.js +4 -4
  4. package/dist/fsLightboxComponent/index.cjs.js +2 -2
  5. package/dist/fsLightboxComponent/index.es.js +51 -52
  6. package/dist/fsLightboxComponent/index.umd.js +2 -2
  7. package/dist/index.cjs.d.ts +1 -0
  8. package/dist/index.cjs.js +22 -22
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.d.ts +1 -0
  11. package/dist/index.es.js +5265 -4605
  12. package/dist/index.umd.js +22 -22
  13. package/dist/lightGalleryComponent/index.cjs.d.ts +3 -0
  14. package/dist/lightGalleryComponent/index.cjs.js +1 -0
  15. package/dist/lightGalleryComponent/index.d.ts +3 -0
  16. package/dist/lightGalleryComponent/index.es.d.ts +3 -0
  17. package/dist/lightGalleryComponent/index.es.js +718 -0
  18. package/dist/lightGalleryComponent/index.umd.js +1 -0
  19. package/dist/lightGalleryComponent/types.d.ts +57 -0
  20. package/dist/lightGalleryComponent/typesSchema.d.ts +3 -0
  21. package/dist/lightGalleryComponent/utils.d.ts +47 -0
  22. package/dist/listPagesComponent/index.cjs.js +3 -3
  23. package/dist/listPagesComponent/index.es.js +32 -33
  24. package/dist/listPagesComponent/index.umd.js +3 -3
  25. package/dist/prosemirror/index.cjs.js +8 -8
  26. package/dist/prosemirror/index.es.js +806 -786
  27. package/dist/prosemirror/index.umd.js +9 -9
  28. package/dist/prosemirror/schema.d.ts +1 -1
  29. package/dist/prosemirror/types.d.ts +5 -0
  30. package/dist/prosemirror/utils.d.ts +3 -1
  31. package/dist/tableComponent/index.cjs.js +1 -1
  32. package/dist/tableComponent/index.es.js +35 -36
  33. package/dist/tableComponent/index.umd.js +1 -1
  34. package/dist/utils.d.ts +1 -0
  35. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- "use strict";require("react");const b="app.grapesjs.com",w="app-stage.grapesjs.com",E=[b,w,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",_="license:check:end",P=()=>typeof window<"u",k=({isDev:n,isStage:t})=>`${n?"":`https://${t?w:b}`}/api`,x=()=>{const n=P()&&window.location.hostname;return!!n&&(E.includes(n)||E.some(t=>n.endsWith(t)))},N=()=>(P()&&window.location.hostname)===b;var j={NODE_ENV:"production",NPM_PACKAGE_VERSION:"1.0.8",STUDIO_NPM_PACKAGE_VERSION:"1.0.25"};const D=j.NODE_ENV!=="production";async function $({path:n,method:t="GET",headers:l={},body:o}){const s=`${k({isDev:D,isStage:!N()})}${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 A(n){const t=n;return t.init=l=>o=>n(o,l),t}const I=n=>A(n);async function X({editor:n,pluginName:t,licenseKey:l,cleanup:o}){let g=!1;const s=x();n.on(S,()=>{g=!0}),n.on(_,({sdkLicense:a})=>{a||o()}),setTimeout(async()=>{if(!g){if(s)return;l&&await q({licenseKey:l,pluginName:t})||o()}},2e3)}async function q({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 W=(...n)=>n.map(t=>`[data-gjs-type="${t}"]`).join(","),M="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 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:`
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:W("wrapper"),droppable:W(s),styles:`
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:`
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 C(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 O(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 T(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 L(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)}C(r.closeWhenPressingX),O(r.closeWhenPressingEsc),T(r.openWhenLeavingWindow),L(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:`
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
11
  .${a} {
12
12
  position: fixed;
13
13
  top: 0;
@@ -56,4 +56,4 @@
56
56
  .${m} {
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=""})}}}),X({editor:n,licenseKey:g,pluginName:M,cleanup:()=>{l.remove(s),o.removeType(s)}})},V=I(U);module.exports=V;
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;
@@ -1,5 +1,4 @@
1
- import "react";
2
- const b = "app.grapesjs.com", w = "app-stage.grapesjs.com", E = [
1
+ const b = "app.grapesjs.com", w = "app-stage.grapesjs.com", W = [
3
2
  b,
4
3
  w,
5
4
  "localhost",
@@ -10,19 +9,19 @@ const b = "app.grapesjs.com", w = "app-stage.grapesjs.com", E = [
10
9
  // For stackblitz.com demos
11
10
  "-sandpack.codesandbox.io"
12
11
  // For Sandpack demos
13
- ], S = "license:check:start", _ = "license:check:end", P = () => typeof window < "u", k = ({ isDev: n, isStage: t }) => `${n ? "" : `https://${t ? w : b}`}/api`, x = () => {
14
- const n = P() && window.location.hostname;
15
- return !!n && (E.includes(n) || E.some((t) => n.endsWith(t)));
16
- }, N = () => (P() && window.location.hostname) === b;
17
- var j = { NODE_ENV: "production", NPM_PACKAGE_VERSION: "1.0.8", STUDIO_NPM_PACKAGE_VERSION: "1.0.25" };
18
- const D = j.NODE_ENV !== "production";
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";
19
18
  async function $({
20
19
  path: n,
21
20
  method: t = "GET",
22
21
  headers: l = {},
23
22
  body: o
24
23
  }) {
25
- const s = `${k({ isDev: D, isStage: !N() })}${n}`, a = {
24
+ const s = `${x({ isDev: D, isStage: !j() })}${n}`, a = {
26
25
  method: t,
27
26
  headers: {
28
27
  "Content-Type": "application/json",
@@ -35,31 +34,31 @@ async function $({
35
34
  throw new Error(`HTTP error! status: ${i.status}`);
36
35
  return i.json();
37
36
  }
38
- function A(n) {
37
+ function X(n) {
39
38
  const t = n;
40
39
  return t.init = (l) => (o) => n(o, l), t;
41
40
  }
42
- const I = (n) => /* @__PURE__ */ A(n);
43
- async function X({
41
+ const q = (n) => /* @__PURE__ */ X(n);
42
+ async function A({
44
43
  editor: n,
45
44
  pluginName: t,
46
45
  licenseKey: l,
47
46
  cleanup: o
48
47
  }) {
49
48
  let g = !1;
50
- const s = x();
49
+ const s = _();
51
50
  n.on(S, () => {
52
51
  g = !0;
53
- }), n.on(_, ({ sdkLicense: a }) => {
52
+ }), n.on(k, ({ sdkLicense: a }) => {
54
53
  a || o();
55
54
  }), setTimeout(async () => {
56
55
  if (!g) {
57
56
  if (s) return;
58
- l && await q({ licenseKey: l, pluginName: t }) || o();
57
+ l && await I({ licenseKey: l, pluginName: t }) || o();
59
58
  }
60
59
  }, 2e3);
61
60
  }
62
- async function q({ licenseKey: n, pluginName: t }) {
61
+ async function I({ licenseKey: n, pluginName: t }) {
63
62
  try {
64
63
  const l = await $({
65
64
  path: `/sdk/${n}`,
@@ -74,7 +73,7 @@ async function q({ licenseKey: n, pluginName: t }) {
74
73
  return console.error("Error during SDK license check:", l), !1;
75
74
  }
76
75
  }
77
- const W = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), M = "dialogComponent", U = function(n, t = {}) {
76
+ const E = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), B = "dialogComponent", U = function(n, t = {}) {
78
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";
79
78
  l.add(s, {
80
79
  label: "Dialog",
@@ -93,8 +92,8 @@ const W = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), M = "dialo
93
92
  tagName: "div",
94
93
  attributes: { class: s, "data-type-role": s },
95
94
  components: [{ type: a }, { type: f }],
96
- draggable: W("wrapper"),
97
- droppable: W(s),
95
+ draggable: E("wrapper"),
96
+ droppable: E(s),
98
97
  styles: `
99
98
  .${s} {
100
99
  position: relative;
@@ -149,28 +148,28 @@ const W = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), M = "dialo
149
148
  ],
150
149
  script: function(r) {
151
150
  const e = this;
152
- function C(c) {
151
+ function T(c) {
153
152
  const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'), d = e.querySelector('[data-type-role="gjs-plg-dialog-close"]');
154
153
  function v() {
155
154
  p.style.display = "none";
156
155
  }
157
156
  c ? (e._onCloseWhenPressingX = v, d.addEventListener("click", e._onCloseWhenPressingX)) : (d.removeEventListener("click", e._onCloseWhenPressingX), e._onCloseWhenPressingX = null);
158
157
  }
159
- function O(c) {
158
+ function C(c) {
160
159
  const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
161
160
  function d(v) {
162
161
  v.key === "Escape" && (p.style.display = "none");
163
162
  }
164
163
  c ? (e._onCloseWhenPressingEsc = d, e.addEventListener("keydown", e._onCloseWhenPressingEsc)) : (e.removeEventListener("keydown", e._onCloseWhenPressingEsc), e._onCloseWhenPressingEsc = null);
165
164
  }
166
- function T(c) {
165
+ function P(c) {
167
166
  const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
168
167
  function d() {
169
168
  p.style.display = "flex";
170
169
  }
171
170
  c ? (e._onOpenWhenLeavingWindow = d, document.addEventListener("mouseleave", e._onOpenWhenLeavingWindow)) : (document.removeEventListener("mouseleave", e._onOpenWhenLeavingWindow), e._onOpenWhenLeavingWindow = null);
172
171
  }
173
- function L(c) {
172
+ function O(c) {
174
173
  const p = e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
175
174
  function d() {
176
175
  const v = document.documentElement.scrollTop;
@@ -178,7 +177,7 @@ const W = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), M = "dialo
178
177
  }
179
178
  c ? (e._onOpenWhenScrollingToLevel = d, document.addEventListener("scroll", e._onOpenWhenScrollingToLevel)) : (document.removeEventListener("scroll", e._onOpenWhenScrollingToLevel), e._onOpenWhenScrollingToLevel = null);
180
179
  }
181
- C(r.closeWhenPressingX), O(r.closeWhenPressingEsc), T(r.openWhenLeavingWindow), L(r.openWhenScrollingToLevel);
180
+ T(r.closeWhenPressingX), C(r.closeWhenPressingEsc), P(r.openWhenLeavingWindow), O(r.openWhenScrollingToLevel);
182
181
  }
183
182
  },
184
183
  init() {
@@ -336,15 +335,15 @@ const W = (...n) => n.map((t) => `[data-gjs-type="${t}"]`).join(","), M = "dialo
336
335
  });
337
336
  }
338
337
  }
339
- }), X({
338
+ }), A({
340
339
  editor: n,
341
340
  licenseKey: g,
342
- pluginName: M,
341
+ pluginName: B,
343
342
  cleanup: () => {
344
343
  l.remove(s), o.removeType(s);
345
344
  }
346
345
  });
347
- }, z = I(U);
346
+ }, H = q(U);
348
347
  export {
349
- z as default
348
+ H as default
350
349
  };
@@ -1,13 +1,13 @@
1
- (function(p,u){typeof exports=="object"&&typeof module<"u"?module.exports=u(require("react")):typeof define=="function"&&define.amd?define(["react"],u):(p=typeof globalThis<"u"?globalThis:p||self,p.StudioSdkPlugins_dialogComponent=u())})(this,function(){"use strict";const p="app.grapesjs.com",u="app-stage.grapesjs.com",W=[p,u,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],T="license:check:start",C="license:check:end",w=()=>typeof window<"u",O=({isDev:n,isStage:t})=>`${n?"":`https://${t?u:p}`}/api`,S=()=>{const n=w()&&window.location.hostname;return!!n&&(W.includes(n)||W.some(t=>n.endsWith(t)))},L=()=>(w()&&window.location.hostname)===p;var _={NODE_ENV:"production",NPM_PACKAGE_VERSION:"1.0.8",STUDIO_NPM_PACKAGE_VERSION:"1.0.25"};const k=_.NODE_ENV!=="production";async function x({path:n,method:t="GET",headers:l={},body:o}){const s=`${O({isDev:k,isStage:!L()})}${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 N(n){const t=n;return t.init=l=>o=>n(o,l),t}const j=n=>N(n);async function D({editor:n,pluginName:t,licenseKey:l,cleanup:o}){let h=!1;const s=S();n.on(T,()=>{h=!0}),n.on(C,({sdkLicense:i})=>{i||o()}),setTimeout(async()=>{if(!h){if(s)return;l&&await $({licenseKey:l,pluginName:t})||o()}},2e3)}async function $({licenseKey:n,pluginName:t}){try{const l=await x({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 P=(...n)=>n.map(t=>`[data-gjs-type="${t}"]`).join(","),A="dialogComponent";return j(function(n,t={}){const{Blocks:l,Components:o}=n,{licenseKey:h}=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",E="gjs-plg-dialog-placeholder";l.add(s,{label:"Dialog",media:`
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:`
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:E}],draggable:P("wrapper"),droppable:P(s),styles:`
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:`
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 I(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 X(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 q(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 M(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)}I(r.closeWhenPressingX),X(r.closeWhenPressingEsc),q(r.openWhenLeavingWindow),M(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:`
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
11
  .${i} {
12
12
  position: fixed;
13
13
  top: 0;
@@ -56,4 +56,4 @@
56
56
  .${v} {
57
57
  margin: 0;
58
58
  }
59
- `}}}),o.addType(E,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:E,"data-type-role":E},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:h,pluginName:A,cleanup:()=>{l.remove(s),o.removeType(s)}})})});
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)}})})});
@@ -1,6 +1,6 @@
1
- "use strict";require("react");const _="app.grapesjs.com",D="app-stage.grapesjs.com",O=[_,D,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],$="license:check:start",B="license:check:end",M=()=>typeof window<"u",W=({isDev:o,isStage:i})=>`${o?"":`https://${i?D:_}`}/api`,R=()=>{const o=M()&&window.location.hostname;return!!o&&(O.includes(o)||O.some(i=>o.endsWith(i)))},U=()=>(M()&&window.location.hostname)===_;var G={NODE_ENV:"production",NPM_PACKAGE_VERSION:"1.0.8",STUDIO_NPM_PACKAGE_VERSION:"1.0.25"};const K=G.NODE_ENV!=="production";async function F({path:o,method:i="GET",headers:c={},body:a}){const u=`${W({isDev:K,isStage:!U()})}${o}`,r={method:i,headers:{"Content-Type":"application/json",...c}};a&&(r.body=JSON.stringify(a));const v=await fetch(u,r);if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);return v.json()}function Z(o){const i=o;return i.init=c=>a=>o(a,c),i}const q=o=>Z(o);async function J({editor:o,pluginName:i,licenseKey:c,cleanup:a}){let h=!1;const u=R();o.on($,()=>{h=!0}),o.on(B,({sdkLicense:r})=>{r||a()}),setTimeout(async()=>{if(!h){if(u)return;c&&await z({licenseKey:c,pluginName:i})||a()}},2e3)}async function z({licenseKey:o,pluginName:i}){try{const c=await F({path:`/sdk/${o}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:i})}),{license:a}=c.result||{};return!!a}catch(c){return console.error("Error during SDK license check:",c),!1}}const X="gjs-plg-",Y="fsLightboxComponent",T="data-fslightbox",L="data-type",Q="fslightbox-open",b="fslightbox",f={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>'},tt=function(o,i={}){const{Blocks:c,Components:a}=o,h="Lightbox",u=`${X}${b}`,r={toolbarIconOpen:f.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...i},{block:v,toolbarIconOpen:w,defaultSrc:A}=r,j=function(e){const t=this,n="data-fslightbox",s=window,p=()=>{var E;const d=s.refreshFsLightbox;d==null||d();const x=t.getAttribute(n);if((E=s.fsLightboxInstances)==null||E[x],!s._isEditor)return;Array.from(document.querySelectorAll(`[${n}]`)).forEach(g=>{const m=g.onclick;g.onclick=function(S){S.preventDefault();const N=g;!N.__skipLb&&(m==null||m(S)),N.__skipLb=!0}})};if(s.refreshFsLightbox)p();else{const d=document.createElement("script");d.src=e.cdnScript,d.onload=p,document.head.appendChild(d)}},H=e=>({id:`${b}-open-lb`,label:w,command:()=>{const t=e.getView();t==null||t.toggleLightbox()}}),l="source-type",k={type:"radio",name:l,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:f.image},{id:"video",label:"Video",icon:f.video},{id:"el",label:"Custom Element",icon:f.external}],labelToTitle:!0},I={id:"href-image",name:"href",type:"file",label:"Source Image"},C={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},V={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},P={image:[I],video:[C],el:[V]};a.addType(b,{block:v&&{label:h,media:f.imageLightbox,category:"Extra",select:!0,...r.block},isComponent:e=>{var t;return(t=e.hasAttribute)==null?void 0:t.call(e,T)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:h,icon:f.imageLightbox,classes:u,draggable:(e,t)=>!t.is(b),attributes:{[T]:"lightbox",[L]:"image",href:A},components:{type:"image",src:A},script:j,cdnScript:r.cdnScript,"script-props":["attributes","cdnScript"],[l]:"image",traits:[k,{name:T,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(e,t){var s;const n=(s=t.target)==null?void 0:s.getView();n==null||n.toggleLightbox()}}],styles:`
1
+ "use strict";const E="app.grapesjs.com",j="app-stage.grapesjs.com",O=[E,j,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],B="license:check:start",P="license:check:end",H=()=>typeof window<"u",W=({isDev:o,isStage:i})=>`${o?"":`https://${i?j:E}`}/api`,R=()=>{const o=H()&&window.location.hostname;return!!o&&(O.includes(o)||O.some(i=>o.endsWith(i)))},U=()=>(H()&&window.location.hostname)===E;var F={};const G=F.NODE_ENV!=="production";async function K({path:o,method:i="GET",headers:c={},body:a}){const u=`${W({isDev:G,isStage:!U()})}${o}`,r={method:i,headers:{"Content-Type":"application/json",...c}};a&&(r.body=JSON.stringify(a));const v=await fetch(u,r);if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);return v.json()}function Z(o){const i=o;return i.init=c=>a=>o(a,c),i}const J=o=>Z(o);async function q({editor:o,pluginName:i,licenseKey:c,cleanup:a}){let p=!1;const u=R();o.on(B,()=>{p=!0}),o.on(P,({sdkLicense:r})=>{r||a()}),setTimeout(async()=>{if(!p){if(u)return;c&&await z({licenseKey:c,pluginName:i})||a()}},2e3)}async function z({licenseKey:o,pluginName:i}){try{const c=await K({path:`/sdk/${o}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:i})}),{license:a}=c.result||{};return!!a}catch(c){return console.error("Error during SDK license check:",c),!1}}const X="gjs-plg-",Y="fsLightboxComponent",S="data-fslightbox",L="data-type",Q="fslightbox-open",b="fslightbox",f={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>'},tt=function(o,i={}){const{Blocks:c,Components:a}=o,p="Lightbox",u=`${X}${b}`,r={toolbarIconOpen:f.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...i},{block:v,toolbarIconOpen:_,defaultSrc:A}=r,$=function(e){const t=this,n="data-fslightbox",s=window,h=()=>{var w;const d=s.refreshFsLightbox;d==null||d();const x=t.getAttribute(n);if((w=s.fsLightboxInstances)==null||w[x],!s._isEditor)return;Array.from(document.querySelectorAll(`[${n}]`)).forEach(g=>{const m=g.onclick;g.onclick=function(T){T.preventDefault();const N=g;!N.__skipLb&&(m==null||m(T)),N.__skipLb=!0}})};if(s.refreshFsLightbox)h();else{const d=document.createElement("script");d.src=e.cdnScript,d.onload=h,document.head.appendChild(d)}},D=e=>({id:`${b}-open-lb`,label:_,command:()=>{const t=e.getView();t==null||t.toggleLightbox()}}),l="source-type",k={type:"radio",name:l,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:f.image},{id:"video",label:"Video",icon:f.video},{id:"el",label:"Custom Element",icon:f.external}],labelToTitle:!0},C={id:"href-image",name:"href",type:"file",label:"Source Image"},I={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},V={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},M={image:[C],video:[I],el:[V]};a.addType(b,{block:v&&{label:p,media:f.imageLightbox,category:"Extra",select:!0,...r.block},isComponent:e=>{var t;return(t=e.hasAttribute)==null?void 0:t.call(e,S)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:p,icon:f.imageLightbox,classes:u,draggable:(e,t)=>!t.is(b),attributes:{[S]:"lightbox",[L]:"image",href:A},components:{type:"image",src:A},script:$,cdnScript:r.cdnScript,"script-props":["attributes","cdnScript"],[l]:"image",traits:[k,{name:S,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(e,t){var s;const n=(s=t.target)==null?void 0:s.getView();n==null||n.toggleLightbox()}}],styles:`
2
2
  .${u} {
3
3
  display: inline-block;
4
4
  padding: 10px;
5
5
  }
6
- `},init(){const e=[l].map(t=>`change:${t}`).join(" ");this.on(e,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(e,t,n){if(n.adjust)return;const p=this.get(l)==="video"?"video":"image";this.addAttributes({[L]:p,href:""})},adjustSourceType(){const e=this.get(l),t=this.getAttributes().href||"",n={adjust:!0};if(e==="video"){const s=t.includes("youtube.com")?"youtube":"video";this.addAttributes({[L]:s},n)}else e!=="el"&&t.startsWith("#")?this.set(l,"el",n):e==="image"&&this.addAttributes({[L]:"image"},n)},updateTraits(e={}){const{changed:t}=this,{init:n}=e;if(t[k.name]||n){this.removeTrait([I.name,C.name,V.name]);const s=this.get(l)||"image",p=this.getTraitIndex(l)+1;this.addTrait(P[s],{at:p})}},initToolbar(){if(!w)return;const{toolbar:e}=this,t=H(this);!e.find(s=>s.id===t.id)&&(e==null||e.unshift(t))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var g;const{em:e,el:t,model:n}=this,{Canvas:s}=e,p=n.getAttributes()[T],{defaultView:d,documentElement:x}=t.ownerDocument,y=(g=d.fsLightboxInstances)==null?void 0:g[p];if(x.classList.contains(Q))y.close();else{t.__skipLb=!1;let m;y.props.onOpen=()=>{m=s.getSpots(),setTimeout(()=>s.removeSpots())},y.props.onClose=()=>{m.forEach(S=>s.addSpot(S.attributes))},t.click()}}}}),J({editor:o,licenseKey:r.licenseKey,pluginName:Y,cleanup:()=>{c.remove(b),a.removeType(b)}})},et=q(tt);module.exports=et;
6
+ `},init(){const e=[l].map(t=>`change:${t}`).join(" ");this.on(e,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(e,t,n){if(n.adjust)return;const h=this.get(l)==="video"?"video":"image";this.addAttributes({[L]:h,href:""})},adjustSourceType(){const e=this.get(l),t=this.getAttributes().href||"",n={adjust:!0};if(e==="video"){const s=t.includes("youtube.com")?"youtube":"video";this.addAttributes({[L]:s},n)}else e!=="el"&&t.startsWith("#")?this.set(l,"el",n):e==="image"&&this.addAttributes({[L]:"image"},n)},updateTraits(e={}){const{changed:t}=this,{init:n}=e;if(t[k.name]||n){this.removeTrait([C.name,I.name,V.name]);const s=this.get(l)||"image",h=this.getTraitIndex(l)+1;this.addTrait(M[s],{at:h})}},initToolbar(){if(!_)return;const{toolbar:e}=this,t=D(this);!e.find(s=>s.id===t.id)&&(e==null||e.unshift(t))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var g;const{em:e,el:t,model:n}=this,{Canvas:s}=e,h=n.getAttributes()[S],{defaultView:d,documentElement:x}=t.ownerDocument,y=(g=d.fsLightboxInstances)==null?void 0:g[h];if(x.classList.contains(Q))y.close();else{t.__skipLb=!1;let m;y.props.onOpen=()=>{m=s.getSpots(),setTimeout(()=>s.removeSpots())},y.props.onClose=()=>{m.forEach(T=>s.addSpot(T.attributes))},t.click()}}}}),q({editor:o,licenseKey:r.licenseKey,pluginName:Y,cleanup:()=>{c.remove(b),a.removeType(b)}})},et=J(tt);module.exports=et;
@@ -1,7 +1,6 @@
1
- import "react";
2
- const _ = "app.grapesjs.com", D = "app-stage.grapesjs.com", O = [
3
- _,
4
- D,
1
+ const E = "app.grapesjs.com", j = "app-stage.grapesjs.com", O = [
2
+ E,
3
+ j,
5
4
  "localhost",
6
5
  "127.0.0.1",
7
6
  ".local-credentialless.webcontainer.io",
@@ -10,19 +9,19 @@ const _ = "app.grapesjs.com", D = "app-stage.grapesjs.com", O = [
10
9
  // For stackblitz.com demos
11
10
  "-sandpack.codesandbox.io"
12
11
  // For Sandpack demos
13
- ], $ = "license:check:start", B = "license:check:end", M = () => typeof window < "u", W = ({ isDev: o, isStage: i }) => `${o ? "" : `https://${i ? D : _}`}/api`, R = () => {
14
- const o = M() && window.location.hostname;
12
+ ], B = "license:check:start", P = "license:check:end", H = () => typeof window < "u", W = ({ isDev: o, isStage: i }) => `${o ? "" : `https://${i ? j : E}`}/api`, R = () => {
13
+ const o = H() && window.location.hostname;
15
14
  return !!o && (O.includes(o) || O.some((i) => o.endsWith(i)));
16
- }, U = () => (M() && window.location.hostname) === _;
17
- var G = { NODE_ENV: "production", NPM_PACKAGE_VERSION: "1.0.8", STUDIO_NPM_PACKAGE_VERSION: "1.0.25" };
18
- const K = G.NODE_ENV !== "production";
19
- async function F({
15
+ }, U = () => (H() && window.location.hostname) === E;
16
+ var F = {};
17
+ const G = F.NODE_ENV !== "production";
18
+ async function K({
20
19
  path: o,
21
20
  method: i = "GET",
22
21
  headers: c = {},
23
22
  body: a
24
23
  }) {
25
- const u = `${W({ isDev: K, isStage: !U() })}${o}`, r = {
24
+ const u = `${W({ isDev: G, isStage: !U() })}${o}`, r = {
26
25
  method: i,
27
26
  headers: {
28
27
  "Content-Type": "application/json",
@@ -46,14 +45,14 @@ async function q({
46
45
  licenseKey: c,
47
46
  cleanup: a
48
47
  }) {
49
- let h = !1;
48
+ let p = !1;
50
49
  const u = R();
51
- o.on($, () => {
52
- h = !0;
53
- }), o.on(B, ({ sdkLicense: r }) => {
50
+ o.on(B, () => {
51
+ p = !0;
52
+ }), o.on(P, ({ sdkLicense: r }) => {
54
53
  r || a();
55
54
  }), setTimeout(async () => {
56
- if (!h) {
55
+ if (!p) {
57
56
  if (u) return;
58
57
  c && await z({ licenseKey: c, pluginName: i }) || a();
59
58
  }
@@ -61,7 +60,7 @@ async function q({
61
60
  }
62
61
  async function z({ licenseKey: o, pluginName: i }) {
63
62
  try {
64
- const c = await F({
63
+ const c = await K({
65
64
  path: `/sdk/${o}`,
66
65
  method: "POST",
67
66
  body: JSON.stringify({
@@ -74,44 +73,44 @@ async function z({ licenseKey: o, pluginName: i }) {
74
73
  return console.error("Error during SDK license check:", c), !1;
75
74
  }
76
75
  }
77
- const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "data-type", Q = "fslightbox-open", b = "fslightbox", f = {
76
+ const X = "gjs-plg-", Y = "fsLightboxComponent", S = "data-fslightbox", L = "data-type", Q = "fslightbox-open", b = "fslightbox", f = {
78
77
  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>',
79
78
  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>',
80
79
  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>',
81
80
  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>',
82
81
  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>'
83
82
  }, tt = function(o, i = {}) {
84
- const { Blocks: c, Components: a } = o, h = "Lightbox", u = `${X}${b}`, r = {
83
+ const { Blocks: c, Components: a } = o, p = "Lightbox", u = `${X}${b}`, r = {
85
84
  toolbarIconOpen: f.eye,
86
85
  block: {},
87
86
  defaultSrc: "https://placehold.co/300/777/white.png?text=Image",
88
87
  cdnScript: "https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",
89
88
  ...i
90
- }, { block: v, toolbarIconOpen: w, defaultSrc: A } = r, j = function(e) {
91
- const t = this, n = "data-fslightbox", s = window, p = () => {
92
- var E;
89
+ }, { block: v, toolbarIconOpen: _, defaultSrc: A } = r, $ = function(e) {
90
+ const t = this, n = "data-fslightbox", s = window, h = () => {
91
+ var w;
93
92
  const d = s.refreshFsLightbox;
94
93
  d == null || d();
95
94
  const x = t.getAttribute(n);
96
- if ((E = s.fsLightboxInstances) == null || E[x], !s._isEditor) return;
95
+ if ((w = s.fsLightboxInstances) == null || w[x], !s._isEditor) return;
97
96
  Array.from(document.querySelectorAll(`[${n}]`)).forEach((g) => {
98
97
  const m = g.onclick;
99
- g.onclick = function(S) {
100
- S.preventDefault();
98
+ g.onclick = function(T) {
99
+ T.preventDefault();
101
100
  const N = g;
102
- !N.__skipLb && (m == null || m(S)), N.__skipLb = !0;
101
+ !N.__skipLb && (m == null || m(T)), N.__skipLb = !0;
103
102
  };
104
103
  });
105
104
  };
106
105
  if (s.refreshFsLightbox)
107
- p();
106
+ h();
108
107
  else {
109
108
  const d = document.createElement("script");
110
- d.src = e.cdnScript, d.onload = p, document.head.appendChild(d);
109
+ d.src = e.cdnScript, d.onload = h, document.head.appendChild(d);
111
110
  }
112
- }, H = (e) => ({
111
+ }, D = (e) => ({
113
112
  id: `${b}-open-lb`,
114
- label: w,
113
+ label: _,
115
114
  command: () => {
116
115
  const t = e.getView();
117
116
  t == null || t.toggleLightbox();
@@ -128,12 +127,12 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
128
127
  ],
129
128
  // @ts-expect-error Studio related prop
130
129
  labelToTitle: !0
131
- }, I = {
130
+ }, C = {
132
131
  id: "href-image",
133
132
  name: "href",
134
133
  type: "file",
135
134
  label: "Source Image"
136
- }, C = {
135
+ }, I = {
137
136
  id: "href-video",
138
137
  name: "href",
139
138
  label: "Source Video",
@@ -143,14 +142,14 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
143
142
  name: "href",
144
143
  label: "Source Element",
145
144
  placeholder: "#custom-element-id"
146
- }, P = {
147
- image: [I],
148
- video: [C],
145
+ }, M = {
146
+ image: [C],
147
+ video: [I],
149
148
  el: [V]
150
149
  };
151
150
  a.addType(b, {
152
151
  block: v && {
153
- label: h,
152
+ label: p,
154
153
  media: f.imageLightbox,
155
154
  category: "Extra",
156
155
  select: !0,
@@ -158,30 +157,30 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
158
157
  },
159
158
  isComponent: (e) => {
160
159
  var t;
161
- return (t = e.hasAttribute) == null ? void 0 : t.call(e, T);
160
+ return (t = e.hasAttribute) == null ? void 0 : t.call(e, S);
162
161
  },
163
162
  extendFn: ["initToolbar"],
164
163
  model: {
165
164
  defaults: {
166
165
  tagName: "a",
167
- name: h,
166
+ name: p,
168
167
  icon: f.imageLightbox,
169
168
  classes: u,
170
169
  draggable: (e, t) => !t.is(b),
171
170
  attributes: {
172
- [T]: "lightbox",
171
+ [S]: "lightbox",
173
172
  [L]: "image",
174
173
  href: A
175
174
  },
176
175
  components: { type: "image", src: A },
177
- script: j,
176
+ script: $,
178
177
  cdnScript: r.cdnScript,
179
178
  "script-props": ["attributes", "cdnScript"],
180
179
  [l]: "image",
181
180
  traits: [
182
181
  k,
183
182
  {
184
- name: T,
183
+ name: S,
185
184
  label: "Group name"
186
185
  },
187
186
  {
@@ -207,8 +206,8 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
207
206
  },
208
207
  onSourceTypeChange(e, t, n) {
209
208
  if (n.adjust) return;
210
- const p = this.get(l) === "video" ? "video" : "image";
211
- this.addAttributes({ [L]: p, href: "" });
209
+ const h = this.get(l) === "video" ? "video" : "image";
210
+ this.addAttributes({ [L]: h, href: "" });
212
211
  },
213
212
  adjustSourceType() {
214
213
  const e = this.get(l), t = this.getAttributes().href || "", n = { adjust: !0 };
@@ -220,14 +219,14 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
220
219
  updateTraits(e = {}) {
221
220
  const { changed: t } = this, { init: n } = e;
222
221
  if (t[k.name] || n) {
223
- this.removeTrait([I.name, C.name, V.name]);
224
- const s = this.get(l) || "image", p = this.getTraitIndex(l) + 1;
225
- this.addTrait(P[s], { at: p });
222
+ this.removeTrait([C.name, I.name, V.name]);
223
+ const s = this.get(l) || "image", h = this.getTraitIndex(l) + 1;
224
+ this.addTrait(M[s], { at: h });
226
225
  }
227
226
  },
228
227
  initToolbar() {
229
- if (!w) return;
230
- const { toolbar: e } = this, t = H(this);
228
+ if (!_) return;
229
+ const { toolbar: e } = this, t = D(this);
231
230
  !e.find((s) => s.id === t.id) && (e == null || e.unshift(t));
232
231
  }
233
232
  },
@@ -237,7 +236,7 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
237
236
  },
238
237
  toggleLightbox() {
239
238
  var g;
240
- const { em: e, el: t, model: n } = this, { Canvas: s } = e, p = n.getAttributes()[T], { defaultView: d, documentElement: x } = t.ownerDocument, y = (g = d.fsLightboxInstances) == null ? void 0 : g[p];
239
+ const { em: e, el: t, model: n } = this, { Canvas: s } = e, h = n.getAttributes()[S], { defaultView: d, documentElement: x } = t.ownerDocument, y = (g = d.fsLightboxInstances) == null ? void 0 : g[h];
241
240
  if (x.classList.contains(Q))
242
241
  y.close();
243
242
  else {
@@ -246,7 +245,7 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
246
245
  y.props.onOpen = () => {
247
246
  m = s.getSpots(), setTimeout(() => s.removeSpots());
248
247
  }, y.props.onClose = () => {
249
- m.forEach((S) => s.addSpot(S.attributes));
248
+ m.forEach((T) => s.addSpot(T.attributes));
250
249
  }, t.click();
251
250
  }
252
251
  }
@@ -259,7 +258,7 @@ const X = "gjs-plg-", Y = "fsLightboxComponent", T = "data-fslightbox", L = "dat
259
258
  c.remove(b), a.removeType(b);
260
259
  }
261
260
  });
262
- }, ot = J(tt);
261
+ }, et = J(tt);
263
262
  export {
264
- ot as default
263
+ et as default
265
264
  };
@@ -1,6 +1,6 @@
1
- (function(u,h){typeof exports=="object"&&typeof module<"u"?module.exports=h(require("react")):typeof define=="function"&&define.amd?define(["react"],h):(u=typeof globalThis<"u"?globalThis:u||self,u.StudioSdkPlugins_fsLightboxComponent=h())})(this,function(){"use strict";const u="app.grapesjs.com",h="app-stage.grapesjs.com",A=[u,h,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],M="license:check:start",P="license:check:end",k=()=>typeof window<"u",H=({isDev:o,isStage:i})=>`${o?"":`https://${i?h:u}`}/api`,$=()=>{const o=k()&&window.location.hostname;return!!o&&(A.includes(o)||A.some(i=>o.endsWith(i)))},B=()=>(k()&&window.location.hostname)===u;var W={NODE_ENV:"production",NPM_PACKAGE_VERSION:"1.0.8",STUDIO_NPM_PACKAGE_VERSION:"1.0.25"};const R=W.NODE_ENV!=="production";async function U({path:o,method:i="GET",headers:c={},body:a}){const f=`${H({isDev:R,isStage:!B()})}${o}`,r={method:i,headers:{"Content-Type":"application/json",...c}};a&&(r.body=JSON.stringify(a));const T=await fetch(f,r);if(!T.ok)throw new Error(`HTTP error! status: ${T.status}`);return T.json()}function G(o){const i=o;return i.init=c=>a=>o(a,c),i}const K=o=>G(o);async function F({editor:o,pluginName:i,licenseKey:c,cleanup:a}){let b=!1;const f=$();o.on(M,()=>{b=!0}),o.on(P,({sdkLicense:r})=>{r||a()}),setTimeout(async()=>{if(!b){if(f)return;c&&await Z({licenseKey:c,pluginName:i})||a()}},2e3)}async function Z({licenseKey:o,pluginName:i}){try{const c=await U({path:`/sdk/${o}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:i})}),{license:a}=c.result||{};return!!a}catch(c){return console.error("Error during SDK license check:",c),!1}}const q="gjs-plg-",J="fsLightboxComponent",v="data-fslightbox",L="data-type",z="fslightbox-open",g="fslightbox",m={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 K(function(o,i={}){const{Blocks:c,Components:a}=o,b="Lightbox",f=`${q}${g}`,r={toolbarIconOpen:m.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...i},{block:T,toolbarIconOpen:C,defaultSrc:I}=r,X=function(t){const e=this,s="data-fslightbox",n=window,p=()=>{var w;const d=n.refreshFsLightbox;d==null||d();const E=e.getAttribute(s);if((w=n.fsLightboxInstances)==null||w[E],!n._isEditor)return;Array.from(document.querySelectorAll(`[${s}]`)).forEach(y=>{const S=y.onclick;y.onclick=function(_){_.preventDefault();const D=y;!D.__skipLb&&(S==null||S(_)),D.__skipLb=!0}})};if(n.refreshFsLightbox)p();else{const d=document.createElement("script");d.src=t.cdnScript,d.onload=p,document.head.appendChild(d)}},Y=t=>({id:`${g}-open-lb`,label:C,command:()=>{const e=t.getView();e==null||e.toggleLightbox()}}),l="source-type",V={type:"radio",name:l,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:m.image},{id:"video",label:"Video",icon:m.video},{id:"el",label:"Custom Element",icon:m.external}],labelToTitle:!0},N={id:"href-image",name:"href",type:"file",label:"Source Image"},O={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},j={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},Q={image:[N],video:[O],el:[j]};a.addType(g,{block:T&&{label:b,media:m.imageLightbox,category:"Extra",select:!0,...r.block},isComponent:t=>{var e;return(e=t.hasAttribute)==null?void 0:e.call(t,v)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:b,icon:m.imageLightbox,classes:f,draggable:(t,e)=>!e.is(g),attributes:{[v]:"lightbox",[L]:"image",href:I},components:{type:"image",src:I},script:X,cdnScript:r.cdnScript,"script-props":["attributes","cdnScript"],[l]:"image",traits:[V,{name:v,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(t,e){var n;const s=(n=e.target)==null?void 0:n.getView();s==null||s.toggleLightbox()}}],styles:`
1
+ (function(h,u){typeof exports=="object"&&typeof module<"u"?module.exports=u():typeof define=="function"&&define.amd?define(u):(h=typeof globalThis<"u"?globalThis:h||self,h.StudioSdkPlugins_fsLightboxComponent=u())})(this,function(){"use strict";const h="app.grapesjs.com",u="app-stage.grapesjs.com",k=[h,u,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],$="license:check:start",D="license:check:end",A=()=>typeof window<"u",M=({isDev:o,isStage:i})=>`${o?"":`https://${i?u:h}`}/api`,B=()=>{const o=A()&&window.location.hostname;return!!o&&(k.includes(o)||k.some(i=>o.endsWith(i)))},P=()=>(A()&&window.location.hostname)===h;var W={};const R=W.NODE_ENV!=="production";async function U({path:o,method:i="GET",headers:c={},body:a}){const f=`${M({isDev:R,isStage:!P()})}${o}`,r={method:i,headers:{"Content-Type":"application/json",...c}};a&&(r.body=JSON.stringify(a));const v=await fetch(f,r);if(!v.ok)throw new Error(`HTTP error! status: ${v.status}`);return v.json()}function F(o){const i=o;return i.init=c=>a=>o(a,c),i}const G=o=>F(o);async function K({editor:o,pluginName:i,licenseKey:c,cleanup:a}){let b=!1;const f=B();o.on($,()=>{b=!0}),o.on(D,({sdkLicense:r})=>{r||a()}),setTimeout(async()=>{if(!b){if(f)return;c&&await Z({licenseKey:c,pluginName:i})||a()}},2e3)}async function Z({licenseKey:o,pluginName:i}){try{const c=await U({path:`/sdk/${o}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:i})}),{license:a}=c.result||{};return!!a}catch(c){return console.error("Error during SDK license check:",c),!1}}const J="gjs-plg-",q="fsLightboxComponent",S="data-fslightbox",L="data-type",z="fslightbox-open",g="fslightbox",m={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(o,i={}){const{Blocks:c,Components:a}=o,b="Lightbox",f=`${J}${g}`,r={toolbarIconOpen:m.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...i},{block:v,toolbarIconOpen:C,defaultSrc:I}=r,X=function(e){const t=this,s="data-fslightbox",n=window,p=()=>{var E;const d=n.refreshFsLightbox;d==null||d();const _=t.getAttribute(s);if((E=n.fsLightboxInstances)==null||E[_],!n._isEditor)return;Array.from(document.querySelectorAll(`[${s}]`)).forEach(y=>{const T=y.onclick;y.onclick=function(w){w.preventDefault();const H=y;!H.__skipLb&&(T==null||T(w)),H.__skipLb=!0}})};if(n.refreshFsLightbox)p();else{const d=document.createElement("script");d.src=e.cdnScript,d.onload=p,document.head.appendChild(d)}},Y=e=>({id:`${g}-open-lb`,label:C,command:()=>{const t=e.getView();t==null||t.toggleLightbox()}}),l="source-type",V={type:"radio",name:l,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:m.image},{id:"video",label:"Video",icon:m.video},{id:"el",label:"Custom Element",icon:m.external}],labelToTitle:!0},N={id:"href-image",name:"href",type:"file",label:"Source Image"},j={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},O={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},Q={image:[N],video:[j],el:[O]};a.addType(g,{block:v&&{label:b,media:m.imageLightbox,category:"Extra",select:!0,...r.block},isComponent:e=>{var t;return(t=e.hasAttribute)==null?void 0:t.call(e,S)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:b,icon:m.imageLightbox,classes:f,draggable:(e,t)=>!t.is(g),attributes:{[S]:"lightbox",[L]:"image",href:I},components:{type:"image",src:I},script:X,cdnScript:r.cdnScript,"script-props":["attributes","cdnScript"],[l]:"image",traits:[V,{name:S,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(e,t){var n;const s=(n=t.target)==null?void 0:n.getView();s==null||s.toggleLightbox()}}],styles:`
2
2
  .${f} {
3
3
  display: inline-block;
4
4
  padding: 10px;
5
5
  }
6
- `},init(){const t=[l].map(e=>`change:${e}`).join(" ");this.on(t,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(t,e,s){if(s.adjust)return;const p=this.get(l)==="video"?"video":"image";this.addAttributes({[L]:p,href:""})},adjustSourceType(){const t=this.get(l),e=this.getAttributes().href||"",s={adjust:!0};if(t==="video"){const n=e.includes("youtube.com")?"youtube":"video";this.addAttributes({[L]:n},s)}else t!=="el"&&e.startsWith("#")?this.set(l,"el",s):t==="image"&&this.addAttributes({[L]:"image"},s)},updateTraits(t={}){const{changed:e}=this,{init:s}=t;if(e[V.name]||s){this.removeTrait([N.name,O.name,j.name]);const n=this.get(l)||"image",p=this.getTraitIndex(l)+1;this.addTrait(Q[n],{at:p})}},initToolbar(){if(!C)return;const{toolbar:t}=this,e=Y(this);!t.find(n=>n.id===e.id)&&(t==null||t.unshift(e))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var y;const{em:t,el:e,model:s}=this,{Canvas:n}=t,p=s.getAttributes()[v],{defaultView:d,documentElement:E}=e.ownerDocument,x=(y=d.fsLightboxInstances)==null?void 0:y[p];if(E.classList.contains(z))x.close();else{e.__skipLb=!1;let S;x.props.onOpen=()=>{S=n.getSpots(),setTimeout(()=>n.removeSpots())},x.props.onClose=()=>{S.forEach(_=>n.addSpot(_.attributes))},e.click()}}}}),F({editor:o,licenseKey:r.licenseKey,pluginName:J,cleanup:()=>{c.remove(g),a.removeType(g)}})})});
6
+ `},init(){const e=[l].map(t=>`change:${t}`).join(" ");this.on(e,this.updateTraits),this.on(`change:${l}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(e,t,s){if(s.adjust)return;const p=this.get(l)==="video"?"video":"image";this.addAttributes({[L]:p,href:""})},adjustSourceType(){const e=this.get(l),t=this.getAttributes().href||"",s={adjust:!0};if(e==="video"){const n=t.includes("youtube.com")?"youtube":"video";this.addAttributes({[L]:n},s)}else e!=="el"&&t.startsWith("#")?this.set(l,"el",s):e==="image"&&this.addAttributes({[L]:"image"},s)},updateTraits(e={}){const{changed:t}=this,{init:s}=e;if(t[V.name]||s){this.removeTrait([N.name,j.name,O.name]);const n=this.get(l)||"image",p=this.getTraitIndex(l)+1;this.addTrait(Q[n],{at:p})}},initToolbar(){if(!C)return;const{toolbar:e}=this,t=Y(this);!e.find(n=>n.id===t.id)&&(e==null||e.unshift(t))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var y;const{em:e,el:t,model:s}=this,{Canvas:n}=e,p=s.getAttributes()[S],{defaultView:d,documentElement:_}=t.ownerDocument,x=(y=d.fsLightboxInstances)==null?void 0:y[p];if(_.classList.contains(z))x.close();else{t.__skipLb=!1;let T;x.props.onOpen=()=>{T=n.getSpots(),setTimeout(()=>n.removeSpots())},x.props.onClose=()=>{T.forEach(w=>n.addSpot(w.attributes))},t.click()}}}}),K({editor:o,licenseKey:r.licenseKey,pluginName:q,cleanup:()=>{c.remove(g),a.removeType(g)}})})});
@@ -2,4 +2,5 @@ export { default as dialogComponent } from './dialogComponent';
2
2
  export { default as tableComponent } from './tableComponent';
3
3
  export { default as listPagesComponent } from './listPagesComponent';
4
4
  export { default as fsLightboxComponent } from './fsLightboxComponent';
5
+ export { default as lightGalleryComponent } from './lightGalleryComponent';
5
6
  export { default as rteProseMirror } from './prosemirror';