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