@uvalib/web-components 1.6.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +133 -12
  3. package/dist/base/states.d.ts +12 -0
  4. package/dist/base/states.js +33 -0
  5. package/dist/base/states.js.map +1 -0
  6. package/dist/base.css +15 -5
  7. package/dist/components/bento-box/BentoBox.js +1 -0
  8. package/dist/components/bento-box/BentoBox.js.map +1 -1
  9. package/dist/components/events-section/EventsSection.js +1 -0
  10. package/dist/components/events-section/EventsSection.js.map +1 -1
  11. package/dist/components/library-hours/hours-data.js +1 -1
  12. package/dist/components/library-hours/hours-data.js.map +1 -1
  13. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +1 -0
  14. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -1
  15. package/dist/components/uvalib-card/UvalibCard.js +6 -0
  16. package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
  17. package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +27 -0
  18. package/dist/components/uvalib-combobox/UvalibCombobox.js +85 -1
  19. package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -1
  20. package/dist/components/uvalib-contents/UvalibContents.js +5 -0
  21. package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
  22. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +6 -0
  23. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +10 -0
  24. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -1
  25. package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +1 -0
  26. package/dist/components/uvalib-image-regions/UvalibImageRegions.js +4 -1
  27. package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -1
  28. package/dist/components/uvalib-image-regions/regions.d.ts +6 -2
  29. package/dist/components/uvalib-image-regions/regions.js +6 -3
  30. package/dist/components/uvalib-image-regions/regions.js.map +1 -1
  31. package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +100 -7
  32. package/dist/components/uvalib-lightbox/UvalibLightbox.js +310 -83
  33. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  34. package/dist/components/uvalib-lightbox/compare.d.ts +48 -8
  35. package/dist/components/uvalib-lightbox/compare.js +226 -22
  36. package/dist/components/uvalib-lightbox/compare.js.map +1 -1
  37. package/dist/components/uvalib-map/UvalibMap.js +2 -2
  38. package/dist/components/uvalib-map/UvalibMap.js.map +1 -1
  39. package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -0
  40. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  41. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +3 -1
  42. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
  43. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +3 -3
  44. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +16 -8
  45. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
  46. package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +4 -1
  47. package/dist/components/uvalib-tag-list/UvalibTagList.js +9 -2
  48. package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -1
  49. package/dist/custom-elements.json +596 -19
  50. package/dist/styles/message.js +4 -0
  51. package/dist/styles/message.js.map +1 -1
  52. package/dist/styles/result-list.js +25 -4
  53. package/dist/styles/result-list.js.map +1 -1
  54. package/dist/styles/results.js +17 -2
  55. package/dist/styles/results.js.map +1 -1
  56. package/dist-cdn/base.css +15 -5
  57. package/dist-cdn/bento-box.js +1 -0
  58. package/dist-cdn/bento-box.js.map +1 -1
  59. package/dist-cdn/chunks/{compare-D4VdaIJN.js → compare-C0nhByn7.js} +185 -56
  60. package/dist-cdn/chunks/compare-C0nhByn7.js.map +1 -0
  61. package/dist-cdn/chunks/{hours-data-Bw6vkIw7.js → hours-data-gMu5uT7H.js} +2 -2
  62. package/dist-cdn/chunks/hours-data-gMu5uT7H.js.map +1 -0
  63. package/dist-cdn/chunks/{library-weekly-hours-CrV3TlP5.js → library-weekly-hours-BJgxAyah.js} +3 -2
  64. package/dist-cdn/chunks/library-weekly-hours-BJgxAyah.js.map +1 -0
  65. package/dist-cdn/chunks/{regions-B8ExwUGP.js → regions-B-rOwa-v.js} +15 -15
  66. package/dist-cdn/chunks/regions-B-rOwa-v.js.map +1 -0
  67. package/dist-cdn/chunks/states-DGXGzcte.js +17 -0
  68. package/dist-cdn/chunks/states-DGXGzcte.js.map +1 -0
  69. package/dist-cdn/custom-elements.json +596 -19
  70. package/dist-cdn/events-section.js +1 -0
  71. package/dist-cdn/events-section.js.map +1 -1
  72. package/dist-cdn/library-hours-setup.js +1 -1
  73. package/dist-cdn/library-weekly-hours.js +1 -1
  74. package/dist-cdn/manifest.json +1 -1
  75. package/dist-cdn/site-hours-section.js +1 -1
  76. package/dist-cdn/skills/uvalib-web-components/SKILL.md +8 -6
  77. package/dist-cdn/skills/uvalib-web-components/reference/components.md +37 -6
  78. package/dist-cdn/uvalib-card.js +6 -0
  79. package/dist-cdn/uvalib-card.js.map +1 -1
  80. package/dist-cdn/uvalib-combobox.js +107 -68
  81. package/dist-cdn/uvalib-combobox.js.map +1 -1
  82. package/dist-cdn/uvalib-contents.js +5 -0
  83. package/dist-cdn/uvalib-contents.js.map +1 -1
  84. package/dist-cdn/uvalib-filter-drawer.js +27 -25
  85. package/dist-cdn/uvalib-filter-drawer.js.map +1 -1
  86. package/dist-cdn/uvalib-image-regions.js +4 -2
  87. package/dist-cdn/uvalib-image-regions.js.map +1 -1
  88. package/dist-cdn/uvalib-lightbox.js +230 -129
  89. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  90. package/dist-cdn/uvalib-map.js +2 -2
  91. package/dist-cdn/uvalib-map.js.map +1 -1
  92. package/dist-cdn/uvalib-metadata.js +3 -0
  93. package/dist-cdn/uvalib-metadata.js.map +1 -1
  94. package/dist-cdn/uvalib-pagefind-search.js +2 -1
  95. package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
  96. package/dist-cdn/uvalib-photo-grid.js +4 -5
  97. package/dist-cdn/uvalib-photo-grid.js.map +1 -1
  98. package/dist-cdn/uvalib-tag-list.js +21 -16
  99. package/dist-cdn/uvalib-tag-list.js.map +1 -1
  100. package/package.json +1 -1
  101. package/skills/uvalib-web-components/SKILL.md +8 -6
  102. package/skills/uvalib-web-components/reference/components.md +37 -6
  103. package/dist-cdn/chunks/compare-D4VdaIJN.js.map +0 -1
  104. package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +0 -1
  105. package/dist-cdn/chunks/library-weekly-hours-CrV3TlP5.js.map +0 -1
  106. 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 { t as d } from "./chunks/accessible-DJv7YOtS.js";
