@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,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const A = "app.grapesjs.com", k = "app-stage.grapesjs.com", R = "app2.grapesjs.com", _ = "app-stage2.grapesjs.com", x = [
|
|
2
|
+
A,
|
|
3
|
+
R,
|
|
4
|
+
k,
|
|
5
5
|
_,
|
|
6
6
|
"localhost",
|
|
7
7
|
"127.0.0.1",
|
|
@@ -11,101 +11,114 @@ const x = "app.grapesjs.com", S = "app-stage.grapesjs.com", C = "app2.grapesjs.c
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
], $ = "license:check:
|
|
15
|
-
isDev:
|
|
16
|
-
isStage:
|
|
14
|
+
], $ = "license:check:end", G = () => typeof window < "u", N = ({
|
|
15
|
+
isDev: e,
|
|
16
|
+
isStage: n,
|
|
17
17
|
isPlatform: r
|
|
18
|
-
}) => `${
|
|
19
|
-
const
|
|
20
|
-
return !!
|
|
18
|
+
}) => `${e ? "" : `https://${n ? k : A}`}/${r ? "platform-api" : "api"}`, B = () => {
|
|
19
|
+
const e = G() && window.location.hostname;
|
|
20
|
+
return !!e && (x.includes(e) || x.some((n) => e.endsWith(n)));
|
|
21
21
|
};
|
|
22
|
-
async function
|
|
23
|
-
path:
|
|
24
|
-
baseApiUrl:
|
|
22
|
+
async function M({
|
|
23
|
+
path: e,
|
|
24
|
+
baseApiUrl: n,
|
|
25
25
|
method: r = "GET",
|
|
26
|
-
headers:
|
|
27
|
-
params:
|
|
26
|
+
headers: s = {},
|
|
27
|
+
params: c,
|
|
28
28
|
body: i
|
|
29
29
|
}) {
|
|
30
|
-
const
|
|
30
|
+
const a = `${n || N({ isDev: !1, isStage: !1 })}${e}`, g = {
|
|
31
31
|
method: r,
|
|
32
32
|
headers: {
|
|
33
33
|
"Content-Type": "application/json",
|
|
34
|
-
...
|
|
34
|
+
...s
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
i && (
|
|
38
|
-
const
|
|
39
|
-
if (!
|
|
40
|
-
throw new Error(`HTTP error! status: ${
|
|
41
|
-
return
|
|
37
|
+
i && (g.body = JSON.stringify(i));
|
|
38
|
+
const p = c ? new URLSearchParams(c).toString() : "", d = p ? `?${p}` : "", o = await fetch(`${a}${d}`, g);
|
|
39
|
+
if (!o.ok)
|
|
40
|
+
throw new Error(`HTTP error! status: ${o.status}`);
|
|
41
|
+
return o.json();
|
|
42
42
|
}
|
|
43
|
-
var W = /* @__PURE__ */ ((
|
|
43
|
+
var W = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(W || {}), w = /* @__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))(w || {});
|
|
44
44
|
const O = {
|
|
45
45
|
[W.free]: 0,
|
|
46
46
|
[W.startup]: 10,
|
|
47
47
|
[W.business]: 20,
|
|
48
48
|
[W.enterprise]: 30
|
|
49
49
|
};
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
return
|
|
50
|
+
function I(e) {
|
|
51
|
+
const n = e;
|
|
52
|
+
return n.init = (r) => (s) => e(s, r), n;
|
|
53
53
|
}
|
|
54
|
-
const U = (
|
|
55
|
-
async function
|
|
56
|
-
editor:
|
|
57
|
-
plan:
|
|
54
|
+
const U = (e) => /* @__PURE__ */ I(e);
|
|
55
|
+
async function m({
|
|
56
|
+
editor: e,
|
|
57
|
+
plan: n,
|
|
58
58
|
pluginName: r,
|
|
59
|
-
licenseKey:
|
|
60
|
-
onLicenseCheckResponse:
|
|
59
|
+
licenseKey: s,
|
|
60
|
+
onLicenseCheckResponse: c,
|
|
61
61
|
cleanup: i
|
|
62
62
|
}) {
|
|
63
|
-
let u = "",
|
|
64
|
-
const
|
|
65
|
-
console.warn("Cleanup plugin:", r, "Reason:",
|
|
66
|
-
},
|
|
67
|
-
var
|
|
68
|
-
const { error:
|
|
69
|
-
if (!(
|
|
70
|
-
|
|
71
|
-
else if (
|
|
72
|
-
const
|
|
73
|
-
|
|
63
|
+
let u = "", a;
|
|
64
|
+
const g = (o) => {
|
|
65
|
+
console.warn("Cleanup plugin:", r, "Reason:", o), i();
|
|
66
|
+
}, p = (o = {}) => {
|
|
67
|
+
var b;
|
|
68
|
+
const { error: v, sdkLicense: L } = o, l = (b = o.plan) == null ? void 0 : b.category;
|
|
69
|
+
if (!(L || o.license) || v)
|
|
70
|
+
g(v || "Invalid license");
|
|
71
|
+
else if (l) {
|
|
72
|
+
const P = O[n], T = O[l];
|
|
73
|
+
P > T && g({ pluginRequiredPlan: n, licensePlan: l });
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
76
|
+
e.Commands.has(w.settings) && (a = e.runCommand(w.settings), u = (a == null ? void 0 : a.baseUrl) || "");
|
|
77
|
+
const d = (o) => {
|
|
78
|
+
c == null || c(o), o && p(o);
|
|
79
|
+
};
|
|
80
|
+
if (!a) {
|
|
81
|
+
e.onReady(async () => {
|
|
82
|
+
if (!B())
|
|
83
|
+
if (s) {
|
|
84
|
+
const o = await X({ licenseKey: s, pluginName: r, baseApiUrl: u });
|
|
85
|
+
d(o);
|
|
86
|
+
} else
|
|
87
|
+
g("The `licenseKey` option not provided");
|
|
88
|
+
});
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (a.licensePlan || a.licenseError) {
|
|
92
|
+
const o = q(a);
|
|
93
|
+
d(o);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
e.on($, (o) => d(o));
|
|
90
97
|
}
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
const q = (e) => ({
|
|
99
|
+
sdkLicense: e.license,
|
|
100
|
+
license: e.license,
|
|
101
|
+
error: e.licenseError,
|
|
102
|
+
plan: e.licensePlan
|
|
103
|
+
});
|
|
104
|
+
async function X(e) {
|
|
105
|
+
const { licenseKey: n, pluginName: r, baseApiUrl: s } = e;
|
|
93
106
|
try {
|
|
94
|
-
return (await
|
|
95
|
-
baseApiUrl:
|
|
96
|
-
path: `/sdk/${
|
|
107
|
+
return (await M({
|
|
108
|
+
baseApiUrl: s,
|
|
109
|
+
path: `/sdk/${n || "na"}`,
|
|
97
110
|
method: "POST",
|
|
98
111
|
params: {
|
|
99
112
|
d: window.location.hostname,
|
|
100
113
|
pn: r
|
|
101
114
|
}
|
|
102
115
|
})).result || {};
|
|
103
|
-
} catch (
|
|
104
|
-
return console.error("Error during SDK license check:",
|
|
116
|
+
} catch (c) {
|
|
117
|
+
return console.error("Error during SDK license check:", c), !1;
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
|
-
const
|
|
108
|
-
const { Blocks: r, Components:
|
|
120
|
+
const j = (...e) => e.map((n) => `[data-gjs-type="${n}"]`).join(","), F = "dialogComponent", z = function(e, n = {}) {
|
|
121
|
+
const { Blocks: r, Components: s } = e, { licenseKey: c } = n, i = "gjs-plg-dialog", u = "gjs-plg-dialog-overlay", a = "gjs-plg-dialog-content", g = "gjs-plg-dialog-close", p = "gjs-plg-dialog-title", d = "gjs-plg-dialog-body", o = "gjs-plg-dialog-description", v = "gjs-plg-dialog-placeholder";
|
|
109
122
|
r.add(i, {
|
|
110
123
|
label: "Dialog",
|
|
111
124
|
media: `
|
|
@@ -116,15 +129,15 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
116
129
|
category: "Extra",
|
|
117
130
|
content: { type: i },
|
|
118
131
|
activate: !0,
|
|
119
|
-
...
|
|
120
|
-
}),
|
|
132
|
+
...n.block
|
|
133
|
+
}), s.addType(i, {
|
|
121
134
|
model: {
|
|
122
135
|
defaults: {
|
|
123
136
|
tagName: "div",
|
|
124
137
|
attributes: { class: i, "data-type-role": i },
|
|
125
|
-
components: [{ type: u }, { type:
|
|
126
|
-
draggable:
|
|
127
|
-
droppable:
|
|
138
|
+
components: [{ type: u }, { type: v }],
|
|
139
|
+
draggable: j("wrapper"),
|
|
140
|
+
droppable: j(i),
|
|
128
141
|
styles: `
|
|
129
142
|
.${i} {
|
|
130
143
|
position: relative;
|
|
@@ -137,9 +150,9 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
137
150
|
label: "Open dialog",
|
|
138
151
|
name: "onActive",
|
|
139
152
|
changeProp: !0,
|
|
140
|
-
command(
|
|
141
|
-
var
|
|
142
|
-
(
|
|
153
|
+
command(l) {
|
|
154
|
+
var t;
|
|
155
|
+
(t = l.getSelected()) == null || t.trigger("active");
|
|
143
156
|
}
|
|
144
157
|
},
|
|
145
158
|
{
|
|
@@ -177,38 +190,38 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
177
190
|
"openWhenLeavingWindow",
|
|
178
191
|
"openWhenScrollingToLevel"
|
|
179
192
|
],
|
|
180
|
-
script: function(
|
|
181
|
-
const
|
|
182
|
-
function
|
|
183
|
-
const f =
|
|
193
|
+
script: function(l) {
|
|
194
|
+
const t = this;
|
|
195
|
+
function b(y) {
|
|
196
|
+
const f = t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'), h = t.querySelector('[data-type-role="gjs-plg-dialog-close"]');
|
|
184
197
|
function E() {
|
|
185
198
|
f.style.display = "none";
|
|
186
199
|
}
|
|
187
|
-
|
|
200
|
+
y ? (t._onCloseWhenPressingX = E, h.addEventListener("click", t._onCloseWhenPressingX)) : (h.removeEventListener("click", t._onCloseWhenPressingX), t._onCloseWhenPressingX = null);
|
|
188
201
|
}
|
|
189
|
-
function
|
|
190
|
-
const f =
|
|
191
|
-
function
|
|
202
|
+
function P(y) {
|
|
203
|
+
const f = t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
204
|
+
function h(E) {
|
|
192
205
|
E.key === "Escape" && (f.style.display = "none");
|
|
193
206
|
}
|
|
194
|
-
|
|
207
|
+
y ? (t._onCloseWhenPressingEsc = h, t.addEventListener("keydown", t._onCloseWhenPressingEsc)) : (t.removeEventListener("keydown", t._onCloseWhenPressingEsc), t._onCloseWhenPressingEsc = null);
|
|
195
208
|
}
|
|
196
|
-
function
|
|
197
|
-
const f =
|
|
198
|
-
function
|
|
209
|
+
function T(y) {
|
|
210
|
+
const f = t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
211
|
+
function h() {
|
|
199
212
|
f.style.display = "flex";
|
|
200
213
|
}
|
|
201
|
-
|
|
214
|
+
y ? (t._onOpenWhenLeavingWindow = h, document.addEventListener("mouseleave", t._onOpenWhenLeavingWindow)) : (document.removeEventListener("mouseleave", t._onOpenWhenLeavingWindow), t._onOpenWhenLeavingWindow = null);
|
|
202
215
|
}
|
|
203
|
-
function
|
|
204
|
-
const f =
|
|
205
|
-
function
|
|
216
|
+
function D(y) {
|
|
217
|
+
const f = t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
218
|
+
function h() {
|
|
206
219
|
const E = document.documentElement.scrollTop;
|
|
207
|
-
|
|
220
|
+
y && E >= Number(y) && (f.style.display = "flex");
|
|
208
221
|
}
|
|
209
|
-
|
|
222
|
+
y ? (t._onOpenWhenScrollingToLevel = h, document.addEventListener("scroll", t._onOpenWhenScrollingToLevel)) : (document.removeEventListener("scroll", t._onOpenWhenScrollingToLevel), t._onOpenWhenScrollingToLevel = null);
|
|
210
223
|
}
|
|
211
|
-
|
|
224
|
+
b(l.closeWhenPressingX), P(l.closeWhenPressingEsc), T(l.openWhenLeavingWindow), D(l.openWhenScrollingToLevel);
|
|
212
225
|
}
|
|
213
226
|
},
|
|
214
227
|
init() {
|
|
@@ -218,25 +231,25 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
218
231
|
this.view.el.querySelector(
|
|
219
232
|
'[data-type-role="gjs-plg-dialog-placeholder"]'
|
|
220
233
|
).addEventListener("click", () => {
|
|
221
|
-
const
|
|
234
|
+
const t = this.view.el.querySelector(
|
|
222
235
|
'[data-type-role="gjs-plg-dialog-overlay"]'
|
|
223
236
|
);
|
|
224
|
-
|
|
237
|
+
t.style.display = "flex";
|
|
225
238
|
});
|
|
226
239
|
}
|
|
227
240
|
},
|
|
228
241
|
view: {
|
|
229
242
|
onActive() {
|
|
230
|
-
const
|
|
231
|
-
|
|
243
|
+
const l = this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');
|
|
244
|
+
l.style.display = "flex";
|
|
232
245
|
}
|
|
233
246
|
}
|
|
234
|
-
}),
|
|
247
|
+
}), s.addType(u, {
|
|
235
248
|
model: {
|
|
236
249
|
defaults: {
|
|
237
250
|
tagName: "div",
|
|
238
251
|
attributes: { class: u, "data-type-role": u },
|
|
239
|
-
components: { type:
|
|
252
|
+
components: { type: a },
|
|
240
253
|
droppable: !1,
|
|
241
254
|
draggable: !1,
|
|
242
255
|
styles: `
|
|
@@ -254,16 +267,16 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
254
267
|
`
|
|
255
268
|
}
|
|
256
269
|
}
|
|
257
|
-
}),
|
|
270
|
+
}), s.addType(a, {
|
|
258
271
|
model: {
|
|
259
272
|
defaults: {
|
|
260
273
|
tagName: "div",
|
|
261
|
-
attributes: { class:
|
|
262
|
-
components: [{ type:
|
|
274
|
+
attributes: { class: a, "data-type-role": a },
|
|
275
|
+
components: [{ type: g }, { type: p }, { type: d }],
|
|
263
276
|
droppable: !1,
|
|
264
277
|
draggable: !1,
|
|
265
278
|
styles: `
|
|
266
|
-
.${
|
|
279
|
+
.${a} {
|
|
267
280
|
position: relative;
|
|
268
281
|
background-color: #fff;
|
|
269
282
|
border-radius: 10px;
|
|
@@ -276,16 +289,16 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
276
289
|
`
|
|
277
290
|
}
|
|
278
291
|
}
|
|
279
|
-
}),
|
|
292
|
+
}), s.addType(g, {
|
|
280
293
|
model: {
|
|
281
294
|
defaults: {
|
|
282
295
|
tagName: "button",
|
|
283
|
-
attributes: { class:
|
|
296
|
+
attributes: { class: g, "data-type-role": g },
|
|
284
297
|
components: "×",
|
|
285
298
|
droppable: !1,
|
|
286
299
|
draggable: !1,
|
|
287
300
|
styles: `
|
|
288
|
-
.${
|
|
301
|
+
.${g} {
|
|
289
302
|
position: absolute;
|
|
290
303
|
top: 10px;
|
|
291
304
|
right: 10px;
|
|
@@ -299,59 +312,59 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
299
312
|
`
|
|
300
313
|
}
|
|
301
314
|
}
|
|
302
|
-
}),
|
|
315
|
+
}), s.addType(p, {
|
|
303
316
|
model: {
|
|
304
317
|
defaults: {
|
|
305
318
|
tagName: "h2",
|
|
306
|
-
attributes: { class:
|
|
319
|
+
attributes: { class: p, "data-type-role": p },
|
|
307
320
|
components: "Dialog Title",
|
|
308
321
|
editable: !0,
|
|
309
322
|
droppable: !1,
|
|
310
323
|
draggable: !1,
|
|
311
324
|
styles: `
|
|
312
|
-
.${
|
|
325
|
+
.${p} {
|
|
313
326
|
margin: 0;
|
|
314
327
|
padding: 0 40px 20px 0;
|
|
315
328
|
}
|
|
316
329
|
`
|
|
317
330
|
}
|
|
318
331
|
}
|
|
319
|
-
}),
|
|
332
|
+
}), s.addType(d, {
|
|
320
333
|
model: {
|
|
321
334
|
defaults: {
|
|
322
335
|
tagName: "div",
|
|
323
|
-
attributes: { class:
|
|
324
|
-
components: [{ type:
|
|
336
|
+
attributes: { class: d, "data-type-role": d },
|
|
337
|
+
components: [{ type: o }],
|
|
325
338
|
styles: `
|
|
326
|
-
.${
|
|
339
|
+
.${d} {
|
|
327
340
|
height: 90%;
|
|
328
341
|
overflow: auto;
|
|
329
342
|
}
|
|
330
343
|
`
|
|
331
344
|
}
|
|
332
345
|
}
|
|
333
|
-
}),
|
|
346
|
+
}), s.addType(o, {
|
|
334
347
|
model: {
|
|
335
348
|
defaults: {
|
|
336
349
|
tagName: "p",
|
|
337
|
-
attributes: { class:
|
|
350
|
+
attributes: { class: o, "data-type-role": o },
|
|
338
351
|
components: "This is a customizable dialog!",
|
|
339
352
|
editable: !0,
|
|
340
353
|
styles: `
|
|
341
|
-
.${
|
|
354
|
+
.${o} {
|
|
342
355
|
margin: 0;
|
|
343
356
|
}
|
|
344
357
|
`
|
|
345
358
|
}
|
|
346
359
|
}
|
|
347
|
-
}),
|
|
360
|
+
}), s.addType(v, {
|
|
348
361
|
model: {
|
|
349
362
|
toHTML() {
|
|
350
363
|
return "";
|
|
351
364
|
},
|
|
352
365
|
defaults: {
|
|
353
366
|
tagName: "button",
|
|
354
|
-
attributes: { class:
|
|
367
|
+
attributes: { class: v, "data-type-role": v },
|
|
355
368
|
components: "Dialog (click me to open)",
|
|
356
369
|
droppable: !1,
|
|
357
370
|
draggable: !1
|
|
@@ -359,21 +372,21 @@ const L = (...n) => n.map((l) => `[data-gjs-type="${l}"]`).join(","), B = "dialo
|
|
|
359
372
|
},
|
|
360
373
|
view: {
|
|
361
374
|
init() {
|
|
362
|
-
const { em:
|
|
363
|
-
this.listenTo(
|
|
364
|
-
|
|
365
|
-
}), this.listenTo(
|
|
366
|
-
|
|
375
|
+
const { em: l, el: t } = this, b = "core:preview", P = l.Commands.events;
|
|
376
|
+
this.listenTo(l, `${P.runCommand}${b}`, () => {
|
|
377
|
+
t.style.display = "none";
|
|
378
|
+
}), this.listenTo(l, `${P.stopCommand}${b}`, () => {
|
|
379
|
+
t.style.display = "";
|
|
367
380
|
});
|
|
368
381
|
}
|
|
369
382
|
}
|
|
370
|
-
}),
|
|
371
|
-
editor:
|
|
372
|
-
licenseKey:
|
|
383
|
+
}), m({
|
|
384
|
+
editor: e,
|
|
385
|
+
licenseKey: c,
|
|
373
386
|
plan: W.startup,
|
|
374
|
-
pluginName:
|
|
387
|
+
pluginName: F,
|
|
375
388
|
cleanup: () => {
|
|
376
|
-
r.remove(i),
|
|
389
|
+
r.remove(i), s.removeType(i);
|
|
377
390
|
}
|
|
378
391
|
});
|
|
379
392
|
}, H = U(z);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(P,T){typeof exports=="object"&&typeof module<"u"?module.exports=T():typeof define=="function"&&define.amd?define(T):(P=typeof globalThis<"u"?globalThis:P||self,P.StudioSdkPlugins_dialogComponent=T())})(this,function(){"use strict";const P="app.grapesjs.com",T="app-stage.grapesjs.com",x=[P,"app2.grapesjs.com",T,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],k="license:check:end",_=()=>typeof window<"u",R=({isDev:e,isStage:s,isPlatform:r})=>`${e?"":`https://${s?T:P}`}/${r?"platform-api":"api"}`,$=()=>{const e=_()&&window.location.hostname;return!!e&&(x.includes(e)||x.some(s=>e.endsWith(s)))};async function G({path:e,baseApiUrl:s,method:r="GET",headers:n={},params:c,body:i}){const a=`${s||R({isDev:!1,isStage:!1})}${e}`,g={method:r,headers:{"Content-Type":"application/json",...n}};i&&(g.body=JSON.stringify(i));const p=c?new URLSearchParams(c).toString():"",d=p?`?${p}`:"",o=await fetch(`${a}${d}`,g);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var W=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(W||{}),L=(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))(L||{});const A={[W.free]:0,[W.startup]:10,[W.business]:20,[W.enterprise]:30};function N(e){const s=e;return s.init=r=>n=>e(n,r),s}const M=e=>N(e);async function B({editor:e,plan:s,pluginName:r,licenseKey:n,onLicenseCheckResponse:c,cleanup:i}){let u="",a;const g=o=>{console.warn("Cleanup plugin:",r,"Reason:",o),i()},p=(o={})=>{var v;const{error:f,sdkLicense:D}=o,l=(v=o.plan)==null?void 0:v.category;if(!(D||o.license)||f)g(f||"Invalid license");else if(l){const E=A[s],O=A[l];E>O&&g({pluginRequiredPlan:s,licensePlan:l})}};e.Commands.has(L.settings)&&(a=e.runCommand(L.settings),u=(a==null?void 0:a.baseUrl)||"");const d=o=>{c==null||c(o),o&&p(o)};if(!a){e.onReady(async()=>{if(!$())if(n){const o=await m({licenseKey:n,pluginName:r,baseApiUrl:u});d(o)}else g("The `licenseKey` option not provided")});return}if(a.licensePlan||a.licenseError){const o=I(a);d(o);return}e.on(k,o=>d(o))}const I=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function m(e){const{licenseKey:s,pluginName:r,baseApiUrl:n}=e;try{return(await G({baseApiUrl:n,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:r}})).result||{}}catch(c){return console.error("Error during SDK license check:",c),!1}}const j=(...e)=>e.map(s=>`[data-gjs-type="${s}"]`).join(","),U="dialogComponent";return M(function(e,s={}){const{Blocks:r,Components:n}=e,{licenseKey:c}=s,i="gjs-plg-dialog",u="gjs-plg-dialog-overlay",a="gjs-plg-dialog-content",g="gjs-plg-dialog-close",p="gjs-plg-dialog-title",d="gjs-plg-dialog-body",o="gjs-plg-dialog-description",f="gjs-plg-dialog-placeholder";r.add(i,{label:"Dialog",media:`
|
|
2
2
|
<svg viewBox="0 0 24 24">
|
|
3
3
|
<path d="M4 4h16v10H8l-4 4V4z"></path>
|
|
4
4
|
</svg>
|
|
5
|
-
`,category:"Extra",content:{type:i},activate:!0,...
|
|
5
|
+
`,category:"Extra",content:{type:i},activate:!0,...s.block}),n.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:[{type:u},{type:f}],draggable:j("wrapper"),droppable:j(i),styles:`
|
|
6
6
|
.${i} {
|
|
7
7
|
position: relative;
|
|
8
8
|
z-index: 1;
|
|
9
9
|
}
|
|
10
|
-
`,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(
|
|
10
|
+
`,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(l){var t;(t=l.getSelected())==null||t.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(l){const t=this;function v(y){const b=t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),h=t.querySelector('[data-type-role="gjs-plg-dialog-close"]');function w(){b.style.display="none"}y?(t._onCloseWhenPressingX=w,h.addEventListener("click",t._onCloseWhenPressingX)):(h.removeEventListener("click",t._onCloseWhenPressingX),t._onCloseWhenPressingX=null)}function E(y){const b=t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function h(w){w.key==="Escape"&&(b.style.display="none")}y?(t._onCloseWhenPressingEsc=h,t.addEventListener("keydown",t._onCloseWhenPressingEsc)):(t.removeEventListener("keydown",t._onCloseWhenPressingEsc),t._onCloseWhenPressingEsc=null)}function O(y){const b=t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function h(){b.style.display="flex"}y?(t._onOpenWhenLeavingWindow=h,document.addEventListener("mouseleave",t._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",t._onOpenWhenLeavingWindow),t._onOpenWhenLeavingWindow=null)}function q(y){const b=t.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function h(){const w=document.documentElement.scrollTop;y&&w>=Number(y)&&(b.style.display="flex")}y?(t._onOpenWhenScrollingToLevel=h,document.addEventListener("scroll",t._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",t._onOpenWhenScrollingToLevel),t._onOpenWhenScrollingToLevel=null)}v(l.closeWhenPressingX),E(l.closeWhenPressingEsc),O(l.openWhenLeavingWindow),q(l.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const t=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');t.style.display="flex"})}},view:{onActive(){const l=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');l.style.display="flex"}}}),n.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:{type:a},droppable:!1,draggable:!1,styles:`
|
|
11
11
|
.${u} {
|
|
12
12
|
position: fixed;
|
|
13
13
|
top: 0;
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
justify-content: center;
|
|
20
20
|
background-color: rgba(0, 0, 0, 0.5);
|
|
21
21
|
}
|
|
22
|
-
`}}}),
|
|
23
|
-
.${
|
|
22
|
+
`}}}),n.addType(a,{model:{defaults:{tagName:"div",attributes:{class:a,"data-type-role":a},components:[{type:g},{type:p},{type:d}],droppable:!1,draggable:!1,styles:`
|
|
23
|
+
.${a} {
|
|
24
24
|
position: relative;
|
|
25
25
|
background-color: #fff;
|
|
26
26
|
border-radius: 10px;
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
height: 600px;
|
|
31
31
|
box-sizing: border-box;
|
|
32
32
|
}
|
|
33
|
-
`}}}),
|
|
34
|
-
.${
|
|
33
|
+
`}}}),n.addType(g,{model:{defaults:{tagName:"button",attributes:{class:g,"data-type-role":g},components:"×",droppable:!1,draggable:!1,styles:`
|
|
34
|
+
.${g} {
|
|
35
35
|
position: absolute;
|
|
36
36
|
top: 10px;
|
|
37
37
|
right: 10px;
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
font-size: 20px;
|
|
43
43
|
cursor: pointer;
|
|
44
44
|
}
|
|
45
|
-
`}}}),
|
|
46
|
-
.${
|
|
45
|
+
`}}}),n.addType(p,{model:{defaults:{tagName:"h2",attributes:{class:p,"data-type-role":p},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
|
|
46
|
+
.${p} {
|
|
47
47
|
margin: 0;
|
|
48
48
|
padding: 0 40px 20px 0;
|
|
49
49
|
}
|
|
50
|
-
`}}}),
|
|
51
|
-
.${
|
|
50
|
+
`}}}),n.addType(d,{model:{defaults:{tagName:"div",attributes:{class:d,"data-type-role":d},components:[{type:o}],styles:`
|
|
51
|
+
.${d} {
|
|
52
52
|
height: 90%;
|
|
53
53
|
overflow: auto;
|
|
54
54
|
}
|
|
55
|
-
`}}}),
|
|
56
|
-
.${
|
|
55
|
+
`}}}),n.addType(o,{model:{defaults:{tagName:"p",attributes:{class:o,"data-type-role":o},components:"This is a customizable dialog!",editable:!0,styles:`
|
|
56
|
+
.${o} {
|
|
57
57
|
margin: 0;
|
|
58
58
|
}
|
|
59
|
-
`}}}),
|
|
59
|
+
`}}}),n.addType(f,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:f,"data-type-role":f},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:l,el:t}=this,v="core:preview",E=l.Commands.events;this.listenTo(l,`${E.runCommand}${v}`,()=>{t.style.display="none"}),this.listenTo(l,`${E.stopCommand}${v}`,()=>{t.style.display=""})}}}),B({editor:e,licenseKey:c,plan:W.startup,pluginName:U,cleanup:()=>{r.remove(i),n.removeType(i)}})})});
|