@uvalib/web-components 1.2.0 → 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 (200) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +808 -46
  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.css +286 -14
  17. package/dist/base.d.ts +2 -0
  18. package/dist/base.js +1 -0
  19. package/dist/base.js.map +1 -1
  20. package/dist/components/site-analytics/SiteAnalytics.d.ts +20 -1
  21. package/dist/components/site-analytics/SiteAnalytics.js +93 -12
  22. package/dist/components/site-analytics/SiteAnalytics.js.map +1 -1
  23. package/dist/components/site-page/SitePage.d.ts +23 -0
  24. package/dist/components/site-page/SitePage.js +77 -0
  25. package/dist/components/site-page/SitePage.js.map +1 -1
  26. package/dist/components/uvalib-back-to-top/UvalibBackToTop.d.ts +58 -0
  27. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js +250 -0
  28. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js.map +1 -0
  29. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts +1 -0
  30. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js +4 -0
  31. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js.map +1 -0
  32. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.d.ts +14 -0
  33. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js +56 -4
  34. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js.map +1 -1
  35. package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +25 -3
  36. package/dist/components/uvalib-chip-group/UvalibChipGroup.js +80 -10
  37. package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -1
  38. package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +212 -0
  39. package/dist/components/uvalib-combobox/UvalibCombobox.js +1088 -0
  40. package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -0
  41. package/dist/components/uvalib-combobox/uvalib-combobox.d.ts +1 -0
  42. package/dist/components/uvalib-combobox/uvalib-combobox.js +4 -0
  43. package/dist/components/uvalib-combobox/uvalib-combobox.js.map +1 -0
  44. package/dist/components/uvalib-contents/UvalibContents.d.ts +53 -0
  45. package/dist/components/uvalib-contents/UvalibContents.js +202 -3
  46. package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
  47. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +56 -17
  48. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +285 -81
  49. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -1
  50. package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +6 -0
  51. package/dist/components/uvalib-date-range/UvalibDateRange.js +23 -0
  52. package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -1
  53. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +113 -0
  54. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +589 -0
  55. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -0
  56. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.d.ts +1 -0
  57. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js +4 -0
  58. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js.map +1 -0
  59. package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +130 -0
  60. package/dist/components/uvalib-image-regions/UvalibImageRegions.js +658 -0
  61. package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -0
  62. package/dist/components/uvalib-image-regions/regions.d.ts +57 -0
  63. package/dist/components/uvalib-image-regions/regions.js +117 -0
  64. package/dist/components/uvalib-image-regions/regions.js.map +1 -0
  65. package/dist/components/uvalib-image-regions/uvalib-image-regions.d.ts +1 -0
  66. package/dist/components/uvalib-image-regions/uvalib-image-regions.js +4 -0
  67. package/dist/components/uvalib-image-regions/uvalib-image-regions.js.map +1 -0
  68. package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +40 -0
  69. package/dist/components/uvalib-lightbox/UvalibLightbox.js +144 -16
  70. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  71. package/dist/components/uvalib-map/UvalibMap.d.ts +182 -0
  72. package/dist/components/uvalib-map/UvalibMap.js +1001 -0
  73. package/dist/components/uvalib-map/UvalibMap.js.map +1 -0
  74. package/dist/components/uvalib-map/uvalib-map.d.ts +1 -0
  75. package/dist/components/uvalib-map/uvalib-map.js +4 -0
  76. package/dist/components/uvalib-map/uvalib-map.js.map +1 -0
  77. package/dist/components/uvalib-metadata/UvalibMetadata.d.ts +39 -2
  78. package/dist/components/uvalib-metadata/UvalibMetadata.js +214 -8
  79. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  80. package/dist/components/uvalib-pager/UvalibPager.d.ts +22 -3
  81. package/dist/components/uvalib-pager/UvalibPager.js +42 -4
  82. package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
  83. package/dist/custom-elements.json +9253 -3253
  84. package/dist/index.d.ts +8 -0
  85. package/dist/index.js +5 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/pagefind.css +4 -0
  88. package/dist/styles/base.js +119 -0
  89. package/dist/styles/base.js.map +1 -1
  90. package/dist/styles/color-scheme.js +5 -0
  91. package/dist/styles/color-scheme.js.map +1 -1
  92. package/dist/styles/controls.js +6 -0
  93. package/dist/styles/controls.js.map +1 -1
  94. package/dist/styles/hidden.d.ts +2 -0
  95. package/dist/styles/hidden.js +51 -0
  96. package/dist/styles/hidden.js.map +1 -0
  97. package/dist/styles/message.d.ts +1 -0
  98. package/dist/styles/message.js +82 -0
  99. package/dist/styles/message.js.map +1 -0
  100. package/dist/styles/pagefind.js +4 -0
  101. package/dist/styles/pagefind.js.map +1 -1
  102. package/dist/styles/result-list.d.ts +1 -0
  103. package/dist/styles/result-list.js +111 -0
  104. package/dist/styles/result-list.js.map +1 -0
  105. package/dist/styles/results.js +0 -15
  106. package/dist/styles/results.js.map +1 -1
  107. package/dist/testing/index.d.ts +110 -0
  108. package/dist/testing/index.js +100 -0
  109. package/dist/testing/index.js.map +1 -0
  110. package/dist/testing/lighthouse-rules.d.ts +10 -0
  111. package/dist/testing/lighthouse-rules.js +44 -0
  112. package/dist/testing/lighthouse-rules.js.map +1 -0
  113. package/dist/tokens.css +5 -0
  114. package/dist-cdn/analytics.js +32 -0
  115. package/dist-cdn/analytics.js.map +1 -0
  116. package/dist-cdn/base.css +286 -14
  117. package/dist-cdn/bento-box.js +3 -3
  118. package/dist-cdn/chunks/{SiteAnalytics-Cm-FyhYS.js → SiteAnalytics-B9gu5aGO.js} +59 -30
  119. package/dist-cdn/chunks/SiteAnalytics-B9gu5aGO.js.map +1 -0
  120. package/dist-cdn/chunks/{UvalibElement-BnI-eRRR.js → UvalibElement-pGONDAwB.js} +108 -101
  121. package/dist-cdn/chunks/UvalibElement-pGONDAwB.js.map +1 -0
  122. package/dist-cdn/chunks/{accessible-GqhVn5_H.js → accessible-DJv7YOtS.js} +2 -2
  123. package/dist-cdn/chunks/{accessible-GqhVn5_H.js.map → accessible-DJv7YOtS.js.map} +1 -1
  124. package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js.map +1 -1
  125. package/dist-cdn/chunks/{base-p5pk0vb2.js → base-BI8h0Gf3.js} +121 -2
  126. package/dist-cdn/chunks/base-BI8h0Gf3.js.map +1 -0
  127. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js → library-weekly-hours-CrV3TlP5.js} +3 -3
  128. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js.map → library-weekly-hours-CrV3TlP5.js.map} +1 -1
  129. package/dist-cdn/chunks/regions-B8ExwUGP.js +86 -0
  130. package/dist-cdn/chunks/regions-B8ExwUGP.js.map +1 -0
  131. package/dist-cdn/chunks/{repeat-CIFUYkyh.js → repeat-m5Zd_QeP.js} +2 -2
  132. package/dist-cdn/chunks/{repeat-CIFUYkyh.js.map → repeat-m5Zd_QeP.js.map} +1 -1
  133. package/dist-cdn/chunks/{site-header-BlOYvQg1.js → site-header-DYRMpdBj.js} +9 -4
  134. package/dist-cdn/chunks/{site-header-BlOYvQg1.js.map → site-header-DYRMpdBj.js.map} +1 -1
  135. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js → site-main-nav-DURrQMal.js} +3 -3
  136. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js.map → site-main-nav-DURrQMal.js.map} +1 -1
  137. package/dist-cdn/chunks/{static-html-1mTAG6nS.js → static-html-C1rhtCHu.js} +2 -2
  138. package/dist-cdn/chunks/{static-html-1mTAG6nS.js.map → static-html-C1rhtCHu.js.map} +1 -1
  139. package/dist-cdn/custom-elements.json +9253 -3253
  140. package/dist-cdn/events-section.js +3 -3
  141. package/dist-cdn/library-hours-setup.js +2 -2
  142. package/dist-cdn/library-weekly-hours.js +1 -1
  143. package/dist-cdn/manifest.json +10 -2
  144. package/dist-cdn/pagefind.css +4 -0
  145. package/dist-cdn/site-alerts.js +4 -4
  146. package/dist-cdn/site-analytics.js +2 -2
  147. package/dist-cdn/site-footer.js +2 -2
  148. package/dist-cdn/site-header.js +1 -1
  149. package/dist-cdn/site-hours-section.js +4 -4
  150. package/dist-cdn/site-main-nav.js +1 -1
  151. package/dist-cdn/site-page.js +56 -11
  152. package/dist-cdn/site-page.js.map +1 -1
  153. package/dist-cdn/site-style.js +2 -2
  154. package/dist-cdn/skills/uvalib-web-components/SKILL.md +98 -13
  155. package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  156. package/dist-cdn/skills/uvalib-web-components/reference/components.md +300 -13
  157. package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +1 -1
  158. package/dist-cdn/tokens.css +5 -0
  159. package/dist-cdn/uvalib-analytics.js +2 -2
  160. package/dist-cdn/uvalib-back-to-top.js +156 -0
  161. package/dist-cdn/uvalib-back-to-top.js.map +1 -0
  162. package/dist-cdn/uvalib-breadcrumbs.js +31 -11
  163. package/dist-cdn/uvalib-breadcrumbs.js.map +1 -1
  164. package/dist-cdn/uvalib-card-grid.js +1 -1
  165. package/dist-cdn/uvalib-card.js +3 -3
  166. package/dist-cdn/uvalib-chip-group.js +53 -14
  167. package/dist-cdn/uvalib-chip-group.js.map +1 -1
  168. package/dist-cdn/uvalib-combobox.js +667 -0
  169. package/dist-cdn/uvalib-combobox.js.map +1 -0
  170. package/dist-cdn/uvalib-contents.js +100 -22
  171. package/dist-cdn/uvalib-contents.js.map +1 -1
  172. package/dist-cdn/uvalib-date-histogram.js +237 -127
  173. package/dist-cdn/uvalib-date-histogram.js.map +1 -1
  174. package/dist-cdn/uvalib-date-range.js +14 -2
  175. package/dist-cdn/uvalib-date-range.js.map +1 -1
  176. package/dist-cdn/uvalib-filter-drawer.js +355 -0
  177. package/dist-cdn/uvalib-filter-drawer.js.map +1 -0
  178. package/dist-cdn/uvalib-filter.js +3 -3
  179. package/dist-cdn/uvalib-image-regions.js +447 -0
  180. package/dist-cdn/uvalib-image-regions.js.map +1 -0
  181. package/dist-cdn/uvalib-lightbox.js +144 -55
  182. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  183. package/dist-cdn/uvalib-map.js +471 -0
  184. package/dist-cdn/uvalib-map.js.map +1 -0
  185. package/dist-cdn/uvalib-metadata.js +150 -24
  186. package/dist-cdn/uvalib-metadata.js.map +1 -1
  187. package/dist-cdn/uvalib-pager.js +29 -17
  188. package/dist-cdn/uvalib-pager.js.map +1 -1
  189. package/dist-cdn/uvalib-photo-grid.js +2 -2
  190. package/dist-cdn/uvalib-results-count.js +2 -2
  191. package/dist-cdn/uvalib-tabs.js +2 -2
  192. package/dist-cdn/uvalib-tag-list.js +2 -2
  193. package/package.json +43 -1
  194. package/skills/uvalib-web-components/SKILL.md +98 -13
  195. package/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  196. package/skills/uvalib-web-components/reference/components.md +300 -13
  197. package/skills/uvalib-web-components/reference/snippets.md +1 -1
  198. package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js.map +0 -1
  199. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +0 -1
  200. package/dist-cdn/chunks/base-p5pk0vb2.js.map +0 -1
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: uvalib-web-components
3
- description: Use when building or editing UVA Library web pages or sites with @uvalib/web-components: the header, footer, page wrapper and other page chrome (<site-page>, <site-header>, <site-main-nav>, <site-footer>, <site-alerts>, <site-analytics>/<uvalib-analytics>, <site-style>), and other uvalib-* components (breadcrumbs, cards, pager, tabs, contents, metadata, chips, tags, results count, filter, date range, date histogram, lightbox, photo grid, Pagefind search), the library hours, events and bento-box elements (e.g. <uvalib-card>, <uvalib-chip-group>, <library-weekly-hours>), base.css classes, or script/link URLs on unpkg.internal.lib.virginia.edu (incl. migrating old /web-components/latest/ or cdn-v URLs). Covers CDN vs npm, version pinning, shadow vs light DOM, theming with --uva-* tokens, WCAG 2.2 AA accessibility testing, requesting components via GitHub issues, and a verification checklist.
3
+ description: Use when building or editing UVA Library web pages or sites with @uvalib/web-components: the header, footer, page wrapper and other page chrome (<site-page>, <site-header>, <site-main-nav>, <site-footer>, <site-alerts>, <site-analytics>/<uvalib-analytics>, <site-style>), and other uvalib-* components (breadcrumbs, cards, pager, tabs, contents, metadata, chips, tags, results count, filter, filter drawer, date range, date histogram, combobox, map (Leaflet), lightbox, photo grid, image regions, back to top, Pagefind search), the library hours, events and bento-box elements (e.g. <uvalib-card>, <uvalib-chip-group>, <library-weekly-hours>), base.css classes, or script/link URLs on unpkg.internal.lib.virginia.edu (incl. migrating old /web-components/latest/ or cdn-v URLs). Covers CDN vs npm, version pinning, shadow vs light DOM, theming with --uva-* tokens, WCAG 2.2 AA accessibility testing, requesting components via GitHub issues, and a verification checklist.
4
4
  ---
