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