@uvalib/web-components 1.7.0 → 1.8.0
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/CHANGELOG.md +23 -0
- package/README.md +56 -12
- package/dist/base/states.d.ts +12 -0
- package/dist/base/states.js +33 -0
- package/dist/base/states.js.map +1 -0
- package/dist/base.css +15 -5
- package/dist/components/bento-box/BentoBox.js +1 -0
- package/dist/components/bento-box/BentoBox.js.map +1 -1
- package/dist/components/events-section/EventsSection.js +1 -0
- package/dist/components/events-section/EventsSection.js.map +1 -1
- package/dist/components/library-hours/hours-data.js +1 -1
- package/dist/components/library-hours/hours-data.js.map +1 -1
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +1 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -1
- package/dist/components/uvalib-card/UvalibCard.js +6 -0
- package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
- package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +27 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.js +85 -1
- package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -1
- package/dist/components/uvalib-contents/UvalibContents.js +5 -0
- package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +6 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +10 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -1
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js +2 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -1
- package/dist/components/uvalib-image-regions/regions.d.ts +6 -2
- package/dist/components/uvalib-image-regions/regions.js +6 -3
- package/dist/components/uvalib-image-regions/regions.js.map +1 -1
- package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +9 -2
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +23 -3
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
- package/dist/components/uvalib-lightbox/compare.d.ts +30 -3
- package/dist/components/uvalib-lightbox/compare.js +98 -29
- package/dist/components/uvalib-lightbox/compare.js.map +1 -1
- package/dist/components/uvalib-map/UvalibMap.js +2 -2
- package/dist/components/uvalib-map/UvalibMap.js.map +1 -1
- package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +3 -1
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +3 -3
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +16 -8
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
- package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +4 -1
- package/dist/components/uvalib-tag-list/UvalibTagList.js +9 -2
- package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -1
- package/dist/custom-elements.json +1926 -1637
- package/dist/styles/message.js +4 -0
- package/dist/styles/message.js.map +1 -1
- package/dist/styles/result-list.js +25 -4
- package/dist/styles/result-list.js.map +1 -1
- package/dist/styles/results.js +17 -2
- package/dist/styles/results.js.map +1 -1
- package/dist-cdn/base.css +15 -5
- package/dist-cdn/bento-box.js +1 -0
- package/dist-cdn/bento-box.js.map +1 -1
- package/dist-cdn/chunks/{compare-DV6ltvsJ.js → compare-C0nhByn7.js} +66 -29
- package/dist-cdn/chunks/compare-C0nhByn7.js.map +1 -0
- package/dist-cdn/chunks/{hours-data-Bw6vkIw7.js → hours-data-gMu5uT7H.js} +2 -2
- package/dist-cdn/chunks/hours-data-gMu5uT7H.js.map +1 -0
- package/dist-cdn/chunks/{library-weekly-hours-CrV3TlP5.js → library-weekly-hours-BJgxAyah.js} +3 -2
- package/dist-cdn/chunks/library-weekly-hours-BJgxAyah.js.map +1 -0
- package/dist-cdn/chunks/{regions-B8ExwUGP.js → regions-B-rOwa-v.js} +15 -15
- package/dist-cdn/chunks/regions-B-rOwa-v.js.map +1 -0
- package/dist-cdn/chunks/states-DGXGzcte.js +17 -0
- package/dist-cdn/chunks/states-DGXGzcte.js.map +1 -0
- package/dist-cdn/custom-elements.json +1926 -1637
- package/dist-cdn/events-section.js +1 -0
- package/dist-cdn/events-section.js.map +1 -1
- package/dist-cdn/library-hours-setup.js +1 -1
- package/dist-cdn/library-weekly-hours.js +1 -1
- package/dist-cdn/manifest.json +1 -1
- package/dist-cdn/site-hours-section.js +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +5 -4
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +33 -6
- package/dist-cdn/uvalib-card.js +6 -0
- package/dist-cdn/uvalib-card.js.map +1 -1
- package/dist-cdn/uvalib-combobox.js +107 -68
- package/dist-cdn/uvalib-combobox.js.map +1 -1
- package/dist-cdn/uvalib-contents.js +5 -0
- package/dist-cdn/uvalib-contents.js.map +1 -1
- package/dist-cdn/uvalib-filter-drawer.js +27 -25
- package/dist-cdn/uvalib-filter-drawer.js.map +1 -1
- package/dist-cdn/uvalib-image-regions.js +3 -1
- package/dist-cdn/uvalib-image-regions.js.map +1 -1
- package/dist-cdn/uvalib-lightbox.js +80 -69
- package/dist-cdn/uvalib-lightbox.js.map +1 -1
- package/dist-cdn/uvalib-map.js +2 -2
- package/dist-cdn/uvalib-map.js.map +1 -1
- package/dist-cdn/uvalib-metadata.js +3 -0
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/dist-cdn/uvalib-pagefind-search.js +2 -1
- package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
- package/dist-cdn/uvalib-photo-grid.js +4 -5
- package/dist-cdn/uvalib-photo-grid.js.map +1 -1
- package/dist-cdn/uvalib-tag-list.js +21 -16
- package/dist-cdn/uvalib-tag-list.js.map +1 -1
- package/package.json +1 -1
- package/skills/uvalib-web-components/SKILL.md +5 -4
- package/skills/uvalib-web-components/reference/components.md +33 -6
- package/dist-cdn/chunks/compare-DV6ltvsJ.js.map +0 -1
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +0 -1
- package/dist-cdn/chunks/library-weekly-hours-CrV3TlP5.js.map +0 -1
- package/dist-cdn/chunks/regions-B8ExwUGP.js.map +0 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
2
|
import { a as u } from "./chunks/analytics-DTTihuBD.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { n as d, t as f } from "./chunks/states-DGXGzcte.js";
|
|
4
|
+
import { t as p } from "./chunks/accessible-DJv7YOtS.js";
|
|
5
|
+
import { i as m, t as h } from "./chunks/regions-B-rOwa-v.js";
|
|
6
|
+
import { n as g, r as _, t as v } from "./chunks/url-param-C1sk_F1d.js";
|
|
6
7
|
// src/components/uvalib-lightbox/media.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var y = /^(full|square|max|pct:[^/]+|\d+,\d+,\d+,\d+)$/i, b = /^!?\d+(\.\d+)?$/, x = /^(default|color|gray|grey|bitonal|native)\.(jpe?g|png|gif|webp|tiff?|jp2)$/i, S = /\.(jpe?g|png|gif|webp)$/i, C = /^image\/(png|jpeg|gif|webp)($|[;,])/i;
|
|
9
|
+
function w(e, t) {
|
|
9
10
|
let n;
|
|
10
11
|
try {
|
|
11
12
|
n = new URL(e, t);
|
|
@@ -16,45 +17,45 @@ function S(e, t) {
|
|
|
16
17
|
let r = n.pathname.split("/");
|
|
17
18
|
if (r.length < 5) return null;
|
|
18
19
|
let i = r[r.length - 1] ?? "", a = r[r.length - 2] ?? "", o = r[r.length - 4] ?? "";
|
|
19
|
-
return !
|
|
20
|
+
return !x.test(i) || !b.test(a) || !y.test(o) ? null : {
|
|
20
21
|
url: n,
|
|
21
22
|
parts: r,
|
|
22
23
|
regionIndex: r.length - 4,
|
|
23
24
|
sizeIndex: r.length - 3
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
let i =
|
|
27
|
+
function T(e, t, n, r) {
|
|
28
|
+
let i = w(e, t);
|
|
28
29
|
if (!i) return null;
|
|
29
30
|
let a = i.parts[i.parts.length - 1] ?? "";
|
|
30
|
-
if (!
|
|
31
|
+
if (!S.test(a)) return null;
|
|
31
32
|
let o = Math.max(1, Math.round(n)), s = Math.max(1, Math.round(r));
|
|
32
33
|
return i.parts[i.sizeIndex] = `!${o},${s}`, i.url.pathname = i.parts.join("/"), i.url.toString();
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
-
let n =
|
|
35
|
+
function E(e, t) {
|
|
36
|
+
let n = w(e, t);
|
|
36
37
|
return n && n.parts[n.regionIndex - 1] || null;
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function D(e) {
|
|
39
40
|
let t = Math.min(e.devicePixelRatio || 1, 2);
|
|
40
41
|
return {
|
|
41
42
|
w: Math.max(1, Math.min(2e3, Math.round((e.innerWidth || 800) * t))),
|
|
42
43
|
h: Math.max(1, Math.min(2e3, Math.round((e.innerHeight || 600) * t)))
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function O(e, t) {
|
|
46
47
|
try {
|
|
47
48
|
let n = new URL(e, t);
|
|
48
|
-
return n.protocol === "http:" || n.protocol === "https:" || n.protocol === "data:" &&
|
|
49
|
+
return n.protocol === "http:" || n.protocol === "https:" || n.protocol === "data:" && C.test(n.pathname);
|
|
49
50
|
} catch {
|
|
50
51
|
return !1;
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
// src/components/uvalib-lightbox/UvalibLightbox.ts
|
|
54
|
-
var
|
|
55
|
+
var k = "uvalib-regions-list", A = "uvalib-details", j = ["data-uvalib-region", "data-uvalib-active"], M = (e) => {
|
|
55
56
|
let t = Number(e);
|
|
56
57
|
return t > 0 ? t : void 0;
|
|
57
|
-
},
|
|
58
|
+
}, N = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), P = (e) => `
|
|
58
59
|
${e} { display: block; }
|
|
59
60
|
${e} .viewer { display: contents; }
|
|
60
61
|
${e} dialog {
|
|
@@ -95,18 +96,19 @@ var D = "uvalib-regions-list", O = "uvalib-details", k = ["data-uvalib-region",
|
|
|
95
96
|
}
|
|
96
97
|
${e} .regions { display: block; }
|
|
97
98
|
${e} .stack { position: relative; width: fit-content; max-width: 100%; margin-inline: auto; }
|
|
99
|
+
${e} .stack.starting > * { visibility: hidden !important; }
|
|
98
100
|
${e} .details:empty { display: none; }
|
|
99
101
|
${e} > [slot="details"] { display: none; }
|
|
100
102
|
${e}[hidden], ${e} [hidden] { display: none !important; }
|
|
101
|
-
`,
|
|
102
|
-
function
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
`, F = s(P(":host")), I = 0, L = null, R = null, z = !1, B = null;
|
|
104
|
+
function V() {
|
|
105
|
+
B || customElements.get("uvalib-image-regions") || (B = import("./uvalib-image-regions.js").catch((e) => {
|
|
106
|
+
B = null, console.warn("uvalib-lightbox: could not load uvalib-image-regions.", e);
|
|
105
107
|
}));
|
|
106
108
|
}
|
|
107
|
-
var
|
|
109
|
+
var H = class extends l {
|
|
108
110
|
constructor(...e) {
|
|
109
|
-
super(...e), this.selector = "", this.urlParam = "", this.regionsLabel = "Regions", this.compare = "switch", this.versionParam = "", this.slides = [], this.index = 0, this.shown = !1, this.status = "loading", this.fitW = 0, this.fitH = 0, this.showRegions = !0, this.captionId = `uvalib-lightbox-caption-${++
|
|
111
|
+
super(...e), this.selector = "", this.urlParam = "", this.regionsLabel = "Regions", this.compare = "switch", this.versionParam = "", this.slides = [], this.index = 0, this.shown = !1, this.status = "loading", this.fitW = 0, this.fitH = 0, this.showRegions = !0, this.captionId = `uvalib-lightbox-caption-${++I}`, this.internals = f(this), this.trigger = null, this.historyPushed = !1, this.userClosed = !1, this.suppressClose = !1, this.warnedSelector = !1, this.lastSrc = "", this.syncQueued = !1, this.regionsChanged = !1, this.resizeTimer = 0, this.ignoreClose = !1, this.dismissing = !1, this.revealTries = 0, this.revealFrame = 0, this.listened = !1, this.pendingBack = !1, this.backInHash = !1, this.queuedOpen = null, this.reopenGuard = !1, this.parked = [], this.parkedKey = "", this.lateDetailsId = "", this.orphan = null, this.lent = null, this.entryTabindex = /* @__PURE__ */ new WeakMap(), this.warnedList = !1, this.refocus = !1, this.pendingVersion = null, this.onResize = () => {
|
|
110
112
|
this.shown && (window.clearTimeout(this.resizeTimer), this.resizeTimer = window.setTimeout(() => {
|
|
111
113
|
this.isConnected && this.shown && this.measure();
|
|
112
114
|
}, 150));
|
|
@@ -127,7 +129,7 @@ var z = class extends l {
|
|
|
127
129
|
this.historyPushed = this.writeParam(t, "push", this.backInHash), this.shown ||= !0;
|
|
128
130
|
return;
|
|
129
131
|
}
|
|
130
|
-
let e =
|
|
132
|
+
let e = g(this.loc(), this.urlParam);
|
|
131
133
|
if (!e) {
|
|
132
134
|
this.historyPushed = !1, this.shown && this.dismiss("pop");
|
|
133
135
|
return;
|
|
@@ -167,8 +169,8 @@ var z = class extends l {
|
|
|
167
169
|
}
|
|
168
170
|
static {
|
|
169
171
|
this.styles = [
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
p,
|
|
173
|
+
F,
|
|
172
174
|
t`
|
|
173
175
|
.panel {
|
|
174
176
|
background: var(--uva-color-surface-raised, var(--uva-color-surface, #fff));
|
|
@@ -188,6 +190,7 @@ var z = class extends l {
|
|
|
188
190
|
font-size: 1.125rem;
|
|
189
191
|
line-height: 1.4;
|
|
190
192
|
font-weight: 600;
|
|
193
|
+
text-wrap: balance;
|
|
191
194
|
}
|
|
192
195
|
.count {
|
|
193
196
|
font-variant-numeric: tabular-nums;
|
|
@@ -272,7 +275,7 @@ var z = class extends l {
|
|
|
272
275
|
createRenderRoot() {
|
|
273
276
|
if (!this.isLight) {
|
|
274
277
|
let e = super.createRenderRoot();
|
|
275
|
-
return this.noStyle && e instanceof ShadowRoot && (e.adoptedStyleSheets = [
|
|
278
|
+
return this.noStyle && e instanceof ShadowRoot && (e.adoptedStyleSheets = [p.styleSheet, F.styleSheet].filter((e) => e != null)), e;
|
|
276
279
|
}
|
|
277
280
|
let e = this.ownerDocument.createElement("div");
|
|
278
281
|
return e.className = "viewer", this.mount = e, this.append(e), e;
|
|
@@ -297,17 +300,17 @@ var z = class extends l {
|
|
|
297
300
|
t === this.lastSrc ? !t && this.status !== "error" && (this.status = "error") : (this.lastSrc = t, this.status = t ? "loading" : "error");
|
|
298
301
|
}
|
|
299
302
|
updated(e) {
|
|
300
|
-
super.updated(e), e.has("selector") && this.watch(), (e.has("regions") || e.has("regionsList") || e.has("versions")) && this.isConnected && this.scheduleSync(!0), this.shown ? ((e.has("shown") || e.has("index") || e.has("slides")) && this.placeDetails(), (this.current?.regions.length || this.current?.list) &&
|
|
303
|
+
super.updated(e), e.has("shown") && d(this.internals, "open", this.shown), e.has("selector") && this.watch(), (e.has("regions") || e.has("regionsList") || e.has("versions")) && this.isConnected && this.scheduleSync(!0), this.shown ? ((e.has("shown") || e.has("index") || e.has("slides")) && this.placeDetails(), (this.current?.regions.length || this.current?.list) && V(), this.current?.versions && this.loadCompare(), this.lendList(!0), this.refocus && (this.refocus = !1, this.closeBtn?.focus()), this.bindDialogObserver(), e.has("shown") && this.reveal(), queueMicrotask(() => {
|
|
301
304
|
this.isConnected && this.settleImage();
|
|
302
305
|
})) : e.has("shown") && this.restoreDetails();
|
|
303
306
|
}
|
|
304
307
|
installLight(e) {
|
|
305
308
|
if (!e) return;
|
|
306
309
|
let t = this.getRootNode(), n = t instanceof Document || t instanceof ShadowRoot ? t : void 0;
|
|
307
|
-
this.noStyle ? (c(`${this.localName}::structure`, s(
|
|
310
|
+
this.noStyle ? (c(`${this.localName}::structure`, s(P(this.localName)), {
|
|
308
311
|
root: n,
|
|
309
312
|
scope: !1
|
|
310
|
-
}), c(`${this.localName}::a11y`,
|
|
313
|
+
}), c(`${this.localName}::a11y`, p, { root: n })) : c(this.localName, this.constructor.elementStyles, { root: n });
|
|
311
314
|
}
|
|
312
315
|
get scope() {
|
|
313
316
|
let e = this.getRootNode();
|
|
@@ -344,6 +347,7 @@ var z = class extends l {
|
|
|
344
347
|
"data-regions",
|
|
345
348
|
"data-regions-list",
|
|
346
349
|
"data-versions",
|
|
350
|
+
"data-version",
|
|
347
351
|
"data-image-width",
|
|
348
352
|
"data-image-height",
|
|
349
353
|
"slot"
|
|
@@ -364,12 +368,14 @@ var z = class extends l {
|
|
|
364
368
|
e.regions,
|
|
365
369
|
e.imageWidth,
|
|
366
370
|
e.imageHeight,
|
|
367
|
-
e.versions
|
|
371
|
+
e.versions,
|
|
372
|
+
e.start
|
|
368
373
|
]) === JSON.stringify([
|
|
369
374
|
this.slides[t]?.regions,
|
|
370
375
|
this.slides[t]?.imageWidth,
|
|
371
376
|
this.slides[t]?.imageHeight,
|
|
372
|
-
this.slides[t]?.versions
|
|
377
|
+
this.slides[t]?.versions,
|
|
378
|
+
this.slides[t]?.start
|
|
373
379
|
]));
|
|
374
380
|
if (this.noteEntries(), !n) {
|
|
375
381
|
let t = this.current;
|
|
@@ -402,7 +408,7 @@ var z = class extends l {
|
|
|
402
408
|
}
|
|
403
409
|
for (let e of r) n(e);
|
|
404
410
|
let i = (n) => {
|
|
405
|
-
if (!(n instanceof HTMLAnchorElement) || !n.hasAttribute("href") || n.closest("[hidden]") || this.mount?.contains(n) || n.closest("dialog") || n.closest(`[slot="details"], [slot="${
|
|
411
|
+
if (!(n instanceof HTMLAnchorElement) || !n.hasAttribute("href") || n.closest("[hidden]") || this.mount?.contains(n) || n.closest("dialog") || n.closest(`[slot="details"], [slot="${A}"]`) || this.lent?.el.contains(n)) return;
|
|
406
412
|
for (let e of t) if (e.contains(n)) return;
|
|
407
413
|
let r = n.closest("uvalib-lightbox");
|
|
408
414
|
r && r !== this || e.push(n);
|
|
@@ -416,19 +422,20 @@ var z = class extends l {
|
|
|
416
422
|
}), a.map((e, t) => this.slide(e, t));
|
|
417
423
|
}
|
|
418
424
|
slide(e, t) {
|
|
419
|
-
let n = e.getAttribute("href") ?? "", r = e.querySelector("img"), i =
|
|
425
|
+
let n = e.getAttribute("href") ?? "", r = e.querySelector("img"), i = N(r?.getAttribute("data-uvalib-alt") || r?.getAttribute("alt")), a = this.linkText(e), o = N(e.dataset.caption) || i || a || N(e.getAttribute("title")) || "Image", s = N(e.dataset.id) || e.id || E(n, this.base) || String(t + 1), c = this.listOf(e, s, n, t), l = this.regionsOf(e, s, n, t);
|
|
420
426
|
return c && l.length && !this.warnedList && (this.warnedList = !0, console.warn(`${this.localName}: an image has both regions and a regions list; the list is used.`)), {
|
|
421
427
|
el: e,
|
|
422
428
|
id: s,
|
|
423
429
|
href: n,
|
|
424
430
|
caption: o,
|
|
425
431
|
alt: i || o,
|
|
426
|
-
detailsId:
|
|
432
|
+
detailsId: N(e.dataset.detailsId) || null,
|
|
427
433
|
regions: c ? [] : l,
|
|
428
434
|
list: c,
|
|
429
|
-
imageWidth:
|
|
430
|
-
imageHeight:
|
|
431
|
-
versions: this.versionsOf(e, s, n, t)
|
|
435
|
+
imageWidth: M(e.dataset.imageWidth),
|
|
436
|
+
imageHeight: M(e.dataset.imageHeight),
|
|
437
|
+
versions: this.versionsOf(e, s, n, t),
|
|
438
|
+
start: N(e.dataset.version) || null
|
|
432
439
|
};
|
|
433
440
|
}
|
|
434
441
|
versionsOf(e, t, n, r) {
|
|
@@ -448,12 +455,12 @@ var z = class extends l {
|
|
|
448
455
|
}
|
|
449
456
|
}
|
|
450
457
|
loadCompare() {
|
|
451
|
-
this.cmp || (
|
|
452
|
-
|
|
458
|
+
this.cmp || (L ? (this.cmp = new L.Compare(this.compareHost()), this.requestUpdate()) : (R ??= import("./chunks/compare-C0nhByn7.js").then((e) => {
|
|
459
|
+
L = e, z = !1;
|
|
453
460
|
}).catch((e) => {
|
|
454
|
-
|
|
455
|
-
}),
|
|
456
|
-
|
|
461
|
+
R = null, z = !0, console.warn("uvalib-lightbox: could not load the version comparison.", e);
|
|
462
|
+
}), R.then(() => {
|
|
463
|
+
L && this.isConnected && this.loadCompare();
|
|
457
464
|
})));
|
|
458
465
|
}
|
|
459
466
|
compareHost() {
|
|
@@ -471,7 +478,7 @@ var z = class extends l {
|
|
|
471
478
|
};
|
|
472
479
|
}
|
|
473
480
|
regionsOf(e, t, n, r) {
|
|
474
|
-
let i =
|
|
481
|
+
let i = h(e.dataset.regions);
|
|
475
482
|
if (typeof this.regions == "function") {
|
|
476
483
|
let a;
|
|
477
484
|
try {
|
|
@@ -485,14 +492,14 @@ var z = class extends l {
|
|
|
485
492
|
console.warn(`${this.localName}: the regions callback threw.`, e);
|
|
486
493
|
}
|
|
487
494
|
if (Array.isArray(a)) for (let e of a) {
|
|
488
|
-
let t =
|
|
495
|
+
let t = m(e);
|
|
489
496
|
t && i.push(t);
|
|
490
497
|
}
|
|
491
498
|
}
|
|
492
499
|
return i;
|
|
493
500
|
}
|
|
494
501
|
listOf(e, t, n, r) {
|
|
495
|
-
let i = null, a =
|
|
502
|
+
let i = null, a = N(e.dataset.regionsList);
|
|
496
503
|
if (a) i = this.scope.getElementById(a);
|
|
497
504
|
else if (typeof this.regionsList == "function") try {
|
|
498
505
|
i = this.regionsList({
|
|
@@ -510,7 +517,7 @@ var z = class extends l {
|
|
|
510
517
|
let t = [], n = (e) => {
|
|
511
518
|
e instanceof HTMLImageElement || e instanceof HTMLElement && (e.hidden || e.getAttribute("slot") === "details" || e.getAttribute("slot") === "badge" || e.classList.contains("badge") || e.classList.contains("visually-hidden") || e.hasAttribute("data-uvalib-generated-badge") || e.hasAttribute("data-uvalib-badge-sep")) || (e.nodeType === Node.TEXT_NODE ? t.push(e.textContent ?? "") : e.childNodes.forEach(n));
|
|
512
519
|
};
|
|
513
|
-
return e.childNodes.forEach(n),
|
|
520
|
+
return e.childNodes.forEach(n), N(t.join(" "));
|
|
514
521
|
}
|
|
515
522
|
get current() {
|
|
516
523
|
return this.slides[this.index];
|
|
@@ -522,12 +529,12 @@ var z = class extends l {
|
|
|
522
529
|
return this.sized(this.current?.href ?? "");
|
|
523
530
|
}
|
|
524
531
|
sized(e) {
|
|
525
|
-
if (!
|
|
526
|
-
let t = this.fitW ||
|
|
527
|
-
return
|
|
532
|
+
if (!O(e, this.base)) return "";
|
|
533
|
+
let t = this.fitW || D(window).w, n = this.fitH || D(window).h;
|
|
534
|
+
return T(e, this.base, t, n) ?? e;
|
|
528
535
|
}
|
|
529
536
|
measure() {
|
|
530
|
-
let { w: e, h: t } =
|
|
537
|
+
let { w: e, h: t } = D(window);
|
|
531
538
|
e !== this.fitW && (this.fitW = e), t !== this.fitH && (this.fitH = t);
|
|
532
539
|
}
|
|
533
540
|
linkFrom(e) {
|
|
@@ -558,8 +565,8 @@ var z = class extends l {
|
|
|
558
565
|
slides: t
|
|
559
566
|
};
|
|
560
567
|
else if (this.urlParam) {
|
|
561
|
-
let n = t[e]?.id ?? null, i =
|
|
562
|
-
r ? this.writeParam(n, "replace", i) : (
|
|
568
|
+
let n = t[e]?.id ?? null, i = _(location.hash);
|
|
569
|
+
r ? this.writeParam(n, "replace", i) : (g(this.loc(), this.urlParam) && this.writeParam(null, "replace", i), this.historyPushed = this.writeParam(n, "push", i));
|
|
563
570
|
}
|
|
564
571
|
n && u(this, [
|
|
565
572
|
"uvalib-lightbox",
|
|
@@ -575,14 +582,14 @@ var z = class extends l {
|
|
|
575
582
|
}
|
|
576
583
|
openFromUrl() {
|
|
577
584
|
if (this.shown || this.userClosed || !this.urlParam) return;
|
|
578
|
-
let e =
|
|
585
|
+
let e = g(this.loc(), this.urlParam);
|
|
579
586
|
if (!e) return;
|
|
580
587
|
let t = this.slides.length ? this.slides : this.collect(), n = t.findIndex((t) => t.id === e);
|
|
581
588
|
if (n < 0) return;
|
|
582
589
|
this.slides = t, this.index = n, this.trigger = t[n]?.el ?? null, this.measure();
|
|
583
590
|
let r = this.versionFromUrl();
|
|
584
591
|
this.pendingVersion = r;
|
|
585
|
-
let i =
|
|
592
|
+
let i = _(location.hash);
|
|
586
593
|
this.writeParam(null, "replace", i), this.historyPushed = this.writeParam(e, "push", i, r), this.orphan = null, this.shown = !0, this.announce("open", {
|
|
587
594
|
id: e,
|
|
588
595
|
index: n,
|
|
@@ -590,7 +597,7 @@ var z = class extends l {
|
|
|
590
597
|
});
|
|
591
598
|
}
|
|
592
599
|
versionFromUrl() {
|
|
593
|
-
return this.versionParam ?
|
|
600
|
+
return this.versionParam ? g(this.loc(), this.versionParam) : null;
|
|
594
601
|
}
|
|
595
602
|
step(e) {
|
|
596
603
|
let t = this.slides.length;
|
|
@@ -621,7 +628,7 @@ var z = class extends l {
|
|
|
621
628
|
this.cmp?.reset();
|
|
622
629
|
try {
|
|
623
630
|
let a = this.historyPushed;
|
|
624
|
-
this.historyPushed = !1, this.ignoreClose = !0, this.cancelReveal(), this.shown = !1, (i || e === "empty") && (this.userClosed = !0), this.restoreDetails(), n?.open && n.close(), this.focusAfterClose(t), i && this.urlParam ? a ? (this.backInHash =
|
|
631
|
+
this.historyPushed = !1, this.ignoreClose = !0, this.cancelReveal(), this.shown = !1, (i || e === "empty") && (this.userClosed = !0), this.restoreDetails(), n?.open && n.close(), this.focusAfterClose(t), i && this.urlParam ? a ? (this.backInHash = _(location.hash), this.pendingBack = !0, history.back()) : this.writeParam(null, "replace", _(location.hash)) : e === "empty" && this.urlParam && (this.pendingBack = !1, this.queuedOpen = null, this.writeParam(null, "replace", _(location.hash))), this.orphan = null;
|
|
625
632
|
let o = e === "ui" ? "close" : e === "pop" ? "history" : e;
|
|
626
633
|
this.announce("close", {
|
|
627
634
|
...r,
|
|
@@ -633,14 +640,14 @@ var z = class extends l {
|
|
|
633
640
|
}
|
|
634
641
|
writeParam(e, t, n, r = null) {
|
|
635
642
|
if (!this.urlParam) return !1;
|
|
636
|
-
let i = this.loc(), a =
|
|
643
|
+
let i = this.loc(), a = v(i, this.urlParam, e, n), o = this.versionParam;
|
|
637
644
|
if (o && o !== this.urlParam) {
|
|
638
645
|
let t = a.slice(i.pathname.length), s = t.indexOf("#"), c = {
|
|
639
646
|
pathname: i.pathname,
|
|
640
647
|
search: s < 0 ? t : t.slice(0, s),
|
|
641
648
|
hash: s < 0 ? "" : t.slice(s)
|
|
642
649
|
};
|
|
643
|
-
a =
|
|
650
|
+
a = v(c, o, e === null ? null : r, n);
|
|
644
651
|
}
|
|
645
652
|
let s = location.pathname + location.search + location.hash;
|
|
646
653
|
if (a === s) return !1;
|
|
@@ -780,7 +787,7 @@ var z = class extends l {
|
|
|
780
787
|
hidden: t.hidden,
|
|
781
788
|
slot: t.getAttribute("slot"),
|
|
782
789
|
at: a
|
|
783
|
-
}), t.hidden = !1, n && t.setAttribute("slot",
|
|
790
|
+
}), t.hidden = !1, n && t.setAttribute("slot", A), a.appendChild(t);
|
|
784
791
|
}
|
|
785
792
|
this.parkedKey = t;
|
|
786
793
|
}
|
|
@@ -840,7 +847,7 @@ var z = class extends l {
|
|
|
840
847
|
slot: t.getAttribute("slot")
|
|
841
848
|
};
|
|
842
849
|
}
|
|
843
|
-
this.noteEntries(), this.isLight ? t.removeAttribute("slot") : t.setAttribute("slot",
|
|
850
|
+
this.noteEntries(), this.isLight ? t.removeAttribute("slot") : t.setAttribute("slot", k), t.hidden = !1, n.append(t);
|
|
844
851
|
}
|
|
845
852
|
}
|
|
846
853
|
noteEntries() {
|
|
@@ -854,7 +861,7 @@ var z = class extends l {
|
|
|
854
861
|
let { el: t } = e, n = this.shadowRoot?.activeElement ?? this.ownerDocument.activeElement;
|
|
855
862
|
this.shown && n && t.contains(n) && (this.refocus = !0);
|
|
856
863
|
for (let e of t.children) {
|
|
857
|
-
for (let t of
|
|
864
|
+
for (let t of j) e.removeAttribute(t);
|
|
858
865
|
if (this.entryTabindex.has(e)) {
|
|
859
866
|
let t = this.entryTabindex.get(e);
|
|
860
867
|
t == null ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", t);
|
|
@@ -877,8 +884,10 @@ var z = class extends l {
|
|
|
877
884
|
@load=${this.onLoad}
|
|
878
885
|
@error=${this.onError}
|
|
879
886
|
/>`, c = o;
|
|
880
|
-
if (e.versions
|
|
881
|
-
|
|
887
|
+
if (e.versions) {
|
|
888
|
+
let t = !this.cmp && e.start && !z ? "starting" : "";
|
|
889
|
+
s = r`<div
|
|
890
|
+
class="stack ${a?.stackClass ?? t}"
|
|
882
891
|
slot=${i ? "image" : o}
|
|
883
892
|
style=${a?.stackStyle ?? o}
|
|
884
893
|
@pointerdown=${this.onStack}
|
|
@@ -887,13 +896,15 @@ var z = class extends l {
|
|
|
887
896
|
@pointercancel=${this.onStack}
|
|
888
897
|
>
|
|
889
898
|
${s}${a ? a.layers() : o}
|
|
890
|
-
</div>`, a && (c = a.controls(i ? "controls" : ""))
|
|
891
|
-
|
|
899
|
+
</div>`, a && (c = a.controls(i ? "controls" : ""));
|
|
900
|
+
}
|
|
901
|
+
if (!i) return r`${s}${c}`;
|
|
902
|
+
let l = e.list && !this.isLight ? r`<slot name=${k}></slot>` : o;
|
|
892
903
|
return r`<uvalib-image-regions
|
|
893
904
|
class="regions"
|
|
894
905
|
part="regions"
|
|
895
906
|
.items=${e.list ? null : n}
|
|
896
|
-
label=${
|
|
907
|
+
label=${N(this.regionsLabel) || "Regions"}
|
|
897
908
|
image-width=${e.imageWidth ?? o}
|
|
898
909
|
image-height=${e.imageHeight ?? o}
|
|
899
910
|
?hide-outlines=${!this.showRegions}
|
|
@@ -903,7 +914,7 @@ var z = class extends l {
|
|
|
903
914
|
>`;
|
|
904
915
|
}
|
|
905
916
|
render() {
|
|
906
|
-
let e = this.shown ? this.current : void 0, t = e ? this.displaySrc : "", n = e &&
|
|
917
|
+
let e = this.shown ? this.current : void 0, t = e ? this.displaySrc : "", n = e && O(e.href, this.base) ? e.href : "", i = n && e?.versions && this.cmp?.active ? this.cmp.full() : null, a = this.statusText, s = e?.regions.length ? e.regions : null, c = !!(s || e?.list), l = this.multiple ? r`<p class="count" aria-live="polite">${this.index + 1} of ${this.slides.length}</p>` : o;
|
|
907
918
|
return r`
|
|
908
919
|
${this.isLight ? o : r`<slot></slot><slot name="details" hidden></slot>`}
|
|
909
920
|
<dialog
|
|
@@ -952,7 +963,7 @@ var z = class extends l {
|
|
|
952
963
|
>`)}
|
|
953
964
|
</div>
|
|
954
965
|
<div class="details" part="details" hidden>
|
|
955
|
-
${this.isLight ? o : r`<slot name=${
|
|
966
|
+
${this.isLight ? o : r`<slot name=${A}></slot>`}
|
|
956
967
|
</div>
|
|
957
968
|
</div>
|
|
958
969
|
</dialog>
|
|
@@ -960,6 +971,6 @@ var z = class extends l {
|
|
|
960
971
|
}
|
|
961
972
|
};
|
|
962
973
|
// src/components/uvalib-lightbox/uvalib-lightbox.ts
|
|
963
|
-
a([e({ type: String })],
|
|
974
|
+
a([e({ type: String })], H.prototype, "selector", void 0), a([e({ attribute: "url-param" })], H.prototype, "urlParam", void 0), a([e({ attribute: !1 })], H.prototype, "regions", void 0), a([e({ attribute: !1 })], H.prototype, "regionsList", void 0), a([e({ attribute: "regions-label" })], H.prototype, "regionsLabel", void 0), a([e({ attribute: !1 })], H.prototype, "versions", void 0), a([e()], H.prototype, "compare", void 0), a([e({ attribute: "version-param" })], H.prototype, "versionParam", void 0), a([n()], H.prototype, "slides", void 0), a([n()], H.prototype, "index", void 0), a([n()], H.prototype, "shown", void 0), a([n()], H.prototype, "status", void 0), a([n()], H.prototype, "fitW", void 0), a([n()], H.prototype, "fitH", void 0), a([n()], H.prototype, "showRegions", void 0), i("uvalib-lightbox", H);
|
|
964
975
|
|
|
965
976
|
//# sourceMappingURL=uvalib-lightbox.js.map
|