@uvalib/web-components 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +72 -0
- package/README.md +723 -32
- package/dist/base/analytics-state.d.ts +36 -0
- package/dist/base/analytics-state.js +44 -0
- package/dist/base/analytics-state.js.map +1 -0
- package/dist/base/analytics.d.ts +31 -27
- package/dist/base/analytics.js +48 -37
- package/dist/base/analytics.js.map +1 -1
- package/dist/base/inline-copy.d.ts +16 -0
- package/dist/base/inline-copy.js +92 -0
- package/dist/base/inline-copy.js.map +1 -0
- package/dist/base/source-children.d.ts +46 -0
- package/dist/base/source-children.js +116 -0
- package/dist/base/source-children.js.map +1 -0
- package/dist/base.css +199 -0
- package/dist/base.d.ts +2 -2
- package/dist/base.js +1 -1
- package/dist/base.js.map +1 -1
- package/dist/components/bento-box/BentoSection.d.ts +1 -1
- package/dist/components/bento-box/BentoSection.js +7 -2
- package/dist/components/bento-box/BentoSection.js.map +1 -1
- package/dist/components/events-section/EventsSection.d.ts +3 -0
- package/dist/components/events-section/EventsSection.js +12 -1
- package/dist/components/events-section/EventsSection.js.map +1 -1
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.d.ts +1 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +5 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -1
- package/dist/components/site-alerts/SiteAlerts.d.ts +109 -0
- package/dist/components/site-alerts/SiteAlerts.js +542 -0
- package/dist/components/site-alerts/SiteAlerts.js.map +1 -0
- package/dist/components/site-alerts/alerts-source.d.ts +36 -0
- package/dist/components/site-alerts/alerts-source.js +115 -0
- package/dist/components/site-alerts/alerts-source.js.map +1 -0
- package/dist/components/{site-page → site-alerts}/alerts.js +8 -3
- package/dist/components/site-alerts/alerts.js.map +1 -0
- package/dist/components/site-alerts/body.d.ts +10 -0
- package/dist/components/site-alerts/body.js +48 -0
- package/dist/components/site-alerts/body.js.map +1 -0
- package/dist/components/site-alerts/dismissed.d.ts +12 -0
- package/dist/components/site-alerts/dismissed.js +72 -0
- package/dist/components/site-alerts/dismissed.js.map +1 -0
- package/dist/components/site-alerts/icons.d.ts +8 -0
- package/dist/components/site-alerts/icons.js +15 -0
- package/dist/components/site-alerts/icons.js.map +1 -0
- package/dist/components/site-alerts/site-alerts.d.ts +1 -0
- package/dist/components/site-alerts/site-alerts.js +4 -0
- package/dist/components/site-alerts/site-alerts.js.map +1 -0
- package/dist/components/site-analytics/SiteAnalytics.d.ts +26 -2
- package/dist/components/site-analytics/SiteAnalytics.js +140 -4
- package/dist/components/site-analytics/SiteAnalytics.js.map +1 -1
- package/dist/components/site-footer/SiteFooter.d.ts +4 -0
- package/dist/components/site-footer/SiteFooter.js +28 -4
- package/dist/components/site-footer/SiteFooter.js.map +1 -1
- package/dist/components/site-header/SiteHeader.d.ts +47 -3
- package/dist/components/site-header/SiteHeader.js +198 -21
- package/dist/components/site-header/SiteHeader.js.map +1 -1
- package/dist/components/site-hours-section/SiteHoursSection.d.ts +4 -1
- package/dist/components/site-hours-section/SiteHoursSection.js +18 -3
- package/dist/components/site-hours-section/SiteHoursSection.js.map +1 -1
- package/dist/components/site-main-nav/SiteMainNav.d.ts +1 -1
- package/dist/components/site-main-nav/SiteMainNav.js +11 -1
- package/dist/components/site-main-nav/SiteMainNav.js.map +1 -1
- package/dist/components/site-page/SitePage.d.ts +43 -15
- package/dist/components/site-page/SitePage.js +161 -34
- package/dist/components/site-page/SitePage.js.map +1 -1
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.d.ts +91 -0
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js +310 -0
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js.map +1 -0
- package/dist/components/uvalib-breadcrumbs/uvalib-breadcrumbs.d.ts +1 -0
- package/dist/components/uvalib-breadcrumbs/uvalib-breadcrumbs.js +4 -0
- package/dist/components/uvalib-breadcrumbs/uvalib-breadcrumbs.js.map +1 -0
- package/dist/components/uvalib-card/UvalibCard.d.ts +113 -0
- package/dist/components/uvalib-card/UvalibCard.js +643 -0
- package/dist/components/uvalib-card/UvalibCard.js.map +1 -0
- package/dist/components/uvalib-card/uvalib-card.d.ts +1 -0
- package/dist/components/uvalib-card/uvalib-card.js +4 -0
- package/dist/components/uvalib-card/uvalib-card.js.map +1 -0
- package/dist/components/uvalib-card-grid/UvalibCardGrid.d.ts +60 -0
- package/dist/components/uvalib-card-grid/UvalibCardGrid.js +305 -0
- package/dist/components/uvalib-card-grid/UvalibCardGrid.js.map +1 -0
- package/dist/components/uvalib-card-grid/uvalib-card-grid.d.ts +1 -0
- package/dist/components/uvalib-card-grid/uvalib-card-grid.js +4 -0
- package/dist/components/uvalib-card-grid/uvalib-card-grid.js.map +1 -0
- package/dist/components/uvalib-contents/UvalibContents.d.ts +134 -0
- package/dist/components/uvalib-contents/UvalibContents.js +613 -0
- package/dist/components/uvalib-contents/UvalibContents.js.map +1 -0
- package/dist/components/uvalib-contents/uvalib-contents.d.ts +1 -0
- package/dist/components/uvalib-contents/uvalib-contents.js +4 -0
- package/dist/components/uvalib-contents/uvalib-contents.js.map +1 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +10 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js +21 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -1
- package/dist/components/uvalib-filter/UvalibFilter.d.ts +1 -0
- package/dist/components/uvalib-filter/UvalibFilter.js +11 -1
- package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -1
- package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +204 -0
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +1115 -0
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -0
- package/dist/components/uvalib-lightbox/media.d.ts +51 -0
- package/dist/components/uvalib-lightbox/media.js +127 -0
- package/dist/components/uvalib-lightbox/media.js.map +1 -0
- package/dist/components/uvalib-lightbox/uvalib-lightbox.d.ts +1 -0
- package/dist/components/uvalib-lightbox/uvalib-lightbox.js +4 -0
- package/dist/components/uvalib-lightbox/uvalib-lightbox.js.map +1 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.d.ts +124 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.js +443 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -0
- package/dist/components/uvalib-metadata/rights.d.ts +8 -0
- package/dist/components/uvalib-metadata/rights.js +47 -0
- package/dist/components/uvalib-metadata/rights.js.map +1 -0
- package/dist/components/uvalib-metadata/uvalib-metadata.d.ts +1 -0
- package/dist/components/uvalib-metadata/uvalib-metadata.js +4 -0
- package/dist/components/uvalib-metadata/uvalib-metadata.js.map +1 -0
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.d.ts +103 -0
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +410 -0
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -0
- package/dist/components/uvalib-pagefind-search/uvalib-pagefind-search.d.ts +1 -0
- package/dist/components/uvalib-pagefind-search/uvalib-pagefind-search.js +7 -0
- package/dist/components/uvalib-pagefind-search/uvalib-pagefind-search.js.map +1 -0
- package/dist/components/uvalib-pager/UvalibPager.d.ts +94 -0
- package/dist/components/uvalib-pager/UvalibPager.js +390 -0
- package/dist/components/uvalib-pager/UvalibPager.js.map +1 -0
- package/dist/components/uvalib-pager/uvalib-pager.d.ts +1 -0
- package/dist/components/uvalib-pager/uvalib-pager.js +4 -0
- package/dist/components/uvalib-pager/uvalib-pager.js.map +1 -0
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +59 -0
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +350 -0
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -0
- package/dist/components/uvalib-photo-grid/uvalib-photo-grid.d.ts +1 -0
- package/dist/components/uvalib-photo-grid/uvalib-photo-grid.js +4 -0
- package/dist/components/uvalib-photo-grid/uvalib-photo-grid.js.map +1 -0
- package/dist/custom-elements.json +10916 -3049
- package/dist/index.d.ts +16 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/pagefind.css +388 -0
- package/dist/styles/base.js +11 -0
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/color-scheme.js +24 -11
- package/dist/styles/color-scheme.js.map +1 -1
- package/dist/styles/controls.d.ts +2 -0
- package/dist/styles/controls.js +200 -0
- package/dist/styles/controls.js.map +1 -0
- package/dist/styles/pagefind.d.ts +1 -0
- package/dist/styles/pagefind.js +395 -0
- package/dist/styles/pagefind.js.map +1 -0
- package/dist/tokens.css +23 -20
- package/dist-cdn/base.css +199 -0
- package/dist-cdn/bento-box.js +103 -95
- package/dist-cdn/bento-box.js.map +1 -1
- package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js +243 -0
- package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js.map +1 -0
- package/dist-cdn/chunks/alerts-C5vkeb-f.js +39 -0
- package/dist-cdn/chunks/alerts-C5vkeb-f.js.map +1 -0
- package/dist-cdn/chunks/analytics-DTTihuBD.js +43 -0
- package/dist-cdn/chunks/analytics-DTTihuBD.js.map +1 -0
- package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js +39 -0
- package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js.map +1 -0
- package/dist-cdn/chunks/{base-DCGd2Oii.js → base-CAFQWnZG.js} +12 -1
- package/dist-cdn/chunks/{base-DCGd2Oii.js.map → base-CAFQWnZG.js.map} +1 -1
- package/dist-cdn/chunks/{library-weekly-hours-ByQ8ugxh.js → library-weekly-hours-COE7Vv6V.js} +47 -38
- package/dist-cdn/chunks/library-weekly-hours-COE7Vv6V.js.map +1 -0
- package/dist-cdn/chunks/{site-header-BwDkZ2LL.js → site-header-C9V7Wuw2.js} +169 -49
- package/dist-cdn/chunks/site-header-C9V7Wuw2.js.map +1 -0
- package/dist-cdn/chunks/{site-main-nav-BLAAunnr.js → site-main-nav-AaxZ9rQf.js} +11 -2
- package/dist-cdn/chunks/site-main-nav-AaxZ9rQf.js.map +1 -0
- package/dist-cdn/chunks/source-children-RuAec527.js +119 -0
- package/dist-cdn/chunks/source-children-RuAec527.js.map +1 -0
- package/dist-cdn/custom-elements.json +10916 -3049
- package/dist-cdn/events-section.js +78 -66
- package/dist-cdn/events-section.js.map +1 -1
- package/dist-cdn/library-hours-setup.js +1 -1
- package/dist-cdn/library-weekly-hours.js +1 -1
- package/dist-cdn/manifest.json +13 -2
- package/dist-cdn/pagefind.css +388 -0
- package/dist-cdn/site-alerts.js +516 -0
- package/dist-cdn/site-alerts.js.map +1 -0
- package/dist-cdn/site-analytics.js +1 -1
- package/dist-cdn/site-footer.js +33 -18
- package/dist-cdn/site-footer.js.map +1 -1
- package/dist-cdn/site-header.js +1 -1
- package/dist-cdn/site-hours-section.js +33 -21
- package/dist-cdn/site-hours-section.js.map +1 -1
- package/dist-cdn/site-main-nav.js +1 -1
- package/dist-cdn/site-page.js +116 -81
- package/dist-cdn/site-page.js.map +1 -1
- package/dist-cdn/site-style.js +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +367 -11
- package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +170 -0
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +414 -12
- package/dist-cdn/skills/uvalib-web-components/reference/migration.md +15 -0
- package/dist-cdn/tokens.css +23 -20
- package/dist-cdn/uvalib-analytics.js +1 -1
- package/dist-cdn/uvalib-breadcrumbs.js +176 -0
- package/dist-cdn/uvalib-breadcrumbs.js.map +1 -0
- package/dist-cdn/uvalib-card-grid.js +163 -0
- package/dist-cdn/uvalib-card-grid.js.map +1 -0
- package/dist-cdn/uvalib-card.js +424 -0
- package/dist-cdn/uvalib-card.js.map +1 -0
- package/dist-cdn/uvalib-contents.js +381 -0
- package/dist-cdn/uvalib-contents.js.map +1 -0
- package/dist-cdn/uvalib-date-range.js +33 -18
- package/dist-cdn/uvalib-date-range.js.map +1 -1
- package/dist-cdn/uvalib-filter.js +32 -11
- package/dist-cdn/uvalib-filter.js.map +1 -1
- package/dist-cdn/uvalib-lightbox.js +662 -0
- package/dist-cdn/uvalib-lightbox.js.map +1 -0
- package/dist-cdn/uvalib-metadata.js +313 -0
- package/dist-cdn/uvalib-metadata.js.map +1 -0
- package/dist-cdn/uvalib-pagefind-search.js +207 -0
- package/dist-cdn/uvalib-pagefind-search.js.map +1 -0
- package/dist-cdn/uvalib-pager.js +278 -0
- package/dist-cdn/uvalib-pager.js.map +1 -0
- package/dist-cdn/uvalib-photo-grid.js +202 -0
- package/dist-cdn/uvalib-photo-grid.js.map +1 -0
- package/package.json +43 -1
- package/skills/uvalib-web-components/SKILL.md +367 -11
- package/skills/uvalib-web-components/reference/accessibility-testing.md +170 -0
- package/skills/uvalib-web-components/reference/components.md +414 -12
- package/skills/uvalib-web-components/reference/migration.md +15 -0
- package/dist/components/site-page/alerts.js.map +0 -1
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js +0 -174
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js.map +0 -1
- package/dist-cdn/chunks/analytics-C8D8n_wt.js +0 -55
- package/dist-cdn/chunks/analytics-C8D8n_wt.js.map +0 -1
- package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js.map +0 -1
- package/dist-cdn/chunks/site-header-BwDkZ2LL.js.map +0 -1
- package/dist-cdn/chunks/site-main-nav-BLAAunnr.js.map +0 -1
- /package/dist/components/{site-page → site-alerts}/alerts.d.ts +0 -0
package/README.md
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Reusable web components for UVA Library sites, built with Lit and TypeScript:
|
|
4
4
|
|
|
5
|
-
- **Page chrome:** `<site-page>` (skip link, header with the library main navigation and live library alerts, one `<main>`, footer), `<site-header>`, `<site-main-nav>`, `<site-footer>`, `<site-analytics>` and `<uvalib-analytics>` (Matomo, one element under two names) and `<site-style>` (legacy compatibility).
|
|
5
|
+
- **Page chrome:** `<site-page>` (skip link, header with the library main navigation and live library alerts, one `<main>`, footer), `<site-alerts>` (the alerts, also usable alone), `<site-header>`, `<site-main-nav>`, `<site-footer>`, `<site-analytics>` and `<uvalib-analytics>` (Matomo, one element under two names) and `<site-style>` (legacy compatibility).
|
|
6
|
+
- **Navigation:** `<uvalib-breadcrumbs>` (the breadcrumb trail) and `<uvalib-contents>` (sub-navigation or a table of contents).
|
|
7
|
+
- **Cards:** `<uvalib-card>`, `<uvalib-card-grid>` and `<uvalib-pager>`.
|
|
8
|
+
- **Records:** `<uvalib-metadata>` (a record's details, credit, rights and how to cite).
|
|
9
|
+
- **Images:** `<uvalib-lightbox>` (an image viewer over plain links) and `<uvalib-photo-grid>` (justified rows of thumbnails).
|
|
6
10
|
- **Search:** `<uvalib-filter>` and `<uvalib-date-range>`.
|
|
7
11
|
- **Library hours:** `<site-hours-section>`, `<library-weekly-hours>` and `<library-hours-setup>`.
|
|
8
12
|
- **Library events:** `<events-section>`.
|
|
@@ -92,7 +96,7 @@ npm i @uvalib/web-components
|
|
|
92
96
|
import '@uvalib/web-components/site-page.js'; // registers site-page, site-header, site-main-nav and site-footer
|
|
93
97
|
```
|
|
94
98
|
|
|
95
|
-
The define entries are `site-page.js`, `site-header.js`, `site-main-nav.js`, `site-footer.js`, `site-analytics.js`, `uvalib-analytics.js`, `site-style.js`, `uvalib-filter.js`, `uvalib-date-range.js`, `site-hours-section.js`, `library-weekly-hours.js`, `library-hours-setup.js`, `events-section.js` and `
|
|
99
|
+
The define entries are `site-page.js`, `site-header.js`, `site-main-nav.js`, `site-footer.js`, `site-analytics.js`, `uvalib-analytics.js`, `site-style.js`, `uvalib-filter.js`, `uvalib-date-range.js`, `site-hours-section.js`, `library-weekly-hours.js`, `library-hours-setup.js`, `events-section.js`, `bento-box.js` and `uvalib-pagefind-search.js`. The package root (`import '@uvalib/web-components'`) exports the classes only and registers nothing. To use a class such as `SitePage` directly, also import the define entries. CSS is available as `@uvalib/web-components/tokens.css`, `base.css` and `pagefind.css` (the Pagefind theme, see [Static-site search](#static-site-search-pagefind)). Do not load the same component from both the CDN and npm on one page.
|
|
96
100
|
|
|
97
101
|
## Quick start
|
|
98
102
|
|
|
@@ -139,6 +143,16 @@ A site with its own navigation puts it in the header instead of the library util
|
|
|
139
143
|
|
|
140
144
|
The links replace the utility links in both the inline nav on wide screens and the Menu popover on narrow ones, in order. Their `href` is used as written (not joined to `root-link-domain`), and `aria-current`, `target`, `rel` and `hreflang` are kept; mark the current page with `aria-current="page"`, which is shown bold with a thick underline. `site-links-label` names the nav (default `Site`; the popover's nav is "… menu"). Adding, removing or editing the links later updates the header. Children that are not `<a href>` with text (a link with empty or whitespace-only text has no accessible name) are ignored with a console warning. Without site links the header is unchanged. The `vendor` header variant ignores site links and keeps its reduced link set.
|
|
141
145
|
|
|
146
|
+
### Site name
|
|
147
|
+
|
|
148
|
+
A sub-site (Electronic Text Collections, a digital exhibit, a project site) names itself in the header with `site-name` on `<site-page>` (or a standalone `<site-header>`):
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<site-page site-name="Electronic Text Collections" site-name-href="/">…page content…</site-page>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The name sits after the library logo, past a thin divider, in the header's text colour, as a link to the site's home: `site-name-href`, default `/`. The logo still links to library.virginia.edu. The links have distinct names, each starting with its visible text (for voice control): "UVA Library home" and "Electronic Text Collections home". The name is not a heading, so the page keeps its own `<h1>`. On wide screens it shares the logo row and wraps to at most two lines without making the header taller, so keep it short (about 30 characters fit on one line from 1200px). When the links would not fit beside it on one line (with `color-scheme-switch`, or many site links, mostly between 993px and 1199px), the name moves under the logo, as on phones, so the links are laid out exactly as without a name and never overflow; the header is then taller by the name's lines. At 992px and below it gets its own lines under the logo, so it wraps cleanly on phones with no horizontal scroll. It works in light DOM and with the `vendor` variant (a vendor-hosted site can name itself too). A click reports `['site-header', 'site-name-click']`. Without `site-name` the header is unchanged.
|
|
155
|
+
|
|
142
156
|
### Main navigation
|
|
143
157
|
|
|
144
158
|
Every full header shows the UVA Library main navigation, as on library.virginia.edu: About, Using the Library, Research & teaching support and Get help. It is on by default for `<site-page>` and a standalone `<site-header>`, with or without site links. Above 992px it is a full-width row under the logo row, with the brand-blue rule under it; at 992px and below it leads the Menu popover as accordions, above the utility or site links. The `vendor` header variant never shows it.
|
|
@@ -179,7 +193,7 @@ Every full header shows the UVA Library main navigation, as on library.virginia.
|
|
|
179
193
|
|
|
180
194
|
### Alerts
|
|
181
195
|
|
|
182
|
-
`<site-page>` shows live UVA Library alerts by default.
|
|
196
|
+
`<site-page>` shows live UVA Library alerts by default, drawn by this library's `<site-alerts>` in library.virginia.edu's look. The data comes from the [alerts project](https://github.com/uvalib/uvalib-alerts): its `<uvalib-alerts>` element, released separately and loaded at runtime from the alerts CDN, now only provides the data (alerts, live updates, dismissals and regional matching), used headless; its own UI is no longer rendered. One `<script type="module" src="{base}v1/uvalib-alerts.js">` is added to `<head>`, once per document however many pages there are, and not at all if `<uvalib-alerts>` is already defined or a script with that `src` is already present. `<site-alerts>`' own code is loaded only while alerts are on.
|
|
183
197
|
|
|
184
198
|
| Attribute | Default | |
|
|
185
199
|
| ------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -189,9 +203,19 @@ Every full header shows the UVA Library main navigation, as on library.virginia.
|
|
|
189
203
|
|
|
190
204
|
The bases are `https://d2q6t6fdv76k7r.cloudfront.net/` (production) and `https://dzfvxb8mejnv6.cloudfront.net/` (staging), exported as `ALERTS_PRODUCTION_SRC` and `ALERTS_STAGING_SRC`; they move to `alerts.lib.virginia.edu` and `alerts-staging.lib.virginia.edu` once those names exist. The vendor header variant gets the same default.
|
|
191
205
|
|
|
192
|
-
Alerts render where Virgo shows them, inside landmarks: the header banner (
|
|
206
|
+
Alerts render where Virgo shows them, inside landmarks: the header banner (`<site-alerts show="header">`) full-bleed at the very top of the header (flush with its top and both edges, after the skip link and before the logo row); the alert list (`show="list"`) in a full-bleed band directly under the header and above `<main>`, a `<section class="alerts-list" aria-label="Library alerts">` region that is hidden while the list has nothing to show; and the page-targeted regional alerts (`show="regional"`) as the first child of `<main>`, inside its padding and before your content. `<main>`'s own padding is unchanged. `<site-header>` has an `alerts` slot for the banner, but a standalone header never loads anything. Changing `no-alerts` later adds or removes the alerts. Changing `alerts-env` or `alerts-src` later re-points the alerts at the new base without loading the code again. `alerts-src` is resolved against the document's base URL, with any query or hash dropped. If the script fails to load, one console warning is logged per URL, nothing is shown, the page is otherwise unchanged, and a later corrected `alerts-src` or env (or another page) tries again. In light mode (`no-shadow-dom`) these are real children (`<site-alerts no-shadow-dom>`): the regional one is the first child of `<main>`, the banner the first child of the header's `<header>`, and the `section.alerts-list` band sits between `<site-header>` and `<main>`, so host CSS such as `main > :first-child` or `site-header + *` matches them.
|
|
207
|
+
|
|
208
|
+
**The look and accessibility** (WCAG 2.2 AA, and AAA for alerts as the Library's web standard asks):
|
|
209
|
+
|
|
210
|
+
- Header banner: teal, centred, the title in bold then ":", a polite `role="status"`.
|
|
211
|
+
- List alerts, most severe first: critical (red), warning (yellow) and information (blue), each with a 10px left border, the theme's severity icon (decorative) and a visually hidden "Critical:", "Warning:" or "Information:" before the title, so severity is never colour alone. Titles are `<h2>` (as on library.virginia.edu; `heading-level` changes them on a `<site-alerts>`). Only critical alerts are an assertive `role="alert"`. Warning and information alerts have a 44px dismiss button, `aria-label="Dismiss alert: <title>"`; after a dismissal focus moves to the next alert (its button) or, with none left, to `<main>`, never to `<body>`. Information alerts stay listed until the reader closes them, as on library.virginia.edu (the alerts service marks them "seen" on arrival, Virgo's rule for its Alerts menu, so `<site-alerts>` keeps its own per-site record of what was closed, in localStorage under `<storage-key>:site-alerts-closed`); a closed warning is also dismissed in the alerts service. Closings are per site and sync across tabs.
|
|
212
|
+
- Regional alerts: yellow (warning) or teal (information) boxes with a visually hidden severity.
|
|
213
|
+
- Text is 7:1 or more on every alert background in light and dark (body text 10.1–13.0:1 light, 8.0–12.0:1 dark), icons follow the text colour, and the focus ring is the text colour on the alert's background. Under forced colors every alert keeps a system-colour border. library.virginia.edu's yellow and teal borders are decorative (1.7:1 and 2.0:1 on white); the icon, the hidden label and the background carry the alert.
|
|
214
|
+
- Alert bodies are server-sanitized HTML; where the browser has `setHTML()` it re-applies the alerts project's allowlist.
|
|
193
215
|
|
|
194
|
-
|
|
216
|
+
**`<site-alerts>` on its own.** Pages without `<site-page>` can use the element directly (`site-alerts.js`; npm `@uvalib/web-components/site-alerts.js`): `show` is `header`, `list`, `regional`, `sitewide` (header and list) or `all` (default), with `alerts-env`, `alerts-src`, `heading-level`, `storage-key` (the localStorage key for dismissals), `no-shadow-dom` and `no-style`. However many there are, one hidden headless `<uvalib-alerts>` per document (per base and storage key) feeds them all; the first `<site-alerts>` creates it at the end of `<body>` and the last one removes it. Sites that used the alerts project's UI (`<uvalib-alerts show="…">` with its script) can switch to `<site-alerts show="…">` with `site-alerts.js`; drop their own `uvalib-alerts.js` script, which `<site-alerts>` loads itself.
|
|
217
|
+
|
|
218
|
+
Do not add another `<site-alerts>` or `<uvalib-alerts>` inside a `<site-page>`. An app that renders alerts itself (Virgo uses the component headless) sets `no-alerts`.
|
|
195
219
|
|
|
196
220
|
**Content Security Policy:** a site with a CSP must allow the alerts host in `script-src` (the component) and `connect-src` (`config.json` and `alerts.json`), plus the AppSync realtime socket in `connect-src`:
|
|
197
221
|
|
|
@@ -202,6 +226,184 @@ connect-src https://d2q6t6fdv76k7r.cloudfront.net wss://*.appsync-realtime-api.u
|
|
|
202
226
|
|
|
203
227
|
(Use the staging host, or your `alerts-src` host, instead where that applies.) Alert bodies can include images, so allow their hosts in `img-src` too. Alert bodies are inserted as HTML, so a page that enforces Trusted Types (`require-trusted-types-for 'script'`) is incompatible with the alerts; use `no-alerts` there.
|
|
204
228
|
|
|
229
|
+
## Breadcrumbs
|
|
230
|
+
|
|
231
|
+
`<uvalib-breadcrumbs>` is the breadcrumb trail, with library.virginia.edu's look (slash separators, underlined `--uva-blue-alt-dark` links) at body size (1rem), as the design system asks. Entry: `uvalib-breadcrumbs.js` on the CDN, `@uvalib/web-components/uvalib-breadcrumbs.js` on npm. Inside `<site-page>` give it `slot="breadcrumbs"` and load both scripts:
|
|
232
|
+
|
|
233
|
+
```html
|
|
234
|
+
<script
|
|
235
|
+
type="module"
|
|
236
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-page.js"
|
|
237
|
+
></script>
|
|
238
|
+
<script
|
|
239
|
+
type="module"
|
|
240
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-breadcrumbs.js"
|
|
241
|
+
></script>
|
|
242
|
+
<site-page>
|
|
243
|
+
<uvalib-breadcrumbs slot="breadcrumbs">
|
|
244
|
+
<a href="/">Home</a>
|
|
245
|
+
<a href="/research-and-teaching">Research & teaching support</a>
|
|
246
|
+
<span>Writing & publication</span>
|
|
247
|
+
</uvalib-breadcrumbs>
|
|
248
|
+
<h1>Writing & publication</h1>
|
|
249
|
+
</site-page>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
- **Markup.** A `<nav aria-label="Breadcrumb">` (`label` changes the name) holding an `<ol>`, one `<li>` per step. The slashes are `aria-hidden` elements, so screen readers do not read them. The last step is the current page: a `<span aria-current="page">`, or a link with `aria-current="page"` when it has an href.
|
|
253
|
+
- **The trail as children.** `<a href>` children, ending with the current page as a text-only element (`<span>Writing</span>`) or a link (`<a href="…" aria-current="page">`). The last child is always the current page; an earlier child without an href is shown as plain text (a level with no page of its own). Hrefs are used as written (relative, hash routes); an href with another scheme than http(s), `mailto:` or `tel:` (such as `javascript:` or `data:`) makes that step plain text, with one console warning. Children with no text, and bare text, are skipped with one console warning. The trail follows changes to the children (added, removed, href and text), so a single-page app can rewrite them on each route. An empty trail renders nothing and, in `<site-page>`, takes no space.
|
|
254
|
+
- **Single-page apps.** The trail is drawn from copies of the children, so a router's own click handlers on them don't run. A plain click on a trail link fires `uvalib-breadcrumbs-navigate` (`detail: { href, index }`, bubbling, cancelable): cancel it with `preventDefault()` and navigate in the app (the click's own navigation is then prevented). Hash links need nothing.
|
|
255
|
+
- **The trail as data.** Apps that build it in JavaScript (React, Vue) set the `items` property: `el.items = [{ label: 'Home', href: '/' }, { label: 'Search' }]`. While set it wins over any children; assign a new array to change it, `undefined` to go back to the children. Entries without a label are skipped with one warning.
|
|
256
|
+
- **Placement.** In `<site-page>` the trail sits where library.virginia.edu puts it: after the header and the alert list band, before `<main>` and outside it, so the skip link lands past it, lined up with `<main>`'s content (same max width and 40px side padding, 16px above). In light mode (`no-shadow-dom`) it is moved there as a real child of `<site-page>`, never into `<main>`. Without a `slot="breadcrumbs"` child the page is unchanged. Elsewhere it is an ordinary block: put it first in the page content, above the `<h1>`.
|
|
257
|
+
- **Styles.** Links `--uva-color-utility-link` (else `--uva-blue-alt-dark`, #005679, as on library.virginia.edu), underlined; a linked current page in the text colour; the slash in `--uva-color-text-muted` (else `--uva-grey-dark`); the current page in the text colour; the library focus ring. Long trails wrap (no horizontal scroll at 320px). It follows dark mode through the role tokens. `no-style` keeps only the structure (an inline list without bullets or indent, the separators' spacing); light DOM styles are scoped to the tag in `@layer uvalib`, so a site's own CSS wins.
|
|
258
|
+
|
|
259
|
+
## Cards
|
|
260
|
+
|
|
261
|
+
`<uvalib-card>` is one summary: a collection (title and “N texts”), a photo, or anything similar. `<uvalib-card-grid>` lays those cards out. `<uvalib-pager>` is the previous/next row on a reading page, or a numbered page list. Entries: `uvalib-card.js`, `uvalib-card-grid.js` and `uvalib-pager.js` on the CDN, and the same paths under `@uvalib/web-components/` on npm.
|
|
262
|
+
|
|
263
|
+
```html
|
|
264
|
+
<script
|
|
265
|
+
type="module"
|
|
266
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-card.js"
|
|
267
|
+
></script>
|
|
268
|
+
<script
|
|
269
|
+
type="module"
|
|
270
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-card-grid.js"
|
|
271
|
+
></script>
|
|
272
|
+
<script
|
|
273
|
+
type="module"
|
|
274
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-pager.js"
|
|
275
|
+
></script>
|
|
276
|
+
<site-page>
|
|
277
|
+
<h1>Collections</h1>
|
|
278
|
+
<uvalib-card-grid>
|
|
279
|
+
<uvalib-card href="/collections/early-american-fiction/">
|
|
280
|
+
<span slot="heading">Early American Fiction</span>
|
|
281
|
+
128 texts
|
|
282
|
+
</uvalib-card>
|
|
283
|
+
</uvalib-card-grid>
|
|
284
|
+
<uvalib-pager
|
|
285
|
+
prev-href="/text/eaf375v1/d8/"
|
|
286
|
+
prev-label="The opening"
|
|
287
|
+
next-href="/text/eaf375v1/d10/"
|
|
288
|
+
next-label="What follows"
|
|
289
|
+
></uvalib-pager>
|
|
290
|
+
</site-page>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
- **A clickable card.** `href` makes the heading the link, and a CSS pseudo-element stretches that link over the card, so the whole card is one destination. The arrow is only a visual aid. Never wrap the card in an `<a>`. A clickable card must not contain another link, button or other control: the stretched link would cover it, and a link inside a link is invalid. The heading needs an accessible name (text, or an image alt or label); otherwise the link is hidden. A static card (no `href`, or an empty or unsafe one such as `javascript:`) has no stretch, so its excerpt may contain links. An unsafe href is shown as plain text, with one console warning.
|
|
294
|
+
- **Slots.** `media` (an `<img>` with a real alt, or `alt=""` when the heading already names it), `badge` (for example “13 photos”, over the image), `heading`, `meta` (a date in `<time>`, or a byline), `chip` (one element per category) and the default slot for the excerpt.
|
|
295
|
+
- **Heading level.** Unset, it is one below the nearest heading before the card, or 3 when there is none (the same rule as `<events-section>`). `heading-level` (1–6) wins.
|
|
296
|
+
- **The grid.** A list, so a screen reader announces how many cards there are. Columns follow the grid’s own width: four above 992px, two through 767px, then one. Cards in a row match the tallest. `min-card-width` (a length such as `16rem`) switches that to `auto-fill` / `minmax`; anything else is ignored, with one warning. Only `<uvalib-card>` children are listed.
|
|
297
|
+
- **Previous/next.** `prev-href` and `next-href` (either may be omitted; with neither, nothing is rendered). Each link shows a “Previous” or “Next” kicker and, when set, `prev-label` or `next-label`. A long title truncates; the full text stays in the accessible name. The links use `rel="prev"` and `rel="next"`. The landmark’s name is `label`, or “Sections”.
|
|
298
|
+
- **Numbered pages.** Set `pages` (a positive count; it wins over previous/next, with one warning if those are set too). `page` is the current page, clamped to that range, and is text with `aria-current="page"`, not a link. Other pages use `href-template`, which must contain `{page}` (the default is `?page={page}`). A long range keeps the first page, a window around the current page, the last page, and an ellipsis where numbers are skipped. The landmark’s name is `label`, or “Pagination”.
|
|
299
|
+
- **One landmark name.** Two pagers with the same accessible name fail the accessibility check. Give the second a different `label`.
|
|
300
|
+
- **Single-page apps.** A plain click fires `uvalib-card-navigate` (`detail: { href, position }`) or `uvalib-pager-navigate` (`detail: { href, kind, page? }`). Cancel it with `preventDefault()` and route in the app. `position` is `'single'` or `'1'`, `'2'`, …. `kind` is `'next'`, `'previous'` or `'number'`, and `page` is set only for `'number'`.
|
|
301
|
+
- **Styles.** A raised surface, a 1px border, and on hover or focus the shadow `0 0 20px 0 #DADADA`. Focusing the heading link draws the focus ring on the card. The chip is `--uva-blue-alt-300` on `--uva-blue-alt-dark` (6.13:1: WCAG AA for normal text, short of AAA’s 7:1). Dark mode follows the role tokens. `no-style` keeps the stretch, the grid and the truncation, and drops the colours.
|
|
302
|
+
|
|
303
|
+
## Contents and record metadata
|
|
304
|
+
|
|
305
|
+
Two components for Library sites with records and long texts, such as the Electronic Text Collections. Entries: `uvalib-contents.js` and `uvalib-metadata.js` on the CDN, `@uvalib/web-components/uvalib-contents.js` and `@uvalib/web-components/uvalib-metadata.js` on npm.
|
|
306
|
+
|
|
307
|
+
```html
|
|
308
|
+
<script
|
|
309
|
+
type="module"
|
|
310
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-contents.js"
|
|
311
|
+
></script>
|
|
312
|
+
<script
|
|
313
|
+
type="module"
|
|
314
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-metadata.js"
|
|
315
|
+
></script>
|
|
316
|
+
<uvalib-metadata
|
|
317
|
+
creator="Smith, Richard Penn"
|
|
318
|
+
rights="http://rightsstatements.org/vocab/NoC-US/1.0/"
|
|
319
|
+
rights-info="https://www.library.virginia.edu/policies/use-of-materials"
|
|
320
|
+
citation-title="The actress of Padua, and other tales"
|
|
321
|
+
>
|
|
322
|
+
<dl>
|
|
323
|
+
<dt>Date</dt>
|
|
324
|
+
<dd>1836</dd>
|
|
325
|
+
<dt>Subjects</dt>
|
|
326
|
+
<dd>
|
|
327
|
+
<ul>
|
|
328
|
+
<li>Short stories</li>
|
|
329
|
+
<li>American literature -- 19th century</li>
|
|
330
|
+
</ul>
|
|
331
|
+
</dd>
|
|
332
|
+
<dt>Download</dt>
|
|
333
|
+
<dd>
|
|
334
|
+
<ul>
|
|
335
|
+
<li><a href="eaf375v1.epub" download data-size="184 KB">EPUB</a></li>
|
|
336
|
+
<li><a href="eaf375v1.txt" download data-size="369 KB">Plain text</a></li>
|
|
337
|
+
</ul>
|
|
338
|
+
</dd>
|
|
339
|
+
</dl>
|
|
340
|
+
</uvalib-metadata>
|
|
341
|
+
<uvalib-contents sticky>
|
|
342
|
+
<ol>
|
|
343
|
+
<li><a href="/text/eaf375v1/d3/">Preface</a></li>
|
|
344
|
+
<li>
|
|
345
|
+
<a href="/text/eaf375v1/d8/">The actress of Padua</a>
|
|
346
|
+
<ol>
|
|
347
|
+
<li><a href="/text/eaf375v1/d9/">Part I. The Key</a></li>
|
|
348
|
+
<li><a href="/text/eaf375v1/d10/">Part II. The Crucifix</a></li>
|
|
349
|
+
</ol>
|
|
350
|
+
</li>
|
|
351
|
+
</ol>
|
|
352
|
+
</uvalib-contents>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
`<uvalib-contents>`, sub-navigation as on library.virginia.edu:
|
|
356
|
+
|
|
357
|
+
- **Markup.** A `<nav>` landmark named by `label` (default "Contents"), with the label as a visible headline (`<h2>`; `heading-level` 2 to 6), then the nested list: dividers between the top-level entries, a bar beside each nested level, links in `--uva-color-utility-link` (else #005679) and the library focus ring. Every link is at least 24px tall.
|
|
358
|
+
- **The list as a child.** One `<ol>` or `<ul>` of `<li>`, each with an `<a href>` (or plain text, for a group label) and, for sub-entries, a nested `<ol>`/`<ul>`, to any depth. Other children (a heading) are ignored; entries with no text are skipped with one console warning; hrefs other than relative, http(s), `mailto:` and `tel:` become plain text. `lang` and `dir` on the links and items are kept, and so is inline markup in the text (`em`, `cite`, `code`, `abbr`…, copied element by element with only `lang`, `dir` and an `abbr` title; never parsed as HTML). It follows changes to the children. Apps set the `items` property instead: `[{ label, href?, children? }]`, winning over the children while set.
|
|
359
|
+
- **Current entry.** `aria-current="page"` on the link to this page and `aria-current="location"` on the link to the section in the URL's hash, drawn bold with a bar. It is found from the page URL (path, ignoring a trailing slash or `index.html`, and hash; an entry whose href has a query string, such as `?part=2`, matches only that query, one without matches whatever the query), followed through `hashchange`, `popstate` and the Navigation API, or from `current` (a URL, for apps whose route is not the page URL; hash-only entries are then places on that URL). With `current` unset, a valid `aria-current` the author put on a source link (`page`, `location`, or `true` for a page) is used, at most one of each.
|
|
360
|
+
- **Narrow screens.** At and below `collapse-below` (a viewport width, default `64rem`; `0` never collapses) the headline becomes a full-width 44px button with `aria-expanded` and `aria-controls`, and the list starts closed until the reader opens it (as the Electronic Text Collections' Contents does on phones, so the text comes first; the `open` attribute starts it open), and opening it shows the current entry. It measures the viewport, not the element (no container query) on purpose: a contents sidebar is always much narrower than 64rem, so its own width cannot tell a phone from a desktop.
|
|
361
|
+
- **Sidebars.** `sticky` keeps it in view on wide screens (`--uvalib-contents-sticky-top`, default 1rem); the list then scrolls within the window's height (`--uvalib-contents-max-height`) and the current entry is scrolled into view inside it, never the page.
|
|
362
|
+
- **Single-page apps.** The list is drawn from copies of the children. A plain click on an entry fires `uvalib-contents-navigate` (`detail: { href, level }`, bubbling, cancelable): cancel it to route in place. Hash links need nothing.
|
|
363
|
+
|
|
364
|
+
`<uvalib-metadata>`, a record's description list:
|
|
365
|
+
|
|
366
|
+
- **The rows as a `<dl>` child**, so the page reads the same before the script runs: `<dt>` labels and `<dd>` values, optionally a `<div>` per row; several `<dd>` are several values. Values are copied as written (links, lists such as subjects, `download` attributes, and `lang`/`dir` on the `<dt>` and `<dd>`); a link whose href is not relative, http(s), `mailto:` or `tel:` is shown as its text, with one console warning. A link with `data-size` is shown as a download, "EPUB · 184 KB", read as "EPUB, 184 KB" (not added again when the link's text already ends with the size). Apps set `items` instead: `[{ label, value }]`, a value being text, a link `{ label, href, size?, download? }` or an array of them (a list).
|
|
367
|
+
- **Credit and rights**, as Special Collections asks: `creator` and `organization` rows first; `rights` last, a rightsstatements.org or Creative Commons URL shown as its short name ("In Copyright", "No Copyright – United States", "CC BY 4.0", "CC0 1.0") linked with `rel="license"`, another URL as `rights-label` (else "Rights statement"), or plain text; `rights-info` adds a "More about rights and permissions" link (the library's is `https://www.library.virginia.edu/policies/use-of-materials`).
|
|
368
|
+
- **How to cite.** `citation` (as written), or `citation-title` for the Special Collections formula "<title or collection>, Albert and Shirley Small Special Collections Library, University of Virginia". A Copy citation button copies it and says "Copied" in a polite status; where the clipboard is unavailable it selects the citation and says so.
|
|
369
|
+
- **Layout.** Label and value side by side when the element is 36rem wide or more, stacked below that (a container query: the element's own width). Labels in `--uva-color-text-muted`, rows divided by `--uva-color-border`.
|
|
370
|
+
|
|
371
|
+
Both follow dark mode through the role tokens and reflow at 320px; `no-style` keeps only the structure, and light DOM styles are scoped to the tag in `@layer uvalib`.
|
|
372
|
+
|
|
373
|
+
## Images
|
|
374
|
+
|
|
375
|
+
`<uvalib-lightbox>` opens a set of plain image links in a dialog. `<uvalib-photo-grid>` lays the thumbnails out in justified rows. Entries: `uvalib-lightbox.js` and `uvalib-photo-grid.js` on the CDN, `@uvalib/web-components/uvalib-lightbox.js` and `…/uvalib-photo-grid.js` on npm. Without JavaScript the links still open the image.
|
|
376
|
+
|
|
377
|
+
```html
|
|
378
|
+
<script
|
|
379
|
+
type="module"
|
|
380
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-lightbox.js"
|
|
381
|
+
></script>
|
|
382
|
+
<script
|
|
383
|
+
type="module"
|
|
384
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-photo-grid.js"
|
|
385
|
+
></script>
|
|
386
|
+
<uvalib-lightbox url-param="photo">
|
|
387
|
+
<uvalib-photo-grid>
|
|
388
|
+
<a href="rotunda.jpg" data-caption="The Rotunda">
|
|
389
|
+
<img alt="The Rotunda" width="1600" height="800" />
|
|
390
|
+
</a>
|
|
391
|
+
<a href="lawn.jpg" data-caption="The Lawn">
|
|
392
|
+
<img alt="The Lawn" width="800" height="800" />
|
|
393
|
+
</a>
|
|
394
|
+
</uvalib-photo-grid>
|
|
395
|
+
</uvalib-lightbox>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
- **Progressive enhancement.** Wrap the links, or point at links elsewhere with `selector` (for example `selector="a.pb-image"` on a reading page). A primary click opens the viewer. A modified click (command, control, shift, alt, or another mouse button) follows the link as usual.
|
|
399
|
+
- **Dialog.** A native `<dialog>` opened with `showModal()`. The caption names it (`aria-labelledby`). Focus moves to Close on open and back to the trigger on close. Escape and a click on the backdrop close it. With more than one image, Previous and Next and the arrow keys move through the set, wrapping, and a polite "3 of 13" is shown. Left is previous in left-to-right and next in right-to-left. Full size opens the original image in a new tab, and its accessible name says so. Loading and a failed image are announced. The dialog image's alt is the trigger image's alt, or the caption when that alt is empty. There is no autoplay and no carousel.
|
|
400
|
+
- **Caption and id.** The caption is `data-caption`, else the image alt, else the link's own text, else `title`, else "Image". The deep-link id is `data-id`, else the element's `id`, else the IIIF identifier, else the position from 1.
|
|
401
|
+
- **IIIF.** An Image API URL keeps its region (a crop or `square` stays). Only the size becomes `!W,H` for the viewport (CSS pixels times the screen density, at most 2, and at most 2000 pixels on a side). TIFF and JPEG2000 URLs are left as written. Full size still opens the original href, and only for an http(s) URL or a PNG, JPEG, GIF or WebP `data:` image. A resize while the viewer is open asks for the new size and is not an analytics event. Other image URLs are used as written. A `javascript:` URL, and an SVG `data:` URL, are refused.
|
|
402
|
+
- **Deep link.** `url-param="photo"` keeps `?photo=<id>` in sync: opening pushes a history entry, stepping replaces it, and Back closes. On a hash route (`#/text`, or a hash that already contains `?`) the parameter is written inside the hash (`#/text?photo=<id>`). Opening from a URL that already has the parameter is not a new action, and neither is Back or Forward. With `<site-analytics spa="auto">` (or `<uvalib-analytics spa="auto">`), that opening push is a same-document route change, so Matomo may count one page view; stepping replaces the entry and does not.
|
|
403
|
+
- **Details.** A child with `slot="details"` (optional `data-for` equal to the item's id or its position from 1; without `data-for` it shows for every image), or `data-details-id` on a link naming an element elsewhere on the page. It is shown in the dialog and put back when the viewer moves on or closes.
|
|
404
|
+
- **Photo grid.** Each direct child that is an `<a href>` or a `<button>` is one photo. The row is about 220px tall, and 140px when the viewport is 767px or narrower, unless `row-height` is set (a bare number is pixels; `rem`, `em` and the other CSS lengths are kept). Each image keeps its shape from its `width` and `height` attributes, or from the loaded image, so the row does not jump. Every item stays a real link or button. An image with no visible text gets a visible caption from its alt, and an alt that repeats that caption is cleared so it is not announced twice. The original alt is kept for a lightbox. A different alt is kept (the accessible name still contains the visible text). An `aria-label` is left as the name. Generated "Photo N" captions renumber when the photos change order. An item with no name is captioned "Photo N" and warned about once. A child that is not a link or a button is skipped, with one warning. The grid reports no analytics. Put it inside `<uvalib-lightbox>` and a plain click opens the viewer.
|
|
405
|
+
- **Motion and colour.** `prefers-reduced-motion` turns the dialog's short fade off. The backdrop, surface and focus ring use the dark-mode role tokens. Controls are at least 44px. `no-style` keeps the dialog's structure and, for the grid, the row layout: the thumbnails stay in light DOM, and those rules are what reserve each image's space.
|
|
406
|
+
|
|
205
407
|
## Rendering modes
|
|
206
408
|
|
|
207
409
|
| Attributes | Rendering |
|
|
@@ -219,6 +421,30 @@ Light-mode component styles live in `@layer uvalib`, scoped to their tag. Unlaye
|
|
|
219
421
|
|
|
220
422
|
The mode is read once, at first connect; do not toggle it afterwards.
|
|
221
423
|
|
|
424
|
+
## Buttons and forms
|
|
425
|
+
|
|
426
|
+
`base.css` also gives host content the library's buttons and fields, so a page's own search box, toggles and links-as-buttons match library.virginia.edu. Link `base.css` (see [Install](#install)) and add the classes:
|
|
427
|
+
|
|
428
|
+
```html
|
|
429
|
+
<form class="uvalib-search-form" role="search" action="/search">
|
|
430
|
+
<label for="q">Search the collections</label>
|
|
431
|
+
<input class="uvalib-input" id="q" name="q" type="search" />
|
|
432
|
+
<button class="uvalib-button" type="submit">Search</button>
|
|
433
|
+
</form>
|
|
434
|
+
|
|
435
|
+
<button class="uvalib-button" type="button">Primary</button>
|
|
436
|
+
<button class="uvalib-button uvalib-button--secondary" type="button">Secondary</button>
|
|
437
|
+
<button class="uvalib-button uvalib-button--subtle" type="button">Subtle</button>
|
|
438
|
+
<a class="uvalib-button uvalib-button--secondary" href="/next">Next page</a>
|
|
439
|
+
<button class="uvalib-button" type="button" aria-pressed="false">Show original line breaks</button>
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
- **`.uvalib-button`** is the library's button: blue-alt (`#007bac`) with white text and a 5px radius, darker on hover. Use it on `<button>` or `<a>`. `--secondary` is the outline, `--subtle` the pale blue one; `--small` and `--large` are the theme's sizes. Every button is at least 44px tall (small: 32px), has the library's orange focus ring, and a grey disabled look (`disabled`, or `aria-disabled="true"` while busy) that ignores the pointer (`pointer-events: none`: no hover, no click; an `aria-disabled` link still needs your script to ignore keyboard activation).
|
|
443
|
+
- **Toggles:** a `.uvalib-button` with `aria-pressed` is an outline with an empty box while off, and filled with a ticked box while on, so the state never rests on colour alone. A pressed toggle is filled whatever its variant (`--secondary` or `--subtle` style only the off state). Flip `aria-pressed` in your script; do not use a checkbox look-alike or `role="switch"` for it.
|
|
444
|
+
- **`.uvalib-input`** is a 44px text field; **`.uvalib-search-form`** puts the label, field and button in one row that wraps on phones. Keep a visible `<label>` (or at least an `aria-label`).
|
|
445
|
+
- **Dark mode and forced colors:** they follow the `--uva-color-button-*` role tokens. `base.css` carries every role token it reads itself (the same values as `tokens.css`), so a page that links only `base.css` stays readable under `data-uva-color-scheme`; link `tokens.css` too for your own content's other `--uva-color-*` tokens. Turn dark mode on with `color-scheme-switch` (see [Dark mode](#dark-mode)). In Windows high-contrast mode they keep visible outlines, show hover and press as a Highlight outline (dashed while pressed), a highlighted pressed toggle, and GrayText when disabled.
|
|
446
|
+
- **Cascade:** like the rest of `base.css` the rules are unlayered, so a host reset such as `button { background: none }` does not undo them; restyle with a more specific selector. They are only in `base.css`: `<site-page>` does not install them. The components' own buttons (bento-box, events-section, library-weekly-hours) keep their look, in light DOM too.
|
|
447
|
+
|
|
222
448
|
## Tokens and theming
|
|
223
449
|
|
|
224
450
|
- **Tokens:** inherited `--uva-*` custom properties (for example `--uva-brand-blue`, `--uva-font-family`), set on `:root` or an ancestor of the component. The full set is in `tokens.css`. Components read tokens with fallbacks and never set them.
|
|
@@ -242,7 +468,7 @@ Dark mode is **off by default**. Without it nothing changes: no control, no dark
|
|
|
242
468
|
- **Ownership:** every `<site-page>` or `<site-header>` with the switch owns the attribute; it is removed when the last of them is turned off or disconnected. A connected `<site-page>` or `<site-header>` without the switch removes a stray `data-uva-color-scheme` (for example from the snippet below on a page without the switch) unless another component on the page owns it; the stored choice is left alone.
|
|
243
469
|
- **Logo:** while the page shows dark mode, every header shows the reversed (white) logo from `https://static.lib.virginia.edu/files/downloads/LibraryLogos/` (it is not on the library website, so it does not follow `root-link-domain`). Under forced colors (a Windows contrast theme), which repaints the header, it follows the OS theme instead.
|
|
244
470
|
- **Footer:** already dark, it is the same in both schemes.
|
|
245
|
-
- **Alerts:**
|
|
471
|
+
- **Alerts:** `<site-alerts>` reads the `--uva-color-alert-*` role tokens (`-text`, `-link`, `-header-bg`, `-header-text`, and `-bg` / `-border` for `critical`, `warning`, `info`, `regional` and `regional-info`): library.virginia.edu's colours in light, a muted dark palette in dark, text 7:1 or more on every alert in both. The focus ring follows the text colour, so it passes on the dark alerts too.
|
|
246
472
|
- **Pre-footer band:** dark `#005679`, white text; unstyled links in it are white too (the site's own link colours still win).
|
|
247
473
|
|
|
248
474
|
**Avoid a flash of light on load.** Module scripts run after the first paint, so on pages whose `<site-page>` (or `<site-header>`) has `color-scheme-switch`, and only there, put this classic inline script in `<head>`, together with linked `tokens.css` and `base.css` (`<site-page>` also sets the attribute when it connects, so pages without it only flash briefly):
|
|
@@ -402,6 +628,35 @@ Three elements show opening hours from the library's own data, for library.virgi
|
|
|
402
628
|
- **Light DOM output** keeps the classes the Drupal theme styles under `.uvalib-bento-search`: `.bento-search-bar` (on a `<bento-search>` element, as before) with its `form`, `input`, `button.uvalib-button-home-search` and `p`; `.bs-header` (`h2`, `.bs-search-term`, `p`); `.bs-results-container` with each section as `.bs-results--block`; `.bs-results--header` (`h3` and the "See all" form and `.uvalib-button`), `.bs-results--body`, `ol.bs-results--list`, `.bs-results--list--entry`, `.bs-results--title`, `ul.ul-0`, `ul.ul-1`, `.bs-results--author`, `.bs-results--date`, `.bs-results--format`, `.bs-results--qty`, `.bs-results--teaser`, and the website's `.bento-section-title` and `.bento-section-desc`. Fixes to the markup: each `ul.ul-1` now sits in an `li` of its `ul.ul-0` (the theme's `ul.ul-0 ul.ul-1` still matches), the input has a real label and the submit button a text name (both visually hidden), the format line has no `aria-label` repeating its text, and the repeated `id="no-results"` is gone. A few rules apply even with `no-style`, scoped to the tags in `@layer uvalib`: the hosts are blocks, placeholders are invisible, the clamps and one-line rules above, the message shares the list's grid cell, and `[hidden]` hides. Styled (without `no-style`) the box follows the Drupal look with the dark-mode role tokens.
|
|
403
629
|
- **Drupal switch.** Replace the old `…/web-components/cdn-v2.2.38/@uvalib/bento-box/bento-box.js` script URL with `https://unpkg.internal.lib.virginia.edu/web-components/v1/bento-box.js`. The markup stays: `<bento-box no-style no-shadow-dom limit="3">`. The `uvalib-bento-search` body class is Drupal's and stays as it is; the headings follow the page's `<h1>` (`<h2>`, then `<h3>` sections), so no `heading-level` is needed. Links that used `?query=` keep working; new searches use `?q=`.
|
|
404
630
|
|
|
631
|
+
## Static-site search (Pagefind)
|
|
632
|
+
|
|
633
|
+
Static sites that search with [Pagefind](https://pagefind.app) (such as Electronic Text Collections) keep Pagefind's own index and script, and take the library look and the accessibility fixes from two files: `pagefind.css`, a theme for Pagefind's default UI (1.x), and `<uvalib-pagefind-search>`, a small element (about 4 KB gzipped, no Lit) that starts that UI with the library's defaults.
|
|
634
|
+
|
|
635
|
+
```html
|
|
636
|
+
<link rel="stylesheet" href="https://unpkg.internal.lib.virginia.edu/web-components/v1/base.css" />
|
|
637
|
+
<link
|
|
638
|
+
rel="stylesheet"
|
|
639
|
+
href="https://unpkg.internal.lib.virginia.edu/web-components/v1/pagefind.css"
|
|
640
|
+
/>
|
|
641
|
+
<script
|
|
642
|
+
type="module"
|
|
643
|
+
src="https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-pagefind-search.js"
|
|
644
|
+
></script>
|
|
645
|
+
|
|
646
|
+
<uvalib-pagefind-search
|
|
647
|
+
bundle-path="/pagefind/s0/"
|
|
648
|
+
merge-index='[{"bundlePath": "/pagefind/s1/"}, {"bundlePath": "/pagefind/s2/"}]'
|
|
649
|
+
placeholder="Search all texts"
|
|
650
|
+
show-sub-results
|
|
651
|
+
></uvalib-pagefind-search>
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
- **`pagefind.css` replaces Pagefind's `pagefind-ui.css`**: link one or the other, never both (the stock rules carry Svelte hash classes that out-rank the theme's). It maps Pagefind's `--pagefind-ui-*` custom properties to the library tokens (set them yourself for small changes) and restyles its classes: the field and the Clear button like `.uvalib-input` and a small outline `.uvalib-button`, the filters like `<uvalib-filter>` (a fieldset of native checkbox rows, "value (count)", long facets scroll in their own box), result titles in the link colour, excerpts with library.virginia.edu's `<mark>` colour, metadata tags, and "Load more results" as a `.uvalib-button`. It carries the dark-mode role tokens it reads (like `base.css`) and keeps every control visible in forced colors.
|
|
655
|
+
- **What it fixes in the stock UI:** text at 16px and up (the stock scale makes it 12.8px), a readable placeholder (stock: 20% opacity), the library focus ring on every control, a hidden Clear button that can no longer take focus (stock: invisible but focusable), native checkboxes (the stock ones vanish in forced colors), 44px targets for the filter headings, rows and buttons, no fixed heights that clip zoomed or spaced text, no arrow glyph read out before each sub-result, and a 320px reflow. Text is 7:1 or more (WCAG AAA) in light and dark, except the Load more button's white on blue-alt in light mode (4.7:1, as on every `.uvalib-button`).
|
|
656
|
+
- **What needs script, done by `<uvalib-pagefind-search>`:** a visible `<label>` for the field (the stock field is named only by its `title` and has no id to point a label at), a polite status region that announces "7 results for virginia" once results settle (the stock message is not a live region), focus kept in the field after Clear and Escape (the stock UI blurs it) and moved to the first new result after "Load more results", and the loading placeholders' dots hidden from screen readers. It also reads `?q=` when it starts (and again on Back and Forward) and writes the settled query back with `history.replaceState` (`query-param`, default `q`; empty turns it off), and reports to `<site-analytics>`: the settled search (`trackSearch`, category `Pagefind`, with the result count, once per query and filter set) and `['uvalib-pagefind-search', 'filter-change', '<filter>: <value>', 1 | 0]`.
|
|
657
|
+
- **Still open** (in Pagefind's markup, not fixable from outside without rewriting it): filter checkbox ids are built from the filter and value (`author-Jefferson, Thomas`), so they can contain spaces and repeat if a page has two search UIs.
|
|
658
|
+
- The element loads `<bundle-path>pagefind-ui.js` unless `window.PagefindUI` already exists; Pagefind itself stays the site's. `el.ready` resolves with the `PagefindUI` instance, for `triggerFilters` (filters from the URL, say). Attributes are read when it connects; removing the element destroys the Pagefind UI, and inserting it again starts a new one (`bundle-path` and each `merge-index` path get their trailing `/` if missing, and `options` cannot move the UI out of the element). Without the element, the theme still styles `new PagefindUI({ element })`, but then the field needs a label and the results a live region from your own script. See the [Pagefind example](https://uvalib.github.io/reusable-web-library/#pagefind-search) in the playground and the reference below.
|
|
659
|
+
|
|
405
660
|
## Analytics
|
|
406
661
|
|
|
407
662
|
`<site-analytics>` and `<uvalib-analytics>` are one element under two names (`site-analytics.js`, `uvalib-analytics.js`; npm `@uvalib/web-components/site-analytics.js`, `…/uvalib-analytics.js`). It has no visual output: it loads Matomo (`https://analytics.lib.virginia.edu/matomo.js`), records the page view and forwards the events below to Matomo.
|
|
@@ -414,24 +669,58 @@ Three elements show opening hours from the library's own data, for library.virgi
|
|
|
414
669
|
<uvalib-analytics matomoid="10"></uvalib-analytics>
|
|
415
670
|
```
|
|
416
671
|
|
|
417
|
-
- **Attributes.** `matomoid`: the Matomo site id; without it, the site whose URL the page is under (the library's site registry), and with none, the element does nothing. `matomourl` (default `https://analytics.lib.virginia.edu/`, ending in `/`): the Matomo server. `spa`: no page view on load; a single-page app records each view with a pageview event. `variables`: custom dimensions as a JSON object, `variables='{"1":"staff"}'`, set before the page view.
|
|
418
|
-
- **Events.** Both tags listen on `document` for both families, `uvalib-analytics-*` (the original names) and `site-analytics-*`. Fire them bubbling and composed from anywhere, or with `trackEvent(el, parts)` and `trackSearch(el, query, category?, count?)` from `@uvalib/web-components/base.js
|
|
672
|
+
- **Attributes.** `matomoid`: the Matomo site id; without it, the site whose URL the page is under (the library's site registry), and with none, the element does nothing. `matomourl` (default `https://analytics.lib.virginia.edu/`, ending in `/`): the Matomo server. `spa`: no page view on load; a single-page app records each view with a pageview event. `spa="auto"`: the element records them itself, one on load and one per same-document route change (see below). `variables`: custom dimensions as a JSON object, `variables='{"1":"staff"}'`, set before the page view.
|
|
673
|
+
- **Events.** Both tags listen on `document` for both families, `uvalib-analytics-*` (the original names) and `site-analytics-*`. Fire them bubbling and composed from anywhere, or with `trackEvent(el, parts)` and `trackSearch(el, query, category?, count?)` from `@uvalib/web-components/base.js` (which follow the opt-outs below; `analyticsAllowed(el)` tells you whether `el` may report), or the mixins (`UvalibAnalyticsMixin`: `_analyticsEvent`, `_analyticsSearch`, firing `uvalib-analytics-*`; `SiteAnalyticsMixin`: `analyticsEvent`, `analyticsSearch`, firing `site-analytics-*`).
|
|
419
674
|
- `…-event`: `detail: { event: [category, action, name?, value?] }` (`track` is accepted as the old name), a Matomo `trackEvent`.
|
|
420
675
|
- `…-search`: `detail: { searchQuery, searchCategory?, resultCount? }`, a Matomo site search; an unknown count (null or missing) is sent as Matomo's "unknown".
|
|
421
676
|
- `…-pageview`: `detail: { customTitle?, referrer? }`, a page view; the title defaults to the document's, a referrer without `http` is a path on this origin, and with none the document's referrer is used.
|
|
677
|
+
- `…-content`: `detail: { name, piece, target?, interaction? }`, a Matomo content impression (`trackContentImpression`), or with `interaction` a `trackContentInteraction`; `trackContent(el, { name, piece, target?, interaction? })` from `@uvalib/web-components/base.js` fires it.
|
|
422
678
|
- **Nothing is lost or counted twice.** Every call goes through Matomo's `_paq` queue, which matomo.js replays when it loads, so events fired before it arrives are kept (and nothing waits for it if it is blocked). However many analytics elements a page has, from any copy of this library (an npm build next to a CDN script, two CDN versions), matomo.js is loaded and the page view recorded once and only one element forwards each event; if it is removed, the next one takes over. A Matomo snippet already on the page (a `matomo.js` script, or a `_paq` that sets a site id) is used as it is: nothing is loaded or recorded again, and the element only forwards the events.
|
|
423
|
-
- **Matomo's own link tracking** (`enableLinkTracking`, on unless `spa`, as in the old element) still records clicks on links to other sites and downloads with their URLs, result links included. The components' own events never carry titles or URLs.
|
|
679
|
+
- **Matomo's own link tracking** (`enableLinkTracking`, on unless `spa`, as in the old element) still records clicks on links to other sites and downloads with their URLs, result links included. Besides Matomo's own download types (pdf, doc*, xls*, ppt*, …), links to the library's file types count as downloads: epub, mobi, csv, tsv, json, xml, zip, tar, gz, mp3, mp4, m4a, tif, tiff, jp2, mrc, ris, bib and txt (`addDownloadExtensions`). The components' own events never carry titles or URLs.
|
|
680
|
+
- **`spa="auto"`** records a page view on load and on every same-document route change (`history.replaceState`, such as a search page syncing its filters to the URL, and reloads are never page views): a hash change, Back and Forward (`popstate`), the Navigation API's `currententrychange` where the browser has it, and `history.pushState` (wrapped once per page, shared by every copy of this library, and left in place). The view is recorded on the next frame, so the title the app sets right after navigating is the one counted, with the URL as the custom URL and the previous view's URL as the referrer. A change to the URL already counted (`replaceState`, a second `pushState` to the same URL, the several events one Back fires) is not counted again. Opening `<uvalib-lightbox url-param>` pushes one history entry, so this counts that open as a page view; stepping through the images replaces the entry and is not another view. Bare `spa` keeps its meaning: no automatic views.
|
|
681
|
+
- **`data-uvalib-track` for host content.** A click on an element with `data-uvalib-track="category,action[,name[,value]]"`, or on anything inside it, sends that Matomo event (the nearest tagged element wins; `value` must be a number). It works in light and shadow DOM (one capture-phase listener on `document`, reading the click's composed path) and needs an analytics element on the page. Use your site's name or the widget as the category and a fixed verb as the action, and never put titles, URLs or personal data in it: `<a href="/spaces" data-uvalib-track="home-page,banner-click,Study spaces">`.
|
|
424
682
|
- **`<site-page matomo-id="N">`** (and optional `matomo-url`) adds one `<site-analytics>` for that site and loads its code only then. Off by default. While that code loads, what the components report is kept and handed over, so an early bento search is not lost. If the page already has a `<site-analytics>` or `<uvalib-analytics>` (including the old v0.0.12 one), site-page adds none and that element does the recording.
|
|
425
|
-
- **What the library's components send
|
|
426
|
-
|
|
427
|
-
| Component
|
|
428
|
-
|
|
|
429
|
-
|
|
|
430
|
-
|
|
|
431
|
-
|
|
|
432
|
-
|
|
|
433
|
-
|
|
434
|
-
-
|
|
683
|
+
- **What the library's components send.** They only fire `uvalib-analytics-*` events, so nothing happens without an analytics element (the old v0.0.12 element records them too). Every event is `[category, action, name?, value?]`: the category is the component's tag, the action a fixed verb, the name a short label from the library's own chrome or data (never a URL, never typed text), the value a number. Each one follows a visitor's action or a real failure: nothing is sent on render, re-render, the initial state or a restored one (a filter value set by the app, a remembered colour scheme). Errors are sent once per element and kind of failure.
|
|
684
|
+
|
|
685
|
+
| Component | Action | Name | Value |
|
|
686
|
+
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
687
|
+
| `site-header` | `link-click` (a utility or site link) | the link's label | |
|
|
688
|
+
| `site-header` | `menu-open` (the phone Menu popover) | | |
|
|
689
|
+
| `site-header` | `skip-link`, `logo-click` | | |
|
|
690
|
+
| `site-header` | `color-scheme` | `light`, `dark` or `system` | |
|
|
691
|
+
| `site-main-nav` | `menu-open` (a group opens, not closes) | the group's label | |
|
|
692
|
+
| `site-main-nav` | `link-click` | `Group > Link` (a top-level link: its label) | |
|
|
693
|
+
| `site-footer` | `link-click` (not the pre-footer's) | `Column: Link`, e.g. `About: Staff directory`; `Contact us: Phone`, `Contact us: Email`; `Social: Facebook`, `Social: Instagram` | |
|
|
694
|
+
| `uvalib-breadcrumbs` | `link-click` | `level N` (never the label) | N, from 1 |
|
|
695
|
+
| `uvalib-card` | `card-click` | `single`, or the card's place in its grid (`1`, `2`, …); never the title or URL | that place, from 1, in a grid |
|
|
696
|
+
| `uvalib-pager` | `page-change` | `next`, `previous` or `number` (never the label or URL) | the page, for `number` only |
|
|
697
|
+
| `uvalib-contents` | `link-click` | `level N` (never the label or URL) | N, from 1 (the top level) |
|
|
698
|
+
| `uvalib-contents` | `toggle` (the narrow-screen disclosure) | `open` or `close` | |
|
|
699
|
+
| `uvalib-metadata` | `copy-citation` (downloads are left to Matomo's own download tracking) | | |
|
|
700
|
+
| `uvalib-lightbox` | `open`, `next`, `previous`, `full-size` | `image N` (never the URL or the caption) | N, from 1 |
|
|
701
|
+
| `site-alerts` | a content impression, once per alert per page view: `trackContentImpression('Library alert', '<severity>: <title>')` | | |
|
|
702
|
+
| `site-alerts` | `dismiss`, `link-click` (a link in an alert's text) | `<severity>: <title>` | |
|
|
703
|
+
| `site-alerts` | `error` (the alerts script failed to load) | `alerts-script` | |
|
|
704
|
+
| `events-section` | `event-click` | the `category` id, or `all` | the event's position, from 1 |
|
|
705
|
+
| `events-section` | `error` | `events-load` | |
|
|
706
|
+
| `site-hours-section` | `link-click` | `See all hours` | |
|
|
707
|
+
| `site-hours-section`, `library-weekly-hours` | `error` | `hours-load` | |
|
|
708
|
+
| `library-weekly-hours` | `week-change` | `next` or `previous` | |
|
|
709
|
+
| `uvalib-filter` | `facet-change` | `<filter title>: <value>` (the facet value as the search service returns it, such as a format, library or subject; cut at 100 characters) | 1 checked, 0 unchecked |
|
|
710
|
+
| `uvalib-filter` | `scope-change` | the scope's label | 1 pressed, 0 not |
|
|
711
|
+
| `uvalib-filter` | `see-more`, `see-less` | the filter's title | |
|
|
712
|
+
| `uvalib-date-range` | `range-change` (1 s after the last change, and only if the years differ) | `<from year>–<to year>` | |
|
|
713
|
+
| `bento-box` | `result-click` | the section (`Virgo catalog`, `Virgo articles`, `Subject guides`, `Library website`) | the result's position, from 1 |
|
|
714
|
+
| `bento-box` | `see-all-click`, `retry` | the section | |
|
|
715
|
+
| `bento-box` | `error` | `section-load: <section>` | |
|
|
716
|
+
|
|
717
|
+
`<bento-box>` also sends a Matomo site search per section once its results are in (not on an error, not again on a re-render): the query, the section as category, and the section's total (0 when nothing was found). A new query, also by Back or Forward, is a new search. The `<library-weekly-hours>` elements `<library-hours-setup>` creates report as `library-weekly-hours`. Alert severities are `Critical`, `Warning`, `Information`, `Header` or `Regional warning` / `Regional information`. Names are capped at 100 characters. `<uvalib-photo-grid>` reports nothing.
|
|
718
|
+
|
|
719
|
+
- **Privacy.** The components never send URLs, paths, record titles, ids, email addresses or phone numbers, or anything a visitor typed: only the fixed names above, positions and counts, labels of the library's own links, and the titles of library alerts (written by the library for everyone). The one exception is search: bento-box's queries are what visitors typed, and are sent as Matomo site searches.
|
|
720
|
+
- **Opting out.** Nothing is sent from a component, a `data-uvalib-track` element or an event fired by hand when:
|
|
721
|
+
- the page has `<html data-uvalib-analytics="off">` (then, as with Do Not Track, `<site-analytics>` loads no matomo.js and records no page view either);
|
|
722
|
+
- the element or an ancestor, across shadow roots, has the `no-analytics` attribute (`<div no-analytics>` around a private widget, `<bento-box no-analytics>`);
|
|
723
|
+
- the browser sends Do Not Track (`navigator.doNotTrack === '1'`) or Global Privacy Control (`navigator.globalPrivacyControl === true`). Then the analytics element also loads no matomo.js and records no page view, automatic or not.
|
|
435
724
|
- **Drupal switch.** Replace the script URL `https://unpkg.internal.lib.virginia.edu/v0.0.12/uvalib-analytics.js` with `https://unpkg.internal.lib.virginia.edu/web-components/v1/uvalib-analytics.js`. The markup stays: `<uvalib-analytics matomoid="10">`.
|
|
436
725
|
|
|
437
726
|
## Components
|
|
@@ -462,7 +751,7 @@ Virgo's first article results for `query`. Articles Virgo hides from guests keep
|
|
|
462
751
|
|---|---|
|
|
463
752
|
| `bento-state` | Whenever `state` changes (bubbles, composed); `<bento-box>` listens to announce "Results updated" once every section has settled. |
|
|
464
753
|
| `uvalib-analytics-search` | For `<site-analytics>`: once per settled search (results or none, not an error): the query, the section's `analyticsName` as category and its total when known. Bubbles and is composed. |
|
|
465
|
-
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; never titles or URLs. Bubbles and is composed. |
|
|
754
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; `['bento-box', 'retry', <section>]` for its Retry button; `['bento-box', 'error', 'section-load: <section>']` once when its results cannot be loaded; never titles or URLs. Bubbles and is composed. |
|
|
466
755
|
|
|
467
756
|
#### CSS custom properties
|
|
468
757
|
|
|
@@ -526,7 +815,7 @@ The Virgo catalog's first results for `query` (books, journals, archives, maps,
|
|
|
526
815
|
|---|---|
|
|
527
816
|
| `bento-state` | Whenever `state` changes (bubbles, composed); `<bento-box>` listens to announce "Results updated" once every section has settled. |
|
|
528
817
|
| `uvalib-analytics-search` | For `<site-analytics>`: once per settled search (results or none, not an error): the query, the section's `analyticsName` as category and its total when known. Bubbles and is composed. |
|
|
529
|
-
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; never titles or URLs. Bubbles and is composed. |
|
|
818
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; `['bento-box', 'retry', <section>]` for its Retry button; `['bento-box', 'error', 'section-load: <section>']` once when its results cannot be loaded; never titles or URLs. Bubbles and is composed. |
|
|
530
819
|
|
|
531
820
|
#### CSS custom properties
|
|
532
821
|
|
|
@@ -555,6 +844,12 @@ Upcoming UVA Library events from LibCal, as on the library.virginia.edu home pag
|
|
|
555
844
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
556
845
|
| `no-style` | `boolean` | `false` | |
|
|
557
846
|
|
|
847
|
+
#### Events
|
|
848
|
+
|
|
849
|
+
| Event | Description |
|
|
850
|
+
|---|---|
|
|
851
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a click on an event, `['events-section', 'event-click', <category id, or all>, <position, from 1>]` (never its title or URL), and `['events-section', 'error', 'events-load']` once when the events cannot be loaded. Bubbles and is composed. |
|
|
852
|
+
|
|
558
853
|
#### CSS custom properties
|
|
559
854
|
|
|
560
855
|
| Property | Default | Description |
|
|
@@ -589,7 +884,7 @@ The first subject guide pages (LibGuides) matching `query`: the page and its gui
|
|
|
589
884
|
|---|---|
|
|
590
885
|
| `bento-state` | Whenever `state` changes (bubbles, composed); `<bento-box>` listens to announce "Results updated" once every section has settled. |
|
|
591
886
|
| `uvalib-analytics-search` | For `<site-analytics>`: once per settled search (results or none, not an error): the query, the section's `analyticsName` as category and its total when known. Bubbles and is composed. |
|
|
592
|
-
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; never titles or URLs. Bubbles and is composed. |
|
|
887
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; `['bento-box', 'retry', <section>]` for its Retry button; `['bento-box', 'error', 'section-load: <section>']` once when its results cannot be loaded; never titles or URLs. Bubbles and is composed. |
|
|
593
888
|
|
|
594
889
|
#### CSS custom properties
|
|
595
890
|
|
|
@@ -629,6 +924,12 @@ One library's opening hours for a week (Sunday to Saturday, in America/New_York)
|
|
|
629
924
|
|---|---|
|
|
630
925
|
| `building-hours` | The "Building hours" table row (shadow mode). |
|
|
631
926
|
|
|
927
|
+
#### Events
|
|
928
|
+
|
|
929
|
+
| Event | Description |
|
|
930
|
+
|---|---|
|
|
931
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['library-weekly-hours', 'week-change', 'next' \| 'previous']` for the week buttons, and `['library-weekly-hours', 'error', 'hours-load']` once when the hours cannot be loaded. Bubbles and is composed. |
|
|
932
|
+
|
|
632
933
|
#### CSS custom properties
|
|
633
934
|
|
|
634
935
|
| Property | Default | Description |
|
|
@@ -642,9 +943,47 @@ One library's opening hours for a week (Sunday to Saturday, in America/New_York)
|
|
|
642
943
|
| `--uva-color-surface-raised` | | Dark-mode role token: button background (else #fff). |
|
|
643
944
|
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
644
945
|
|
|
946
|
+
### `<site-alerts>`
|
|
947
|
+
|
|
948
|
+
Live UVA Library alerts, drawn as library.virginia.edu draws them. The alerts project (github.com/uvalib/uvalib-alerts) keeps the data: a headless `<uvalib-alerts>` loaded at runtime from the alerts CDN (`alerts-env`, or `alerts-src`), one per document, shared by every `<site-alerts>` and created hidden at the end of `<body>`. It keeps the live connection, the dismissals (per site, synced across tabs) and the regional matching (the page URL, followed through single-page-app navigation). If its script fails to load, one console warning is logged and nothing is shown. `show` picks the alerts: `header` (the banner: a polite `role="status"` row on teal), `list` (critical, warning and information alerts, most severe first; only critical ones are an assertive `role="alert"`), `regional` (alerts targeted at this page), `sitewide` (header and list) or `all` (the default). Each list alert has a decorative icon and a visually hidden "Critical:", "Warning:" or "Information:" before its title, a heading (`heading-level`, default 2, as on library.virginia.edu). Warning and information alerts have a dismiss button; after a dismissal focus moves to the next alert's button (or the alert), else to the page's `<main>`, never to `<body>`. Alert bodies are server-sanitized HTML, re-sanitized with the browser's `setHTML()` where it exists. `<site-page>` places three of these itself (banner, list band, regional); use this element directly only on pages without `<site-page>`.
|
|
949
|
+
|
|
950
|
+
#### Attributes
|
|
951
|
+
|
|
952
|
+
| Attribute | Type | Default | Description |
|
|
953
|
+
|---|---|---|---|
|
|
954
|
+
| `show` | `SiteAlertsShow` | `'all'` | Which alerts to show: `header`, `list`, `regional`, `sitewide` (header and list) or `all`. |
|
|
955
|
+
| `alerts-env` | `string` | `'production'` | Alerts environment: `production` (default) or `staging`. Any other value logs one console warning and uses production. Ignored when `alerts-src` is set. |
|
|
956
|
+
| `alerts-src` | `string \| undefined` | | Alerts base URL (holding `config.json`, `alerts.json` and `v1/uvalib-alerts.js`); overrides `alerts-env`. For a custom domain, local development and tests. |
|
|
957
|
+
| `heading-level` | | `DEFAULT_LEVEL` | The level of each list alert's title heading, 1 to 6 (default 2). |
|
|
958
|
+
| `storage-key` | `string \| undefined` | | The localStorage key for dismissed alerts, passed to the headless element (default: the alerts project's, `uvalib-alerts-seen`). Elements with different keys use different headless elements. |
|
|
959
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
960
|
+
| `no-style` | `boolean` | `false` | |
|
|
961
|
+
|
|
962
|
+
#### Events
|
|
963
|
+
|
|
964
|
+
| Event | Description |
|
|
965
|
+
|---|---|
|
|
966
|
+
| `site-alerts-change` | The number of alerts this element shows changed: `detail` is `{ count }`. Bubbles and is composed. The host also has `data-empty` while it shows none. |
|
|
967
|
+
|
|
968
|
+
#### CSS custom properties
|
|
969
|
+
|
|
970
|
+
| Property | Default | Description |
|
|
971
|
+
|---|---|---|
|
|
972
|
+
| `--uva-teal` | `#25cad3` | Header banner background. |
|
|
973
|
+
| `--uva-red-100` | `#fbcfda` | Critical alert background (`--uva-red-B` #b30000 border). |
|
|
974
|
+
| `--uva-yellow-100` | `#fef6c8` | Warning alert and regional alert background (`--uva-yellow` #ecc602 border). |
|
|
975
|
+
| `--uva-blue-alt-300` | `#bfe7f7` | Information alert background (`--uva-blue-alt` #007bac border). |
|
|
976
|
+
| `--uva-teal-200` | `#c8f2f4` | Information regional alert background (`--uva-teal` border). |
|
|
977
|
+
| `--uva-grey-darkest` | `#2b2b2b` | Alert text. |
|
|
978
|
+
| `--uva-blue-alt-B` | `#141e3c` | Links in alert text. |
|
|
979
|
+
| `--uva-color-alert-text` | | Dark-mode role token: alert text, icons and focus ring (else `--uva-grey-darkest`; the banner's is `--uva-color-alert-header-text`, else #000). |
|
|
980
|
+
| `--uva-color-alert-link` | | Dark-mode role token: links in alert text (else `--uva-blue-alt-B`). |
|
|
981
|
+
| `--uva-color-alert-header-bg` | | Dark-mode role token: banner background (else `--uva-teal`). |
|
|
982
|
+
| `--uva-color-alert-critical-bg` | | Dark-mode role token: critical alert background; `-border` for its border. Also `--uva-color-alert-warning-*`, `--uva-color-alert-info-*`, `--uva-color-alert-regional-*` and `--uva-color-alert-regional-info-*`. |
|
|
983
|
+
|
|
645
984
|
### `<site-analytics>`
|
|
646
985
|
|
|
647
|
-
Matomo analytics, with no visual output. Loads matomo.js for the site and records the page view, then forwards the events below, fired anywhere in the page, to Matomo. Every call goes through Matomo's `_paq` queue, so events fired before matomo.js loads are kept. One tracker per page: however many `<site-analytics>` and `<uvalib-analytics>` elements there are (from any copy of this library), matomo.js is loaded and the page view recorded once, and only one element forwards each event; if it is removed, the next takes over. A Matomo snippet already on the page is used as it is (nothing is loaded or recorded again). The same element is registered as `<uvalib-analytics>` by `uvalib-analytics.js`.
|
|
986
|
+
Matomo analytics, with no visual output. Loads matomo.js for the site and records the page view, then forwards the events below, fired anywhere in the page, to Matomo. Every call goes through Matomo's `_paq` queue, so events fired before matomo.js loads are kept. One tracker per page: however many `<site-analytics>` and `<uvalib-analytics>` elements there are (from any copy of this library), matomo.js is loaded and the page view recorded once, and only one element forwards each event; if it is removed, the next takes over. A Matomo snippet already on the page is used as it is (nothing is loaded or recorded again). When the browser sends Do Not Track or Global Privacy Control, or the page has `<html data-uvalib-analytics="off">`, it loads nothing and records nothing. A click on an element with `data-uvalib-track="category,action[,name[,value]]"` (or inside one, in light or shadow DOM) sends that event, unless `<html data-uvalib-analytics="off">` or a `no-analytics` ancestor opts it out. The same element is registered as `<uvalib-analytics>` by `uvalib-analytics.js`.
|
|
648
987
|
|
|
649
988
|
#### Attributes
|
|
650
989
|
|
|
@@ -652,7 +991,7 @@ Matomo analytics, with no visual output. Loads matomo.js for the site and record
|
|
|
652
991
|
|---|---|---|---|
|
|
653
992
|
| `matomourl` | `string` | `'https://analytics.lib.virginia.edu/'` | The Matomo server, ending in `/` (attribute `matomourl`). |
|
|
654
993
|
| `matomoid` | `number \| undefined` | | The Matomo site id (attribute `matomoid`). Default: the site whose URL the page is under. |
|
|
655
|
-
| `spa` | `boolean` | `false` | A single-page app records its own page views (`uvalib-analytics-pageview`)
|
|
994
|
+
| `spa` | `boolean \| 'auto'` | `false` | A single-page app. `spa` (no value): it records its own page views (`uvalib-analytics-pageview`), none on load. `spa="auto"`: a page view on load and one per same-document route change (hash change, Back and Forward, `history.pushState`), once the title has settled, never twice in a row for the same URL, with the previous URL as the referrer. Either way Matomo's link tracking is off. |
|
|
656
995
|
| `variables` | `Record<string, unknown> \| null` | `null` | Custom dimensions, a JSON object of `{ id: value }`, set before the page view. |
|
|
657
996
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
658
997
|
| `no-style` | `boolean` | `false` | |
|
|
@@ -664,9 +1003,11 @@ Matomo analytics, with no visual output. Loads matomo.js for the site and record
|
|
|
664
1003
|
| `uvalib-analytics-pageview` | Listened for on `document` (not fired): records a page view; `detail` is `{ customTitle?, referrer? }` (default: the document's title and referrer; a referrer without `http` is taken as a path on this origin). |
|
|
665
1004
|
| `uvalib-analytics-search` | Listened for on `document` (not fired): a Matomo site search; `detail` is `{ searchQuery, searchCategory?, resultCount? }`. |
|
|
666
1005
|
| `uvalib-analytics-event` | Listened for on `document` (not fired): a Matomo event; `detail` is `{ event: [category, action, name?, value?] }` (`track` is the old name of `event`). |
|
|
1006
|
+
| `uvalib-analytics-content` | Listened for on `document` (not fired): a Matomo content impression; `detail` is `{ name, piece, target?, interaction? }` (with `interaction`, a content interaction instead). |
|
|
667
1007
|
| `site-analytics-pageview` | Listened for on `document` too: the same as `uvalib-analytics-pageview`. |
|
|
668
1008
|
| `site-analytics-search` | Listened for on `document` too: the same as `uvalib-analytics-search`. |
|
|
669
1009
|
| `site-analytics-event` | Listened for on `document` too: the same as `uvalib-analytics-event`. |
|
|
1010
|
+
| `site-analytics-content` | Listened for on `document` too: the same as `uvalib-analytics-content`. |
|
|
670
1011
|
|
|
671
1012
|
### `<site-footer>`
|
|
672
1013
|
|
|
@@ -692,6 +1033,12 @@ UVA Library site footer: link columns, contact details and copyright.
|
|
|
692
1033
|
|---|---|
|
|
693
1034
|
| `footer` | The `<footer>` element. |
|
|
694
1035
|
|
|
1036
|
+
#### Events
|
|
1037
|
+
|
|
1038
|
+
| Event | Description |
|
|
1039
|
+
|---|---|
|
|
1040
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a click on one of the footer's own links (not the pre-footer's), `['site-footer', 'link-click', '<Column>: <Link>']`, for example `Using the Library: Get help`; the phone and email links are `Contact us: Phone` and `Contact us: Email`, the social links `Social: Facebook` and `Social: Instagram`. Never a URL. Bubbles and is composed. |
|
|
1041
|
+
|
|
695
1042
|
#### CSS custom properties
|
|
696
1043
|
|
|
697
1044
|
| Property | Default | Description |
|
|
@@ -705,7 +1052,7 @@ UVA Library site footer: link columns, contact details and copyright.
|
|
|
705
1052
|
|
|
706
1053
|
### `<site-header>`
|
|
707
1054
|
|
|
708
|
-
UVA Library site header: logo, utility navigation, and a popover menu on narrow screens. A site can replace the library utility links (My account, Ask a Librarian, Hours, Give, Alerts, Search) with its own: give the header `<a slot="site-links" href="…">` children. They are shown, in order, in the inline nav and the Menu popover, with `href` as written (not joined to `root-link-domain`) and their `aria-current`, `target`, `rel` and `hreflang`. The source anchors themselves stay hidden. Children that are not `<a href>` with text (empty or whitespace-only text counts as none) are ignored with one console warning. The `vendor` variant ignores site links and keeps its own reduced link set. The full header also shows the UVA Library main navigation (`<site-main-nav>`): a row under the logo row on wide screens, and an accordion at the top of the Menu popover on narrow ones (992px and below), above the utility or site links. `no-main-nav` turns it off, leaving the header exactly as it was without it; the `vendor` variant never shows it. A `<nav slot="main-nav">` child replaces its links (see `<site-main-nav>`), and `main-nav-src` loads them from JSON; `main-nav-current` sets the URL marked current. `color-scheme-switch` opts in to dark mode (off by default; see the README's "Dark mode"): a Light / Dark / System radio group ("Theme") at the end of the utility-links row on wide screens and at the bottom of the Menu popover on narrow ones. The `vendor` variant, which has no Menu, shows it after its inline link, on a row of its own under the logo row on narrow screens. In dark mode the logo is the reversed (white) one.
|
|
1055
|
+
UVA Library site header: logo, utility navigation, and a popover menu on narrow screens. A site can replace the library utility links (My account, Ask a Librarian, Hours, Give, Alerts, Search) with its own: give the header `<a slot="site-links" href="…">` children. They are shown, in order, in the inline nav and the Menu popover, with `href` as written (not joined to `root-link-domain`) and their `aria-current`, `target`, `rel` and `hreflang`. The source anchors themselves stay hidden. Children that are not `<a href>` with text (empty or whitespace-only text counts as none) are ignored with one console warning. The `vendor` variant ignores site links and keeps its own reduced link set. The full header also shows the UVA Library main navigation (`<site-main-nav>`): a row under the logo row on wide screens, and an accordion at the top of the Menu popover on narrow ones (992px and below), above the utility or site links. `no-main-nav` turns it off, leaving the header exactly as it was without it; the `vendor` variant never shows it. A `<nav slot="main-nav">` child replaces its links (see `<site-main-nav>`), and `main-nav-src` loads them from JSON; `main-nav-current` sets the URL marked current. `color-scheme-switch` opts in to dark mode (off by default; see the README's "Dark mode"): a Light / Dark / System radio group ("Theme") at the end of the utility-links row on wide screens and at the bottom of the Menu popover on narrow ones. The `vendor` variant, which has no Menu, shows it after its inline link, on a row of its own under the logo row on narrow screens. In dark mode the logo is the reversed (white) one. `site-name` shows a sub-site's name after the logo, past a thin divider, as a link to the site's home (`site-name-href`, default `/`); the logo still links to library.virginia.edu. The name is not a heading (the page keeps its own `<h1>`) and its link is named "<name> home". On wide screens it sits in the logo row, wrapping to at most two lines (keep it short), so the header is no taller, while the links (and theme control) fit beside it on one line; when they would not, and at 992px and below, it gets its own lines under the logo, so the links are laid out exactly as without it. The `vendor` variant shows it too.
|
|
709
1056
|
|
|
710
1057
|
#### Attributes
|
|
711
1058
|
|
|
@@ -714,6 +1061,8 @@ UVA Library site header: logo, utility navigation, and a popover menu on narrow
|
|
|
714
1061
|
| `root-link-domain` | `string` | `'https://www.library.virginia.edu'` | |
|
|
715
1062
|
| `variant` | `'full' \| 'vendor'` | `'full'` | |
|
|
716
1063
|
| `site-links-label` | `string \| undefined` | | Accessible name of the nav when site links replace the utility links (default "Site"; the popover nav's name adds " menu"). |
|
|
1064
|
+
| `site-name` | `string \| undefined` | | The sub-site's name, shown after the library logo as a link to the site's home (`site-name-href`). The logo still links to library.virginia.edu. Not a heading. |
|
|
1065
|
+
| `site-name-href` | `string \| undefined` | | Where the site name links (default `/`, the site's own home). |
|
|
717
1066
|
| `no-main-nav` | `boolean` | `false` | Hide the UVA Library main navigation (the row under the logo and the popover accordion). |
|
|
718
1067
|
| `main-nav-label` | `string \| undefined` | | Accessible name of the main navigation (default "Main"). |
|
|
719
1068
|
| `main-nav-src` | `string \| undefined` | | URL of JSON main navigation items (`MainNavItem[]`, needs CORS), passed to `<site-main-nav items-src>`. |
|
|
@@ -727,7 +1076,7 @@ UVA Library site header: logo, utility navigation, and a popover menu on narrow
|
|
|
727
1076
|
| Slot | Description |
|
|
728
1077
|
|---|---|
|
|
729
1078
|
| `skip-link` | Shadow mode only: optional skip link, rendered first inside `<header>` (`<site-page>` uses it). |
|
|
730
|
-
| `alerts` | Optional alert banner (`<site-page>` passes its `<
|
|
1079
|
+
| `alerts` | Optional alert banner (`<site-page>` passes its `<site-alerts show="header">`), shown as a full-bleed row at the very top of `<header>` (flush with its top and both edges, outside its padding), after the skip link and before the logo row. In light mode the children are moved to the start of `<header>`. The header never loads alerts itself. |
|
|
731
1080
|
| `main-nav` | Optional `<nav>` whose `<ul>` replaces the main navigation's links in both layouts: `<li><a href>` for a direct link, `<li><span>Group</span><ul><li><a href>…</a></li></ul></li>` for a group. Invalid entries are skipped with one console warning. Never shown itself; in light mode it is moved into a hidden holder. Ignored with `no-main-nav` and by the `vendor` variant. |
|
|
732
1081
|
| `site-links` | Optional `<a href>` elements with text that replace the library utility links in the inline nav and the Menu popover (ignored by the `vendor` variant). In light mode they are moved into a hidden holder. |
|
|
733
1082
|
|
|
@@ -742,7 +1091,7 @@ UVA Library site header: logo, utility navigation, and a popover menu on narrow
|
|
|
742
1091
|
| Event | Description |
|
|
743
1092
|
|---|---|
|
|
744
1093
|
| `site-main-nav-error` | `main-nav-src` could not be loaded; the bundled main navigation is shown. `detail` is `{ src, message }`. Fired once, from the bar's `<site-main-nav>`; bubbles and is composed. |
|
|
745
|
-
| `uvalib-analytics-event` | For `<site-analytics>`: the visitor picked a colour scheme, `['site-header', 'color-scheme', 'light' \| 'dark' \| 'system']` (not the initial value), and the main navigation's menu opens (see `<site-main-nav>`). Bubbles and is composed. |
|
|
1094
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: the visitor picked a colour scheme, `['site-header', 'color-scheme', 'light' \| 'dark' \| 'system']` (not the initial value); `['site-header', 'link-click', <label>]` for a utility or site link, `['site-header', 'logo-click']`, `['site-header', 'site-name-click']` (the `site-name` link), `['site-header', 'skip-link']` (a slotted skip link) and `['site-header', 'menu-open']` when the Menu popover opens; and the main navigation's menu opens and link clicks (see `<site-main-nav>`). Never a URL. Bubbles and is composed. |
|
|
746
1095
|
|
|
747
1096
|
#### CSS custom properties
|
|
748
1097
|
|
|
@@ -782,6 +1131,7 @@ Today's hours for the UVA libraries, as on the library.virginia.edu home page: t
|
|
|
782
1131
|
|---|---|
|
|
783
1132
|
| `got-library-hours` | The hours were loaded. `detail` is `{ message }`. Bubbles and is composed. |
|
|
784
1133
|
| `got-libraries` | The libraries were loaded (fired after `got-library-hours`). `detail` is `{ message }`. Bubbles and is composed. |
|
|
1134
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['site-hours-section', 'link-click', 'See all hours']` for a "See all hours" link, and `['site-hours-section', 'error', 'hours-load']` once when the libraries or their hours cannot be loaded. Bubbles and is composed. |
|
|
785
1135
|
|
|
786
1136
|
#### CSS custom properties
|
|
787
1137
|
|
|
@@ -820,7 +1170,7 @@ The UVA Library main navigation (About, Using the Library, Research & teaching s
|
|
|
820
1170
|
| Event | Description |
|
|
821
1171
|
|---|---|
|
|
822
1172
|
| `site-main-nav-error` | `items-src` could not be loaded: both attempts failed (network error, a 10 s timeout per attempt, or no valid entries), after about 21 s at worst; the nav shows the bundled snapshot. `detail` is `{ src, message }`. Bubbles and is composed. |
|
|
823
|
-
| `uvalib-analytics-event` | For `<site-analytics>`: a group was opened, `['site-main-nav', 'menu-open', <the group's label>]` (not on close). Bubbles and is composed. |
|
|
1173
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a group was opened, `['site-main-nav', 'menu-open', <the group's label>]` (not on close), and a link was clicked, `['site-main-nav', 'link-click', '<Group> > <Link>']` (a top-level link: its label alone; never the URL). Bubbles and is composed. |
|
|
824
1174
|
|
|
825
1175
|
#### CSS custom properties
|
|
826
1176
|
|
|
@@ -842,7 +1192,7 @@ The UVA Library main navigation (About, Using the Library, Research & teaching s
|
|
|
842
1192
|
|
|
843
1193
|
### `<site-page>`
|
|
844
1194
|
|
|
845
|
-
Page wrapper: skip link (inside the header landmark in shadow mode), header, a single `<main>`, footer (unless `no-footer`), and global page styles. Side-effect free: `site-page.ts` registers `<site-header>` (and its `<site-main-nav>`) and `<site-footer>`. The header shows the UVA Library main navigation by default (`no-main-nav` turns it off; `header-variant="vendor"` never shows it). Shows live UVA Library alerts by default, placed as Virgo places them: a full-bleed `<
|
|
1195
|
+
Page wrapper: skip link (inside the header landmark in shadow mode), header, a single `<main>`, footer (unless `no-footer`), and global page styles. Side-effect free: `site-page.ts` registers `<site-header>` (and its `<site-main-nav>`) and `<site-footer>`. The header shows the UVA Library main navigation by default (`no-main-nav` turns it off; `header-variant="vendor"` never shows it). Shows live UVA Library alerts by default with `<site-alerts>` (its code loads only then), placed as Virgo places them: a full-bleed `<site-alerts show="header">` banner at the top of the header landmark (after the skip link), a full-bleed band between the header and `<main>` holding `<site-alerts show="list">` (a `<section aria-label="Library alerts">` region, hidden while the list has nothing to show), and `<site-alerts show="regional">` as the first child of `<main>`, inside its padding. Their data comes from one headless `<uvalib-alerts>`, loaded once per document, with a module script, from the alerts CDN (`alerts-env`, or `alerts-src`); if it fails to load, one console warning is logged and the page works as before. `no-alerts` renders no alert elements and loads nothing. A `slot="breadcrumbs"` child (a `<uvalib-breadcrumbs>`) is placed where library.virginia.edu puts the trail: after the header and the alert list band, before `<main>` and outside it (so the skip link lands past it), with the same gutters as `<main>`.
|
|
846
1196
|
|
|
847
1197
|
#### Attributes
|
|
848
1198
|
|
|
@@ -853,6 +1203,8 @@ Page wrapper: skip link (inside the header landmark in shadow mode), header, a s
|
|
|
853
1203
|
| `no-global-styles` | `boolean` | `false` | |
|
|
854
1204
|
| `no-footer` | `boolean` | `false` | Hide the footer (and any pre-footer band), for tools and app-like pages where the site footer does not belong. The footer is kept hidden rather than removed, so toggling the attribute keeps pre-footer content. |
|
|
855
1205
|
| `site-links-label` | `string \| undefined` | | Accessible name of the header navigation when site links are given (default "Site"). |
|
|
1206
|
+
| `site-name` | `string \| undefined` | | The sub-site's name, forwarded to `<site-header site-name>`: shown after the logo as a link to the site's home. |
|
|
1207
|
+
| `site-name-href` | `string \| undefined` | | Where the site name links, forwarded to `<site-header site-name-href>` (default `/`). |
|
|
856
1208
|
| `no-main-nav` | `boolean` | `false` | Hide the UVA Library main navigation in the header. |
|
|
857
1209
|
| `main-nav-label` | `string \| undefined` | | Accessible name of the header's main navigation (default "Main"). |
|
|
858
1210
|
| `main-nav-src` | `string \| undefined` | | URL of JSON main navigation items, forwarded to `<site-header main-nav-src>`. |
|
|
@@ -871,6 +1223,7 @@ Page wrapper: skip link (inside the header landmark in shadow mode), header, a s
|
|
|
871
1223
|
| Slot | Description |
|
|
872
1224
|
|---|---|
|
|
873
1225
|
| (default) | Main page content, rendered inside the single `<main>`. |
|
|
1226
|
+
| `breadcrumbs` | Optional breadcrumb trail (a `<uvalib-breadcrumbs>`), shown between the header (and alert list band) and `<main>`. In light mode it is moved there, never into `<main>`. |
|
|
874
1227
|
| `pre-footer` | Optional content shown in a band above the footer. |
|
|
875
1228
|
| `site-links` | Optional `<a href>` elements, forwarded to `<site-header>`, that replace the library utility links in the header (inline nav and Menu popover). Ignored with `header-variant="vendor"`. |
|
|
876
1229
|
| `main-nav` | Optional `<nav>` forwarded to `<site-header>`, whose list replaces the UVA Library main navigation's links (see `<site-main-nav>`). Ignored with `no-main-nav` and `header-variant="vendor"`. |
|
|
@@ -937,7 +1290,7 @@ Compatibility element. Light mode (`no-shadow-dom`) installs the tokens and base
|
|
|
937
1290
|
|---|---|---|---|
|
|
938
1291
|
| `matomourl` | `string` | `'https://analytics.lib.virginia.edu/'` | The Matomo server, ending in `/` (attribute `matomourl`). |
|
|
939
1292
|
| `matomoid` | `number \| undefined` | | The Matomo site id (attribute `matomoid`). Default: the site whose URL the page is under. |
|
|
940
|
-
| `spa` | `boolean` | `false` | A single-page app records its own page views (`uvalib-analytics-pageview`)
|
|
1293
|
+
| `spa` | `boolean \| 'auto'` | `false` | A single-page app. `spa` (no value): it records its own page views (`uvalib-analytics-pageview`), none on load. `spa="auto"`: a page view on load and one per same-document route change (hash change, Back and Forward, `history.pushState`), once the title has settled, never twice in a row for the same URL, with the previous URL as the referrer. Either way Matomo's link tracking is off. |
|
|
941
1294
|
| `variables` | `Record<string, unknown> \| null` | `null` | Custom dimensions, a JSON object of `{ id: value }`, set before the page view. |
|
|
942
1295
|
| `no-shadow-dom` | `boolean` | `false` | |
|
|
943
1296
|
| `no-style` | `boolean` | `false` | |
|
|
@@ -949,9 +1302,158 @@ Compatibility element. Light mode (`no-shadow-dom`) installs the tokens and base
|
|
|
949
1302
|
| `uvalib-analytics-pageview` | Listened for on `document` (not fired): records a page view; `detail` is `{ customTitle?, referrer? }` (default: the document's title and referrer; a referrer without `http` is taken as a path on this origin). |
|
|
950
1303
|
| `uvalib-analytics-search` | Listened for on `document` (not fired): a Matomo site search; `detail` is `{ searchQuery, searchCategory?, resultCount? }`. |
|
|
951
1304
|
| `uvalib-analytics-event` | Listened for on `document` (not fired): a Matomo event; `detail` is `{ event: [category, action, name?, value?] }` (`track` is the old name of `event`). |
|
|
1305
|
+
| `uvalib-analytics-content` | Listened for on `document` (not fired): a Matomo content impression; `detail` is `{ name, piece, target?, interaction? }` (with `interaction`, a content interaction instead). |
|
|
952
1306
|
| `site-analytics-pageview` | Listened for on `document` too: the same as `uvalib-analytics-pageview`. |
|
|
953
1307
|
| `site-analytics-search` | Listened for on `document` too: the same as `uvalib-analytics-search`. |
|
|
954
1308
|
| `site-analytics-event` | Listened for on `document` too: the same as `uvalib-analytics-event`. |
|
|
1309
|
+
| `site-analytics-content` | Listened for on `document` too: the same as `uvalib-analytics-content`. |
|
|
1310
|
+
|
|
1311
|
+
### `<uvalib-breadcrumbs>`
|
|
1312
|
+
|
|
1313
|
+
A breadcrumb trail, as on library.virginia.edu: links separated by slashes, ending with the current page, at body size. A `<nav aria-label="Breadcrumb">` holding an `<ol>`; the separators are hidden from assistive technology and the last item has `aria-current="page"` (a `<span>`, or a link when it has an href). Give the trail as children: `<a href>` elements, ending with the current page as a text-only element (`<span>Hours</span>`) or a link (`<a href aria-current="page">`). The last child is always the current page. An earlier child without an href is shown as plain text. Children with no text are skipped with one console warning. Hrefs are used as written, and the trail follows changes to the children (attributes and text too). Apps that build the trail in JavaScript set the `items` property instead (it then wins over any children); assigning a new array re-renders. Inside `<site-page>`, give it `slot="breadcrumbs"`: it is placed between the header (and alerts band) and `<main>`, with the page's gutters. It works anywhere else too. Single-page apps: the trail is drawn from copies of the children, so a router's own click handlers on them do not run. Listen for `uvalib-breadcrumbs-navigate` and cancel it to route in place; hash links need nothing.
|
|
1314
|
+
|
|
1315
|
+
#### Attributes
|
|
1316
|
+
|
|
1317
|
+
| Attribute | Type | Default | Description |
|
|
1318
|
+
|---|---|---|---|
|
|
1319
|
+
| `label` | `string` | `'Breadcrumb'` | Accessible name of the navigation landmark. |
|
|
1320
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1321
|
+
| `no-style` | `boolean` | `false` | |
|
|
1322
|
+
|
|
1323
|
+
#### Events
|
|
1324
|
+
|
|
1325
|
+
| Event | Description |
|
|
1326
|
+
|---|---|
|
|
1327
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a click on a trail link, `['uvalib-breadcrumbs', 'link-click', 'level <N>', <N>]` (N from 1, the first step); never the label or URL. Bubbles and is composed. |
|
|
1328
|
+
| `uvalib-breadcrumbs-navigate` | A plain click on a trail link: `detail` is `{ href, index }` (href as written). Cancel it (`preventDefault()`) to navigate in the app; the click's default is then prevented. Bubbles and is composed. |
|
|
1329
|
+
|
|
1330
|
+
#### CSS custom properties
|
|
1331
|
+
|
|
1332
|
+
| Property | Default | Description |
|
|
1333
|
+
|---|---|---|
|
|
1334
|
+
| `--uva-blue-alt-dark` | `#005679` | Link colour. |
|
|
1335
|
+
| `--uva-grey-darkest` | `#2b2b2b` | Current page colour. |
|
|
1336
|
+
| `--uva-grey-dark` | `#4f4f4f` | Separator colour. |
|
|
1337
|
+
| `--uva-color-utility-link` | | Dark-mode role token: link colour, #005679 in light as on library.virginia.edu (else `--uva-blue-alt-dark`). |
|
|
1338
|
+
| `--uva-color-text` | | Dark-mode role token: current page colour (else `--uva-grey-darkest`). |
|
|
1339
|
+
| `--uva-color-text-muted` | | Dark-mode role token: separator colour (else `--uva-grey-dark`). |
|
|
1340
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1341
|
+
|
|
1342
|
+
### `<uvalib-card>`
|
|
1343
|
+
|
|
1344
|
+
One card: a collection (title and “N texts”), a photo (image, count, date, category, title, excerpt) or any other raised summary. With `href`, the heading is the link and a pseudo-element stretches that link over the card, so the whole card is one click. The arrow is only a visual aid. The card is never wrapped in an `<a>`. A clickable card must not contain another link, button or other control: the stretched link covers it. A static card (no `href`, or an empty or unsafe one) has no stretch, so its excerpt may contain links. With `href`, the heading needs an accessible name (text, or an image `alt` or `aria-label`); otherwise the link is hidden. Regions are light-DOM children. Give `slot="media"`, `slot="badge"`, `slot="heading"`, `slot="meta"` or `slot="chip"`; anything else (including text) is the excerpt. An image needs a real alt, or `alt=""` when the heading already names it. A date belongs in `<time>` in the meta slot. One element per chip. The heading level defaults like `<events-section>`: one below the nearest heading before the card, or 3 when there is none. `heading-level` (1–6) wins. An invalid value is ignored.
|
|
1345
|
+
|
|
1346
|
+
#### Attributes
|
|
1347
|
+
|
|
1348
|
+
| Attribute | Type | Default | Description |
|
|
1349
|
+
|---|---|---|---|
|
|
1350
|
+
| `href` | `string \| undefined` | | Makes the card one link: the heading stretches over the card. Empty is not a link. |
|
|
1351
|
+
| `heading-level` | `number \| undefined` | | Heading level of the title, 1–6. Unset, it is one below the nearest heading before this card, or 3 when there is none. Any other value is ignored. |
|
|
1352
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1353
|
+
| `no-style` | `boolean` | `false` | |
|
|
1354
|
+
|
|
1355
|
+
#### Slots
|
|
1356
|
+
|
|
1357
|
+
| Slot | Description |
|
|
1358
|
+
|---|---|
|
|
1359
|
+
| `media` | Image or other media. An `<img>` needs a real alt, or `alt=""` when the heading names it. |
|
|
1360
|
+
| `badge` | Short label drawn over the media, such as “13 photos”. |
|
|
1361
|
+
| `heading` | The card title. With `href`, this heading’s link is the card, so it needs an accessible name. |
|
|
1362
|
+
| `meta` | Date (`<time>`) or byline, under the title. |
|
|
1363
|
+
| `chip` | Category. One element per chip. |
|
|
1364
|
+
| (default) | Excerpt. A static card may put links here; a clickable card must not contain other controls. |
|
|
1365
|
+
|
|
1366
|
+
#### Events
|
|
1367
|
+
|
|
1368
|
+
| Event | Description |
|
|
1369
|
+
|---|---|
|
|
1370
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a primary-button click on the card link that was not already canceled, including a modified click, `['uvalib-card', 'card-click', 'single']` or, inside `<uvalib-card-grid>`, `['uvalib-card', 'card-click', '<n>', <n>]` (n from 1, the card’s place in that grid). Never the title or URL. Bubbles and is composed. |
|
|
1371
|
+
| `uvalib-card-navigate` | A plain click on the card link: `detail` is `{ href, position }` (`position` is `'single'` or `'1'`, `'2'`, …). Cancel it (`preventDefault()`) to route in the app; the click’s default is then prevented. Bubbles and is composed. |
|
|
1372
|
+
|
|
1373
|
+
#### CSS custom properties
|
|
1374
|
+
|
|
1375
|
+
| Property | Default | Description |
|
|
1376
|
+
|---|---|---|
|
|
1377
|
+
| `--uva-brand-blue` | `#232d4b` | Title link when `--uva-color-link` is unset, and the badge background when `--uva-color-accent-bg` is unset. |
|
|
1378
|
+
| `--uva-blue-alt-300` | `#BFE7F7` | Chip background. With `--uva-blue-alt-dark` this pair is 6.13:1 (WCAG AA for normal text, short of AAA’s 7:1). |
|
|
1379
|
+
| `--uva-blue-alt-dark` | `#005679` | Chip text. |
|
|
1380
|
+
| `--uva-grey-100` | `#DADADA` | Hover shadow colour when `--uva-color-shadow` is unset. |
|
|
1381
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: card background (else #fff). |
|
|
1382
|
+
| `--uva-color-border` | | Dark-mode role token: card border (else `--uva-grey-100`). |
|
|
1383
|
+
| `--uva-color-text` | | Dark-mode role token: body text (else `--uva-grey-darkest`). |
|
|
1384
|
+
| `--uva-color-text-muted` | | Dark-mode role token: meta line (else #4f4f4f). |
|
|
1385
|
+
| `--uva-color-link` | | Dark-mode role token: title link (else `--uva-brand-blue`). |
|
|
1386
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring on the card (else `--uva-brand-orange`). |
|
|
1387
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: badge background (else `--uva-brand-blue`). |
|
|
1388
|
+
| `--uva-color-on-accent` | | Text on the badge (else #fff). |
|
|
1389
|
+
| `--uva-color-shadow` | | Dark-mode role token: hover shadow colour (else `--uva-grey-100`). |
|
|
1390
|
+
|
|
1391
|
+
### `<uvalib-card-grid>`
|
|
1392
|
+
|
|
1393
|
+
A grid of `<uvalib-card>` elements. It is a list, so a screen reader announces how many cards there are. Safari drops that list when markers are removed, so the list role is set as well as the `<ul>`. Columns follow the theme’s breakpoints on the grid’s own width (a container query, so a sidebar collapses the grid too): four above 992px, two through 767px, then one. Cards in a row match the height of the tallest. Set `min-card-width` (a length: `16rem`, `240px`, …) to use `repeat(auto-fill, minmax(min(100%, <width>), 1fr))` instead. An invalid value is ignored, with one console warning, and the 4/2/1 columns stay. Only `<uvalib-card>` children are listed. Anything else is left in the tree (hidden in light DOM) and warned about once. The grid gives each card a `slot` while it is inside; that attribute is removed when the card leaves, so it is not hidden by another shadow root.
|
|
1394
|
+
|
|
1395
|
+
#### Attributes
|
|
1396
|
+
|
|
1397
|
+
| Attribute | Type | Default | Description |
|
|
1398
|
+
|---|---|---|---|
|
|
1399
|
+
| `min-card-width` | `string \| undefined` | | When a length (`16rem`, `240px`, `20ch`, `40%`), the grid fills by that minimum instead of the fixed 4/2/1 columns. Any other value is ignored. |
|
|
1400
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1401
|
+
| `no-style` | `boolean` | `false` | |
|
|
1402
|
+
|
|
1403
|
+
#### Slots
|
|
1404
|
+
|
|
1405
|
+
| Slot | Description |
|
|
1406
|
+
|---|---|
|
|
1407
|
+
| (default) | `<uvalib-card>` elements, one per cell. |
|
|
1408
|
+
|
|
1409
|
+
#### CSS custom properties
|
|
1410
|
+
|
|
1411
|
+
| Property | Default | Description |
|
|
1412
|
+
|---|---|---|
|
|
1413
|
+
| `--uvalib-card-min` | | Set from `min-card-width` when that value is a length. The grid uses it as the `auto-fill` minimum. |
|
|
1414
|
+
|
|
1415
|
+
### `<uvalib-contents>`
|
|
1416
|
+
|
|
1417
|
+
Sub-navigation or a table of contents, as library.virginia.edu's sub-navigation: a `<nav>` landmark (named by `label`, "Contents" by default) with the label as a visible headline, and a nested list of links with dividers between the top-level entries and a bar beside each nested level. Give the list as a child: an `<ol>` or `<ul>` of `<li>` elements, each with an `<a href>` (or plain text for a group label) and, for sub-entries, a nested `<ol>`/`<ul>`, to any depth. Other children (a heading) are ignored. The list follows changes to the children. Apps set the `items` property instead (`{ label, href?, children? }`, winning over the children while set). The current entry gets `aria-current`: `page` for the link to this page, `location` for the link to the section of it in the URL's hash. It is found from the page URL (path, and hash for in-page sections), followed through same-document navigations (`hashchange`, `popstate` and the Navigation API), or from the `current` attribute (a URL, resolved like the links). An entry whose href has a query string matches only that query (`?part=2`); one without matches the page whatever its query. Hash-only hrefs are places on that page. With `current` unset, a valid `aria-current` on a source link (`page`, `location` or `true`) is used instead, the first of each kind. `lang` and `dir` on the source links and items, and inline markup in their text (`em`, `cite`, `code`, `abbr`…, copied element by element, never as HTML), are kept. On narrow screens the list collapses into a disclosure: the headline becomes a button with `aria-expanded`, and the list starts closed (as the Electronic Text Collections' Contents does on phones, so the text comes first) until the reader opens it, or while the `open` attribute is set; opening it shows the current entry. Narrow means the viewport (`collapse-below`, 64rem by default), not the element's own width: a contents sidebar is always far narrower than 64rem, so a container query could not tell a phone from a desktop. `sticky` keeps it in view in a sidebar on wide screens; a list longer than the window then scrolls, and the current entry is scrolled into view inside it (never the page). Single-page apps: the list is drawn from copies of the children, so a router's own click handlers on them do not run. Listen for `uvalib-contents-navigate` and cancel it to route in place; hash links need nothing.
|
|
1418
|
+
|
|
1419
|
+
#### Attributes
|
|
1420
|
+
|
|
1421
|
+
| Attribute | Type | Default | Description |
|
|
1422
|
+
|---|---|---|---|
|
|
1423
|
+
| `label` | | `DEFAULT_LABEL` | Accessible name of the navigation landmark, and its visible headline. |
|
|
1424
|
+
| `heading-level` | | `DEFAULT_LEVEL` | The headline's level (2 to 6), for the page's outline. |
|
|
1425
|
+
| `current` | `string \| undefined` | | The URL of the current entry (resolved like the links), for apps whose route is not the page URL. Unset: the page URL, followed through same-document navigations. |
|
|
1426
|
+
| `collapse-below` | | `DEFAULT_COLLAPSE` | The viewport width at and below which the list collapses into a disclosure: a CSS length (`64rem`, `800px`). `0` or `none` never collapses. |
|
|
1427
|
+
| `open` | `boolean` | `false` | Whether the collapsed disclosure is open (no effect on wide screens). Toggled by its button. |
|
|
1428
|
+
| `sticky` | `boolean` | `false` | Keep it in view while the page scrolls (a sidebar), on wide screens. |
|
|
1429
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1430
|
+
| `no-style` | `boolean` | `false` | |
|
|
1431
|
+
|
|
1432
|
+
#### Events
|
|
1433
|
+
|
|
1434
|
+
| Event | Description |
|
|
1435
|
+
|---|---|
|
|
1436
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a click on an entry, `['uvalib-contents', 'link-click', 'level <N>', <N>]` (N from 1, the top level), and opening or closing the disclosure, `['uvalib-contents', 'toggle', 'open' \| 'close']`; never the label or URL. Bubbles and is composed. |
|
|
1437
|
+
| `uvalib-contents-navigate` | A plain click on an entry: `detail` is `{ href, level }` (href as written). Cancel it (`preventDefault()`) to navigate in the app; the click's default is then prevented. Bubbles and is composed. |
|
|
1438
|
+
|
|
1439
|
+
#### CSS custom properties
|
|
1440
|
+
|
|
1441
|
+
| Property | Default | Description |
|
|
1442
|
+
|---|---|---|
|
|
1443
|
+
| `--uvalib-contents-sticky-top` | `1rem` | With `sticky`: the gap kept above it. |
|
|
1444
|
+
| `--uvalib-contents-max-height` | `none` | The list's maximum height on wide screens (it scrolls beyond it); with `sticky`, the window's height less twice the sticky gap. |
|
|
1445
|
+
| `--uva-blue-alt-dark` | `#005679` | Link colour. |
|
|
1446
|
+
| `--uva-brand-blue` | `#232d4b` | The current entry's bar. |
|
|
1447
|
+
| `--uva-brand-orange` | `#e57200` | The nested levels' bar. |
|
|
1448
|
+
| `--uva-grey-darkest` | `#2b2b2b` | Text and current entry colour. |
|
|
1449
|
+
| `--uva-color-utility-link` | | Dark-mode role token: link colour (else `--uva-blue-alt-dark`). |
|
|
1450
|
+
| `--uva-color-text` | | Dark-mode role token: text and current entry (else `--uva-grey-darkest`). |
|
|
1451
|
+
| `--uva-color-link` | | Dark-mode role token: the current entry's bar and the button's text (else `--uva-brand-blue`). |
|
|
1452
|
+
| `--uva-color-current` | | Dark-mode role token: the nested levels' bar (else `--uva-brand-orange`). |
|
|
1453
|
+
| `--uva-color-border` | | Dark-mode role token: dividers (else #dadada). |
|
|
1454
|
+
| `--uva-color-control-border` | | Dark-mode role token: the button's border (else #808080). |
|
|
1455
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: the button's background (else #fff). |
|
|
1456
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
955
1457
|
|
|
956
1458
|
### `<uvalib-date-range>`
|
|
957
1459
|
|
|
@@ -973,6 +1475,7 @@ A date-range picker: a two-thumb year slider plus "From" and "To" date inputs. `
|
|
|
973
1475
|
| Event | Description |
|
|
974
1476
|
|---|---|
|
|
975
1477
|
| `date-range-change` | The range changed from a slider or a date input. `detail` is `{ value: [start, end] }` (ISO dates). Bubbles and is composed. |
|
|
1478
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-date-range', 'range-change', '<from year>–<to year>']`, 1 s after the visitor's last change (not when the range ends where it started). Bubbles and is composed. |
|
|
976
1479
|
|
|
977
1480
|
#### CSS custom properties
|
|
978
1481
|
|
|
@@ -1020,6 +1523,7 @@ A faceted-search filter: a fieldset of checkboxes (value plus result count), opt
|
|
|
1020
1523
|
|---|---|
|
|
1021
1524
|
| `filter-change` | A checkbox was toggled. `detail` is `{ name, value }`: the facet name and the new array of selected keys. Does not bubble. |
|
|
1022
1525
|
| `scope-change` | A scope chip was toggled. `detail` is `{ value }`: the new array of pressed scope values. Does not bubble. |
|
|
1526
|
+
| `uvalib-analytics-event` | For `<site-analytics>`, on the visitor's changes only: `['uvalib-filter', 'facet-change', '<title>: <value>', 1 \| 0]` (checked or unchecked), `['uvalib-filter', 'scope-change', <scope label>, 1 \| 0]` (pressed or not), and `['uvalib-filter', 'see-more' \| 'see-less', <title>]`. Bubbles and is composed. |
|
|
1023
1527
|
|
|
1024
1528
|
#### CSS custom properties
|
|
1025
1529
|
|
|
@@ -1035,6 +1539,193 @@ A faceted-search filter: a fieldset of checkboxes (value plus result count), opt
|
|
|
1035
1539
|
| `--uva-color-on-accent` | | Dark-mode role token: pressed chip text (else #fff). |
|
|
1036
1540
|
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1037
1541
|
|
|
1542
|
+
### `<uvalib-lightbox>`
|
|
1543
|
+
|
|
1544
|
+
An accessible image viewer over a set of plain links. With JavaScript a primary click opens a modal dialog; without it (or with a modified click) the link opens the image as before. Wrap the links, or point at them with `selector` (for example `a.pb-image` on a reading page). There is no autoplay and no carousel. The dialog is labelled by the caption (`data-caption`, else the image alt, else the link text). Focus moves to Close on open and back to the trigger on close. Escape and a click on the backdrop close it. With more than one image, Previous and Next and the arrow keys move through the set (wrapping), and a polite “3 of 13” counter is shown. Full size opens the original image in a new tab. A IIIF Image API URL keeps its region; only the size becomes `!W,H` for the viewport. TIFF and JPEG2000 URLs are left as written. `url-param` (for example `photo`) keeps `?photo=<id>` in sync, including on a hash route (`#/text?photo=<id>`): opening pushes a history entry, stepping replaces it, and Back closes. Optional details: children with `slot="details"` (and `data-for` equal to the item's id or its position from 1; without `data-for` they show for every image), or `data-details-id` on a link pointing at an element elsewhere on the page. Either is shown inside the dialog and put back when the viewer moves on or closes.
|
|
1545
|
+
|
|
1546
|
+
#### Attributes
|
|
1547
|
+
|
|
1548
|
+
| Attribute | Type | Default | Description |
|
|
1549
|
+
|---|---|---|---|
|
|
1550
|
+
| `selector` | `string` | `''` | CSS selector for image links elsewhere in this root (the page, or the shadow root the component sits in). Combined with any links inside the component. Example: `a.pb-image`. |
|
|
1551
|
+
| `url-param` | `string` | `''` | Query parameter kept in sync with the open image, for example `photo` → `?photo=<id>`. The id is the link's `data-id`, else its `id`, else the IIIF identifier, else its position from 1. On a hash route the parameter is written inside the hash. Empty: no deep link. |
|
|
1552
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1553
|
+
| `no-style` | `boolean` | `false` | |
|
|
1554
|
+
|
|
1555
|
+
#### Slots
|
|
1556
|
+
|
|
1557
|
+
| Slot | Description |
|
|
1558
|
+
|---|---|
|
|
1559
|
+
| (default) | The image links. A plain click opens the viewer; without JavaScript they open the image. |
|
|
1560
|
+
| `details` | Details for the open image. `data-for` selects one item by its id or position (from 1); without it the details show for every image. |
|
|
1561
|
+
|
|
1562
|
+
#### CSS parts
|
|
1563
|
+
|
|
1564
|
+
| Part | Description |
|
|
1565
|
+
|---|---|
|
|
1566
|
+
| `dialog` | The modal dialog. |
|
|
1567
|
+
| `panel` | The surface inside the dialog. |
|
|
1568
|
+
| `caption` | The caption that names the dialog. |
|
|
1569
|
+
| `image` | The image. |
|
|
1570
|
+
| `controls` | Previous, Next, the counter and Full size. |
|
|
1571
|
+
| `details` | The details panel. |
|
|
1572
|
+
|
|
1573
|
+
#### Events
|
|
1574
|
+
|
|
1575
|
+
| Event | Description |
|
|
1576
|
+
|---|---|
|
|
1577
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-lightbox', 'open'\|'next'\|'previous'\|'full-size', 'image N', N]` (N from 1, the image's place in the set). Never the URL or the caption. Not fired for a viewer restored from the URL or from Back and Forward. Bubbles and is composed. |
|
|
1578
|
+
|
|
1579
|
+
#### CSS custom properties
|
|
1580
|
+
|
|
1581
|
+
| Property | Default | Description |
|
|
1582
|
+
|---|---|---|
|
|
1583
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: dialog surface (else `--uva-color-surface`, else #fff). |
|
|
1584
|
+
| `--uva-color-surface` | | Dark-mode role token: the figure behind the image (else #fff). |
|
|
1585
|
+
| `--uva-color-text` | | Dark-mode role token: text (else `--uva-grey-darkest`). |
|
|
1586
|
+
| `--uva-color-shadow` | | Dark-mode role token: the backdrop scrim (else rgba(16, 23, 43, 0.72)). |
|
|
1587
|
+
| `--uva-color-border` | | Dark-mode role token: dialog border (else `--uva-grey-100`). |
|
|
1588
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1589
|
+
| `--uva-color-link` | | Dark-mode role token: Full size text when it is not the filled control (else `--uva-brand-blue`). |
|
|
1590
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: Close and Full size background (else `--uva-brand-blue`). |
|
|
1591
|
+
| `--uva-color-on-accent` | | Text on those controls (else #fff). |
|
|
1592
|
+
| `--uva-brand-orange` | `#e57200` | Focus ring when `--uva-color-focus` is unset. |
|
|
1593
|
+
| `--uva-brand-blue` | `#232d4b` | Control background when `--uva-color-accent-bg` is unset. |
|
|
1594
|
+
| `--uva-grey-darkest` | `#2b2b2b` | Text when `--uva-color-text` is unset. |
|
|
1595
|
+
| `--uva-grey-100` | `#dadada` | Border when `--uva-color-border` is unset. |
|
|
1596
|
+
|
|
1597
|
+
### `<uvalib-metadata>`
|
|
1598
|
+
|
|
1599
|
+
A record's details as a description list, as on the library's digital collections: label and value side by side on wide screens (the element's own width, 36rem and up), stacked on narrow ones. Values may be text, links or lists (subjects). Give the rows as a `<dl>` child (so the page reads the same before the script loads): `<dt>` labels and `<dd>` values, optionally wrapped in a `<div>` per row; several `<dd>` after one `<dt>` are several values. The values are copied as written (links, lists, `download` attributes kept); a link with `data-size="184 KB"` is shown as a download, "EPUB · 184 KB". The list follows changes to the children. Apps set the `items` property instead (`{ label, value }`, winning over the children while set). Built-in rows for credit and rights (as Special Collections asks): `creator` and `organization` come first; `rights` (a rightsstatements.org or Creative Commons URL, shown as its short name linked to it, or plain text) and `citation` ("How to cite", with a Copy citation button that announces "Copied" politely) come last. `citation-title` builds the Special Collections citation, "<title>, Albert and Shirley Small Special Collections Library, University of Virginia".
|
|
1600
|
+
|
|
1601
|
+
#### Attributes
|
|
1602
|
+
|
|
1603
|
+
| Attribute | Type | Default | Description |
|
|
1604
|
+
|---|---|---|---|
|
|
1605
|
+
| `creator` | `string \| undefined` | | The creator (author, photographer…), shown first. |
|
|
1606
|
+
| `organization` | `string \| undefined` | | The organization holding or crediting the item, shown after the creator. |
|
|
1607
|
+
| `rights` | `string \| undefined` | | The rights statement: a rightsstatements.org or Creative Commons URL (shown as its short name, linked), another http(s) URL (shown as `rights-label`, or "Rights statement"), or plain text. |
|
|
1608
|
+
| `rights-label` | `string \| undefined` | | The link text for a `rights` URL, instead of its short name. |
|
|
1609
|
+
| `rights-info` | `string \| undefined` | | A "More about rights and permissions" link under the statement, such as `https://www.library.virginia.edu/policies/use-of-materials`. |
|
|
1610
|
+
| `citation` | `string \| undefined` | | "How to cite": the citation, as written. Wins over `citation-title`. |
|
|
1611
|
+
| `citation-title` | `string \| undefined` | | A title or collection name for the Special Collections citation: "<title>, Albert and Shirley Small Special Collections Library, University of Virginia". |
|
|
1612
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1613
|
+
| `no-style` | `boolean` | `false` | |
|
|
1614
|
+
|
|
1615
|
+
#### Events
|
|
1616
|
+
|
|
1617
|
+
| Event | Description |
|
|
1618
|
+
|---|---|
|
|
1619
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: the Copy citation button, `['uvalib-metadata', 'copy-citation']`. Downloads are left to Matomo's own download tracking. Bubbles and is composed. |
|
|
1620
|
+
|
|
1621
|
+
#### CSS custom properties
|
|
1622
|
+
|
|
1623
|
+
| Property | Default | Description |
|
|
1624
|
+
|---|---|---|
|
|
1625
|
+
| `--uva-blue-alt-dark` | `#005679` | Link colour. |
|
|
1626
|
+
| `--uva-grey-darkest` | `#2b2b2b` | Value colour. |
|
|
1627
|
+
| `--uva-color-utility-link` | | Dark-mode role token: link colour (else `--uva-blue-alt-dark`). |
|
|
1628
|
+
| `--uva-color-text` | | Dark-mode role token: value colour (else `--uva-grey-darkest`). |
|
|
1629
|
+
| `--uva-color-text-muted` | | Dark-mode role token: label and status colour (else #4b5563). |
|
|
1630
|
+
| `--uva-color-border` | | Dark-mode role token: row dividers (else #dadada). |
|
|
1631
|
+
| `--uva-color-link` | | Dark-mode role token: the button's text and border (else `--uva-brand-blue`). |
|
|
1632
|
+
| `--uva-color-surface-raised` | | Dark-mode role token: the button's background (else #fff). |
|
|
1633
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1634
|
+
|
|
1635
|
+
### `<uvalib-pagefind-search>`
|
|
1636
|
+
|
|
1637
|
+
Pagefind's default search UI (`PagefindUI`, from the site's own Pagefind bundle) with the library's defaults and the accessibility fixes that need script. Use it with pagefind.css, in place of Pagefind's pagefind-ui.css. It renders in light DOM, so the page's styles reach Pagefind's markup. It loads `<bundle-path>pagefind-ui.js` unless `window.PagefindUI` already exists. What it adds to the stock UI: a visible `<label>` for the field (the stock field is named only by its title); a polite status region that announces the result count ("12 results for virginia") once results settle (the stock message is not a live region); focus kept in the field after Clear or Escape (the stock UI blurs it, dropping focus to the page) and moved to the first new result after "Load more results"; the loading placeholders' dots hidden from screen readers; `?q=` read at start (and on Back and Forward) and the settled query written back with `history.replaceState`, so a search can be shared; and reports to `<site-analytics>`. The `ui` property is the `PagefindUI` instance (for `triggerFilters`), and `ready` resolves with it. Attributes are read once, when the element is first connected.
|
|
1638
|
+
|
|
1639
|
+
#### Attributes
|
|
1640
|
+
|
|
1641
|
+
| Attribute | Type | Default | Description |
|
|
1642
|
+
|---|---|---|---|
|
|
1643
|
+
| `bundle-path` | `string` | `/pagefind/` | The Pagefind bundle's URL path, ending in `/`. |
|
|
1644
|
+
| `merge-index` | `string` | | JSON array of more indexes to search together: `[{"bundlePath": "/pagefind/s1/"}]`. |
|
|
1645
|
+
| `page-size` | `number` | `10` | Results shown before "Load more results". |
|
|
1646
|
+
| `excerpt-length` | `number` | | Words per excerpt (Pagefind's default: 30, or 12 with sub-results). |
|
|
1647
|
+
| `show-sub-results` | `boolean` | | Also list the matching sections of each page. |
|
|
1648
|
+
| `show-images` | `boolean` | | Show each result's `image` metadata (off by default). |
|
|
1649
|
+
| `placeholder` | `string` | `Search` | The field's placeholder. |
|
|
1650
|
+
| `label` | `string` | | The field's visible label. Empty (the default) uses the placeholder. |
|
|
1651
|
+
| `label-hidden` | `boolean` | | Keep the label for screen readers only. |
|
|
1652
|
+
| `translations` | `string` | | JSON of Pagefind UI strings to override (`{"zero_results": "…"}`). |
|
|
1653
|
+
| `options` | `string` | | JSON of any other `PagefindUI` options (`{"openFilters": ["author"]}`), applied last. |
|
|
1654
|
+
| `query-param` | `string` | `q` | The URL parameter that holds the query; empty turns it off. |
|
|
1655
|
+
|
|
1656
|
+
#### Events
|
|
1657
|
+
|
|
1658
|
+
| Event | Description |
|
|
1659
|
+
|---|---|
|
|
1660
|
+
| `search-results` | Results settled: `detail` is `{ query, count }`; `{ query: '', count: 0 }` when the field is emptied after a search. Does not bubble. |
|
|
1661
|
+
| `uvalib-analytics-search` | For `<site-analytics>`: the settled query, category `Pagefind` and its result count, once per query and filter set. Bubbles and is composed. |
|
|
1662
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-pagefind-search', 'filter-change', '<filter>: <value>', 1 \| 0]` (checked or unchecked), and `['uvalib-pagefind-search', 'error', 'load']` if Pagefind cannot be loaded. Bubbles and is composed. |
|
|
1663
|
+
|
|
1664
|
+
### `<uvalib-pager>`
|
|
1665
|
+
|
|
1666
|
+
Previous/next section links, as on a reading page, or a numbered page list. Previous/next: set `prev-href` and `next-href` (either may be omitted). Each link shows a “Previous” or “Next” kicker and, when `prev-label` or `next-label` is set, that title. A visually hidden “: ” sits between them, so the accessible name is punctuated even when CSS is off. A long title truncates visually; the full text stays in the accessible name. The links use `rel="prev"` and `rel="next"`. With neither href, nothing is rendered. Numbered pages: set `pages` (a positive count). `page` is the current page, clamped to `1…pages`. Each link’s href comes from `href-template`, which must contain `{page}` (the default is `?page={page}`). The current page is text with `aria-current="page"`, not a link. Long ranges collapse to the first page, a window around the current page, the last page, and an ellipsis where numbers are skipped. `pages` wins when previous/next attributes are also set, with one console warning. The landmark’s accessible name is `label`, or “Sections” for previous/next and “Pagination” for numbered pages. An empty `label` uses that default. Two pagers on one page need different labels: a repeated landmark name fails the accessibility check.
|
|
1667
|
+
|
|
1668
|
+
#### Attributes
|
|
1669
|
+
|
|
1670
|
+
| Attribute | Type | Default | Description |
|
|
1671
|
+
|---|---|---|---|
|
|
1672
|
+
| `prev-href` | `string \| undefined` | | Href of the previous section. Omitted, that side is not shown. |
|
|
1673
|
+
| `prev-label` | `string \| undefined` | | Title of the previous section, under the “Previous” kicker. |
|
|
1674
|
+
| `next-href` | `string \| undefined` | | Href of the next section. Omitted, that side is not shown. |
|
|
1675
|
+
| `next-label` | `string \| undefined` | | Title of the next section, under the “Next” kicker. |
|
|
1676
|
+
| `page` | `number \| undefined` | | Current page, from 1. Clamped to `pages`. Used when `pages` is set. |
|
|
1677
|
+
| `pages` | `number \| undefined` | | How many pages. A positive number selects numbered pages and ignores previous/next. Zero, negative or non-numeric does not. |
|
|
1678
|
+
| `href-template` | `string \| undefined` | | Href of each numbered page, with `{page}` where the number goes. Default `?page={page}` when omitted. Without `{page}`, numbered links are not made. |
|
|
1679
|
+
| `label` | `string \| undefined` | | Accessible name of the navigation landmark. Default “Pagination” for numbered pages and “Sections” for previous/next. Empty uses that default. A second pager on the page needs its own name. |
|
|
1680
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1681
|
+
| `no-style` | `boolean` | `false` | |
|
|
1682
|
+
|
|
1683
|
+
#### Events
|
|
1684
|
+
|
|
1685
|
+
| Event | Description |
|
|
1686
|
+
|---|---|
|
|
1687
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: a primary-button click that was not already canceled, including a modified click, on a page link `['uvalib-pager', 'page-change', 'number', <n>]`, or on a section link `['uvalib-pager', 'page-change', 'next'\|'previous']` (no page number: that mode has none). Never the label or URL. Bubbles and is composed. |
|
|
1688
|
+
| `uvalib-pager-navigate` | A plain click on a pager link: `detail` is `{ href, kind, page? }` (`kind` is `'next'`, `'previous'` or `'number'`; `page` is set for `'number'`). Cancel it (`preventDefault()`) to route in the app; the click’s default is then prevented. Bubbles and is composed. |
|
|
1689
|
+
|
|
1690
|
+
#### CSS custom properties
|
|
1691
|
+
|
|
1692
|
+
| Property | Default | Description |
|
|
1693
|
+
|---|---|---|
|
|
1694
|
+
| `--uva-color-link` | | Dark-mode role token: link colour (else `--uva-brand-blue`). |
|
|
1695
|
+
| `--uva-color-text` | | Dark-mode role token: current page (else `--uva-grey-darkest`). |
|
|
1696
|
+
| `--uva-color-text-muted` | | Dark-mode role token: the Previous/Next kicker (else #4f4f4f). |
|
|
1697
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1698
|
+
| `--uva-color-accent-bg` | | Dark-mode role token: current page background (else `--uva-brand-blue`). |
|
|
1699
|
+
| `--uva-color-on-accent` | | Text on the current page background (else #fff). |
|
|
1700
|
+
|
|
1701
|
+
### `<uvalib-photo-grid>`
|
|
1702
|
+
|
|
1703
|
+
Justified rows of thumbnails. Each direct child that is a link or a button is one photo; its image keeps its shape from the `width` and `height` attributes, or from the loaded image, so the row does not jump when the picture arrives. The row is about 220px tall and shorter on a phone; `row-height` sets that height. Every item stays a real link or button. An image with no visible text gets a visible caption from its alt (the caption is then the accessible name, and a repeated alt is cleared). The original alt is kept in `data-uvalib-alt` so a lightbox still describes the picture. An item with no name at all is captioned “Photo N” and warned about once; that caption is renumbered when the photos change order. An `aria-label` is left as the name: the grid does not add a caption that would disagree with it. Put the grid inside `<uvalib-lightbox>` and a plain click opens the viewer.
|
|
1704
|
+
|
|
1705
|
+
#### Attributes
|
|
1706
|
+
|
|
1707
|
+
| Attribute | Type | Default | Description |
|
|
1708
|
+
|---|---|---|---|
|
|
1709
|
+
| `row-height` | `string` | `''` | Row height. A bare number is pixels (`220` is 220px); `px`, `rem`, `em`, `vh`, `vw`, `vmin`, `vmax`, `ch` and `%` are kept. Empty uses 220px, or 140px when the viewport is 767px or narrower. |
|
|
1710
|
+
| `no-shadow-dom` | `boolean` | `false` | |
|
|
1711
|
+
| `no-style` | `boolean` | `false` | |
|
|
1712
|
+
|
|
1713
|
+
#### Slots
|
|
1714
|
+
|
|
1715
|
+
| Slot | Description |
|
|
1716
|
+
|---|---|
|
|
1717
|
+
| (default) | The thumbnails: one `<a href>` or `<button>` per photo, each with an `<img>`. |
|
|
1718
|
+
|
|
1719
|
+
#### CSS custom properties
|
|
1720
|
+
|
|
1721
|
+
| Property | Default | Description |
|
|
1722
|
+
|---|---|---|
|
|
1723
|
+
| `--uva-color-text` | | Dark-mode role token: caption colour (else `--uva-grey-darkest`). |
|
|
1724
|
+
| `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
|
|
1725
|
+
| `--uva-color-surface` | | Dark-mode role token: the box behind an image that has not loaded (else #fff). |
|
|
1726
|
+
| `--uva-grey-darkest` | `#2b2b2b` | Caption colour when `--uva-color-text` is unset. |
|
|
1727
|
+
| `--uva-brand-orange` | `#e57200` | Focus ring when `--uva-color-focus` is unset. |
|
|
1728
|
+
|
|
1038
1729
|
### `<website-section>`
|
|
1039
1730
|
|
|
1040
1731
|
The library website's first pages (pages, people, libraries, news) matching `query`, from Drupal's search index, with its excerpt (the matched words marked). The index sends no CORS headers, so this section works on library.virginia.edu (or wherever `BentoBox.endpoints.website` points to a same-origin copy) only.
|
|
@@ -1056,7 +1747,7 @@ The library website's first pages (pages, people, libraries, news) matching `que
|
|
|
1056
1747
|
|---|---|
|
|
1057
1748
|
| `bento-state` | Whenever `state` changes (bubbles, composed); `<bento-box>` listens to announce "Results updated" once every section has settled. |
|
|
1058
1749
|
| `uvalib-analytics-search` | For `<site-analytics>`: once per settled search (results or none, not an error): the query, the section's `analyticsName` as category and its total when known. Bubbles and is composed. |
|
|
1059
|
-
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; never titles or URLs. Bubbles and is composed. |
|
|
1750
|
+
| `uvalib-analytics-event` | For `<site-analytics>`: `['bento-box', 'result-click', <section>, <1-based position>]` or `['bento-box', 'see-all-click', <section>]`; `['bento-box', 'retry', <section>]` for its Retry button; `['bento-box', 'error', 'section-load: <section>']` once when its results cannot be loaded; never titles or URLs. Bubbles and is composed. |
|
|
1060
1751
|
|
|
1061
1752
|
#### CSS custom properties
|
|
1062
1753
|
|
|
@@ -1085,7 +1776,7 @@ The library website's first pages (pages, people, libraries, news) matching `que
|
|
|
1085
1776
|
|
|
1086
1777
|
Three automated checks guard accessibility, best practice and performance. The first two run in `pnpm test`; Lighthouse is slower and runs on its own (`pnpm lhci`, and the `lighthouse` job in the `CI` workflow).
|
|
1087
1778
|
|
|
1088
|
-
- **axe, at every impact level.** `expectNoAxeViolations` (`test/helpers/axe.ts`) fails on minor, moderate, serious and critical violations, so best-practice rules such as `heading-order`, `region` and the landmark rules count. Every visual component is audited in shadow and light DOM, and in the states people use: menus and groups open (the header Menu popover at 390px, `site-main-nav` at 1280px and 390px), `uvalib-filter` expanded with a scope pressed and a box checked, `uvalib-date-range` with the sliders on one year and dates typed, the hours elements loading, loaded and failing, and `events-section` loading, loaded, empty and failing, on its own and in home-page markup in light and dark. Full-page tests use `expectNoPageAxeViolations`, which audits the whole document so the rules that only match `<html>` (`landmark-one-main`, `page-has-heading-one`) run too; it gives the test runner's bare page a `<title>` and `lang` first, and disables no rule. Tests never reach the network: `test/helpers/*-intercept.mjs` route the alerts, hours, events and main-nav hosts to fixtures.
|
|
1779
|
+
- **axe, at every impact level, at least as strict as Lighthouse.** `expectNoAxeViolations` (`test/helpers/axe.ts`) fails on minor, moderate, serious and critical violations, so best-practice rules such as `heading-order`, `region` and the landmark rules count. It runs every axe rule and also turns on the ones Lighthouse's accessibility audit enables that a default axe run leaves off (`target-size`, `identical-links-same-purpose`, `table-fake-caption`, `td-has-header`), so a component that passes here cannot lose Lighthouse accessibility points to axe. Sites built with the components get the same setup for Playwright in the skill's [accessibility testing guide](skills/uvalib-web-components/reference/accessibility-testing.md). Every visual component is audited in shadow and light DOM, and in the states people use: menus and groups open (the header Menu popover at 390px, `site-main-nav` at 1280px and 390px), `uvalib-filter` expanded with a scope pressed and a box checked, `uvalib-date-range` with the sliders on one year and dates typed, the hours elements loading, loaded and failing, and `events-section` loading, loaded, empty and failing, on its own and in home-page markup in light and dark. Full-page tests use `expectNoPageAxeViolations`, which audits the whole document so the rules that only match `<html>` (`landmark-one-main`, `page-has-heading-one`) run too; it gives the test runner's bare page a `<title>` and `lang` first, and disables no rule. Tests never reach the network: `test/helpers/*-intercept.mjs` route the alerts, hours, events and main-nav hosts to fixtures.
|
|
1089
1780
|
- **Bundle-size budgets.** `test/size-budget.test.mjs` gzips (level 9) every entry in `dist-cdn/manifest.json` together with every chunk it imports, statically or with `import()` (site-page's lazy site-footer), each counted once, and fails if one exceeds its budget in `test/size-budgets.json` (about 12% over the sizes below). `node scripts/bundle-sizes.mjs` prints today's sizes against the budgets. When a change has to grow a bundle, raise its budget in the same PR and say why.
|
|
1090
1781
|
|
|
1091
1782
|
| Entry | gzip (bytes) | Budget |
|