@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,11 +1,11 @@
1
1
  import { jsx as y } from "react/jsx-runtime";
2
- import { useState as R, useEffect as I, createElement as B, Fragment as T } from "react";
3
- import { createRoot as L } from "react-dom/client";
4
- const U = "app.grapesjs.com", W = "app-stage.grapesjs.com", K = "app2.grapesjs.com", F = "app-stage2.grapesjs.com", P = [
2
+ import { useState as O, useEffect as I, createElement as F, Fragment as D } from "react";
3
+ import { createRoot as W } from "react-dom/client";
4
+ const U = "app.grapesjs.com", M = "app-stage.grapesjs.com", $ = "app2.grapesjs.com", K = "app-stage2.grapesjs.com", N = [
5
5
  U,
6
+ $,
7
+ M,
6
8
  K,
7
- W,
8
- F,
9
9
  "localhost",
10
10
  "127.0.0.1",
11
11
  ".local-credentialless.webcontainer.io",
@@ -14,88 +14,101 @@ const U = "app.grapesjs.com", W = "app-stage.grapesjs.com", K = "app2.grapesjs.c
14
14
  // For stackblitz.com demos
15
15
  "-sandpack.codesandbox.io"
16
16
  // For Sandpack demos
17
- ], M = "license:check:start", V = "license:check:end", z = () => typeof window < "u", G = ({
17
+ ], S = "license:check:end", V = () => typeof window < "u", z = ({
18
18
  isDev: e,
19
19
  isStage: t,
20
- isPlatform: n
21
- }) => `${e ? "" : `https://${t ? W : U}`}/${n ? "platform-api" : "api"}`, J = () => {
22
- const e = z() && window.location.hostname;
23
- return !!e && (P.includes(e) || P.some((t) => e.endsWith(t)));
24
- }, q = (e) => e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, n) => (n ? "-" : "") + t.toLowerCase()), x = (e) => typeof e == "string";
20
+ isPlatform: o
21
+ }) => `${e ? "" : `https://${t ? M : U}`}/${o ? "platform-api" : "api"}`, J = () => {
22
+ const e = V() && window.location.hostname;
23
+ return !!e && (N.includes(e) || N.some((t) => e.endsWith(t)));
24
+ }, q = (e) => e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t, o) => (o ? "-" : "") + t.toLowerCase()), L = (e) => typeof e == "string";
25
25
  function H(e) {
26
26
  return typeof e == "function";
27
27
  }
