@uvalib/web-components 1.1.1 → 1.3.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 (252) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +1310 -80
  3. package/dist/analytics.d.ts +10 -0
  4. package/dist/analytics.js +9 -0
  5. package/dist/analytics.js.map +1 -0
  6. package/dist/base/UvalibElement.js +8 -5
  7. package/dist/base/UvalibElement.js.map +1 -1
  8. package/dist/base/analytics-state.d.ts +7 -0
  9. package/dist/base/analytics-state.js.map +1 -1
  10. package/dist/base/light-dom-styles.d.ts +13 -0
  11. package/dist/base/light-dom-styles.js +26 -0
  12. package/dist/base/light-dom-styles.js.map +1 -1
  13. package/dist/base/search-tracker.d.ts +57 -0
  14. package/dist/base/search-tracker.js +51 -0
  15. package/dist/base/search-tracker.js.map +1 -0
  16. package/dist/base/url-param.d.ts +23 -0
  17. package/dist/base/url-param.js +49 -0
  18. package/dist/base/url-param.js.map +1 -0
  19. package/dist/base.css +562 -2
  20. package/dist/base.d.ts +2 -0
  21. package/dist/base.js +1 -0
  22. package/dist/base.js.map +1 -1
  23. package/dist/components/site-analytics/SiteAnalytics.d.ts +20 -1
  24. package/dist/components/site-analytics/SiteAnalytics.js +93 -12
  25. package/dist/components/site-analytics/SiteAnalytics.js.map +1 -1
  26. package/dist/components/site-page/SitePage.d.ts +23 -0
  27. package/dist/components/site-page/SitePage.js +77 -0
  28. package/dist/components/site-page/SitePage.js.map +1 -1
  29. package/dist/components/uvalib-back-to-top/UvalibBackToTop.d.ts +58 -0
  30. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js +250 -0
  31. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js.map +1 -0
  32. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts +1 -0
  33. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js +4 -0
  34. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js.map +1 -0
  35. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.d.ts +14 -0
  36. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js +56 -4
  37. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js.map +1 -1
  38. package/dist/components/uvalib-card/UvalibCard.d.ts +19 -5
  39. package/dist/components/uvalib-card/UvalibCard.js +112 -9
  40. package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
  41. package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +178 -0
  42. package/dist/components/uvalib-chip-group/UvalibChipGroup.js +817 -0
  43. package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -0
  44. package/dist/components/uvalib-chip-group/uvalib-chip-group.d.ts +1 -0
  45. package/dist/components/uvalib-chip-group/uvalib-chip-group.js +4 -0
  46. package/dist/components/uvalib-chip-group/uvalib-chip-group.js.map +1 -0
  47. package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +212 -0
  48. package/dist/components/uvalib-combobox/UvalibCombobox.js +1088 -0
  49. package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -0
  50. package/dist/components/uvalib-combobox/uvalib-combobox.d.ts +1 -0
  51. package/dist/components/uvalib-combobox/uvalib-combobox.js +4 -0
  52. package/dist/components/uvalib-combobox/uvalib-combobox.js.map +1 -0
  53. package/dist/components/uvalib-contents/UvalibContents.d.ts +53 -0
  54. package/dist/components/uvalib-contents/UvalibContents.js +202 -3
  55. package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
  56. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +187 -0
  57. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +1452 -0
  58. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -0
  59. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.d.ts +1 -0
  60. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js +4 -0
  61. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js.map +1 -0
  62. package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +6 -0
  63. package/dist/components/uvalib-date-range/UvalibDateRange.js +23 -0
  64. package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -1
  65. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +113 -0
  66. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +589 -0
  67. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -0
  68. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.d.ts +1 -0
  69. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js +4 -0
  70. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js.map +1 -0
  71. package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +130 -0
  72. package/dist/components/uvalib-image-regions/UvalibImageRegions.js +658 -0
  73. package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -0
  74. package/dist/components/uvalib-image-regions/regions.d.ts +57 -0
  75. package/dist/components/uvalib-image-regions/regions.js +117 -0
  76. package/dist/components/uvalib-image-regions/regions.js.map +1 -0
  77. package/dist/components/uvalib-image-regions/uvalib-image-regions.d.ts +1 -0
  78. package/dist/components/uvalib-image-regions/uvalib-image-regions.js +4 -0
  79. package/dist/components/uvalib-image-regions/uvalib-image-regions.js.map +1 -0
  80. package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +40 -0
  81. package/dist/components/uvalib-lightbox/UvalibLightbox.js +152 -17
  82. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  83. package/dist/components/uvalib-lightbox/media.d.ts +1 -18
  84. package/dist/components/uvalib-lightbox/media.js +1 -42
  85. package/dist/components/uvalib-lightbox/media.js.map +1 -1
  86. package/dist/components/uvalib-map/UvalibMap.d.ts +182 -0
  87. package/dist/components/uvalib-map/UvalibMap.js +1001 -0
  88. package/dist/components/uvalib-map/UvalibMap.js.map +1 -0
  89. package/dist/components/uvalib-map/uvalib-map.d.ts +1 -0
  90. package/dist/components/uvalib-map/uvalib-map.js +4 -0
  91. package/dist/components/uvalib-map/uvalib-map.js.map +1 -0
  92. package/dist/components/uvalib-metadata/UvalibMetadata.d.ts +39 -2
  93. package/dist/components/uvalib-metadata/UvalibMetadata.js +214 -8
  94. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  95. package/dist/components/uvalib-pager/UvalibPager.d.ts +77 -4
  96. package/dist/components/uvalib-pager/UvalibPager.js +270 -8
  97. package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
  98. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +27 -1
  99. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +192 -26
  100. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
  101. package/dist/components/uvalib-results-count/UvalibResultsCount.d.ts +62 -0
  102. package/dist/components/uvalib-results-count/UvalibResultsCount.js +208 -0
  103. package/dist/components/uvalib-results-count/UvalibResultsCount.js.map +1 -0
  104. package/dist/components/uvalib-results-count/uvalib-results-count.d.ts +1 -0
  105. package/dist/components/uvalib-results-count/uvalib-results-count.js +4 -0
  106. package/dist/components/uvalib-results-count/uvalib-results-count.js.map +1 -0
  107. package/dist/components/uvalib-tabs/UvalibTabs.d.ts +127 -0
  108. package/dist/components/uvalib-tabs/UvalibTabs.js +821 -0
  109. package/dist/components/uvalib-tabs/UvalibTabs.js.map +1 -0
  110. package/dist/components/uvalib-tabs/uvalib-tabs.d.ts +1 -0
  111. package/dist/components/uvalib-tabs/uvalib-tabs.js +4 -0
  112. package/dist/components/uvalib-tabs/uvalib-tabs.js.map +1 -0
  113. package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +89 -0
  114. package/dist/components/uvalib-tag-list/UvalibTagList.js +411 -0
  115. package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -0
  116. package/dist/components/uvalib-tag-list/uvalib-tag-list.d.ts +1 -0
  117. package/dist/components/uvalib-tag-list/uvalib-tag-list.js +4 -0
  118. package/dist/components/uvalib-tag-list/uvalib-tag-list.js.map +1 -0
  119. package/dist/custom-elements.json +14007 -3497
  120. package/dist/index.d.ts +16 -0
  121. package/dist/index.js +10 -0
  122. package/dist/index.js.map +1 -1
  123. package/dist/pagefind.css +4 -0
  124. package/dist/styles/base.js +154 -1
  125. package/dist/styles/base.js.map +1 -1
  126. package/dist/styles/color-scheme.js +9 -0
  127. package/dist/styles/color-scheme.js.map +1 -1
  128. package/dist/styles/controls.js +8 -0
  129. package/dist/styles/controls.js.map +1 -1
  130. package/dist/styles/hidden.d.ts +2 -0
  131. package/dist/styles/hidden.js +51 -0
  132. package/dist/styles/hidden.js.map +1 -0
  133. package/dist/styles/message.d.ts +1 -0
  134. package/dist/styles/message.js +82 -0
  135. package/dist/styles/message.js.map +1 -0
  136. package/dist/styles/pagefind.js +4 -0
  137. package/dist/styles/pagefind.js.map +1 -1
  138. package/dist/styles/result-list.d.ts +1 -0
  139. package/dist/styles/result-list.js +111 -0
  140. package/dist/styles/result-list.js.map +1 -0
  141. package/dist/styles/results.d.ts +1 -0
  142. package/dist/styles/results.js +242 -0
  143. package/dist/styles/results.js.map +1 -0
  144. package/dist/testing/index.d.ts +110 -0
  145. package/dist/testing/index.js +100 -0
  146. package/dist/testing/index.js.map +1 -0
  147. package/dist/testing/lighthouse-rules.d.ts +10 -0
  148. package/dist/testing/lighthouse-rules.js +44 -0
  149. package/dist/testing/lighthouse-rules.js.map +1 -0
  150. package/dist/tokens.css +9 -0
  151. package/dist-cdn/analytics.js +32 -0
  152. package/dist-cdn/analytics.js.map +1 -0
  153. package/dist-cdn/base.css +562 -2
  154. package/dist-cdn/bento-box.js +3 -3
  155. package/dist-cdn/chunks/{SiteAnalytics-Cm-FyhYS.js → SiteAnalytics-B9gu5aGO.js} +59 -30
  156. package/dist-cdn/chunks/SiteAnalytics-B9gu5aGO.js.map +1 -0
  157. package/dist-cdn/chunks/{UvalibElement-BnI-eRRR.js → UvalibElement-pGONDAwB.js} +108 -101
  158. package/dist-cdn/chunks/UvalibElement-pGONDAwB.js.map +1 -0
  159. package/dist-cdn/chunks/{accessible-GqhVn5_H.js → accessible-DJv7YOtS.js} +2 -2
  160. package/dist-cdn/chunks/{accessible-GqhVn5_H.js.map → accessible-DJv7YOtS.js.map} +1 -1
  161. package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js.map +1 -1
  162. package/dist-cdn/chunks/base-BI8h0Gf3.js +281 -0
  163. package/dist-cdn/chunks/base-BI8h0Gf3.js.map +1 -0
  164. package/dist-cdn/chunks/inline-copy-BANQSMIR.js +69 -0
  165. package/dist-cdn/chunks/inline-copy-BANQSMIR.js.map +1 -0
  166. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js → library-weekly-hours-CrV3TlP5.js} +3 -3
  167. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js.map → library-weekly-hours-CrV3TlP5.js.map} +1 -1
  168. package/dist-cdn/chunks/regions-B8ExwUGP.js +86 -0
  169. package/dist-cdn/chunks/regions-B8ExwUGP.js.map +1 -0
  170. package/dist-cdn/chunks/{repeat-CIFUYkyh.js → repeat-m5Zd_QeP.js} +2 -2
  171. package/dist-cdn/chunks/{repeat-CIFUYkyh.js.map → repeat-m5Zd_QeP.js.map} +1 -1
  172. package/dist-cdn/chunks/{site-header-C9V7Wuw2.js → site-header-DYRMpdBj.js} +13 -4
  173. package/dist-cdn/chunks/site-header-DYRMpdBj.js.map +1 -0
  174. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js → site-main-nav-DURrQMal.js} +3 -3
  175. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js.map → site-main-nav-DURrQMal.js.map} +1 -1
  176. package/dist-cdn/chunks/source-children-BHsDwCvL.js +53 -0
  177. package/dist-cdn/chunks/source-children-BHsDwCvL.js.map +1 -0
  178. package/dist-cdn/chunks/{static-html-1mTAG6nS.js → static-html-C1rhtCHu.js} +2 -2
  179. package/dist-cdn/chunks/{static-html-1mTAG6nS.js.map → static-html-C1rhtCHu.js.map} +1 -1
  180. package/dist-cdn/chunks/url-param-C1sk_F1d.js +28 -0
  181. package/dist-cdn/chunks/url-param-C1sk_F1d.js.map +1 -0
  182. package/dist-cdn/custom-elements.json +14007 -3497
  183. package/dist-cdn/events-section.js +3 -3
  184. package/dist-cdn/library-hours-setup.js +2 -2
  185. package/dist-cdn/library-weekly-hours.js +1 -1
  186. package/dist-cdn/manifest.json +15 -2
  187. package/dist-cdn/pagefind.css +4 -0
  188. package/dist-cdn/site-alerts.js +4 -4
  189. package/dist-cdn/site-analytics.js +2 -2
  190. package/dist-cdn/site-footer.js +2 -2
  191. package/dist-cdn/site-header.js +1 -1
  192. package/dist-cdn/site-hours-section.js +4 -4
  193. package/dist-cdn/site-main-nav.js +1 -1
  194. package/dist-cdn/site-page.js +56 -11
  195. package/dist-cdn/site-page.js.map +1 -1
  196. package/dist-cdn/site-style.js +2 -2
  197. package/dist-cdn/skills/uvalib-web-components/SKILL.md +269 -24
  198. package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  199. package/dist-cdn/skills/uvalib-web-components/reference/components.md +514 -13
  200. package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +1 -1
  201. package/dist-cdn/tokens.css +9 -0
  202. package/dist-cdn/uvalib-analytics.js +2 -2
  203. package/dist-cdn/uvalib-back-to-top.js +156 -0
  204. package/dist-cdn/uvalib-back-to-top.js.map +1 -0
  205. package/dist-cdn/uvalib-breadcrumbs.js +31 -11
  206. package/dist-cdn/uvalib-breadcrumbs.js.map +1 -1
  207. package/dist-cdn/uvalib-card-grid.js +1 -1
  208. package/dist-cdn/uvalib-card.js +97 -23
  209. package/dist-cdn/uvalib-card.js.map +1 -1
  210. package/dist-cdn/uvalib-chip-group.js +535 -0
  211. package/dist-cdn/uvalib-chip-group.js.map +1 -0
  212. package/dist-cdn/uvalib-combobox.js +667 -0
  213. package/dist-cdn/uvalib-combobox.js.map +1 -0
  214. package/dist-cdn/uvalib-contents.js +102 -23
  215. package/dist-cdn/uvalib-contents.js.map +1 -1
  216. package/dist-cdn/uvalib-date-histogram.js +960 -0
  217. package/dist-cdn/uvalib-date-histogram.js.map +1 -0
  218. package/dist-cdn/uvalib-date-range.js +14 -2
  219. package/dist-cdn/uvalib-date-range.js.map +1 -1
  220. package/dist-cdn/uvalib-filter-drawer.js +355 -0
  221. package/dist-cdn/uvalib-filter-drawer.js.map +1 -0
  222. package/dist-cdn/uvalib-filter.js +3 -3
  223. package/dist-cdn/uvalib-image-regions.js +447 -0
  224. package/dist-cdn/uvalib-image-regions.js.map +1 -0
  225. package/dist-cdn/uvalib-lightbox.js +145 -78
  226. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  227. package/dist-cdn/uvalib-map.js +471 -0
  228. package/dist-cdn/uvalib-map.js.map +1 -0
  229. package/dist-cdn/uvalib-metadata.js +152 -25
  230. package/dist-cdn/uvalib-metadata.js.map +1 -1
  231. package/dist-cdn/uvalib-pager.js +164 -18
  232. package/dist-cdn/uvalib-pager.js.map +1 -1
  233. package/dist-cdn/uvalib-photo-grid.js +123 -21
  234. package/dist-cdn/uvalib-photo-grid.js.map +1 -1
  235. package/dist-cdn/uvalib-results-count.js +101 -0
  236. package/dist-cdn/uvalib-results-count.js.map +1 -0
  237. package/dist-cdn/uvalib-tabs.js +436 -0
  238. package/dist-cdn/uvalib-tabs.js.map +1 -0
  239. package/dist-cdn/uvalib-tag-list.js +267 -0
  240. package/dist-cdn/uvalib-tag-list.js.map +1 -0
  241. package/package.json +66 -3
  242. package/skills/uvalib-web-components/SKILL.md +269 -24
  243. package/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  244. package/skills/uvalib-web-components/reference/components.md +514 -13
  245. package/skills/uvalib-web-components/reference/snippets.md +1 -1
  246. package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js.map +0 -1
  247. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +0 -1
  248. package/dist-cdn/chunks/base-CAFQWnZG.js +0 -128
  249. package/dist-cdn/chunks/base-CAFQWnZG.js.map +0 -1
  250. package/dist-cdn/chunks/site-header-C9V7Wuw2.js.map +0 -1
  251. package/dist-cdn/chunks/source-children-RuAec527.js +0 -119
  252. package/dist-cdn/chunks/source-children-RuAec527.js.map +0 -1
