@grapesjs/studio-sdk-plugins 1.0.10 → 1.0.11

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.
Files changed (41) hide show
  1. package/dist/dialogComponent/index.cjs.js +2 -2
  2. package/dist/dialogComponent/index.es.js +4 -3
  3. package/dist/dialogComponent/index.umd.js +7 -7
  4. package/dist/fsLightboxComponent/index.cjs.js +2 -2
  5. package/dist/fsLightboxComponent/index.es.js +4 -3
  6. package/dist/fsLightboxComponent/index.umd.js +2 -2
  7. package/dist/index.cjs.d.ts +1 -0
  8. package/dist/index.cjs.js +59 -15
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.d.ts +1 -0
  11. package/dist/index.es.js +3891 -2910
  12. package/dist/index.umd.js +66 -22
  13. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  14. package/dist/lightGalleryComponent/index.es.js +21 -20
  15. package/dist/lightGalleryComponent/index.umd.js +1 -1
  16. package/dist/listPagesComponent/index.cjs.js +4 -4
  17. package/dist/listPagesComponent/index.es.js +4 -3
  18. package/dist/listPagesComponent/index.umd.js +3 -3
  19. package/dist/prosemirror/index.cjs.js +1 -1
  20. package/dist/prosemirror/index.es.js +4 -2
  21. package/dist/prosemirror/index.umd.js +1 -1
  22. package/dist/swiperComponent/components/Swiper.d.ts +12 -0
  23. package/dist/swiperComponent/components/SwiperNavigation.d.ts +7 -0
  24. package/dist/swiperComponent/components/SwiperPagination.d.ts +3 -0
  25. package/dist/swiperComponent/components/SwiperScrollbar.d.ts +5 -0
  26. package/dist/swiperComponent/components/SwiperSlide.d.ts +5 -0
  27. package/dist/swiperComponent/components/SwiperWrapper.d.ts +5 -0
  28. package/dist/swiperComponent/index.cjs.d.ts +3 -0
  29. package/dist/swiperComponent/index.cjs.js +45 -0
  30. package/dist/swiperComponent/index.d.ts +3 -0
  31. package/dist/swiperComponent/index.es.d.ts +3 -0
  32. package/dist/swiperComponent/index.es.js +1082 -0
  33. package/dist/swiperComponent/index.umd.js +45 -0
  34. package/dist/swiperComponent/types.d.ts +13 -0
  35. package/dist/swiperComponent/typesSchema.d.ts +19 -0
  36. package/dist/swiperComponent/utils.d.ts +23 -0
  37. package/dist/tableComponent/index.cjs.js +1 -1
  38. package/dist/tableComponent/index.es.js +4 -3
  39. package/dist/tableComponent/index.umd.js +1 -1
  40. package/dist/utils.d.ts +36 -1
  41. package/package.json +1 -1