28
28
  async function Z({
29
29
  path: e,
30
30
  baseApiUrl: t,
31
- method: n = "GET",
31
+ method: o = "GET",
32
32
  headers: s = {},
33
33
  params: r,
34
- body: o
34
+ body: n
35
35
  }) {
36
- const a = `${t || G({ isDev: !1, isStage: !1 })}${e}`, i = {
37
- method: n,
36
+ const a = `${t || z({ isDev: !1, isStage: !1 })}${e}`, c = {
37
+ method: o,
38
38
  headers: {
39
39
  "Content-Type": "application/json",
40
40
  ...s
41
41
  }
42
42
  };
43
- o && (i.body = JSON.stringify(o));
44
- const f = r ? new URLSearchParams(r).toString() : "", d = f ? `?${f}` : "", p = await fetch(`${a}${d}`, i);
43
+ n && (c.body = JSON.stringify(n));
44
+ const u = r ? new URLSearchParams(r).toString() : "", d = u ? `?${u}` : "", p = await fetch(`${a}${d}`, c);
45
45
  if (!p.ok)
46
46
  throw new Error(`HTTP error! status: ${p.status}`);
47
47
  return p.json();
48
48
  }
49
- var g = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(g || {});
50
- const O = {
51
- [g.free]: 0,
52
- [g.startup]: 10,
53
- [g.business]: 20,
54
- [g.enterprise]: 30
49
+ var v = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(v || {}), k = /* @__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))(k || {});
50
+ const B = {
51
+ [v.free]: 0,
52
+ [v.startup]: 10,
53
+ [v.business]: 20,
54
+ [v.enterprise]: 30
55
55
  };
56
56
  function Q(e) {
57
57
  const t = e;
58
- return t.init = (n) => (s) => e(s, n), t;
58
+ return t.init = (o) => (s) => e(s, o), t;
59
59
  }
60
60
  const X = (e) => /* @__PURE__ */ Q(e);
61
61
  async function Y({
62
62
  editor: e,
63
63
  plan: t,
64
- pluginName: n,
64
+ pluginName: o,
65
65
  licenseKey: s,
66
66
  onLicenseCheckResponse: r,
67
- cleanup: o
67
+ cleanup: n
68
68
  }) {
69
- let c = "", a = !1;
70
- const i = J(), f = (p) => {
71
- console.warn("Cleanup plugin:", n, "Reason:", p), o();
72
- }, d = (p = {}) => {
73
- var C;
74
- const { error: m, sdkLicense: u } = p, l = (C = p.plan) == null ? void 0 : C.category;
75
- if (!(u || p.license) || m)
76
- f(m || "Invalid license");
69
+ let i = "", a;
70
+ const c = (p) => {
71
+ console.warn("Cleanup plugin:", o, "Reason:", p), n();
72
+ }, u = (p = {}) => {
73
+ var R;
74
+ const { error: g, sdkLicense: f } = p, l = (R = p.plan) == null ? void 0 : R.category;
75
+ if (!(f || p.license) || g)
76
+ c(g || "Invalid license");
77
77
  else if (l) {
78
- const w = O[t], b = O[l];
79
- w > b && f({ pluginRequiredPlan: t, licensePlan: l });
78
+ const m = B[t], w = B[l];
79
+ m > w && c({ pluginRequiredPlan: t, licensePlan: l });
80
80
  }
81
81
  };
82
- e.on(M, (p) => {
83
- c = p == null ? void 0 : p.baseApiUrl, a = !0;
84
- }), e.on(V, (p) => {
85
- r == null || r(p), d(p);
86
- }), setTimeout(async () => {
87
- if (!a) {
88
- if (i) return;
89
- if (s) {
90
- const p = await ee({ licenseKey: s, pluginName: n, baseApiUrl: c });
91
- r == null || r(p), p && d(p);
92
- } else
93
- f("The `licenseKey` option not provided");
94
- }
95
- }, 2e3);
82
+ e.Commands.has(k.settings) && (a = e.runCommand(k.settings), i = (a == null ? void 0 : a.baseUrl) || "");
83
+ const d = (p) => {
84
+ r == null || r(p), p && u(p);
85
+ };
86
+ if (!a) {
87
+ e.onReady(async () => {
88
+ if (!J())
89
+ if (s) {
90
+ const p = await te({ licenseKey: s, pluginName: o, baseApiUrl: i });
91
+ d(p);
92
+ } else
93
+ c("The `licenseKey` option not provided");
94
+ });
95
+ return;
96
+ }
97
+ if (a.licensePlan || a.licenseError) {
98
+ const p = ee(a);
99
+ d(p);
100
+ return;
101
+ }
102
+ e.on(S, (p) => d(p));
96
103
  }
97
- async function ee(e) {
98
- const { licenseKey: t, pluginName: n, baseApiUrl: s } = e;
104
+ const ee = (e) => ({
105
+ sdkLicense: e.license,
106
+ license: e.license,
107
+ error: e.licenseError,
108
+ plan: e.licensePlan
109
+ });
110
+ async function te(e) {
111
+ const { licenseKey: t, pluginName: o, baseApiUrl: s } = e;
99
112
  try {
100
113
  return (await Z({
101
114
  baseApiUrl: s,
@@ -103,100 +116,100 @@ async function ee(e) {
103
116
  method: "POST",
104
117
  params: {
105
118
  d: window.location.hostname,
106
- pn: n
119
+ pn: o
107
120
  }
108
121
  })).result || {};
109
122
  } catch (r) {
110
123
  return console.error("Error during SDK license check:", r), !1;
111
124
  }
112
125
  }
113
- function te(e) {
126
+ function oe(e) {
114
127
  const t = {};
115
- for (const n in e)
116
- if (Object.prototype.hasOwnProperty.call(e, n)) {
117
- const s = q(n);
118
- t[s] = e[n];
128
+ for (const o in e)
129
+ if (Object.prototype.hasOwnProperty.call(e, o)) {
130
+ const s = q(o);
131
+ t[s] = e[o];
119
132
  }
120
133
  return t;
121
134
  }
122
135
  const ne = (e, t) => {
123
- const n = e.components || {};
124
- for (const s in n) {
125
- const r = n[s];
136
+ const o = e.components || {};
137
+ for (const s in o) {
138
+ const r = o[s];
126
139
  if (r.component === t)
127
140
  return { cmpConfig: r, type: s };
128
141
  }
129
142
  };
130
- function D(e) {
143
+ function C(e) {
131
144
  const t = {};
132
- let n = !1;
145
+ let o = !1;
133
146
  for (const s in e)
134
147
  if (Object.prototype.hasOwnProperty.call(e, s)) {
135
148
  const r = e[s];
136
149
  if (typeof r == "string" || typeof r == "number") {
137
- const o = s.includes("-") ? s.replace(/-([a-z])/g, (c) => c[1].toUpperCase()) : s;
138
- t[o] = r, n = !0;
150
+ const n = s.includes("-") ? s.replace(/-([a-z])/g, (i) => i[1].toUpperCase()) : s;
151
+ t[n] = r, o = !0;
139
152
  }
140
153
  }
141
- return n ? t : void 0;
154
+ return o ? t : void 0;
142
155
  }
143
- function oe(e) {
156
+ function se(e) {
144
157
  const t = {};
145
- return e.split(";").forEach((n) => {
146
- if (!n.trim()) return;
147
- const s = n.indexOf(":");
158
+ return e.split(";").forEach((o) => {
159
+ if (!o.trim()) return;
160
+ const s = o.indexOf(":");
148
161
  if (s > 0) {
149
- const r = n.substring(0, s).trim(), o = n.substring(s + 1).trim();
150
- if (r && o) {
151
- const c = r.replace(/-([a-z])/g, (a) => a[1].toUpperCase());
152
- t[c] = o;
162
+ const r = o.substring(0, s).trim(), n = o.substring(s + 1).trim();
163
+ if (r && n) {
164
+ const i = r.replace(/-([a-z])/g, (a) => a[1].toUpperCase());
165
+ t[i] = n;
153
166
  }
154
167
  }
155
168
  }), Object.keys(t).length > 0 ? t : void 0;
156
169
  }
157
- function se(e) {
170
+ function re(e) {
158
171
  if (e) {
159
172
  if (typeof e == "object" && !Array.isArray(e))
160
- return D(e);
173
+ return C(e);
161
174
  if (typeof e == "string") {
162
- let t = oe(e);
175
+ let t = se(e);
163
176
  if (!t)
164
177
  try {
165
- const n = JSON.parse(e);
166
- typeof n == "object" && n !== null && !Array.isArray(n) && (t = D(n));
167
- } catch (n) {
168
- console.error("Failed to parse style string as JSON", n);
178
+ const o = JSON.parse(e);
179
+ typeof o == "object" && o !== null && !Array.isArray(o) && (t = C(o));
180
+ } catch (o) {
181
+ console.error("Failed to parse style string as JSON", o);
169
182
  }
170
183
  return t;
171
184
  }
172
185
  if (Array.isArray(e)) {
173
186
  const t = {};
174
- return e.forEach((n) => {
175
- if (typeof n == "object" && n !== null) {
176
- const s = n.name || n.property, r = n.value;
187
+ return e.forEach((o) => {
188
+ if (typeof o == "object" && o !== null) {
189
+ const s = o.name || o.property, r = o.value;
177
190
  if (typeof s == "string" && s && r !== void 0 && r !== "") {
178
- const o = s.replace(/-([a-z])/g, (c) => c[1].toUpperCase());
179
- t[o] = r;
191
+ const n = s.replace(/-([a-z])/g, (i) => i[1].toUpperCase());
192
+ t[n] = r;
180
193
  }
181
194
  }
182
195
  }), Object.keys(t).length > 0 ? t : void 0;
183
196
  }
184
197
  }
185
198
  }
186
- function re(e) {
187
- return _[e] ? _[e] : e.includes("-") ? e.replace(/-([a-z])/g, (t, n) => n.toUpperCase()) : e;
188
- }
189
199
  function ae(e) {
190
- var n;
200
+ return G[e] ? G[e] : e.includes("-") ? e.replace(/-([a-z])/g, (t, o) => o.toUpperCase()) : e;
201
+ }
202
+ function ie(e) {
203
+ var o;
191
204
  const t = {};
192
205
  for (const [s, r] of Object.entries(e))
193
206
  if (s === "style")
194
- t.style = se(r);
207
+ t.style = re(r);
195
208
  else if (s.startsWith("data-"))
196
209
  t[s] = r;
197
210
  else {
198
- const o = re(s);
199
- ((n = e.xmlns) == null ? void 0 : n.includes("svg")) || e.viewBox !== void 0 || e.d !== void 0 || ie.has(o) || o.startsWith("svg") ? t[o] = r : !ce.has(o) && !o.startsWith("on") && !o.startsWith("aria-") && !o.startsWith("data-") ? t[s] = r : t[o] = r;
211
+ const n = ae(s);
212
+ ((o = e.xmlns) == null ? void 0 : o.includes("svg")) || e.viewBox !== void 0 || e.d !== void 0 || le.has(n) || n.startsWith("svg") ? t[n] = r : !ce.has(n) && !n.startsWith("on") && !n.startsWith("aria-") && !n.startsWith("data-") ? t[s] = r : t[n] = r;
200
213
  }
201
214
  return t;
202
215
  }
@@ -241,7 +254,7 @@ const ce = /* @__PURE__ */ new Set([
241
254
  "aria-labelledby",
242
255
  "aria-describedby",
243
256
  "role"
244
- ]), ie = /* @__PURE__ */ new Set([
257
+ ]), le = /* @__PURE__ */ new Set([
245
258
  "x",
246
259
  "y",
247
260
  "d",
@@ -284,7 +297,7 @@ const ce = /* @__PURE__ */ new Set([
284
297
  "clipPath",
285
298
  "overflow",
286
299
  "pointerEvents"
287
- ]), _ = {
300
+ ]), G = {
288
301
  class: "className",
289
302
  for: "htmlFor",
290
303
  "http-equiv": "httpEquiv",
@@ -301,60 +314,60 @@ const ce = /* @__PURE__ */ new Set([
301
314
  "font-family": "fontFamily",
302
315
  "font-size": "fontSize",
303
316
  "text-anchor": "textAnchor"
304
- }, E = (e) => (e == null ? void 0 : e.$$typeof) && typeof e.props == "object";
305
- function le(e) {
317
+ }, T = (e) => (e == null ? void 0 : e.$$typeof) && typeof e.props == "object";
318
+ function pe(e) {
306
319
  return (t) => {
307
- const n = t.getContent();
308
- E(n) && t.set({
309
- content: A({ ...e, model: n }),
310
- reactContent: n
320
+ const o = t.getContent();
321
+ T(o) && t.set({
322
+ content: A({ ...e, model: o }),
323
+ reactContent: o
311
324
  });
312
325
  };
313
326
  }
314
- const pe = (e) => (t) => {
315
- const n = t.component;
316
- E(n) && (t.component = { components: A({ ...e, model: n }) });
327
+ const ue = (e) => (t) => {
328
+ const o = t.component;
329
+ T(o) && (t.component = { components: A({ ...e, model: o }) });
317
330
  };
318
331
  function A(e) {
319
- const { model: t, editor: n, config: s } = e;
320
- if (E(t)) {
321
- const r = t, o = {}, { type: c, props: a = {} } = r, { children: i, className: f, style: d, ...p } = a, m = (l) => ({ type: "textnode", content: l }), u = typeof c == "symbol";
322
- if (H(c)) {
323
- const l = ne(s, c);
324
- o.type = l == null ? void 0 : l.type;
325
- } else n.Components.getType(c) ? o.type = c : u || (o.tagName = c);
326
- if (f && (o.classes = f), d && (o.style = te(d)), Array.isArray(i) ? o.components = i.map((l) => x(l) ? m(l) : A({ ...e, model: l })).filter(Boolean) : x(i) && (o.components = m(i)), Object.keys(p).length) {
327
- const l = n.Parser.parserHtml.splitPropsFromAttr(p);
328
- o.attributes = l.attrs, Object.assign(o, l.props);
332
+ const { model: t, editor: o, config: s } = e;
333
+ if (T(t)) {
334
+ const r = t, n = {}, { type: i, props: a = {} } = r, { children: c, className: u, style: d, ...p } = a, g = (l) => ({ type: "textnode", content: l }), f = typeof i == "symbol";
335
+ if (H(i)) {
336
+ const l = ne(s, i);
337
+ n.type = l == null ? void 0 : l.type;
338
+ } else o.Components.getType(i) ? n.type = i : f || (n.tagName = i);
339
+ if (u && (n.classes = u), d && (n.style = oe(d)), Array.isArray(c) ? n.components = c.map((l) => L(l) ? g(l) : A({ ...e, model: l })).filter(Boolean) : L(c) && (n.components = g(c)), Object.keys(p).length) {
340
+ const l = o.Parser.parserHtml.splitPropsFromAttr(p);
341
+ n.attributes = l.attrs, Object.assign(n, l.props);
329
342
  }
330
- return o;
343
+ return n;
331
344
  }
332
345
  }
333
346
  function fe(e) {
334
- const { component: t } = e, [n, s] = R(0), [r, o] = R();
347
+ const { component: t } = e, [o, s] = O(0), [r, n] = O();
335
348
  return I(() => {
336
349
  if (!t) return () => {
337
350
  };
338
- const a = () => s((l) => l + 1), i = () => {
339
- [...t.views].forEach((v) => v.remove()), o(void 0);
340
- }, { em: f } = t, d = f.Components.events, m = [...["components", "attributes", "classes"].map((l) => `${d.update}:${l}`), "rerender"].join(" "), u = [d.removed, "rerender"].join(" ");
341
- return t.on(m, a), t.on(u, i), () => {
342
- t.off(m, a), t.off(u, i), i();
351
+ const a = () => s((l) => l + 1), c = () => {
352
+ [...t.views].forEach((b) => b.remove()), n(void 0);
353
+ }, { em: u } = t, d = u.Components.events, g = [...["components", "attributes", "classes"].map((l) => `${d.update}:${l}`), "rerender"].join(" "), f = [d.removed, "rerender"].join(" ");
354
+ return t.on(g, a), t.on(f, c), () => {
355
+ t.off(g, a), t.off(f, c), c();
343
356
  };
344
- }, [t]), { key: n, view: r, connectDom: (a) => {
357
+ }, [t]), { key: o, view: r, connectDom: (a) => {
345
358
  if (!a) return;
346
- const i = ue({ ...e, el: a });
347
- o(i);
359
+ const c = de({ ...e, el: a });
360
+ n(c);
348
361
  } };
349
362
  }
350
- function ue(e) {
351
- var i;
352
- const { editor: t, component: n, el: s, frameView: r } = e, { em: o, Components: c } = t;
353
- let a = n.getView(r.model);
363
+ function de(e) {
364
+ var c;
365
+ const { editor: t, component: o, el: s, frameView: r } = e, { em: n, Components: i } = t;
366
+ let a = o.getView(r.model);
354
367
  if ((a == null ? void 0 : a.el) === s)
355
368
  return a;
356
369
  if (!a) {
357
- const { ComponentView: f } = c, d = n.attributes.type || "default", p = ((i = c.getType(d)) == null ? void 0 : i.view) || f, m = { ...c.config, frameView: r, em: o }, u = p.extend({
370
+ const { ComponentView: u } = i, d = o.attributes.type || "default", p = ((c = i.getType(d)) == null ? void 0 : c.view) || u, g = { ...i.config, frameView: r, em: n }, f = p.extend({
358
371
  initComponents() {
359
372
  },
360
373
  _createElement() {
@@ -369,110 +382,110 @@ function ue(e) {
369
382
  return this._ensureElement(), this._setData(), this.renderAttributes(), (l = this.updateSrc) == null || l.call(this), this;
370
383
  }
371
384
  });
372
- a = new u({ el: s, config: m, model: n });
385
+ a = new f({ el: s, config: g, model: o });
373
386
  }
374
387
  return a.el = s, a.render(), a;
375
388
  }
376
- function de(e, t) {
377
- const { Components: n } = e, s = (r) => {
378
- const { id: o, model: c } = r;
379
- n.addType(o, {
389
+ function ge(e, t) {
390
+ const { Components: o } = e, s = (r) => {
391
+ const { id: n, model: i } = r;
392
+ o.addType(n, {
380
393
  model: {
381
394
  toJSON(...a) {
382
- const i = c.prototype.toJSON.apply(this, a);
383
- return i.tagName = this.tagName, i;
395
+ const c = i.prototype.toJSON.apply(this, a);
396
+ return c.tagName = this.tagName, c;
384
397
  }
385
398
  }
386
399
  });
387
400
  };
388
- n.getTypes().forEach(s), e.on("component:type:add", s), Object.entries(t.components || {}).forEach(([r, o]) => {
389
- var m, u;
390
- const { allowPropClassName: c, allowPropId: a, allowChildren: i } = o, f = !a && !c, d = () => ({
391
- disabled: f
401
+ o.getTypes().forEach(s), e.on("component:type:add", s), Object.entries(t.components || {}).forEach(([r, n]) => {
402
+ var g, f;
403
+ const { allowPropClassName: i, allowPropId: a, allowChildren: c } = n, u = !a && !i, d = () => ({
404
+ disabled: u
392
405
  }), p = () => ({
393
- disableClasses: !c,
406
+ disableClasses: !i,
394
407
  disableComponent: !a
395
408
  });
396
- n.addType(r, {
409
+ o.addType(r, {
397
410
  isComponent: (l) => (l == null ? void 0 : l.tagName) === r,
398
411
  model: {
399
412
  defaults: {
400
413
  type: r,
401
- traits: ((m = o.props) == null ? void 0 : m.call(o)) || [],
402
- droppable: !!i,
403
- stylable: !f,
414
+ traits: ((g = n.props) == null ? void 0 : g.call(n)) || [],
415
+ droppable: !!c,
416
+ stylable: !u,
404
417
  styleManager: d,
405
418
  selectorManager: p,
406
- ...((u = o.model) == null ? void 0 : u.defaults) || {}
419
+ ...((f = n.model) == null ? void 0 : f.defaults) || {}
407
420
  }
408
421
  }
409
422
  });
410
423
  });
411
424
  }
412
- function j(e) {
413
- var N;
414
- const { component: t, config: n, editor: s, frameView: r, onMount: o, tagName: c, children: a } = e, { key: i, view: f, connectDom: d } = fe(e);
425
+ function _(e) {
426
+ var x;
427
+ const { component: t, config: o, editor: s, frameView: r, onMount: n, tagName: i, children: a } = e, { key: c, view: u, connectDom: d } = fe(e);
415
428
  I(() => {
416
- if (!f && !o) return;
429
+ if (!u && !n) return;
417
430
  const h = setTimeout(() => {
418
- f && (o == null || o(f), setTimeout(() => f.postRender()));
431
+ u && (n == null || n(u), setTimeout(() => u.postRender()));
419
432
  });
420
433
  return () => clearTimeout(h);
421
- }, [f]);
422
- const p = t.get("type") || "default", m = t.content, u = (N = n.components) == null ? void 0 : N[p], l = (u == null ? void 0 : u.component) || c || t.tagName || "div", v = t.components(), C = v.length ? v.map((h) => /* @__PURE__ */ y(j, { component: h, config: n, editor: s, frameView: r }, h.cid)) : [m || void 0], w = ae(t.getAttributes()), b = u == null ? void 0 : u.editorRender, S = [...C, a].filter((h) => h ?? !1), k = S.length ? S : null;
423
- if (b)
424
- return /* @__PURE__ */ y(b, { props: w, editor: s, component: t, connectDom: d, children: k });
425
- if (u != null && u.component)
426
- return /* @__PURE__ */ y("gjs-wrapper", { ref: d, style: u.wrapperStyle, children: /* @__PURE__ */ y(l, { ...w, children: k }) });
434
+ }, [u]);
435
+ const p = t.get("type") || "default", g = t.content, f = (x = o.components) == null ? void 0 : x[p], l = (f == null ? void 0 : f.component) || i || t.tagName || "div", b = t.components(), R = b.length ? b.map((h) => /* @__PURE__ */ y(_, { component: h, config: o, editor: s, frameView: r }, h.cid)) : [g || void 0], m = ie(t.getAttributes()), w = f == null ? void 0 : f.editorRender, E = [...R, a].filter((h) => h ?? !1), P = E.length ? E : null;
436
+ if (w)
437
+ return /* @__PURE__ */ y(w, { props: m, editor: s, component: t, connectDom: d, children: P });
438
+ if (f != null && f.component)
439
+ return /* @__PURE__ */ y("gjs-wrapper", { ref: d, style: f.wrapperStyle, children: /* @__PURE__ */ y(l, { ...m, children: P }) });
427
440
  if (t.isInstanceOf("textnode"))
428
- return m;
429
- const $ = t.isInstanceOf("text") ? i : void 0;
430
- return /* @__PURE__ */ B(l, { ...w, ref: d, key: $ }, t.get("void") ? null : k);
441
+ return g;
442
+ const j = t.isInstanceOf("text") ? c : void 0;
443
+ return /* @__PURE__ */ F(l, { ...m, ref: d, key: j }, t.get("void") ? null : P);
431
444
  }
432
- const me = (e) => {
433
- const { frame: t, window: n, onMount: s, editor: r } = e, o = r.Canvas.events, { root: c } = t;
445
+ const ye = (e) => {
446
+ const { frame: t, window: o, onMount: s, editor: r } = e, n = r.Canvas.events, { root: i } = t;
434
447
  try {
435
- const a = L(n.document.body);
436
- a.render(/* @__PURE__ */ y(ye, { ...e, component: c, onMount: s }));
437
- const i = () => a.unmount();
438
- t.once(o.frameUnload, i), n.addEventListener("unload", i);
448
+ const a = W(o.document.body);
449
+ a.render(/* @__PURE__ */ y(he, { ...e, component: i, onMount: s }));
450
+ const c = () => a.unmount();
451
+ t.once(n.frameUnload, c), o.addEventListener("unload", c);
439
452
  } catch (a) {
440
453
  console.warn(a);
441
454
  }
442
- return c.getView();
455
+ return i.getView();
443
456
  };
444
- function ye(e) {
445
- const { editor: t, component: n, window: s, frameView: r, config: o, onMount: c } = e, a = s.document, i = o.rootComponent || T, f = o.rootComponent ? { editorProps: { doc: a, editor: t, frameView: r } } : {}, d = (o == null ? void 0 : o.bodyAfter) || T;
446
- return /* @__PURE__ */ y(i, { ...f, children: /* @__PURE__ */ y(
447
- j,
457
+ function he(e) {
458
+ const { editor: t, component: o, window: s, frameView: r, config: n, onMount: i } = e, a = s.document, c = n.rootComponent || D, u = n.rootComponent ? { editorProps: { doc: a, editor: t, frameView: r } } : {}, d = (n == null ? void 0 : n.bodyAfter) || D;
459
+ return /* @__PURE__ */ y(c, { ...u, children: /* @__PURE__ */ y(
460
+ _,
448
461
  {
449
462
  tagName: "div",
450
- component: n,
451
- config: o,
463
+ component: o,
464
+ config: n,
452
465
  editor: t,
453
466
  frameView: r,
454
- onMount: c,
455
- children: /* @__PURE__ */ y(d, { ...f })
467
+ onMount: i,
468
+ children: /* @__PURE__ */ y(d, { ...u })
456
469
  }
457
470
  ) });
458
471
  }
459
- const he = "rendererReact", ge = g.startup, ve = function(e, t = {}) {
460
- const { Blocks: n, Pages: s } = e, r = n.events, o = s.events;
461
- e.Canvas.config.customRenderer = (a) => me({ ...a, config: t }), e.Components.config.processor = (a) => A({ model: a, editor: e, config: t }), de(e, t);
462
- const c = [
463
- [r.add, le({ editor: e, config: t })],
464
- [o.addBefore, pe({ editor: e, config: t })]
472
+ const ve = "rendererReact", be = v.startup, me = function(e, t = {}) {
473
+ const { Blocks: o, Pages: s } = e, r = o.events, n = s.events;
474
+ e.Canvas.config.customRenderer = (a) => ye({ ...a, config: t }), e.Components.config.processor = (a) => A({ model: a, editor: e, config: t }), ge(e, t);
475
+ const i = [
476
+ [r.add, pe({ editor: e, config: t })],
477
+ [n.addBefore, ue({ editor: e, config: t })]
465
478
  ];
466
- c.forEach(([a, i]) => e.on(a, i)), Y({
479
+ i.forEach(([a, c]) => e.on(a, c)), Y({
467
480
  editor: e,
468
481
  licenseKey: t.licenseKey,
469
- plan: ge,
470
- pluginName: he,
482
+ plan: be,
483
+ pluginName: ve,
471
484
  cleanup: () => {
472
- e.Canvas.config.customRenderer = void 0, e.Components.config.processor = void 0, c.forEach(([a, i]) => e.off(a, i));
485
+ e.Canvas.config.customRenderer = void 0, e.Components.config.processor = void 0, i.forEach(([a, c]) => e.off(a, c));
473
486
  }
474
487
  });
475
- }, Ae = X(ve);
488
+ }, Pe = X(me);
476
489
  export {
477
- Ae as default
490
+ Pe as default
478
491
  };