@redot-src/glare 1.4.0 → 1.4.1
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/glare.css +1 -1
- package/dist/glare.esm.js +122 -122
- package/dist/glare.esm.js.map +1 -1
- package/dist/glare.js +2 -2
- package/dist/glare.js.map +1 -1
- package/package.json +1 -1
package/dist/glare.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const lt = {
|
|
2
2
|
CLOSE: "Close",
|
|
3
3
|
NEXT: "Next",
|
|
4
4
|
PREV: "Previous",
|
|
@@ -17,20 +17,20 @@ const at = {
|
|
|
17
17
|
ZOOM: "Zoom",
|
|
18
18
|
ZOOM_OUT: "Zoom out"
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function vt(e) {
|
|
21
21
|
const t = e.lang ?? "en";
|
|
22
|
-
return { ...
|
|
22
|
+
return { ...lt, ...e.i18n?.en, ...e.i18n?.[t] };
|
|
23
23
|
}
|
|
24
24
|
function x(e, t) {
|
|
25
25
|
return e.replace(/\{\{(\w+)\}\}/g, (s, i) => t[i] ?? "");
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function wt(e) {
|
|
28
28
|
return Object.entries(e).map(([t, s]) => `${encodeURIComponent(t)}=${encodeURIComponent(String(s))}`).join("&");
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Et(e, t) {
|
|
31
31
|
return e.replace(/\$(\d+)/g, (s, i) => t[Number(i)] ?? "");
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const Tt = {
|
|
34
34
|
youtube: {
|
|
35
35
|
matcher: /(?:youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/\w\/|embed\/|shorts\/)?([\w-]{11})/i,
|
|
36
36
|
type: "embed",
|
|
@@ -60,14 +60,14 @@ const Et = {
|
|
|
60
60
|
};
|
|
61
61
|
function q(e, t, s) {
|
|
62
62
|
if (typeof e == "function") return e(t, s);
|
|
63
|
-
if (typeof e == "string") return
|
|
63
|
+
if (typeof e == "string") return Et(e, t);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function St(e, t) {
|
|
66
66
|
for (const s of Object.values(t ?? {})) {
|
|
67
67
|
const i = e.match(s.matcher);
|
|
68
68
|
if (!i) continue;
|
|
69
69
|
let n = q(s.url, i, e) ?? e;
|
|
70
|
-
return s.params && (n += (n.includes("?") ? "&" : "?") +
|
|
70
|
+
return s.params && (n += (n.includes("?") ? "&" : "?") + wt(s.params)), {
|
|
71
71
|
src: n,
|
|
72
72
|
type: s.type ?? "iframe",
|
|
73
73
|
thumb: q(s.thumb, i, e)
|
|
@@ -96,7 +96,7 @@ const d = (e) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fi
|
|
|
96
96
|
thumbAjax: d('<path d="M20 15a4 4 0 0 0-3-3.87A6 6 0 1 0 6 14"/><path d="m9 16 3 3 3-3M12 12v7"/>'),
|
|
97
97
|
thumbHtml: d('<path d="m8 9-3 3 3 3M16 9l3 3-3 3M14 5l-4 14"/>'),
|
|
98
98
|
thumbSlide: d('<path d="M6 3h9l4 4v14H6Z"/><path d="M14 3v5h5M9 13h7M9 17h5"/>')
|
|
99
|
-
}, w = (e, t, s, i = "") => `<button type="button" class="glare-button glare-button--${e}" data-glare-${e} title="{{${t}}}" aria-label="{{${t}}}"${i}>${s}</button>`,
|
|
99
|
+
}, w = (e, t, s, i = "") => `<button type="button" class="glare-button glare-button--${e}" data-glare-${e} title="{{${t}}}" aria-label="{{${t}}}"${i}>${s}</button>`, Lt = `
|
|
100
100
|
<div class="glare-container" role="dialog" aria-modal="true" tabindex="-1">
|
|
101
101
|
<div class="glare-bg"></div>
|
|
102
102
|
<div class="glare-progress" hidden></div>
|
|
@@ -120,14 +120,14 @@ const d = (e) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fi
|
|
|
120
120
|
close: w("close", "CLOSE", c.close),
|
|
121
121
|
download: `<a class="glare-button glare-button--download" data-glare-download download target="_blank" rel="noopener" title="{{DOWNLOAD}}" aria-label="{{DOWNLOAD}}">${c.download}</a>`,
|
|
122
122
|
smallBtn: `<button type="button" class="glare-button glare-close-small" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${c.close}</button>`
|
|
123
|
-
},
|
|
123
|
+
}, Ct = '<div class="glare-spinner" role="status" aria-label="{{LOADING}}"></div>', $t = '<div class="glare-error"><p>{{ERROR}}</p></div>', It = '<video class="glare-video" controls playsinline controlsList="nodownload" poster="{{poster}}"><source src="{{src}}" type="{{format}}"/>{{VIDEO_UNSUPPORTED}}</video>', Ot = '<iframe class="glare-iframe"></iframe>', ct = {
|
|
124
124
|
autoStart: !1,
|
|
125
125
|
axis: "x",
|
|
126
126
|
fit: "cover"
|
|
127
127
|
}, N = {
|
|
128
128
|
autoStart: !1,
|
|
129
129
|
speed: 3e3
|
|
130
|
-
},
|
|
130
|
+
}, ht = {
|
|
131
131
|
autoStart: !1
|
|
132
132
|
}, R = {
|
|
133
133
|
closeExisting: !1,
|
|
@@ -169,38 +169,38 @@ const d = (e) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fi
|
|
|
169
169
|
dblclickSlide: (e) => e.type === "image" ? "zoom" : !1
|
|
170
170
|
},
|
|
171
171
|
image: { preload: !1 },
|
|
172
|
-
video: { tpl:
|
|
172
|
+
video: { tpl: It, format: "", autoStart: !0 },
|
|
173
173
|
iframe: {
|
|
174
174
|
preload: !0,
|
|
175
175
|
css: {},
|
|
176
176
|
attr: { allowfullscreen: "true", allow: "autoplay; fullscreen; picture-in-picture" },
|
|
177
|
-
tpl:
|
|
177
|
+
tpl: Ot
|
|
178
178
|
},
|
|
179
179
|
ajax: { settings: { headers: { "X-Requested-With": "XMLHttpRequest" } } },
|
|
180
|
-
media:
|
|
180
|
+
media: Tt,
|
|
181
181
|
hash: !0,
|
|
182
182
|
slideshow: N,
|
|
183
|
-
thumbs:
|
|
184
|
-
fullscreen:
|
|
183
|
+
thumbs: ct,
|
|
184
|
+
fullscreen: ht,
|
|
185
185
|
lang: "en",
|
|
186
|
-
i18n: { en:
|
|
187
|
-
baseTpl:
|
|
186
|
+
i18n: { en: lt },
|
|
187
|
+
baseTpl: Lt,
|
|
188
188
|
btnTpl: Mt,
|
|
189
|
-
spinnerTpl:
|
|
190
|
-
errorTpl:
|
|
191
|
-
},
|
|
192
|
-
function
|
|
193
|
-
return e ?
|
|
189
|
+
spinnerTpl: Ct,
|
|
190
|
+
errorTpl: $t
|
|
191
|
+
}, At = /\.(avif|bmp|gif|jpe?g|png|svg|webp|ico)(\?.*)?$/i, Dt = /\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i, kt = /\.pdf(\?.*)?$/i, Rt = /^(#[\w-]+|\.[\w-]+)$/;
|
|
192
|
+
function Ft(e, t = "image") {
|
|
193
|
+
return e ? Rt.test(e) ? "inline" : At.test(e) ? "image" : Dt.test(e) ? "video" : kt.test(e) ? "iframe" : t : "html";
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function Ht(e) {
|
|
196
196
|
const t = e.match(/\.(\w+)(?:\?|$)/)?.[1]?.toLowerCase();
|
|
197
197
|
return t ? `video/${t === "ogv" ? "ogg" : t}` : "video/mp4";
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function ut(e, t, s) {
|
|
200
200
|
const i = typeof e == "string" ? { src: e } : { ...e };
|
|
201
201
|
let n = i.src ?? "", o = i.type, r = i.thumb;
|
|
202
|
-
const a = n ?
|
|
203
|
-
return a && (n = a.src ?? n, o ??= a.type, r ??= a.thumb), o || (o = i.html || i.content ? "html" :
|
|
202
|
+
const a = n ? St(n, s.media) : null;
|
|
203
|
+
return a && (n = a.src ?? n, o ??= a.type, r ??= a.thumb), o || (o = i.html || i.content ? "html" : Ft(n, s.defaultType)), {
|
|
204
204
|
...i,
|
|
205
205
|
index: t,
|
|
206
206
|
src: n,
|
|
@@ -212,10 +212,10 @@ function ht(e, t, s) {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
const p = (e, t) => e.getAttribute(t) || void 0;
|
|
215
|
-
function
|
|
215
|
+
function Pt(e, t) {
|
|
216
216
|
return e.map((s, i) => {
|
|
217
217
|
const n = s.querySelector("img"), o = p(s, "data-caption") ?? p(s, "title") ?? "";
|
|
218
|
-
return
|
|
218
|
+
return ut(
|
|
219
219
|
{
|
|
220
220
|
src: p(s, "data-src") ?? p(s, "href") ?? "",
|
|
221
221
|
type: p(s, "data-type"),
|
|
@@ -235,8 +235,8 @@ function Ht(e, t) {
|
|
|
235
235
|
);
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
|
-
function
|
|
239
|
-
return e.length && e[0].nodeType === 1 ?
|
|
238
|
+
function zt(e, t) {
|
|
239
|
+
return e.length && e[0].nodeType === 1 ? Pt(e, t) : e.map((s, i) => ut(s, i, t));
|
|
240
240
|
}
|
|
241
241
|
function h(e, t = document) {
|
|
242
242
|
return t.querySelector(e);
|
|
@@ -248,13 +248,13 @@ function m(e, t = "", s = "") {
|
|
|
248
248
|
const i = document.createElement(e);
|
|
249
249
|
return t && (i.className = t), s && (i.innerHTML = s), i;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function _t(e) {
|
|
252
252
|
return m("div", "", e.trim()).firstElementChild;
|
|
253
253
|
}
|
|
254
254
|
function Z(e) {
|
|
255
255
|
return /[<&]/.test(e) ? new DOMParser().parseFromString(e, "text/html").body.textContent?.trim() ?? "" : e.trim();
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function dt(e, t = document) {
|
|
258
258
|
return e ? typeof e != "string" ? e : h(e, t) ?? h(e) : null;
|
|
259
259
|
}
|
|
260
260
|
function W(e) {
|
|
@@ -263,10 +263,10 @@ function W(e) {
|
|
|
263
263
|
function f(e, t, s, i) {
|
|
264
264
|
return e.addEventListener(t, s, i), () => e.removeEventListener(t, s, i);
|
|
265
265
|
}
|
|
266
|
-
function
|
|
266
|
+
function ft(e) {
|
|
267
267
|
requestAnimationFrame(() => requestAnimationFrame(e));
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Nt(e, t, s) {
|
|
270
270
|
let i = !1;
|
|
271
271
|
const n = () => {
|
|
272
272
|
i || (i = !0, clearTimeout(r), e.removeEventListener("transitionend", o), s());
|
|
@@ -276,13 +276,13 @@ function _t(e, t, s) {
|
|
|
276
276
|
e.addEventListener("transitionend", o);
|
|
277
277
|
const r = setTimeout(n, t + 50);
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function Zt() {
|
|
280
280
|
return navigator.maxTouchPoints > 0 && window.matchMedia("(pointer: coarse)").matches;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function pt() {
|
|
283
283
|
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function mt() {
|
|
286
286
|
const e = document;
|
|
287
287
|
return !!(e.fullscreenEnabled ?? e.webkitFullscreenEnabled);
|
|
288
288
|
}
|
|
@@ -296,8 +296,8 @@ function V(e) {
|
|
|
296
296
|
t.classList.remove(U), t.style.marginRight = "";
|
|
297
297
|
}
|
|
298
298
|
const T = "glare-hidden";
|
|
299
|
-
function
|
|
300
|
-
const n =
|
|
299
|
+
function jt(e, t, s, i) {
|
|
300
|
+
const n = _t(x(e.baseTpl, t));
|
|
301
301
|
n.dataset.glareId = String(s), e.baseClass && n.classList.add(e.baseClass), e.modal && n.classList.add("glare-is-modal");
|
|
302
302
|
const o = h(".glare-stage", n);
|
|
303
303
|
if (!o) throw new Error("baseTpl must contain a .glare-stage element");
|
|
@@ -311,9 +311,9 @@ function Zt(e, t, s, i) {
|
|
|
311
311
|
infobar: h(".glare-infobar", n),
|
|
312
312
|
navigation: h(".glare-navigation", n)
|
|
313
313
|
}, a = i < 2;
|
|
314
|
-
return r.navigation?.classList.toggle(T, !e.arrows || a), r.infobar?.classList.toggle(T, !e.infobar || a), r.toolbar &&
|
|
314
|
+
return r.navigation?.classList.toggle(T, !e.arrows || a), r.infobar?.classList.toggle(T, !e.infobar || a), r.toolbar && Bt(r.toolbar, e, t, a), r;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function Bt(e, t, s, i) {
|
|
317
317
|
if (t.toolbar === !1) {
|
|
318
318
|
e.classList.add(T);
|
|
319
319
|
return;
|
|
@@ -322,10 +322,10 @@ function jt(e, t, s, i) {
|
|
|
322
322
|
n.id = `glare-toolbar-menu-${e.closest(".glare-container")?.dataset.glareId ?? ""}`;
|
|
323
323
|
for (const o of t.buttons) {
|
|
324
324
|
if (typeof o != "string") {
|
|
325
|
-
n.appendChild(
|
|
325
|
+
n.appendChild(qt(o));
|
|
326
326
|
continue;
|
|
327
327
|
}
|
|
328
|
-
if (i && (o === "thumbs" || o === "slideshow") || o === "fullscreen" && !
|
|
328
|
+
if (i && (o === "thumbs" || o === "slideshow") || o === "fullscreen" && !mt() || o === "more" || o === "close") continue;
|
|
329
329
|
const r = t.btnTpl[o];
|
|
330
330
|
r && n.insertAdjacentHTML("beforeend", x(r, s));
|
|
331
331
|
}
|
|
@@ -339,23 +339,23 @@ function jt(e, t, s, i) {
|
|
|
339
339
|
o && e.insertAdjacentHTML("beforeend", x(o, s));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function qt({ name: e, label: t, icon: s }) {
|
|
343
343
|
const i = m("button", `glare-button glare-button--${e}`, s);
|
|
344
344
|
return i.type = "button", i.title = t, i.dataset.glareCustom = e, i.setAttribute("aria-label", t), i;
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function Wt(e, t) {
|
|
347
347
|
let s = 0;
|
|
348
348
|
for (let i = e; i instanceof HTMLElement && i !== t; i = i.offsetParent)
|
|
349
349
|
s += i.offsetTop;
|
|
350
350
|
return s;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function Ut({ container: e, caption: t }) {
|
|
353
353
|
let s = null;
|
|
354
354
|
const i = () => {
|
|
355
355
|
if (!t) return;
|
|
356
356
|
e.style.setProperty("--glare-caption-inset", `${t.offsetHeight}px`);
|
|
357
357
|
const o = s && h(".glare-content", s);
|
|
358
|
-
o && Object.assign(t.style, { top: `${
|
|
358
|
+
o && Object.assign(t.style, { top: `${Wt(o, t.offsetParent) + o.offsetHeight}px`, bottom: "auto" });
|
|
359
359
|
}, n = new ResizeObserver(i);
|
|
360
360
|
return t && n.observe(t), i(), {
|
|
361
361
|
follow(o) {
|
|
@@ -368,16 +368,16 @@ function Wt({ container: e, caption: t }) {
|
|
|
368
368
|
destroy: () => n.disconnect()
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function Vt(e, t, s) {
|
|
372
372
|
const i = m("div", `glare-slide glare-slide--${t.type}`);
|
|
373
373
|
s.slideClass && i.classList.add(s.slideClass);
|
|
374
374
|
const n = m("div", "glare-content");
|
|
375
375
|
return i.appendChild(n), e.appendChild(i), t.$slide = i, t.$content = n, i;
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function Xt(e, t, s) {
|
|
378
378
|
e.style.setProperty("--glare-direction", String(s)), e.classList.add(t ? "glare-slide--opening" : "glare-slide--in"), t && (e.style.transition = "none"), e.offsetWidth, e.classList.add("glare-slide--current"), t && (e.offsetWidth, e.style.transition = "");
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function X(e, t, s, i) {
|
|
381
381
|
for (const n of I(".glare-slide", e))
|
|
382
382
|
n !== t && (n.classList.contains("glare-slide--out") || n.style.setProperty("--glare-direction", String(i)), n.classList.remove("glare-slide--current", "glare-slide--in", "glare-slide--opening"), n.classList.add("glare-slide--out"), setTimeout(() => n.remove(), s));
|
|
383
383
|
}
|
|
@@ -393,11 +393,11 @@ function Kt(e) {
|
|
|
393
393
|
function Qt(e, t, s, i) {
|
|
394
394
|
e.hasError = !0, e.error = t, e.$content && (e.$content.className = "glare-content glare-content--error", e.$content.innerHTML = x(s.errorTpl, i));
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function gt(e, t) {
|
|
397
397
|
return typeof e.toolbar == "boolean" ? e.toolbar : t.type === "image";
|
|
398
398
|
}
|
|
399
399
|
function Jt(e, t) {
|
|
400
|
-
return typeof e.smallBtn == "boolean" ? e.smallBtn : !
|
|
400
|
+
return typeof e.smallBtn == "boolean" ? e.smallBtn : !gt(e, t);
|
|
401
401
|
}
|
|
402
402
|
function te(e, t, s, i, n, o) {
|
|
403
403
|
const { container: r, toolbar: a, infobar: l } = e;
|
|
@@ -406,7 +406,7 @@ function te(e, t, s, i, n, o) {
|
|
|
406
406
|
function ee(e, t, s) {
|
|
407
407
|
if (t.toolbar === !1) return;
|
|
408
408
|
e.classList.remove("glare-toolbar--expanded"), e.querySelector("[data-glare-more]")?.setAttribute("aria-expanded", "false");
|
|
409
|
-
const i =
|
|
409
|
+
const i = gt(t, s);
|
|
410
410
|
if (e.classList.toggle(T, !i), !i) return;
|
|
411
411
|
const n = s.type === "image";
|
|
412
412
|
h("[data-glare-zoom]", e)?.classList.toggle(T, !n);
|
|
@@ -426,9 +426,9 @@ function ne(e, t) {
|
|
|
426
426
|
}
|
|
427
427
|
function oe(e, t, s, i) {
|
|
428
428
|
const n = !t.loop && s === 0, o = !t.loop && s === i - 1;
|
|
429
|
-
|
|
429
|
+
G(h("[data-glare-prev]", e), n), G(h("[data-glare-next]", e), o);
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function G(e, t) {
|
|
432
432
|
e && (e.classList.toggle("glare-is-disabled", t), e.setAttribute("aria-disabled", String(t)));
|
|
433
433
|
}
|
|
434
434
|
function re(e, t, s, i) {
|
|
@@ -489,7 +489,7 @@ class ce {
|
|
|
489
489
|
);
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function Y(e) {
|
|
493
493
|
if (typeof e != "object" || e === null) return !1;
|
|
494
494
|
const t = Object.getPrototypeOf(e);
|
|
495
495
|
return t === null || Object.getPrototypeOf(t) === null;
|
|
@@ -501,7 +501,7 @@ function F(...e) {
|
|
|
501
501
|
for (const [i, n] of Object.entries(s)) {
|
|
502
502
|
if (n === void 0) continue;
|
|
503
503
|
const o = t[i];
|
|
504
|
-
t[i] =
|
|
504
|
+
t[i] = Y(n) ? F(Y(o) ? o : {}, n) : n;
|
|
505
505
|
}
|
|
506
506
|
return t;
|
|
507
507
|
}
|
|
@@ -555,7 +555,7 @@ class ue {
|
|
|
555
555
|
return { x: E(t, -o, o), y: E(s, -r, r) };
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
const de = 6,
|
|
558
|
+
const de = 6, K = 120, fe = 100, pe = 0.5, me = 80, ge = 0.4, be = "a, button, input, textarea, select, video, .glare-thumbs", Q = (e, t) => Math.hypot(e.x - t.x, e.y - t.y), J = (e, t) => ({ x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }), O = (e) => ({ x: e.clientX, y: e.clientY });
|
|
559
559
|
class ye {
|
|
560
560
|
constructor(t, s) {
|
|
561
561
|
this.stage = t, this.host = s, this.pointers = /* @__PURE__ */ new Map(), this.mode = "idle", this.moved = !1, this.start = [], this.startTime = 0, this.startZoom = { scale: 1, x: 0, y: 0 }, this.startMid = { x: 0, y: 0 }, this.startDistance = 0, this.offs = [
|
|
@@ -586,7 +586,7 @@ class ye {
|
|
|
586
586
|
begin() {
|
|
587
587
|
this.mode === "swipe" && this.releaseStage();
|
|
588
588
|
const t = [...this.pointers.values()];
|
|
589
|
-
this.start = t, this.startTime = performance.now(), this.startZoom = this.host.zoom.state, this.mode = t.length >= 2 ? "pinch" : "idle", t.length >= 2 && (this.startDistance =
|
|
589
|
+
this.start = t, this.startTime = performance.now(), this.startZoom = this.host.zoom.state, this.mode = t.length >= 2 ? "pinch" : "idle", t.length >= 2 && (this.startDistance = Q(t[0], t[1]), this.startMid = J(t[0], t[1]));
|
|
590
590
|
}
|
|
591
591
|
move(t) {
|
|
592
592
|
const s = [...this.pointers.values()];
|
|
@@ -608,8 +608,8 @@ class ye {
|
|
|
608
608
|
}
|
|
609
609
|
/** Scales around the pinch midpoint so the content under the fingers stays put. */
|
|
610
610
|
pinch(t, s) {
|
|
611
|
-
const { zoom: i } = this.host, n =
|
|
612
|
-
this.startZoom.scale *
|
|
611
|
+
const { zoom: i } = this.host, n = J(t, s), o = i.center() ?? n, r = E(
|
|
612
|
+
this.startZoom.scale * Q(t, s) / (this.startDistance || 1),
|
|
613
613
|
S,
|
|
614
614
|
H
|
|
615
615
|
), a = (this.startMid.x - o.x - this.startZoom.x) / this.startZoom.scale, l = (this.startMid.y - o.y - this.startZoom.y) / this.startZoom.scale;
|
|
@@ -622,7 +622,7 @@ class ye {
|
|
|
622
622
|
this.releaseStage(), this.finishSwipe(i, n, o);
|
|
623
623
|
else if (this.mode === "pan" && this.host.touch.momentum !== !1) {
|
|
624
624
|
const { zoom: r } = this.host;
|
|
625
|
-
r.apply(r.scale, r.x + o.x *
|
|
625
|
+
r.apply(r.scale, r.x + o.x * K, r.y + o.y * K, 250);
|
|
626
626
|
}
|
|
627
627
|
this.mode = "idle", this.start = [], this.moved && setTimeout(() => this.moved = !1, 0);
|
|
628
628
|
}
|
|
@@ -651,18 +651,18 @@ function P(e = window.location.hash) {
|
|
|
651
651
|
const t = e.replace(/^#/, "").match(xe);
|
|
652
652
|
return t ? { gallery: t[1], index: Math.max(0, parseInt(t[2], 10) - 1) } : null;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function tt(e, t) {
|
|
655
655
|
return `${e}-${t + 1}`;
|
|
656
656
|
}
|
|
657
657
|
class ve {
|
|
658
658
|
constructor(t, s) {
|
|
659
659
|
this.glare = t, this.gallery = s, this.pushed = !1, this.off = f(window, "hashchange", () => this.onHashChange());
|
|
660
|
-
const i =
|
|
661
|
-
|
|
660
|
+
const i = tt(s, t.currIndex);
|
|
661
|
+
et() !== i && (window.history.pushState(null, "", `#${i}`), this.pushed = !0);
|
|
662
662
|
}
|
|
663
663
|
update(t = this.glare.currIndex) {
|
|
664
|
-
const s =
|
|
665
|
-
|
|
664
|
+
const s = tt(this.gallery, t);
|
|
665
|
+
et() !== s && this.replace(`#${s}`);
|
|
666
666
|
}
|
|
667
667
|
destroy() {
|
|
668
668
|
this.off(), P()?.gallery === this.gallery && (this.pushed ? window.history.back() : this.replace(""));
|
|
@@ -676,7 +676,7 @@ class ve {
|
|
|
676
676
|
window.history.replaceState(null, "", `${s}${i}${t}`);
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
const
|
|
679
|
+
const et = () => window.location.hash.replace(/^#/, "");
|
|
680
680
|
class we {
|
|
681
681
|
constructor(t, s, i) {
|
|
682
682
|
this.glare = t, this.container = s, this.opts = i, this.timer = null, this.active = !1, this.bar = h(".glare-progress", s), this.button = h("[data-glare-slideshow]", s), i.autoStart && this.start();
|
|
@@ -706,7 +706,7 @@ class we {
|
|
|
706
706
|
return !this.glare.opts.loop && this.glare.currIndex === this.glare.group.length - 1;
|
|
707
707
|
}
|
|
708
708
|
schedule() {
|
|
709
|
-
this.clearTimer(), this.setProgress(0),
|
|
709
|
+
this.clearTimer(), this.setProgress(0), pt() || (this.bar?.offsetWidth, this.setProgress(1)), this.timer = setTimeout(() => this.atEnd ? this.stop() : this.glare.next(), this.speed);
|
|
710
710
|
}
|
|
711
711
|
clearTimer() {
|
|
712
712
|
this.timer && clearTimeout(this.timer), this.timer = null;
|
|
@@ -737,7 +737,7 @@ const Ee = {
|
|
|
737
737
|
function Te(e) {
|
|
738
738
|
return e.thumb || (e.type === "video" ? e.poster : "") || (e.type === "image" ? e.src : "");
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function st(e, t) {
|
|
741
741
|
e.classList.add("glare-thumbs-item--placeholder"), e.innerHTML = Ee[t] ?? c.thumbSlide;
|
|
742
742
|
}
|
|
743
743
|
class Se {
|
|
@@ -777,15 +777,15 @@ class Se {
|
|
|
777
777
|
const r = Te(n);
|
|
778
778
|
if (r) {
|
|
779
779
|
const a = m("img");
|
|
780
|
-
a.src = r, a.alt = n.alt || Z(n.caption), a.loading = "lazy", a.onerror = () =>
|
|
780
|
+
a.src = r, a.alt = n.alt || Z(n.caption), a.loading = "lazy", a.onerror = () => st(o, n.type), o.appendChild(a);
|
|
781
781
|
} else
|
|
782
|
-
|
|
782
|
+
st(o, n.type);
|
|
783
783
|
this.list.appendChild(o), this.offs.push(f(o, "click", () => this.glare.jumpTo(n.index)));
|
|
784
784
|
}
|
|
785
|
-
(
|
|
785
|
+
(dt(this.opts.parentEl, this.container) ?? this.container).appendChild(this.strip), this.opts.autoStart && this.show(), this.focus();
|
|
786
786
|
}
|
|
787
787
|
}
|
|
788
|
-
const
|
|
788
|
+
const Le = 40, Me = 150, Ce = 16;
|
|
789
789
|
class $e {
|
|
790
790
|
constructor(t, s) {
|
|
791
791
|
this.distance = 0, this.fired = !1, this.settle = null, this.off = f(
|
|
@@ -793,7 +793,7 @@ class $e {
|
|
|
793
793
|
"wheel",
|
|
794
794
|
(i) => {
|
|
795
795
|
const n = s.current();
|
|
796
|
-
!n || i.deltaY === 0 || s.mode === "auto" && n.type !== "image" || n.type === "image" && s.isZoomed() || (i.preventDefault(), this.restartSettle(), !this.fired && (this.distance += Ie(i, t), !(Math.abs(this.distance) <
|
|
796
|
+
!n || i.deltaY === 0 || s.mode === "auto" && n.type !== "image" || n.type === "image" && s.isZoomed() || (i.preventDefault(), this.restartSettle(), !this.fired && (this.distance += Ie(i, t), !(Math.abs(this.distance) < Le) && (this.fired = !0, this.distance > 0 ? s.next() : s.prev())));
|
|
797
797
|
},
|
|
798
798
|
{ passive: !1 }
|
|
799
799
|
);
|
|
@@ -804,14 +804,14 @@ class $e {
|
|
|
804
804
|
restartSettle() {
|
|
805
805
|
this.settle && clearTimeout(this.settle), this.settle = setTimeout(() => {
|
|
806
806
|
this.distance = 0, this.fired = !1;
|
|
807
|
-
},
|
|
807
|
+
}, Me);
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
function Ie(e, t) {
|
|
811
811
|
return e.deltaMode === WheelEvent.DOM_DELTA_LINE ? e.deltaY * Ce : e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? e.deltaY * t.clientHeight : e.deltaY;
|
|
812
812
|
}
|
|
813
813
|
function $(e) {
|
|
814
|
-
const t =
|
|
814
|
+
const t = pt(), s = t || !e.animationEffect ? 0 : Math.max(0, e.animationDuration), i = t || !e.transitionEffect ? 0 : Math.max(0, e.transitionDuration);
|
|
815
815
|
return {
|
|
816
816
|
animationEffect: s ? e.animationEffect : !1,
|
|
817
817
|
animationDuration: s,
|
|
@@ -826,14 +826,14 @@ function Oe(e, t) {
|
|
|
826
826
|
function Ae(e, t) {
|
|
827
827
|
e.dataset.transition = $(t).transitionEffect || "none";
|
|
828
828
|
}
|
|
829
|
-
const De = /^(top|center|bottom)-(left|center|right)$/,
|
|
829
|
+
const De = /^(top|center|bottom)-(left|center|right)$/, it = { top: 0, left: 0, center: 0.5, bottom: 1, right: 1 };
|
|
830
830
|
function ke(e, t, s) {
|
|
831
831
|
const i = typeof s == "string" ? De.exec(s) : null;
|
|
832
832
|
if (i) {
|
|
833
|
-
const u = e.getBoundingClientRect(), g = u.left + u.width *
|
|
834
|
-
return new DOMRect(g,
|
|
833
|
+
const u = e.getBoundingClientRect(), g = u.left + u.width * it[i[2]], L = u.top + u.height * it[i[1]];
|
|
834
|
+
return new DOMRect(g, L, 0, 0);
|
|
835
835
|
}
|
|
836
|
-
const n = (u) => u?.getClientRects().length ? u : null, o = s !== "trigger" && n(
|
|
836
|
+
const n = (u) => u?.getClientRects().length ? u : null, o = s !== "trigger" && n(dt(s)) || n(t.$trigger);
|
|
837
837
|
if (!o) return null;
|
|
838
838
|
const r = o.getBoundingClientRect(), l = (o.ownerDocument === e.ownerDocument ? null : o.ownerDocument.defaultView?.frameElement)?.getBoundingClientRect();
|
|
839
839
|
return l ? new DOMRect(r.x + l.x, r.y + l.y, r.width, r.height) : r;
|
|
@@ -848,13 +848,13 @@ function Re(e, t, s) {
|
|
|
848
848
|
transform: `translate3d(${a}px, ${l}px, 0) scale(${r})`,
|
|
849
849
|
opacity: s.zoomOpacity ? "0.2" : "1",
|
|
850
850
|
transitionDuration: "0ms"
|
|
851
|
-
}),
|
|
851
|
+
}), ft(() => {
|
|
852
852
|
Object.assign(i.style, { transform: "", opacity: "", transitionDuration: "" });
|
|
853
853
|
});
|
|
854
854
|
}
|
|
855
|
-
function
|
|
855
|
+
function bt(e) {
|
|
856
856
|
const t = F(R, e);
|
|
857
|
-
return
|
|
857
|
+
return Zt() && t.mobile ? F(t, t.mobile) : t;
|
|
858
858
|
}
|
|
859
859
|
function A(e, t) {
|
|
860
860
|
return e ? e === !0 ? { ...t } : { ...t, ...e } : null;
|
|
@@ -879,7 +879,7 @@ function He(e, t, s) {
|
|
|
879
879
|
a >= 0 && C.splice(a, 1);
|
|
880
880
|
}
|
|
881
881
|
};
|
|
882
|
-
return C.push(r),
|
|
882
|
+
return C.push(r), bt(t).hash && ze(i, n), r;
|
|
883
883
|
}
|
|
884
884
|
function Pe() {
|
|
885
885
|
for (const e of [...C]) e.destroy();
|
|
@@ -939,21 +939,21 @@ function Ue(e, t, s) {
|
|
|
939
939
|
if (e.consumeGesture()) return;
|
|
940
940
|
const a = r.target, l = a.closest("[data-glare-more]");
|
|
941
941
|
if (l) {
|
|
942
|
-
const
|
|
943
|
-
|
|
942
|
+
const M = l.closest(".glare-toolbar"), B = !M?.classList.contains("glare-toolbar--expanded");
|
|
943
|
+
M?.classList.toggle("glare-toolbar--expanded", B), l.setAttribute("aria-expanded", String(B));
|
|
944
944
|
return;
|
|
945
945
|
}
|
|
946
|
-
|
|
946
|
+
xt(t);
|
|
947
947
|
const u = a.closest("[data-glare-custom]");
|
|
948
948
|
if (u) return Ve(e, u.dataset.glareCustom, r);
|
|
949
|
-
const g = Ne.find(([
|
|
949
|
+
const g = Ne.find(([M]) => a.closest(M));
|
|
950
950
|
if (g) return g[1](e);
|
|
951
951
|
if (a.closest(".glare-button")) return;
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
954
|
-
if (!
|
|
955
|
-
return k(e,
|
|
956
|
-
n(), i = setTimeout(() => k(e,
|
|
952
|
+
const L = D(e, a, "click");
|
|
953
|
+
if (L) {
|
|
954
|
+
if (!yt(e, D(e, a, "dblclick"), r))
|
|
955
|
+
return k(e, L, r);
|
|
956
|
+
n(), i = setTimeout(() => k(e, L, r), We);
|
|
957
957
|
}
|
|
958
958
|
}),
|
|
959
959
|
f(t, "dblclick", (r) => {
|
|
@@ -986,11 +986,11 @@ function D(e, t, s) {
|
|
|
986
986
|
if (!(i.modal || !t.closest(je)))
|
|
987
987
|
return s === "click" ? i.clickSlide : i.dblclickSlide;
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function yt(e, t, s) {
|
|
990
990
|
return !t || !e.current ? !1 : typeof t == "function" ? t(e.current, s) : t;
|
|
991
991
|
}
|
|
992
992
|
function k(e, t, s) {
|
|
993
|
-
switch (
|
|
993
|
+
switch (yt(e, t, s)) {
|
|
994
994
|
case "close":
|
|
995
995
|
return e.close();
|
|
996
996
|
case "next":
|
|
@@ -1007,7 +1007,7 @@ function k(e, t, s) {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
function Xe(e, t) {
|
|
1009
1009
|
if (b.top() !== e) return;
|
|
1010
|
-
if (t.key === "Escape" &&
|
|
1010
|
+
if (t.key === "Escape" && xt(e.$refs?.container ?? null)) {
|
|
1011
1011
|
t.preventDefault();
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
@@ -1030,7 +1030,7 @@ function Xe(e, t) {
|
|
|
1030
1030
|
return e.fullscreen?.toggle();
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function xt(e) {
|
|
1034
1034
|
const t = e?.querySelector(".glare-toolbar--expanded");
|
|
1035
1035
|
return t ? (t.classList.remove("glare-toolbar--expanded"), t.querySelector("[data-glare-more]")?.setAttribute("aria-expanded", "false"), !0) : !1;
|
|
1036
1036
|
}
|
|
@@ -1043,33 +1043,33 @@ function Ge(e, t) {
|
|
|
1043
1043
|
const i = s[0], n = s[s.length - 1];
|
|
1044
1044
|
t.shiftKey && document.activeElement === i ? (t.preventDefault(), n.focus()) : !t.shiftKey && document.activeElement === n && (t.preventDefault(), i.focus());
|
|
1045
1045
|
}
|
|
1046
|
-
const Ye = 1200,
|
|
1046
|
+
const Ye = 1200, nt = 16 / 9;
|
|
1047
1047
|
function Ke(e, t, s) {
|
|
1048
1048
|
if (t && s) return t / s;
|
|
1049
|
-
const i = String(e.ratio ||
|
|
1050
|
-
return r > 0 && a > 0 ? r / a :
|
|
1049
|
+
const i = String(e.ratio || nt).replace(":", "/"), [n, o = "1"] = i.split("/").map((l) => l.trim()), r = parseFloat(n), a = parseFloat(o);
|
|
1050
|
+
return r > 0 && a > 0 ? r / a : nt;
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function ot(e, t, s) {
|
|
1053
1053
|
if (!e) return 0;
|
|
1054
1054
|
if (typeof e == "number") return e;
|
|
1055
1055
|
const i = e.trim(), n = parseFloat(i);
|
|
1056
1056
|
return n > 0 ? i.endsWith("%") ? t * n / 100 : i.endsWith("vw") || i.endsWith("vh") ? s * n / 100 : n : 0;
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function rt(e, t) {
|
|
1059
1059
|
const s = t.parentElement;
|
|
1060
1060
|
if (!s) return;
|
|
1061
1061
|
const i = getComputedStyle(s), n = s.clientWidth - parseFloat(i.paddingLeft) - parseFloat(i.paddingRight), o = s.clientHeight - parseFloat(i.paddingTop) - parseFloat(i.paddingBottom);
|
|
1062
1062
|
if (!(n > 0 && o > 0)) return;
|
|
1063
1063
|
const r = e.width !== void 0 && e.height !== void 0;
|
|
1064
|
-
let a = r ?
|
|
1064
|
+
let a = r ? ot(e.width, n, innerWidth) : n, l = r ? ot(e.height, o, innerHeight) : o;
|
|
1065
1065
|
const u = Ke(e, r ? a : void 0, r ? l : void 0), g = Math.min(1, n / a, o / l);
|
|
1066
1066
|
a *= g, l *= g, l > a / u ? l = a / u : a > l * u && (a = l * u), t.style.width = `${a}px`, t.style.height = `${l}px`, t.style.aspectRatio = String(u);
|
|
1067
1067
|
}
|
|
1068
1068
|
function Qe(e, t) {
|
|
1069
|
-
if (
|
|
1069
|
+
if (rt(e, t), typeof ResizeObserver > "u" || !t.parentElement) return;
|
|
1070
1070
|
const s = new ResizeObserver(() => {
|
|
1071
1071
|
if (!t.isConnected) return s.disconnect();
|
|
1072
|
-
|
|
1072
|
+
rt(e, t);
|
|
1073
1073
|
});
|
|
1074
1074
|
s.observe(t.parentElement);
|
|
1075
1075
|
}
|
|
@@ -1079,7 +1079,7 @@ const Je = (e, t, s) => new Promise((i, n) => {
|
|
|
1079
1079
|
e.$image = o, e.contentWidth = o.naturalWidth, e.contentHeight = o.naturalHeight, t.appendChild(o), i();
|
|
1080
1080
|
}, o.onerror = () => n(new Error(`Failed to load image: ${e.src}`)), o.src = e.src;
|
|
1081
1081
|
}), ts = (e, t, s, i) => {
|
|
1082
|
-
const n = e.format || s.video.format ||
|
|
1082
|
+
const n = e.format || s.video.format || Ht(e.src);
|
|
1083
1083
|
t.innerHTML = x(s.video.tpl, {
|
|
1084
1084
|
...i,
|
|
1085
1085
|
src: e.src,
|
|
@@ -1089,7 +1089,7 @@ const Je = (e, t, s) => new Promise((i, n) => {
|
|
|
1089
1089
|
const o = t.querySelector("video");
|
|
1090
1090
|
o && (e.autoStart ?? s.video.autoStart) && o.play().catch(() => {
|
|
1091
1091
|
});
|
|
1092
|
-
},
|
|
1092
|
+
}, at = (e, t, s) => new Promise((i) => {
|
|
1093
1093
|
const n = s.iframe, o = m("div", "glare-iframe-wrap", n.tpl), r = o.querySelector("iframe");
|
|
1094
1094
|
if (!r) throw new Error("Iframe template must contain an <iframe>");
|
|
1095
1095
|
for (const [a, l] of Object.entries(n.attr)) r.setAttribute(a, l);
|
|
@@ -1109,7 +1109,7 @@ const Je = (e, t, s) => new Promise((i, n) => {
|
|
|
1109
1109
|
t.innerHTML = await i.text();
|
|
1110
1110
|
}, is = (e, t) => {
|
|
1111
1111
|
e.content && typeof e.content == "object" ? t.appendChild(e.content) : t.innerHTML = e.html ?? e.content ?? e.src;
|
|
1112
|
-
}, ns = { image: Je, video: ts, embed:
|
|
1112
|
+
}, ns = { image: Je, video: ts, embed: at, iframe: at, inline: es, ajax: ss, html: is };
|
|
1113
1113
|
async function os(e, t, s, i) {
|
|
1114
1114
|
t.innerHTML = "", t.className = `glare-content glare-content--${e.type}`, await ns[e.type](e, t, s, i), e.isLoaded = !0;
|
|
1115
1115
|
}
|
|
@@ -1127,7 +1127,7 @@ function ls(e) {
|
|
|
1127
1127
|
}
|
|
1128
1128
|
const y = class y {
|
|
1129
1129
|
constructor(t, s = {}, i = 0, n = "") {
|
|
1130
|
-
this.id = ++as, this.current = null, this.currIndex = 0, this.prevIndex = 0, this.isActive = !1, this.isClosing = !1, this.isIdle = !1, this.$refs = null, this.hash = null, this.gestures = null, this.wheel = null, this.cleanups = [], this.captionTracker = null, this.previouslyFocused = null, this.direction = 1, this.opts =
|
|
1130
|
+
this.id = ++as, this.current = null, this.currIndex = 0, this.prevIndex = 0, this.isActive = !1, this.isClosing = !1, this.isIdle = !1, this.$refs = null, this.hash = null, this.gestures = null, this.wheel = null, this.cleanups = [], this.captionTracker = null, this.previouslyFocused = null, this.direction = 1, this.opts = bt(s), this.dict = vt(this.opts), this.group = zt(t, this.opts), this.galleryName = n, this.currIndex = this.clampIndex(i), this.zoom = new ue({
|
|
1131
1131
|
image: () => this.current?.$image ?? null,
|
|
1132
1132
|
stage: () => this.$refs?.stage ?? null,
|
|
1133
1133
|
onChange: (o) => this.syncZoomState(o)
|
|
@@ -1137,8 +1137,8 @@ const y = class y {
|
|
|
1137
1137
|
if (this.isActive) return this.jumpTo(t);
|
|
1138
1138
|
if (!this.group.length) return;
|
|
1139
1139
|
this.opts.closeExisting && y.close(!0), this.currIndex = this.clampIndex(t), this.current = this.group[this.currIndex], this.previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null, this.emit("onInit");
|
|
1140
|
-
const s =
|
|
1141
|
-
this.$refs = s, Oe(i, this.opts), this.syncChrome(), this.resolveParent().appendChild(i), this.captionTracker =
|
|
1140
|
+
const s = jt(this.opts, this.dict, this.id, this.group.length), { container: i } = s;
|
|
1141
|
+
i.classList.add("glare-is-loading"), this.$refs = s, Oe(i, this.opts), this.syncChrome(), this.resolveParent().appendChild(i), this.captionTracker = Ut(s), this.cleanups.push(() => this.captionTracker?.destroy()), this.isActive = !0, b.add(this), this.opts.hideScrollbar && V(!0), this.emit("onActivate"), this.emitSlide("beforeShow", this.current), ft(() => {
|
|
1142
1142
|
this.isActive && (i.classList.add("glare-is-open"), this.showSlide(this.currIndex, !0), this.cleanups.push(Ue(this, i, () => this.onActivity())), this.startModules(s), this.opts.autoFocus && this.focus(), this.idle.reset());
|
|
1143
1143
|
});
|
|
1144
1144
|
}
|
|
@@ -1147,7 +1147,7 @@ const y = class y {
|
|
|
1147
1147
|
this.isClosing = !0, this.slideshow?.stop(), this.idle.stop();
|
|
1148
1148
|
const { container: t, bg: s } = this.$refs, i = $(this.opts).animationDuration;
|
|
1149
1149
|
if (i === 0) return this.teardown();
|
|
1150
|
-
t.classList.remove("glare-is-open"), t.classList.add("glare-is-closing"),
|
|
1150
|
+
t.classList.remove("glare-is-open"), t.classList.add("glare-is-closing"), Nt(s ?? t, i, () => this.teardown());
|
|
1151
1151
|
}
|
|
1152
1152
|
next() {
|
|
1153
1153
|
this.jumpTo(this.currIndex + 1);
|
|
@@ -1158,7 +1158,7 @@ const y = class y {
|
|
|
1158
1158
|
jumpTo(t) {
|
|
1159
1159
|
if (!this.isActive || this.isClosing) return;
|
|
1160
1160
|
const s = this.group.length, i = this.opts.loop ? (t % s + s) % s : E(t, 0, s - 1);
|
|
1161
|
-
i !== this.currIndex && (this.direction = t > this.currIndex ? 1 : -1, this.prevIndex = this.currIndex, this.currIndex = i, this.zoom.reset(), this.current = this.group[i], this.syncChrome(), this.showSlide(i, !1), this.thumbs?.focus(i), this.hash?.update(i), this.slideshow?.onIndexChange(), this.emitSlide("onUpdate", this.current));
|
|
1161
|
+
i !== this.currIndex && (this.direction = t > this.currIndex ? 1 : -1, this.prevIndex = this.currIndex, this.currIndex = i, this.zoom.reset(), this.current = this.group[i], this.$refs?.container.classList.add("glare-is-loading"), this.syncChrome(), this.showSlide(i, !1), this.thumbs?.focus(i), this.hash?.update(i), this.slideshow?.onIndexChange(), this.emitSlide("onUpdate", this.current));
|
|
1162
1162
|
}
|
|
1163
1163
|
toggleZoom(t) {
|
|
1164
1164
|
this.current?.type === "image" && (this.zoom.isZoomed ? this.zoom.toFit() : this.zoom.toActual(t));
|
|
@@ -1179,8 +1179,8 @@ const y = class y {
|
|
|
1179
1179
|
async showSlide(t, s) {
|
|
1180
1180
|
const i = this.group[t];
|
|
1181
1181
|
if (!this.$refs || !i) return;
|
|
1182
|
-
const { container: n, stage: o } = this.$refs, r =
|
|
1183
|
-
Jt(this.opts, i) && Gt(r, this.opts, this.dict), Yt(o, this.opts, this.dict), this.emitSlide("beforeLoad", i), this.opts.image.preload && rs(this.group, t);
|
|
1182
|
+
const { container: n, stage: o } = this.$refs, r = Vt(o, i, this.opts);
|
|
1183
|
+
Jt(this.opts, i) && Gt(r, this.opts, this.dict), s || X(o, r, 0, this.direction), Yt(o, this.opts, this.dict), this.emitSlide("beforeLoad", i), this.opts.image.preload && rs(this.group, t);
|
|
1184
1184
|
let a = !1;
|
|
1185
1185
|
try {
|
|
1186
1186
|
await os(i, i.$content, this.opts, this.dict);
|
|
@@ -1188,7 +1188,7 @@ const y = class y {
|
|
|
1188
1188
|
a = !0, Qt(i, l, this.opts, this.dict), this.emitSlide("onError", i), this.opts.onError || console.warn("[glare]", l);
|
|
1189
1189
|
}
|
|
1190
1190
|
if (!this.isActive || this.currIndex !== t) return r.remove();
|
|
1191
|
-
a || this.emitSlide("afterLoad", i), Kt(o), s || Ae(n, this.opts),
|
|
1191
|
+
a || this.emitSlide("afterLoad", i), Kt(o), s || Ae(n, this.opts), Xt(r, s, this.direction), this.captionTracker?.follow(r), n.classList.remove("glare-is-loading"), X(o, r, $(this.opts).transitionDuration, this.direction), this.syncZoomState(this.zoom.isZoomed), !a && (s && Re(n, i, this.opts), this.emitSlide("afterShow", i));
|
|
1192
1192
|
}
|
|
1193
1193
|
syncChrome() {
|
|
1194
1194
|
!this.$refs || !this.current || (te(this.$refs, this.opts, this.dict, this.current, this.group.length, this.captionFor(this.current)), this.syncZoomState(this.zoom.isZoomed));
|
|
@@ -1205,12 +1205,12 @@ const y = class y {
|
|
|
1205
1205
|
return (typeof t == "string" ? document.querySelector(t) : t) ?? document.body;
|
|
1206
1206
|
}
|
|
1207
1207
|
startModules({ container: t, stage: s, bg: i }) {
|
|
1208
|
-
const n = this.opts, o = A(n.thumbs,
|
|
1208
|
+
const n = this.opts, o = A(n.thumbs, ct);
|
|
1209
1209
|
o && (this.thumbs = new Se(this, t, o));
|
|
1210
1210
|
const r = A(n.slideshow, N);
|
|
1211
1211
|
r && (this.slideshow = new we(this, t, r));
|
|
1212
|
-
const a = A(n.fullscreen,
|
|
1213
|
-
a &&
|
|
1212
|
+
const a = A(n.fullscreen, ht);
|
|
1213
|
+
a && mt() && (this.fullscreen = new ce(this, t, a)), n.hash && this.galleryName && (this.hash = new ve(this, this.galleryName)), n.wheel && (this.wheel = new $e(s, {
|
|
1214
1214
|
mode: n.wheel,
|
|
1215
1215
|
current: () => this.current,
|
|
1216
1216
|
isZoomed: () => this.zoom.isZoomed,
|