4
- import { i as f, t as p } from "./chunks/regions-B8ExwUGP.js";
5
- import { n as m, r as h, t as g } from "./chunks/url-param-C1sk_F1d.js";
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 _ = /^(full|square|max|pct:[^/]+|\d+,\d+,\d+,\d+)$/i, v = /^!?\d+(\.\d+)?$/, y = /^(default|color|gray|grey|bitonal|native)\.(jpe?g|png|gif|webp|tiff?|jp2)$/i, b = /\.(jpe?g|png|gif|webp)$/i, x = /^image\/(png|jpeg|gif|webp)($|[;,])/i;
8
- function S(e, t) {
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 !y.test(i) || !v.test(a) || !_.test(o) ? null : {
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 C(e, t, n, r) {
27
- let i = S(e, t);
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 (!b.test(a)) return null;
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 w(e, t) {
35
- let n = S(e, t);
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 T(e) {
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 E(e, t) {
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:" && x.test(n.pathname);
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 D = "uvalib-regions-list", O = ["data-uvalib-region", "data-uvalib-active"], k = (e) => {
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
- }, A = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), j = (e) => `
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,20 +96,21 @@ var D = "uvalib-regions-list", O = ["data-uvalib-region", "data-uvalib-active"],
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
- `, M = s(j(":host")), N = 0, P = null, F = null, I = null;
102
- function L() {
103
- I || customElements.get("uvalib-image-regions") || (I = import("./uvalib-image-regions.js").catch((e) => {
104
- I = null, console.warn("uvalib-lightbox: could not load uvalib-image-regions.", e);
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 R = class extends l {
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.open = !1, this.status = "loading", this.fitW = 0, this.fitH = 0, this.showRegions = !0, this.captionId = `uvalib-lightbox-caption-${++N}`, 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.lent = null, this.entryTabindex = /* @__PURE__ */ new WeakMap(), this.warnedList = !1, this.refocus = !1, this.pendingVersion = null, this.onResize = () => {
110
- this.open && (window.clearTimeout(this.resizeTimer), this.resizeTimer = window.setTimeout(() => {
111
- this.isConnected && this.open && this.measure();
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 = () => {
112
+ this.shown && (window.clearTimeout(this.resizeTimer), this.resizeTimer = window.setTimeout(() => {
113
+ this.isConnected && this.shown && this.measure();
112
114
  }, 150));
113
115
  }, this.onClick = (e) => {
114
116
  if (!(e instanceof MouseEvent) || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
@@ -124,17 +126,21 @@ var R = class extends l {
124
126
  if (this.queuedOpen = null, !this.isConnected || !e) return;
125
127
  this.slides = e.slides, this.index = e.i, this.trigger = e.slides[e.i]?.el ?? null, this.userClosed = !1, this.measure();
126
128
  let t = e.slides[e.i]?.id ?? null;
127
- this.historyPushed = this.writeParam(t, "push", this.backInHash), this.open ||= !0;
129
+ this.historyPushed = this.writeParam(t, "push", this.backInHash), this.shown ||= !0;
128
130
  return;
129
131
  }
130
- let e = m(this.loc(), this.urlParam);
132
+ let e = g(this.loc(), this.urlParam);
131
133
  if (!e) {
132
- this.historyPushed = !1, this.open && this.dismiss("pop");
134
+ this.historyPushed = !1, this.shown && this.dismiss("pop");
133
135
  return;
134
136
  }
135
137
  this.userClosed = !1;
136
138
  let t = this.collect(), n = t.findIndex((t) => t.id === e);
137
- n < 0 ? this.open && this.dismiss("pop") : (this.pendingVersion = this.versionFromUrl(), this.slides = t, this.index = n, this.trigger = t[n]?.el ?? null, this.historyPushed = !0, this.measure(), this.armReopenGuard(), this.open ||= !0);
139
+ n < 0 ? this.shown && this.dismiss("pop") : (this.pendingVersion = this.versionFromUrl(), this.slides = t, this.index = n, this.trigger = t[n]?.el ?? null, this.historyPushed = !0, this.orphan = null, this.measure(), this.armReopenGuard(), this.shown || (this.shown = !0, this.announce("open", {
140
+ id: e,
141
+ index: n,
142
+ restored: !0
143
+ })));
138
144
  }, this.onKey = (e) => {
139
145
  if (this.typing(e) || this.cmp?.key(e) || !this.multiple || e.type !== "keydown") return;
140
146
  let t = getComputedStyle(this).direction === "rtl", n = t ? "ArrowRight" : "ArrowLeft", r = t ? "ArrowLeft" : "ArrowRight";
@@ -163,8 +169,8 @@ var R = class extends l {
163
169
  }
164
170
  static {
165
171
  this.styles = [
166
- d,
167
- M,
172
+ p,
173
+ F,
168
174
  t`
169
175
  .panel {
170
176
  background: var(--uva-color-surface-raised, var(--uva-color-surface, #fff));
@@ -184,6 +190,7 @@ var R = class extends l {
184
190
  font-size: 1.125rem;
185
191
  line-height: 1.4;
186
192
  font-weight: 600;
193
+ text-wrap: balance;
187
194
  }
188
195
  .count {
189
196
  font-variant-numeric: tabular-nums;
@@ -268,7 +275,7 @@ var R = class extends l {
268
275
  createRenderRoot() {
269
276
  if (!this.isLight) {
270
277
  let e = super.createRenderRoot();
271
- return this.noStyle && e instanceof ShadowRoot && (e.adoptedStyleSheets = [d.styleSheet, M.styleSheet].filter((e) => e != null)), e;
278
+ return this.noStyle && e instanceof ShadowRoot && (e.adoptedStyleSheets = [p.styleSheet, F.styleSheet].filter((e) => e != null)), e;
272
279
  }
273
280
  let e = this.ownerDocument.createElement("div");
274
281
  return e.className = "viewer", this.mount = e, this.append(e), e;
@@ -278,12 +285,12 @@ var R = class extends l {
278
285
  super.connectedCallback(), this.suppressClose = !1, e && this.installLight(e), this.listen(), this.slides = this.collect(), this.watch(), this.openFromUrl();
279
286
  }
280
287
  disconnectedCallback() {
281
- super.disconnectedCallback(), this.unlisten(), this.observer?.disconnect(), this.dialogObserver?.disconnect(), this.dialogObserver = void 0, this.observedDialog = void 0, window.clearTimeout(this.resizeTimer), this.cancelReveal(), this.restoreDetails(), this.pendingBack = !1, this.queuedOpen = null, this.reopenGuard = !1, this.suppressClose = !0, this.open = !1;
288
+ super.disconnectedCallback(), this.unlisten(), this.observer?.disconnect(), this.dialogObserver?.disconnect(), this.dialogObserver = void 0, this.observedDialog = void 0, window.clearTimeout(this.resizeTimer), this.cancelReveal(), this.restoreDetails(), this.pendingBack = !1, this.queuedOpen = null, this.reopenGuard = !1, this.suppressClose = !0, this.shown = !1;
282
289
  let e = this.dialogEl;
283
290
  e?.open && e.close(), this.suppressClose = !1, this.ignoreClose = !1;
284
291
  }
285
292
  willUpdate() {
286
- if (this.lendList(), !this.open) {
293
+ if (this.lendList(), !this.shown) {
287
294
  this.lastSrc = "";
288
295
  return;
289
296
  }
@@ -293,17 +300,17 @@ var R = class extends l {
293
300
  t === this.lastSrc ? !t && this.status !== "error" && (this.status = "error") : (this.lastSrc = t, this.status = t ? "loading" : "error");
294
301
  }
295
302
  updated(e) {
296
- super.updated(e), e.has("selector") && this.watch(), (e.has("regions") || e.has("regionsList") || e.has("versions")) && this.isConnected && this.scheduleSync(!0), this.open ? ((e.has("open") || e.has("index") || e.has("slides")) && this.placeDetails(), (this.current?.regions.length || this.current?.list) && L(), this.current?.versions && this.loadCompare(), this.lendList(!0), this.refocus && (this.refocus = !1, this.closeBtn?.focus()), this.bindDialogObserver(), e.has("open") && this.reveal(), queueMicrotask(() => {
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(() => {
297
304
  this.isConnected && this.settleImage();
298
- })) : e.has("open") && this.restoreDetails();
305
+ })) : e.has("shown") && this.restoreDetails();
299
306
  }
300
307
  installLight(e) {
301
308
  if (!e) return;
302
309
  let t = this.getRootNode(), n = t instanceof Document || t instanceof ShadowRoot ? t : void 0;
303
- this.noStyle ? (c(`${this.localName}::structure`, s(j(this.localName)), {
310
+ this.noStyle ? (c(`${this.localName}::structure`, s(P(this.localName)), {
304
311
  root: n,
305
312
  scope: !1
306
- }), c(`${this.localName}::a11y`, d, { root: n })) : c(this.localName, this.constructor.elementStyles, { root: n });
313
+ }), c(`${this.localName}::a11y`, p, { root: n })) : c(this.localName, this.constructor.elementStyles, { root: n });
307
314
  }
308
315
  get scope() {
309
316
  let e = this.getRootNode();
@@ -326,7 +333,7 @@ var R = class extends l {
326
333
  this.listened && (this.listened = !1, this.listenRoot?.removeEventListener("click", this.onClick, !0), this.listenRoot = void 0, window.removeEventListener("popstate", this.onPop), window.removeEventListener("resize", this.onResize));
327
334
  }
328
335
  watch() {
329
- this.observer?.disconnect(), this.observer = new MutationObserver(() => this.scheduleSync()), this.observer.observe(this, {
336
+ this.observer?.disconnect(), this.watchedBox = void 0, this.observer = new MutationObserver(() => this.scheduleSync()), this.observer.observe(this, {
330
337
  attributes: !0,
331
338
  attributeFilter: [
332
339
  "href",
@@ -336,9 +343,11 @@ var R = class extends l {
336
343
  "data-caption",
337
344
  "data-id",
338
345
  "data-details-id",
346
+ "data-for",
339
347
  "data-regions",
340
348
  "data-regions-list",
341
349
  "data-versions",
350
+ "data-version",
342
351
  "data-image-width",
343
352
  "data-image-height",
344
353
  "slot"
@@ -359,21 +368,29 @@ var R = class extends l {
359
368
  e.regions,
360
369
  e.imageWidth,
361
370
  e.imageHeight,
362
- e.versions
371
+ e.versions,
372
+ e.start
363
373
  ]) === JSON.stringify([
364
374
  this.slides[t]?.regions,
365
375
  this.slides[t]?.imageWidth,
366
376
  this.slides[t]?.imageHeight,
367
- this.slides[t]?.versions
377
+ this.slides[t]?.versions,
378
+ this.slides[t]?.start
368
379
  ]));
369
380
  if (this.noteEntries(), !n) {
370
- let t = this.current?.el;
371
- if (this.slides = e, this.open) {
372
- let n = t ? e.findIndex((e) => e.el === t) : -1;
373
- n >= 0 ? this.index = n : e.length ? this.index = Math.min(this.index, e.length - 1) : this.dismiss("empty");
381
+ let t = this.current;
382
+ if (!this.shown) this.slides = e;
383
+ else {
384
+ let n = t ? e.findIndex((e) => e.el === t.el) : -1;
385
+ if (n >= 0 || !t) this.slides = e, this.index = Math.max(n, 0), this.orphan = null;
386
+ else if (!e.length) this.dismiss("empty"), this.slides = e, this.index = 0;
387
+ else {
388
+ let n = Math.min(this.index, e.length);
389
+ e.splice(n, 0, t), this.slides = e, this.index = n, this.orphan = t;
390
+ }
374
391
  }
375
392
  }
376
- this.open || this.openFromUrl();
393
+ this.shown ? this.placeDetails() : this.openFromUrl();
377
394
  }));
378
395
  }
379
396
  collect() {
@@ -391,7 +408,7 @@ var R = class extends l {
391
408
  }
392
409
  for (let e of r) n(e);
393
410
  let i = (n) => {
394
- if (!(n instanceof HTMLAnchorElement) || !n.hasAttribute("href") || n.closest("[hidden]") || this.mount?.contains(n) || n.closest("dialog") || n.closest("[slot=\"details\"]") || this.lent?.el.contains(n)) return;
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;
395
412
  for (let e of t) if (e.contains(n)) return;
396
413
  let r = n.closest("uvalib-lightbox");
397
414
  r && r !== this || e.push(n);
@@ -405,19 +422,20 @@ var R = class extends l {
405
422
  }), a.map((e, t) => this.slide(e, t));
406
423
  }
407
424
  slide(e, t) {
408
- let n = e.getAttribute("href") ?? "", r = e.querySelector("img"), i = A(r?.getAttribute("data-uvalib-alt") || r?.getAttribute("alt")), a = this.linkText(e), o = A(e.dataset.caption) || i || a || A(e.getAttribute("title")) || "Image", s = A(e.dataset.id) || e.id || w(n, this.base) || String(t + 1), c = this.listOf(e, s, n, t), l = this.regionsOf(e, s, n, t);
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);
409
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.`)), {
410
427
  el: e,
411
428
  id: s,
412
429
  href: n,
413
430
  caption: o,
414
431
  alt: i || o,
415
- detailsId: A(e.dataset.detailsId) || null,
432
+ detailsId: N(e.dataset.detailsId) || null,
416
433
  regions: c ? [] : l,
417
434
  list: c,
418
- imageWidth: k(e.dataset.imageWidth),
419
- imageHeight: k(e.dataset.imageHeight),
420
- 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
421
439
  };
422
440
  }
423
441
  versionsOf(e, t, n, r) {
@@ -437,12 +455,12 @@ var R = class extends l {
437
455
  }
438
456
  }
439
457
  loadCompare() {
440
- this.cmp || (P ? (this.cmp = new P.Compare(this.compareHost()), this.requestUpdate()) : (F ??= import("./chunks/compare-D4VdaIJN.js").then((e) => {
441
- P = e;
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;
442
460
  }).catch((e) => {
443
- F = null, console.warn("uvalib-lightbox: could not load the version comparison.", e);
444
- }), F.then(() => {
445
- P && this.isConnected && this.loadCompare();
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();
446
464
  })));
447
465
  }
448
466
  compareHost() {
@@ -454,13 +472,13 @@ var R = class extends l {
454
472
  mode: () => this.compare,
455
473
  size: (e) => this.sized(e),
456
474
  write: (e) => {
457
- this.versionParam && this.open && this.writeParam(this.current?.id ?? null, "replace", void 0, e);
475
+ this.versionParam && this.shown && this.writeParam(this.current?.id ?? null, "replace", void 0, e);
458
476
  },
459
477
  update: () => this.requestUpdate()
460
478
  };
461
479
  }
462
480
  regionsOf(e, t, n, r) {
463
- let i = p(e.dataset.regions);
481
+ let i = h(e.dataset.regions);
464
482
  if (typeof this.regions == "function") {
465
483
  let a;
466
484
  try {
@@ -474,14 +492,14 @@ var R = class extends l {
474
492
  console.warn(`${this.localName}: the regions callback threw.`, e);
475
493
  }
476
494
  if (Array.isArray(a)) for (let e of a) {
477
- let t = f(e);
495
+ let t = m(e);
478
496
  t && i.push(t);
479
497
  }
480
498
  }
481
499
  return i;
482
500
  }
483
501
  listOf(e, t, n, r) {
484
- let i = null, a = A(e.dataset.regionsList);
502
+ let i = null, a = N(e.dataset.regionsList);
485
503
  if (a) i = this.scope.getElementById(a);
486
504
  else if (typeof this.regionsList == "function") try {
487
505
  i = this.regionsList({
@@ -499,7 +517,7 @@ var R = class extends l {
499
517
  let t = [], n = (e) => {
500
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));
501
519
  };
502
- return e.childNodes.forEach(n), A(t.join(" "));
520
+ return e.childNodes.forEach(n), N(t.join(" "));
503
521
  }
504
522
  get current() {
505
523
  return this.slides[this.index];
@@ -511,12 +529,12 @@ var R = class extends l {
511
529
  return this.sized(this.current?.href ?? "");
512
530
  }
513
531
  sized(e) {
514
- if (!E(e, this.base)) return "";
515
- let t = this.fitW || T(window).w, n = this.fitH || T(window).h;
516
- return C(e, this.base, t, n) ?? e;
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;
517
535
  }
518
536
  measure() {
519
- let { w: e, h: t } = T(window);
537
+ let { w: e, h: t } = D(window);
520
538
  e !== this.fitW && (this.fitW = e), t !== this.fitH && (this.fitH = t);
521
539
  }
522
540
  linkFrom(e) {
@@ -524,44 +542,71 @@ var R = class extends l {
524
542
  let t = e.target;
525
543
  return t instanceof Element ? t.closest("a[href]") : null;
526
544
  }
527
- activate(e, t) {
528
- let n = this.open;
529
- if (!(n && this.index === e)) {
530
- if (this.slides = t, this.index = e, this.trigger = t[e]?.el ?? null, this.userClosed = !1, this.pendingVersion = null, this.cmp?.reset(), this.measure(), this.open = !0, this.pendingBack) this.queuedOpen = {
545
+ open(e) {
546
+ if (!this.isConnected) return !1;
547
+ let t = this.collect(), n = typeof e == "number" ? Number.isInteger(e) && e >= 0 && e < t.length ? e : -1 : t.findIndex((t) => t.id === e);
548
+ return n < 0 ? !1 : (this.activate(n, t, !1), !0);
549
+ }
550
+ close(e = {}) {
551
+ return !this.shown && !this.dialogEl?.open ? !1 : (this.dismiss("api", e.focus ?? null), !0);
552
+ }
553
+ announce(e, t) {
554
+ this.dispatchEvent(new CustomEvent(`uvalib-lightbox-${e}`, {
555
+ detail: t,
556
+ bubbles: !0,
557
+ composed: !0
558
+ }));
559
+ }
560
+ activate(e, t, n = !0) {
561
+ let r = this.shown;
562
+ if (!(r && this.index === e)) {
563
+ if (this.slides = t, this.index = e, this.orphan = null, this.trigger = t[e]?.el ?? null, this.userClosed = !1, this.pendingVersion = null, this.cmp?.reset(), this.measure(), this.shown = !0, this.pendingBack) this.queuedOpen = {
531
564
  i: e,
532
565
  slides: t
533
566
  };
534
567
  else if (this.urlParam) {
535
- let r = t[e]?.id ?? null, i = h(location.hash);
536
- n ? this.writeParam(r, "replace", i) : (m(this.loc(), this.urlParam) && this.writeParam(null, "replace", i), this.historyPushed = this.writeParam(r, "push", 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));
537
570
  }
538
- u(this, [
571
+ n && u(this, [
539
572
  "uvalib-lightbox",
540
573
  "open",
541
574
  `image ${e + 1}`,
542
575
  e + 1
543
- ]);
576
+ ]), r || this.announce("open", {
577
+ id: t[e]?.id ?? "",
578
+ index: e,
579
+ restored: !1
580
+ });
544
581
  }
545
582
  }
546
583
  openFromUrl() {
547
- if (this.open || this.userClosed || !this.urlParam) return;
548
- let e = m(this.loc(), this.urlParam);
584
+ if (this.shown || this.userClosed || !this.urlParam) return;
585
+ let e = g(this.loc(), this.urlParam);
549
586
  if (!e) return;
550
587
  let t = this.slides.length ? this.slides : this.collect(), n = t.findIndex((t) => t.id === e);
551
588
  if (n < 0) return;
552
589
  this.slides = t, this.index = n, this.trigger = t[n]?.el ?? null, this.measure();
553
590
  let r = this.versionFromUrl();
554
591
  this.pendingVersion = r;
555
- let i = h(location.hash);
556
- this.writeParam(null, "replace", i), this.historyPushed = this.writeParam(e, "push", i, r), this.open = !0;
592
+ let i = _(location.hash);
593
+ this.writeParam(null, "replace", i), this.historyPushed = this.writeParam(e, "push", i, r), this.orphan = null, this.shown = !0, this.announce("open", {
594
+ id: e,
595
+ index: n,
596
+ restored: !0
597
+ });
557
598
  }
558
599
  versionFromUrl() {
559
- return this.versionParam ? m(this.loc(), this.versionParam) : null;
600
+ return this.versionParam ? g(this.loc(), this.versionParam) : null;
560
601
  }
561
602
  step(e) {
562
603
  let t = this.slides.length;
563
604
  if (t < 2) return;
564
605
  let n = (this.index + e + t) % t;
606
+ if (this.orphan && this.current === this.orphan) {
607
+ let r = this.index;
608
+ this.slides = this.slides.filter((e) => e !== this.orphan), this.orphan = null, t = this.slides.length, n = e > 0 ? r % t : (r - 1 + t) % t;
609
+ }
565
610
  this.index = n, this.pendingVersion = null, this.trigger = this.slides[n]?.el ?? this.trigger, this.urlParam && this.writeParam(this.slides[n]?.id ?? null, "replace");
566
611
  let r = e < 0 ? "previous" : "next";
567
612
  u(this, [
@@ -571,29 +616,38 @@ var R = class extends l {
571
616
  n + 1
572
617
  ]);
573
618
  }
574
- dismiss(e) {
619
+ dismiss(e, t = null) {
575
620
  if (this.dismissing) return;
576
- let t = this.dialogEl;
577
- if (this.open || t?.open) {
578
- this.dismissing = !0, this.cmp?.reset();
579
- try {
580
- let n = this.historyPushed;
581
- this.historyPushed = !1, this.ignoreClose = !0, this.cancelReveal(), this.open = !1, (e === "ui" || e === "empty") && (this.userClosed = !0), this.restoreDetails(), t?.open && t.close(), this.focusTrigger(), e === "ui" && this.urlParam ? n ? (this.backInHash = h(location.hash), this.pendingBack = !0, history.back()) : this.writeParam(null, "replace", h(location.hash)) : e === "empty" && this.urlParam && (this.pendingBack = !1, this.queuedOpen = null, this.writeParam(null, "replace", h(location.hash)));
582
- } finally {
583
- this.dismissing = !1;
584
- }
621
+ let n = this.dialogEl;
622
+ if (!this.shown && !n?.open) return;
623
+ this.dismissing = !0;
624
+ let r = {
625
+ id: this.current?.id ?? "",
626
+ index: this.index
627
+ }, i = e === "ui" || e === "api";
628
+ this.cmp?.reset();
629
+ try {
630
+ let a = this.historyPushed;
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;
632
+ let o = e === "ui" ? "close" : e === "pop" ? "history" : e;
633
+ this.announce("close", {
634
+ ...r,
635
+ reason: o
636
+ });
637
+ } finally {
638
+ this.dismissing = !1;
585
639
  }
586
640
  }
587
641
  writeParam(e, t, n, r = null) {
588
642
  if (!this.urlParam) return !1;
589
- let i = this.loc(), a = g(i, this.urlParam, e, n), o = this.versionParam;
643
+ let i = this.loc(), a = v(i, this.urlParam, e, n), o = this.versionParam;
590
644
  if (o && o !== this.urlParam) {
591
645
  let t = a.slice(i.pathname.length), s = t.indexOf("#"), c = {
592
646
  pathname: i.pathname,
593
647
  search: s < 0 ? t : t.slice(0, s),
594
648
  hash: s < 0 ? "" : t.slice(s)
595
649
  };
596
- a = g(c, o, e === null ? null : r, n);
650
+ a = v(c, o, e === null ? null : r, n);
597
651
  }
598
652
  let s = location.pathname + location.search + location.hash;
599
653
  if (a === s) return !1;
@@ -629,8 +683,8 @@ var R = class extends l {
629
683
  }), this.dialogObserver = t;
630
684
  }
631
685
  onNativeClose() {
632
- this.ignoreClose || this.suppressClose || !this.open || this.dialogEl?.open || (this.reopenGuard ? this.ownerDocument.defaultView?.queueMicrotask(() => {
633
- this.open && this.isConnected && !this.dialogEl?.open && this.reveal();
686
+ this.ignoreClose || this.suppressClose || !this.shown || this.dialogEl?.open || (this.reopenGuard ? this.ownerDocument.defaultView?.queueMicrotask(() => {
687
+ this.shown && this.isConnected && !this.dialogEl?.open && this.reveal();
634
688
  }) : this.dismiss("ui"));
635
689
  }
636
690
  get dialogEl() {
@@ -642,9 +696,19 @@ var R = class extends l {
642
696
  get detailsBox() {
643
697
  return this.renderRoot.querySelector(".details");
644
698
  }
645
- focusTrigger() {
646
- let e = this.trigger;
647
- e?.isConnected && e.focus();
699
+ focusAfterClose(e) {
700
+ if (e?.isConnected) {
701
+ e.focus();
702
+ return;
703
+ }
704
+ let t = this.trigger;
705
+ if (t?.isConnected && !t.closest("[hidden]")) {
706
+ t.focus();
707
+ return;
708
+ }
709
+ if (!this.isConnected) return;
710
+ let n = this.collect()[0]?.el;
711
+ n ? n.focus() : (this.hasAttribute("tabindex") || (this.setAttribute("tabindex", "-1"), this.addEventListener("blur", () => this.removeAttribute("tabindex"), { once: !0 })), this.focus());
648
712
  }
649
713
  ensureRoot() {
650
714
  let e = this.renderRoot;
@@ -657,7 +721,7 @@ var R = class extends l {
657
721
  reveal() {
658
722
  this.ensureRoot();
659
723
  let e = this.dialogEl;
660
- if (!this.open || !e) return;
724
+ if (!this.shown || !e) return;
661
725
  let t = () => {
662
726
  if (this.revealTries++ > 8) {
663
727
  this.ignoreClose = !1;
@@ -665,7 +729,7 @@ var R = class extends l {
665
729
  }
666
730
  let e = this.ownerDocument.defaultView;
667
731
  e && (this.revealFrame = e.requestAnimationFrame(() => {
668
- this.revealFrame = 0, this.open && this.reveal();
732
+ this.revealFrame = 0, this.shown && this.reveal();
669
733
  }));
670
734
  };
671
735
  if (!e.isConnected) {
@@ -706,34 +770,64 @@ var R = class extends l {
706
770
  }
707
771
  placeDetails() {
708
772
  let e = this.matchingDetails(), t = `${e.map((e) => this.detailToken(e)).join("|")}@${this.index}`;
709
- if (t === this.parkedKey) return;
710
- let n = new Set(e), r = [];
711
- for (let e of this.parked) n.has(e.el) && this.detailsBox?.contains(e.el) ? r.push(e) : this.putBack(e);
712
- this.parked = r;
713
- let i = this.detailsBox;
714
- if (i) for (let t of e) {
715
- if (i.contains(t)) continue;
716
- let e = t.parentNode;
717
- e && (this.parked.push({
718
- el: t,
719
- parent: e,
720
- next: t.nextSibling,
721
- hidden: t.hidden
722
- }), t.hidden = !1, i.append(t));
773
+ if (t !== this.parkedKey) {
774
+ let n = new Set(e), r = [];
775
+ for (let e of this.parked) n.has(e.el) && e.el.parentNode === e.at ? r.push(e) : this.putBack(e);
776
+ this.parked = r;
777
+ let i = this.detailsBox;
778
+ if (i) for (let t of e) {
779
+ if (r.some((e) => e.el === t)) continue;
780
+ let e = t.parentNode;
781
+ if (!e) continue;
782
+ let n = !this.isLight && t.getAttribute("slot") !== "details", a = n ? this : i;
783
+ this.parked.push({
784
+ el: t,
785
+ parent: e,
786
+ next: t.nextSibling,
787
+ hidden: t.hidden,
788
+ slot: t.getAttribute("slot"),
789
+ at: a
790
+ }), t.hidden = !1, n && t.setAttribute("slot", A), a.appendChild(t);
791
+ }
792
+ this.parkedKey = t;
723
793
  }
724
- this.parkedKey = t;
794
+ this.markDetailsBox(), this.awaitDetails();
795
+ }
796
+ markDetailsBox() {
797
+ let e = this.detailsBox;
798
+ e && (e.hidden = !this.parked.some((e) => e.el.parentNode === e.at), !this.isLight && e !== this.watchedBox && this.observer && (this.watchedBox = e, this.observer.observe(e, {
799
+ attributes: !0,
800
+ attributeFilter: ["data-for", "slot"],
801
+ subtree: !0
802
+ })));
803
+ }
804
+ awaitDetails() {
805
+ let e = this.shown ? this.current?.detailsId ?? "" : "";
806
+ !e || this.scope.getElementById(e) ? this.stopAwaitingDetails() : this.lateDetails && this.lateDetailsId === e || (this.stopAwaitingDetails(), this.lateDetailsId = e, this.lateDetails = new MutationObserver(() => {
807
+ !this.shown || this.current?.detailsId !== e ? this.stopAwaitingDetails() : this.scope.getElementById(e) && (this.stopAwaitingDetails(), this.placeDetails());
808
+ }), this.lateDetails.observe(this.scope, {
809
+ childList: !0,
810
+ subtree: !0,
811
+ attributes: !0,
812
+ attributeFilter: ["id"]
813
+ }));
814
+ }
815
+ stopAwaitingDetails() {
816
+ this.lateDetails?.disconnect(), this.lateDetails = void 0, this.lateDetailsId = "";
725
817
  }
726
818
  putBack(e) {
727
- e.el.hidden = e.hidden;
728
- let t = e.next?.parentNode === e.parent ? e.next : null;
729
- e.parent.insertBefore(e.el, t);
819
+ let { el: t } = e;
820
+ if (t.hidden = e.hidden, e.slot == null ? t.removeAttribute("slot") : t.setAttribute("slot", e.slot), t.parentNode !== e.at) return;
821
+ let n = e.next?.parentNode === e.parent ? e.next : null;
822
+ e.parent.insertBefore(t, n);
730
823
  }
731
824
  restoreDetails() {
825
+ this.stopAwaitingDetails();
732
826
  for (let e = this.parked.length - 1; e >= 0; e--) this.putBack(this.parked[e]);
733
- this.parked = [], this.parkedKey = "", this.returnList();
827
+ this.parked = [], this.parkedKey = "", this.markDetailsBox(), this.returnList();
734
828
  }
735
829
  get wantedList() {
736
- if (!this.open) return null;
830
+ if (!this.shown) return null;
737
831
  let e = this.current?.list ?? null;
738
832
  return e && this.displaySrc ? e : null;
739
833
  }
@@ -753,7 +847,7 @@ var R = class extends l {
753
847
  slot: t.getAttribute("slot")
754
848
  };
755
849
  }
756
- this.noteEntries(), this.isLight ? t.removeAttribute("slot") : t.setAttribute("slot", D), t.hidden = !1, n.append(t);
850
+ this.noteEntries(), this.isLight ? t.removeAttribute("slot") : t.setAttribute("slot", k), t.hidden = !1, n.append(t);
757
851
  }
758
852
  }
759
853
  noteEntries() {
@@ -765,9 +859,9 @@ var R = class extends l {
765
859
  if (!e) return;
766
860
  this.lent = null;
767
861
  let { el: t } = e, n = this.shadowRoot?.activeElement ?? this.ownerDocument.activeElement;
768
- this.open && n && t.contains(n) && (this.refocus = !0);
862
+ this.shown && n && t.contains(n) && (this.refocus = !0);
769
863
  for (let e of t.children) {
770
- for (let t of O) e.removeAttribute(t);
864
+ for (let t of j) e.removeAttribute(t);
771
865
  if (this.entryTabindex.has(e)) {
772
866
  let t = this.entryTabindex.get(e);
773
867
  t == null ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", t);
@@ -778,7 +872,7 @@ var R = class extends l {
778
872
  e.parent.insertBefore(t, r);
779
873
  }
780
874
  get statusText() {
781
- return this.open ? this.status === "loading" ? "Loading image." : this.status === "error" ? "This image could not be loaded." : "" : "";
875
+ return this.shown ? this.status === "loading" ? "Loading image." : this.status === "error" ? "This image could not be loaded." : "" : "";
782
876
  }
783
877
  renderImage(e, t, n) {
784
878
  let i = !!(n || e.list), a = e.versions && this.cmp?.active ? this.cmp : null, s = r`<img
@@ -790,8 +884,10 @@ var R = class extends l {
790
884
  @load=${this.onLoad}
791
885
  @error=${this.onError}
792
886
  />`, c = o;
793
- if (e.versions && (s = r`<div
794
- class="stack ${a?.stackClass ?? ""}"
887
+ if (e.versions) {
888
+ let t = !this.cmp && e.start && !z ? "starting" : "";
889
+ s = r`<div
890
+ class="stack ${a?.stackClass ?? t}"
795
891
  slot=${i ? "image" : o}
796
892
  style=${a?.stackStyle ?? o}
797
893
  @pointerdown=${this.onStack}
@@ -800,22 +896,25 @@ var R = class extends l {
800
896
  @pointercancel=${this.onStack}
801
897
  >
802
898
  ${s}${a ? a.layers() : o}
803
- </div>`, a && (c = a.controls(i ? "controls" : ""))), !i) return r`${s}${c}`;
804
- let l = e.list && !this.isLight ? r`<slot name=${D}></slot>` : o;
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;
805
903
  return r`<uvalib-image-regions
806
904
  class="regions"
807
905
  part="regions"
808
906
  .items=${e.list ? null : n}
809
- label=${A(this.regionsLabel) || "Regions"}
907
+ label=${N(this.regionsLabel) || "Regions"}
810
908
  image-width=${e.imageWidth ?? o}
811
909
  image-height=${e.imageHeight ?? o}
812
910
  ?hide-outlines=${!this.showRegions}
813
911
  ?no-style=${this.noStyle}
912
+ style=${a?.regionsStyle || o}
814
913
  >${s}${c}${l}</uvalib-image-regions
815
914
  >`;
816
915
  }
817
916
  render() {
818
- let e = this.open ? this.current : void 0, t = e ? this.displaySrc : "", n = e && E(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;
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;
819
918
  return r`
820
919
  ${this.isLight ? o : r`<slot></slot><slot name="details" hidden></slot>`}
821
920
  <dialog
@@ -863,13 +962,15 @@ var R = class extends l {
863
962
  ></a
864
963
  >`)}
865
964
  </div>
866
- <div class="details" part="details"></div>
965
+ <div class="details" part="details" hidden>
966
+ ${this.isLight ? o : r`<slot name=${A}></slot>`}
967
+ </div>
867
968
  </div>
868
969
  </dialog>
869
970
  `;
870
971
  }
871
972
  };
872
973
  // src/components/uvalib-lightbox/uvalib-lightbox.ts
873
- a([e({ type: String })], R.prototype, "selector", void 0), a([e({ attribute: "url-param" })], R.prototype, "urlParam", void 0), a([e({ attribute: !1 })], R.prototype, "regions", void 0), a([e({ attribute: !1 })], R.prototype, "regionsList", void 0), a([e({ attribute: "regions-label" })], R.prototype, "regionsLabel", void 0), a([e({ attribute: !1 })], R.prototype, "versions", void 0), a([e()], R.prototype, "compare", void 0), a([e({ attribute: "version-param" })], R.prototype, "versionParam", void 0), a([n()], R.prototype, "slides", void 0), a([n()], R.prototype, "index", void 0), a([n()], R.prototype, "open", void 0), a([n()], R.prototype, "status", void 0), a([n()], R.prototype, "fitW", void 0), a([n()], R.prototype, "fitH", void 0), a([n()], R.prototype, "showRegions", void 0), i("uvalib-lightbox", R);
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);
874
975
 
875
976
  //# sourceMappingURL=uvalib-lightbox.js.map