5
5
 
6
6
  # UVA Library web components
7
7
 
8
- `@uvalib/web-components` provides the UVA Library page chrome as custom elements: `<site-page>` (skip link, header with the library main navigation, one `<main>`, footer), `<site-header>`, `<site-main-nav>` (the main navigation, rendered by the header), `<site-footer>`, `<site-analytics>` (Matomo; also registered as `<uvalib-analytics>`) and `<site-style>` (legacy compatibility), plus `<uvalib-breadcrumbs>` (the breadcrumb trail), `<uvalib-contents>` (sub-navigation or a table of contents) and `<uvalib-metadata>` (a record's details, credit, rights and how to cite), all in section 2, `<uvalib-card>`, `<uvalib-card-grid>` and `<uvalib-pager>` (cards and paging, section 5), `<uvalib-tabs>` (tabbed panels) and `<site-alerts>` (the live library alerts, which `<site-page>` shows itself). It also ships search-page components, `<uvalib-filter>`, `<uvalib-date-range>` and `<uvalib-date-histogram>`, and `<uvalib-chip-group>` for segmented controls, filter chips and suggestion chips (section 6), and three library-hours elements for library.virginia.edu, `<site-hours-section>`, `<library-weekly-hours>` and `<library-hours-setup>`, `<events-section>` for upcoming library events and `<bento-box>` for the library's search results page (section 7), and `pagefind.css` with `<uvalib-pagefind-search>` for a static site's Pagefind search, and `<uvalib-tag-list>`, `<uvalib-results-count>` and `base.css`'s badge, toolbar, empty-state and skeleton classes for results lists (section 6), and `<uvalib-lightbox>` and `<uvalib-photo-grid>` for images (section 8). Tag names are stable.
8
+ `@uvalib/web-components` provides the UVA Library page chrome as custom elements: `<site-page>` (skip link, header with the library main navigation, one `<main>`, footer), `<site-header>`, `<site-main-nav>` (the main navigation, rendered by the header), `<site-footer>`, `<site-analytics>` (Matomo; also registered as `<uvalib-analytics>`) and `<site-style>` (legacy compatibility), plus `<uvalib-breadcrumbs>` (the breadcrumb trail), `<uvalib-contents>` (sub-navigation or a table of contents) and `<uvalib-metadata>` (a record's details, credit, rights and how to cite), all in section 2, `<uvalib-card>`, `<uvalib-card-grid>` and `<uvalib-pager>` (cards and paging, section 5), `<uvalib-tabs>` (tabbed panels), `<uvalib-back-to-top>` (a back-to-top button for long pages) and `<site-alerts>` (the live library alerts, which `<site-page>` shows itself). It also ships search-page components, `<uvalib-filter>`, `<uvalib-date-range>` and `<uvalib-date-histogram>`, `<uvalib-chip-group>` for segmented controls, filter chips and suggestion chips, `<uvalib-combobox>`, a text field that suggests values as you type, and `<uvalib-filter-drawer>`, the filters as a sidebar or a modal panel on phones (section 6), and three library-hours elements for library.virginia.edu, `<site-hours-section>`, `<library-weekly-hours>` and `<library-hours-setup>`, `<events-section>` for upcoming library events and `<bento-box>` for the library's search results page (section 7), and `pagefind.css` with `<uvalib-pagefind-search>` for a static site's Pagefind search, and `<uvalib-tag-list>`, `<uvalib-results-count>` and `base.css`'s badge, toolbar, empty-state and skeleton classes for results lists (section 6), and `<uvalib-lightbox>`, `<uvalib-photo-grid>` and `<uvalib-image-regions>` for images and `<uvalib-map>` for a map of places over the page's own Leaflet, with a linked list (section 8). Tag names are stable.
9
9
 
10
10
  Authority rule: https://www.library.virginia.edu and the UVA Library design system are the source of truth for how the chrome looks and what it says. Do not re-create, copy or restyle the header, footer, logo or links by hand. Use the components, and change appearance only through the theming surface below.
11
11
 
@@ -31,7 +31,7 @@ Loading rules:
31
31
 
32
32
  - One script is enough for the page chrome: `site-page.js` also loads the header (with its main navigation) and footer. For Matomo, give `<site-page>` a `matomo-id` (it loads the analytics code itself), or add `site-analytics.js` and a `<site-analytics>` (or `uvalib-analytics.js` and `<uvalib-analytics>`) element; never both, and never alongside a hand-written Matomo snippet.
33
33
  - Also link `.../v1/base.css` in `<head>` (npm: `@uvalib/web-components/base.css`), unless the page sets `no-global-styles`. `<site-page>` installs the same base styles only after the first paint, so without the link the page shifts once (the default body margin goes away, and a heading's margin stops collapsing through the not-yet-defined `<site-page>`). The link also keeps `<site-page>` invisible until it is defined, with a two-second fallback.
34
- - npm: the define entries (`@uvalib/web-components/site-page.js`, `site-header.js`, `site-main-nav.js`, `site-footer.js`, `site-analytics.js`, `uvalib-analytics.js`, `site-style.js`, `uvalib-breadcrumbs.js`, `uvalib-card.js`, `uvalib-card-grid.js`, `uvalib-pager.js`, `uvalib-contents.js`, `uvalib-metadata.js`, `site-alerts.js`, `uvalib-filter.js`, `uvalib-date-range.js`, `uvalib-date-histogram.js`, `site-hours-section.js`, `library-weekly-hours.js`, `library-hours-setup.js`, `events-section.js`, `bento-box.js`, `uvalib-pagefind-search.js`, `uvalib-lightbox.js`, `uvalib-photo-grid.js`, `uvalib-tabs.js`, `uvalib-chip-group.js`, `uvalib-tag-list.js`, `uvalib-results-count.js`) register the element (`bento-box.js` also registers its four sections, `<catalog-section>`, `<articles-section>`, `<libguides-section>` and `<website-section>`). Importing the package root (`@uvalib/web-components`) gives the classes only and registers nothing. If you use the `SitePage` class directly, also import the header and footer define entries.
34
+ - npm: the define entries (`@uvalib/web-components/site-page.js`, `site-header.js`, `site-main-nav.js`, `site-footer.js`, `site-analytics.js`, `uvalib-analytics.js`, `site-style.js`, `uvalib-breadcrumbs.js`, `uvalib-card.js`, `uvalib-card-grid.js`, `uvalib-pager.js`, `uvalib-contents.js`, `uvalib-metadata.js`, `site-alerts.js`, `uvalib-filter.js`, `uvalib-date-range.js`, `uvalib-date-histogram.js`, `site-hours-section.js`, `library-weekly-hours.js`, `library-hours-setup.js`, `events-section.js`, `bento-box.js`, `uvalib-pagefind-search.js`, `uvalib-lightbox.js`, `uvalib-photo-grid.js`, `uvalib-tabs.js`, `uvalib-chip-group.js`, `uvalib-tag-list.js`, `uvalib-results-count.js`, `uvalib-combobox.js`, `uvalib-image-regions.js`, `uvalib-map.js`, `uvalib-filter-drawer.js`, `uvalib-back-to-top.js`) register the element (`bento-box.js` also registers its four sections, `<catalog-section>`, `<articles-section>`, `<libguides-section>` and `<website-section>`). Importing the package root (`@uvalib/web-components`) gives the classes only and registers nothing. If you use the `SitePage` class directly, also import the header and footer define entries.
35
35
  - Do not load the same component from both the CDN and npm on one page.
36
36
 
37
37
  ## 2. Required page structure
@@ -39,10 +39,11 @@ Loading rules:
39
39
  - Exactly one `<site-page>` per page, wrapping all page content.
40
40
  - `<site-page>` renders the one skip link, the header, one `<main id="main-content">` and the footer. Never add your own `<main>`, skip link, `<header>`/`<footer>` site chrome, or `role="main"`. If the page already has them, remove them and keep only the content that was inside `<main>`.
41
41
  - Sidebars and article content go inside `<site-page>` as ordinary elements (use `<nav aria-label="...">` for navigation, no ARIA menu roles).
42
- - Breadcrumbs: a `<uvalib-breadcrumbs slot="breadcrumbs">` (from `uvalib-breadcrumbs.js`) inside `<site-page>`, never a hand-built trail. Its children are `<a href>` links ending with the current page (`<span>Title</span>`, or `<a href aria-current="page">`); apps can set its `items` property (`[{ label, href? }]`) instead. `<site-page>` places it between the header and `<main>`, outside `<main>`. Outside `<site-page>` it goes first in the content, above the `<h1>`. In a single-page app with history routing, listen for `uvalib-breadcrumbs-navigate` and call `preventDefault()` to route in place (hash links need nothing).
43
- - Cards and paging: a collection or photo is a `<uvalib-card>` (`uvalib-card.js`), inside `<uvalib-card-grid>` (`uvalib-card-grid.js`) when there are several. `href` makes the heading the one link for the whole card: never wrap the card in an `<a>`, and do not put another link, button or other control inside a clickable card. The heading needs an accessible name, or the link is hidden. A card with no `href` may contain its own links, including an `actions` slot row (“Read the story”, “Photos (132)”). Do not put that row in a clickable card: the card link covers it, and the component warns. `media-shape="circle"` draws a person or avatar as a circle and keeps the image alt; the count badge still sits on it. An image needs a real alt, or `alt=""` when the heading already names it. Previous/next sections, numbered pages, or `mode="load-more"` (a Load more button and “Showing N of M”) are one `<uvalib-pager>` (`uvalib-pager.js`); a second pager on the same page needs its own `label`. Load more fires `load-more` (`detail: { page }`, the next page). Call `loaded(firstNew)`, or set `for` to the list id and call `loaded()`, so focus moves to the new item. `<uvalib-tabs>` (`uvalib-tabs.js`) is a tab set: each child with `data-tab` is a panel, or pair `<button slot="tab">` with panels. Arrow keys move, Home and End jump, and `activation="manual"` waits for Enter or Space. `url-param` (or `url-param="hash"`) makes the selected tab linkable and Back restores it. In a single-page app, listen for `uvalib-card-navigate` and `uvalib-pager-navigate` and call `preventDefault()` to route in place.
44
- - Sub-navigation and tables of contents: a `<uvalib-contents>` (from `uvalib-contents.js`) holding one `<ol>`/`<ul>` of `<li><a href>` entries, nested lists for sub-entries (plain text in an `<li>` for a group label), never a hand-built `<nav>` list or `<details>` for it. It is the `<nav>` landmark (named and headed by `label`, default "Contents"; set `heading-level` to fit the outline) and marks the current page (`aria-current="page"`) and in-page section (`"location"`, from the hash) itself: do not add `aria-current` by hand unless the route is not the URL, and then prefer `current="<url>"`. It collapses into a disclosure button at 64rem and below (`collapse-below`), closed until opened. In a sidebar add `sticky`. Apps can set `items` (`[{ label, href?, children? }]`); with history routing, cancel `uvalib-contents-navigate` to route in place.
45
- - Record details: a `<uvalib-metadata>` (from `uvalib-metadata.js`) around a plain `<dl>` (`<dt>` label, `<dd>` values; lists such as subjects as a `<ul>` in the `<dd>`). Downloads are `<a href download data-size="184 KB">EPUB</a>`. For credit and rights use its attributes, not your own rows: `creator`, `organization`, `rights` (a rightsstatements.org or Creative Commons URL; it shows the short name), `rights-info` (`https://www.library.virginia.edu/policies/use-of-materials`) and `citation` or `citation-title` (the Special Collections citation "<title>, Albert and Shirley Small Special Collections Library, University of Virginia"), which adds a Copy citation button. Do not add icons from rightsstatements.org or creativecommons.org.
42
+ - Breadcrumbs: a `<uvalib-breadcrumbs slot="breadcrumbs">` (from `uvalib-breadcrumbs.js`) inside `<site-page>`, never a hand-built trail. Its children are `<a href>` links ending with the current page (`<span>Title</span>`, or `<a href aria-current="page">`); apps can set its `items` property (`[{ label, href? }]`) instead. `<site-page>` places it between the header and `<main>`, outside `<main>`. Outside `<site-page>` it goes first in the content, above the `<h1>`. To return to the search the visitor came from, give that crumb `data-return-from="<search path>"` (it links to the same-origin referrer when it is that path with a query), never an inline script. In a single-page app with history routing, listen for `uvalib-breadcrumbs-navigate` and call `preventDefault()` to route in place (hash links need nothing).
43
+ - Cards and paging: a collection or photo is a `<uvalib-card>` (`uvalib-card.js`), inside `<uvalib-card-grid>` (`uvalib-card-grid.js`) when there are several. `href` makes the heading the one link for the whole card: never wrap the card in an `<a>`, and do not put another link, button or other control inside a clickable card. The heading needs an accessible name, or the link is hidden. A card with no `href` may contain its own links, including an `actions` slot row (“Read the story”, “Photos (132)”). Do not put that row in a clickable card: the card link covers it, and the component warns. `media-shape="circle"` draws a person or avatar as a circle and keeps the image alt; the count badge still sits on it. An image needs a real alt, or `alt=""` when the heading already names it. Previous/next sections, numbered pages, or `mode="load-more"` (a Load more button and “Showing N of M”, or “Showing N” with no `total`; with an unknown total add `has-more` and remove it, or set `hasMore = false`, after the last page) are one `<uvalib-pager>` (`uvalib-pager.js`); a second pager on the same page needs its own `label`. Load more fires `load-more` (`detail: { page }`, the next page). Call `loaded(firstNew)`, or set `for` to the list id and call `loaded()`, so focus moves to the new item. `<uvalib-tabs>` (`uvalib-tabs.js`) is a tab set: each child with `data-tab` is a panel, or pair `<button slot="tab">` with panels. Arrow keys move, Home and End jump, and `activation="manual"` waits for Enter or Space. `url-param` (or `url-param="hash"`) makes the selected tab linkable and Back restores it. In a single-page app, listen for `uvalib-card-navigate` and `uvalib-pager-navigate` and call `preventDefault()` to route in place.
44
+ - Sub-navigation and tables of contents: a `<uvalib-contents>` (from `uvalib-contents.js`) holding one `<ol>`/`<ul>` of `<li><a href>` entries, nested lists for sub-entries (plain text in an `<li>` for a group label), never a hand-built `<nav>` list or `<details>` for it. It is the `<nav>` landmark (named and headed by `label`, default "Contents"; set `heading-level` to fit the outline) and marks the current page (`aria-current="page"`) and in-page section (`"location"`, from the hash) itself: do not add `aria-current` by hand unless the route is not the URL, and then prefer `current="<url>"`. It collapses into a disclosure button at 64rem and below (`collapse-below`), closed until opened. In a sidebar add `sticky`. For a long document's table of contents without a build-time list, `headings-from="#article"` (with `levels="2-3"`, `min`) builds it from the headings and adds ids; a build-time list (children) is better where possible, since it works without JavaScript. Apps can set `items` (`[{ label, href?, children? }]`); with history routing, cancel `uvalib-contents-navigate` to route in place.
45
+ - Record details: a `<uvalib-metadata>` (from `uvalib-metadata.js`) around a plain `<dl>` (`<dt>` label, `<dd>` values; lists such as subjects as a `<ul>` in the `<dd>`). Downloads are `<a href download data-size="184 KB">EPUB</a>`. For credit and rights use its attributes, not your own rows: `creator`, `organization`, `rights` (a rightsstatements.org or Creative Commons URL; it shows the short name), `rights-info` (`https://www.library.virginia.edu/policies/use-of-materials`) and `citation` or `citation-title` (the Special Collections citation "<title>, Albert and Shirley Small Special Collections Library, University of Virginia"), which adds a Copy citation button. A long list (30 participants) gets `list-limit="8"` (or `data-limit` on its `<dd>`), not your own Show more script. Do not add icons from rightsstatements.org or creativecommons.org.
46
+ - Long pages (minutes, finding aids, transcriptions, long result lists): a `<uvalib-back-to-top>` (from `uvalib-back-to-top.js`) last in the content inside `<site-page>`, never a hand-built button and scroll script. It stays hidden (`visibility: hidden`, not a tab stop) until the top 400px (`offset`) scroll away, then floats in the bottom corner; activating it scrolls to the top (smooth unless reduced motion) and moves focus to the page's `<h1>` (or `target`, a selector), adding `tabindex="-1"`. The element keeps 4.75rem of space at the end and the button rests there at the bottom, so it never covers the last lines or the footer: do not add your own padding for it. `label` changes its text. `<site-page>` has no attribute for it. It reports `click` to analytics itself.
46
47
  - Content for a band above the footer: put an element with `slot="pre-footer"` inside `<site-page>`.
47
48
  - `no-footer` on `<site-page>` hides the footer (and any pre-footer band). Use it only for tool or app-like pages, such as a full-screen editor, where the site footer does not belong; normal content pages keep the footer.
48
49
  - A site's own navigation (its home, sections, docs) goes in the header: give `<site-page>` `<a slot="site-links" href="…">` children and a `site-links-label` (see section 5). They replace the library utility links in the header and its Menu popover. Do not add a separate nav row or bar at the top of the content for it. Each must be an `<a href>` with visible text; other children and empty links are ignored with a console warning. Mark the current page with `aria-current="page"`. The `vendor` variant ignores site links: it is for third-party sites that only need the library logo and Ask a Librarian.
@@ -55,6 +56,8 @@ Loading rules:
55
56
  - In light mode the regional `<site-alerts>` is the first child of `<main>`, the banner the first child of the header's `<header>`, and the `section.alerts-list` band (the alert list) sits between `<site-header>` and `<main>`; do not write host CSS like `main > :first-child` or `site-header + *` that assumes your content comes first, and do not restyle the band's full-bleed layout.
56
57
  - A sub-site's name (Electronic Text Collections, an exhibit or project site): `site-name="…"` on `<site-page>` (and `site-name-href` when its home is not `/`). The header shows it after the logo as a link to the site's home; the logo still links to library.virginia.edu. Never add your own banner, title bar or second logo row for it, and never make it the page's `<h1>` (the page keeps its own). Keep it short (two lines at most on wide screens).
57
58
  - Buttons, toggles and search boxes in the page's own content: use `base.css`'s classes, never hand-rolled button CSS: `.uvalib-button` (on `<button>` or `<a>`), `--secondary` (outline), `--subtle`, `--small`, `--large`; a toggle is a `.uvalib-button` with `aria-pressed="true|false"` (flip it in script); fields are `.uvalib-input` with a visible `<label>`, and a search box is `<form class="uvalib-search-form" role="search">` holding the label, the field and a `.uvalib-button` submit. They need `base.css` linked (`<site-page>` does not install them); it carries the dark-mode role tokens they read. Disable with `disabled` (or `aria-disabled="true"` while busy); a pressed toggle is filled whatever its variant.
59
+ - Messages in the page's own content (a search error, a "keyword results only" notice): `<div class="uvalib-message uvalib-message--error" role="alert">` (`--warning`, `--info`/`--notice`, `--success`), starting with the severity in words in `<strong class="uvalib-message__label">Error:</strong>`; `role="alert"` only for an error caused by what the visitor did, `role="status"` for notices. Never hand-rolled alert boxes, and never a `<site-alerts>` for them. `hidden` hides every `base.css` class (`el.hidden = true`); no `[hidden]` reset is needed.
60
+ - Printing: `<site-page>` prints only `<main>` (no header, nav, alerts, breadcrumbs or footer), black on white with underlined links and a "UVA Library — site, URL" line; `print-chrome` keeps the chrome. Do not add print rules for the chrome yourself.
58
61
  - Third-party or vendor sites that are not library.virginia.edu: `<site-page header-variant="vendor">` (logo plus Ask a Librarian only). Links default to `root-link-domain="https://www.library.virginia.edu"`; set it only for a non-production domain.
59
62
  - Do not replace a light-mode page's children wholesale (`innerHTML` or `textContent` on `<site-page>`): that destroys the chrome. Append, or update a child container inside it.
60
63
 
@@ -219,12 +222,16 @@ import '@uvalib/web-components/tokens.css'; // optional: tokens for your own CSS
219
222
  // <site-page> is then used in your HTML or templates exactly as in the plain HTML snippet.
220
223
  ```
221
224
 
222
- Analytics: only when the site needs Matomo, set `<site-page matomo-id="N">`, or add `site-analytics.js` and a `<site-analytics matomoid="N">`; see the analytics page in [reference/snippets.md](reference/snippets.md). `<uvalib-analytics>` (`uvalib-analytics.js`) is the same element under its original name, for existing markup. It listens on `document` for `uvalib-analytics-*` and `site-analytics-*` events (`event`, `search`, `pageview`, `content`) and queues them for Matomo, so events fired before Matomo loads are kept, and a page never counts twice. A single-page app whose router uses `pushState` or hashes can set `spa="auto"` to have each route change counted (after the new title is set, never twice for one URL); bare `spa` means the app sends its own `uvalib-analytics-pageview` events.
225
+ Analytics: only when the site needs Matomo, set `<site-page matomo-id="N">`, or add `site-analytics.js` and a `<site-analytics matomoid="N">` (add `downloads="event"`, or `matomo-downloads="event"` on `<site-page>`, when file URLs carry ids: downloads are then counted as `['download', '<extension>']` events without URLs); see the analytics page in [reference/snippets.md](reference/snippets.md). `<uvalib-analytics>` (`uvalib-analytics.js`) is the same element under its original name, for existing markup. It listens on `document` for `uvalib-analytics-*` and `site-analytics-*` events (`event`, `search`, `pageview`, `content`) and queues them for Matomo, so events fired before Matomo loads are kept, and a page never counts twice. A single-page app whose router uses `pushState` or hashes can set `spa="auto"` to have each route change counted (after the new title is set, never twice for one URL); bare `spa` means the app sends its own `uvalib-analytics-pageview` events.
223
226
 
224
- The library's components already report what visitors do with them; do not add tracking for any of it: header utility and site links, logo, skip link, Menu and colour scheme; main-nav menu opens and links; footer links; breadcrumb and contents levels, the contents disclosure, Copy citation; card clicks (the card's place in its grid, or single); pager next, previous, page numbers and Load more; tab changes (the tab's label); alerts (impressions, dismiss, links, errors); event clicks; See all hours, week changes; filter facets, scopes and See more/less; date-range changes; histogram selections (`<from>–<to>` when both ends are ISO dates, otherwise `other`); bento searches, result and See all clicks, retries; lightbox opens, next, previous and full size (the name is `image N`, never the URL or the caption); load errors; and tag-list clicks and Show all (`list N`, or the label with `track-label`, and the tag's place; never the tag text). `<uvalib-photo-grid>` and `<uvalib-results-count>` report nothing. The README's "Analytics" section has the full table.
227
+ The library's components already report what visitors do with them; do not add tracking for any of it: header utility and site links, logo, skip link, Menu and colour scheme; main-nav menu opens and links; footer links; breadcrumb and contents levels, the contents disclosure, Copy citation; card clicks (the card's place in its grid, or single); pager next, previous, page numbers and Load more; tab changes (the tab's label); alerts (impressions, dismiss, links, errors); event clicks; See all hours, week changes; filter facets, scopes and See more/less; date-range changes; histogram selections (`<from>–<to>` when both ends are ISO dates, otherwise `other`); bento searches, result and See all clicks, retries; lightbox opens, next, previous and full size (the name is `image N`, never the URL or the caption); load errors; and tag-list clicks and Show all (`list N`, or the label with `track-label`, and the tag's place; never the tag text); and combobox choices and clears (the field's label and the suggestion's place; never the typed text or the suggestion); and image-region outline clicks (the list's label and the region's number; never a region's label); and map marker choices and zoom-button presses (the map's label and the place's position or the zoom level; never the place's name, coordinates or URL). `<uvalib-photo-grid>` and `<uvalib-results-count>` report nothing. The README's "Analytics" section has the full table.
225
228
 
226
229
  For the host page's own content, tag the clickable element (or a wrapper) with `data-uvalib-track="category,action[,name[,value]]"` instead of writing a listener, for example `<a href="/spaces" data-uvalib-track="home-page,banner-click,Study spaces">`: the category is your page or widget, the action a fixed kebab-case verb, the name a short fixed label, the value a number. It works inside shadow DOM too. Never put titles, URLs, search text, ids, email addresses, phone numbers or other personal data in events.
227
230
 
231
+ A page with its own search UI (not `<bento-box>` or `<uvalib-pagefind-search>`, which report their own) sends site searches with `createSearchTracker()` from `analytics.js` (CDN `…/web-components/v1/analytics.js`, npm `@uvalib/web-components/analytics.js`), never with hand-written timers or `trackSearch` calls: `typed()` for search-as-you-type (sent after a 1 s pause), `settled()` when a submitted search's results arrive, `restored()` for a query from the URL or Back/Forward (not sent), `cancel()` on a clear or an error; always pass the result `count` (0 included) and a fixed `category`. It never sends the same search twice in a row; see the README's "Analytics".
232
+
233
+ To test a site's pages in Playwright, use `@uvalib/web-components/testing` (npm, dev dependency) rather than copying setup: `strictAxe(page)` with `formatViolations` for accessibility (see [reference/accessibility-testing.md](reference/accessibility-testing.md)), and `stubMatomo(page, { siteId })` with `matomoQueue(page)` to check page views, site searches and events without reaching Matomo.
234
+
228
235
  To opt out: `no-analytics` on an element (or any ancestor) silences it and everything inside; `<html data-uvalib-analytics="off">` turns analytics off for the whole page (no Matomo, no page view, no events). Browsers that send Do Not Track or Global Privacy Control get no Matomo at all, with nothing to configure.
229
236
 
230
237
  A page with a breadcrumb trail (between the header and `<main>`):
@@ -414,8 +421,9 @@ A record page with its metadata and a contents sidebar (the sidebar is an ordina
414
421
  For a search results page that needs a checkbox facet, a date-range picker or date counts as bars, use `<uvalib-filter>`, `<uvalib-date-range>` and `<uvalib-date-histogram>` instead of hand-built fieldsets, sliders and charts. They are not page chrome: use them inside `<site-page>` alongside your own results, and load each from its own script (`uvalib-filter.js`, `uvalib-date-range.js`, `uvalib-date-histogram.js`; npm: `@uvalib/web-components/uvalib-filter.js`).
415
422
 
416
423
  - `<uvalib-filter>`: set `filter` (`{ name, title, position, buckets: [{ key, doc_count, selected }] }`), `value` (selected keys), and optionally `scopes` (`[{ value, label }]` chips), `scopeValue` and `scopesLabel`. `limit="5"` shows five buckets with See more / See less. Events: `filter-change` (`detail: { name, value }`) and `scope-change` (`detail: { value }`).
417
- - `<uvalib-date-range>`: `min` and `max` (`YYYY-MM-DD`) are required; without them nothing renders and a console warning is logged. Set `value` to `[start, end]`; `label` renames the legend. Event: `date-range-change` (`detail: { value: [start, end] }`).
418
- - `<uvalib-date-histogram>`: set `items` (`[{ date: 'YYYY' | 'YYYY-MM', count }]`) or a child `<table>` (two columns, date and count, or a year-by-month grid). The table is the no-JS fallback and stays available; "Show as table" shows the same counts. `granularity` is `month` (bars grouped by year) or `year`. `unit` (default `items`) names each bar, for example "October 2015: 5,311 photos". Arrow keys move between bars; Enter or Space selects. `selected` is one bucket or a range (`2015-10` or `2015-10/2016-03`). A choice fires `select` (`detail: { from, to }` as ISO dates). `range-for` names a `<uvalib-date-range>`: a bar sets its `value`, and `date-range-change` highlights the bars the range covers. Setting `selected` in script updates that date range and does not fire `select`. Setting the date range's `value` in script does not update the histogram unless the histogram connects afterwards or the range fires `date-range-change`. A value equal to that range's own `min` and `max` selects nothing. `scale="log"` sizes bars by log(count + 1). On a narrow screen month rows scroll inside the chart ("Scroll sideways to see more."); year bars wrap. `variant="strip"` is a non-interactive per-year row (`role="img"`) for a card. A date that is not a bucket at that granularity is a chip. Analytics: one `select` named `<from>–<to>` when both ends are ISO dates, otherwise `other`; nothing when the selection is cleared, set in script, or restored from a date range.
424
+ - `<uvalib-date-range>`: `min` and `max` (`YYYY-MM-DD`) are required; without them nothing renders and a console warning is logged. Set `value` to `[start, end]`; `label` renames the legend. Events: `date-range-change` (`detail: { value: [start, end] }`) for a visitor's change; `uvalib-date-range-value` (same detail) for any change, script sets included.
425
+ - `<uvalib-date-histogram>`: set `items` (`[{ date: 'YYYY' | 'YYYY-MM', count }]`) or a child `<table>` (two columns, date and count, or a year-by-month grid). The table is the no-JS fallback and stays available; "Show as table" shows the same counts. `granularity` is `month` (bars grouped by year), `year`, `decade` (for a long span, e.g. 1817–2026: "1810s: 22 meetings", choosing one selects `1810/1819`) or `auto` (months up to 3 years, years up to 30, then decades). `unit` (default `items`) names each bar, for example "October 2015: 5,311 photos". Arrow keys move between bars; Enter or Space selects. `selected` is one bucket or a range (`2015-10` or `2015-10/2016-03`). A choice fires `select` (`detail: { from, to }` as ISO dates). `range-for` names a `<uvalib-date-range>`: a bar sets its `value`, and any change to the range's value, from its controls or set in script (Clear, Back/Forward, a restored URL), highlights the bars it covers (the range fires `uvalib-date-range-value` for every change). On (re)connect a range value that holds a selection wins over `selected`. Setting `selected` in script updates that date range and does not fire `select`. A value equal to that range's own `min` and `max` selects nothing. `scale="log"` sizes bars by log(count + 1). On a narrow screen month rows scroll inside the chart ("Scroll sideways to see more."); year bars wrap. `variant="strip"` is a non-interactive per-year row (`role="img"`) for a card. A date that is not a bucket at that granularity is a chip. Analytics: one `select` named `<from>–<to>` when both ends are ISO dates, otherwise `other`; nothing when the selection is cleared, set in script, or restored from a date range.
426
+ - A search page's form and facets on phones: wrap them in one `<uvalib-filter-drawer>` (`uvalib-filter-drawer.js`), never a hand-built off-canvas panel, `role="dialog"` div or focus-return script. Above `breakpoint` (default `48rem`) the children are a plain sidebar (lay out the column yourself); at and below it a "Search and filters" button (`label`) opens them in a native modal `<dialog>` with a heading and a Close button that takes focus; Escape, Close and the backdrop close it and focus returns to the button. The rest of the page, `<site-page>`'s header included, is inert while it is open: do not add `inert` or focus-trapping code. Inert regions are not announced, so list the ids of the results count and status notices outside it in `live` (`live="results-count status"`) and it repeats their announcements inside the panel. Set `count` to the number of filters set (shown on the button). The children are moved, never re-created, so form state and filter state survive; call `close()` after running a search if you want the results shown. base.css holds the button's place on phones before it upgrades; with your own `breakpoint`, copy the README's `:not(:defined)` rule for that width. It reports `open` and `close` (the label) to analytics itself.
419
427
  - The filter and the date range are controlled: update `value` / `scopeValue` from your own state after each event, and re-run your search.
420
428
  - Do not hard-code ids on the filter's or date range's inner inputs; ids are unique per instance and the markup is internal.
421
429
 
@@ -476,9 +484,9 @@ For a search results page that needs a checkbox facet, a date-range picker or da
476
484
  A year rail, a category filter, a sort or view toggle, or "Try:" suggestions are one `<uvalib-chip-group>` (`uvalib-chip-group.js`), never hand-built pill buttons or a `role="tablist"` (it is not tabs).
477
485
 
478
486
  - `label` (required) names the group. `mode="single"` (default): one value, radios drawn as chips; arrow keys select. `mode="multi"`: toggles with `aria-pressed`, `value` an array. `mode="links"`: `<a href>` children (or buttons) that fire `select`, with no selected state.
479
- - Chips are children (`<button value="2005" data-count="213">2005</button>`, `<a href>` for links) or the `items` property (`[{ value, label, count?, href?, disabled? }]`). Counts go in `data-count`/`count`, not in the label text; `count-label` is the word read after them ("2005, 213 shoots").
487
+ - Chips are children (`<button value="2005" data-count="213">2005</button>`, `<a href>` for links) or the `items` property (`[{ value, label, count?, href?, disabled?, swatch? }]`); `data-swatch="#e57200"`/`swatch` adds a decorative colour square, so the chips can be a chart's or map's key (the label stays the name). Counts go in `data-count`/`count`, not in the label text; `count-label` is the word read after them ("2005, 213 shoots").
480
488
  - Listen for `change` (`detail: { value }`); setting `value` from your state fires nothing. In a single-page app cancel `select` to route a link chip in place.
481
- - `segmented` for a short sort or view toggle (one row), `scroll` for a long rail such as years (one scrolling row). `url-param="year"` keeps the value in the address and follows Back and Forward (then `change` has `restored: true`).
489
+ - `segmented` for a short sort or view toggle (one row), `scroll` for a long rail such as years (one scrolling row). A hint about the choice goes in `description="…"` (shown under the chips and read with the group), not in a paragraph beside it. `url-param="year"` keeps the value in the address and follows Back and Forward (then `change` has `restored: true`).
482
490
  - It reports `change` (`<label>: <chip label>`, with the count) and `select` (the label only) to analytics itself: do not add your own tracking.
483
491
 
484
492
  ```html snippet
@@ -523,6 +531,17 @@ A year rail, a category filter, a sort or view toggle, or "Try:" suggestions are
523
531
  </html>
524
532
  ```
525
533
 
534
+ ### Combobox
535
+
536
+ A person, place or subject picker, or any text field that suggests values as you type, is one `<uvalib-combobox>` (`uvalib-combobox.js`), never a hand-built ARIA combobox or a bare `<datalist>` restyled with `.uvalib-input`.
537
+
538
+ - `label` (required) is the visible label; `description` a hint read with the field; `name` makes it a form field (it submits the chosen suggestion's `value`, else the typed text, and resets with the form). `required` and `must-choose` (only a suggestion is valid) validate like an input.
539
+ - Suggestions: the `items` property (`[{ value, label?, description?, disabled? }]` or strings; 16,000 is fine, `max-results` caps what is shown), `<option>` children (in a `<datalist>` or directly), or `src="/api/people?q={q}"` (debounced, stale requests aborted; `transform` maps a response that is not an array). Matching ignores case and accents.
540
+ - Listen for `change` (`detail: { value, item }`, the committed text and the chosen object or null) and `select` (`detail: { item }`). Free text is kept unless the visitor chooses. Set `selected` or `value` to show a value; that fires nothing.
541
+ - Keys follow the APG example (Down/Up open and move, Enter chooses without submitting, Escape closes then clears); do not add your own key handlers. It announces the count itself and has its own clear button.
542
+ - For no-JavaScript visitors, put `<input name list aria-label>` and its `<datalist>` inside: base.css shows the label and the field before the script runs.
543
+ - It reports `select` (the label and position) and `clear` to analytics itself, never what was typed: do not add your own tracking.
544
+
526
545
  ### Static-site search (Pagefind)
527
546
 
528
547
  A static site (11ty, Jekyll, a generated collection) that searches with [Pagefind](https://pagefind.app) keeps Pagefind's own index and `pagefind-ui.js`, and gets the library look and the accessibility fixes from this package:
@@ -578,6 +597,7 @@ For a results list of your own (a collection, a Virgo-like listing, a photo arch
578
597
  - Toolbar: `.uvalib-toolbar` around `.uvalib-toolbar__field` (label over control; `--grow` takes the spare width), `.uvalib-toolbar__group` (`role="group"` with an `aria-label`, `.uvalib-button` toggles with `aria-pressed`) and `.uvalib-toolbar__summary`. It stacks on phones.
579
598
  - `<uvalib-results-count shown total noun singular>`: the visible “Showing 48 of 3,694 shoots”, announced politely once it settles (1 s); never the first render, but the first count after an empty one (data loading) is. Leave `shown`/`total` unset while loading. Set `shown` and `total` after every filter change; do not add your own live region for the count. Not beside `<bento-box>` or `<uvalib-pagefind-search>`, which announce their own.
580
599
  - `<uvalib-tag-list label="Subjects" track-label limit="8" href-template="/search?q={tag}">` with `<a href>` or `<span>` children (or `items`): links are outlined pills, plain tags filled chips; a child's `lang`/`dir` and inline markup are kept; `limit` adds “Show all N”. Always set `label` (`hide-label` hides it visually). It reports tag clicks as `list N` and the tag's position, never the tag text; add `track-label` only when the label is fixed text you wrote, never one filled from a record.
600
+ - Long result sets (hundreds or thousands of rows): `<ul class="uvalib-result-list">` of `<li class="uvalib-result">` rows holding `__meta` (badges, date), `__title` (the row's one link), `__snippet` (search terms in `<mark>`, drawn bold on `--uva-color-highlight`) and `__actions` (secondary buttons, each with a unique visually hidden name). Plain HTML, never a `<uvalib-card>` per row; rows skip rendering off screen (`content-visibility: auto`). A heading and a list per group for date order.
581
601
  - No results: `.uvalib-empty-state` (decorative `__icon`, a heading, a sentence, one action). Loading: `.uvalib-skeleton` (give it a height, or `--media` for 3:2) and `.uvalib-skeleton-text` (one line), sized like what replaces them, inside an `aria-hidden="true"` container, with `aria-busy="true"` on the region while it loads.
582
602
 
583
603
  ```html snippet
@@ -700,6 +720,8 @@ Use these instead of a hand-built gallery or a carousel. There is no autoplay.
700
720
  - `<uvalib-lightbox>` from `uvalib-lightbox.js`: progressive enhancement over plain links. Wrap them (`<a href="full.jpg" data-caption="Page 2"><img alt="Page 2" width="1600" height="2000"></a>`), or point at links elsewhere with `selector="a.pb-image"`. Without JavaScript, and on a modified click, the link opens the image as before. A primary click opens a native `<dialog>` (`showModal()`): the caption names it, Close takes focus, focus returns to the trigger, Escape and the backdrop close it. With more than one image, Previous and Next and the arrow keys move through the set (wrapping; Left is previous in left-to-right), with a polite "3 of 13". Full size opens the original image in a new tab and says so in its accessible name. It is offered for an http(s) URL or a PNG, JPEG, GIF or WebP `data:` image, never an SVG `data:` URL. A IIIF Image API URL keeps its region and only the size becomes `!W,H` for the viewport; TIFF and JPEG2000 URLs are left as written. Full size stays the original href.
701
721
  - `url-param="photo"` keeps `?photo=<id>` in sync (the id is `data-id`, else `id`, else the IIIF identifier, else the position from 1): opening pushes a history entry, stepping replaces it, Back closes. On a hash route the parameter is written inside the hash. Opening from a URL that already has it is not an analytics event. With `spa="auto"`, that opening push may count as one Matomo page view.
702
722
  - Details: a child with `slot="details"` (`data-for` selects one item by id or position from 1; without it the details show for every image), or `data-details-id` on a link naming an element elsewhere. It is put back when the viewer moves on or closes.
723
+ - `<uvalib-image-regions>` from `uvalib-image-regions.js`: numbered outlines on an image (people, objects, inscriptions) with a list of the same regions beside it. Write the page's own `<img width height alt>` and `<ol>` inside, each `<li data-xywh="percent:x,y,w,h">` (or pixels of the natural size, `160,120,320,240`; `image-width`/`image-height` for a IIIF derivative) holding the region's link and your own action buttons, which stay yours; or set `items` (`{ label, x, y, w, h, unit?, href?, description? }[]`). The list is the accessible route: the outlines are `aria-hidden`, not tab stops, and never the only place a name or action is; hovering or focusing an entry highlights its outline (thicker double outline and label) and back, and clicking an outline focuses its entry. `label` names the list. Listen for `select` and `highlight` (`detail: { item, index }`). Do not hand-build absolutely positioned outlines. It reports outline clicks itself (the list's label and the number, never a region's label).
724
+ - Regions in the viewer: `data-regions` on a lightbox link (a JSON array, or `percent:10,20,30,40 Person 1; percent:55,15,20,30 Sign`), or the lightbox's `regions` callback (`({ element, id, href, index }) => regions`). The open image then shows the outlines, their list and a "Show regions" toggle; `regions-label` names the list.
703
725
  - `<uvalib-photo-grid>` from `uvalib-photo-grid.js`: justified rows. Each direct `<a href>` or `<button>` is one photo and stays a real control. The row is about 220px, and 140px at 767px and below, unless `row-height` is set (a bare number is pixels). Give each image `width` and `height` so the row does not jump when it loads. An image with no visible text gets a caption from its alt, and a repeated alt is cleared (the original is kept for a lightbox). A different alt is kept. Do not set an `aria-label` that differs from the visible text; the grid will not add a caption beside one. Generated "Photo N" captions renumber when the photos change order. A `<span slot="badge">` inside the item, or `data-badge` on it (“seq”, “3 photos”), is drawn over the thumbnail and stays in the accessible name; an existing `aria-label` gains the badge text. A grid inside a lightbox opens the viewer. The grid reports no analytics.
704
726
 
705
727
  ```html snippet
@@ -768,6 +790,69 @@ Use these instead of a hand-built gallery or a carousel. There is no autoplay.
768
790
  </html>
769
791
  ```
770
792
 
793
+ ### Maps
794
+
795
+ A map of places (buildings, rooms, outdoor spaces, collection subjects) is one `<uvalib-map>` (`uvalib-map.js`), never a bare Leaflet map or an embedded Google map: it makes the markers keyboard links with names and counts and keeps a list of the same places beside them.
796
+
797
+ - Leaflet is the page's: load `https://unpkg.com/leaflet@1.9.4/dist/leaflet.js` (with its integrity hash and `defer`, before the module scripts), or in a bundled app `import * as L from 'leaflet'` and set `el.leaflet = L`. The library never bundles it. Leaflet's CSS is not needed. Without Leaflet the element shows the list alone (one console warning).
798
+ - Give the places as the child list (`<ul>` of `<li><a href data-lat data-lng data-count>Name</a></li>`, which is the no-JavaScript list too) or the `items` property (`[{ id?, name, lat, lng, count?, href?, description? }]`). `label` is required; `count-label` is the noun in the markers' names (“The Rotunda, 2,702 photos”).
799
+ - It renders the skip link, the key instructions, the labelled region, 44px zoom buttons, the attribution, the tooltips and the list↔marker highlight itself; do not add your own. `select` (`detail: { item }`, cancelable) fires when a marker is chosen.
800
+ - Tiles default to OpenStreetMap's, which are for light use only (attribution kept, no heavy traffic): for a busy page set `tile-url` and `attribution` to a library-hosted or commercial tile source. In dark mode it inverts the tiles with a filter, or uses `dark-tile-url`.
801
+ - It reports `select` (the map's label and the place's position) and `zoom` to analytics itself, never a place: do not add your own tracking.
802
+
803
+ ```html snippet
804
+ <!doctype html>
805
+ <html lang="en">
806
+ <head>
807
+ <meta charset="utf-8" />
808
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
809
+ <title>Places on Grounds</title>
810
+ <link
811
+ rel="stylesheet"
812
+ href="https://unpkg.internal.lib.virginia.edu/web-components/v1/base.css"
813
+ />
814
+ <script
815
+ defer
816
+ src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
817
+ integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
818
+ crossorigin=""
819
+ ></script>
820
+ <script
821
+ type="module"
822
+ src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-page.js"
823
+ ></script>
824
+ <script
825
+ type="module"
826
+ src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-map.js"
827
+ ></script>
828
+ </head>
829
+ <body>
830
+ <site-page>
831
+ <h1>Places on Grounds</h1>
832
+ <uvalib-map label="Places on Grounds" count-label="photos">
833
+ <ul>
834
+ <li>
835
+ <a href="#rotunda" data-lat="38.0356" data-lng="-78.5034" data-count="2702"
836
+ >The Rotunda</a
837
+ >
838
+ </li>
839
+ <li>
840
+ <a href="#alderman" data-lat="38.0367" data-lng="-78.5055" data-count="640"
841
+ >Alderman Library</a
842
+ >
843
+ </li>
844
+ <li>
845
+ <a href="#stadium" data-lat="38.0311" data-lng="-78.5137" data-count="1150"
846
+ >Scott Stadium</a
847
+ >
848
+ </li>
849
+ </ul>
850
+ </uvalib-map>
851
+ </site-page>
852
+ </body>
853
+ </html>
854
+ ```
855
+
771
856
  ## 9. Verification checklist
772
857
 
773
858
  Before finishing, load the page in a browser (or test) and confirm:
@@ -18,10 +18,36 @@ best-practice tags added, and fail on **every** impact level (minor included), s
18
18
  test cannot lose Lighthouse accessibility points to axe.
19
19
 
20
20
  ```bash
21
- npm i -D @playwright/test @axe-core/playwright
21
+ npm i -D @playwright/test @axe-core/playwright @uvalib/web-components
22
22
  ```
23
23
 
24
- `tests/a11y.spec.mjs`:
24
+ The package ships this setup as test helpers, `@uvalib/web-components/testing` (npm only; kept in step
25
+ with the Lighthouse version these docs target): `strictAxe(page, { include?, exclude? })` waits for
26
+ `<site-page>` to upgrade (`waitForUpgrade(page)`) and runs axe with `LIGHTHOUSE_RULES` forced on and the
27
+ WCAG 2.0/2.1/2.2 A and AA and best-practice tags (`STRICT_AXE_TAGS`); `formatViolations` makes one line
28
+ per violation. Install `@uvalib/web-components` in the site's dev dependencies even if the pages use the
29
+ CDN. `tests/a11y.spec.mjs`:
30
+
31
+ ```js
32
+ import { test, expect } from '@playwright/test';
33
+ import { strictAxe, formatViolations } from '@uvalib/web-components/testing';
34
+
35
+ const PAGES = ['./', './about/'];
36
+
37
+ for (const path of PAGES) {
38
+ for (const colorScheme of ['light', 'dark']) {
39
+ test(`${path}: no axe violations at any impact (${colorScheme})`, async ({ page }) => {
40
+ await page.emulateMedia({ colorScheme });
41
+ await page.goto(path);
42
+ const { violations } = await strictAxe(page);
43
+ expect(formatViolations(violations)).toEqual([]);
44
+ });
45
+ }
46
+ }
47
+ ```
48
+
49
+ The same test written by hand, without the package (keep `LIGHTHOUSE_RULES` in step with Lighthouse
50
+ yourself):
25
51
 
26
52
  ```js
27
53
  import { test, expect } from '@playwright/test';
@@ -118,6 +144,12 @@ Notes:
118
144
  two documents; test that page on its own instead.
119
145
  - Dark mode: when the page has `color-scheme-switch`, `emulateMedia({ colorScheme: 'dark' })` with the
120
146
  System choice covers it. Contrast is checked per scheme.
147
+ - `waitForUpgrade(page, { selector })` waits for other elements too (say `'uvalib-card'`) before a
148
+ screenshot or a keyboard test.
149
+ - Analytics tests use the same module: `stubMatomo(page, { siteId })` (before `page.goto`) answers
150
+ `matomo.js` with an empty script and `matomo.php` with 204, and gives `<site-page>` that `matomo-id`;
151
+ `matomoQueue(page)` returns `window._paq`, the page views, site searches and events the page sent. See
152
+ the README's "Analytics" for an example, including Do Not Track.
121
153
 
122
154
  ## 2. Lighthouse CI
123
155