@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
|
@@ -72,3 +72,18 @@ Importing `@uvalib/web-components` itself returns classes only and registers not
|
|
|
72
72
|
- Delete any hand-written `<main>`, `role="main"`, skip link, header or footer: `<site-page>` renders them.
|
|
73
73
|
- `<site-style no-shadow-dom>` still works (it installs tokens and base styles); new pages do not need it.
|
|
74
74
|
- Look for `no-shadow-dom` that was added only as a workaround; keep it only if the host CSS should own the styling.
|
|
75
|
+
|
|
76
|
+
## Alerts: from the alerts project's UI to `<site-alerts>`
|
|
77
|
+
|
|
78
|
+
Since 1.2.0 the library draws the alerts itself with `<site-alerts>`; the alerts project's `<uvalib-alerts>` only provides the data (headless). Pages using `<site-page>` need nothing: it switched by itself (its dark-mode `--uvalib-alerts-*` properties are replaced by the `--uva-color-alert-*` role tokens).
|
|
79
|
+
|
|
80
|
+
Pages that show the alerts project's UI directly switch like this:
|
|
81
|
+
|
|
82
|
+
| Old | New |
|
|
83
|
+
| --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
84
|
+
| `<script type="module" src="https://d2q6t6fdv76k7r.cloudfront.net/v1/uvalib-alerts.js">` (or the `.iife.js` build, or a pinned version) | `<script type="module" src="https://unpkg.internal.lib.virginia.edu/web-components/v1/site-alerts.js">`; it loads the alerts script itself |
|
|
85
|
+
| `<uvalib-alerts show="sitewide">` (or `all`, `header`, `list`, `regional`) | `<site-alerts show="sitewide">` (same `show` values) |
|
|
86
|
+
| `<uvalib-alerts src="https://dzfvxb8mejnv6.cloudfront.net/">` | `<site-alerts alerts-env="staging">` (or `alerts-src="…"` for another base) |
|
|
87
|
+
| `storage-key="…"` | the same attribute on `<site-alerts>` |
|
|
88
|
+
| `--uvalib-alerts-*` custom properties and `::part(…)` | the `--uva-color-alert-*` role tokens (keep 7:1 text contrast); there are no parts. List titles are `<h2>`: set `heading-level` if the page outline needs another level |
|
|
89
|
+
| a headless `<uvalib-alerts headless>` in an app (Virgo) | unchanged: apps that draw alerts themselves keep using the alerts project directly, and set `no-alerts` on `<site-page>` |
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../../src/components/site-page/alerts.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,mGAAmG;AAEnG,uFAAuF;AACvF,sFAAsF;AACtF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,qBAAqB,GAAG,w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CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,OAAO,CAAC,IAAI,CACV,uDAAuD,GAAG,wBAAwB,CACnF,CAAC;IACJ,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;IACF,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { a as e, f as t, n, t as r } from "./UvalibElement-BnI-eRRR.js";
|
|
2
|
-
import { n as i, t as a } from "./analytics-C8D8n_wt.js";
|
|
3
|
-
// src/data/sites.ts
|
|
4
|
-
var o = [
|
|
5
|
-
{
|
|
6
|
-
name: "100 Objects",
|
|
7
|
-
matomoSiteId: 31,
|
|
8
|
-
urls: ["https://100objects.lib.virginia.edu/"]
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
name: "Avalon",
|
|
12
|
-
matomoSiteId: 42,
|
|
13
|
-
urls: ["https://avalon.lib.virginia.edu/"]
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: "Explore",
|
|
17
|
-
matomoSiteId: 2,
|
|
18
|
-
urls: ["https://explore.lib.virginia.edu/"]
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
name: "Faculty Newsletter",
|
|
22
|
-
matomoSiteId: 22,
|
|
23
|
-
inactive: !0
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
name: "Library Cluster",
|
|
27
|
-
matomoSiteId: 3,
|
|
28
|
-
urls: ["https://jti.lib.virginia.edu/", "https://etext.virginia.edu/"],
|
|
29
|
-
inactive: !0
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "Library Web Site",
|
|
33
|
-
matomoSiteId: 10,
|
|
34
|
-
urls: ["https://www.library.virginia.edu/", "https://library.virginia.edu/"]
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "Mobile",
|
|
38
|
-
matomoSiteId: 13,
|
|
39
|
-
inactive: !0
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: "Research Guides",
|
|
43
|
-
matomoSiteId: 5,
|
|
44
|
-
urls: ["https://guides.lib.virginia.edu/"]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "Staff newsletter",
|
|
48
|
-
matomoSiteId: 26,
|
|
49
|
-
inactive: !0
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "Tedium Reducer III",
|
|
53
|
-
matomoSiteId: 41,
|
|
54
|
-
urls: ["https://fillholdreader.internal.lib.virginia.edu/"]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "Test UX",
|
|
58
|
-
matomoSiteId: 23,
|
|
59
|
-
description: "Test Matomo Id for development/testing purposes",
|
|
60
|
-
matomoDefault: !0
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "The Taper",
|
|
64
|
-
matomoSiteId: 25,
|
|
65
|
-
urls: ["https://thetaper.library.virginia.edu/"]
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: "Virgo",
|
|
69
|
-
matomoSiteId: 1,
|
|
70
|
-
urls: ["https://search.lib.virginia.edu/"]
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
name: "Virgo Lite",
|
|
74
|
-
matomoSiteId: 40,
|
|
75
|
-
urls: ["https://search-kiosk.lib.virginia.edu/"]
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "Modern Library Bibliography",
|
|
79
|
-
urls: ["https://mlbib.library.virginia.edu/"]
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: "Board of Visitors Minutes",
|
|
83
|
-
urls: ["https://bov.library.virginia.edu/"]
|
|
84
|
-
}
|
|
85
|
-
];
|
|
86
|
-
function s(e, t = o) {
|
|
87
|
-
let n = t.find((t) => t.urls?.some((t) => e.startsWith(t))), r = t.find((e) => e.matomoDefault === !0);
|
|
88
|
-
return n?.matomoSiteId || r?.matomoSiteId;
|
|
89
|
-
}
|
|
90
|
-
// src/components/site-analytics/SiteAnalytics.ts
|
|
91
|
-
var c = i;
|
|
92
|
-
function l(e) {
|
|
93
|
-
return !!document.querySelector("script[src*=\"matomo.js\"]") || e.some((e) => Array.isArray(e) && e[0] === "setSiteId");
|
|
94
|
-
}
|
|
95
|
-
function u(e) {
|
|
96
|
-
if (e == null || e === "") return !1;
|
|
97
|
-
let t = Number(e);
|
|
98
|
-
return Number.isFinite(t) ? t : !1;
|
|
99
|
-
}
|
|
100
|
-
var d = class extends r {
|
|
101
|
-
constructor(...e) {
|
|
102
|
-
super(...e), this.matomoURL = "https://analytics.lib.virginia.edu/", this.spa = !1, this.variables = null, this.tracker = { off: !1 }, this.onEvent = (e) => {
|
|
103
|
-
if (!this.forwards()) return;
|
|
104
|
-
let t = e.type.slice(e.type.lastIndexOf("-") + 1), n = e.detail ?? {};
|
|
105
|
-
t === "event" ? this.logEvent(n) : t === "search" ? this.logSearch(n) : this.logPageView(n);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
static {
|
|
109
|
-
this.styles = t`
|
|
110
|
-
:host {
|
|
111
|
-
display: none;
|
|
112
|
-
}
|
|
113
|
-
`;
|
|
114
|
-
}
|
|
115
|
-
connectedCallback() {
|
|
116
|
-
super.connectedCallback(), c().trackers.push(this.tracker);
|
|
117
|
-
for (let e of a) document.addEventListener(e, this.onEvent);
|
|
118
|
-
}
|
|
119
|
-
disconnectedCallback() {
|
|
120
|
-
for (let e of a) document.removeEventListener(e, this.onEvent);
|
|
121
|
-
let { trackers: e } = c(), t = e.indexOf(this.tracker);
|
|
122
|
-
t >= 0 && e.splice(t, 1), super.disconnectedCallback();
|
|
123
|
-
}
|
|
124
|
-
forwards() {
|
|
125
|
-
return c().trackers.find((e) => !e.off) === this.tracker;
|
|
126
|
-
}
|
|
127
|
-
get paq() {
|
|
128
|
-
return window._paq ??= [];
|
|
129
|
-
}
|
|
130
|
-
firstUpdated() {
|
|
131
|
-
let e = this.matomoId || s(window.location.href);
|
|
132
|
-
if (!e) {
|
|
133
|
-
this.tracker.off = !0;
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
let t = c();
|
|
137
|
-
if (t.booted) return;
|
|
138
|
-
t.booted = !0;
|
|
139
|
-
let n = this.paq;
|
|
140
|
-
if (l(n)) return;
|
|
141
|
-
n.push(["setTrackerUrl", `${this.matomoURL}matomo.php`]), n.push(["setSiteId", String(e)]);
|
|
142
|
-
for (let [e, t] of Object.entries(this.variables ?? {})) n.push([
|
|
143
|
-
"setCustomDimension",
|
|
144
|
-
e,
|
|
145
|
-
t
|
|
146
|
-
]);
|
|
147
|
-
this.spa || (n.push(["trackPageView"]), n.push(["enableLinkTracking"]));
|
|
148
|
-
let r = document.createElement("script");
|
|
149
|
-
r.async = !0, r.src = `${this.matomoURL}matomo.js`, document.head.append(r);
|
|
150
|
-
}
|
|
151
|
-
logPageView(e) {
|
|
152
|
-
let t = e.customTitle || document.title, n = e.referrer ? e.referrer.startsWith("http") ? e.referrer : location.origin + e.referrer : document.referrer;
|
|
153
|
-
this.paq.push(["setDocumentTitle", t], ["setReferrerUrl", n], ["trackPageView", t]);
|
|
154
|
-
}
|
|
155
|
-
logSearch(e) {
|
|
156
|
-
e.searchQuery && this.paq.push([
|
|
157
|
-
"trackSiteSearch",
|
|
158
|
-
e.searchQuery,
|
|
159
|
-
e.searchCategory || !1,
|
|
160
|
-
u(e.resultCount)
|
|
161
|
-
]);
|
|
162
|
-
}
|
|
163
|
-
logEvent(e) {
|
|
164
|
-
let t = e.event ?? e.track;
|
|
165
|
-
Array.isArray(t) && t.length >= 2 && this.paq.push(["trackEvent", ...t]);
|
|
166
|
-
}
|
|
167
|
-
render() {
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
n([e({ type: String })], d.prototype, "matomoURL", void 0), n([e({ type: Number })], d.prototype, "matomoId", void 0), n([e({ type: Boolean })], d.prototype, "spa", void 0), n([e({ type: Object })], d.prototype, "variables", void 0);
|
|
172
|
-
export { d as t };
|
|
173
|
-
|
|
174
|
-
//# sourceMappingURL=SiteAnalytics-T1Wx3lsb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SiteAnalytics-T1Wx3lsb.js","names":["_decorate","property","n","i","UvalibElement","analyticsState","ANALYTICS_EVENTS","sites","findMatomoId","matched","list","s","href","u","fallback","shared","matomoOnPage","paq","c","countOf","v","SiteAnalytics","_args","type","detail","t","trackers","id","state","key","value","script","title","d","referrer","parts","__decorate"],"sources":["../../src/data/sites.ts","../../src/components/site-analytics/SiteAnalytics.ts"],"sourcesContent":["export interface Site {\n name: string;\n /** Absent for sites that are listed but have no Matomo property. */\n matomoSiteId?: number;\n description?: string;\n urls?: string[];\n inactive?: boolean;\n matomoDefault?: boolean;\n}\n\nexport const sites: Site[] = [\n {\n name: '100 Objects',\n matomoSiteId: 31,\n urls: ['https://100objects.lib.virginia.edu/'],\n },\n {\n name: 'Avalon',\n matomoSiteId: 42,\n urls: ['https://avalon.lib.virginia.edu/'],\n },\n {\n name: 'Explore',\n matomoSiteId: 2,\n urls: ['https://explore.lib.virginia.edu/'],\n },\n {\n name: 'Faculty Newsletter',\n matomoSiteId: 22,\n inactive: true,\n },\n {\n name: 'Library Cluster',\n matomoSiteId: 3,\n urls: ['https://jti.lib.virginia.edu/', 'https://etext.virginia.edu/'],\n inactive: true,\n },\n {\n name: 'Library Web Site',\n matomoSiteId: 10,\n urls: ['https://www.library.virginia.edu/', 'https://library.virginia.edu/'],\n },\n {\n name: 'Mobile',\n matomoSiteId: 13,\n inactive: true,\n },\n {\n name: 'Research Guides',\n matomoSiteId: 5,\n urls: ['https://guides.lib.virginia.edu/'],\n },\n {\n name: 'Staff newsletter',\n matomoSiteId: 26,\n inactive: true,\n },\n {\n name: 'Tedium Reducer III',\n matomoSiteId: 41,\n urls: ['https://fillholdreader.internal.lib.virginia.edu/'],\n },\n {\n name: 'Test UX',\n matomoSiteId: 23,\n description: 'Test Matomo Id for development/testing purposes',\n matomoDefault: true,\n },\n {\n name: 'The Taper',\n matomoSiteId: 25,\n urls: ['https://thetaper.library.virginia.edu/'],\n },\n {\n name: 'Virgo',\n matomoSiteId: 1,\n urls: ['https://search.lib.virginia.edu/'],\n },\n {\n name: 'Virgo Lite',\n matomoSiteId: 40,\n urls: ['https://search-kiosk.lib.virginia.edu/'],\n },\n {\n name: 'Modern Library Bibliography',\n urls: ['https://mlbib.library.virginia.edu/'],\n },\n {\n name: 'Board of Visitors Minutes',\n urls: ['https://bov.library.virginia.edu/'],\n },\n];\n\n/** Matomo site id for an href: first site whose url prefixes it, else the matomoDefault site's id. */\nexport function findMatomoId(href: string, list: Site[] = sites): number | undefined {\n const matched = list.find((s) => s.urls?.some((u) => href.startsWith(u)));\n const fallback = list.find((s) => s.matomoDefault === true);\n return matched?.matomoSiteId || fallback?.matomoSiteId;\n}\n","import { css } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { findMatomoId } from '../../data/sites.js';\nimport { analyticsState, ANALYTICS_EVENTS, type AnalyticsTracker } from '../../base/analytics.js';\n\n/** The page's window with Matomo's command queue, which matomo.js replays when it loads. */\ntype MatomoWindow = Window & { _paq?: unknown[][] };\n\ninterface PageViewDetail {\n customTitle?: string;\n referrer?: string;\n}\n\ninterface SearchDetail {\n searchQuery?: string;\n searchCategory?: string | null;\n resultCount?: number | string | null;\n}\n\ninterface EventDetail {\n event?: unknown[];\n /** The old name of `event`. */\n track?: unknown[];\n}\n\ntype Tracker = AnalyticsTracker;\nconst shared = analyticsState;\n\n/** Matomo is already on the page: a matomo.js script, or a queue that sets a site id. */\nfunction matomoOnPage(paq: unknown[][]): boolean {\n return (\n !!document.querySelector('script[src*=\"matomo.js\"]') ||\n paq.some((c) => Array.isArray(c) && c[0] === 'setSiteId')\n );\n}\n\n/** A result count for Matomo: a number, or `false` (Matomo's \"unknown\"). */\nfunction countOf(n: SearchDetail['resultCount']): number | false {\n if (n === null || n === undefined || n === '') return false;\n const v = Number(n);\n return Number.isFinite(v) ? v : false;\n}\n\n/**\n * Matomo analytics, with no visual output. Loads matomo.js for the site and records the\n * page view, then forwards the events below, fired anywhere in the page, to Matomo. Every\n * call goes through Matomo's `_paq` queue, so events fired before matomo.js loads are kept.\n *\n * One tracker per page: however many `<site-analytics>` and `<uvalib-analytics>` elements\n * there are (from any copy of this library), matomo.js is loaded and the page view recorded\n * once, and only one element forwards each event; if it is removed, the next takes over. A\n * Matomo snippet already on the page is used as it is (nothing is loaded or recorded again).\n *\n * The same element is registered as `<uvalib-analytics>` by `uvalib-analytics.js`.\n *\n * @tagname site-analytics\n * @fires 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).\n * @fires uvalib-analytics-search - Listened for on `document` (not fired): a Matomo site search; `detail` is `{ searchQuery, searchCategory?, resultCount? }`.\n * @fires 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`).\n * @fires site-analytics-pageview - Listened for on `document` too: the same as `uvalib-analytics-pageview`.\n * @fires site-analytics-search - Listened for on `document` too: the same as `uvalib-analytics-search`.\n * @fires site-analytics-event - Listened for on `document` too: the same as `uvalib-analytics-event`.\n */\nexport class SiteAnalytics extends UvalibElement {\n static styles = css`\n :host {\n display: none;\n }\n `;\n\n /** The Matomo server, ending in `/` (attribute `matomourl`). */\n @property({ type: String }) matomoURL: string = 'https://analytics.lib.virginia.edu/';\n /** The Matomo site id (attribute `matomoid`). Default: the site whose URL the page is under. */\n @property({ type: Number }) matomoId?: number;\n /** A single-page app records its own page views (`uvalib-analytics-pageview`): none on load. */\n @property({ type: Boolean }) spa: boolean = false;\n /** Custom dimensions, a JSON object of `{ id: value }`, set before the page view. */\n @property({ type: Object }) variables: Record<string, unknown> | null = null;\n\n private readonly tracker: Tracker = { off: false };\n\n private readonly onEvent = (e: Event) => {\n if (!this.forwards()) return;\n const type = e.type.slice(e.type.lastIndexOf('-') + 1);\n const detail = (e as CustomEvent).detail ?? {};\n if (type === 'event') this.logEvent(detail as EventDetail);\n else if (type === 'search') this.logSearch(detail as SearchDetail);\n else this.logPageView(detail as PageViewDetail);\n };\n\n override connectedCallback() {\n super.connectedCallback();\n shared().trackers.push(this.tracker);\n for (const t of ANALYTICS_EVENTS) document.addEventListener(t, this.onEvent);\n }\n\n override disconnectedCallback() {\n for (const t of ANALYTICS_EVENTS) document.removeEventListener(t, this.onEvent);\n const { trackers } = shared();\n const i = trackers.indexOf(this.tracker);\n if (i >= 0) trackers.splice(i, 1);\n super.disconnectedCallback();\n }\n\n /** Whether this element is the page's one forwarder: the first connected one with a site id. */\n private forwards(): boolean {\n return shared().trackers.find((t) => !t.off) === this.tracker;\n }\n\n private get paq(): unknown[][] {\n return ((window as MatomoWindow)._paq ??= []);\n }\n\n protected override firstUpdated() {\n const id = this.matomoId || findMatomoId(window.location.href);\n if (!id) {\n this.tracker.off = true;\n return;\n }\n const state = shared();\n if (state.booted) return;\n state.booted = true;\n const paq = this.paq;\n if (matomoOnPage(paq)) return;\n paq.push(['setTrackerUrl', `${this.matomoURL}matomo.php`]);\n paq.push(['setSiteId', String(id)]);\n for (const [key, value] of Object.entries(this.variables ?? {}))\n paq.push(['setCustomDimension', key, value]);\n if (!this.spa) {\n paq.push(['trackPageView']);\n paq.push(['enableLinkTracking']);\n }\n const script = document.createElement('script');\n script.async = true;\n script.src = `${this.matomoURL}matomo.js`;\n document.head.append(script);\n }\n\n private logPageView(d: PageViewDetail) {\n const title = d.customTitle || document.title;\n const referrer = d.referrer\n ? d.referrer.startsWith('http')\n ? d.referrer\n : location.origin + d.referrer\n : document.referrer;\n this.paq.push(\n ['setDocumentTitle', title],\n ['setReferrerUrl', referrer],\n ['trackPageView', title],\n );\n }\n\n private logSearch(d: SearchDetail) {\n if (!d.searchQuery) return;\n this.paq.push([\n 'trackSiteSearch',\n d.searchQuery,\n d.searchCategory || false,\n countOf(d.resultCount),\n ]);\n }\n\n private logEvent(d: EventDetail) {\n const parts = d.event ?? d.track;\n if (Array.isArray(parts) && parts.length >= 2) this.paq.push(['trackEvent', ...parts]);\n }\n\n protected override render() {\n return null;\n }\n}\n"],"mappings":";;;AAUA,IAAaO,IAAgB;CAC3B;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,sCAAsC;CAC/C;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,kCAAkC;CAC3C;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,mCAAmC;CAC5C;CACA;EACE,MAAM;EACN,cAAc;EACd,UAAU;CACZ;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,iCAAiC,6BAA6B;EACrE,UAAU;CACZ;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,qCAAqC,+BAA+B;CAC7E;CACA;EACE,MAAM;EACN,cAAc;EACd,UAAU;CACZ;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,kCAAkC;CAC3C;CACA;EACE,MAAM;EACN,cAAc;EACd,UAAU;CACZ;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,mDAAmD;CAC5D;CACA;EACE,MAAM;EACN,cAAc;EACd,aAAa;EACb,eAAe;CACjB;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,wCAAwC;CACjD;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,kCAAkC;CAC3C;CACA;EACE,MAAM;EACN,cAAc;EACd,MAAM,CAAC,wCAAwC;CACjD;CACA;EACE,MAAM;EACN,MAAM,CAAC,qCAAqC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event", { event: n });
|
|
11
|
-
}
|
|
12
|
-
function n(t, n, r, i) {
|
|
13
|
-
e(t, "search", {
|
|
14
|
-
searchQuery: n,
|
|
15
|
-
searchCategory: r,
|
|
16
|
-
resultCount: i
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
var r = Symbol.for("@uvalib/web-components/analytics");
|
|
20
|
-
function i() {
|
|
21
|
-
let e = window;
|
|
22
|
-
return e[r] ??= {
|
|
23
|
-
trackers: [],
|
|
24
|
-
booted: !1
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
var a = ["uvalib-analytics", "site-analytics"].flatMap((e) => [
|
|
28
|
-
"event",
|
|
29
|
-
"search",
|
|
30
|
-
"pageview"
|
|
31
|
-
].map((t) => `${e}-${t}`));
|
|
32
|
-
function o(e) {
|
|
33
|
-
let t = [], n = (e) => {
|
|
34
|
-
i().trackers.some((e) => !e.off) || t.push({
|
|
35
|
-
type: e.type,
|
|
36
|
-
detail: e.detail
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
for (let t of a) e.addEventListener(t, n);
|
|
40
|
-
let r = () => {
|
|
41
|
-
for (let t of a) e.removeEventListener(t, n);
|
|
42
|
-
};
|
|
43
|
-
return {
|
|
44
|
-
flush() {
|
|
45
|
-
r();
|
|
46
|
-
for (let { type: n, detail: r } of t.splice(0)) e.dispatchEvent(new CustomEvent(n, { detail: r }));
|
|
47
|
-
},
|
|
48
|
-
drop() {
|
|
49
|
-
r(), t.length = 0;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export { n as a, t as i, i as n, o as r, a as t };
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=analytics-C8D8n_wt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-C8D8n_wt.js","names":["send","type","trackEvent","el","parts","trackSearch","query","category","count","STATE","analyticsState","w","ANALYTICS_EVENTS","f","bufferAnalytics","kept","keep","t","stop"],"sources":["../../src/base/analytics.ts"],"sourcesContent":["/**\n * Report to the page's analytics element, if there is one. Each helper dispatches a bubbling,\n * composed `uvalib-analytics-*` event from `el`; `<uvalib-analytics>` and `<site-analytics>`\n * (and the old v0.0.12 `<uvalib-analytics>`) listen on `document` and forward it to Matomo.\n * Without a listener nothing happens. Never pass titles, URLs or other personal text.\n */\n\n/** A Matomo event: category, action, then optional name and numeric value. */\nexport type AnalyticsEvent = [category: string, action: string, name?: string, value?: number];\n\nconst send = (el: EventTarget, type: string, detail: object): void => {\n el.dispatchEvent(\n new CustomEvent(`uvalib-analytics-${type}`, { detail, bubbles: true, composed: true }),\n );\n};\n\n/** A Matomo event (`trackEvent`), e.g. `['site-main-nav', 'menu-open', 'Research']`. */\nexport function trackEvent(el: EventTarget, parts: AnalyticsEvent): void {\n send(el, 'event', { event: parts });\n}\n\n/**\n * A Matomo site search (`trackSiteSearch`): the keyword, its category (e.g. a result section)\n * and the result count, left out when unknown.\n */\nexport function trackSearch(\n el: EventTarget,\n query: string,\n category?: string,\n count?: number,\n): void {\n send(el, 'search', { searchQuery: query, searchCategory: category, resultCount: count });\n}\n\n/** One analytics element on the page, as the shared state sees it. */\nexport interface AnalyticsTracker {\n /** Has no Matomo site id: it neither loads Matomo nor forwards events. */\n off: boolean;\n}\n\n/**\n * State shared by every analytics element on the page, whichever tag, and whichever copy of\n * the bundle defined it (an npm build and a CDN script, or two CDN versions): `Symbol.for`\n * gives every copy the same key. Keep its shape stable across versions.\n */\nexport interface AnalyticsState {\n /** Connected elements, in connection order; the first one not `off` forwards events. */\n trackers: AnalyticsTracker[];\n /** Matomo is set up on the page (by an element, or by a snippet found there first). */\n booted: boolean;\n}\n\nconst STATE = Symbol.for('@uvalib/web-components/analytics');\n\n/** The page's shared analytics state. */\nexport function analyticsState(): AnalyticsState {\n const w = window as unknown as Record<symbol, AnalyticsState | undefined>;\n return (w[STATE] ??= { trackers: [], booted: false });\n}\n\n/** Every event type the analytics elements listen for, in both families. */\nexport const ANALYTICS_EVENTS = ['uvalib-analytics', 'site-analytics'].flatMap((f) =>\n ['event', 'search', 'pageview'].map((t) => `${f}-${t}`),\n);\n\n/**\n * Keep the analytics events fired while no element forwards them (an element's code is still\n * loading), to hand over once one does. `flush()` fires them again on `doc`; `drop()` forgets\n * them. Either one stops the buffering.\n */\nexport function bufferAnalytics(doc: Document): { flush(): void; drop(): void } {\n const kept: { type: string; detail: unknown }[] = [];\n const keep = (e: Event) => {\n if (analyticsState().trackers.some((t) => !t.off)) return; // someone forwards it\n kept.push({ type: e.type, detail: (e as CustomEvent).detail });\n };\n for (const t of ANALYTICS_EVENTS) doc.addEventListener(t, keep);\n const stop = () => {\n for (const t of ANALYTICS_EVENTS) doc.removeEventListener(t, keep);\n };\n return {\n flush() {\n stop();\n for (const { type, detail } of kept.splice(0))\n doc.dispatchEvent(new CustomEvent(type, { detail }));\n },\n drop() {\n stop();\n kept.length = 0;\n },\n };\n}\n"],"mappings":";AAUA,IAAMA,KAAQ,GAAiB,GAAc,MAAyB;CACpE,EAAG,cACD,IAAI,YAAY,oBAAoBC,KAAQ;EAAE;EAAQ,SAAS;EAAM,UAAU;CAAK,CAAC,CACvF;AACF;AAGA,SAAgBC,EAAW,GAAiB,GAA6B;CACvE,EAAKC,GAAI,SAAS,EAAE,OAAOC,EAAM,CAAC;AACpC;AAMA,SAAgBC,EACd,GACA,GACA,GACA,GACM;CACN,EAAKF,GAAI,UAAU;EAAE,aAAaG;EAAO,gBAAgBC;EAAU,aAAaC;CAAM,CAAC;AACzF;AAoBA,IAAMC,IAAQ,OAAO,IAAI,kCAAkC;AAG3D,SAAgBC,IAAiC;CAC/C,IAAMC,IAAI;CACV,OAAQ,EAAEF,OAAW;EAAE,UAAU,CAAC;EAAG,QAAQ;CAAM;AACrD;AAGA,IAAaG,IAAmB,CAAC,oBAAoB,gBAAgB,CAAC,CAAC,SAAS,MAC9E;CAAC;CAAS;CAAU;AAAU,CAAC,CAAC,KAAK,MAAM,GAAGC,EAAE,GAAG,GAAG,CACxD;AAOA,SAAgBC,EAAgB,GAAgD;CAC9E,IAAMC,IAA4C,CAAC,GAC7CC,KAAQ,MAAa;EACzB,AAAIN,EAAe,CAAC,CAAC,SAAS,MAAM,MAAM,CAACO,EAAE,GAAG,KAChDF,EAAK,KAAK;GAAE,MAAM,EAAE;GAAM,QAAS,EAAkB;EAAO,CAAC;CAC/D;CACA,KAAK,IAAM,KAAKH,GAAkB,EAAI,iBAAiB,GAAGI,CAAI;CAC9D,IAAME,UAAa;EACjB,KAAK,IAAM,KAAKN,GAAkB,EAAI,oBAAoB,GAAGI,CAAI;CACnE;CACA,OAAO;EACL,QAAQ;GACN,EAAK;GACL,KAAK,IAAM,EAAE,SAAM,eAAYD,EAAK,OAAO,CAAC,GAC1C,EAAI,cAAc,IAAI,YAAYd,GAAM,EAAE,UAAO,CAAC,CAAC;EACvD;EACA,OAAO;GAEL,AADAiB,EAAK,GACL,EAAK,SAAS;EAChB;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"library-weekly-hours-ByQ8ugxh.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","precedingHeadingLevel","todayInNewYork","accessible","hoursTiming","longDate","shortDate","shortWeekday","weekStart","hoursEndpoints","weekHeadingDate","formatDay","loadHours","fullDate","loadLibraries","addDays","setHoursEndpoints","instanceCounter","structuralRules","host","shadowStructure","LibraryWeeklyHours","_args","value","root","sheet","above","node","today","every","start","changed","id","announce","slug","days","background","libraries","library","l","spaces","ids","hours","maxAge","sameWeek","hadFocus","active","day","dates","calId","text","A","lib","cells","building","space","view","level","headingId","tableDays"],"sources":["../../src/components/library-weekly-hours/LibraryWeeklyHours.ts","../../src/components/library-weekly-hours/library-weekly-hours.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport {\n addDays,\n formatDay,\n fullDate,\n hoursEndpoints,\n hoursTiming,\n setHoursEndpoints,\n loadHours,\n loadLibraries,\n longDate,\n shortDate,\n shortWeekday,\n todayInNewYork,\n weekHeadingDate,\n weekStart,\n type HoursByCalendar,\n type HoursEndpoints,\n type LibraryInfo,\n} from '../library-hours/hours-data.js';\n\n/** Element ids share the document id space in light DOM, so each instance gets its own prefix. */\nlet instanceCounter = 0;\n\n/** What the table shows: one week's data, kept on screen while the next week loads. */\ninterface WeekView {\n days: string[];\n library: LibraryInfo;\n spaces: LibraryInfo[];\n hours: HoursByCalendar;\n}\n\n/** `loading` until the first data arrives, then `ready`, or `error` when it cannot be loaded. */\nexport type HoursState = 'loading' | 'ready' | 'error';\n\n/**\n * The layout rules the week header and table need even with `no-style`: Drupal's /hours CSS\n * relies on them. `host` is `:host` (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host}[loading] { min-height: var(--library-weekly-hours-min-height, 0); }\n ${host} .hours-placeholder { visibility: hidden; }\n /* One line even when empty, so \"Loading hours…\" giving way to nothing moves nothing below. */\n ${host} .weekly-hours-status { min-height: 1.5em; min-height: 1lh; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .weekly-hours-header-section {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n text-align: center;\n }\n ${host} .weekly-hours-header-section div[role='heading'] { flex: 1; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/**\n * One library's opening hours for a week (Sunday to Saturday, in America/New_York): a\n * header with \"Previous week\" / \"Next week\" buttons and the date range, then a table with a\n * \"Building hours\" row and a row per space in the library. Data comes from the library\n * website's JSON:API (same origin) and LibCal, shared between all hours elements on a page.\n * Used on library.virginia.edu/hours through `<library-hours-setup>`.\n *\n * @tagname library-weekly-hours\n * @csspart building-hours - The \"Building hours\" table row (shadow mode).\n * @cssprop [--library-weekly-hours-min-height=0] - Height the element keeps during its first load (while it has the `loading` attribute, before any rows show), so content below does not jump when the hours arrive. Applies with `no-style` too. Pages can reserve the same height before the element upgrades with `library-weekly-hours:not(:defined) { display: block; min-height: … }`.\n * @cssprop [--uva-brand-orange=#e57200] - Border of today's column; focus ring colour.\n * @cssprop [--uva-brand-blue=#232d4b] - Header and button colour.\n * @cssprop --uva-color-border - Dark-mode role token: table cell borders (else #dadada).\n * @cssprop --uva-color-current - Dark-mode role token: today's column border (else `--uva-brand-orange`).\n * @cssprop --uva-color-link - Dark-mode role token: heading, button text and border (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: button background (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class LibraryWeeklyHours extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin-block: 1rem;\n }\n th,\n td {\n padding: 0.5rem;\n border: 1px solid var(--uva-color-border, #dadada);\n text-align: center;\n vertical-align: middle;\n }\n tbody th {\n text-align: start;\n }\n th.today,\n td.today {\n border-inline: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n th.today {\n border-block-start: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n .date-header-day {\n font-weight: bold;\n }\n tbody .date--mobile {\n display: none;\n }\n .uvalib-button {\n font: inherit;\n padding: 0.4rem 0.9rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n cursor: pointer;\n }\n .heading-h1,\n .heading-h2,\n .heading-h3,\n .heading-h4,\n .heading-h5,\n .heading-h6 {\n font-size: 1.25rem;\n font-weight: bold;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n `,\n ];\n\n /**\n * The data endpoints shared by all hours elements: `libraries` (the Drupal JSON:API URL,\n * relative by default) and `hours` (LibCal, with `{ids}`). Assigning an object (or setting\n * a key) changes them for every hours element from the next load on. To repoint before\n * elements already in the HTML start fetching, set `window.uvalibHoursEndpoints` before\n * the define script runs.\n */\n static get endpoints(): HoursEndpoints {\n return hoursEndpoints;\n }\n static set endpoints(value: Partial<HoursEndpoints>) {\n setHoursEndpoints(value);\n }\n\n /** The library's `field_slug` in Drupal (for example `clemons`). */\n @property({ type: String, attribute: 'library-slug' })\n librarySlug?: string;\n\n /** Which week to show: 0 is this week, 1 next week, -1 last week. Changed by the buttons. */\n @property({ type: Number, attribute: 'week-count', reflect: true })\n weekCount = 0;\n\n /** How often (ms) the current week's hours are fetched again. 0 turns it off. */\n @property({ type: Number, attribute: 'refresh-every' })\n refreshEvery = 600000;\n\n /** Hide the \"Building hours\" row (for a library whose building calendar is one of its spaces). */\n @property({ type: Boolean, attribute: 'hide-building-hours', reflect: true })\n hideBuildingHours = false;\n\n /**\n * `aria-level` (1–6) of the week heading, also its `heading-h<n>` class. Unset (the\n * default), the level is one below the nearest heading before the element in the page\n * (`aria-level` 3 under a library's `<h2>` on /hours), or 2 when there is none, and the\n * class stays `heading-h2`, the one the library website's CSS styles.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n /** Old name of `heading-level`, still accepted; `heading-level` wins. */\n @property({ type: Number, attribute: 'headinglevelstart' })\n headingLevelStart?: number;\n\n /** One below the nearest preceding heading, worked out on connect (see `level`). */\n @state() private inferredLevel = 2;\n\n /** `loading` (the default, until data arrives), `ready` or `error`. Read-only. */\n get state(): HoursState {\n return this._state;\n }\n\n @state() private _state: HoursState = 'loading';\n @state() private today = '';\n @state() private view?: WeekView;\n /**\n * During the first load, once the library list is in: the rows the table will have, so\n * placeholder rows can hold their height until the hours arrive.\n */\n @state() private pending?: Omit<WeekView, 'hours'>;\n @state() private announcement = '';\n\n private readonly uid = `library-weekly-hours-${++instanceCounter}`;\n private loadId = 0;\n /** Set by the week buttons and Retry: announce the result of the next load. */\n private userInitiated = false;\n private tickTimer?: ReturnType<typeof setInterval>;\n private refreshTimer?: ReturnType<typeof setInterval>;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? 2 : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n },\n );\n }\n this.today = todayInNewYork();\n clearInterval(this.tickTimer);\n this.tickTimer = setInterval(() => {\n const today = todayInNewYork();\n if (today !== this.today) this.today = today;\n else if (this._state === 'error') void this.load({ background: true });\n }, hoursTiming.tick);\n this.restartRefresh();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearInterval(this.tickTimer);\n clearInterval(this.refreshTimer);\n this.tickTimer = this.refreshTimer = undefined;\n }\n\n private restartRefresh() {\n clearInterval(this.refreshTimer);\n this.refreshTimer = undefined;\n const every = this.refreshEvery;\n if (!this.isConnected || !(every > 0)) return;\n this.refreshTimer = setInterval(() => {\n if (this.weekCount === 0 && this._state !== 'loading')\n void this.load({ background: true, maxAge: every / 2 });\n }, every);\n }\n\n /** The seven `YYYY-MM-DD` dates of the week shown. */\n private get days(): string[] {\n const start = addDays(weekStart(this.today), (Math.trunc(this.weekCount) || 0) * 7);\n return Array.from({ length: 7 }, (_, i) => addDays(start, i));\n }\n\n /** The level set by `heading-level` (or the old `headinglevelstart`), or null. */\n private get explicitLevel(): number | null {\n const n = Math.trunc(this.headingLevel ?? this.headingLevelStart ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : null;\n }\n\n /** The week heading's `aria-level`: as set, else inferred from the page on connect. */\n private get level(): number {\n return this.explicitLevel ?? this.inferredLevel;\n }\n\n /** The `heading-h<n>` class: as set, else `heading-h2` (what the library's CSS styles). */\n private get headingClass(): number {\n return this.explicitLevel ?? 2;\n }\n\n // A plain map: `today` is private, which PropertyValues<this> does not cover.\n protected override willUpdate(changed: Map<PropertyKey, unknown>) {\n if (!this.isConnected || !this.today) return;\n if (!this.hasUpdated || changed.has('librarySlug') || changed.has('weekCount')) {\n void this.load();\n } else if (changed.has('today')) {\n // The date rolled over: reload quietly. The same week keeps its rows on a failure.\n void this.load({ background: this.view?.days[0] === this.days[0] });\n }\n }\n\n protected override updated(changed: PropertyValues<this>) {\n // Only the first load, before any rows show, reserves --library-weekly-hours-min-height.\n this.toggleAttribute('loading', this._state === 'loading' && !this.view);\n // The first value is picked up by connectedCallback.\n if (changed.has('refreshEvery') && changed.get('refreshEvery') !== undefined)\n this.restartRefresh();\n }\n\n /**\n * Load the week shown. The previous rows stay on screen (the table is `aria-busy`) until\n * the new data lands. A `background` load (refresh, retry from the interval or a rollover\n * within the week) does not change the state to loading and, if it fails while rows for\n * the same week are shown, keeps them. Only user-initiated loads announce their result.\n */\n private async load({\n background = false,\n maxAge = Infinity,\n }: { background?: boolean; maxAge?: number } = {}) {\n const id = ++this.loadId;\n const announce = this.userInitiated;\n this.userInitiated = false;\n const slug = this.librarySlug;\n if (!slug) {\n this._state = 'ready';\n this.view = undefined;\n return;\n }\n const days = this.days;\n if (!background) {\n this._state = 'loading';\n this.announcement = '';\n }\n try {\n const libraries = await loadLibraries();\n const library = libraries.find((l) => l.slug === slug);\n if (!library) throw new Error(`no library with slug \"${slug}\"`);\n const spaces = libraries.filter((l) => l.parent === library.id);\n if (id === this.loadId && !this.view) this.pending = { days, library, spaces };\n const ids = [library, ...spaces]\n .map((l) => l.calId)\n .filter((n): n is number => n !== undefined);\n const hours = await loadHours(ids, days[0]!, days[6]!, maxAge);\n if (id !== this.loadId) return; // a newer load owns the element\n this.view = { days, library, spaces, hours };\n this.pending = undefined;\n this._state = 'ready';\n if (announce)\n this.announcement = `Showing hours for ${fullDate(days[0]!)} to ${fullDate(days[6]!)}`;\n } catch {\n if (id !== this.loadId) return;\n const sameWeek = this.view?.days[0] === days[0];\n if (background && sameWeek && this._state !== 'error') return;\n if (!sameWeek) this.view = undefined;\n this.pending = undefined;\n this._state = 'error';\n }\n }\n\n private retry() {\n this.userInitiated = true;\n const hadFocus = this.focusedInside();\n void this.load().then(() => {\n // The Retry button is gone once the hours load; keep keyboard focus in the element.\n if (hadFocus && this._state === 'ready' && !this.focusedInside())\n this.renderRoot\n .querySelector<HTMLButtonElement>('.weekly-hours-header-section button')\n ?.focus();\n });\n }\n\n private focusedInside(): boolean {\n const active =\n this.renderRoot instanceof ShadowRoot\n ? this.renderRoot.activeElement\n : document.activeElement;\n return !!active && (this.renderRoot as Node).contains(active) && active !== this;\n }\n\n private previousWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) - 1;\n }\n\n private nextWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) + 1;\n }\n\n private renderMobileDate(day: string) {\n return html`<div class=\"date--mobile\">\n <div class=\"date-header-day\">${shortWeekday(day)}</div>\n <div class=\"date-header-month\">${shortDate(day)}</div>\n </div>`;\n }\n\n private renderCells(days: string[], hours: HoursByCalendar, calId: number | undefined) {\n const dates = calId === undefined ? undefined : hours.get(calId);\n return days.map((day) => {\n const text = formatDay(dates?.[day]);\n return html`<td\n aria-label=${text ? `${longDate(day)}: ${text}` : longDate(day)}\n class=${day === this.today ? 'today' : nothing}\n >\n ${this.renderMobileDate(day)}${text}\n </td>`;\n });\n }\n\n /**\n * The first load's rows before the hours arrive: the real row headers with invisible,\n * typical hours text in each cell, so the table already has its final height in whatever\n * font the page uses and nothing below it moves when the hours replace the placeholders.\n */\n private renderPlaceholderRows({ days, library: lib, spaces }: Omit<WeekView, 'hours'>) {\n const cells = () =>\n days.map(\n (day) =>\n html`<td class=${day === this.today ? 'today' : nothing}>\n ${this.renderMobileDate(day)}<span class=\"hours-placeholder\" aria-hidden=\"true\"\n >10am - 10pm</span\n >\n </td>`,\n );\n const building =\n !this.hideBuildingHours && lib.calId !== undefined\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\">Building hours</th>\n ${cells()}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\">\n <span class=${space.siteLink ? 'lib-space-link' : 'lib-space'}>${space.title}</span>\n </th>\n ${cells()}\n </tr>`,\n )}`;\n }\n\n private renderRows(view: WeekView | undefined) {\n if (!view) {\n if (this.pending) return this.renderPlaceholderRows(this.pending);\n // Before the library list is in: the Building hours row nearly every library has, so\n // only a library's extra spaces can still move what follows the table.\n if (this._state === 'loading' && !this.hideBuildingHours)\n return this.renderPlaceholderRows({\n days: this.days,\n library: { calId: 0 } as LibraryInfo,\n spaces: [],\n });\n return nothing;\n }\n const { days, library: lib, spaces, hours } = view;\n const building =\n !this.hideBuildingHours && lib.calId !== undefined && hours.has(lib.calId)\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\" aria-label=\"Building hours\">Building hours</th>\n ${this.renderCells(days, hours, lib.calId)}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\" aria-label=${space.title}>\n ${\n space.siteLink\n ? html`<a class=\"lib-space-link\" href=${space.siteLink}>${space.title}</a>`\n : html`<span class=\"lib-space\">${space.title}</span>`\n }\n </th>\n ${this.renderCells(days, hours, space.calId)}\n </tr>`,\n )}`;\n }\n\n private renderStatus() {\n // Only the first load says so; later loads keep the previous rows (aria-busy) quietly.\n if (this._state === 'loading') return this.view ? nothing : 'Loading hours…';\n if (this._state === 'error')\n return html`Hours are unavailable right now.\n <button type=\"button\" class=\"uvalib-button uvalib-button--basic\" @click=${this.retry}>\n Retry\n </button>`;\n return this.announcement\n ? html`<span class=\"visually-hidden\">${this.announcement}</span>`\n : nothing;\n }\n\n render() {\n if (!this.librarySlug || !this.today) return nothing;\n const days = this.days;\n const level = this.level;\n const headingId = `${this.uid}-heading`;\n // The table shows the data it has (the previous week while the next one loads).\n const tableDays = this.view?.days ?? days;\n return html`<div class=\"weekly-hours-header-section\">\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.previousWeek}\n >\n Previous week\n </button>\n <div\n class=\"heading-h${this.headingClass}\"\n role=\"heading\"\n aria-level=${level}\n id=${headingId}\n >\n ${weekHeadingDate(days[0]!)} - ${weekHeadingDate(days[6]!)}\n </div>\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.nextWeek}\n >\n Next week\n </button>\n </div>\n <table\n class=\"weekly-hours-body-section\"\n aria-busy=${this._state === 'loading' ? 'true' : nothing}\n >\n <colgroup>\n <col class=\"location-column\" />\n ${tableDays.map(() => html`<col />`)}\n <col />\n </colgroup>\n <thead>\n <tr>\n <th colspan=\"2\" scope=\"col\"><span class=\"visually-hidden\">Day</span></th>\n ${tableDays.map(\n (day) =>\n html`<th\n scope=\"col\"\n aria-label=${longDate(day)}\n aria-current=${day === this.today ? 'date' : nothing}\n class=${day === this.today ? 'today' : nothing}\n >\n <div class=\"date-header\">${this.renderMobileDate(day)}</div>\n </th>`,\n )}\n </tr>\n </thead>\n <tbody>\n ${this.renderRows(this.view)}\n </tbody>\n </table>\n <div class=\"weekly-hours-status\" role=\"status\">${this.renderStatus()}</div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { L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i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","o","normalizeItems","readItemsMarkup","SiteMainNav","trackEvent","siteLink","accessible","dark","preFooterLinks","colorScheme","COLOR_SCHEME_STORAGE_KEY","COLOR_SCHEME_ATTR","CHANGE","DARK_QUERY","memory","asPreference","v","colorSchemeSupported","css","doc","readPreference","kept","systemIsDark","resolvePreference","pref","applyPreference","html","inline","clearPreference","setPreference","storage","installColorSchemeStyles","owners","ownersOf","set","FORCED_QUERY","rootColorScheme","attr","ColorSchemeController","host","enabled","renders","supported","root","next","changed","k","update","level","forced","FULL_LINKS","VENDOR_LINKS","l","menuCounter","schemeCounter","DARK_LOGO_URL","SCHEME_OPTIONS","SITE_LINKS","isSiteLinksChild","MAIN_NAV","isMainNavChild","ALERTS","isAlertsChild","LINK_ATTRS","stopEvent","SiteHeader","path","link","menu","popover","was","keep","holder","input","hint","systemDark","name","where","preference","A","sources","moved","raw","s","result","header","incoming","ref","items","invalid","el","text","content","vendor","id","anchor","mainNav","mainNavEl","label","own","classic","classicHidden","accordion","withMainNav","withMainNavHidden","registered"],"sources":["../../src/styles/color-scheme.ts","../../src/base/color-scheme.ts","../../src/components/site-header/SiteHeader.ts","../../src/components/site-header/site-header.ts"],"sourcesContent":["import { css, unsafeCSS } from 'lit';\n\n// Hand-written (not generated): the opt-in dark mode. Nothing here applies until the page's\n// root element has `data-uva-color-scheme` (set by `color-scheme-switch` or the documented\n// inline snippet), and only in browsers with light-dark(); everywhere else the role tokens are\n// undefined and every component falls back to its palette token or hex value, exactly as\n// before. The palette tokens in tokens.ts are untouched.\n//\n// Role tokens are light-dark() pairs; the light half reads the palette token, so a host's\n// own `:root { --uva-brand-*: … }` still applies in light mode. They are resolved where they\n// are used, against that element's `color-scheme`, which every component sets from\n// `--uva-color-scheme` (default `light`). Tokens with no single light value (the decorative\n// border, the alerts component's properties) are set in dark only.\n\n/** Dark values for properties that have no one light value: each reader keeps its own. */\nconst darkOnly = `\n --uva-color-border: #7a84a0;\n --uvalib-alerts-text: #e8e8e8;\n --uvalib-alerts-header-bg: #0e4a57;\n --uvalib-alerts-alert1-bg: #4a1622;\n --uvalib-alerts-alert1-border: #ef3f6b;\n --uvalib-alerts-alert2-bg: #3d3510;\n --uvalib-alerts-alert2-border: #ecc602;\n --uvalib-alerts-alert3-bg: #0d3247;\n --uvalib-alerts-alert3-border: #55c4ec;\n --uvalib-alerts-regional-bg: #0f3a3d;\n --uvalib-alerts-regional-border: 0.2em solid #25cad3;\n`;\n\nconst dark = unsafeCSS(darkOnly);\n\n/**\n * Links in the pre-footer band are the site's own content: unstyled ones would keep the\n * browser's dark link colours (#9e9eff is 3.37:1 on the band). White is 8.05:1, visited too.\n * Layered like the rest of this sheet, so a site's own link colours still win.\n */\nconst preFooterLinks = 'color: var(--uva-color-pre-footer-text, #ffffff);';\n\nexport const colorScheme = css`\n @supports (color: light-dark(#000, #fff)) {\n :root[data-uva-color-scheme] {\n --uva-color-surface: light-dark(#ffffff, #10172b);\n --uva-color-surface-raised: light-dark(#ffffff, #232d4b);\n --uva-color-surface-hover: light-dark(var(--uva-grey-100, #dadada), #2c3858);\n --uva-color-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #e8e8e8);\n --uva-color-text-muted: light-dark(#4b5563, #adadad);\n --uva-color-link: light-dark(var(--uva-brand-blue, #232d4b), #87b9d9);\n --uva-color-utility-link: light-dark(var(--uva-blue-alt-dark, #005679), #91d8f2);\n --uva-color-focus: light-dark(var(--uva-brand-orange, #e57200), #ffb370);\n --uva-color-current: light-dark(var(--uva-brand-orange, #e57200), #e57200);\n --uva-color-accent-bg: light-dark(var(--uva-brand-blue, #232d4b), #87b9d9);\n --uva-color-on-accent: light-dark(#ffffff, #10172b);\n --uva-color-control-border: light-dark(var(--uva-grey, #808080), #7a84a0);\n --uva-color-input-text: light-dark(#1f2937, #e8e8e8);\n --uva-color-track: light-dark(#e5e7eb, #2c3858);\n --uva-color-shadow: light-dark(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6));\n --uva-color-pre-footer-bg: light-dark(var(--uva-blue-alt-300, #bfe7f7), #005679);\n --uva-color-pre-footer-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #ffffff);\n }\n :root[data-uva-color-scheme='system'] {\n color-scheme: light dark;\n --uva-color-scheme: light dark;\n }\n :root[data-uva-color-scheme='light'] {\n color-scheme: light;\n --uva-color-scheme: light;\n }\n :root[data-uva-color-scheme='dark'] {\n color-scheme: dark;\n --uva-color-scheme: dark;\n ${dark}\n }\n :root[data-uva-color-scheme='dark'] [slot='pre-footer'] a {\n ${unsafeCSS(preFooterLinks)}\n }\n @media (prefers-color-scheme: dark) {\n :root[data-uva-color-scheme='system'] {\n ${dark}\n }\n :root[data-uva-color-scheme='system'] [slot='pre-footer'] a {\n ${unsafeCSS(preFooterLinks)}\n }\n }\n }\n`;\n","import type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport { colorScheme } from '../styles/color-scheme.js';\nimport { installLightDomStyles } from './light-dom-styles.js';\n\n/** The visitor's choice: follow the OS (`system`, the default) or pin `light` or `dark`. */\nexport type ColorSchemePreference = 'light' | 'dark' | 'system';\n/** What is shown: the preference, with `system` resolved from `prefers-color-scheme`. */\nexport type ResolvedColorScheme = 'light' | 'dark';\n\n/** localStorage key, per site (origin): `light` or `dark`; absent means `system`. */\nexport const COLOR_SCHEME_STORAGE_KEY = 'uvalib-color-scheme';\n/** Attribute on the root element that turns the opt-in dark-mode rules on. */\nexport const COLOR_SCHEME_ATTR = 'data-uva-color-scheme';\n/** Fired on the document whenever a control changes the preference. */\nconst CHANGE = 'uvalib-color-scheme-change';\nconst DARK_QUERY = '(prefers-color-scheme: dark)';\n\n/** Choices made while storage is unavailable, kept for the page's lifetime. */\nconst memory = new WeakMap<Document, ColorSchemePreference>();\n\nconst asPreference = (v: unknown): ColorSchemePreference =>\n v === 'light' || v === 'dark' ? v : 'system';\n\n/** Dark mode needs light-dark(); without it nothing is shown or set, and the page stays light. */\nexport function colorSchemeSupported(doc: Document = document): boolean {\n const css = doc.defaultView?.CSS;\n try {\n return !!css?.supports?.('color', 'light-dark(#000, #fff)');\n } catch {\n return false;\n }\n}\n\n/** The stored preference: this page's in-memory choice if storage failed, else localStorage. */\nexport function readPreference(doc: Document = document): ColorSchemePreference {\n const kept = memory.get(doc);\n if (kept) return kept;\n try {\n return asPreference(doc.defaultView?.localStorage.getItem(COLOR_SCHEME_STORAGE_KEY));\n } catch {\n return 'system';\n }\n}\n\n/** Whether the OS asks for dark. */\nexport function systemIsDark(doc: Document = document): boolean {\n return !!doc.defaultView?.matchMedia?.(DARK_QUERY).matches;\n}\n\nexport function resolvePreference(\n pref: ColorSchemePreference,\n doc: Document = document,\n): ResolvedColorScheme {\n return pref === 'system' ? (systemIsDark(doc) ? 'dark' : 'light') : pref;\n}\n\n/**\n * Show `pref` on the page: `data-uva-color-scheme` on the root element, and with `inline`\n * (for `no-style`, where no stylesheet maps the attribute) `color-scheme` as an inline style.\n */\nexport function applyPreference(doc: Document, pref: ColorSchemePreference, inline = false): void {\n const html = doc.documentElement;\n if (html.getAttribute(COLOR_SCHEME_ATTR) !== pref) html.setAttribute(COLOR_SCHEME_ATTR, pref);\n if (inline) html.style.colorScheme = pref === 'system' ? 'light dark' : pref;\n}\n\n/** Turn dark mode off again: remove the attribute and any inline `color-scheme`. */\nexport function clearPreference(doc: Document): void {\n const html = doc.documentElement;\n html.removeAttribute(COLOR_SCHEME_ATTR);\n html.style.removeProperty('color-scheme');\n if (!html.getAttribute('style')) html.removeAttribute('style');\n}\n\n/**\n * Remember and show `pref`. `system` removes the stored value; storage that throws keeps the\n * choice in memory for this page. Every connected control is told.\n */\nexport function setPreference(doc: Document, pref: ColorSchemePreference, inline = false): void {\n try {\n const storage = doc.defaultView!.localStorage;\n if (pref === 'system') storage.removeItem(COLOR_SCHEME_STORAGE_KEY);\n else storage.setItem(COLOR_SCHEME_STORAGE_KEY, pref);\n memory.delete(doc);\n } catch {\n memory.set(doc, pref);\n }\n applyPreference(doc, pref, inline);\n doc.dispatchEvent(new CustomEvent(CHANGE));\n}\n\n/** The opt-in rules on the document (layered, so host CSS wins), for pages without tokens.css. */\nexport function installColorSchemeStyles(doc: Document): void {\n installLightDomStyles('uvalib-color-scheme', [colorScheme], { root: doc, scope: false });\n}\n\n/** Per document, the controllers that currently own `data-uva-color-scheme`. */\nconst owners = new WeakMap<Document, Set<ColorSchemeController>>();\nconst ownersOf = (doc: Document): Set<ColorSchemeController> => {\n let set = owners.get(doc);\n if (!set) owners.set(doc, (set = new Set()));\n return set;\n};\n\nconst FORCED_QUERY = '(forced-colors: active)';\n\n/** The scheme the root element shows: from `data-uva-color-scheme`, or null when dark mode is off. */\nexport function rootColorScheme(doc: Document = document): ResolvedColorScheme | null {\n const attr = doc.documentElement.getAttribute(COLOR_SCHEME_ATTR);\n if (attr === null || !colorSchemeSupported(doc)) return null;\n return resolvePreference(asPreference(attr), doc);\n}\n\n/**\n * A component's view of dark mode. While `enabled()` and supported (`active`), it owns\n * `data-uva-color-scheme` on the root element: it sets it, keeps it current with the\n * stored preference (any control on the page, another tab through the `storage` event) and\n * removes it when the last owner in the document is turned off or disconnected. A connected\n * controller that is not enabled removes a stray attribute (for example from the inline\n * snippet on a page without the switch) unless another one owns it.\n *\n * Every connected controller also follows the root's scheme (`rootDark`) and the OS\n * preference (`systemDark`), so a header without the switch never shows the navy logo on a\n * dark page. A controller that is off on a page where dark mode is off stays inert: it reads\n * no storage and queries no media, and listens only for the controllers' own change event.\n */\nexport class ColorSchemeController implements ReactiveController {\n preference: ColorSchemePreference = 'system';\n /** What \"System\" resolves to: the OS preference. */\n systemDark = false;\n /** Whether the root element currently shows the dark scheme. */\n rootDark = false;\n /** Whether forced colors (a contrast theme) are on. */\n forcedColors = false;\n /** Whether the root element has `data-uva-color-scheme` (dark mode is on for the page). */\n rootOn = false;\n /** Enabled and supported: this controller owns the root attribute. */\n active = false;\n /** Set while sync() runs, so its own change events do not request a second update. */\n private syncing = false;\n\n private listening?: {\n doc: Document;\n level: 'change' | 'full';\n dark?: MediaQueryList;\n forced?: MediaQueryList;\n };\n\n constructor(\n private readonly host: ReactiveControllerHost & HTMLElement,\n private readonly enabled: () => boolean,\n private readonly inline: () => boolean,\n /** Whether the host renders anything from this state (and so needs updates). */\n private readonly renders = true,\n ) {\n host.addController(this);\n }\n\n hostConnected(): void {\n this.sync();\n }\n\n hostDisconnected(): void {\n this.listen('none');\n this.release(this.host.ownerDocument);\n }\n\n /** Call when `enabled()` may have changed (from the host's `willUpdate`). */\n sync(): void {\n const doc = this.host.ownerDocument;\n if (!this.host.isConnected) return;\n this.syncing = true;\n const supported = colorSchemeSupported(doc);\n this.active = this.enabled() && supported;\n if (this.active) {\n ownersOf(doc).add(this);\n if (!this.inline()) installColorSchemeStyles(doc);\n this.preference = readPreference(doc);\n applyPreference(doc, this.preference, this.inline());\n doc.dispatchEvent(new CustomEvent(CHANGE));\n } else {\n this.release(doc);\n // Not ours, and nobody owns it: a stray attribute (the snippet without the switch).\n if (!ownersOf(doc).size && doc.documentElement.hasAttribute(COLOR_SCHEME_ATTR)) {\n clearPreference(doc);\n doc.dispatchEvent(new CustomEvent(CHANGE));\n }\n }\n this.syncing = false;\n this.refresh(false);\n this.listen(supported ? this.listenLevel() : 'none');\n }\n\n /**\n * Whether to show the reversed (white) logo: only while the page shows dark mode, and under\n * forced colors (a contrast theme repaints the header) only when the OS theme is dark.\n */\n get logoDark(): boolean {\n return this.rootOn && (this.forcedColors ? this.systemDark : this.rootDark);\n }\n\n /** The visitor picked `pref` in a control. */\n choose(pref: ColorSchemePreference): void {\n setPreference(this.host.ownerDocument, pref, this.inline());\n }\n\n /** Stop owning the attribute; the last owner to go removes it. */\n private release(doc: Document): void {\n const set = ownersOf(doc);\n if (!set.delete(this)) return;\n this.active = false;\n if (!set.size) {\n clearPreference(doc);\n doc.dispatchEvent(new CustomEvent(CHANGE));\n }\n }\n\n private readonly onChange = (): void => this.refresh(!this.syncing);\n\n private readonly onStorage = (e: StorageEvent): void => {\n if (e.key !== null && e.key !== COLOR_SCHEME_STORAGE_KEY) return;\n if (this.active)\n applyPreference(\n this.host.ownerDocument,\n readPreference(this.host.ownerDocument),\n this.inline(),\n );\n this.refresh(true);\n };\n\n private refresh(update: boolean): void {\n const doc = this.host.ownerDocument;\n const root = rootColorScheme(doc);\n // A controller that is off, on a page where dark mode is off, stays inert: no storage\n // read and no media queries, only the cheap root-attribute check above.\n const engaged = this.active || root !== null;\n const next = engaged\n ? {\n preference: readPreference(doc),\n systemDark: systemIsDark(doc),\n rootDark: root === 'dark',\n rootOn: root !== null,\n forcedColors: !!doc.defaultView?.matchMedia?.(FORCED_QUERY).matches,\n }\n : {\n preference: 'system' as const,\n systemDark: false,\n rootDark: false,\n rootOn: false,\n forcedColors: false,\n };\n const changed = (Object.keys(next) as (keyof typeof next)[]).some((k) => next[k] !== this[k]);\n Object.assign(this, next);\n if (this.listening) this.listen(this.listenLevel());\n if (changed && update && this.renders) this.host.requestUpdate();\n }\n\n /**\n * What to listen to: nothing without `light-dark()` support; everything (storage, the OS\n * and forced-colors queries) while this controller owns the attribute or the page shows\n * dark mode; otherwise only the controllers' own change event, which tells an inert\n * controller that another one turned dark mode on.\n */\n private listenLevel(): 'none' | 'change' | 'full' {\n if (!colorSchemeSupported(this.host.ownerDocument)) return 'none';\n return this.active || this.rootOn ? 'full' : 'change';\n }\n\n private listen(level: 'none' | 'change' | 'full'): void {\n if (level === (this.listening?.level ?? 'none')) return;\n if (this.listening) {\n const { doc, dark, forced } = this.listening;\n doc.removeEventListener(CHANGE, this.onChange);\n doc.defaultView?.removeEventListener('storage', this.onStorage);\n dark?.removeEventListener('change', this.onChange);\n forced?.removeEventListener('change', this.onChange);\n this.listening = undefined;\n }\n if (level === 'none') return;\n const doc = this.host.ownerDocument;\n doc.addEventListener(CHANGE, this.onChange);\n if (level === 'change') {\n this.listening = { doc, level };\n return;\n }\n const dark = doc.defaultView?.matchMedia?.(DARK_QUERY);\n const forced = doc.defaultView?.matchMedia?.(FORCED_QUERY);\n doc.defaultView?.addEventListener('storage', this.onStorage);\n dark?.addEventListener('change', this.onChange);\n forced?.addEventListener('change', this.onChange);\n this.listening = { doc, level, dark, forced };\n }\n}\n","import { html, css, nothing, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { siteLink } from '../link.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { ColorSchemeController, type ColorSchemePreference } from '../../base/color-scheme.js';\nimport {\n normalizeItems,\n readItemsMarkup,\n type MainNavItem,\n} from '../site-main-nav/main-nav-items.js';\n\nconst ACCOUNT_URL = 'https://search.lib.virginia.edu/account';\n\nconst FULL_LINKS: ReadonlyArray<{ label: string; path: string }> = [\n { label: 'My account', path: ACCOUNT_URL },\n { label: 'Ask a Librarian', path: '/askalibrarian' },\n { label: 'Hours', path: '/hours' },\n { label: 'Give', path: '/support-library' },\n { label: 'Alerts', path: '/status#alerts' },\n { label: 'Search', path: '/search' },\n];\n\nconst VENDOR_LINKS = FULL_LINKS.filter((l) => l.label === 'Ask a Librarian');\n\n/** Light-DOM instances share the document id space, so each gets its own popover id. */\nlet menuCounter = 0;\n/** Radio group names are per instance and per control (two controls per header). */\nlet schemeCounter = 0;\n\n/** The reversed (white) library logo, for dark mode. Same aspect ratio as the navy one. */\nexport const DARK_LOGO_URL =\n 'https://static.lib.virginia.edu/files/downloads/LibraryLogos/UVALIB_primary_color_white_web.png';\nconst SCHEME_OPTIONS: ReadonlyArray<{ value: ColorSchemePreference; label: string }> = [\n { value: 'light', label: 'Light' },\n { value: 'dark', label: 'Dark' },\n { value: 'system', label: 'System' },\n];\n\n/** A site's own link, read from an `<a slot=\"site-links\">` child. */\ninterface SiteLinkItem {\n href: string;\n text: string;\n current?: string;\n target?: string;\n rel?: string;\n hreflang?: string;\n}\n\nconst SITE_LINKS = 'site-links';\nconst isSiteLinksChild = (n: Node): n is Element =>\n n instanceof Element && n.getAttribute('slot') === SITE_LINKS;\nconst MAIN_NAV = 'main-nav';\nconst isMainNavChild = (n: Node): n is Element =>\n n instanceof Element && n.getAttribute('slot') === MAIN_NAV;\nconst ALERTS = 'alerts';\nconst isAlertsChild = (n: Node | null): n is Element =>\n n instanceof Element && n.getAttribute('slot') === ALERTS;\n/** Attributes of a source anchor that change what the header renders. */\nconst LINK_ATTRS = ['href', 'aria-current', 'target', 'rel', 'hreflang'];\n/** Swallows the popover accordion's copy of an `items-src` error the bar also reports. */\nconst stopEvent = (e: Event) => e.stopPropagation();\n\n/**\n * UVA Library site header: logo, utility navigation, and a popover menu on narrow screens.\n *\n * A site can replace the library utility links (My account, Ask a Librarian, Hours, Give,\n * Alerts, Search) with its own: give the header `<a slot=\"site-links\" href=\"…\">` children.\n * They are shown, in order, in the inline nav and the Menu popover, with `href` as written\n * (not joined to `root-link-domain`) and their `aria-current`, `target`, `rel` and\n * `hreflang`. The source anchors themselves stay hidden. Children that are not `<a href>`\n * with text (empty or whitespace-only text counts as none) are ignored with one console\n * warning. The `vendor` variant ignores site links and keeps\n * its own reduced link set.\n *\n * The full header also shows the UVA Library main navigation (`<site-main-nav>`): a row\n * under the logo row on wide screens, and an accordion at the top of the Menu popover on\n * narrow ones (992px and below), above the utility or site links. `no-main-nav` turns it\n * off, leaving the header exactly as it was without it; the `vendor` variant never shows it.\n * A `<nav slot=\"main-nav\">` child replaces its links (see `<site-main-nav>`), and\n * `main-nav-src` loads them from JSON; `main-nav-current` sets the URL marked current.\n *\n * `color-scheme-switch` opts in to dark mode (off by default; see the README's \"Dark mode\"):\n * a Light / Dark / System radio group (\"Theme\") at the end of the utility-links row on wide\n * screens and at the bottom of the Menu popover on narrow ones. The `vendor` variant, which\n * has no Menu, shows it after its inline link, on a row of its own under the logo row on\n * narrow screens. In dark mode the logo is the reversed (white) one.\n *\n * @tagname site-header\n * @slot skip-link - Shadow mode only: optional skip link, rendered first inside `<header>` (`<site-page>` uses it).\n * @slot alerts - Optional alert banner (`<site-page>` passes its `<uvalib-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.\n * @slot 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.\n * @slot 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.\n * @csspart header - The `<header>` element.\n * @fires 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.\n * @fires 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.\n * @cssprop [--uva-blue-alt-dark=#005679] - Utility link colour.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Menu button colour.\n * @cssprop [--uva-brand-orange=#e57200] - Focus ring colour (focus-visible outline), and the underline colour of an `aria-current` link (also bold, with a 3px underline).\n * @cssprop [--uva-brand-blue=#232d4b] - Skip-link background for a skip link slotted into `skip-link` (shadow mode, shared accessibility sheet).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: header, Menu popover and theme control background (else #ffffff).\n * @cssprop --uva-color-utility-link - Dark-mode role token: utility and site link colour (else `--uva-blue-alt-dark`).\n * @cssprop --uva-color-text - Dark-mode role token: Menu button and theme control text (else `--uva-grey-darkest`).\n * @cssprop --uva-color-border - Dark-mode role token: popover border and rules (else #ccc).\n * @cssprop --uva-color-control-border - Dark-mode role token: theme control border (else `--uva-grey`, #808080).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: selected theme option and skip-link background (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Dark-mode role token: selected theme option and skip-link text (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n * @cssprop --uva-color-current - Dark-mode role token: current-page underline (else `--uva-brand-orange`).\n */\nexport class SiteHeader extends UvalibElement {\n static styles = [\n accessible,\n css`\n :host {\n display: block;\n width: 100%;\n }\n /* Logo on the start, everything else on the end, as one row. A grid (not a wrapping\n flex row) so an alerts row can span the top without changing where the logo row\n breaks: flex wrapping decides lines on max-content sizes before anything shrinks. */\n header {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr);\n align-items: start;\n position: relative;\n background-color: var(--uva-color-surface-raised, #ffffff);\n --_pad-block: 0.5rem;\n --_pad-inline: 16px; /* old: .w3-container 16px side padding */\n padding: var(--_pad-block) var(--_pad-inline);\n }\n header > :not(.logo) {\n grid-column: 2;\n justify-self: end;\n }\n /* The alerts (slot=\"alerts\") are a full-bleed row above the logo row, as in Virgo:\n negative margins equal to the header's padding put them flush with the top and both\n edges, and the bottom margin gives the logo row back its top padding. With no\n alerts content they take no space, so the logo row is exactly where it was. */\n ::slotted([slot='alerts']),\n header > [slot='alerts'] {\n grid-column: 1 / -1;\n justify-self: stretch;\n min-inline-size: 0;\n margin: calc(-1 * var(--_pad-block)) calc(-1 * var(--_pad-inline)) var(--_pad-block);\n }\n .logo {\n display: block;\n text-decoration: none;\n }\n .logo img {\n display: block;\n max-width: 225px;\n height: auto;\n }\n nav ul {\n list-style-type: none;\n margin: 0;\n padding: 0;\n }\n /* Old nav hung from the top of the header below the default 1em list margin. */\n nav.inline ul {\n margin: 1em 0;\n display: flex;\n gap: 1.5rem;\n }\n a {\n color: var(--uva-color-utility-link, var(--uva-blue-alt-dark, #005679));\n }\n /* Current page: bold with a thick underline, so it does not rely on colour alone. */\n nav a[aria-current]:not([aria-current='false']) {\n font-weight: 700;\n text-decoration-line: underline;\n text-decoration-thickness: 3px;\n text-decoration-color: var(--uva-color-current, var(--uva-brand-orange, #e57200));\n text-underline-offset: 0.3em;\n }\n .menu-toggle {\n display: none;\n align-items: center;\n gap: 0.25rem;\n background: none;\n border: none;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n font: inherit;\n cursor: pointer;\n }\n /* Old shared sheet sized every inline svg at 17px. */\n .menu-toggle svg {\n width: 17px;\n height: 17px;\n }\n [popover] {\n position: fixed;\n inset: auto;\n /* Fallback offset (about the header height) for engines without anchor(). */\n top: 4.75rem;\n inset-inline-end: 1rem;\n inline-size: min(80dvw, 24rem);\n max-inline-size: calc(100dvw - 2rem);\n block-size: fit-content;\n max-block-size: calc(100dvh - 6rem);\n overflow: auto;\n box-sizing: border-box;\n margin: 0.5rem 0 0;\n padding: 0.5rem 1rem;\n border: 1px solid var(--uva-color-border, #ccc);\n background: var(--uva-color-surface-raised, #ffffff);\n }\n nav.menu li {\n padding: 0.375rem 0;\n }\n /* The main navigation: a full-bleed row under the logo row, flush with the header's\n bottom (its 5px rule is the header's bottom edge), 0.5rem below the logo row. */\n header > site-main-nav.bar {\n grid-column: 1 / -1;\n justify-self: stretch;\n min-inline-size: 0;\n margin: var(--_pad-block) calc(-1 * var(--_pad-inline)) calc(-1 * var(--_pad-block));\n }\n /* Narrow screens: the main navigation leads the Menu popover, then a rule, then the\n utility or site links. */\n .menu-popover > site-main-nav + nav.menu > ul,\n .menu-popover > .color-scheme {\n margin-block-start: 0.5rem;\n padding-block-start: 0.5rem;\n border-block-start: 1px solid var(--uva-color-border, #ccc);\n }\n nav.menu {\n display: contents;\n }\n @supports (top: anchor(--x bottom)) {\n [popover] {\n top: anchor(var(--menu-anchor) bottom);\n }\n }\n /* One line: the links wrap within their own space, the control stays at the end. */\n .utility-row {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n column-gap: 1.5rem;\n min-inline-size: 0;\n }\n .utility-row > nav.inline {\n min-inline-size: 0;\n }\n .utility-row > nav.inline ul {\n flex-wrap: wrap;\n justify-content: flex-end;\n row-gap: 0.25rem;\n }\n .utility-row > .color-scheme {\n flex: none;\n }\n .color-scheme {\n min-inline-size: 0;\n margin: 0;\n padding: 0;\n border: 0;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n }\n .color-scheme legend {\n padding: 0;\n font-weight: 700;\n }\n .segments {\n display: flex;\n border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #ffffff);\n }\n .segments label {\n position: relative;\n display: flex;\n flex: 1;\n min-inline-size: 28px;\n font-size: 0.875rem;\n cursor: pointer;\n }\n .segments label + label {\n border-inline-start: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));\n }\n .segment {\n display: flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n min-block-size: 28px;\n padding: 0.125rem 0.625rem;\n }\n .segments input {\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n opacity: 0;\n cursor: pointer;\n }\n .segments input:checked + .segment {\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n color: var(--uva-color-on-accent, #ffffff);\n font-weight: 700;\n }\n .segments input:focus-visible + .segment {\n position: relative;\n z-index: 1;\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n /* Floated, so it is not drawn into the fieldset's top border (the popover rule). */\n .menu-popover > .color-scheme legend {\n float: inline-start;\n inline-size: 100%;\n margin-block-end: 0.375rem;\n }\n .menu-popover > .color-scheme .segments {\n clear: both;\n }\n @media (forced-colors: active) {\n .segments input:checked + .segment {\n forced-color-adjust: none;\n background: Highlight;\n color: HighlightText;\n }\n }\n @media screen and (max-width: 992px) {\n header:not(.vendor) nav.inline,\n header:not(.vendor) .utility-row,\n header > site-main-nav.bar {\n display: none;\n }\n header.vendor .utility-row {\n display: contents;\n }\n header.vendor .utility-row > nav.inline {\n grid-column: 2;\n justify-self: end;\n }\n header.vendor .utility-row > .color-scheme {\n grid-column: 1 / -1;\n justify-self: end;\n margin-block-end: 0.5rem;\n }\n .menu-toggle {\n display: inline-flex;\n }\n }\n @media screen and (min-width: 993px) {\n .menu-toggle,\n [popover] {\n display: none;\n }\n }\n `,\n ];\n\n @property({ type: String, attribute: 'root-link-domain' }) rootLinkDomain =\n 'https://www.library.virginia.edu';\n @property({ type: String, reflect: true }) variant: 'full' | 'vendor' = 'full';\n /** Accessible name of the nav when site links replace the utility links (default \"Site\"; the popover nav's name adds \" menu\"). */\n @property({ type: String, attribute: 'site-links-label' }) siteLinksLabel?: string;\n\n /** Hide the UVA Library main navigation (the row under the logo and the popover accordion). */\n @property({ type: Boolean, attribute: 'no-main-nav' }) noMainNav = false;\n /** Accessible name of the main navigation (default \"Main\"). */\n @property({ type: String, attribute: 'main-nav-label' }) mainNavLabel?: string;\n /** URL of JSON main navigation items (`MainNavItem[]`, needs CORS), passed to `<site-main-nav items-src>`. */\n @property({ type: String, attribute: 'main-nav-src' }) mainNavSrc?: string;\n /**\n * The URL whose main-navigation link is marked current, passed to `<site-main-nav current>`.\n * Default: the page location, followed through same-document navigations.\n */\n @property({ type: String, attribute: 'main-nav-current' }) mainNavCurrent?: string;\n\n /**\n * Opt in to dark mode: the page follows the OS light or dark preference (\"System\"), and a\n * Light / Dark / System control (at the end of the utility-links row on wide screens, at\n * the bottom of the Menu popover on narrow ones) lets the visitor override it, remembered\n * per site in localStorage (`uvalib-color-scheme`). Sets `data-uva-color-scheme` on the root\n * element, and swaps in the reversed logo while dark. Ignored (the page stays light and no\n * control is shown) in browsers without CSS `light-dark()`.\n */\n @property({ type: Boolean, attribute: 'color-scheme-switch' }) colorSchemeSwitch = false;\n\n private readonly scheme = new ColorSchemeController(\n this,\n () => this.colorSchemeSwitch,\n () => this.noStyle,\n );\n private readonly schemeName = `uva-color-scheme-${++schemeCounter}`;\n\n /** Main navigation items from `slot=\"main-nav\"` markup, or null for the default. */\n @state() private mainNavItems: MainNavItem[] | null = null;\n private warnedMainNav = false;\n /** Light mode: hidden container this element owns for the `slot=\"main-nav\"` children. */\n private mainNavHolder?: HTMLDivElement;\n\n /** The site's own links, or null to show the library utility links. */\n @state() private siteLinks: SiteLinkItem[] | null = null;\n private warnedInvalid = false;\n private observer?: MutationObserver;\n /** Light mode: hidden container this element owns for the `slot=\"site-links\"` children. */\n private holder?: HTMLDivElement;\n\n constructor() {\n super();\n this.addEventListener('click', this.onMenuLinkClick);\n }\n\n /**\n * A plain click on a link in the Menu popover closes it, so a single-page app that handles\n * the navigation in place does not leave the menu open. Modified clicks (a new tab or\n * window) keep it open.\n */\n private onMenuLinkClick = (e: MouseEvent): void => {\n if (e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;\n const path = e.composedPath();\n const link = path.findIndex((n) => n instanceof Element && n.localName === 'a');\n const menu = path.findIndex((n) => n instanceof HTMLElement && n.id === this.menuId);\n if (link < 0 || menu < link) return;\n const popover = path[menu] as HTMLElement;\n if (popover.matches(':popover-open')) popover.hidePopover();\n };\n\n override connectedCallback(): void {\n super.connectedCallback();\n // Reconnect after a disconnect; the first connect reads the links in firstUpdated().\n if (this.hasUpdated) this.syncChildren();\n // The main-nav markup is read before the first render too, so it costs no second update.\n else this.syncMainNav();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!changed.has('colorSchemeSwitch')) return;\n const was = this.scheme.active;\n this.scheme.sync();\n // Light mode: turning dark mode on or off swaps the header template, and Lit clears\n // everything after its start marker: the alerts moved into the old <header> and the\n // hidden source holders. Move them before the marker; updated() re-adopts the alerts.\n if (this.lightDom && this.hasUpdated && was !== this.scheme.active) {\n const header = this.querySelector(':scope > header');\n const keep = [...(header?.children ?? [])].filter(isAlertsChild);\n for (const holder of [this.holder, this.mainNavHolder]) if (holder) keep.push(holder);\n this.prepend(...keep);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has('colorSchemeSwitch') && this.hasUpdated) this.adoptAlerts();\n }\n\n protected override firstUpdated(): void {\n this.syncChildren();\n }\n\n /** The navy logo, or the reversed (white) one while the page shows dark mode. */\n private logoSrc(): string {\n return this.scheme.logoDark\n ? DARK_LOGO_URL\n : siteLink(this.rootLinkDomain, '/sites/default/files/2022-09/library_rgb.png');\n }\n\n private onSchemeChange(e: Event): void {\n const input = e.target as HTMLInputElement;\n if (!input.checked) return;\n this.scheme.choose(input.value as ColorSchemePreference);\n trackEvent(this, ['site-header', 'color-scheme', input.value]);\n }\n\n /**\n * The Light / Dark / System radio group. `inline` sits in the utility-links row, with its\n * legend visually hidden; `menu` closes the Menu popover, legend shown. \"System\" names\n * what it resolves to (the OS preference, whichever option is chosen), for screen readers.\n * Each option's look is on the span after its radio (no `:has()`, which Firefox 120 lacks).\n */\n private schemeControl(where: 'inline' | 'menu') {\n const { preference, systemDark } = this.scheme;\n const hint = ` (currently ${systemDark ? 'dark' : 'light'})`;\n const name = `${this.schemeName}-${where}`;\n return html`<fieldset class=\"color-scheme ${where}\">\n <legend class=${where === 'inline' ? 'visually-hidden' : ''}>Theme</legend>\n <div class=\"segments\">\n ${SCHEME_OPTIONS.map(\n (o) =>\n html`<label\n ><input\n type=\"radio\"\n name=${name}\n value=${o.value}\n .checked=${preference === o.value}\n @change=${this.onSchemeChange}\n /><span class=\"segment\"\n >${o.label}${\n o.value === 'system'\n ? html`<span class=\"visually-hidden\">${hint}</span>`\n : nothing\n }</span\n ></label\n >`,\n )}\n </div>\n </fieldset>`;\n }\n\n /** Light mode: place slotted alerts in `<header>`, then read the site links and main nav. */\n private syncChildren(): void {\n this.adoptAlerts();\n this.syncSources();\n }\n\n /** Read the site links and the main-nav markup, and watch both. */\n private syncSources(): void {\n const sources = [...this.syncSiteLinks(), ...this.syncMainNav()];\n this.watch(sources);\n }\n\n /**\n * Shadow mode: the `slot=\"main-nav\"` children, with a forwarded `<slot>` (from\n * `<site-page>`) replaced by what is assigned to it. Needs no rendered slot.\n */\n private get slottedMainNav(): Element[] {\n return [...this.children]\n .filter(isMainNavChild)\n .flatMap((k) => (k instanceof HTMLSlotElement ? k.assignedElements({ flatten: true }) : [k]));\n }\n\n /** Light mode: move `slot=\"main-nav\"` children into their own hidden holder. */\n private adoptMainNav(): Element[] {\n const moved = [...this.children].filter(isMainNavChild);\n if (moved.length && !this.mainNavHolder) {\n this.mainNavHolder = document.createElement('div');\n this.mainNavHolder.hidden = true;\n this.mainNavHolder.className = 'main-nav-source';\n }\n if (this.mainNavHolder) {\n this.mainNavHolder.append(...moved);\n if (this.mainNavHolder.parentNode !== this) this.append(this.mainNavHolder);\n }\n return this.mainNavHolder ? [...this.mainNavHolder.children] : [];\n }\n\n /** Read the `slot=\"main-nav\"` markup once, for both main-nav instances. */\n private syncMainNav(): Element[] {\n const sources = this.lightDom ? this.adoptMainNav() : this.slottedMainNav;\n if (!sources.length) {\n if (this.mainNavItems) this.mainNavItems = null;\n return sources;\n }\n const raw = sources.flatMap((s, i) => (i === 0 ? readItemsMarkup(s) : [{}]));\n const result = normalizeItems(raw);\n if ((result.invalid || result.flattened) && !this.warnedMainNav) {\n this.warnedMainNav = true;\n console.warn(\n `${this.localName}: ignoring invalid slot=\"${MAIN_NAV}\" entries (each needs a label, and an href or links; deeper levels are shown in their group).`,\n );\n }\n const next = result.items.length ? result.items : null;\n // Only a real change re-renders the header and both navs.\n if (JSON.stringify(next) !== JSON.stringify(this.mainNavItems)) this.mainNavItems = next;\n return sources;\n }\n\n /**\n * Light mode has no slots: move `slot=\"alerts\"` children to the start of `<header>`, after\n * any alerts already there. That is before every Lit part in the header, so re-renders\n * never touch them.\n */\n private adoptAlerts(): void {\n if (!this.lightDom) return;\n const header = this.querySelector(':scope > header');\n const incoming = [...this.children].filter(isAlertsChild);\n if (!header || !incoming.length) return;\n let ref = header.firstChild;\n while (isAlertsChild(ref)) ref = ref.nextSibling;\n for (const n of incoming) header.insertBefore(n, ref);\n }\n\n /** Shadow mode: the elements assigned to the site-links slot, through forwarded slots. */\n private get slotted(): Element[] {\n const slot = this.renderRoot.querySelector<HTMLSlotElement>(`slot[name=\"${SITE_LINKS}\"]`);\n return slot?.assignedElements({ flatten: true }) ?? [];\n }\n\n /** Light mode has no slots: move `slot=\"site-links\"` children into the hidden holder. */\n private adoptSiteLinks(): Element[] {\n const moved = [...this.children].filter(isSiteLinksChild);\n if (moved.length && !this.holder) {\n this.holder = document.createElement('div');\n this.holder.hidden = true;\n this.holder.className = 'site-links-source';\n }\n if (this.holder) {\n this.holder.append(...moved);\n if (this.holder.parentNode !== this) this.append(this.holder);\n }\n return this.holder ? [...this.holder.children] : [];\n }\n\n /** Read the source links and render them; returns the sources to watch. */\n private syncSiteLinks(): Element[] {\n const sources = this.lightDom ? this.adoptSiteLinks() : this.slotted;\n const items: SiteLinkItem[] = [];\n let invalid = false;\n for (const el of sources) {\n const text = (el.textContent ?? '').replace(/\\s+/g, ' ').trim();\n // A link with no text would have no accessible name.\n if (!(el instanceof HTMLAnchorElement) || !el.hasAttribute('href') || !text) {\n invalid = true;\n continue;\n }\n const attr = (name: string) => el.getAttribute(name) ?? undefined;\n items.push({\n href: el.getAttribute('href')!,\n text,\n current: attr('aria-current'),\n target: attr('target'),\n rel: attr('rel'),\n hreflang: attr('hreflang'),\n });\n }\n if (invalid && !this.warnedInvalid) {\n this.warnedInvalid = true;\n console.warn(\n `${this.localName}: ignoring slot=\"${SITE_LINKS}\" children that are not <a href> elements with text.`,\n );\n }\n this.siteLinks = items.length ? items : null;\n return sources;\n }\n\n /**\n * Shadow mode: slotchange reports added and removed links, and the observer watches the\n * assigned anchors' attributes and text. Light mode: the observer also watches the host\n * for new children and the holder for removals.\n */\n private watch(sources: Element[]): void {\n this.observer ??= new MutationObserver(() => this.syncChildren());\n this.observer.disconnect();\n const content = {\n attributes: true,\n attributeFilter: LINK_ATTRS,\n characterData: true,\n childList: true,\n subtree: true,\n };\n if (this.lightDom) {\n this.observer.observe(this, { childList: true });\n if (this.holder) this.observer.observe(this.holder, content);\n if (this.mainNavHolder)\n this.observer.observe(this.mainNavHolder, { ...content, attributeFilter: ['href'] });\n } else {\n for (const el of sources) this.observer.observe(el, content);\n }\n }\n\n private onSourcesChange(): void {\n this.syncSources();\n }\n\n private _menuId?: string;\n private get menuId(): string {\n this._menuId ??= this.lightDom ? `utility-menu-${++menuCounter}` : 'utility-menu';\n return this._menuId;\n }\n\n /**\n * The header with dark mode on: the inline nav and the control share the utility row, the\n * Menu popover ends with the control, and the logo follows the scheme. A template of its\n * own, so the header without the switch renders exactly what it did before dark mode.\n */\n private renderWithScheme(\n items: unknown,\n label: string,\n mainNav: boolean,\n mainNavEl: (accordion: boolean) => unknown,\n ) {\n const root = this.rootLinkDomain;\n const vendor = this.variant === 'vendor';\n const id = this.menuId;\n const anchor = `--${id}`;\n const menu = html`<button\n popovertarget=${id}\n aria-controls=${id}\n class=\"menu-toggle\"\n style=\"anchor-name: ${anchor}\"\n >\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"28\"\n height=\"28\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"butt\"\n stroke-linejoin=\"bevel\"\n >\n <line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"></line>\n <line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"></line>\n <line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"></line>\n </svg>\n Menu\n </button>\n <div id=${id} popover class=\"menu-popover\" style=\"--menu-anchor: ${anchor}\">\n ${mainNav ? mainNavEl(true) : nothing}\n <nav class=\"menu\" aria-label=${`${label} menu`}>\n <ul>\n ${items}\n </ul>\n </nav>\n ${this.schemeControl('menu')}\n </div>\n ${mainNav ? mainNavEl(false) : nothing}`;\n return html`\n <header part=\"header\" class=${vendor ? 'vendor' : ''}>\n ${this.lightDom ? nothing : html`<slot name=\"skip-link\"></slot><slot name=\"alerts\"></slot>`}\n <a class=\"logo\" href=${siteLink(root, '/')}\n ><img src=${this.logoSrc()} alt=\"UVA Library home\" width=\"304\" height=\"69\"\n /></a>\n <div class=\"utility-row\">\n <nav class=\"inline\" aria-label=${label}>\n <ul>\n ${items}\n </ul>\n </nav>\n ${this.schemeControl('inline')}\n </div>\n ${vendor ? nothing : menu}\n </header>\n ${\n this.lightDom\n ? nothing\n : html`<div hidden>\n <slot name=\"site-links\" @slotchange=${this.onSourcesChange}></slot>\n </div>\n <div hidden>\n <slot name=\"main-nav\" @slotchange=${this.onSourcesChange}></slot>\n </div>`\n }\n `;\n }\n\n render() {\n const root = this.rootLinkDomain;\n const vendor = this.variant === 'vendor';\n const own = vendor ? null : this.siteLinks;\n const items = own\n ? own.map(\n (l) =>\n html`<li>\n <a\n href=${l.href}\n aria-current=${ifDefined(l.current)}\n target=${ifDefined(l.target)}\n rel=${ifDefined(l.rel)}\n hreflang=${ifDefined(l.hreflang)}\n >${l.text}</a\n >\n </li>`,\n )\n : (vendor ? VENDOR_LINKS : FULL_LINKS).map(\n (l) => html`<li><a href=${siteLink(root, l.path)}>${l.label}</a></li>`,\n );\n const label = own ? this.siteLinksLabel || 'Site' : 'Utility';\n const id = this.menuId;\n const anchor = `--${id}`;\n const mainNav = !vendor && !this.noMainNav;\n // Without the main navigation the header renders exactly what it did before it existed,\n // whitespace included: these two templates are kept verbatim (prettier-ignore).\n // prettier-ignore\n const classic = html`<button\n popovertarget=${id}\n aria-controls=${id}\n class=\"menu-toggle\"\n style=\"anchor-name: ${anchor}\"\n >\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"28\"\n height=\"28\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"butt\"\n stroke-linejoin=\"bevel\"\n >\n <line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"></line>\n <line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"></line>\n <line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"></line>\n </svg>\n Menu\n </button>\n <nav class=\"menu\" aria-label=${`${label} menu`}>\n <ul id=${id} popover style=\"--menu-anchor: ${anchor}\">\n ${items}\n </ul>\n </nav>`;\n // prettier-ignore\n const classicHidden = html`<div hidden>\n <slot name=\"site-links\" @slotchange=${this.onSourcesChange}></slot>\n </div>`;\n const mainNavEl = (accordion: boolean) =>\n html`<site-main-nav\n class=${accordion ? 'accordion' : 'bar'}\n layout=${ifDefined(accordion ? 'accordion' : undefined)}\n ?no-shadow-dom=${this.lightDom}\n ?no-style=${this.noStyle}\n label=${this.mainNavLabel || 'Main'}\n root-link-domain=${root}\n items-src=${ifDefined(this.mainNavSrc || undefined)}\n current=${ifDefined(this.mainNavCurrent || undefined)}\n .items=${this.mainNavItems ?? undefined}\n @site-main-nav-error=${accordion ? stopEvent : nothing}\n ></site-main-nav>`;\n // With it: the Menu popover holds the accordion and then the utility links, and the bar\n // is the header's last child, a row of its own.\n const withMainNav = html`<button\n popovertarget=${id}\n aria-controls=${id}\n class=\"menu-toggle\"\n style=\"anchor-name: ${anchor}\"\n >\n <svg\n aria-hidden=\"true\"\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"28\"\n height=\"28\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"butt\"\n stroke-linejoin=\"bevel\"\n >\n <line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"></line>\n <line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"></line>\n <line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"></line>\n </svg>\n Menu\n </button>\n <div id=${id} popover class=\"menu-popover\" style=\"--menu-anchor: ${anchor}\">\n ${mainNavEl(true)}\n <nav class=\"menu\" aria-label=${`${label} menu`}>\n <ul>\n ${items}\n </ul>\n </nav>\n </div>\n ${mainNavEl(false)}`;\n const withMainNavHidden = html`<div hidden>\n <slot name=\"site-links\" @slotchange=${this.onSourcesChange}></slot>\n </div>\n <div hidden>\n <slot name=\"main-nav\" @slotchange=${this.onSourcesChange}></slot>\n </div>`;\n if (this.scheme.active) return this.renderWithScheme(items, label, mainNav, mainNavEl);\n return html`\n <header part=\"header\" class=${vendor ? 'vendor' : ''}>\n ${this.lightDom ? nothing : html`<slot name=\"skip-link\"></slot><slot name=\"alerts\"></slot>`}\n <a class=\"logo\" href=${siteLink(root, '/')}\n ><img src=${this.logoSrc()} alt=\"UVA Library home\" width=\"304\" height=\"69\"\n /></a>\n <nav class=\"inline\" aria-label=${label}>\n <ul>\n ${items}\n </ul>\n </nav>\n ${vendor ? nothing : mainNav ? withMainNav : classic}\n </header>\n ${this.lightDom ? nothing : mainNav ? withMainNavHidden : classicHidden}\n `;\n }\n}\n","import { define } from '../../base/define.js';\nimport { SiteHeader } from './SiteHeader.js';\nimport { SiteMainNav } from '../site-main-nav/SiteMainNav.js';\nimport '../site-main-nav/site-main-nav.js';\n\ndefine('site-header', SiteHeader);\n\n// Another build (a second copy of the package, or the CDN and npm on one page) registered\n// <site-main-nav> first: the header then renders that version, which may not match it.\nconst registered = customElements.get('site-main-nav');\nif (registered && registered !== SiteMainNav) {\n console.warn(\n 'site-header: <site-main-nav> is already defined by another copy of @uvalib/web-components; the header uses that one. Load the components from one source only.',\n );\n}\n"],"mappings":";;;;;;AA6BA,IAAMsB,IAAOtB,EAAU,qcAAQ,GAOzBuB,IAAiB,qDAEVC,IAAc,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgCtBF,EAAK;;;QAGLtB,EAAUuB,CAAc,EAAE;;;;UAIxBD,EAAK;;;UAGLtB,EAAUuB,CAAc,EAAE;;;;GCtEvBE,IAA2B,uBAE3BC,IAAoB,yBAE3BC,IAAS,8BACTC,IAAa,gCAGbC,oBAAS,IAAI,QAAyC,GAEtDC,KAAgB,MACpBC,MAAM,WAAWA,MAAM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