@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.
- package/dist/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +175 -162
- package/dist/accordionComponent/index.umd.js +7 -7
- package/dist/aiChat/index.cjs.js +64 -64
- package/dist/aiChat/index.es.js +5785 -5757
- package/dist/aiChat/index.js +64 -64
- package/dist/aiChat/index.umd.js +63 -63
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +204 -191
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +183 -170
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +134 -121
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +165 -152
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +5 -5
- package/dist/canvasGridMode/index.es.js +245 -232
- package/dist/canvasGridMode/index.umd.js +4 -4
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +155 -142
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +9 -9
- package/dist/dataSourceEjs/index.es.js +257 -244
- package/dist/dataSourceEjs/index.umd.js +9 -9
- package/dist/dataSourceHandlebars/index.cjs.js +8 -8
- package/dist/dataSourceHandlebars/index.es.js +216 -203
- package/dist/dataSourceHandlebars/index.umd.js +7 -7
- package/dist/dialogComponent/index.cjs.js +14 -14
- package/dist/dialogComponent/index.es.js +141 -128
- package/dist/dialogComponent/index.umd.js +14 -14
- package/dist/flexComponent/index.cjs.js +13 -13
- package/dist/flexComponent/index.es.js +484 -471
- package/dist/flexComponent/index.umd.js +13 -13
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +173 -160
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +160 -147
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +196 -183
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +25 -25
- package/dist/index.es.js +121 -108
- package/dist/index.umd.js +18 -18
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +157 -144
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +245 -232
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +106 -93
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +157 -144
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +3 -3
- package/dist/presetPrintable/index.es.js +181 -168
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +7 -7
- package/dist/prosemirror/index.es.js +385 -372
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +200 -187
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +118 -105
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +4 -4
- package/dist/shapeDividerComponent/index.es.js +129 -116
- package/dist/shapeDividerComponent/index.umd.js +4 -4
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +203 -190
- package/dist/swiperComponent/index.umd.js +7 -7
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +257 -244
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +121 -108
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { createRoot as
|
|
4
|
-
const U = "app.grapesjs.com",
|
|
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
|
-
],
|
|
17
|
+
], S = "license:check:end", V = () => typeof window < "u", z = ({
|
|
18
18
|
isDev: e,
|
|
19
19
|
isStage: t,
|
|
20
|
-
isPlatform:
|
|
21
|
-
}) => `${e ? "" : `https://${t ?
|
|
22
|
-
const e =
|
|
23
|
-
return !!e && (
|
|
24
|
-
}, q = (e) => e.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (t,
|
|
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:
|
|
31
|
+
method: o = "GET",
|
|
32
32
|
headers: s = {},
|
|
33
33
|
params: r,
|
|
34
|
-
body:
|
|
34
|
+
body: n
|
|
35
35
|
}) {
|
|
36
|
-
const a = `${t ||
|
|
37
|
-
method:
|
|
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
|
-
|
|
44
|
-
const
|
|
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
|
|
50
|
-
const
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
54
|
-
[
|
|
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 = (
|
|
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:
|
|
64
|
+
pluginName: o,
|
|
65
65
|
licenseKey: s,
|
|
66
66
|
onLicenseCheckResponse: r,
|
|
67
|
-
cleanup:
|
|
67
|
+
cleanup: n
|
|
68
68
|
}) {
|
|
69
|
-
let
|
|
70
|
-
const
|
|
71
|
-
console.warn("Cleanup plugin:",
|
|
72
|
-
},
|
|
73
|
-
var
|
|
74
|
-
const { error:
|
|
75
|
-
if (!(
|
|
76
|
-
|
|
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
|
|
79
|
-
|
|
78
|
+
const m = B[t], w = B[l];
|
|
79
|
+
m > w && c({ pluginRequiredPlan: t, licensePlan: l });
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
e.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
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
|
-
|
|
98
|
-
|
|
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:
|
|
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
|
|
126
|
+
function oe(e) {
|
|
114
127
|
const t = {};
|
|
115
|
-
for (const
|
|
116
|
-
if (Object.prototype.hasOwnProperty.call(e,
|
|
117
|
-
const s = q(
|
|
118
|
-
t[s] = e[
|
|
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
|
|
124
|
-
for (const s in
|
|
125
|
-
const r =
|
|
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
|
|
143
|
+
function C(e) {
|
|
131
144
|
const t = {};
|
|
132
|
-
let
|
|
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
|
|
138
|
-
t[
|
|
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
|
|
154
|
+
return o ? t : void 0;
|
|
142
155
|
}
|
|
143
|
-
function
|
|
156
|
+
function se(e) {
|
|
144
157
|
const t = {};
|
|
145
|
-
return e.split(";").forEach((
|
|
146
|
-
if (!
|
|
147
|
-
const s =
|
|
158
|
+
return e.split(";").forEach((o) => {
|
|
159
|
+
if (!o.trim()) return;
|
|
160
|
+
const s = o.indexOf(":");
|
|
148
161
|
if (s > 0) {
|
|
149
|
-
const r =
|
|
150
|
-
if (r &&
|
|
151
|
-
const
|
|
152
|
-
t[
|
|
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
|
|
170
|
+
function re(e) {
|
|
158
171
|
if (e) {
|
|
159
172
|
if (typeof e == "object" && !Array.isArray(e))
|
|
160
|
-
return
|
|
173
|
+
return C(e);
|
|
161
174
|
if (typeof e == "string") {
|
|
162
|
-
let t =
|
|
175
|
+
let t = se(e);
|
|
163
176
|
if (!t)
|
|
164
177
|
try {
|
|
165
|
-
const
|
|
166
|
-
typeof
|
|
167
|
-
} catch (
|
|
168
|
-
console.error("Failed to parse style string as JSON",
|
|
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((
|
|
175
|
-
if (typeof
|
|
176
|
-
const s =
|
|
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
|
|
179
|
-
t[
|
|
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
|
-
|
|
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 =
|
|
207
|
+
t.style = re(r);
|
|
195
208
|
else if (s.startsWith("data-"))
|
|
196
209
|
t[s] = r;
|
|
197
210
|
else {
|
|
198
|
-
const
|
|
199
|
-
((
|
|
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
|
-
]),
|
|
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
|
-
},
|
|
305
|
-
function
|
|
317
|
+
}, T = (e) => (e == null ? void 0 : e.$$typeof) && typeof e.props == "object";
|
|
318
|
+
function pe(e) {
|
|
306
319
|
return (t) => {
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
content: A({ ...e, model:
|
|
310
|
-
reactContent:
|
|
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
|
|
315
|
-
const
|
|
316
|
-
|
|
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:
|
|
320
|
-
if (
|
|
321
|
-
const r = t,
|
|
322
|
-
if (H(
|
|
323
|
-
const l = ne(s,
|
|
324
|
-
|
|
325
|
-
} else
|
|
326
|
-
if (
|
|
327
|
-
const l =
|
|
328
|
-
|
|
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
|
|
343
|
+
return n;
|
|
331
344
|
}
|
|
332
345
|
}
|
|
333
346
|
function fe(e) {
|
|
334
|
-
const { component: t } = e, [
|
|
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),
|
|
339
|
-
[...t.views].forEach((
|
|
340
|
-
}, { em:
|
|
341
|
-
return t.on(
|
|
342
|
-
t.off(
|
|
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:
|
|
357
|
+
}, [t]), { key: o, view: r, connectDom: (a) => {
|
|
345
358
|
if (!a) return;
|
|
346
|
-
const
|
|
347
|
-
|
|
359
|
+
const c = de({ ...e, el: a });
|
|
360
|
+
n(c);
|
|
348
361
|
} };
|
|
349
362
|
}
|
|
350
|
-
function
|
|
351
|
-
var
|
|
352
|
-
const { editor: t, component:
|
|
353
|
-
let a =
|
|
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:
|
|
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
|
|
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
|
|
377
|
-
const { Components:
|
|
378
|
-
const { id:
|
|
379
|
-
|
|
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
|
|
383
|
-
return
|
|
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
|
-
|
|
389
|
-
var
|
|
390
|
-
const { allowPropClassName:
|
|
391
|
-
disabled:
|
|
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: !
|
|
406
|
+
disableClasses: !i,
|
|
394
407
|
disableComponent: !a
|
|
395
408
|
});
|
|
396
|
-
|
|
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: ((
|
|
402
|
-
droppable: !!
|
|
403
|
-
stylable: !
|
|
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
|
-
...((
|
|
419
|
+
...((f = n.model) == null ? void 0 : f.defaults) || {}
|
|
407
420
|
}
|
|
408
421
|
}
|
|
409
422
|
});
|
|
410
423
|
});
|
|
411
424
|
}
|
|
412
|
-
function
|
|
413
|
-
var
|
|
414
|
-
const { component: t, config:
|
|
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 (!
|
|
429
|
+
if (!u && !n) return;
|
|
417
430
|
const h = setTimeout(() => {
|
|
418
|
-
|
|
431
|
+
u && (n == null || n(u), setTimeout(() => u.postRender()));
|
|
419
432
|
});
|
|
420
433
|
return () => clearTimeout(h);
|
|
421
|
-
}, [
|
|
422
|
-
const p = t.get("type") || "default",
|
|
423
|
-
if (
|
|
424
|
-
return /* @__PURE__ */ y(
|
|
425
|
-
if (
|
|
426
|
-
return /* @__PURE__ */ y("gjs-wrapper", { ref: d, style:
|
|
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
|
|
429
|
-
const
|
|
430
|
-
return /* @__PURE__ */
|
|
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
|
|
433
|
-
const { frame: t, window:
|
|
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 =
|
|
436
|
-
a.render(/* @__PURE__ */ y(
|
|
437
|
-
const
|
|
438
|
-
t.once(
|
|
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
|
|
455
|
+
return i.getView();
|
|
443
456
|
};
|
|
444
|
-
function
|
|
445
|
-
const { editor: t, component:
|
|
446
|
-
return /* @__PURE__ */ y(
|
|
447
|
-
|
|
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:
|
|
451
|
-
config:
|
|
463
|
+
component: o,
|
|
464
|
+
config: n,
|
|
452
465
|
editor: t,
|
|
453
466
|
frameView: r,
|
|
454
|
-
onMount:
|
|
455
|
-
children: /* @__PURE__ */ y(d, { ...
|
|
467
|
+
onMount: i,
|
|
468
|
+
children: /* @__PURE__ */ y(d, { ...u })
|
|
456
469
|
}
|
|
457
470
|
) });
|
|
458
471
|
}
|
|
459
|
-
const
|
|
460
|
-
const { Blocks:
|
|
461
|
-
e.Canvas.config.customRenderer = (a) =>
|
|
462
|
-
const
|
|
463
|
-
[r.add,
|
|
464
|
-
[
|
|
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
|
-
|
|
479
|
+
i.forEach(([a, c]) => e.on(a, c)), Y({
|
|
467
480
|
editor: e,
|
|
468
481
|
licenseKey: t.licenseKey,
|
|
469
|
-
plan:
|
|
470
|
-
pluginName:
|
|
482
|
+
plan: be,
|
|
483
|
+
pluginName: ve,
|
|
471
484
|
cleanup: () => {
|
|
472
|
-
e.Canvas.config.customRenderer = void 0, e.Components.config.processor = void 0,
|
|
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
|
-
},
|
|
488
|
+
}, Pe = X(me);
|
|
476
489
|
export {
|
|
477
|
-
|
|
490
|
+
Pe as default
|
|
478
491
|
};
|