@grapesjs/studio-sdk-plugins 1.0.8 → 1.0.9
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/dialogComponent/index.cjs.js +4 -4
- package/dist/dialogComponent/index.es.js +27 -28
- package/dist/dialogComponent/index.umd.js +4 -4
- package/dist/fsLightboxComponent/index.cjs.js +2 -2
- package/dist/fsLightboxComponent/index.es.js +51 -52
- package/dist/fsLightboxComponent/index.umd.js +2 -2
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +22 -22
- package/dist/index.d.ts +1 -0
- package/dist/index.es.d.ts +1 -0
- package/dist/index.es.js +5265 -4605
- package/dist/index.umd.js +22 -22
- package/dist/lightGalleryComponent/index.cjs.d.ts +3 -0
- package/dist/lightGalleryComponent/index.cjs.js +1 -0
- package/dist/lightGalleryComponent/index.d.ts +3 -0
- package/dist/lightGalleryComponent/index.es.d.ts +3 -0
- package/dist/lightGalleryComponent/index.es.js +718 -0
- package/dist/lightGalleryComponent/index.umd.js +1 -0
- package/dist/lightGalleryComponent/types.d.ts +57 -0
- package/dist/lightGalleryComponent/typesSchema.d.ts +3 -0
- package/dist/lightGalleryComponent/utils.d.ts +47 -0
- package/dist/listPagesComponent/index.cjs.js +3 -3
- package/dist/listPagesComponent/index.es.js +32 -33
- package/dist/listPagesComponent/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +8 -8
- package/dist/prosemirror/index.es.js +806 -786
- package/dist/prosemirror/index.umd.js +9 -9
- package/dist/prosemirror/schema.d.ts +1 -1
- package/dist/prosemirror/types.d.ts +5 -0
- package/dist/prosemirror/utils.d.ts +3 -1
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +35 -36
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
const F = "app.grapesjs.com", ie = "app-stage.grapesjs.com", Y = [
|
|
2
|
+
F,
|
|
3
|
+
ie,
|
|
4
|
+
"localhost",
|
|
5
|
+
"127.0.0.1",
|
|
6
|
+
".local-credentialless.webcontainer.io",
|
|
7
|
+
// For stackblitz.com demos
|
|
8
|
+
".local.webcontainer.io",
|
|
9
|
+
// For stackblitz.com demos
|
|
10
|
+
"-sandpack.codesandbox.io"
|
|
11
|
+
// For Sandpack demos
|
|
12
|
+
], pe = "license:check:start", ue = "license:check:end", se = () => typeof window < "u", he = ({ isDev: e, isStage: n }) => `${e ? "" : `https://${n ? ie : F}`}/api`, ge = () => {
|
|
13
|
+
const e = se() && window.location.hostname;
|
|
14
|
+
return !!e && (Y.includes(e) || Y.some((n) => e.endsWith(n)));
|
|
15
|
+
}, be = () => (se() && window.location.hostname) === F;
|
|
16
|
+
var de = {};
|
|
17
|
+
const me = de.NODE_ENV !== "production";
|
|
18
|
+
async function ye({
|
|
19
|
+
path: e,
|
|
20
|
+
method: n = "GET",
|
|
21
|
+
headers: a = {},
|
|
22
|
+
body: o
|
|
23
|
+
}) {
|
|
24
|
+
const c = `${he({ isDev: me, isStage: !be() })}${e}`, i = {
|
|
25
|
+
method: n,
|
|
26
|
+
headers: {
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
...a
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
o && (i.body = JSON.stringify(o));
|
|
32
|
+
const r = await fetch(c, i);
|
|
33
|
+
if (!r.ok)
|
|
34
|
+
throw new Error(`HTTP error! status: ${r.status}`);
|
|
35
|
+
return r.json();
|
|
36
|
+
}
|
|
37
|
+
function ve(e) {
|
|
38
|
+
const n = e;
|
|
39
|
+
return n.init = (a) => (o) => e(o, a), n;
|
|
40
|
+
}
|
|
41
|
+
const fe = (e) => /* @__PURE__ */ ve(e);
|
|
42
|
+
async function Te({
|
|
43
|
+
editor: e,
|
|
44
|
+
pluginName: n,
|
|
45
|
+
licenseKey: a,
|
|
46
|
+
cleanup: o
|
|
47
|
+
}) {
|
|
48
|
+
let s = !1;
|
|
49
|
+
const c = ge();
|
|
50
|
+
e.on(pe, () => {
|
|
51
|
+
s = !0;
|
|
52
|
+
}), e.on(ue, ({ sdkLicense: i }) => {
|
|
53
|
+
i || o();
|
|
54
|
+
}), setTimeout(async () => {
|
|
55
|
+
if (!s) {
|
|
56
|
+
if (c) return;
|
|
57
|
+
a && await we({ licenseKey: a, pluginName: n }) || o();
|
|
58
|
+
}
|
|
59
|
+
}, 2e3);
|
|
60
|
+
}
|
|
61
|
+
async function we({ licenseKey: e, pluginName: n }) {
|
|
62
|
+
try {
|
|
63
|
+
const a = await ye({
|
|
64
|
+
path: `/sdk/${e}`,
|
|
65
|
+
method: "POST",
|
|
66
|
+
body: JSON.stringify({
|
|
67
|
+
d: window.location.hostname,
|
|
68
|
+
pn: n
|
|
69
|
+
})
|
|
70
|
+
}), { license: o } = a.result || {};
|
|
71
|
+
return !!o;
|
|
72
|
+
} catch (a) {
|
|
73
|
+
return console.error("Error during SDK license check:", a), !1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const z = (e, n) => {
|
|
77
|
+
var a;
|
|
78
|
+
return !!((a = e == null ? void 0 : e.hasAttribute) != null && a.call(e, n));
|
|
79
|
+
};
|
|
80
|
+
var k = /* @__PURE__ */ ((e) => (e.image = "image", e.video = "video", e.external = "external", e))(k || {});
|
|
81
|
+
const w = "lightGallery", ee = `${w}-item`, V = "data-lightgallery", te = `${V}-item`, O = "toggle", S = {
|
|
82
|
+
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>',
|
|
83
|
+
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>',
|
|
84
|
+
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>',
|
|
85
|
+
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>',
|
|
86
|
+
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>',
|
|
87
|
+
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>'
|
|
88
|
+
}, U = { propKeys: [], props: {}, traits: [] }, A = (e, n = {}) => {
|
|
89
|
+
var s;
|
|
90
|
+
const a = {}, o = [];
|
|
91
|
+
for (const c in e) {
|
|
92
|
+
const { value: i, ...r } = e[c];
|
|
93
|
+
o.push({ id: c, name: c, changeProp: !0, category: n.category, ...r }), a[c] = i;
|
|
94
|
+
const { subTraits: h = {} } = r;
|
|
95
|
+
for (const u in r.subTraits)
|
|
96
|
+
(s = h[u]) == null || s.forEach((I) => {
|
|
97
|
+
const E = I.id || I.name;
|
|
98
|
+
a[E] = I.value;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
propKeys: Object.keys(a),
|
|
103
|
+
props: a,
|
|
104
|
+
traits: o
|
|
105
|
+
};
|
|
106
|
+
}, Z = (e, n) => {
|
|
107
|
+
const a = e.getTrait(n), o = a.get("category"), s = a.get("subTraits") || {}, i = (Object.values(s).flat() || []).map((u) => u.id || u.name);
|
|
108
|
+
e.removeTrait(i);
|
|
109
|
+
const r = s[a.getValue()], h = e.getTraitIndex(n) + 1;
|
|
110
|
+
r && e.addTrait(
|
|
111
|
+
r.map((u) => ({ category: o, ...u })),
|
|
112
|
+
{ at: h }
|
|
113
|
+
);
|
|
114
|
+
}, W = (e, n) => {
|
|
115
|
+
n.forEach((a) => {
|
|
116
|
+
const o = e.getTrait(a);
|
|
117
|
+
if (!o || !o.get("subTraits")) return;
|
|
118
|
+
const s = o.changeProp ? `change:${a}` : `change:attributes:${a}`;
|
|
119
|
+
e.on(s, () => Z(e, a)), Z(e, a);
|
|
120
|
+
});
|
|
121
|
+
}, Se = (e, n, a) => {
|
|
122
|
+
const s = e.getTrait(n).get("subTraits") || {}, i = (Object.values(s).flat() || []).map((h) => {
|
|
123
|
+
const u = h.name || h.id;
|
|
124
|
+
return h.changeProp ? `change:${u}` : `change:attributes:${u}`;
|
|
125
|
+
}), r = Array.from(new Set(i));
|
|
126
|
+
r.length && e.on(r.join(" "), a);
|
|
127
|
+
}, xe = {
|
|
128
|
+
// startAnimationDuration: {
|
|
129
|
+
// type: 'number',
|
|
130
|
+
// label: 'Start duration',
|
|
131
|
+
// tip: 'Start animation duration (in ms)',
|
|
132
|
+
// value: 400,
|
|
133
|
+
// step: 50,
|
|
134
|
+
// min: 0
|
|
135
|
+
// },
|
|
136
|
+
[O]: {
|
|
137
|
+
type: "button",
|
|
138
|
+
label: "Toggle Gallery",
|
|
139
|
+
command: (e, n) => {
|
|
140
|
+
var a, o;
|
|
141
|
+
return (o = (a = n.target) == null ? void 0 : a.getView()) == null ? void 0 : o.toggleGallery();
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
speed: {
|
|
145
|
+
type: "number",
|
|
146
|
+
label: "Speed",
|
|
147
|
+
tip: "Transition duration between slides (in ms)",
|
|
148
|
+
value: 400,
|
|
149
|
+
step: 50,
|
|
150
|
+
min: 0
|
|
151
|
+
},
|
|
152
|
+
inline: {
|
|
153
|
+
type: "checkbox",
|
|
154
|
+
label: "Inline Gallery",
|
|
155
|
+
value: !1
|
|
156
|
+
},
|
|
157
|
+
allowMediaOverlap: {
|
|
158
|
+
type: "checkbox",
|
|
159
|
+
label: "Allow media overlap",
|
|
160
|
+
tip: "If enabled, toolbar, captions and thumbnails will overlap with the media element",
|
|
161
|
+
value: !1
|
|
162
|
+
},
|
|
163
|
+
controls: {
|
|
164
|
+
type: "checkbox",
|
|
165
|
+
label: "Show controls",
|
|
166
|
+
tip: "If disabled, prev/next buttons will not be displayed",
|
|
167
|
+
value: !0
|
|
168
|
+
},
|
|
169
|
+
counter: {
|
|
170
|
+
type: "checkbox",
|
|
171
|
+
label: "Show counter",
|
|
172
|
+
tip: "Display the total number of images and index number of the currently displayed slide",
|
|
173
|
+
value: !0
|
|
174
|
+
},
|
|
175
|
+
download: {
|
|
176
|
+
type: "checkbox",
|
|
177
|
+
label: "Download icon",
|
|
178
|
+
tip: "Enable download button",
|
|
179
|
+
value: !0
|
|
180
|
+
},
|
|
181
|
+
enableDrag: {
|
|
182
|
+
type: "checkbox",
|
|
183
|
+
label: "Enable drag",
|
|
184
|
+
tip: "Enables desktop mouse drag support",
|
|
185
|
+
value: !0
|
|
186
|
+
},
|
|
187
|
+
enableSwipe: {
|
|
188
|
+
type: "checkbox",
|
|
189
|
+
label: "Enable swipe",
|
|
190
|
+
tip: "Enables swipe support for mobile devices",
|
|
191
|
+
value: !0
|
|
192
|
+
},
|
|
193
|
+
escKey: {
|
|
194
|
+
type: "checkbox",
|
|
195
|
+
label: "Enable Esc key",
|
|
196
|
+
tip: 'Whether the gallery could be closed by pressing the "Esc" key',
|
|
197
|
+
value: !0
|
|
198
|
+
},
|
|
199
|
+
keyPress: {
|
|
200
|
+
type: "checkbox",
|
|
201
|
+
label: "Enable keyboard navigation",
|
|
202
|
+
value: !1
|
|
203
|
+
},
|
|
204
|
+
loop: {
|
|
205
|
+
type: "checkbox",
|
|
206
|
+
label: "Loop",
|
|
207
|
+
tip: "If false, will disable the ability to loop back to the beginning of the gallery from the last slide",
|
|
208
|
+
value: !0
|
|
209
|
+
},
|
|
210
|
+
getCaptionFromTitleOrAlt: {
|
|
211
|
+
type: "checkbox",
|
|
212
|
+
label: "Caption from title or alt",
|
|
213
|
+
tip: "Get captions from alt or title tags",
|
|
214
|
+
value: !0
|
|
215
|
+
},
|
|
216
|
+
showMaximizeIcon: {
|
|
217
|
+
type: "checkbox",
|
|
218
|
+
label: "Show maximize icon",
|
|
219
|
+
value: !1
|
|
220
|
+
},
|
|
221
|
+
closable: {
|
|
222
|
+
type: "checkbox",
|
|
223
|
+
label: "Closable",
|
|
224
|
+
tip: "If false, it won't be possible to close the gallery",
|
|
225
|
+
value: !0
|
|
226
|
+
},
|
|
227
|
+
showCloseIcon: {
|
|
228
|
+
type: "checkbox",
|
|
229
|
+
label: "Show close icon",
|
|
230
|
+
tip: "If false, close button won't be displayed.",
|
|
231
|
+
visible: ({ component: e }) => !!e.getTrait("closable").getValue(),
|
|
232
|
+
value: !0
|
|
233
|
+
},
|
|
234
|
+
closeOnTap: {
|
|
235
|
+
type: "checkbox",
|
|
236
|
+
label: "Close on tap",
|
|
237
|
+
tip: "Allows clicks on black area to close gallery",
|
|
238
|
+
visible: ({ component: e }) => !!e.getTrait("closable").getValue(),
|
|
239
|
+
value: !0
|
|
240
|
+
}
|
|
241
|
+
}, ke = {
|
|
242
|
+
thumbnail: {
|
|
243
|
+
category: { id: "thumbnail-options", label: "Thumbnail Options" },
|
|
244
|
+
type: "checkbox",
|
|
245
|
+
label: "Thumbnails",
|
|
246
|
+
value: !0,
|
|
247
|
+
subTraits: {
|
|
248
|
+
false: [],
|
|
249
|
+
true: [
|
|
250
|
+
// {
|
|
251
|
+
// type: 'checkbox',
|
|
252
|
+
// name: 'animateThumb',
|
|
253
|
+
// label: 'Animate Thumbnails',
|
|
254
|
+
// changeProp: true,
|
|
255
|
+
// value: true
|
|
256
|
+
// },
|
|
257
|
+
// {
|
|
258
|
+
// type: 'checkbox',
|
|
259
|
+
// name: 'toggleThumb',
|
|
260
|
+
// label: 'Toggle Thumbnails',
|
|
261
|
+
// tip: 'Enable toggle captions and thumbnails',
|
|
262
|
+
// changeProp: true,
|
|
263
|
+
// value: false
|
|
264
|
+
// },
|
|
265
|
+
{
|
|
266
|
+
type: "checkbox",
|
|
267
|
+
name: "enableThumbDrag",
|
|
268
|
+
label: "Thumbnail drag",
|
|
269
|
+
tip: "Enable thumbnail drag on desktop",
|
|
270
|
+
changeProp: !0,
|
|
271
|
+
value: !0
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
type: "checkbox",
|
|
275
|
+
name: "enableThumbSwipe",
|
|
276
|
+
label: "Thumbnail swipe",
|
|
277
|
+
tip: "Enable thumbnail swipe on mobile devices",
|
|
278
|
+
changeProp: !0,
|
|
279
|
+
value: !0
|
|
280
|
+
},
|
|
281
|
+
// {
|
|
282
|
+
// type: 'checkbox',
|
|
283
|
+
// name: 'loadYouTubeThumbnail',
|
|
284
|
+
// label: 'Load YouTube thumbnail',
|
|
285
|
+
// changeProp: true,
|
|
286
|
+
// value: true
|
|
287
|
+
// },
|
|
288
|
+
{
|
|
289
|
+
type: "select",
|
|
290
|
+
name: "alignThumbnails",
|
|
291
|
+
tip: "Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",
|
|
292
|
+
label: "Align Thumbnails",
|
|
293
|
+
value: "middle",
|
|
294
|
+
changeProp: !0,
|
|
295
|
+
options: [
|
|
296
|
+
{ id: "left", label: "Left" },
|
|
297
|
+
{ id: "middle", label: "Middle" },
|
|
298
|
+
{ id: "right", label: "Right" }
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
type: "select",
|
|
303
|
+
name: "currentPagerPosition",
|
|
304
|
+
label: "Select thumbnail position",
|
|
305
|
+
value: "middle",
|
|
306
|
+
changeProp: !0,
|
|
307
|
+
options: [
|
|
308
|
+
{ id: "left", label: "Left" },
|
|
309
|
+
{ id: "middle", label: "Middle" },
|
|
310
|
+
{ id: "right", label: "Right" }
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
type: "number",
|
|
315
|
+
name: "thumbMargin",
|
|
316
|
+
label: "Thumb margin",
|
|
317
|
+
tip: "Spacing between each thumbnails",
|
|
318
|
+
changeProp: !0,
|
|
319
|
+
min: 0,
|
|
320
|
+
value: "5"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
type: "number",
|
|
324
|
+
name: "thumbWidth",
|
|
325
|
+
label: "Thumb width",
|
|
326
|
+
tip: "Width of each thumbnails",
|
|
327
|
+
changeProp: !0,
|
|
328
|
+
min: 0,
|
|
329
|
+
value: "100"
|
|
330
|
+
}
|
|
331
|
+
// { // TODO fix trait with number units
|
|
332
|
+
// type: 'number',
|
|
333
|
+
// name: 'thumbHeight',
|
|
334
|
+
// label: 'Thumbnail height',
|
|
335
|
+
// tip: 'Height of each thumbnails',
|
|
336
|
+
// changeProp: true,
|
|
337
|
+
// min: 0,
|
|
338
|
+
// value: '80px'
|
|
339
|
+
// }
|
|
340
|
+
]
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}, Ie = {
|
|
344
|
+
autoplay: {
|
|
345
|
+
category: { id: "autoplay-options", label: "Autoplay options" },
|
|
346
|
+
type: "checkbox",
|
|
347
|
+
label: "Autoplay",
|
|
348
|
+
value: !0,
|
|
349
|
+
subTraits: {
|
|
350
|
+
false: [],
|
|
351
|
+
true: [
|
|
352
|
+
{
|
|
353
|
+
type: "checkbox",
|
|
354
|
+
name: "autoplayControls",
|
|
355
|
+
label: "Autoplay controls",
|
|
356
|
+
tip: "Show/hide autoplay controls",
|
|
357
|
+
changeProp: !0,
|
|
358
|
+
value: !0
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
type: "checkbox",
|
|
362
|
+
name: "progressBar",
|
|
363
|
+
label: "Progress bar",
|
|
364
|
+
tip: "Show autoplay progress bar",
|
|
365
|
+
changeProp: !0,
|
|
366
|
+
value: !0
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
type: "checkbox",
|
|
370
|
+
name: "forceSlideShowAutoplay",
|
|
371
|
+
label: "Force autoplay",
|
|
372
|
+
tip: "If false, autoplay will be stopped after first user action",
|
|
373
|
+
changeProp: !0,
|
|
374
|
+
value: !1
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
type: "checkbox",
|
|
378
|
+
name: "slideShowAutoplay",
|
|
379
|
+
label: "Start autoplay",
|
|
380
|
+
tip: "Enable autoplay on start",
|
|
381
|
+
changeProp: !0,
|
|
382
|
+
value: !1
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
type: "number",
|
|
386
|
+
name: "slideShowInterval",
|
|
387
|
+
label: "Interval",
|
|
388
|
+
tip: "The time (in ms) between each auto transition",
|
|
389
|
+
changeProp: !0,
|
|
390
|
+
min: 0,
|
|
391
|
+
step: 50,
|
|
392
|
+
value: 5e3
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}, Le = {
|
|
398
|
+
zoom: {
|
|
399
|
+
category: { id: "zoom-options", label: "Zoom options" },
|
|
400
|
+
type: "checkbox",
|
|
401
|
+
label: "Zoom",
|
|
402
|
+
value: !0,
|
|
403
|
+
subTraits: {
|
|
404
|
+
false: [],
|
|
405
|
+
true: [
|
|
406
|
+
{
|
|
407
|
+
type: "checkbox",
|
|
408
|
+
name: "actualSize",
|
|
409
|
+
label: "Show actual size icon",
|
|
410
|
+
changeProp: !0,
|
|
411
|
+
value: !0
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
type: "checkbox",
|
|
415
|
+
name: "infiniteZoom",
|
|
416
|
+
label: "Infinte zoom",
|
|
417
|
+
changeProp: !0,
|
|
418
|
+
value: !0
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
type: "checkbox",
|
|
422
|
+
name: "showZoomInOutIcons",
|
|
423
|
+
label: "Show zoom in/out icons",
|
|
424
|
+
changeProp: !0,
|
|
425
|
+
value: !1
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
type: "number",
|
|
429
|
+
name: "scale",
|
|
430
|
+
label: "Scale",
|
|
431
|
+
tip: "Value of zoom should be incremented/decremented",
|
|
432
|
+
changeProp: !0,
|
|
433
|
+
min: 0,
|
|
434
|
+
value: 1
|
|
435
|
+
}
|
|
436
|
+
// This seems unnecessary (mainly for custom styling)
|
|
437
|
+
// {
|
|
438
|
+
// type: 'number',
|
|
439
|
+
// name: 'enableZoomAfter',
|
|
440
|
+
// label: 'Enable zoom after',
|
|
441
|
+
// tip: 'Once the slide transition is completed, how much time should take zoom plugin to activate',
|
|
442
|
+
// changeProp: true,
|
|
443
|
+
// min: 0,
|
|
444
|
+
// value: 300
|
|
445
|
+
// }
|
|
446
|
+
]
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}, y = "sourceType", G = "data-iframe", B = {
|
|
450
|
+
name: "href",
|
|
451
|
+
type: "file",
|
|
452
|
+
label: "Image Source"
|
|
453
|
+
}, _ = {
|
|
454
|
+
name: "data-src",
|
|
455
|
+
label: "Video Source",
|
|
456
|
+
placeholder: "https://www.youtube.com/watch?v=..."
|
|
457
|
+
}, R = {
|
|
458
|
+
name: "data-poster",
|
|
459
|
+
label: "Video Poster",
|
|
460
|
+
type: "file"
|
|
461
|
+
}, ae = {
|
|
462
|
+
name: "data-src",
|
|
463
|
+
label: "External Source",
|
|
464
|
+
placeholder: "https://some-external-source.com/...."
|
|
465
|
+
}, re = {
|
|
466
|
+
label: "Caption",
|
|
467
|
+
name: "data-sub-html",
|
|
468
|
+
placeholder: "My caption",
|
|
469
|
+
changeProp: !1
|
|
470
|
+
}, Ae = {
|
|
471
|
+
[O]: {
|
|
472
|
+
type: "button",
|
|
473
|
+
label: "Toggle Gallery",
|
|
474
|
+
command: (e, n) => {
|
|
475
|
+
var s, c;
|
|
476
|
+
const a = n.target, o = (s = a == null ? void 0 : a.closestType(w)) == null ? void 0 : s.getView();
|
|
477
|
+
if (o && a) {
|
|
478
|
+
const i = ((c = o.getLightGallery()) == null ? void 0 : c.items) || [], r = Array.from(i).indexOf(a.getEl());
|
|
479
|
+
r >= 0 && o.toggleGallery(r);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
[y]: {
|
|
484
|
+
type: "radio",
|
|
485
|
+
label: "Source type",
|
|
486
|
+
labelToTitle: !0,
|
|
487
|
+
value: "image",
|
|
488
|
+
subTraits: {
|
|
489
|
+
image: [B],
|
|
490
|
+
video: [_, R],
|
|
491
|
+
external: [ae]
|
|
492
|
+
},
|
|
493
|
+
options: [
|
|
494
|
+
{ id: "image", label: B.label || "", icon: S.image },
|
|
495
|
+
{ id: "video", label: _.label || "", icon: S.video },
|
|
496
|
+
{ id: "external", label: ae.label || "", icon: S.external }
|
|
497
|
+
]
|
|
498
|
+
},
|
|
499
|
+
subHtml: re
|
|
500
|
+
// This unfortuntaly breaks other thumbnails
|
|
501
|
+
// customThumb: traitCustomThumb
|
|
502
|
+
}, Ee = "lightGalleryComponent", oe = "lgThumbnail", Pe = "lgVideo", ne = "lgAutoplay", le = "lgZoom", x = "https://cdn.jsdelivr.net/npm/lightgallery@2.8.2", Ce = function(e, n = {}) {
|
|
503
|
+
const { Blocks: a, Components: o } = e, s = "LightGallery", c = "LightGallery Item", i = {
|
|
504
|
+
toolbarIconOpen: S.eye,
|
|
505
|
+
block: {},
|
|
506
|
+
lgLicenseKey: "0000-0000-000-0000",
|
|
507
|
+
defaultSrc: "https://placehold.co/200/777/white.png?text=Image",
|
|
508
|
+
plugins: [oe, Pe, ne, le],
|
|
509
|
+
cdnScript: [
|
|
510
|
+
`${x}/lightgallery.min.js`,
|
|
511
|
+
`${x}/plugins/thumbnail/lg-thumbnail.min.js`,
|
|
512
|
+
`${x}/plugins/video/lg-video.min.js`,
|
|
513
|
+
`${x}/plugins/autoplay/lg-autoplay.min.js`,
|
|
514
|
+
`${x}/plugins/zoom/lg-zoom.min.js`
|
|
515
|
+
],
|
|
516
|
+
cdnStyle: `${x}/css/lightgallery-bundle.min.css`,
|
|
517
|
+
...n
|
|
518
|
+
}, { block: r, toolbarIconOpen: h, defaultSrc: u } = i, I = function(t) {
|
|
519
|
+
const l = this, p = window, { plugins: b, cdnScript: v, cdnStyle: L, inline: q, lgLicenseKey: ce, ...d } = t || {}, f = (g) => isNaN(g) ? void 0 : parseInt(g, 10), Q = () => {
|
|
520
|
+
var P;
|
|
521
|
+
const g = {
|
|
522
|
+
...d,
|
|
523
|
+
licenseKey: ce,
|
|
524
|
+
speed: f(d.speed),
|
|
525
|
+
startAnimationDuration: f(d.startAnimationDuration),
|
|
526
|
+
thumbMargin: f(d.thumbMargin),
|
|
527
|
+
thumbWidth: f(d.thumbWidth),
|
|
528
|
+
slideShowInterval: f(d.slideShowInterval),
|
|
529
|
+
scale: f(d.scale),
|
|
530
|
+
enableZoomAfter: f(d.enableZoomAfter),
|
|
531
|
+
plugins: (b || []).map((C) => p[C])
|
|
532
|
+
};
|
|
533
|
+
q && (g.container = l, g.closable = !1);
|
|
534
|
+
const j = (P = p.lightGallery) == null ? void 0 : P.call(p, l, g);
|
|
535
|
+
q && j.openGallery();
|
|
536
|
+
};
|
|
537
|
+
if (p.lightGallery)
|
|
538
|
+
Q();
|
|
539
|
+
else {
|
|
540
|
+
const { head: g } = document, j = Array.isArray(v) ? [...v] : [v], P = Array.isArray(L) ? [...L] : [L], C = (T) => {
|
|
541
|
+
if (T.length) {
|
|
542
|
+
const m = document.createElement("link");
|
|
543
|
+
m.href = T.shift(), m.rel = "stylesheet", g.appendChild(m), C(T);
|
|
544
|
+
}
|
|
545
|
+
}, X = (T) => {
|
|
546
|
+
if (T.length) {
|
|
547
|
+
const m = document.createElement("script");
|
|
548
|
+
m.src = T.shift(), m.onerror = m.onload = X.bind(null, T), g.appendChild(m);
|
|
549
|
+
} else
|
|
550
|
+
Q();
|
|
551
|
+
};
|
|
552
|
+
C(P), X(j);
|
|
553
|
+
}
|
|
554
|
+
}, E = (t) => {
|
|
555
|
+
const l = t.getTrait(O);
|
|
556
|
+
if (!h || !l) return;
|
|
557
|
+
const { toolbar: p } = t, b = {
|
|
558
|
+
id: O,
|
|
559
|
+
label: h,
|
|
560
|
+
command: () => setTimeout(() => l.runCommand(), 100)
|
|
561
|
+
};
|
|
562
|
+
!p.find((L) => L.id === b.id) && (p == null || p.unshift(b));
|
|
563
|
+
};
|
|
564
|
+
let M = [];
|
|
565
|
+
const N = i.plugins || [], $ = A(xe), H = N.includes(oe) ? A(ke) : U, D = N.includes(ne) ? A(Ie) : U, K = N.includes(le) ? A(Le) : U;
|
|
566
|
+
o.addType(w, {
|
|
567
|
+
block: r && {
|
|
568
|
+
label: s,
|
|
569
|
+
media: S.gallery,
|
|
570
|
+
category: "Extra",
|
|
571
|
+
select: !0,
|
|
572
|
+
...i.block
|
|
573
|
+
},
|
|
574
|
+
isComponent: (t) => z(t, V),
|
|
575
|
+
extendFn: ["init", "initToolbar"],
|
|
576
|
+
model: {
|
|
577
|
+
defaults: {
|
|
578
|
+
name: s,
|
|
579
|
+
icon: S.gallery,
|
|
580
|
+
draggable: (t, l) => !l.is(w),
|
|
581
|
+
attributes: { [V]: !0 },
|
|
582
|
+
components: { type: ee },
|
|
583
|
+
script: I,
|
|
584
|
+
selector: "",
|
|
585
|
+
exThumbImage: "",
|
|
586
|
+
cdnScript: i.cdnScript,
|
|
587
|
+
cdnStyle: i.cdnStyle,
|
|
588
|
+
plugins: i.plugins,
|
|
589
|
+
lgLicenseKey: i.lgLicenseKey,
|
|
590
|
+
"script-props": [
|
|
591
|
+
"lgLicenseKey",
|
|
592
|
+
"cdnScript",
|
|
593
|
+
"cdnStyle",
|
|
594
|
+
"plugins",
|
|
595
|
+
"selector",
|
|
596
|
+
"exThumbImage",
|
|
597
|
+
...$.propKeys,
|
|
598
|
+
...H.propKeys,
|
|
599
|
+
...D.propKeys,
|
|
600
|
+
...K.propKeys
|
|
601
|
+
],
|
|
602
|
+
...$.props,
|
|
603
|
+
...H.props,
|
|
604
|
+
...D.props,
|
|
605
|
+
...K.props,
|
|
606
|
+
traits: [...$.traits, ...H.traits, ...D.traits, ...K.traits]
|
|
607
|
+
},
|
|
608
|
+
init() {
|
|
609
|
+
W(this, ["thumbnail"]), W(this, ["autoplay"]), W(this, ["zoom"]);
|
|
610
|
+
},
|
|
611
|
+
initToolbar() {
|
|
612
|
+
E(this);
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
extendFnView: ["init"],
|
|
616
|
+
view: {
|
|
617
|
+
// Events: https://www.lightgalleryjs.com/docs/events/
|
|
618
|
+
events: () => ({
|
|
619
|
+
lgInit: "onLgInit",
|
|
620
|
+
lgBeforeOpen: "onLgOpen",
|
|
621
|
+
lgAfterClose: "onLgClose"
|
|
622
|
+
}),
|
|
623
|
+
init() {
|
|
624
|
+
const t = o.events.scriptUnmount;
|
|
625
|
+
t && this.listenTo(this.model, t, this.destroyLightGallery);
|
|
626
|
+
},
|
|
627
|
+
getLightGallery() {
|
|
628
|
+
return this.el.__lg;
|
|
629
|
+
},
|
|
630
|
+
destroyLightGallery() {
|
|
631
|
+
const t = this.getLightGallery();
|
|
632
|
+
t == null || t.destroy();
|
|
633
|
+
},
|
|
634
|
+
disableLgInCanvas() {
|
|
635
|
+
const t = this.getLightGallery();
|
|
636
|
+
t.lgOpened = !0;
|
|
637
|
+
},
|
|
638
|
+
isInlineGallery() {
|
|
639
|
+
var l;
|
|
640
|
+
const t = this.getLightGallery();
|
|
641
|
+
return ((l = t == null ? void 0 : t.settings) == null ? void 0 : l.container) === this.el;
|
|
642
|
+
},
|
|
643
|
+
onLgInit(t) {
|
|
644
|
+
this.el.__lg = t.detail.instance, !this.isInlineGallery() && this.disableLgInCanvas();
|
|
645
|
+
},
|
|
646
|
+
onLgOpen() {
|
|
647
|
+
const { em: t } = this, { Canvas: l } = t, p = this.getLightGallery();
|
|
648
|
+
M = l.getSpots(), setTimeout(() => l.removeSpots()), p.__lgOpened = !0;
|
|
649
|
+
},
|
|
650
|
+
onLgClose() {
|
|
651
|
+
const t = this.getLightGallery();
|
|
652
|
+
M.forEach((l) => this.em.Canvas.addSpot(l.attributes)), M = [], t.__lgOpened = !1, setTimeout(() => this.disableLgInCanvas());
|
|
653
|
+
},
|
|
654
|
+
toggleGallery(t) {
|
|
655
|
+
const l = this.getLightGallery();
|
|
656
|
+
if (l.__lgOpened) return l.closeGallery(!0);
|
|
657
|
+
l.lgOpened = !1, l.openGallery(t);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
const J = A(Ae);
|
|
662
|
+
o.addType(ee, {
|
|
663
|
+
isComponent: (t) => z(t, te) || t.tagName === "A" && z(t.parentElement, V),
|
|
664
|
+
extendFn: ["init", "initToolbar"],
|
|
665
|
+
model: {
|
|
666
|
+
defaults: {
|
|
667
|
+
tagName: "a",
|
|
668
|
+
name: c,
|
|
669
|
+
icon: S.galleryItem,
|
|
670
|
+
attributes: { [te]: !0, href: u },
|
|
671
|
+
components: { type: "image", attributes: { alt: "Image", src: u } },
|
|
672
|
+
...J.props,
|
|
673
|
+
traits: [...J.traits]
|
|
674
|
+
},
|
|
675
|
+
init() {
|
|
676
|
+
const t = [y].map((l) => `change:${l}`).join(" ");
|
|
677
|
+
this.initSourceType(), this.on(t, this.updateTraits), this.updateTraits({ init: !0 }), this.initScriptUpdate(), Se(this, y, this.triggerGalleryUpdate);
|
|
678
|
+
},
|
|
679
|
+
initToolbar() {
|
|
680
|
+
E(this);
|
|
681
|
+
},
|
|
682
|
+
initScriptUpdate() {
|
|
683
|
+
const t = [re.name].map((l) => `change:attributes:${l}`).join(" ");
|
|
684
|
+
this.on(t, this.triggerGalleryUpdate);
|
|
685
|
+
},
|
|
686
|
+
triggerGalleryUpdate(...t) {
|
|
687
|
+
var l;
|
|
688
|
+
(l = this.closestType(w)) == null || l.__scriptPropsChange(...t);
|
|
689
|
+
},
|
|
690
|
+
updateTraits(t = {}) {
|
|
691
|
+
const { changed: l } = this, { init: p } = t;
|
|
692
|
+
if (l[y] || p) {
|
|
693
|
+
Z(this, y);
|
|
694
|
+
const b = this.getTrait(y).getValue();
|
|
695
|
+
if (b === k.image) {
|
|
696
|
+
this.removeAttributes([_.name, R.name, G]);
|
|
697
|
+
const v = this.getTrait(B.name);
|
|
698
|
+
v.setValue(v.getValue() || u);
|
|
699
|
+
} else b === k.video ? this.removeAttributes([G]) : b === k.external && this.addAttributes({ [G]: !0 });
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
initSourceType() {
|
|
703
|
+
const t = this.getAttributes({ noClass: !0, noStyle: !0 });
|
|
704
|
+
t[G] ? this.set(y, k.external) : (t[_.name] || t[R.name]) && this.set(y, k.video);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}), Te({
|
|
708
|
+
editor: e,
|
|
709
|
+
licenseKey: i.licenseKey,
|
|
710
|
+
pluginName: Ee,
|
|
711
|
+
cleanup: () => {
|
|
712
|
+
a.remove(w), o.removeType(w);
|
|
713
|
+
}
|
|
714
|
+
});
|
|
715
|
+
}, Ge = fe(Ce);
|
|
716
|
+
export {
|
|
717
|
+
Ge as default
|
|
718
|
+
};
|