@@ -1,9 +1,11 @@
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-BnI-eRRR.js";
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-GqhVn5_H.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";
4
6
  // src/components/uvalib-lightbox/media.ts
5
- var f = /^(full|square|max|pct:[^/]+|\d+,\d+,\d+,\d+)$/i, p = /^!?\d+(\.\d+)?$/, m = /^(default|color|gray|grey|bitonal|native)\.(jpe?g|png|gif|webp|tiff?|jp2)$/i, h = /\.(jpe?g|png|gif|webp)$/i, g = /^image\/(png|jpeg|gif|webp)($|[;,])/i;
6
- function _(e, t) {
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) {
7
9
  let n;
8
10
  try {
9
11
  n = new URL(e, t);
@@ -14,65 +16,45 @@ function _(e, t) {
14
16
  let r = n.pathname.split("/");
15
17
  if (r.length < 5) return null;
16
18
  let i = r[r.length - 1] ?? "", a = r[r.length - 2] ?? "", o = r[r.length - 4] ?? "";
17
- return !m.test(i) || !p.test(a) || !f.test(o) ? null : {
19
+ return !y.test(i) || !v.test(a) || !_.test(o) ? null : {
18
20
  url: n,
19
21
  parts: r,
20
22
  regionIndex: r.length - 4,
21
23
  sizeIndex: r.length - 3
22
24
  };
23
25
  }
24
- function v(e, t, n, r) {
25
- let i = _(e, t);
26
+ function C(e, t, n, r) {
27
+ let i = S(e, t);
26
28
  if (!i) return null;
27
29
  let a = i.parts[i.parts.length - 1] ?? "";
28
- if (!h.test(a)) return null;
30
+ if (!b.test(a)) return null;
29
31
  let o = Math.max(1, Math.round(n)), s = Math.max(1, Math.round(r));
30
32
  return i.parts[i.sizeIndex] = `!${o},${s}`, i.url.pathname = i.parts.join("/"), i.url.toString();
31
33
  }
32
- function y(e, t) {
33
- let n = _(e, t);
34
+ function w(e, t) {
35
+ let n = S(e, t);
34
36
  return n && n.parts[n.regionIndex - 1] || null;
35
37
  }
36
- function b(e) {
38
+ function T(e) {
37
39
  let t = Math.min(e.devicePixelRatio || 1, 2);
38
40
  return {
39
41
  w: Math.max(1, Math.min(2e3, Math.round((e.innerWidth || 800) * t))),
40
42
  h: Math.max(1, Math.min(2e3, Math.round((e.innerHeight || 600) * t)))
41
43
  };
42
44
  }
43
- function x(e, t) {
45
+ function E(e, t) {
44
46
  try {
45
47
  let n = new URL(e, t);
46
- return n.protocol === "http:" || n.protocol === "https:" || n.protocol === "data:" && g.test(n.pathname);
48
+ return n.protocol === "http:" || n.protocol === "https:" || n.protocol === "data:" && x.test(n.pathname);
47
49
  } catch {
48
50
  return !1;
49
51
  }
50
52
  }
51
- function S(e) {
52
- return e.startsWith("#/") || e.startsWith("#!/") || e.includes("?");
53
- }
54
- function C(e, t) {
55
- if (!t) return null;
56
- if (S(e.hash)) {
57
- let n = e.hash.indexOf("?");
58
- return new URLSearchParams(n >= 0 ? e.hash.slice(n + 1) : "").get(t);
59
- }
60
- return new URLSearchParams(e.search).get(t);
61
- }
62
- function w(e, t, n, r) {
63
- if (r ?? S(e.hash)) {
64
- let r = e.hash.indexOf("?"), i = r >= 0 ? e.hash.slice(0, r) : e.hash, a = new URLSearchParams(r >= 0 ? e.hash.slice(r + 1) : "");
65
- n ? a.set(t, n) : a.delete(t);
66
- let o = a.toString();
67
- return e.pathname + e.search + (o ? `${i}?${o}` : i);
68
- }
69
- let i = new URLSearchParams(e.search);
70
- n ? i.set(t, n) : i.delete(t);
71
- let a = i.toString();
72
- return e.pathname + (a ? `?${a}` : "") + e.hash;
73
- }
74
53
  // src/components/uvalib-lightbox/UvalibLightbox.ts
75
- var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
54
+ var D = (e) => {
55
+ let t = Number(e);
56
+ return t > 0 ? t : void 0;
57
+ }, O = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), k = (e) => `
76
58
  ${e} { display: block; }
77
59
  ${e} .viewer { display: contents; }
78
60
  ${e} dialog {
@@ -111,12 +93,19 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
111
93
  padding: 0.5rem 0.75rem;
112
94
  font: inherit;
113
95
  }
96
+ ${e} .regions { display: block; }
114
97
  ${e} .details:empty { display: none; }
115
98
  ${e} > [slot="details"] { display: none; }
116
99
  ${e}[hidden], ${e} [hidden] { display: none !important; }
117
- `, D = s(E(":host")), O = 0, k = class extends l {
100
+ `, A = s(k(":host")), j = 0, M = null;
101
+ function N() {
102
+ M || customElements.get("uvalib-image-regions") || (M = import("./uvalib-image-regions.js").catch((e) => {
103
+ M = null, console.warn("uvalib-lightbox: could not load uvalib-image-regions.", e);
104
+ }));
105
+ }
106
+ var P = class extends l {
118
107
  constructor(...e) {
119
- super(...e), this.selector = "", this.urlParam = "", this.slides = [], this.index = 0, this.open = !1, this.status = "loading", this.fitW = 0, this.fitH = 0, this.captionId = `uvalib-lightbox-caption-${++O}`, this.trigger = null, this.historyPushed = !1, this.userClosed = !1, this.suppressClose = !1, this.warnedSelector = !1, this.lastSrc = "", this.syncQueued = !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.onResize = () => {
108
+ super(...e), this.selector = "", this.urlParam = "", this.regionsLabel = "Regions", 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-${++j}`, 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.onResize = () => {
120
109
  this.open && (window.clearTimeout(this.resizeTimer), this.resizeTimer = window.setTimeout(() => {
121
110
  this.isConnected && this.open && this.measure();
122
111
  }, 150));
@@ -137,7 +126,7 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
137
126
  this.historyPushed = this.writeParam(t, "push", this.backInHash), this.open ||= !0;
138
127
  return;
139
128
  }
140
- let e = C(this.loc(), this.urlParam);
129
+ let e = m(this.loc(), this.urlParam);
141
130
  if (!e) {
142
131
  this.historyPushed = !1, this.open && this.dismiss("pop");
143
132
  return;
@@ -165,12 +154,14 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
165
154
  this.status === "loading" && (this.status = "ready");
166
155
  }, this.onError = () => {
167
156
  this.status = "error";
168
- }, this.detailTokens = /* @__PURE__ */ new WeakMap(), this.detailTokenSeq = 0;
157
+ }, this.detailTokens = /* @__PURE__ */ new WeakMap(), this.detailTokenSeq = 0, this.toggleRegions = () => {
158
+ this.showRegions = !this.showRegions;
159
+ };
169
160
  }
170
161
  static {
171
162
  this.styles = [
172
163
  d,
173
- D,
164
+ A,
174
165
  t`
175
166
  .panel {
176
167
  background: var(--uva-color-surface-raised, var(--uva-color-surface, #fff));
@@ -209,7 +200,8 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
209
200
  outline-offset: 2px;
210
201
  }
211
202
  dialog button.prev,
212
- dialog button.next {
203
+ dialog button.next,
204
+ dialog button.regions-toggle {
213
205
  color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
214
206
  background: var(--uva-color-surface, #fff);
215
207
  border-color: var(--uva-color-border, var(--uva-grey-100, #dadada));
@@ -217,6 +209,25 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
217
209
  .status {
218
210
  font-size: 1rem;
219
211
  }
212
+ /* Pressed shows a check mark, so the state is not shown by colour alone. */
213
+ button.regions-toggle {
214
+ display: inline-flex;
215
+ align-items: center;
216
+ gap: 0.5rem;
217
+ }
218
+ button.regions-toggle::before {
219
+ content: '';
220
+ box-sizing: border-box;
221
+ width: 1rem;
222
+ height: 1rem;
223
+ border: 2px solid currentColor;
224
+ }
225
+ button.regions-toggle[aria-pressed='true']::before {
226
+ border-width: 0 3px 3px 0;
227
+ width: 0.5rem;
228
+ margin-inline: 0.25rem;
229
+ transform: translateY(-0.125rem) rotate(45deg);
230
+ }
220
231
  @media (prefers-reduced-motion: no-preference) {
221
232
  .panel {
222
233
  animation: uvalib-lightbox-in 0.15s ease;
@@ -254,7 +265,7 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
254
265
  createRenderRoot() {
255
266
  if (!this.isLight) {
256
267
  let e = super.createRenderRoot();
257
- return this.noStyle && e instanceof ShadowRoot && (e.adoptedStyleSheets = [d.styleSheet, D.styleSheet].filter((e) => e != null)), e;
268
+ return this.noStyle && e instanceof ShadowRoot && (e.adoptedStyleSheets = [d.styleSheet, A.styleSheet].filter((e) => e != null)), e;
258
269
  }
259
270
  let e = this.ownerDocument.createElement("div");
260
271
  return e.className = "viewer", this.mount = e, this.append(e), e;
@@ -277,14 +288,14 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
277
288
  e === this.lastSrc ? !e && this.status !== "error" && (this.status = "error") : (this.lastSrc = e, this.status = e ? "loading" : "error");
278
289
  }
279
290
  updated(e) {
280
- super.updated(e), e.has("selector") && this.watch(), this.open ? ((e.has("open") || e.has("index") || e.has("slides")) && this.placeDetails(), this.bindDialogObserver(), e.has("open") && this.reveal(), queueMicrotask(() => {
291
+ super.updated(e), e.has("selector") && this.watch(), e.has("regions") && this.isConnected && this.scheduleSync(!0), this.open ? ((e.has("open") || e.has("index") || e.has("slides")) && this.placeDetails(), this.current?.regions.length && N(), this.bindDialogObserver(), e.has("open") && this.reveal(), queueMicrotask(() => {
281
292
  this.isConnected && this.settleImage();
282
293
  })) : e.has("open") && this.restoreDetails();
283
294
  }
284
295
  installLight(e) {
285
296
  if (!e) return;
286
297
  let t = this.getRootNode(), n = t instanceof Document || t instanceof ShadowRoot ? t : void 0;
287
- this.noStyle ? (c(`${this.localName}::structure`, s(E(this.localName)), {
298
+ this.noStyle ? (c(`${this.localName}::structure`, s(k(this.localName)), {
288
299
  root: n,
289
300
  scope: !1
290
301
  }), c(`${this.localName}::a11y`, d, { root: n })) : c(this.localName, this.constructor.elementStyles, { root: n });
@@ -320,6 +331,9 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
320
331
  "data-caption",
321
332
  "data-id",
322
333
  "data-details-id",
334
+ "data-regions",
335
+ "data-image-width",
336
+ "data-image-height",
323
337
  "slot"
324
338
  ],
325
339
  childList: !0,
@@ -329,11 +343,19 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
329
343
  subtree: !0
330
344
  });
331
345
  }
332
- scheduleSync() {
333
- this.syncQueued || (this.syncQueued = !0, queueMicrotask(() => {
346
+ scheduleSync(e = !1) {
347
+ e && (this.regionsChanged = !0), this.syncQueued || (this.syncQueued = !0, queueMicrotask(() => {
334
348
  if (this.syncQueued = !1, !this.isConnected) return;
335
- let e = this.collect();
336
- if (!(e.length === this.slides.length && e.every((e, t) => e.el === this.slides[t]?.el && e.href === this.slides[t]?.href && e.id === this.slides[t]?.id && e.caption === this.slides[t]?.caption && e.detailsId === this.slides[t]?.detailsId))) {
349
+ let e = this.collect(), t = this.regionsChanged;
350
+ if (this.regionsChanged = !1, t || e.length !== this.slides.length || !e.every((e, t) => e.el === this.slides[t]?.el && e.href === this.slides[t]?.href && e.id === this.slides[t]?.id && e.caption === this.slides[t]?.caption && e.detailsId === this.slides[t]?.detailsId && JSON.stringify([
351
+ e.regions,
352
+ e.imageWidth,
353
+ e.imageHeight
354
+ ]) === JSON.stringify([
355
+ this.slides[t]?.regions,
356
+ this.slides[t]?.imageWidth,
357
+ this.slides[t]?.imageHeight
358
+ ]))) {
337
359
  let t = this.current?.el;
338
360
  if (this.slides = e, this.open) {
339
361
  let n = t ? e.findIndex((e) => e.el === t) : -1;
@@ -372,21 +394,45 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
372
394
  }), a.map((e, t) => this.slide(e, t));
373
395
  }
374
396
  slide(e, t) {
375
- let n = e.getAttribute("href") ?? "", r = e.querySelector("img"), i = T(r?.getAttribute("data-uvalib-alt") || r?.getAttribute("alt")), a = this.linkText(e), o = T(e.dataset.caption) || i || a || T(e.getAttribute("title")) || "Image";
397
+ let n = e.getAttribute("href") ?? "", r = e.querySelector("img"), i = O(r?.getAttribute("data-uvalib-alt") || r?.getAttribute("alt")), a = this.linkText(e), o = O(e.dataset.caption) || i || a || O(e.getAttribute("title")) || "Image", s = O(e.dataset.id) || e.id || w(n, this.base) || String(t + 1);
376
398
  return {
377
399
  el: e,
378
- id: T(e.dataset.id) || e.id || y(n, this.base) || String(t + 1),
400
+ id: s,
379
401
  href: n,
380
402
  caption: o,
381
403
  alt: i || o,
382
- detailsId: T(e.dataset.detailsId) || null
404
+ detailsId: O(e.dataset.detailsId) || null,
405
+ regions: this.regionsOf(e, s, n, t),
406
+ imageWidth: D(e.dataset.imageWidth),
407
+ imageHeight: D(e.dataset.imageHeight)
383
408
  };
384
409
  }
410
+ regionsOf(e, t, n, r) {
411
+ let i = p(e.dataset.regions);
412
+ if (typeof this.regions == "function") {
413
+ let a;
414
+ try {
415
+ a = this.regions({
416
+ element: e,
417
+ id: t,
418
+ href: n,
419
+ index: r
420
+ });
421
+ } catch (e) {
422
+ console.warn(`${this.localName}: the regions callback threw.`, e);
423
+ }
424
+ if (Array.isArray(a)) for (let e of a) {
425
+ let t = f(e);
426
+ t && i.push(t);
427
+ }
428
+ }
429
+ return i;
430
+ }
385
431
  linkText(e) {
386
432
  let t = [], n = (e) => {
387
- e instanceof HTMLImageElement || e instanceof HTMLElement && (e.hidden || e.getAttribute("slot") === "details") || (e.nodeType === Node.TEXT_NODE ? t.push(e.textContent ?? "") : e.childNodes.forEach(n));
433
+ 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));
388
434
  };
389
- return e.childNodes.forEach(n), T(t.join(" "));
435
+ return e.childNodes.forEach(n), O(t.join(" "));
390
436
  }
391
437
  get current() {
392
438
  return this.slides[this.index];
@@ -396,12 +442,12 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
396
442
  }
397
443
  get displaySrc() {
398
444
  let e = this.current?.href ?? "";
399
- if (!x(e, this.base)) return "";
400
- let t = this.fitW || b(window).w, n = this.fitH || b(window).h;
401
- return v(e, this.base, t, n) ?? e;
445
+ if (!E(e, this.base)) return "";
446
+ let t = this.fitW || T(window).w, n = this.fitH || T(window).h;
447
+ return C(e, this.base, t, n) ?? e;
402
448
  }
403
449
  measure() {
404
- let { w: e, h: t } = b(window);
450
+ let { w: e, h: t } = T(window);
405
451
  e !== this.fitW && (this.fitW = e), t !== this.fitH && (this.fitH = t);
406
452
  }
407
453
  linkFrom(e) {
@@ -417,8 +463,8 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
417
463
  slides: t
418
464
  };
419
465
  else if (this.urlParam) {
420
- let r = t[e]?.id ?? null, i = S(location.hash);
421
- n ? this.writeParam(r, "replace", i) : (C(this.loc(), this.urlParam) && this.writeParam(null, "replace", i), this.historyPushed = this.writeParam(r, "push", i));
466
+ let r = t[e]?.id ?? null, i = h(location.hash);
467
+ n ? this.writeParam(r, "replace", i) : (m(this.loc(), this.urlParam) && this.writeParam(null, "replace", i), this.historyPushed = this.writeParam(r, "push", i));
422
468
  }
423
469
  u(this, [
424
470
  "uvalib-lightbox",
@@ -430,12 +476,12 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
430
476
  }
431
477
  openFromUrl() {
432
478
  if (this.open || this.userClosed || !this.urlParam) return;
433
- let e = C(this.loc(), this.urlParam);
479
+ let e = m(this.loc(), this.urlParam);
434
480
  if (!e) return;
435
481
  let t = this.slides.length ? this.slides : this.collect(), n = t.findIndex((t) => t.id === e);
436
482
  if (n < 0) return;
437
483
  this.slides = t, this.index = n, this.trigger = t[n]?.el ?? null, this.measure();
438
- let r = S(location.hash);
484
+ let r = h(location.hash);
439
485
  this.writeParam(null, "replace", r), this.historyPushed = this.writeParam(e, "push", r), this.open = !0;
440
486
  }
441
487
  step(e) {
@@ -458,7 +504,7 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
458
504
  this.dismissing = !0;
459
505
  try {
460
506
  let n = this.historyPushed;
461
- 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 = S(location.hash), this.pendingBack = !0, history.back()) : this.writeParam(null, "replace", S(location.hash)) : e === "empty" && this.urlParam && (this.pendingBack = !1, this.queuedOpen = null, this.writeParam(null, "replace", S(location.hash)));
507
+ 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)));
462
508
  } finally {
463
509
  this.dismissing = !1;
464
510
  }
@@ -466,7 +512,7 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
466
512
  }
467
513
  writeParam(e, t, n) {
468
514
  if (!this.urlParam) return !1;
469
- let r = w(this.loc(), this.urlParam, e, n);
515
+ let r = g(this.loc(), this.urlParam, e, n);
470
516
  if (r === location.pathname + location.search + location.hash) return !1;
471
517
  let i = history.state && typeof history.state == "object" ? history.state : {};
472
518
  try {
@@ -606,8 +652,30 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
606
652
  get statusText() {
607
653
  return this.open ? this.status === "loading" ? "Loading image." : this.status === "error" ? "This image could not be loaded." : "" : "";
608
654
  }
655
+ renderImage(e, t, n) {
656
+ let i = r`<img
657
+ part="image"
658
+ slot=${n ? "image" : o}
659
+ alt=${e.alt}
660
+ src=${t}
661
+ aria-busy=${this.status === "loading" ? "true" : "false"}
662
+ @load=${this.onLoad}
663
+ @error=${this.onError}
664
+ />`;
665
+ return n ? r`<uvalib-image-regions
666
+ class="regions"
667
+ part="regions"
668
+ .items=${n}
669
+ label=${O(this.regionsLabel) || "Regions"}
670
+ image-width=${e.imageWidth ?? o}
671
+ image-height=${e.imageHeight ?? o}
672
+ ?hide-outlines=${!this.showRegions}
673
+ ?no-style=${this.noStyle}
674
+ >${i}</uvalib-image-regions
675
+ >` : i;
676
+ }
609
677
  render() {
610
- let e = this.open ? this.current : void 0, t = e ? this.displaySrc : "", n = e && x(e.href, this.base) ? e.href : "", i = this.statusText, a = this.multiple ? r`<p class="count" aria-live="polite">${this.index + 1} of ${this.slides.length}</p>` : o;
678
+ let e = this.open ? this.current : void 0, t = e ? this.displaySrc : "", n = e && E(e.href, this.base) ? e.href : "", i = this.statusText, a = e?.regions.length ? e.regions : null, s = this.multiple ? r`<p class="count" aria-live="polite">${this.index + 1} of ${this.slides.length}</p>` : o;
611
679
  return r`
612
680
  ${this.isLight ? o : r`<slot></slot><slot name="details" hidden></slot>`}
613
681
  <dialog
@@ -624,23 +692,22 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
624
692
  Close
625
693
  </button>
626
694
  </div>
627
- <figure class="figure">
628
- ${t ? r`<img
629
- part="image"
630
- alt=${e?.alt ?? ""}
631
- src=${t}
632
- aria-busy=${this.status === "loading" ? "true" : "false"}
633
- @load=${this.onLoad}
634
- @error=${this.onError}
635
- />` : o}
636
- </figure>
695
+ <figure class="figure">${t ? this.renderImage(e, t, a) : o}</figure>
637
696
  <p class="status ${i ? "" : "visually-hidden"}" role="status">${i}</p>
638
697
  <div class="toolbar" part="controls">
698
+ ${a && t ? r`<button
699
+ type="button"
700
+ class="regions-toggle"
701
+ aria-pressed=${this.showRegions ? "true" : "false"}
702
+ @click=${this.toggleRegions}
703
+ >
704
+ Show regions
705
+ </button>` : o}
639
706
  ${this.multiple ? r`<button type="button" class="prev" @click=${() => this.step(-1)}>
640
707
  Previous
641
708
  </button>
642
709
  <button type="button" class="next" @click=${() => this.step(1)}>Next</button>
643
- ${a}` : o}
710
+ ${s}` : o}
644
711
  ${n ? r`<a
645
712
  class="full"
646
713
  href=${n}
@@ -657,6 +724,6 @@ var T = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), E = (e) => `
657
724
  }
658
725
  };
659
726
  // src/components/uvalib-lightbox/uvalib-lightbox.ts
660
- a([e({ type: String })], k.prototype, "selector", void 0), a([e({ attribute: "url-param" })], k.prototype, "urlParam", void 0), a([n()], k.prototype, "slides", void 0), a([n()], k.prototype, "index", void 0), a([n()], k.prototype, "open", void 0), a([n()], k.prototype, "status", void 0), a([n()], k.prototype, "fitW", void 0), a([n()], k.prototype, "fitH", void 0), i("uvalib-lightbox", k);
727
+ a([e({ type: String })], P.prototype, "selector", void 0), a([e({ attribute: "url-param" })], P.prototype, "urlParam", void 0), a([e({ attribute: !1 })], P.prototype, "regions", void 0), a([e({ attribute: "regions-label" })], P.prototype, "regionsLabel", void 0), a([n()], P.prototype, "slides", void 0), a([n()], P.prototype, "index", void 0), a([n()], P.prototype, "open", void 0), a([n()], P.prototype, "status", void 0), a([n()], P.prototype, "fitW", void 0), a([n()], P.prototype, "fitH", void 0), a([n()], P.prototype, "showRegions", void 0), i("uvalib-lightbox", P);
661
728
 
662
729
  //# sourceMappingURL=uvalib-lightbox.js.map