@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36

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 (88) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +175 -162
  3. package/dist/accordionComponent/index.umd.js +7 -7
  4. package/dist/aiChat/index.cjs.js +64 -64
  5. package/dist/aiChat/index.es.js +5785 -5757
  6. package/dist/aiChat/index.js +64 -64
  7. package/dist/aiChat/index.umd.js +63 -63
  8. package/dist/animationComponent/index.cjs.js +3 -3
  9. package/dist/animationComponent/index.es.js +204 -191
  10. package/dist/animationComponent/index.umd.js +3 -3
  11. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  12. package/dist/canvasAbsoluteMode/index.es.js +183 -170
  13. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  14. package/dist/canvasEmptyState/index.cjs.js +1 -1
  15. package/dist/canvasEmptyState/index.es.js +134 -121
  16. package/dist/canvasEmptyState/index.umd.js +1 -1
  17. package/dist/canvasFullSize/index.cjs.js +9 -9
  18. package/dist/canvasFullSize/index.es.js +165 -152
  19. package/dist/canvasFullSize/index.umd.js +9 -9
  20. package/dist/canvasGridMode/index.cjs.js +5 -5
  21. package/dist/canvasGridMode/index.es.js +245 -232
  22. package/dist/canvasGridMode/index.umd.js +4 -4
  23. package/dist/canvasScreenshot/index.cjs.js +1 -1
  24. package/dist/canvasScreenshot/index.es.js +155 -142
  25. package/dist/canvasScreenshot/index.umd.js +1 -1
  26. package/dist/dataSourceEjs/index.cjs.js +9 -9
  27. package/dist/dataSourceEjs/index.es.js +257 -244
  28. package/dist/dataSourceEjs/index.umd.js +9 -9
  29. package/dist/dataSourceHandlebars/index.cjs.js +8 -8
  30. package/dist/dataSourceHandlebars/index.es.js +216 -203
  31. package/dist/dataSourceHandlebars/index.umd.js +7 -7
  32. package/dist/dialogComponent/index.cjs.js +14 -14
  33. package/dist/dialogComponent/index.es.js +141 -128
  34. package/dist/dialogComponent/index.umd.js +14 -14
  35. package/dist/flexComponent/index.cjs.js +13 -13
  36. package/dist/flexComponent/index.es.js +484 -471
  37. package/dist/flexComponent/index.umd.js +13 -13
  38. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  39. package/dist/fsLightboxComponent/index.es.js +173 -160
  40. package/dist/fsLightboxComponent/index.umd.js +3 -3
  41. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  42. package/dist/googleFontsAssetProvider/index.es.js +160 -147
  43. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  44. package/dist/iconifyComponent/index.cjs.js +2 -2
  45. package/dist/iconifyComponent/index.es.js +196 -183
  46. package/dist/iconifyComponent/index.umd.js +2 -2
  47. package/dist/index.cjs.js +25 -25
  48. package/dist/index.es.js +121 -108
  49. package/dist/index.umd.js +18 -18
  50. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  51. package/dist/layoutSidebarButtons/index.es.js +157 -144
  52. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  53. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  54. package/dist/lightGalleryComponent/index.es.js +245 -232
  55. package/dist/lightGalleryComponent/index.umd.js +1 -1
  56. package/dist/linkImageComponent/index.cjs.js +2 -2
  57. package/dist/linkImageComponent/index.es.js +106 -93
  58. package/dist/linkImageComponent/index.umd.js +2 -2
  59. package/dist/listPagesComponent/index.cjs.js +5 -5
  60. package/dist/listPagesComponent/index.es.js +157 -144
  61. package/dist/listPagesComponent/index.umd.js +5 -5
  62. package/dist/presetPrintable/index.cjs.js +3 -3
  63. package/dist/presetPrintable/index.es.js +181 -168
  64. package/dist/presetPrintable/index.umd.js +3 -3
  65. package/dist/prosemirror/index.cjs.js +7 -7
  66. package/dist/prosemirror/index.es.js +385 -372
  67. package/dist/prosemirror/index.umd.js +8 -8
  68. package/dist/rendererReact/index.cjs.js +1 -1
  69. package/dist/rendererReact/index.es.js +200 -187
  70. package/dist/rendererReact/index.js +1 -1
  71. package/dist/rendererReact/index.umd.js +1 -1
  72. package/dist/rteTinyMce/index.cjs.js +2 -2
  73. package/dist/rteTinyMce/index.es.js +118 -105
  74. package/dist/rteTinyMce/index.umd.js +2 -2
  75. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  76. package/dist/shapeDividerComponent/index.es.js +129 -116
  77. package/dist/shapeDividerComponent/index.umd.js +4 -4
  78. package/dist/swiperComponent/index.cjs.js +9 -9
  79. package/dist/swiperComponent/index.es.js +203 -190
  80. package/dist/swiperComponent/index.umd.js +7 -7
  81. package/dist/tableComponent/index.cjs.js +1 -1
  82. package/dist/tableComponent/index.es.js +257 -244
  83. package/dist/tableComponent/index.umd.js +1 -1
  84. package/dist/types.d.ts +1 -1
  85. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  86. package/dist/youtubeAssetProvider/index.es.js +121 -108
  87. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  88. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- const se = "app.grapesjs.com", re = "app-stage.grapesjs.com", ue = "app2.grapesjs.com", he = "app-stage2.grapesjs.com", Y = [
2
- se,
3
- ue,
1
+ const re = "app.grapesjs.com", ce = "app-stage.grapesjs.com", ge = "app2.grapesjs.com", he = "app-stage2.grapesjs.com", ee = [
4
2
  re,
3
+ ge,
4
+ ce,
5
5
  he,
6
6
  "localhost",
7
7
  "127.0.0.1",
@@ -11,151 +11,164 @@ const se = "app.grapesjs.com", re = "app-stage.grapesjs.com", ue = "app2.grapesj
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], ge = "license:check:start", be = "license:check:end", me = () => typeof window < "u", de = ({
14
+ ], be = "license:check:end", de = () => typeof window < "u", ye = ({
15
15
  isDev: e,
16
- isStage: n,
16
+ isStage: l,
17
17
  isPlatform: t
18
- }) => `${e ? "" : `https://${n ? re : se}`}/${t ? "platform-api" : "api"}`, ye = () => {
19
- const e = me() && window.location.hostname;
20
- return !!e && (Y.includes(e) || Y.some((n) => e.endsWith(n)));
18
+ }) => `${e ? "" : `https://${l ? ce : re}`}/${t ? "platform-api" : "api"}`, me = () => {
19
+ const e = de() && window.location.hostname;
20
+ return !!e && (ee.includes(e) || ee.some((l) => e.endsWith(l)));
21
21
  };