@@ -0,0 +1,1082 @@
1
+ import "grapesjs";
2
+ const X = "app.grapesjs.com", J = "app-stage.grapesjs.com", q = [
3
+ X,
4
+ J,
5
+ "localhost",
6
+ "127.0.0.1",
7
+ ".local-credentialless.webcontainer.io",
8
+ // For stackblitz.com demos
9
+ ".local.webcontainer.io",
10
+ // For stackblitz.com demos
11
+ "-sandpack.codesandbox.io"
12
+ // For Sandpack demos
13
+ ], Q = "license:check:start", ee = "license:check:end", te = () => typeof window < "u", ae = ({ isDev: t, isStage: l }) => `${t ? "" : `https://${l ? J : X}`}/api`, le = () => {
14
+ const t = te() && window.location.hostname;
15
+ return !!t && (q.includes(t) || q.some((l) => t.endsWith(l)));
16
+ }, se = (t) => t.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (l, a) => (a ? "-" : "") + l.toLowerCase()), ne = (t) => typeof t < "u";
17
+ var E = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(E || {});
18
+ async function ie({
19
+ path: t,
20
+ baseApiUrl: l,
21
+ method: a = "GET",
22
+ headers: s = {},
23
+ params: i,
24
+ body: r
25
+ }) {
26
+ const u = `${l || ae({ isDev: !1, isStage: !1 })}${t}`, d = {
27
+ method: a,
28
+ headers: {
29
+ "Content-Type": "application/json",
30
+ ...s
31
+ }
32
+ };
33
+ r && (d.body = JSON.stringify(r));
34
+ const b = i ? new URLSearchParams(i).toString() : "", e = b ? `?${b}` : "", n = await fetch(`${u}${e}`, d);
35
+ if (!n.ok)
36
+ throw new Error(`HTTP error! status: ${n.status}`);
37
+ return n.json();
38
+ }
39
+ const z = {
40
+ [E.free]: 0,
41
+ [E.startup]: 10,
42
+ [E.business]: 20,
43
+ [E.enterprise]: 30
44
+ };
45
+ function oe(t) {
46
+ const l = t;
47
+ return l.init = (a) => (s) => t(s, a), l;
48
+ }
49
+ const re = (t) => /* @__PURE__ */ oe(t);
50
+ async function ce({
51
+ editor: t,
52
+ plan: l,
53
+ pluginName: a,
54
+ licenseKey: s,
55
+ cleanup: i
56
+ }) {
57
+ let r = "", c = !1;
58
+ const u = le(), d = (e) => {
59
+ console.warn("Cleanup plugin:", a, "Reason:", e), i();
60
+ }, b = (e = {}) => {
61
+ var R;
62
+ const { error: n, sdkLicense: m } = e, g = (R = e.plan) == null ? void 0 : R.category;
63
+ if (!(m || e.license) || n)
64
+ d(n || "Invalid license");
65
+ else if (g) {
66
+ const A = z[l], C = z[g];
67
+ A > C && d({ pluginRequiredPlan: l, licensePlan: g });
68
+ }
69
+ };
70
+ t.on(Q, (e) => {
71
+ r = e == null ? void 0 : e.baseApiUrl, c = !0;
72
+ }), t.on(ee, (e) => {
73
+ b(e);
74
+ }), setTimeout(async () => {
75
+ if (!c) {
76
+ if (u) return;
77
+ if (s) {
78
+ const e = await de({ licenseKey: s, pluginName: a, baseApiUrl: r });
79
+ e && b(e);
80
+ } else
81
+ d("The `licenseKey` option not provided");
82
+ }
83
+ }, 2e3);
84
+ }
85
+ async function de(t) {
86
+ const { licenseKey: l, pluginName: a, baseApiUrl: s } = t;
87
+ try {
88
+ return (await ie({
89
+ baseApiUrl: s,
90
+ path: `/sdk/${l || "na"}`,
91
+ method: "POST",
92
+ params: {
93
+ d: window.location.hostname,
94
+ pn: a
95
+ }
96
+ })).result || {};
97
+ } catch (i) {
98
+ return console.error("Error during SDK license check:", i), !1;
99
+ }
100
+ }
101
+ const w = (t, l) => {
102
+ var a;
103
+ return !!((a = t == null ? void 0 : t.classList) != null && a.contains(l));
104
+ }, pe = (t, l = {}) => {
105
+ var r;
106
+ const a = {}, s = [], i = [];
107
+ for (const c in t) {
108
+ const { value: u, ...d } = t[c];
109
+ s.push({ id: c, name: c, changeProp: !0, category: l.category, ...d }), a[c] = u, !ne(u) && i.push(c);
110
+ const { subTraits: b = {} } = d;
111
+ for (const e in d.subTraits)
112
+ (r = b[e]) == null || r.forEach((n) => {
113
+ const m = n.id || n.name;
114
+ a[m] = n.value;
115
+ });
116
+ }
117
+ return {
118
+ propKeys: Object.keys(a),
119
+ propsNoValues: i,
120
+ props: a,
121
+ traits: s
122
+ };
123
+ }, ue = (t, l) => {
124
+ l.forEach((a) => {
125
+ if (a.subTraits) {
126
+ const s = `${a.id || a.name}`, i = a.changeProp ? `change:${s}` : `change:attributes:${s}`;
127
+ t.on(i, () => H(t, s)), H(t, s);
128
+ }
129
+ });
130
+ }, H = (t, l) => {
131
+ const a = t.getTrait(l), s = a.get("category"), i = a.get("subTraits") || {}, c = (Object.values(i).flat() || []).map((b) => b.id || b.name);
132
+ t.removeTrait(c);
133
+ const u = i[a.getValue()], d = t.getTraitIndex(l) + 1;
134
+ u && t.addTrait(
135
+ u.map((b) => ({ category: s, ...b })),
136
+ { at: d }
137
+ );
138
+ }, be = (t, l) => {
139
+ l.forEach((a) => {
140
+ const s = se(a);
141
+ s !== a && t.has(s) && t.set({ [a]: t.get(s), [s]: void 0 });
142
+ });
143
+ }, h = "swiper", M = `${h}-slide`, T = `${h}-wrapper`, x = `${h}-nav-prev`, V = `${h}-nav-next`, L = `${h}-pagination`, N = `${h}-scrollbar`, p = {
144
+ slider: `<svg viewBox="0 0 24 24">
145
+ <path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
146
+ <path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
147
+ </svg>`,
148
+ effect: `<svg viewBox="0 0 24 24">
149
+ <path d="M7.5 5.6 5 7l1.4-2.5L5 2l2.5 1.4L10 2 8.6 4.5 10 7 7.5 5.6m12 9.8L22 14l-1.4 2.5L22 19l-2.5-1.4L17 19l1.4-2.5L17 14l2.5 1.4M22 2l-1.4 2.5L22 7l-2.5-1.4L17 7l1.4-2.5L17 2l2.5 1.4L22 2m-8.7 10.8 2.5-2.5-2.1-2-2.5 2.4 2.1 2m1-5.4 2.4 2.3c.4.4.4 1 0 1.4L5 22.7a1 1 0 0 1-1.4 0l-2.3-2.3a1 1 0 0 1 0-1.4L13 7.3a1 1 0 0 1 1.4 0Z"/>
150
+ </svg>`,
151
+ autoplay: `<svg viewBox="0 0 24 24">
152
+ <path d="M5 6.3A1 1 0 0 1 5 5a1 1 0 0 1 1.3 0l6.8 5.4.3.3a2 2 0 0 1-2.8 2.8l-.3-.3L5 6.3M12 20a8 8 0 0 0 8-8 8 8 0 0 0-2.3-5.7L19 5a10 10 0 0 1 3 7 10 10 0 0 1-10 10A10 10 0 0 1 2 12h2a8 8 0 0 0 8 8m0-19a2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2 2 2 0 0 1 2-2Z"/>
153
+ </svg>`,
154
+ pagination: `<svg viewBox="0 0 24 24">
155
+ <path d="M16 12a2 2 0 0 1 2-2 2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2 2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2 2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2Z"/>
156
+ </svg>`,
157
+ scrollbar: `<svg viewBox="0 0 24 24">
158
+ <path d="M7.2 9.2 5.8 7.8 1.5 12l4.3 4.2 1.4-1.4L4.4 12zm9.6 5.6 1.4 1.4 4.3-4.2-4.3-4.2-1.4 1.4 2.8 2.8z"/>
159
+ <path fill-rule="evenodd" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0m-2 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0" clip-rule="evenodd"/>
160
+ </svg>`,
161
+ parallax: `<svg viewBox="0 0 24 24">
162
+ <path d="M12.6 23.3h-.2v.5h.2v-.5m.3-.2-.2.1v.5l.2.1v-.6m-.8 0v.6h.2v-.5z"/>
163
+ <path fill="currentColor" d="M18 9.4a2.5 2.5 0 0 1 3 2.3v5.7a3 3 0 0 1-2.2 2.9h-.2L13 21.4a2.5 2.5 0 0 1-3-2.3v-5.7a3 3 0 0 1 2.2-2.9h.2zM14.5 6a2.5 2.5 0 0 1 3 2.3v.4l-5.3 1A4 4 0 0 0 9 13.4v4.8a2.5 2.5 0 0 1-2.5-2.4v-5.7a3 3 0 0 1 2.2-2.9H9zM11 2.6a2.5 2.5 0 0 1 3 2.3v.3l-5.3 1A4 4 0 0 0 5.5 10v4.8A2.5 2.5 0 0 1 3 12.3V6.6a3 3 0 0 1 2.2-2.9h.2z"/>
164
+ </svg>`,
165
+ responsive: `<svg viewBox="0 0 24 24">
166
+ <path d="M17 21q-.4 0-.7-.3T16 20V10q0-.8-.6-1.4T14 8h-3.5q-.4 0-.7-.3T9.5 7V4q0-.4.3-.7t.7-.3H20q.4 0 .7.3t.3.7v16q0 .4-.3.7t-.7.3zm-6.5 0q-.4 0-.7-.3t-.3-.7v-9q0-.4.3-.7t.7-.3H13q.4 0 .7.3t.3.7v9q0 .4-.3.7t-.7.3zM4 21q-.4 0-.7-.3T3 20v-9q0-.4.3-.7T4 10h2.5q.4 0 .7.3t.3.7v9q0 .4-.3.7t-.7.3z"/>
167
+ </svg>`,
168
+ extra: `<svg viewBox="0 0 24 24">
169
+ <path fill-rule="evenodd" d="M5.4 3h13.2A2.4 2.4 0 0 1 21 5.4v13.2a2.4 2.4 0 0 1-2.4 2.4H5.4A2.4 2.4 0 0 1 3 18.6V5.4A2.4 2.4 0 0 1 5.4 3M5 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0m5 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0m7-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4" clip-rule="evenodd"/>
170
+ </svg>`,
171
+ reload: `<svg viewBox="0 0 24 24">
172
+ <path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
173
+ </svg>`,
174
+ prev: '<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',
175
+ next: '<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',
176
+ add: `<svg viewBox="0 0 24 24">
177
+ <path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
178
+ </svg>`
179
+ }, G = { id: "swiper-responsive", label: "Responsive", icon: p.responsive }, U = { id: "swiper-extra", label: "Extra", icon: p.extra }, fe = {
180
+ actions: {
181
+ type: "radio",
182
+ label: !1,
183
+ labelToTitle: !0,
184
+ options: [
185
+ { id: "r", label: "Reload slider", icon: p.reload },
186
+ { id: "p", label: "Previous slide", icon: p.prev },
187
+ { id: "n", label: "Next slide", icon: p.next },
188
+ { id: "a", label: "Add new slide", icon: p.add }
189
+ ],
190
+ setValue: ({ component: t, value: l }) => {
191
+ var s;
192
+ const a = (s = t.getView()) == null ? void 0 : s.getSwiper();
193
+ switch (l) {
194
+ case "r":
195
+ t.reloadSlider();
196
+ break;
197
+ case "p":
198
+ a == null || a.slidePrev();
199
+ break;
200
+ case "n":
201
+ a == null || a.slideNext();
202
+ break;
203
+ case "a":
204
+ t.addSlide();
205
+ break;
206
+ }
207
+ }
208
+ },
209
+ vertical: {
210
+ type: "checkbox",
211
+ label: "Vertical",
212
+ value: !1
213
+ },
214
+ loop: {
215
+ type: "checkbox",
216
+ label: "Loop",
217
+ value: !1
218
+ },
219
+ freeMode: {
220
+ type: "checkbox",
221
+ label: "Free mode",
222
+ value: !1
223
+ },
224
+ autoHeight: {
225
+ type: "checkbox",
226
+ label: "Auto height",
227
+ value: !1
228
+ },
229
+ navigation: {
230
+ type: "checkbox",
231
+ label: "Navigation",
232
+ getValue: ({ component: t }) => !!t.findFirstType(x),
233
+ setValue: ({ component: t, value: l }) => {
234
+ var a, s;
235
+ l ? t.append([{ type: x }, { type: V }]) : ((a = t.findFirstType(x)) == null || a.remove(), (s = t.findFirstType(V)) == null || s.remove()), t.set({ navigation: l });
236
+ }
237
+ },
238
+ initialSlide: {
239
+ type: "number",
240
+ label: "Initial slide",
241
+ min: 0,
242
+ value: "0"
243
+ },
244
+ speed: {
245
+ type: "number",
246
+ label: "Speed",
247
+ tip: "Transition duration (in ms)",
248
+ step: 500,
249
+ min: 0,
250
+ value: 300
251
+ },
252
+ effect: {
253
+ category: { id: "swiper-effect", label: "Effects", icon: p.effect },
254
+ type: "select",
255
+ label: "Effect Type",
256
+ value: "slide",
257
+ options: [
258
+ { id: "slide", label: "Slide" },
259
+ { id: "fade", label: "Fade" },
260
+ { id: "cube", label: "Cube" },
261
+ { id: "coverflow", label: "Coverflow" },
262
+ { id: "flip", label: "Flip" },
263
+ { id: "cards", label: "Cards" }
264
+ ],
265
+ subTraits: {
266
+ slide: [
267
+ {
268
+ type: "number",
269
+ name: "slidesPerView",
270
+ label: "Slides per view",
271
+ changeProp: !0,
272
+ min: 1,
273
+ value: 1
274
+ },
275
+ {
276
+ type: "number",
277
+ name: "slidesPerGroup",
278
+ label: "Slides per group",
279
+ tip: "Numbers of slides for group sliding",
280
+ changeProp: !0,
281
+ min: 1,
282
+ value: 1
283
+ },
284
+ {
285
+ type: "number",
286
+ name: "spaceBetween",
287
+ label: "Space between",
288
+ tip: "Distance between slides in px",
289
+ changeProp: !0,
290
+ min: 0,
291
+ value: 0
292
+ },
293
+ {
294
+ type: "number",
295
+ name: "slidesOffsetBefore",
296
+ label: "Slides offset before",
297
+ tip: "Add additional slide offset in the beginning of the container (in px, before all slides)",
298
+ changeProp: !0,
299
+ min: 0,
300
+ value: 0
301
+ },
302
+ {
303
+ type: "number",
304
+ name: "slidesOffsetAfter",
305
+ label: "Slides offset after",
306
+ tip: "Add additional slide offset in the end of the container (in px, after all slides)",
307
+ changeProp: !0,
308
+ min: 0,
309
+ value: 0
310
+ },
311
+ {
312
+ type: "checkbox",
313
+ name: "centeredSlides",
314
+ label: "Centered slides",
315
+ tip: "If enabled, the active slide will be centered",
316
+ changeProp: !0,
317
+ value: !1
318
+ }
319
+ ],
320
+ fade: [
321
+ {
322
+ type: "checkbox",
323
+ name: "crossFade",
324
+ tip: "Enables slides cross fade",
325
+ label: "Cross fade",
326
+ changeProp: !0,
327
+ value: !1
328
+ }
329
+ ],
330
+ cube: [
331
+ {
332
+ type: "checkbox",
333
+ name: "cubeEffectShadow",
334
+ label: "Shadow",
335
+ changeProp: !0,
336
+ value: !0
337
+ },
338
+ {
339
+ type: "checkbox",
340
+ name: "cubeEffectSlideShadows",
341
+ label: "Slide shadows",
342
+ changeProp: !0,
343
+ value: !0
344
+ },
345
+ {
346
+ type: "number",
347
+ name: "cubeEffectShadowOffset",
348
+ label: "Shadow offset",
349
+ changeProp: !0,
350
+ value: 20
351
+ },
352
+ {
353
+ type: "number",
354
+ name: "cubeEffectShadowScale",
355
+ label: "Shadow scale",
356
+ changeProp: !0,
357
+ value: 0.94
358
+ }
359
+ ],
360
+ coverflow: [
361
+ {
362
+ type: "number",
363
+ name: "coverflowEffectDepth",
364
+ tip: "Depth offset in px (slides translate in Z axis)",
365
+ label: "Depth",
366
+ changeProp: !0,
367
+ min: 0,
368
+ value: 100
369
+ },
370
+ {
371
+ type: "number",
372
+ name: "coverflowEffectModifier",
373
+ tip: "Effect multiplier",
374
+ label: "Modifier",
375
+ changeProp: !0,
376
+ step: 0.1,
377
+ min: 0,
378
+ value: 1
379
+ },
380
+ {
381
+ type: "number",
382
+ name: "coverflowEffectRotate",
383
+ tip: "Slide rotate in degrees",
384
+ label: "Rotate",
385
+ changeProp: !0,
386
+ min: 0,
387
+ value: 50
388
+ },
389
+ {
390
+ type: "number",
391
+ name: "coverflowEffectScale",
392
+ tip: "Slide scale effect",
393
+ label: "Scale",
394
+ changeProp: !0,
395
+ min: 0,
396
+ step: 0.1,
397
+ value: 1
398
+ },
399
+ {
400
+ type: "number",
401
+ name: "coverflowEffectStretch",
402
+ tip: "Stretch space between slides (in px)",
403
+ label: "Stretch",
404
+ changeProp: !0,
405
+ min: 0,
406
+ value: 0
407
+ },
408
+ {
409
+ type: "checkbox",
410
+ name: "coverflowEffectSlideShadows",
411
+ tip: "Enables slides shadows",
412
+ label: "Slide shadow",
413
+ changeProp: !0,
414
+ value: !0
415
+ }
416
+ ],
417
+ flip: [
418
+ {
419
+ type: "checkbox",
420
+ name: "flipEffectLimitRotation",
421
+ tip: "Limit edge slides rotation",
422
+ label: "Limit rotation",
423
+ changeProp: !0,
424
+ value: !0
425
+ },
426
+ {
427
+ type: "checkbox",
428
+ name: "flipEffectSlideShadows",
429
+ tip: "Enables slides shadows",
430
+ label: "Slide shadows",
431
+ changeProp: !0,
432
+ value: !0
433
+ }
434
+ ],
435
+ cards: [
436
+ {
437
+ type: "number",
438
+ name: "cardsEffectPerSlideOffset",
439
+ tip: "Offset distance per slide (in px)",
440
+ label: "Slide offset",
441
+ changeProp: !0,
442
+ min: 0,
443
+ value: 8
444
+ },
445
+ {
446
+ type: "number",
447
+ name: "cardsEffectPerSlideRotate",
448
+ tip: "Rotate angle per slide (in degrees)",
449
+ label: "Slide rotate",
450
+ changeProp: !0,
451
+ min: 0,
452
+ value: 2
453
+ },
454
+ {
455
+ type: "checkbox",
456
+ name: "cardsEffectRotate",
457
+ tip: "Enables cards rotation",
458
+ label: "Rotate",
459
+ changeProp: !0,
460
+ value: !0
461
+ },
462
+ {
463
+ type: "checkbox",
464
+ name: "cardsEffectSlideShadows",
465
+ tip: "Enables slides shadows",
466
+ label: "Slide shadows",
467
+ changeProp: !0,
468
+ value: !0
469
+ }
470
+ ]
471
+ }
472
+ },
473
+ autoplay: {
474
+ category: { id: "swiper-autoplay", label: "Autoplay", icon: p.autoplay },
475
+ type: "checkbox",
476
+ label: "Enable Autoplay",
477
+ value: !1,
478
+ subTraits: {
479
+ true: [
480
+ {
481
+ type: "number",
482
+ name: "autoplayDelay",
483
+ label: "Delay",
484
+ changeProp: !0,
485
+ value: 3e3
486
+ },
487
+ {
488
+ type: "checkbox",
489
+ name: "autoplayDisableOnInteraction",
490
+ label: "Disable on interaction",
491
+ changeProp: !0,
492
+ value: !0
493
+ },
494
+ {
495
+ type: "checkbox",
496
+ name: "autoplayWaitForTransition",
497
+ label: "Wait for transition",
498
+ changeProp: !0,
499
+ value: !0
500
+ },
501
+ {
502
+ type: "checkbox",
503
+ name: "autoplayPauseOnMouseEnter",
504
+ label: "Pause on mouse enter",
505
+ changeProp: !0,
506
+ value: !1
507
+ },
508
+ {
509
+ type: "checkbox",
510
+ name: "autoplayReverseDirection",
511
+ label: "Reverse direction",
512
+ changeProp: !0,
513
+ value: !1
514
+ },
515
+ {
516
+ type: "checkbox",
517
+ name: "autoplayStopOnLastSlide",
518
+ label: "Stop on last slide",
519
+ changeProp: !0,
520
+ value: !1
521
+ }
522
+ ]
523
+ }
524
+ },
525
+ pagination: {
526
+ category: { id: "swiper-pagination", label: "Pagination", icon: p.pagination },
527
+ type: "select",
528
+ label: "Pagination Type",
529
+ options: [
530
+ { id: "none", label: "None" },
531
+ { id: "bullets", label: "Bullets" },
532
+ { id: "progressbar", label: "Progressbar" },
533
+ { id: "fraction", label: "Fraction" }
534
+ ],
535
+ getValue: ({ component: t }) => t.findFirstType(L) ? t.get("pagination") || "bullets" : "none",
536
+ setValue: ({ component: t, value: l }) => {
537
+ const a = t.findFirstType(L);
538
+ a == null || a.remove(), l !== "none" && t.append({ type: L }), t.set({ pagination: l });
539
+ },
540
+ subTraits: {
541
+ bullets: [
542
+ {
543
+ type: "checkbox",
544
+ name: "dynamicBullets",
545
+ label: "Dynamic bullets",
546
+ changeProp: !0,
547
+ value: !1
548
+ },
549
+ {
550
+ type: "checkbox",
551
+ name: "clickableBullets",
552
+ label: "Clickable bullets",
553
+ changeProp: !0,
554
+ value: !0
555
+ }
556
+ ],
557
+ progressbar: [
558
+ {
559
+ type: "checkbox",
560
+ name: "progressbarOpposite",
561
+ label: "Progress opposite",
562
+ changeProp: !0,
563
+ value: !1
564
+ }
565
+ ]
566
+ }
567
+ },
568
+ scrollbar: {
569
+ category: { id: "swiper-scrollbar", label: "Scrollbar", icon: p.scrollbar },
570
+ type: "checkbox",
571
+ label: "Enable Scrollbar",
572
+ getValue: ({ component: t }) => !!t.findFirstType(N),
573
+ setValue: ({ component: t, value: l }) => {
574
+ const a = t.findFirstType(N);
575
+ a == null || a.remove(), l && t.append({ type: N }), t.set({ scrollbar: l });
576
+ },
577
+ subTraits: {
578
+ false: [],
579
+ true: [
580
+ {
581
+ type: "checkbox",
582
+ name: "scrollbarDraggable",
583
+ label: "Draggable",
584
+ changeProp: !0,
585
+ value: !1
586
+ },
587
+ {
588
+ type: "checkbox",
589
+ name: "scrollbarHide",
590
+ label: "Hide",
591
+ tip: "Hide scrollbar automatically after user interaction",
592
+ changeProp: !0,
593
+ value: !0
594
+ }
595
+ ]
596
+ }
597
+ },
598
+ parallax: {
599
+ category: { id: "swiper-parallax", label: "Parallax", icon: p.parallax },
600
+ type: "checkbox",
601
+ label: "Enable Parallax",
602
+ value: !1
603
+ },
604
+ mobile: {
605
+ category: G,
606
+ type: "checkbox",
607
+ label: "Enable mobile breakpoint",
608
+ value: !1,
609
+ subTraits: {
610
+ true: [
611
+ {
612
+ type: "number",
613
+ name: "mobileBreakpoint",
614
+ label: "Mobile breakpoint",
615
+ tip: "Slide values below will be applied when the screen width is greater than this value",
616
+ changeProp: !0,
617
+ min: 1,
618
+ value: 460
619
+ },
620
+ {
621
+ type: "number",
622
+ name: "mobileSlidesPerView",
623
+ label: "Slides per view",
624
+ changeProp: !0,
625
+ min: 1,
626
+ value: 1
627
+ },
628
+ {
629
+ type: "number",
630
+ name: "mobileSlidesPerGroup",
631
+ label: "Slides per group",
632
+ changeProp: !0,
633
+ min: 1,
634
+ value: 1
635
+ },
636
+ {
637
+ type: "number",
638
+ name: "mobileSpaceBetween",
639
+ label: "Space between",
640
+ changeProp: !0,
641
+ min: 0,
642
+ value: 0
643
+ }
644
+ ]
645
+ }
646
+ },
647
+ tablet: {
648
+ category: G,
649
+ type: "checkbox",
650
+ label: "Enable tablet breakpoint",
651
+ value: !1,
652
+ subTraits: {
653
+ true: [
654
+ {
655
+ type: "number",
656
+ name: "tabletBreakpoint",
657
+ label: "Tablet breakpoint",
658
+ tip: "Slide values below will be applied when the screen width is greater than this value",
659
+ changeProp: !0,
660
+ min: 1,
661
+ value: 991
662
+ },
663
+ {
664
+ type: "number",
665
+ name: "tabletSlidesPerView",
666
+ label: "Slides per view",
667
+ changeProp: !0,
668
+ min: 1,
669
+ value: 1
670
+ },
671
+ {
672
+ type: "number",
673
+ name: "tabletSlidesPerGroup",
674
+ label: "Slides per group",
675
+ changeProp: !0,
676
+ min: 1,
677
+ value: 1
678
+ },
679
+ {
680
+ type: "number",
681
+ name: "tabletSpaceBetween",
682
+ label: "Space between",
683
+ changeProp: !0,
684
+ min: 0,
685
+ value: 0
686
+ }
687
+ ]
688
+ }
689
+ },
690
+ allowTouchMove: {
691
+ category: U,
692
+ type: "checkbox",
693
+ label: "Allow touch move",
694
+ tip: "Allow touch interactions",
695
+ value: !0
696
+ },
697
+ grabCursor: {
698
+ category: U,
699
+ type: "checkbox",
700
+ label: "Grab cursor",
701
+ tip: 'If enabled, the user will see the "grab" cursor when hover the slider',
702
+ value: !1
703
+ }
704
+ }, j = "Slider", F = "swiper", k = `${F}-`, he = (t, l) => {
705
+ const { Components: a, Blocks: s } = t, { block: i } = l, r = pe(fe), c = "core:preview", u = function(e) {
706
+ const n = this, m = window, g = n.__onLoad, D = n.__activeSlide, R = n.__inPreview, { cdnScript: A, cdnStyle: C, slidesPerView: $ } = e || {}, o = (f) => isNaN(f) ? void 0 : parseFloat(f), W = () => {
707
+ const f = {
708
+ loop: e.loop,
709
+ speed: e.speed,
710
+ initialSlide: e.initialSlide,
711
+ direction: e.vertical ? "vertical" : "horizontal",
712
+ effect: e.effect,
713
+ freeMode: e.freeMode,
714
+ parallax: e.parallax,
715
+ autoHeight: e.autoHeight,
716
+ allowTouchMove: e.allowTouchMove,
717
+ grabCursor: e.grabCursor,
718
+ simulateTouch: !0,
719
+ breakpoints: {},
720
+ slidesPerView: isNaN($) ? $ : o($),
721
+ slidesPerGroup: o(e.slidesPerGroup),
722
+ spaceBetween: o(e.spaceBetween),
723
+ slidesOffsetBefore: o(e.slidesOffsetBefore),
724
+ slidesOffsetAfter: o(e.slidesOffsetAfter),
725
+ centeredSlides: e.centeredSlides,
726
+ fadeEffect: { crossFade: e.crossFade },
727
+ cubeEffect: {
728
+ shadow: e.cubeEffectShadow,
729
+ slideShadows: e.cubeEffectSlideShadows,
730
+ shadowOffset: o(e.cubeEffectShadowOffset),
731
+ shadowScale: o(e.cubeEffectShadowScale)
732
+ },
733
+ coverflowEffect: {
734
+ depth: o(e.coverflowEffectDepth),
735
+ modifier: o(e.coverflowEffectModifier),
736
+ rotate: o(e.coverflowEffectRotate),
737
+ scale: o(e.coverflowEffectScale),
738
+ stretch: o(e.coverflowEffectStretch),
739
+ slideShadows: e.coverflowEffectSlideShadows
740
+ },
741
+ flipEffect: {
742
+ limitRotation: e.flipEffectLimitRotation,
743
+ slideShadows: e.flipEffectSlideShadows
744
+ },
745
+ cardsEffect: {
746
+ perSlideOffset: o(e.cardsEffectPerSlideOffset),
747
+ perSlideRotate: o(e.cardsEffectPerSlideRotate),
748
+ rotate: e.cardsEffectRotate,
749
+ slideShadows: e.cardsEffectSlideShadows
750
+ },
751
+ navigation: {
752
+ nextEl: n.querySelector(".swiper-button-next"),
753
+ prevEl: n.querySelector(".swiper-button-prev")
754
+ },
755
+ pagination: {
756
+ type: e.pagination || "bullets",
757
+ dynamicBullets: e.dynamicBullets,
758
+ clickable: e.clickableBullets,
759
+ progressbarOpposite: e.progressbarOpposite,
760
+ el: n.querySelector(".swiper-pagination")
761
+ },
762
+ scrollbar: {
763
+ el: n.querySelector(".swiper-scrollbar"),
764
+ draggable: e.scrollbarDraggable,
765
+ hide: e.scrollbarHide
766
+ },
767
+ autoplay: e.autoplay && {
768
+ delay: e.autoplayDelay,
769
+ disableOnInteraction: e.autoplayDisableOnInteraction,
770
+ pauseOnMouseEnter: e.autoplayPauseOnMouseEnter,
771
+ reverseDirection: e.autoplayReverseDirection,
772
+ stopOnLastSlide: e.autoplayStopOnLastSlide,
773
+ waitForTransition: e.autoplayWaitForTransition
774
+ }
775
+ };
776
+ if (e.tablet) {
777
+ const { tabletBreakpoint: _, tabletSlidesPerView: v } = e, P = o(_);
778
+ f.breakpoints[P] = {
779
+ slidesPerView: isNaN(v) ? v : o(v),
780
+ slidesPerGroup: o(e.tabletSlidesPerGroup),
781
+ spaceBetween: o(e.tabletSpaceBetween)
782
+ };
783
+ }
784
+ if (e.mobile) {
785
+ const { mobileBreakpoint: _, mobileSlidesPerView: v } = e, P = o(_);
786
+ f.breakpoints[P] = {
787
+ slidesPerView: isNaN(v) ? v : o(v),
788
+ slidesPerGroup: o(e.mobileSlidesPerGroup),
789
+ spaceBetween: o(e.mobileSpaceBetween)
790
+ };
791
+ }
792
+ g && !R && (f.simulateTouch = !1), D && (f.initialSlide = D);
793
+ const I = new m.Swiper(n, f);
794
+ g == null || g(I);
795
+ };
796
+ if (m.Swiper)
797
+ W();
798
+ else {
799
+ const { head: f } = document, I = Array.isArray(A) ? [...A] : [A], _ = Array.isArray(C) ? [...C] : [C], v = (S) => {
800
+ if (S.length) {
801
+ const y = document.createElement("link");
802
+ y.href = S.shift(), y.rel = "stylesheet", f.appendChild(y), v(S);
803
+ }
804
+ }, P = (S) => {
805
+ if (S.length) {
806
+ const y = document.createElement("script");
807
+ y.src = S.shift(), y.onerror = y.onload = P.bind(null, S), f.appendChild(y);
808
+ } else
809
+ W();
810
+ };
811
+ v(_), P(I);
812
+ }
813
+ }, d = (e = 0) => ({
814
+ type: M,
815
+ style: { padding: "50px" },
816
+ components: { type: "text", components: { type: "textnode", content: `Slide ${e}` } }
817
+ }), b = a.getType("default").model;
818
+ return a.addType(h, {
819
+ block: i && {
820
+ label: j,
821
+ media: p.slider,
822
+ category: "Extra",
823
+ select: !0,
824
+ ...l.block
825
+ },
826
+ isComponent: (e) => w(e, F),
827
+ model: {
828
+ defaults: () => ({
829
+ name: j,
830
+ icon: p.slider,
831
+ classes: F,
832
+ draggable: (e, n) => !n.is(h),
833
+ components: [
834
+ {
835
+ type: T,
836
+ components: [d(1), d(2), d(3)]
837
+ },
838
+ { type: L }
839
+ ],
840
+ script: u,
841
+ cdnScript: l.cdnScript,
842
+ cdnStyle: l.cdnStyle,
843
+ "script-props": ["cdnScript", "cdnStyle", ...r.propKeys],
844
+ ...r.props,
845
+ traits: [...r.traits]
846
+ }),
847
+ init() {
848
+ const { em: e } = this;
849
+ ue(this, r.traits), be(this, r.propKeys), this.listenTo(e, `run:${c}`, this.onPreviewOn), this.listenTo(e, `stop:${c}`, this.onPreviewOff);
850
+ },
851
+ onPreviewOn() {
852
+ this.__inPreview = !0, this.reloadSlider();
853
+ },
854
+ onPreviewOff() {
855
+ this.__inPreview = !1, this.reloadSlider();
856
+ },
857
+ reloadSlider() {
858
+ this.trigger("rerender");
859
+ },
860
+ addSlide() {
861
+ const e = this.findFirstType(T);
862
+ e == null || e.append(this.getNewSlideComponentDef());
863
+ },
864
+ getNewSlideComponentDef() {
865
+ var n;
866
+ const e = ((n = this.findFirstType(T)) == null ? void 0 : n.components().length) || 0;
867
+ return {
868
+ type: M,
869
+ components: { type: "text", components: { type: "textnode", content: `Slide ${e + 1}` } }
870
+ };
871
+ },
872
+ toJSON(...e) {
873
+ const n = b.prototype.toJSON.apply(this, e);
874
+ return r.propsNoValues.forEach((m) => delete n[m]), delete n["script-props"], n;
875
+ }
876
+ },
877
+ view: {
878
+ init() {
879
+ const e = a.events.scriptUnmount;
880
+ e && this.listenTo(this.model, e, this.destroySwiper);
881
+ },
882
+ getSwiper() {
883
+ return this.el.swiper;
884
+ },
885
+ destroySwiper() {
886
+ var e;
887
+ (e = this.getSwiper()) == null || e.destroy();
888
+ },
889
+ onRender() {
890
+ const e = this.el;
891
+ e.__onLoad = (n) => n.on("slideChange", () => this.__activeSlide = n.activeIndex), e.__activeSlide = this.__activeSlide, e.__inPreview = this.model.__inPreview;
892
+ }
893
+ }
894
+ }), () => {
895
+ a.removeType(h), s.remove(h);
896
+ };
897
+ }, ve = "Nav Prev", me = "Nav Next", O = `${k}button-prev`, B = `${k}button-next`, ge = (t) => {
898
+ const { Components: l } = t, a = (s) => ({
899
+ type: "svg",
900
+ selectable: !1,
901
+ hoverable: !1,
902
+ attributes: { viewBox: "0 0 27 44" },
903
+ components: {
904
+ type: "svg-in",
905
+ tagName: "path",
906
+ attributes: { d: s, fill: "currentColor" }
907
+ }
908
+ });
909
+ return l.addType(x, {
910
+ isComponent: (s) => w(s, O),
911
+ model: {
912
+ defaults: {
913
+ name: ve,
914
+ classes: O,
915
+ copyable: !1,
916
+ highlightable: !1,
917
+ droppable: !1,
918
+ draggable: !1,
919
+ selectable: !1,
920
+ hoverable: !1,
921
+ layerable: !1,
922
+ components: a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),
923
+ styles: `
924
+ .${O} {
925
+ color: inherit;
926
+ }
927
+ .${O}:after {
928
+ content: none;
929
+ }
930
+ `
931
+ }
932
+ }
933
+ }), l.addType(V, {
934
+ extend: x,
935
+ isComponent: (s) => w(s, B),
936
+ model: {
937
+ defaults: {
938
+ name: me,
939
+ classes: B,
940
+ components: a("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),
941
+ styles: `
942
+ .${B} {
943
+ color: inherit;
944
+ }
945
+ .${B}:after {
946
+ content: none;
947
+ }
948
+ `
949
+ }
950
+ }
951
+ }), () => {
952
+ l.removeType(x), l.removeType(V);
953
+ };
954
+ }, ye = (t) => {
955
+ const { Components: l } = t, a = `${k}pagination`;
956
+ return l.addType(L, {
957
+ isComponent: (s) => w(s, a),
958
+ model: {
959
+ defaults: {
960
+ name: "Pagination",
961
+ classes: a,
962
+ copyable: !1,
963
+ highlightable: !1,
964
+ droppable: !1,
965
+ draggable: !1,
966
+ selectable: !1,
967
+ hoverable: !1,
968
+ layerable: !1,
969
+ styles: `
970
+ .${a}-bullet-active {
971
+ background-color: currentColor;
972
+ }
973
+ .${a}-progressbar-fill {
974
+ --swiper-pagination-color: currentColor;
975
+ }
976
+ `
977
+ }
978
+ }
979
+ }), () => {
980
+ l.removeType(L);
981
+ };
982
+ }, Se = "Scrollbar", K = `${k}scrollbar`, we = (t) => {
983
+ const { Components: l } = t;
984
+ return l.addType(N, {
985
+ isComponent: (a) => w(a, K),
986
+ model: {
987
+ defaults: {
988
+ name: Se,
989
+ classes: K,
990
+ copyable: !1,
991
+ highlightable: !1,
992
+ removable: !1,
993
+ selectable: !1,
994
+ hoverable: !1,
995
+ layerable: !1,
996
+ droppable: !1,
997
+ draggable: !1
998
+ }
999
+ }
1000
+ }), () => {
1001
+ l.removeType(N);
1002
+ };
1003
+ }, Pe = "Slide", Z = `${k}slide`, Ee = (t) => {
1004
+ const { Components: l } = t;
1005
+ return l.addType(M, {
1006
+ isComponent: (a) => w(a, Z),
1007
+ model: {
1008
+ defaults: {
1009
+ name: Pe,
1010
+ classes: Z,
1011
+ icon: p.slider,
1012
+ draggable: (a, s) => s.is(T)
1013
+ }
1014
+ // TODO VIEW slide to this slide when selected
1015
+ }
1016
+ }), () => {
1017
+ l.removeType(M);
1018
+ };
1019
+ }, Te = "Wrapper", Y = `${k}wrapper`, xe = (t) => {
1020
+ const { Components: l } = t, { events: a } = l;
1021
+ return l.addType(T, {
1022
+ isComponent: (s) => w(s, Y),
1023
+ model: {
1024
+ defaults: {
1025
+ name: Te,
1026
+ icon: p.slider,
1027
+ classes: Y,
1028
+ copyable: !1,
1029
+ removable: !1,
1030
+ draggable: !1,
1031
+ highlightable: !1,
1032
+ droppable: (s) => s.is(M)
1033
+ },
1034
+ init() {
1035
+ const s = this.components();
1036
+ this.listenTo(s, "add remove", this.updateSlider);
1037
+ },
1038
+ updateSlider(s) {
1039
+ const i = this.closestType(h);
1040
+ if (i) {
1041
+ const r = i.getView();
1042
+ i.reloadSlider();
1043
+ const c = a.scriptMount;
1044
+ c && this.em.once(c, () => {
1045
+ setTimeout(() => {
1046
+ var u;
1047
+ return (u = r.getSwiper()) == null ? void 0 : u.slideTo(s.index());
1048
+ }, 100);
1049
+ });
1050
+ }
1051
+ }
1052
+ }
1053
+ }), () => {
1054
+ l.removeType(T);
1055
+ };
1056
+ }, Le = "swiperComponent", ke = function(t, l = {}) {
1057
+ const a = {
1058
+ block: {},
1059
+ cdnScript: "https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",
1060
+ cdnStyle: "https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",
1061
+ ...l
1062
+ }, s = [
1063
+ he(t, a),
1064
+ ge(t),
1065
+ xe(t),
1066
+ Ee(t),
1067
+ ye(t),
1068
+ we(t)
1069
+ ];
1070
+ ce({
1071
+ editor: t,
1072
+ plan: E.startup,
1073
+ licenseKey: a.licenseKey,
1074
+ pluginName: Le,
1075
+ cleanup: () => {
1076
+ s.forEach((i) => i());
1077
+ }
1078
+ });
1079
+ }, Ce = re(ke);
1080
+ export {
1081
+ Ce as default
1082
+ };