@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33
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 +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- 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 +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const se = "app.grapesjs.com", re = "app-stage.grapesjs.com", ue = "app2.grapesjs.com", he = "app-stage2.grapesjs.com", Y = [
|
|
2
|
+
se,
|
|
3
3
|
ue,
|
|
4
4
|
re,
|
|
5
5
|
he,
|
|
@@ -11,146 +11,151 @@ const ie = "app.grapesjs.com", re = "app-stage.grapesjs.com", ue = "app2.grapesj
|
|
|
11
11
|
// For stackblitz.com demos
|
|
12
12
|
"-sandpack.codesandbox.io"
|
|
13
13
|
// For Sandpack demos
|
|
14
|
-
], ge = "license:check:start", be = "license:check:end", me = () => typeof window < "u", de = ({
|
|
14
|
+
], ge = "license:check:start", be = "license:check:end", me = () => typeof window < "u", de = ({
|
|
15
|
+
isDev: e,
|
|
16
|
+
isStage: n,
|
|
17
|
+
isPlatform: t
|
|
18
|
+
}) => `${e ? "" : `https://${n ? re : se}`}/${t ? "platform-api" : "api"}`, ye = () => {
|
|
15
19
|
const e = me() && window.location.hostname;
|
|
16
|
-
return !!e && (Y.includes(e) || Y.some((
|
|
20
|
+
return !!e && (Y.includes(e) || Y.some((n) => e.endsWith(n)));
|
|
17
21
|
};
|
|
18
22
|
async function ve({
|
|
19
23
|
path: e,
|
|
20
|
-
baseApiUrl:
|
|
21
|
-
method:
|
|
22
|
-
headers:
|
|
23
|
-
params:
|
|
24
|
+
baseApiUrl: n,
|
|
25
|
+
method: t = "GET",
|
|
26
|
+
headers: l = {},
|
|
27
|
+
params: o,
|
|
24
28
|
body: u
|
|
25
29
|
}) {
|
|
26
|
-
const p = `${
|
|
27
|
-
method:
|
|
30
|
+
const p = `${n || de({ isDev: !1, isStage: !1 })}${e}`, h = {
|
|
31
|
+
method: t,
|
|
28
32
|
headers: {
|
|
29
33
|
"Content-Type": "application/json",
|
|
30
|
-
...
|
|
34
|
+
...l
|
|
31
35
|
}
|
|
32
36
|
};
|
|
33
37
|
u && (h.body = JSON.stringify(u));
|
|
34
|
-
const c =
|
|
35
|
-
if (!
|
|
36
|
-
throw new Error(`HTTP error! status: ${
|
|
37
|
-
return
|
|
38
|
+
const c = o ? new URLSearchParams(o).toString() : "", b = c ? `?${c}` : "", s = await fetch(`${p}${b}`, h);
|
|
39
|
+
if (!s.ok)
|
|
40
|
+
throw new Error(`HTTP error! status: ${s.status}`);
|
|
41
|
+
return s.json();
|
|
38
42
|
}
|
|
39
|
-
var
|
|
43
|
+
var G = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(G || {});
|
|
40
44
|
const ee = {
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
[
|
|
45
|
+
[G.free]: 0,
|
|
46
|
+
[G.startup]: 10,
|
|
47
|
+
[G.business]: 20,
|
|
48
|
+
[G.enterprise]: 30
|
|
45
49
|
};
|
|
46
50
|
function fe(e) {
|
|
47
|
-
const
|
|
48
|
-
return
|
|
51
|
+
const n = e;
|
|
52
|
+
return n.init = (t) => (l) => e(l, t), n;
|
|
49
53
|
}
|
|
50
54
|
const Te = (e) => /* @__PURE__ */ fe(e);
|
|
51
55
|
async function we({
|
|
52
56
|
editor: e,
|
|
53
|
-
plan:
|
|
54
|
-
pluginName:
|
|
55
|
-
licenseKey:
|
|
56
|
-
|
|
57
|
+
plan: n,
|
|
58
|
+
pluginName: t,
|
|
59
|
+
licenseKey: l,
|
|
60
|
+
onLicenseCheckResponse: o,
|
|
61
|
+
cleanup: u
|
|
57
62
|
}) {
|
|
58
|
-
let
|
|
59
|
-
const
|
|
60
|
-
console.warn("Cleanup plugin:",
|
|
61
|
-
},
|
|
62
|
-
var
|
|
63
|
-
const { error:
|
|
64
|
-
if (!(
|
|
65
|
-
|
|
63
|
+
let r = "", p = !1;
|
|
64
|
+
const h = ye(), c = (s) => {
|
|
65
|
+
console.warn("Cleanup plugin:", t, "Reason:", s), u();
|
|
66
|
+
}, b = (s = {}) => {
|
|
67
|
+
var k;
|
|
68
|
+
const { error: P, sdkLicense: V } = s, T = (k = s.plan) == null ? void 0 : k.category;
|
|
69
|
+
if (!(V || s.license) || P)
|
|
70
|
+
c(P || "Invalid license");
|
|
66
71
|
else if (T) {
|
|
67
|
-
const
|
|
68
|
-
|
|
72
|
+
const O = ee[n], $ = ee[T];
|
|
73
|
+
O > $ && c({ pluginRequiredPlan: n, licensePlan: T });
|
|
69
74
|
}
|
|
70
75
|
};
|
|
71
|
-
e.on(ge, (
|
|
72
|
-
|
|
73
|
-
}), e.on(be, (
|
|
74
|
-
|
|
76
|
+
e.on(ge, (s) => {
|
|
77
|
+
r = s == null ? void 0 : s.baseApiUrl, p = !0;
|
|
78
|
+
}), e.on(be, (s) => {
|
|
79
|
+
o == null || o(s), b(s);
|
|
75
80
|
}), setTimeout(async () => {
|
|
76
|
-
if (!
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
+
if (!p) {
|
|
82
|
+
if (h) return;
|
|
83
|
+
if (l) {
|
|
84
|
+
const s = await Se({ licenseKey: l, pluginName: t, baseApiUrl: r });
|
|
85
|
+
o == null || o(s), s && b(s);
|
|
81
86
|
} else
|
|
82
|
-
|
|
87
|
+
c("The `licenseKey` option not provided");
|
|
83
88
|
}
|
|
84
89
|
}, 2e3);
|
|
85
90
|
}
|
|
86
91
|
async function Se(e) {
|
|
87
|
-
const { licenseKey:
|
|
92
|
+
const { licenseKey: n, pluginName: t, baseApiUrl: l } = e;
|
|
88
93
|
try {
|
|
89
94
|
return (await ve({
|
|
90
|
-
baseApiUrl:
|
|
91
|
-
path: `/sdk/${
|
|
95
|
+
baseApiUrl: l,
|
|
96
|
+
path: `/sdk/${n || "na"}`,
|
|
92
97
|
method: "POST",
|
|
93
98
|
params: {
|
|
94
99
|
d: window.location.hostname,
|
|
95
|
-
pn:
|
|
100
|
+
pn: t
|
|
96
101
|
}
|
|
97
102
|
})).result || {};
|
|
98
|
-
} catch (
|
|
99
|
-
return console.error("Error during SDK license check:",
|
|
103
|
+
} catch (o) {
|
|
104
|
+
return console.error("Error during SDK license check:", o), !1;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
102
|
-
const
|
|
103
|
-
var
|
|
104
|
-
return !!((
|
|
105
|
-
}, xe = "lightGalleryComponent", Ie =
|
|
106
|
-
var
|
|
107
|
-
const I = "lightGallery", te = `${I}-item`,
|
|
107
|
+
const B = (e, n) => {
|
|
108
|
+
var t;
|
|
109
|
+
return !!((t = e == null ? void 0 : e.hasAttribute) != null && t.call(e, n));
|
|
110
|
+
}, xe = "lightGalleryComponent", Ie = G.startup;
|
|
111
|
+
var E = /* @__PURE__ */ ((e) => (e.image = "image", e.video = "video", e.external = "external", e))(E || {});
|
|
112
|
+
const I = "lightGallery", te = `${I}-item`, U = "data-lightgallery", ae = `${U}-item`, j = "toggle", A = {
|
|
108
113
|
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>',
|
|
109
114
|
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>',
|
|
110
115
|
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>',
|
|
111
116
|
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>',
|
|
112
117
|
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>',
|
|
113
118
|
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>'
|
|
114
|
-
},
|
|
115
|
-
var
|
|
116
|
-
const
|
|
119
|
+
}, W = { propKeys: [], props: {}, traits: [] }, _ = (e, n = {}) => {
|
|
120
|
+
var o;
|
|
121
|
+
const t = {}, l = [];
|
|
117
122
|
for (const u in e) {
|
|
118
123
|
const { value: r, ...p } = e[u];
|
|
119
|
-
|
|
124
|
+
l.push({ id: u, name: u, changeProp: !0, category: n.category, ...p }), t[u] = r;
|
|
120
125
|
const { subTraits: h = {} } = p;
|
|
121
126
|
for (const c in p.subTraits)
|
|
122
|
-
(
|
|
123
|
-
const
|
|
124
|
-
|
|
127
|
+
(o = h[c]) == null || o.forEach((b) => {
|
|
128
|
+
const s = b.id || b.name;
|
|
129
|
+
t[s] = b.value;
|
|
125
130
|
});
|
|
126
131
|
}
|
|
127
132
|
return {
|
|
128
|
-
propKeys: Object.keys(
|
|
129
|
-
props:
|
|
130
|
-
traits:
|
|
133
|
+
propKeys: Object.keys(t),
|
|
134
|
+
props: t,
|
|
135
|
+
traits: l
|
|
131
136
|
};
|
|
132
|
-
},
|
|
133
|
-
const
|
|
137
|
+
}, F = (e, n) => {
|
|
138
|
+
const t = e.getTrait(n), l = t.get("category"), o = t.get("subTraits") || {}, r = (Object.values(o).flat() || []).map((c) => c.id || c.name);
|
|
134
139
|
e.removeTrait(r);
|
|
135
|
-
const p =
|
|
140
|
+
const p = o[t.getValue()], h = e.getTraitIndex(n) + 1;
|
|
136
141
|
p && e.addTrait(
|
|
137
|
-
p.map((c) => ({ category:
|
|
142
|
+
p.map((c) => ({ category: l, ...c })),
|
|
138
143
|
{ at: h }
|
|
139
144
|
);
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
if (!
|
|
144
|
-
const
|
|
145
|
-
e.on(
|
|
145
|
+
}, Z = (e, n) => {
|
|
146
|
+
n.forEach((t) => {
|
|
147
|
+
const l = e.getTrait(t);
|
|
148
|
+
if (!l || !l.get("subTraits")) return;
|
|
149
|
+
const o = l.changeProp ? `change:${t}` : `change:attributes:${t}`;
|
|
150
|
+
e.on(o, () => F(e, t)), F(e, t);
|
|
146
151
|
});
|
|
147
|
-
},
|
|
148
|
-
const
|
|
152
|
+
}, Ae = (e, n, t) => {
|
|
153
|
+
const o = e.getTrait(n).get("subTraits") || {}, r = (Object.values(o).flat() || []).map((h) => {
|
|
149
154
|
const c = h.name || h.id;
|
|
150
155
|
return h.changeProp ? `change:${c}` : `change:attributes:${c}`;
|
|
151
156
|
}), p = Array.from(new Set(r));
|
|
152
|
-
p.length && e.on(p.join(" "),
|
|
153
|
-
},
|
|
157
|
+
p.length && e.on(p.join(" "), t);
|
|
158
|
+
}, Pe = {
|
|
154
159
|
// startAnimationDuration: {
|
|
155
160
|
// type: 'number',
|
|
156
161
|
// label: 'Start duration',
|
|
@@ -159,12 +164,12 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
159
164
|
// step: 50,
|
|
160
165
|
// min: 0
|
|
161
166
|
// },
|
|
162
|
-
[
|
|
167
|
+
[j]: {
|
|
163
168
|
type: "button",
|
|
164
169
|
label: "Toggle Gallery",
|
|
165
|
-
command: (e,
|
|
166
|
-
var
|
|
167
|
-
return (
|
|
170
|
+
command: (e, n) => {
|
|
171
|
+
var t, l;
|
|
172
|
+
return (l = (t = n.target) == null ? void 0 : t.getView()) == null ? void 0 : l.toggleGallery();
|
|
168
173
|
}
|
|
169
174
|
},
|
|
170
175
|
speed: {
|
|
@@ -264,7 +269,7 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
264
269
|
visible: ({ component: e }) => !!e.getTrait("closable").getValue(),
|
|
265
270
|
value: !0
|
|
266
271
|
}
|
|
267
|
-
},
|
|
272
|
+
}, ke = {
|
|
268
273
|
thumbnail: {
|
|
269
274
|
category: { id: "thumbnail-options", label: "Thumbnail Options" },
|
|
270
275
|
type: "checkbox",
|
|
@@ -366,7 +371,7 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
366
371
|
]
|
|
367
372
|
}
|
|
368
373
|
}
|
|
369
|
-
},
|
|
374
|
+
}, Le = {
|
|
370
375
|
autoplay: {
|
|
371
376
|
category: { id: "autoplay-options", label: "Autoplay options" },
|
|
372
377
|
type: "checkbox",
|
|
@@ -472,19 +477,19 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
472
477
|
]
|
|
473
478
|
}
|
|
474
479
|
}
|
|
475
|
-
}, f = "sourceType",
|
|
480
|
+
}, f = "sourceType", K = "data-iframe", q = {
|
|
476
481
|
name: "href",
|
|
477
482
|
type: "file",
|
|
478
483
|
label: "Image Source"
|
|
479
|
-
},
|
|
484
|
+
}, H = {
|
|
480
485
|
name: "data-src",
|
|
481
486
|
label: "Video Source",
|
|
482
487
|
placeholder: "https://www.youtube.com/watch?v=..."
|
|
483
|
-
},
|
|
488
|
+
}, J = {
|
|
484
489
|
name: "data-poster",
|
|
485
490
|
label: "Video Poster",
|
|
486
491
|
type: "file"
|
|
487
|
-
},
|
|
492
|
+
}, le = {
|
|
488
493
|
name: "data-src",
|
|
489
494
|
label: "External Source",
|
|
490
495
|
placeholder: "https://some-external-source.com/...."
|
|
@@ -494,15 +499,15 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
494
499
|
placeholder: "My caption",
|
|
495
500
|
changeProp: !1
|
|
496
501
|
}, Ge = {
|
|
497
|
-
[
|
|
502
|
+
[j]: {
|
|
498
503
|
type: "button",
|
|
499
504
|
label: "Toggle Gallery",
|
|
500
|
-
command: (e,
|
|
501
|
-
var
|
|
502
|
-
const
|
|
503
|
-
if (
|
|
504
|
-
const r = ((u =
|
|
505
|
-
p >= 0 &&
|
|
505
|
+
command: (e, n) => {
|
|
506
|
+
var o, u;
|
|
507
|
+
const t = n.target, l = (o = t == null ? void 0 : t.closestType(I)) == null ? void 0 : o.getView();
|
|
508
|
+
if (l && t) {
|
|
509
|
+
const r = ((u = l.getLightGallery()) == null ? void 0 : u.items) || [], p = Array.from(r).indexOf(t.getEl());
|
|
510
|
+
p >= 0 && l.toggleGallery(p);
|
|
506
511
|
}
|
|
507
512
|
}
|
|
508
513
|
},
|
|
@@ -512,26 +517,26 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
512
517
|
labelToTitle: !0,
|
|
513
518
|
value: "image",
|
|
514
519
|
subTraits: {
|
|
515
|
-
image: [
|
|
516
|
-
video: [
|
|
517
|
-
external: [
|
|
520
|
+
image: [q],
|
|
521
|
+
video: [H, J],
|
|
522
|
+
external: [le]
|
|
518
523
|
},
|
|
519
524
|
options: [
|
|
520
|
-
{ id: "image", label:
|
|
521
|
-
{ id: "video", label:
|
|
522
|
-
{ id: "external", label:
|
|
525
|
+
{ id: "image", label: q.label || "", icon: A.image },
|
|
526
|
+
{ id: "video", label: H.label || "", icon: A.video },
|
|
527
|
+
{ id: "external", label: le.label || "", icon: A.external }
|
|
523
528
|
]
|
|
524
529
|
},
|
|
525
530
|
subHtml: ce
|
|
526
531
|
// This unfortuntaly breaks other thumbnails
|
|
527
532
|
// customThumb: traitCustomThumb
|
|
528
|
-
},
|
|
529
|
-
const { Blocks:
|
|
530
|
-
toolbarIconOpen:
|
|
533
|
+
}, ne = "lgThumbnail", Ve = "lgVideo", oe = "lgAutoplay", ie = "lgZoom", L = "https://cdn.jsdelivr.net/npm/lightgallery@2.8.2", Oe = function(e, n = {}) {
|
|
534
|
+
const { Blocks: t, Components: l } = e, o = "LightGallery", u = "LightGallery Item", r = {
|
|
535
|
+
toolbarIconOpen: A.eye,
|
|
531
536
|
block: {},
|
|
532
537
|
lgLicenseKey: "92DE1DB8-7986-4F02-B908-514F97678D28",
|
|
533
538
|
defaultSrc: "https://placehold.co/200/777/white.png?text=Image",
|
|
534
|
-
plugins: [
|
|
539
|
+
plugins: [ne, Ve, oe, ie],
|
|
535
540
|
cdnScript: [
|
|
536
541
|
`${L}/lightgallery.min.js`,
|
|
537
542
|
`${L}/plugins/thumbnail/lg-thumbnail.min.js`,
|
|
@@ -540,10 +545,10 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
540
545
|
`${L}/plugins/zoom/lg-zoom.min.js`
|
|
541
546
|
],
|
|
542
547
|
cdnStyle: `${L}/css/lightgallery-bundle.min.css`,
|
|
543
|
-
...
|
|
544
|
-
}, { block: p, toolbarIconOpen: h, defaultSrc: c } = r,
|
|
545
|
-
const
|
|
546
|
-
var
|
|
548
|
+
...n
|
|
549
|
+
}, { block: p, toolbarIconOpen: h, defaultSrc: c } = r, b = function(a) {
|
|
550
|
+
const i = this, g = window, { plugins: d, cdnScript: w, cdnStyle: C, inline: R, lgLicenseKey: pe, ...y } = a || {}, S = (m) => isNaN(m) ? void 0 : parseInt(m, 10), Q = () => {
|
|
551
|
+
var D;
|
|
547
552
|
const m = {
|
|
548
553
|
...y,
|
|
549
554
|
licenseKey: pe,
|
|
@@ -554,19 +559,19 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
554
559
|
slideShowInterval: S(y.slideShowInterval),
|
|
555
560
|
scale: S(y.scale),
|
|
556
561
|
enableZoomAfter: S(y.enableZoomAfter),
|
|
557
|
-
plugins: (d || []).map((
|
|
562
|
+
plugins: (d || []).map((N) => g[N])
|
|
558
563
|
};
|
|
559
|
-
|
|
560
|
-
const
|
|
561
|
-
|
|
564
|
+
R && (m.container = i, m.closable = !1);
|
|
565
|
+
const z = (D = g.lightGallery) == null ? void 0 : D.call(g, i, m);
|
|
566
|
+
R && z.openGallery();
|
|
562
567
|
};
|
|
563
568
|
if (g.lightGallery)
|
|
564
569
|
Q();
|
|
565
570
|
else {
|
|
566
|
-
const { head: m } = document,
|
|
571
|
+
const { head: m } = document, z = Array.isArray(w) ? [...w] : [w], D = Array.isArray(C) ? [...C] : [C], N = (x) => {
|
|
567
572
|
if (x.length) {
|
|
568
573
|
const v = document.createElement("link");
|
|
569
|
-
v.href = x.shift(), v.rel = "stylesheet", m.appendChild(v),
|
|
574
|
+
v.href = x.shift(), v.rel = "stylesheet", m.appendChild(v), N(x);
|
|
570
575
|
}
|
|
571
576
|
}, X = (x) => {
|
|
572
577
|
if (x.length) {
|
|
@@ -575,38 +580,38 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
575
580
|
} else
|
|
576
581
|
Q();
|
|
577
582
|
};
|
|
578
|
-
D
|
|
583
|
+
N(D), X(z);
|
|
579
584
|
}
|
|
580
|
-
},
|
|
581
|
-
const
|
|
582
|
-
if (!h || !
|
|
583
|
-
const { toolbar: g } =
|
|
584
|
-
id:
|
|
585
|
+
}, s = (a) => {
|
|
586
|
+
const i = a.getTrait(j);
|
|
587
|
+
if (!h || !i) return;
|
|
588
|
+
const { toolbar: g } = a, d = {
|
|
589
|
+
id: j,
|
|
585
590
|
label: h,
|
|
586
|
-
command: () => setTimeout(() =>
|
|
591
|
+
command: () => setTimeout(() => i.runCommand(), 100)
|
|
587
592
|
};
|
|
588
|
-
!g.find((
|
|
593
|
+
!g.find((C) => C.id === d.id) && (g == null || g.unshift(d));
|
|
589
594
|
};
|
|
590
|
-
let
|
|
591
|
-
const
|
|
592
|
-
|
|
595
|
+
let P = [];
|
|
596
|
+
const V = r.plugins || [], T = _(Pe), M = V.includes(ne) ? _(ke) : W, k = V.includes(oe) ? _(Le) : W, O = V.includes(ie) ? _(Ee) : W;
|
|
597
|
+
l.addType(I, {
|
|
593
598
|
block: p && {
|
|
594
|
-
label:
|
|
595
|
-
media:
|
|
599
|
+
label: o,
|
|
600
|
+
media: A.gallery,
|
|
596
601
|
category: "Extra",
|
|
597
602
|
select: !0,
|
|
598
603
|
...r.block
|
|
599
604
|
},
|
|
600
|
-
isComponent: (
|
|
605
|
+
isComponent: (a) => B(a, U),
|
|
601
606
|
extendFn: ["init", "initToolbar"],
|
|
602
607
|
model: {
|
|
603
608
|
defaults: {
|
|
604
|
-
name:
|
|
605
|
-
icon:
|
|
606
|
-
draggable: (
|
|
607
|
-
attributes: { [
|
|
609
|
+
name: o,
|
|
610
|
+
icon: A.gallery,
|
|
611
|
+
draggable: (a, i) => !i.is(I),
|
|
612
|
+
attributes: { [U]: !0 },
|
|
608
613
|
components: { type: te },
|
|
609
|
-
script:
|
|
614
|
+
script: b,
|
|
610
615
|
selector: "",
|
|
611
616
|
exThumbImage: "",
|
|
612
617
|
cdnScript: r.cdnScript,
|
|
@@ -620,22 +625,22 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
620
625
|
"plugins",
|
|
621
626
|
"selector",
|
|
622
627
|
"exThumbImage",
|
|
628
|
+
...T.propKeys,
|
|
623
629
|
...M.propKeys,
|
|
624
|
-
...
|
|
625
|
-
...
|
|
626
|
-
...V.propKeys
|
|
630
|
+
...k.propKeys,
|
|
631
|
+
...O.propKeys
|
|
627
632
|
],
|
|
633
|
+
...T.props,
|
|
628
634
|
...M.props,
|
|
629
|
-
...
|
|
630
|
-
...
|
|
631
|
-
...
|
|
632
|
-
traits: [...M.traits, ...A.traits, ...C.traits, ...V.traits]
|
|
635
|
+
...k.props,
|
|
636
|
+
...O.props,
|
|
637
|
+
traits: [...T.traits, ...M.traits, ...k.traits, ...O.traits]
|
|
633
638
|
},
|
|
634
639
|
init() {
|
|
635
|
-
|
|
640
|
+
Z(this, ["thumbnail"]), Z(this, ["autoplay"]), Z(this, ["zoom"]);
|
|
636
641
|
},
|
|
637
642
|
initToolbar() {
|
|
638
|
-
|
|
643
|
+
s(this);
|
|
639
644
|
}
|
|
640
645
|
},
|
|
641
646
|
extendFnView: ["init"],
|
|
@@ -647,86 +652,86 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
647
652
|
lgAfterClose: "onLgClose"
|
|
648
653
|
}),
|
|
649
654
|
init() {
|
|
650
|
-
this.listenTo(this.model,
|
|
655
|
+
this.listenTo(this.model, l.events.scriptUnmount, this.destroyLightGallery);
|
|
651
656
|
},
|
|
652
657
|
getLightGallery() {
|
|
653
658
|
return this.el.__lg;
|
|
654
659
|
},
|
|
655
660
|
destroyLightGallery() {
|
|
656
|
-
const
|
|
657
|
-
|
|
661
|
+
const a = this.getLightGallery();
|
|
662
|
+
a == null || a.destroy();
|
|
658
663
|
},
|
|
659
664
|
disableLgInCanvas() {
|
|
660
|
-
const
|
|
661
|
-
|
|
665
|
+
const a = this.getLightGallery();
|
|
666
|
+
a.lgOpened = !0;
|
|
662
667
|
},
|
|
663
668
|
isInlineGallery() {
|
|
664
|
-
var
|
|
665
|
-
const
|
|
666
|
-
return ((
|
|
669
|
+
var i;
|
|
670
|
+
const a = this.getLightGallery();
|
|
671
|
+
return ((i = a == null ? void 0 : a.settings) == null ? void 0 : i.container) === this.el;
|
|
667
672
|
},
|
|
668
|
-
onLgInit(
|
|
669
|
-
this.el.__lg =
|
|
673
|
+
onLgInit(a) {
|
|
674
|
+
this.el.__lg = a.detail.instance, !this.isInlineGallery() && this.disableLgInCanvas();
|
|
670
675
|
},
|
|
671
676
|
onLgOpen() {
|
|
672
|
-
const { em:
|
|
673
|
-
|
|
677
|
+
const { em: a } = this, { Canvas: i } = a, g = this.getLightGallery();
|
|
678
|
+
P = i.getSpots(), setTimeout(() => i.removeSpots()), g.__lgOpened = !0;
|
|
674
679
|
},
|
|
675
680
|
onLgClose() {
|
|
676
|
-
const
|
|
677
|
-
|
|
681
|
+
const a = this.getLightGallery();
|
|
682
|
+
P.forEach((i) => this.em.Canvas.addSpot(i.attributes)), P = [], a.__lgOpened = !1, setTimeout(() => this.disableLgInCanvas());
|
|
678
683
|
},
|
|
679
|
-
toggleGallery(
|
|
680
|
-
const
|
|
681
|
-
if (
|
|
682
|
-
|
|
684
|
+
toggleGallery(a) {
|
|
685
|
+
const i = this.getLightGallery();
|
|
686
|
+
if (i.__lgOpened) return i.closeGallery(!0);
|
|
687
|
+
i.lgOpened = !1, i.openGallery(a);
|
|
683
688
|
}
|
|
684
689
|
}
|
|
685
690
|
});
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
isComponent: (
|
|
691
|
+
const $ = _(Ge);
|
|
692
|
+
l.addType(te, {
|
|
693
|
+
isComponent: (a) => B(a, ae) || a.tagName === "A" && B(a.parentElement, U),
|
|
689
694
|
extendFn: ["init", "initToolbar"],
|
|
690
695
|
model: {
|
|
691
696
|
defaults: {
|
|
692
697
|
tagName: "a",
|
|
693
698
|
name: u,
|
|
694
|
-
icon:
|
|
699
|
+
icon: A.galleryItem,
|
|
695
700
|
attributes: { [ae]: !0, href: c },
|
|
696
701
|
components: { type: "image", attributes: { alt: "Image", src: c } },
|
|
697
|
-
|
|
698
|
-
traits: [
|
|
702
|
+
...$.props,
|
|
703
|
+
traits: [...$.traits]
|
|
699
704
|
},
|
|
700
705
|
init() {
|
|
701
|
-
const
|
|
702
|
-
this.initSourceType(), this.on(
|
|
706
|
+
const a = [f].map((i) => `change:${i}`).join(" ");
|
|
707
|
+
this.initSourceType(), this.on(a, this.updateTraits), this.updateTraits({ init: !0 }), this.initScriptUpdate(), Ae(this, f, this.triggerGalleryUpdate);
|
|
703
708
|
},
|
|
704
709
|
initToolbar() {
|
|
705
|
-
|
|
710
|
+
s(this);
|
|
706
711
|
},
|
|
707
712
|
initScriptUpdate() {
|
|
708
|
-
const
|
|
709
|
-
this.on(
|
|
713
|
+
const a = [ce.name].map((i) => `change:attributes:${i}`).join(" ");
|
|
714
|
+
this.on(a, this.triggerGalleryUpdate);
|
|
710
715
|
},
|
|
711
|
-
triggerGalleryUpdate(...
|
|
712
|
-
var
|
|
713
|
-
(
|
|
716
|
+
triggerGalleryUpdate(...a) {
|
|
717
|
+
var i;
|
|
718
|
+
(i = this.closestType(I)) == null || i.__scriptPropsChange(...a);
|
|
714
719
|
},
|
|
715
|
-
updateTraits(
|
|
716
|
-
const { changed:
|
|
717
|
-
if (
|
|
718
|
-
|
|
720
|
+
updateTraits(a = {}) {
|
|
721
|
+
const { changed: i } = this, { init: g } = a;
|
|
722
|
+
if (i[f] || g) {
|
|
723
|
+
F(this, f);
|
|
719
724
|
const d = this.getTrait(f).getValue();
|
|
720
|
-
if (d ===
|
|
721
|
-
this.removeAttributes([
|
|
722
|
-
const w = this.getTrait(
|
|
725
|
+
if (d === E.image) {
|
|
726
|
+
this.removeAttributes([H.name, J.name, K]);
|
|
727
|
+
const w = this.getTrait(q.name);
|
|
723
728
|
w.setValue(w.getValue() || c);
|
|
724
|
-
} else d ===
|
|
729
|
+
} else d === E.video ? this.removeAttributes([K]) : d === E.external && this.addAttributes({ [K]: !0 });
|
|
725
730
|
}
|
|
726
731
|
},
|
|
727
732
|
initSourceType() {
|
|
728
|
-
const
|
|
729
|
-
|
|
733
|
+
const a = this.getAttributes({ noClass: !0, noStyle: !0 });
|
|
734
|
+
a[K] ? this.set(f, E.external) : (a[H.name] || a[J.name]) && this.set(f, E.video);
|
|
730
735
|
}
|
|
731
736
|
}
|
|
732
737
|
}), we({
|
|
@@ -735,10 +740,10 @@ const I = "lightGallery", te = `${I}-item`, K = "data-lightgallery", ae = `${K}-
|
|
|
735
740
|
licenseKey: r.licenseKey,
|
|
736
741
|
pluginName: xe,
|
|
737
742
|
cleanup: () => {
|
|
738
|
-
|
|
743
|
+
t.remove(I), l.removeType(I);
|
|
739
744
|
}
|
|
740
745
|
});
|
|
741
|
-
},
|
|
746
|
+
}, Ce = Te(Oe);
|
|
742
747
|
export {
|
|
743
|
-
|
|
748
|
+
Ce as default
|
|
744
749
|
};
|