22
22
  async function ve({
23
23
  path: e,
24
- baseApiUrl: n,
24
+ baseApiUrl: l,
25
25
  method: t = "GET",
26
- headers: l = {},
27
- params: o,
28
- body: u
26
+ headers: o = {},
27
+ params: i,
28
+ body: g
29
29
  }) {
30
- const p = `${n || de({ isDev: !1, isStage: !1 })}${e}`, h = {
30
+ const n = `${l || ye({ isDev: !1, isStage: !1 })}${e}`, u = {
31
31
  method: t,
32
32
  headers: {
33
33
  "Content-Type": "application/json",
34
- ...l
34
+ ...o
35
35
  }
36
36
  };
37
- u && (h.body = JSON.stringify(u));
38
- const c = o ? new URLSearchParams(o).toString() : "", b = c ? `?${c}` : "", s = await fetch(`${p}${b}`, h);
39
- if (!s.ok)
40
- throw new Error(`HTTP error! status: ${s.status}`);
41
- return s.json();
37
+ g && (u.body = JSON.stringify(g));
38
+ const p = i ? new URLSearchParams(i).toString() : "", b = p ? `?${p}` : "", r = await fetch(`${n}${b}`, u);
39
+ if (!r.ok)
40
+ throw new Error(`HTTP error! status: ${r.status}`);
41
+ return r.json();
42
42
  }
43
- var G = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(G || {});
44
- const ee = {
45
- [G.free]: 0,
46
- [G.startup]: 10,
47
- [G.business]: 20,
48
- [G.enterprise]: 30
43
+ var E = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(E || {}), Z = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", e.sidebarLeftSet = "studio:sidebarLeft:set", e.sidebarLeftGet = "studio:sidebarLeft:get", e.sidebarLeftToggle = "studio:sidebarLeft:toggle", e.sidebarRightSet = "studio:sidebarRight:set", e.sidebarRightGet = "studio:sidebarRight:get", e.sidebarRightToggle = "studio:sidebarRight:toggle", e.sidebarTopSet = "studio:sidebarTop:set", e.sidebarTopGet = "studio:sidebarTop:get", e.sidebarTopToggle = "studio:sidebarTop:toggle", e.sidebarBottomSet = "studio:sidebarBottom:set", e.sidebarBottomGet = "studio:sidebarBottom:get", e.sidebarBottomToggle = "studio:sidebarBottom:toggle", e.symbolAdd = "studio:symbolAdd", e.symbolDetach = "studio:symbolDetach", e.symbolOverride = "studio:symbolOverride", e.symbolPropagateStyles = "studio:propagateStyles", e.getPagesConfig = "studio:getPagesConfig", e.setPagesConfig = "studio:setPagesConfig", e.getPageSettings = "studio:getPageSettings", e.setPageSettings = "studio:setPageSettings", e.clearPage = "studio:clearPage", e.projectFiles = "studio:projectFiles", e.validateCode = "studio:validateCode", e.canvasReload = "studio:canvasReload", e.getBlocksPanel = "studio:getBlocksPanel", e.setBlocksPanel = "studio:setBlocksPanel", e.getStateContextMenu = "studio:getStateContextMenu", e.setStateContextMenu = "studio:setStateContextMenu", e.contextMenuComponent = "studio:contextMenuComponent", e.layoutAdd = "studio:layoutAdd", e.layoutRemove = "studio:layoutRemove", e.layoutToggle = "studio:layoutToggle", e.layoutUpdate = "studio:layoutUpdate", e.layoutGet = "studio:layoutGet", e.layoutConfigGet = "studio:layoutConfigGet", e.layoutConfigSet = "studio:layoutConfigSet", e.layoutComponentAdd = "studio:layoutComponentAdd", e.layoutComponentGet = "studio:layoutComponentGet", e.layoutComponentRemove = "studio:layoutComponentRemove", e.layoutComponentRender = "studio:layoutComponentRender", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.settings = "studio:settings", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e.fontManagerOpen = "studio:fontManagerOpen", e.menuFontLoad = "studio:menuFontLoad", e.toggleStateDataSource = "studio:toggleStateDataSource", e.getStateDataSource = "studio:getStateDataSource", e.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", e.dataSourceSetImporter = "studio:dataSourceSetImporter", e.dataSourceSetExporter = "studio:dataSourceSetExporter", e.setDragAbsolute = "studio:setDragAbsolute", e))(Z || {});
44
+ const te = {
45
+ [E.free]: 0,
46
+ [E.startup]: 10,
47
+ [E.business]: 20,
48
+ [E.enterprise]: 30
49
49
  };
50
50
  function fe(e) {
51
- const n = e;
52
- return n.init = (t) => (l) => e(l, t), n;
51
+ const l = e;
52
+ return l.init = (t) => (o) => e(o, t), l;
53
53
  }
54
54
  const Te = (e) => /* @__PURE__ */ fe(e);
55
55
  async function we({
56
56
  editor: e,
57
- plan: n,
57
+ plan: l,
58
58
  pluginName: t,
59
- licenseKey: l,
60
- onLicenseCheckResponse: o,
61
- cleanup: u
59
+ licenseKey: o,
60
+ onLicenseCheckResponse: i,
61
+ cleanup: g
62
62
  }) {
63
- let r = "", p = !1;
64
- const h = ye(), c = (s) => {
65
- console.warn("Cleanup plugin:", t, "Reason:", s), u();
66
- }, b = (s = {}) => {
67
- var k;
68
- const { error: P, sdkLicense: V } = s, T = (k = s.plan) == null ? void 0 : k.category;
69
- if (!(V || s.license) || P)
70
- c(P || "Invalid license");
63
+ let c = "", n;
64
+ const u = (r) => {
65
+ console.warn("Cleanup plugin:", t, "Reason:", r), g();
66
+ }, p = (r = {}) => {
67
+ var G;
68
+ const { error: I, sdkLicense: O } = r, T = (G = r.plan) == null ? void 0 : G.category;
69
+ if (!(O || r.license) || I)
70
+ u(I || "Invalid license");
71
71
  else if (T) {
72
- const O = ee[n], $ = ee[T];
73
- O > $ && c({ pluginRequiredPlan: n, licensePlan: T });
72
+ const M = te[l], _ = te[T];
73
+ M > _ && u({ pluginRequiredPlan: l, licensePlan: T });
74
74
  }
75
75
  };
76
- e.on(ge, (s) => {
77
- r = s == null ? void 0 : s.baseApiUrl, p = !0;
78
- }), e.on(be, (s) => {
79
- o == null || o(s), b(s);
80
- }), setTimeout(async () => {
81
- if (!p) {
82
- if (h) return;
83
- if (l) {
84
- const s = await Se({ licenseKey: l, pluginName: t, baseApiUrl: r });
85
- o == null || o(s), s && b(s);
86
- } else
87
- c("The `licenseKey` option not provided");
88
- }
89
- }, 2e3);
76
+ e.Commands.has(Z.settings) && (n = e.runCommand(Z.settings), c = (n == null ? void 0 : n.baseUrl) || "");
77
+ const b = (r) => {
78
+ i == null || i(r), r && p(r);
79
+ };
80
+ if (!n) {
81
+ e.onReady(async () => {
82
+ if (!me())
83
+ if (o) {
84
+ const r = await Pe({ licenseKey: o, pluginName: t, baseApiUrl: c });
85
+ b(r);
86
+ } else
87
+ u("The `licenseKey` option not provided");
88
+ });
89
+ return;
90
+ }
91
+ if (n.licensePlan || n.licenseError) {
92
+ const r = xe(n);
93
+ b(r);
94
+ return;
95
+ }
96
+ e.on(be, (r) => b(r));
90
97
  }
91
- async function Se(e) {
92
- const { licenseKey: n, pluginName: t, baseApiUrl: l } = e;
98
+ const xe = (e) => ({
99
+ sdkLicense: e.license,
100
+ license: e.license,
101
+ error: e.licenseError,
102
+ plan: e.licensePlan
103
+ });
104
+ async function Pe(e) {
105
+ const { licenseKey: l, pluginName: t, baseApiUrl: o } = e;
93
106
  try {
94
107
  return (await ve({
95
- baseApiUrl: l,
96
- path: `/sdk/${n || "na"}`,
108
+ baseApiUrl: o,
109
+ path: `/sdk/${l || "na"}`,
97
110
  method: "POST",
98
111
  params: {
99
112
  d: window.location.hostname,
100
113
  pn: t
101
114
  }
102
115
  })).result || {};
103
- } catch (o) {
104
- return console.error("Error during SDK license check:", o), !1;
116
+ } catch (i) {
117
+ return console.error("Error during SDK license check:", i), !1;
105
118
  }
106
119
  }
107
- const B = (e, n) => {
120
+ const z = (e, l) => {
108
121
  var t;
109
- return !!((t = e == null ? void 0 : e.hasAttribute) != null && t.call(e, n));
110
- }, xe = "lightGalleryComponent", Ie = G.startup;
111
- var E = /* @__PURE__ */ ((e) => (e.image = "image", e.video = "video", e.external = "external", e))(E || {});
112
- const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-item`, j = "toggle", A = {
122
+ return !!((t = e == null ? void 0 : e.hasAttribute) != null && t.call(e, l));
123
+ }, Ae = "lightGalleryComponent", Le = E.startup;
124
+ var S = /* @__PURE__ */ ((e) => (e.image = "image", e.video = "video", e.external = "external", e))(S || {});
125
+ const A = "lightGallery", ae = `${A}-item`, j = "data-lightgallery", oe = `${j}-item`, N = "toggle", L = {
113
126
  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>',
114
127
  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>',
115
128
  gallery: '<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>',
116
129
  galleryItem: '<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',
117
130
  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>',
118
131
  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>'
119
- }, W = { propKeys: [], props: {}, traits: [] }, _ = (e, n = {}) => {
120
- var o;
121
- const t = {}, l = [];
122
- for (const u in e) {
123
- const { value: r, ...p } = e[u];
124
- l.push({ id: u, name: u, changeProp: !0, category: n.category, ...p }), t[u] = r;
125
- const { subTraits: h = {} } = p;
126
- for (const c in p.subTraits)
127
- (o = h[c]) == null || o.forEach((b) => {
128
- const s = b.id || b.name;
129
- t[s] = b.value;
132
+ }, F = { propKeys: [], props: {}, traits: [] }, V = (e, l = {}) => {
133
+ var i;
134
+ const t = {}, o = [];
135
+ for (const g in e) {
136
+ const { value: c, ...n } = e[g];
137
+ o.push({ id: g, name: g, changeProp: !0, category: l.category, ...n }), t[g] = c;
138
+ const { subTraits: u = {} } = n;
139
+ for (const p in n.subTraits)
140
+ (i = u[p]) == null || i.forEach((b) => {
141
+ const r = b.id || b.name;
142
+ t[r] = b.value;
130
143
  });
131
144
  }
132
145
  return {
133
146
  propKeys: Object.keys(t),
134
147
  props: t,
135
- traits: l
148
+ traits: o
136
149
  };
137
- }, F = (e, n) => {
138
- const t = e.getTrait(n), l = t.get("category"), o = t.get("subTraits") || {}, r = (Object.values(o).flat() || []).map((c) => c.id || c.name);
139
- e.removeTrait(r);
140
- const p = o[t.getValue()], h = e.getTraitIndex(n) + 1;
141
- p && e.addTrait(
142
- p.map((c) => ({ category: l, ...c })),
143
- { at: h }
150
+ }, q = (e, l) => {
151
+ const t = e.getTrait(l), o = t.get("category"), i = t.get("subTraits") || {}, c = (Object.values(i).flat() || []).map((p) => p.id || p.name);
152
+ e.removeTrait(c);
153
+ const n = i[t.getValue()], u = e.getTraitIndex(l) + 1;
154
+ n && e.addTrait(
155
+ n.map((p) => ({ category: o, ...p })),
156
+ { at: u }
144
157
  );
145
- }, Z = (e, n) => {
146
- n.forEach((t) => {
147
- const l = e.getTrait(t);
148
- if (!l || !l.get("subTraits")) return;
149
- const o = l.changeProp ? `change:${t}` : `change:attributes:${t}`;
150
- e.on(o, () => F(e, t)), F(e, t);
158
+ }, W = (e, l) => {
159
+ l.forEach((t) => {
160
+ const o = e.getTrait(t);
161
+ if (!o || !o.get("subTraits")) return;
162
+ const i = o.changeProp ? `change:${t}` : `change:attributes:${t}`;
163
+ e.on(i, () => q(e, t)), q(e, t);
151
164
  });
152
- }, Ae = (e, n, t) => {
153
- const o = e.getTrait(n).get("subTraits") || {}, r = (Object.values(o).flat() || []).map((h) => {
154
- const c = h.name || h.id;
155
- return h.changeProp ? `change:${c}` : `change:attributes:${c}`;
156
- }), p = Array.from(new Set(r));
157
- p.length && e.on(p.join(" "), t);
158
- }, Pe = {
165
+ }, Ie = (e, l, t) => {
166
+ const i = e.getTrait(l).get("subTraits") || {}, c = (Object.values(i).flat() || []).map((u) => {
167
+ const p = u.name || u.id;
168
+ return u.changeProp ? `change:${p}` : `change:attributes:${p}`;
169
+ }), n = Array.from(new Set(c));
170
+ n.length && e.on(n.join(" "), t);
171
+ }, Ge = {
159
172
  // startAnimationDuration: {
160
173
  // type: 'number',
161
174
  // label: 'Start duration',
@@ -164,12 +177,12 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
164
177
  // step: 50,
165
178
  // min: 0
166
179
  // },
167
- [j]: {
180
+ [N]: {
168
181
  type: "button",
169
182
  label: "Toggle Gallery",
170
- command: (e, n) => {
171
- var t, l;
172
- return (l = (t = n.target) == null ? void 0 : t.getView()) == null ? void 0 : l.toggleGallery();
183
+ command: (e, l) => {
184
+ var t, o;
185
+ return (o = (t = l.target) == null ? void 0 : t.getView()) == null ? void 0 : o.toggleGallery();
173
186
  }
174
187
  },
175
188
  speed: {
@@ -371,7 +384,7 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
371
384
  ]
372
385
  }
373
386
  }
374
- }, Le = {
387
+ }, Se = {
375
388
  autoplay: {
376
389
  category: { id: "autoplay-options", label: "Autoplay options" },
377
390
  type: "checkbox",
@@ -477,15 +490,15 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
477
490
  ]
478
491
  }
479
492
  }
480
- }, f = "sourceType", K = "data-iframe", q = {
493
+ }, f = "sourceType", U = "data-iframe", J = {
481
494
  name: "href",
482
495
  type: "file",
483
496
  label: "Image Source"
484
- }, H = {
497
+ }, K = {
485
498
  name: "data-src",
486
499
  label: "Video Source",
487
500
  placeholder: "https://www.youtube.com/watch?v=..."
488
- }, J = {
501
+ }, C = {
489
502
  name: "data-poster",
490
503
  label: "Video Poster",
491
504
  type: "file"
@@ -493,21 +506,21 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
493
506
  name: "data-src",
494
507
  label: "External Source",
495
508
  placeholder: "https://some-external-source.com/...."
496
- }, ce = {
509
+ }, pe = {
497
510
  label: "Caption",
498
511
  name: "data-sub-html",
499
512
  placeholder: "My caption",
500
513
  changeProp: !1
501
- }, Ge = {
502
- [j]: {
514
+ }, Oe = {
515
+ [N]: {
503
516
  type: "button",
504
517
  label: "Toggle Gallery",
505
- command: (e, n) => {
506
- var o, u;
507
- const t = n.target, l = (o = t == null ? void 0 : t.closestType(I)) == null ? void 0 : o.getView();
508
- if (l && t) {
509
- const r = ((u = l.getLightGallery()) == null ? void 0 : u.items) || [], p = Array.from(r).indexOf(t.getEl());
510
- p >= 0 && l.toggleGallery(p);
518
+ command: (e, l) => {
519
+ var i, g;
520
+ const t = l.target, o = (i = t == null ? void 0 : t.closestType(A)) == null ? void 0 : i.getView();
521
+ if (o && t) {
522
+ const c = ((g = o.getLightGallery()) == null ? void 0 : g.items) || [], n = Array.from(c).indexOf(t.getEl());
523
+ n >= 0 && o.toggleGallery(n);
511
524
  }
512
525
  }
513
526
  },
@@ -517,107 +530,107 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
517
530
  labelToTitle: !0,
518
531
  value: "image",
519
532
  subTraits: {
520
- image: [q],
521
- video: [H, J],
533
+ image: [J],
534
+ video: [K, C],
522
535
  external: [le]
523
536
  },
524
537
  options: [
525
- { id: "image", label: q.label || "", icon: A.image },
526
- { id: "video", label: H.label || "", icon: A.video },
527
- { id: "external", label: le.label || "", icon: A.external }
538
+ { id: "image", label: J.label || "", icon: L.image },
539
+ { id: "video", label: K.label || "", icon: L.video },
540
+ { id: "external", label: le.label || "", icon: L.external }
528
541
  ]
529
542
  },
530
- subHtml: ce
543
+ subHtml: pe
531
544
  // This unfortuntaly breaks other thumbnails
532
545
  // customThumb: traitCustomThumb
533
- }, ne = "lgThumbnail", Ve = "lgVideo", oe = "lgAutoplay", ie = "lgZoom", L = "https://cdn.jsdelivr.net/npm/lightgallery@2.8.2", Oe = function(e, n = {}) {
534
- const { Blocks: t, Components: l } = e, o = "LightGallery", u = "LightGallery Item", r = {
535
- toolbarIconOpen: A.eye,
546
+ }, se = "lgThumbnail", Me = "lgVideo", ie = "lgAutoplay", ne = "lgZoom", k = "https://cdn.jsdelivr.net/npm/lightgallery@2.8.2", De = function(e, l = {}) {
547
+ const { Blocks: t, Components: o } = e, i = "LightGallery", g = "LightGallery Item", c = {
548
+ toolbarIconOpen: L.eye,
536
549
  block: {},
537
550
  lgLicenseKey: "92DE1DB8-7986-4F02-B908-514F97678D28",
538
551
  defaultSrc: "https://placehold.co/200/777/white.png?text=Image",
539
- plugins: [ne, Ve, oe, ie],
552
+ plugins: [se, Me, ie, ne],
540
553
  cdnScript: [
541
- `${L}/lightgallery.min.js`,
542
- `${L}/plugins/thumbnail/lg-thumbnail.min.js`,
543
- `${L}/plugins/video/lg-video.min.js`,
544
- `${L}/plugins/autoplay/lg-autoplay.min.js`,
545
- `${L}/plugins/zoom/lg-zoom.min.js`
554
+ `${k}/lightgallery.min.js`,
555
+ `${k}/plugins/thumbnail/lg-thumbnail.min.js`,
556
+ `${k}/plugins/video/lg-video.min.js`,
557
+ `${k}/plugins/autoplay/lg-autoplay.min.js`,
558
+ `${k}/plugins/zoom/lg-zoom.min.js`
546
559
  ],
547
- cdnStyle: `${L}/css/lightgallery-bundle.min.css`,
548
- ...n
549
- }, { block: p, toolbarIconOpen: h, defaultSrc: c } = r, b = function(a) {
550
- const i = this, g = window, { plugins: d, cdnScript: w, cdnStyle: C, inline: R, lgLicenseKey: pe, ...y } = a || {}, S = (m) => isNaN(m) ? void 0 : parseInt(m, 10), Q = () => {
551
- var D;
552
- const m = {
553
- ...y,
554
- licenseKey: pe,
555
- speed: S(y.speed),
556
- startAnimationDuration: S(y.startAnimationDuration),
557
- thumbMargin: S(y.thumbMargin),
558
- thumbWidth: S(y.thumbWidth),
559
- slideShowInterval: S(y.slideShowInterval),
560
- scale: S(y.scale),
561
- enableZoomAfter: S(y.enableZoomAfter),
562
- plugins: (d || []).map((N) => g[N])
560
+ cdnStyle: `${k}/css/lightgallery-bundle.min.css`,
561
+ ...l
562
+ }, { block: n, toolbarIconOpen: u, defaultSrc: p } = c, b = function(a) {
563
+ const s = this, h = window, { plugins: y, cdnScript: w, cdnStyle: D, inline: Q, lgLicenseKey: ue, ...m } = a || {}, x = (d) => isNaN(d) ? void 0 : parseInt(d, 10), X = () => {
564
+ var B;
565
+ const d = {
566
+ ...m,
567
+ licenseKey: ue,
568
+ speed: x(m.speed),
569
+ startAnimationDuration: x(m.startAnimationDuration),
570
+ thumbMargin: x(m.thumbMargin),
571
+ thumbWidth: x(m.thumbWidth),
572
+ slideShowInterval: x(m.slideShowInterval),
573
+ scale: x(m.scale),
574
+ enableZoomAfter: x(m.enableZoomAfter),
575
+ plugins: (y || []).map(($) => h[$])
563
576
  };
564
- R && (m.container = i, m.closable = !1);
565
- const z = (D = g.lightGallery) == null ? void 0 : D.call(g, i, m);
566
- R && z.openGallery();
577
+ Q && (d.container = s, d.closable = !1);
578
+ const H = (B = h.lightGallery) == null ? void 0 : B.call(h, s, d);
579
+ Q && H.openGallery();
567
580
  };
568
- if (g.lightGallery)
569
- Q();
581
+ if (h.lightGallery)
582
+ X();
570
583
  else {
571
- const { head: m } = document, z = Array.isArray(w) ? [...w] : [w], D = Array.isArray(C) ? [...C] : [C], N = (x) => {
572
- if (x.length) {
584
+ const { head: d } = document, H = Array.isArray(w) ? [...w] : [w], B = Array.isArray(D) ? [...D] : [D], $ = (P) => {
585
+ if (P.length) {
573
586
  const v = document.createElement("link");
574
- v.href = x.shift(), v.rel = "stylesheet", m.appendChild(v), N(x);
587
+ v.href = P.shift(), v.rel = "stylesheet", d.appendChild(v), $(P);
575
588
  }
576
- }, X = (x) => {
577
- if (x.length) {
589
+ }, Y = (P) => {
590
+ if (P.length) {
578
591
  const v = document.createElement("script");
579
- v.src = x.shift(), v.onerror = v.onload = X.bind(null, x), m.appendChild(v);
592
+ v.src = P.shift(), v.onerror = v.onload = Y.bind(null, P), d.appendChild(v);
580
593
  } else
581
- Q();
594
+ X();
582
595
  };
583
- N(D), X(z);
596
+ $(B), Y(H);
584
597
  }
585
- }, s = (a) => {
586
- const i = a.getTrait(j);
587
- if (!h || !i) return;
588
- const { toolbar: g } = a, d = {
589
- id: j,
590
- label: h,
591
- command: () => setTimeout(() => i.runCommand(), 100)
598
+ }, r = (a) => {
599
+ const s = a.getTrait(N);
600
+ if (!u || !s) return;
601
+ const { toolbar: h } = a, y = {
602
+ id: N,
603
+ label: u,
604
+ command: () => setTimeout(() => s.runCommand(), 100)
592
605
  };
593
- !g.find((C) => C.id === d.id) && (g == null || g.unshift(d));
606
+ !h.find((D) => D.id === y.id) && (h == null || h.unshift(y));
594
607
  };
595
- let P = [];
596
- const V = r.plugins || [], T = _(Pe), M = V.includes(ne) ? _(ke) : W, k = V.includes(oe) ? _(Le) : W, O = V.includes(ie) ? _(Ee) : W;
597
- l.addType(I, {
598
- block: p && {
599
- label: o,
600
- media: A.gallery,
608
+ let I = [];
609
+ const O = c.plugins || [], T = V(Ge), R = O.includes(se) ? V(ke) : F, G = O.includes(ie) ? V(Se) : F, M = O.includes(ne) ? V(Ee) : F;
610
+ o.addType(A, {
611
+ block: n && {
612
+ label: i,
613
+ media: L.gallery,
601
614
  category: "Extra",
602
615
  select: !0,
603
- ...r.block
616
+ ...c.block
604
617
  },
605
- isComponent: (a) => B(a, U),
618
+ isComponent: (a) => z(a, j),
606
619
  extendFn: ["init", "initToolbar"],
607
620
  model: {
608
621
  defaults: {
609
- name: o,
610
- icon: A.gallery,
611
- draggable: (a, i) => !i.is(I),
612
- attributes: { [U]: !0 },
613
- components: { type: te },
622
+ name: i,
623
+ icon: L.gallery,
624
+ draggable: (a, s) => !s.is(A),
625
+ attributes: { [j]: !0 },
626
+ components: { type: ae },
614
627
  script: b,
615
628
  selector: "",
616
629
  exThumbImage: "",
617
- cdnScript: r.cdnScript,
618
- cdnStyle: r.cdnStyle,
619
- plugins: r.plugins,
620
- lgLicenseKey: r.lgLicenseKey,
630
+ cdnScript: c.cdnScript,
631
+ cdnStyle: c.cdnStyle,
632
+ plugins: c.plugins,
633
+ lgLicenseKey: c.lgLicenseKey,
621
634
  "script-props": [
622
635
  "lgLicenseKey",
623
636
  "cdnScript",
@@ -626,21 +639,21 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
626
639
  "selector",
627
640
  "exThumbImage",
628
641
  ...T.propKeys,
629
- ...M.propKeys,
630
- ...k.propKeys,
631
- ...O.propKeys
642
+ ...R.propKeys,
643
+ ...G.propKeys,
644
+ ...M.propKeys
632
645
  ],
633
646
  ...T.props,
647
+ ...R.props,
648
+ ...G.props,
634
649
  ...M.props,
635
- ...k.props,
636
- ...O.props,
637
- traits: [...T.traits, ...M.traits, ...k.traits, ...O.traits]
650
+ traits: [...T.traits, ...R.traits, ...G.traits, ...M.traits]
638
651
  },
639
652
  init() {
640
- Z(this, ["thumbnail"]), Z(this, ["autoplay"]), Z(this, ["zoom"]);
653
+ W(this, ["thumbnail"]), W(this, ["autoplay"]), W(this, ["zoom"]);
641
654
  },
642
655
  initToolbar() {
643
- s(this);
656
+ r(this);
644
657
  }
645
658
  },
646
659
  extendFnView: ["init"],
@@ -652,7 +665,7 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
652
665
  lgAfterClose: "onLgClose"
653
666
  }),
654
667
  init() {
655
- this.listenTo(this.model, l.events.scriptUnmount, this.destroyLightGallery);
668
+ this.listenTo(this.model, o.events.scriptUnmount, this.destroyLightGallery);
656
669
  },
657
670
  getLightGallery() {
658
671
  return this.el.__lg;
@@ -666,84 +679,84 @@ const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-
666
679
  a.lgOpened = !0;
667
680
  },
668
681
  isInlineGallery() {
669
- var i;
682
+ var s;
670
683
  const a = this.getLightGallery();
671
- return ((i = a == null ? void 0 : a.settings) == null ? void 0 : i.container) === this.el;
684
+ return ((s = a == null ? void 0 : a.settings) == null ? void 0 : s.container) === this.el;
672
685
  },
673
686
  onLgInit(a) {
674
687
  this.el.__lg = a.detail.instance, !this.isInlineGallery() && this.disableLgInCanvas();
675
688
  },
676
689
  onLgOpen() {
677
- const { em: a } = this, { Canvas: i } = a, g = this.getLightGallery();
678
- P = i.getSpots(), setTimeout(() => i.removeSpots()), g.__lgOpened = !0;
690
+ const { em: a } = this, { Canvas: s } = a, h = this.getLightGallery();
691
+ I = s.getSpots(), setTimeout(() => s.removeSpots()), h.__lgOpened = !0;
679
692
  },
680
693
  onLgClose() {
681
694
  const a = this.getLightGallery();
682
- P.forEach((i) => this.em.Canvas.addSpot(i.attributes)), P = [], a.__lgOpened = !1, setTimeout(() => this.disableLgInCanvas());
695
+ I.forEach((s) => this.em.Canvas.addSpot(s.attributes)), I = [], a.__lgOpened = !1, setTimeout(() => this.disableLgInCanvas());
683
696
  },
684
697
  toggleGallery(a) {
685
- const i = this.getLightGallery();
686
- if (i.__lgOpened) return i.closeGallery(!0);
687
- i.lgOpened = !1, i.openGallery(a);
698
+ const s = this.getLightGallery();
699
+ if (s.__lgOpened) return s.closeGallery(!0);
700
+ s.lgOpened = !1, s.openGallery(a);
688
701
  }
689
702
  }
690
703
  });
691
- const $ = _(Ge);
692
- l.addType(te, {
693
- isComponent: (a) => B(a, ae) || a.tagName === "A" && B(a.parentElement, U),
704
+ const _ = V(Oe);
705
+ o.addType(ae, {
706
+ isComponent: (a) => z(a, oe) || a.tagName === "A" && z(a.parentElement, j),
694
707
  extendFn: ["init", "initToolbar"],
695
708
  model: {
696
709
  defaults: {
697
710
  tagName: "a",
698
- name: u,
699
- icon: A.galleryItem,
700
- attributes: { [ae]: !0, href: c },
701
- components: { type: "image", attributes: { alt: "Image", src: c } },
702
- ...$.props,
703
- traits: [...$.traits]
711
+ name: g,
712
+ icon: L.galleryItem,
713
+ attributes: { [oe]: !0, href: p },
714
+ components: { type: "image", attributes: { alt: "Image", src: p } },
715
+ ..._.props,
716
+ traits: [..._.traits]
704
717
  },
705
718
  init() {
706
- const a = [f].map((i) => `change:${i}`).join(" ");
707
- this.initSourceType(), this.on(a, this.updateTraits), this.updateTraits({ init: !0 }), this.initScriptUpdate(), Ae(this, f, this.triggerGalleryUpdate);
719
+ const a = [f].map((s) => `change:${s}`).join(" ");
720
+ this.initSourceType(), this.on(a, this.updateTraits), this.updateTraits({ init: !0 }), this.initScriptUpdate(), Ie(this, f, this.triggerGalleryUpdate);
708
721
  },
709
722
  initToolbar() {
710
- s(this);
723
+ r(this);
711
724
  },
712
725
  initScriptUpdate() {
713
- const a = [ce.name].map((i) => `change:attributes:${i}`).join(" ");
726
+ const a = [pe.name].map((s) => `change:attributes:${s}`).join(" ");
714
727
  this.on(a, this.triggerGalleryUpdate);
715
728
  },
716
729
  triggerGalleryUpdate(...a) {
717
- var i;
718
- (i = this.closestType(I)) == null || i.__scriptPropsChange(...a);
730
+ var s;
731
+ (s = this.closestType(A)) == null || s.__scriptPropsChange(...a);
719
732
  },
720
733
  updateTraits(a = {}) {
721
- const { changed: i } = this, { init: g } = a;
722
- if (i[f] || g) {
723
- F(this, f);
724
- const d = this.getTrait(f).getValue();
725
- if (d === E.image) {
726
- this.removeAttributes([H.name, J.name, K]);
727
- const w = this.getTrait(q.name);
728
- w.setValue(w.getValue() || c);
729
- } else d === E.video ? this.removeAttributes([K]) : d === E.external && this.addAttributes({ [K]: !0 });
734
+ const { changed: s } = this, { init: h } = a;
735
+ if (s[f] || h) {
736
+ q(this, f);
737
+ const y = this.getTrait(f).getValue();
738
+ if (y === S.image) {
739
+ this.removeAttributes([K.name, C.name, U]);
740
+ const w = this.getTrait(J.name);
741
+ w.setValue(w.getValue() || p);
742
+ } else y === S.video ? this.removeAttributes([U]) : y === S.external && this.addAttributes({ [U]: !0 });
730
743
  }
731
744
  },
732
745
  initSourceType() {
733
746
  const a = this.getAttributes({ noClass: !0, noStyle: !0 });
734
- a[K] ? this.set(f, E.external) : (a[H.name] || a[J.name]) && this.set(f, E.video);
747
+ a[U] ? this.set(f, S.external) : (a[K.name] || a[C.name]) && this.set(f, S.video);
735
748
  }
736
749
  }
737
750
  }), we({
738
751
  editor: e,
739
- plan: Ie,
740
- licenseKey: r.licenseKey,
741
- pluginName: xe,
752
+ plan: Le,
753
+ licenseKey: c.licenseKey,
754
+ pluginName: Ae,
742
755
  cleanup: () => {
743
- t.remove(I), l.removeType(I);
756
+ t.remove(A), o.removeType(A);
744
757
  }
745
758
  });
746
- }, Ce = Te(Oe);
759
+ }, Ve = Te(De);
747
760
  export {
748
- Ce as default
761
+ Ve as default
749
762
  };