@uvalib/web-components 0.0.0-stage → 1.0.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 +162 -0
- package/README.md +1164 -2
- package/bin/install-skill.mjs +139 -0
- package/dist/base/UvalibElement.d.ts +21 -0
- package/dist/base/UvalibElement.js +68 -0
- package/dist/base/UvalibElement.js.map +1 -0
- package/dist/base/analytics.d.ts +44 -0
- package/dist/base/analytics.js +59 -0
- package/dist/base/analytics.js.map +1 -0
- package/dist/base/color-scheme.d.ts +93 -0
- package/dist/base/color-scheme.js +267 -0
- package/dist/base/color-scheme.js.map +1 -0
- package/dist/base/define.d.ts +2 -0
- package/dist/base/define.js +6 -0
- package/dist/base/define.js.map +1 -0
- package/dist/base/heading-level.d.ts +12 -0
- package/dist/base/heading-level.js +52 -0
- package/dist/base/heading-level.js.map +1 -0
- package/dist/base/light-dom-styles.d.ts +18 -0
- package/dist/base/light-dom-styles.js +134 -0
- package/dist/base/light-dom-styles.js.map +1 -0
- package/dist/base.css +30 -0
- package/dist/base.d.ts +5 -0
- package/dist/base.js +5 -0
- package/dist/base.js.map +1 -0
- package/dist/components/bento-box/ArticlesSection.d.ts +19 -0
- package/dist/components/bento-box/ArticlesSection.js +22 -0
- package/dist/components/bento-box/ArticlesSection.js.map +1 -0
- package/dist/components/bento-box/BentoBox.d.ts +85 -0
- package/dist/components/bento-box/BentoBox.js +366 -0
- package/dist/components/bento-box/BentoBox.js.map +1 -0
- package/dist/components/bento-box/BentoSection.d.ts +115 -0
- package/dist/components/bento-box/BentoSection.js +468 -0
- package/dist/components/bento-box/BentoSection.js.map +1 -0
- package/dist/components/bento-box/CatalogSection.d.ts +18 -0
- package/dist/components/bento-box/CatalogSection.js +19 -0
- package/dist/components/bento-box/CatalogSection.js.map +1 -0
- package/dist/components/bento-box/LibGuidesSection.d.ts +24 -0
- package/dist/components/bento-box/LibGuidesSection.js +73 -0
- package/dist/components/bento-box/LibGuidesSection.js.map +1 -0
- package/dist/components/bento-box/VirgoSection.d.ts +19 -0
- package/dist/components/bento-box/VirgoSection.js +58 -0
- package/dist/components/bento-box/VirgoSection.js.map +1 -0
- package/dist/components/bento-box/WebsiteSection.d.ts +25 -0
- package/dist/components/bento-box/WebsiteSection.js +40 -0
- package/dist/components/bento-box/WebsiteSection.js.map +1 -0
- package/dist/components/bento-box/bento-box.d.ts +1 -0
- package/dist/components/bento-box/bento-box.js +13 -0
- package/dist/components/bento-box/bento-box.js.map +1 -0
- package/dist/components/bento-box/bento-data.d.ts +147 -0
- package/dist/components/bento-box/bento-data.js +422 -0
- package/dist/components/bento-box/bento-data.js.map +1 -0
- package/dist/components/events-section/EventsSection.d.ts +91 -0
- package/dist/components/events-section/EventsSection.js +435 -0
- package/dist/components/events-section/EventsSection.js.map +1 -0
- package/dist/components/events-section/events-data.d.ts +90 -0
- package/dist/components/events-section/events-data.js +174 -0
- package/dist/components/events-section/events-data.js.map +1 -0
- package/dist/components/events-section/events-section.d.ts +1 -0
- package/dist/components/events-section/events-section.js +4 -0
- package/dist/components/events-section/events-section.js.map +1 -0
- package/dist/components/library-hours/hours-data.d.ts +104 -0
- package/dist/components/library-hours/hours-data.js +267 -0
- package/dist/components/library-hours/hours-data.js.map +1 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.d.ts +21 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.js +59 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.js.map +1 -0
- package/dist/components/library-hours-setup/library-hours-setup.d.ts +1 -0
- package/dist/components/library-hours-setup/library-hours-setup.js +5 -0
- package/dist/components/library-hours-setup/library-hours-setup.js.map +1 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.d.ts +107 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +502 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.d.ts +1 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.js +4 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.js.map +1 -0
- package/dist/components/link.d.ts +2 -0
- package/dist/components/link.js +7 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/site-analytics/SiteAnalytics.d.ts +44 -0
- package/dist/components/site-analytics/SiteAnalytics.js +161 -0
- package/dist/components/site-analytics/SiteAnalytics.js.map +1 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.d.ts +8 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.js +22 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.js.map +1 -0
- package/dist/components/site-analytics/site-analytics.d.ts +1 -0
- package/dist/components/site-analytics/site-analytics.js +4 -0
- package/dist/components/site-analytics/site-analytics.js.map +1 -0
- package/dist/components/site-footer/SiteFooter.d.ts +34 -0
- package/dist/components/site-footer/SiteFooter.js +275 -0
- package/dist/components/site-footer/SiteFooter.js.map +1 -0
- package/dist/components/site-footer/icons.d.ts +4 -0
- package/dist/components/site-footer/icons.js +7 -0
- package/dist/components/site-footer/icons.js.map +1 -0
- package/dist/components/site-footer/site-footer.d.ts +1 -0
- package/dist/components/site-footer/site-footer.js +4 -0
- package/dist/components/site-footer/site-footer.js.map +1 -0
- package/dist/components/site-header/SiteHeader.d.ts +154 -0
- package/dist/components/site-header/SiteHeader.js +845 -0
- package/dist/components/site-header/SiteHeader.js.map +1 -0
- package/dist/components/site-header/site-header.d.ts +1 -0
- package/dist/components/site-header/site-header.js +12 -0
- package/dist/components/site-header/site-header.js.map +1 -0
- package/dist/components/site-hours-section/SiteHoursSection.d.ts +63 -0
- package/dist/components/site-hours-section/SiteHoursSection.js +243 -0
- package/dist/components/site-hours-section/SiteHoursSection.js.map +1 -0
- package/dist/components/site-hours-section/site-hours-section.d.ts +1 -0
- package/dist/components/site-hours-section/site-hours-section.js +4 -0
- package/dist/components/site-hours-section/site-hours-section.js.map +1 -0
- package/dist/components/site-main-nav/SiteMainNav.d.ts +136 -0
- package/dist/components/site-main-nav/SiteMainNav.js +678 -0
- package/dist/components/site-main-nav/SiteMainNav.js.map +1 -0
- package/dist/components/site-main-nav/main-nav-data.d.ts +5 -0
- package/dist/components/site-main-nav/main-nav-data.js +90 -0
- package/dist/components/site-main-nav/main-nav-data.js.map +1 -0
- package/dist/components/site-main-nav/main-nav-items.d.ts +49 -0
- package/dist/components/site-main-nav/main-nav-items.js +138 -0
- package/dist/components/site-main-nav/main-nav-items.js.map +1 -0
- package/dist/components/site-main-nav/site-main-nav.d.ts +1 -0
- package/dist/components/site-main-nav/site-main-nav.js +4 -0
- package/dist/components/site-main-nav/site-main-nav.js.map +1 -0
- package/dist/components/site-page/SitePage.d.ts +145 -0
- package/dist/components/site-page/SitePage.js +480 -0
- package/dist/components/site-page/SitePage.js.map +1 -0
- package/dist/components/site-page/alerts.d.ts +24 -0
- package/dist/components/site-page/alerts.js +78 -0
- package/dist/components/site-page/alerts.js.map +1 -0
- package/dist/components/site-page/site-page.d.ts +1 -0
- package/dist/components/site-page/site-page.js +7 -0
- package/dist/components/site-page/site-page.js.map +1 -0
- package/dist/components/site-style/SiteStyle.d.ts +37 -0
- package/dist/components/site-style/SiteStyle.js +76 -0
- package/dist/components/site-style/SiteStyle.js.map +1 -0
- package/dist/components/site-style/site-style.d.ts +1 -0
- package/dist/components/site-style/site-style.js +4 -0
- package/dist/components/site-style/site-style.js.map +1 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.d.ts +10 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.js +11 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.js.map +1 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.d.ts +13 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js +25 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js.map +1 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.d.ts +1 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.js +4 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.js.map +1 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +46 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js +339 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.d.ts +1 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.js +4 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.js.map +1 -0
- package/dist/components/uvalib-filter/UvalibFilter.d.ts +73 -0
- package/dist/components/uvalib-filter/UvalibFilter.js +279 -0
- package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -0
- package/dist/components/uvalib-filter/uvalib-filter.d.ts +1 -0
- package/dist/components/uvalib-filter/uvalib-filter.js +4 -0
- package/dist/components/uvalib-filter/uvalib-filter.js.map +1 -0
- package/dist/custom-elements.json +15178 -0
- package/dist/data/fetch-json.d.ts +28 -0
- package/dist/data/fetch-json.js +43 -0
- package/dist/data/fetch-json.js.map +1 -0
- package/dist/data/new-york.d.ts +5 -0
- package/dist/data/new-york.js +23 -0
- package/dist/data/new-york.js.map +1 -0
- package/dist/data/sites.d.ts +12 -0
- package/dist/data/sites.js +89 -0
- package/dist/data/sites.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/accessible.d.ts +1 -0
- package/dist/styles/accessible.js +37 -0
- package/dist/styles/accessible.js.map +1 -0
- package/dist/styles/base.d.ts +2 -0
- package/dist/styles/base.js +41 -0
- package/dist/styles/base.js.map +1 -0
- package/dist/styles/color-scheme.d.ts +1 -0
- package/dist/styles/color-scheme.js +81 -0
- package/dist/styles/color-scheme.js.map +1 -0
- package/dist/styles/tokens.d.ts +1 -0
- package/dist/styles/tokens.js +85 -0
- package/dist/styles/tokens.js.map +1 -0
- package/dist/styles/w3-subset.d.ts +1 -0
- package/dist/styles/w3-subset.js +33 -0
- package/dist/styles/w3-subset.js.map +1 -0
- package/dist/tokens.css +152 -0
- package/dist-cdn/base.css +30 -0
- package/dist-cdn/bento-box.js +1023 -0
- package/dist-cdn/bento-box.js.map +1 -0
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js +174 -0
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js.map +1 -0
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js +695 -0
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +1 -0
- package/dist-cdn/chunks/accessible-GqhVn5_H.js +40 -0
- package/dist-cdn/chunks/accessible-GqhVn5_H.js.map +1 -0
- package/dist-cdn/chunks/analytics-C8D8n_wt.js +55 -0
- package/dist-cdn/chunks/analytics-C8D8n_wt.js.map +1 -0
- package/dist-cdn/chunks/base-DCGd2Oii.js +117 -0
- package/dist-cdn/chunks/base-DCGd2Oii.js.map +1 -0
- package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js +25 -0
- package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js.map +1 -0
- package/dist-cdn/chunks/heading-level-DIuNS44-.js +31 -0
- package/dist-cdn/chunks/heading-level-DIuNS44-.js.map +1 -0
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js +181 -0
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +1 -0
- package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js +346 -0
- package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js.map +1 -0
- package/dist-cdn/chunks/link-DbJSwj16.js +7 -0
- package/dist-cdn/chunks/link-DbJSwj16.js.map +1 -0
- package/dist-cdn/chunks/new-york-DkcnqvJ4.js +18 -0
- package/dist-cdn/chunks/new-york-DkcnqvJ4.js.map +1 -0
- package/dist-cdn/chunks/repeat-CIFUYkyh.js +101 -0
- package/dist-cdn/chunks/repeat-CIFUYkyh.js.map +1 -0
- package/dist-cdn/chunks/site-header-BwDkZ2LL.js +802 -0
- package/dist-cdn/chunks/site-header-BwDkZ2LL.js.map +1 -0
- package/dist-cdn/chunks/site-main-nav-BLAAunnr.js +605 -0
- package/dist-cdn/chunks/site-main-nav-BLAAunnr.js.map +1 -0
- package/dist-cdn/chunks/static-html-1mTAG6nS.js +22 -0
- package/dist-cdn/chunks/static-html-1mTAG6nS.js.map +1 -0
- package/dist-cdn/custom-elements.json +15178 -0
- package/dist-cdn/events-section.js +401 -0
- package/dist-cdn/events-section.js.map +1 -0
- package/dist-cdn/library-hours-setup.js +28 -0
- package/dist-cdn/library-hours-setup.js.map +1 -0
- package/dist-cdn/library-weekly-hours.js +1 -0
- package/dist-cdn/manifest.json +23 -0
- package/dist-cdn/site-analytics.js +6 -0
- package/dist-cdn/site-analytics.js.map +1 -0
- package/dist-cdn/site-footer.js +267 -0
- package/dist-cdn/site-footer.js.map +1 -0
- package/dist-cdn/site-header.js +1 -0
- package/dist-cdn/site-hours-section.js +145 -0
- package/dist-cdn/site-hours-section.js.map +1 -0
- package/dist-cdn/site-main-nav.js +1 -0
- package/dist-cdn/site-page.js +317 -0
- package/dist-cdn/site-page.js.map +1 -0
- package/dist-cdn/site-style.js +42 -0
- package/dist-cdn/site-style.js.map +1 -0
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +276 -0
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +631 -0
- package/dist-cdn/skills/uvalib-web-components/reference/migration.md +52 -0
- package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +147 -0
- package/dist-cdn/tokens.css +152 -0
- package/dist-cdn/uvalib-analytics.js +6 -0
- package/dist-cdn/uvalib-analytics.js.map +1 -0
- package/dist-cdn/uvalib-date-range.js +262 -0
- package/dist-cdn/uvalib-date-range.js.map +1 -0
- package/dist-cdn/uvalib-filter.js +184 -0
- package/dist-cdn/uvalib-filter.js.map +1 -0
- package/package.json +152 -4
- package/skills/uvalib-web-components/SKILL.md +276 -0
- package/skills/uvalib-web-components/reference/components.md +631 -0
- package/skills/uvalib-web-components/reference/migration.md +52 -0
- package/skills/uvalib-web-components/reference/snippets.md +147 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./UvalibElement-BnI-eRRR.js";
|
|
2
|
+
import { i as u, n as d, r as f, t as p } from "./site-main-nav-BLAAunnr.js";
|
|
3
|
+
import { i as m } from "./analytics-C8D8n_wt.js";
|
|
4
|
+
import { t as h } from "./link-DbJSwj16.js";
|
|
5
|
+
import { t as g } from "./accessible-GqhVn5_H.js";
|
|
6
|
+
// src/styles/color-scheme.ts
|
|
7
|
+
var _ = s("\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"), v = "color: var(--uva-color-pre-footer-text, #ffffff);", y = t`
|
|
8
|
+
@supports (color: light-dark(#000, #fff)) {
|
|
9
|
+
:root[data-uva-color-scheme] {
|
|
10
|
+
--uva-color-surface: light-dark(#ffffff, #10172b);
|
|
11
|
+
--uva-color-surface-raised: light-dark(#ffffff, #232d4b);
|
|
12
|
+
--uva-color-surface-hover: light-dark(var(--uva-grey-100, #dadada), #2c3858);
|
|
13
|
+
--uva-color-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #e8e8e8);
|
|
14
|
+
--uva-color-text-muted: light-dark(#4b5563, #adadad);
|
|
15
|
+
--uva-color-link: light-dark(var(--uva-brand-blue, #232d4b), #87b9d9);
|
|
16
|
+
--uva-color-utility-link: light-dark(var(--uva-blue-alt-dark, #005679), #91d8f2);
|
|
17
|
+
--uva-color-focus: light-dark(var(--uva-brand-orange, #e57200), #ffb370);
|
|
18
|
+
--uva-color-current: light-dark(var(--uva-brand-orange, #e57200), #e57200);
|
|
19
|
+
--uva-color-accent-bg: light-dark(var(--uva-brand-blue, #232d4b), #87b9d9);
|
|
20
|
+
--uva-color-on-accent: light-dark(#ffffff, #10172b);
|
|
21
|
+
--uva-color-control-border: light-dark(var(--uva-grey, #808080), #7a84a0);
|
|
22
|
+
--uva-color-input-text: light-dark(#1f2937, #e8e8e8);
|
|
23
|
+
--uva-color-track: light-dark(#e5e7eb, #2c3858);
|
|
24
|
+
--uva-color-shadow: light-dark(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.6));
|
|
25
|
+
--uva-color-pre-footer-bg: light-dark(var(--uva-blue-alt-300, #bfe7f7), #005679);
|
|
26
|
+
--uva-color-pre-footer-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #ffffff);
|
|
27
|
+
}
|
|
28
|
+
:root[data-uva-color-scheme='system'] {
|
|
29
|
+
color-scheme: light dark;
|
|
30
|
+
--uva-color-scheme: light dark;
|
|
31
|
+
}
|
|
32
|
+
:root[data-uva-color-scheme='light'] {
|
|
33
|
+
color-scheme: light;
|
|
34
|
+
--uva-color-scheme: light;
|
|
35
|
+
}
|
|
36
|
+
:root[data-uva-color-scheme='dark'] {
|
|
37
|
+
color-scheme: dark;
|
|
38
|
+
--uva-color-scheme: dark;
|
|
39
|
+
${_}
|
|
40
|
+
}
|
|
41
|
+
:root[data-uva-color-scheme='dark'] [slot='pre-footer'] a {
|
|
42
|
+
${s(v)}
|
|
43
|
+
}
|
|
44
|
+
@media (prefers-color-scheme: dark) {
|
|
45
|
+
:root[data-uva-color-scheme='system'] {
|
|
46
|
+
${_}
|
|
47
|
+
}
|
|
48
|
+
:root[data-uva-color-scheme='system'] [slot='pre-footer'] a {
|
|
49
|
+
${s(v)}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
`, b = "uvalib-color-scheme", x = "data-uva-color-scheme", S = "uvalib-color-scheme-change", C = "(prefers-color-scheme: dark)", w = /* @__PURE__ */ new WeakMap(), T = (e) => e === "light" || e === "dark" ? e : "system";
|
|
54
|
+
function E(e = document) {
|
|
55
|
+
let t = e.defaultView?.CSS;
|
|
56
|
+
try {
|
|
57
|
+
return !!t?.supports?.("color", "light-dark(#000, #fff)");
|
|
58
|
+
} catch {
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function D(e = document) {
|
|
63
|
+
let t = w.get(e);
|
|
64
|
+
if (t) return t;
|
|
65
|
+
try {
|
|
66
|
+
return T(e.defaultView?.localStorage.getItem(b));
|
|
67
|
+
} catch {
|
|
68
|
+
return "system";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function O(e = document) {
|
|
72
|
+
return !!e.defaultView?.matchMedia?.(C).matches;
|
|
73
|
+
}
|
|
74
|
+
function k(e, t = document) {
|
|
75
|
+
return e === "system" ? O(t) ? "dark" : "light" : e;
|
|
76
|
+
}
|
|
77
|
+
function A(e, t, n = !1) {
|
|
78
|
+
let r = e.documentElement;
|
|
79
|
+
r.getAttribute("data-uva-color-scheme") !== t && r.setAttribute(x, t), n && (r.style.colorScheme = t === "system" ? "light dark" : t);
|
|
80
|
+
}
|
|
81
|
+
function j(e) {
|
|
82
|
+
let t = e.documentElement;
|
|
83
|
+
t.removeAttribute(x), t.style.removeProperty("color-scheme"), t.getAttribute("style") || t.removeAttribute("style");
|
|
84
|
+
}
|
|
85
|
+
function M(e, t, n = !1) {
|
|
86
|
+
try {
|
|
87
|
+
let n = e.defaultView.localStorage;
|
|
88
|
+
t === "system" ? n.removeItem(b) : n.setItem(b, t), w.delete(e);
|
|
89
|
+
} catch {
|
|
90
|
+
w.set(e, t);
|
|
91
|
+
}
|
|
92
|
+
A(e, t, n), e.dispatchEvent(new CustomEvent(S));
|
|
93
|
+
}
|
|
94
|
+
function N(e) {
|
|
95
|
+
c("uvalib-color-scheme", [y], {
|
|
96
|
+
root: e,
|
|
97
|
+
scope: !1
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
var P = /* @__PURE__ */ new WeakMap(), F = (e) => {
|
|
101
|
+
let t = P.get(e);
|
|
102
|
+
return t || P.set(e, t = /* @__PURE__ */ new Set()), t;
|
|
103
|
+
}, I = "(forced-colors: active)";
|
|
104
|
+
function L(e = document) {
|
|
105
|
+
let t = e.documentElement.getAttribute(x);
|
|
106
|
+
return t === null || !E(e) ? null : k(T(t), e);
|
|
107
|
+
}
|
|
108
|
+
var R = class {
|
|
109
|
+
constructor(e, t, n, r = !0) {
|
|
110
|
+
this.host = e, this.enabled = t, this.inline = n, this.renders = r, this.preference = "system", this.systemDark = !1, this.rootDark = !1, this.forcedColors = !1, this.rootOn = !1, this.active = !1, this.syncing = !1, this.onChange = () => this.refresh(!this.syncing), this.onStorage = (e) => {
|
|
111
|
+
(e.key === null || e.key === "uvalib-color-scheme") && (this.active && A(this.host.ownerDocument, D(this.host.ownerDocument), this.inline()), this.refresh(!0));
|
|
112
|
+
}, e.addController(this);
|
|
113
|
+
}
|
|
114
|
+
hostConnected() {
|
|
115
|
+
this.sync();
|
|
116
|
+
}
|
|
117
|
+
hostDisconnected() {
|
|
118
|
+
this.listen("none"), this.release(this.host.ownerDocument);
|
|
119
|
+
}
|
|
120
|
+
sync() {
|
|
121
|
+
let e = this.host.ownerDocument;
|
|
122
|
+
if (!this.host.isConnected) return;
|
|
123
|
+
this.syncing = !0;
|
|
124
|
+
let t = E(e);
|
|
125
|
+
this.active = this.enabled() && t, this.active ? (F(e).add(this), this.inline() || N(e), this.preference = D(e), A(e, this.preference, this.inline()), e.dispatchEvent(new CustomEvent(S))) : (this.release(e), !F(e).size && e.documentElement.hasAttribute("data-uva-color-scheme") && (j(e), e.dispatchEvent(new CustomEvent(S)))), this.syncing = !1, this.refresh(!1), this.listen(t ? this.listenLevel() : "none");
|
|
126
|
+
}
|
|
127
|
+
get logoDark() {
|
|
128
|
+
return this.rootOn && (this.forcedColors ? this.systemDark : this.rootDark);
|
|
129
|
+
}
|
|
130
|
+
choose(e) {
|
|
131
|
+
M(this.host.ownerDocument, e, this.inline());
|
|
132
|
+
}
|
|
133
|
+
release(e) {
|
|
134
|
+
let t = F(e);
|
|
135
|
+
t.delete(this) && (this.active = !1, t.size || (j(e), e.dispatchEvent(new CustomEvent(S))));
|
|
136
|
+
}
|
|
137
|
+
refresh(e) {
|
|
138
|
+
let t = this.host.ownerDocument, n = L(t), r = this.active || n !== null ? {
|
|
139
|
+
preference: D(t),
|
|
140
|
+
systemDark: O(t),
|
|
141
|
+
rootDark: n === "dark",
|
|
142
|
+
rootOn: n !== null,
|
|
143
|
+
forcedColors: !!t.defaultView?.matchMedia?.(I).matches
|
|
144
|
+
} : {
|
|
145
|
+
preference: "system",
|
|
146
|
+
systemDark: !1,
|
|
147
|
+
rootDark: !1,
|
|
148
|
+
rootOn: !1,
|
|
149
|
+
forcedColors: !1
|
|
150
|
+
}, i = Object.keys(r).some((e) => r[e] !== this[e]);
|
|
151
|
+
Object.assign(this, r), this.listening && this.listen(this.listenLevel()), i && e && this.renders && this.host.requestUpdate();
|
|
152
|
+
}
|
|
153
|
+
listenLevel() {
|
|
154
|
+
return E(this.host.ownerDocument) ? this.active || this.rootOn ? "full" : "change" : "none";
|
|
155
|
+
}
|
|
156
|
+
listen(e) {
|
|
157
|
+
if (e === (this.listening?.level ?? "none")) return;
|
|
158
|
+
if (this.listening) {
|
|
159
|
+
let { doc: e, dark: t, forced: n } = this.listening;
|
|
160
|
+
e.removeEventListener(S, this.onChange), e.defaultView?.removeEventListener("storage", this.onStorage), t?.removeEventListener("change", this.onChange), n?.removeEventListener("change", this.onChange), this.listening = void 0;
|
|
161
|
+
}
|
|
162
|
+
if (e === "none") return;
|
|
163
|
+
let t = this.host.ownerDocument;
|
|
164
|
+
if (t.addEventListener(S, this.onChange), e === "change") {
|
|
165
|
+
this.listening = {
|
|
166
|
+
doc: t,
|
|
167
|
+
level: e
|
|
168
|
+
};
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
let n = t.defaultView?.matchMedia?.(C), r = t.defaultView?.matchMedia?.(I);
|
|
172
|
+
t.defaultView?.addEventListener("storage", this.onStorage), n?.addEventListener("change", this.onChange), r?.addEventListener("change", this.onChange), this.listening = {
|
|
173
|
+
doc: t,
|
|
174
|
+
level: e,
|
|
175
|
+
dark: n,
|
|
176
|
+
forced: r
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}, z = [
|
|
180
|
+
{
|
|
181
|
+
label: "My account",
|
|
182
|
+
path: "https://search.lib.virginia.edu/account"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
label: "Ask a Librarian",
|
|
186
|
+
path: "/askalibrarian"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
label: "Hours",
|
|
190
|
+
path: "/hours"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
label: "Give",
|
|
194
|
+
path: "/support-library"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
label: "Alerts",
|
|
198
|
+
path: "/status#alerts"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
label: "Search",
|
|
202
|
+
path: "/search"
|
|
203
|
+
}
|
|
204
|
+
], B = z.filter((e) => e.label === "Ask a Librarian"), ee = 0, V = 0, H = "https://static.lib.virginia.edu/files/downloads/LibraryLogos/UVALIB_primary_color_white_web.png", U = [
|
|
205
|
+
{
|
|
206
|
+
value: "light",
|
|
207
|
+
label: "Light"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
value: "dark",
|
|
211
|
+
label: "Dark"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
value: "system",
|
|
215
|
+
label: "System"
|
|
216
|
+
}
|
|
217
|
+
], W = "site-links", G = (e) => e instanceof Element && e.getAttribute("slot") === W, K = "main-nav", q = (e) => e instanceof Element && e.getAttribute("slot") === K, J = "alerts", Y = (e) => e instanceof Element && e.getAttribute("slot") === J, X = [
|
|
218
|
+
"href",
|
|
219
|
+
"aria-current",
|
|
220
|
+
"target",
|
|
221
|
+
"rel",
|
|
222
|
+
"hreflang"
|
|
223
|
+
], Z = (e) => e.stopPropagation(), Q = class extends l {
|
|
224
|
+
static {
|
|
225
|
+
this.styles = [g, t`
|
|
226
|
+
:host {
|
|
227
|
+
display: block;
|
|
228
|
+
width: 100%;
|
|
229
|
+
}
|
|
230
|
+
/* Logo on the start, everything else on the end, as one row. A grid (not a wrapping
|
|
231
|
+
flex row) so an alerts row can span the top without changing where the logo row
|
|
232
|
+
breaks: flex wrapping decides lines on max-content sizes before anything shrinks. */
|
|
233
|
+
header {
|
|
234
|
+
display: grid;
|
|
235
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
236
|
+
align-items: start;
|
|
237
|
+
position: relative;
|
|
238
|
+
background-color: var(--uva-color-surface-raised, #ffffff);
|
|
239
|
+
--_pad-block: 0.5rem;
|
|
240
|
+
--_pad-inline: 16px; /* old: .w3-container 16px side padding */
|
|
241
|
+
padding: var(--_pad-block) var(--_pad-inline);
|
|
242
|
+
}
|
|
243
|
+
header > :not(.logo) {
|
|
244
|
+
grid-column: 2;
|
|
245
|
+
justify-self: end;
|
|
246
|
+
}
|
|
247
|
+
/* The alerts (slot="alerts") are a full-bleed row above the logo row, as in Virgo:
|
|
248
|
+
negative margins equal to the header's padding put them flush with the top and both
|
|
249
|
+
edges, and the bottom margin gives the logo row back its top padding. With no
|
|
250
|
+
alerts content they take no space, so the logo row is exactly where it was. */
|
|
251
|
+
::slotted([slot='alerts']),
|
|
252
|
+
header > [slot='alerts'] {
|
|
253
|
+
grid-column: 1 / -1;
|
|
254
|
+
justify-self: stretch;
|
|
255
|
+
min-inline-size: 0;
|
|
256
|
+
margin: calc(-1 * var(--_pad-block)) calc(-1 * var(--_pad-inline)) var(--_pad-block);
|
|
257
|
+
}
|
|
258
|
+
.logo {
|
|
259
|
+
display: block;
|
|
260
|
+
text-decoration: none;
|
|
261
|
+
}
|
|
262
|
+
.logo img {
|
|
263
|
+
display: block;
|
|
264
|
+
max-width: 225px;
|
|
265
|
+
height: auto;
|
|
266
|
+
}
|
|
267
|
+
nav ul {
|
|
268
|
+
list-style-type: none;
|
|
269
|
+
margin: 0;
|
|
270
|
+
padding: 0;
|
|
271
|
+
}
|
|
272
|
+
/* Old nav hung from the top of the header below the default 1em list margin. */
|
|
273
|
+
nav.inline ul {
|
|
274
|
+
margin: 1em 0;
|
|
275
|
+
display: flex;
|
|
276
|
+
gap: 1.5rem;
|
|
277
|
+
}
|
|
278
|
+
a {
|
|
279
|
+
color: var(--uva-color-utility-link, var(--uva-blue-alt-dark, #005679));
|
|
280
|
+
}
|
|
281
|
+
/* Current page: bold with a thick underline, so it does not rely on colour alone. */
|
|
282
|
+
nav a[aria-current]:not([aria-current='false']) {
|
|
283
|
+
font-weight: 700;
|
|
284
|
+
text-decoration-line: underline;
|
|
285
|
+
text-decoration-thickness: 3px;
|
|
286
|
+
text-decoration-color: var(--uva-color-current, var(--uva-brand-orange, #e57200));
|
|
287
|
+
text-underline-offset: 0.3em;
|
|
288
|
+
}
|
|
289
|
+
.menu-toggle {
|
|
290
|
+
display: none;
|
|
291
|
+
align-items: center;
|
|
292
|
+
gap: 0.25rem;
|
|
293
|
+
background: none;
|
|
294
|
+
border: none;
|
|
295
|
+
color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
|
|
296
|
+
font: inherit;
|
|
297
|
+
cursor: pointer;
|
|
298
|
+
}
|
|
299
|
+
/* Old shared sheet sized every inline svg at 17px. */
|
|
300
|
+
.menu-toggle svg {
|
|
301
|
+
width: 17px;
|
|
302
|
+
height: 17px;
|
|
303
|
+
}
|
|
304
|
+
[popover] {
|
|
305
|
+
position: fixed;
|
|
306
|
+
inset: auto;
|
|
307
|
+
/* Fallback offset (about the header height) for engines without anchor(). */
|
|
308
|
+
top: 4.75rem;
|
|
309
|
+
inset-inline-end: 1rem;
|
|
310
|
+
inline-size: min(80dvw, 24rem);
|
|
311
|
+
max-inline-size: calc(100dvw - 2rem);
|
|
312
|
+
block-size: fit-content;
|
|
313
|
+
max-block-size: calc(100dvh - 6rem);
|
|
314
|
+
overflow: auto;
|
|
315
|
+
box-sizing: border-box;
|
|
316
|
+
margin: 0.5rem 0 0;
|
|
317
|
+
padding: 0.5rem 1rem;
|
|
318
|
+
border: 1px solid var(--uva-color-border, #ccc);
|
|
319
|
+
background: var(--uva-color-surface-raised, #ffffff);
|
|
320
|
+
}
|
|
321
|
+
nav.menu li {
|
|
322
|
+
padding: 0.375rem 0;
|
|
323
|
+
}
|
|
324
|
+
/* The main navigation: a full-bleed row under the logo row, flush with the header's
|
|
325
|
+
bottom (its 5px rule is the header's bottom edge), 0.5rem below the logo row. */
|
|
326
|
+
header > site-main-nav.bar {
|
|
327
|
+
grid-column: 1 / -1;
|
|
328
|
+
justify-self: stretch;
|
|
329
|
+
min-inline-size: 0;
|
|
330
|
+
margin: var(--_pad-block) calc(-1 * var(--_pad-inline)) calc(-1 * var(--_pad-block));
|
|
331
|
+
}
|
|
332
|
+
/* Narrow screens: the main navigation leads the Menu popover, then a rule, then the
|
|
333
|
+
utility or site links. */
|
|
334
|
+
.menu-popover > site-main-nav + nav.menu > ul,
|
|
335
|
+
.menu-popover > .color-scheme {
|
|
336
|
+
margin-block-start: 0.5rem;
|
|
337
|
+
padding-block-start: 0.5rem;
|
|
338
|
+
border-block-start: 1px solid var(--uva-color-border, #ccc);
|
|
339
|
+
}
|
|
340
|
+
nav.menu {
|
|
341
|
+
display: contents;
|
|
342
|
+
}
|
|
343
|
+
@supports (top: anchor(--x bottom)) {
|
|
344
|
+
[popover] {
|
|
345
|
+
top: anchor(var(--menu-anchor) bottom);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
/* One line: the links wrap within their own space, the control stays at the end. */
|
|
349
|
+
.utility-row {
|
|
350
|
+
display: flex;
|
|
351
|
+
align-items: center;
|
|
352
|
+
justify-content: flex-end;
|
|
353
|
+
column-gap: 1.5rem;
|
|
354
|
+
min-inline-size: 0;
|
|
355
|
+
}
|
|
356
|
+
.utility-row > nav.inline {
|
|
357
|
+
min-inline-size: 0;
|
|
358
|
+
}
|
|
359
|
+
.utility-row > nav.inline ul {
|
|
360
|
+
flex-wrap: wrap;
|
|
361
|
+
justify-content: flex-end;
|
|
362
|
+
row-gap: 0.25rem;
|
|
363
|
+
}
|
|
364
|
+
.utility-row > .color-scheme {
|
|
365
|
+
flex: none;
|
|
366
|
+
}
|
|
367
|
+
.color-scheme {
|
|
368
|
+
min-inline-size: 0;
|
|
369
|
+
margin: 0;
|
|
370
|
+
padding: 0;
|
|
371
|
+
border: 0;
|
|
372
|
+
color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
|
|
373
|
+
}
|
|
374
|
+
.color-scheme legend {
|
|
375
|
+
padding: 0;
|
|
376
|
+
font-weight: 700;
|
|
377
|
+
}
|
|
378
|
+
.segments {
|
|
379
|
+
display: flex;
|
|
380
|
+
border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));
|
|
381
|
+
border-radius: 0.3rem;
|
|
382
|
+
background: var(--uva-color-surface-raised, #ffffff);
|
|
383
|
+
}
|
|
384
|
+
.segments label {
|
|
385
|
+
position: relative;
|
|
386
|
+
display: flex;
|
|
387
|
+
flex: 1;
|
|
388
|
+
min-inline-size: 28px;
|
|
389
|
+
font-size: 0.875rem;
|
|
390
|
+
cursor: pointer;
|
|
391
|
+
}
|
|
392
|
+
.segments label + label {
|
|
393
|
+
border-inline-start: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));
|
|
394
|
+
}
|
|
395
|
+
.segment {
|
|
396
|
+
display: flex;
|
|
397
|
+
flex: 1;
|
|
398
|
+
align-items: center;
|
|
399
|
+
justify-content: center;
|
|
400
|
+
min-block-size: 28px;
|
|
401
|
+
padding: 0.125rem 0.625rem;
|
|
402
|
+
}
|
|
403
|
+
.segments input {
|
|
404
|
+
position: absolute;
|
|
405
|
+
inset: 0;
|
|
406
|
+
inline-size: 100%;
|
|
407
|
+
block-size: 100%;
|
|
408
|
+
margin: 0;
|
|
409
|
+
opacity: 0;
|
|
410
|
+
cursor: pointer;
|
|
411
|
+
}
|
|
412
|
+
.segments input:checked + .segment {
|
|
413
|
+
background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
|
|
414
|
+
color: var(--uva-color-on-accent, #ffffff);
|
|
415
|
+
font-weight: 700;
|
|
416
|
+
}
|
|
417
|
+
.segments input:focus-visible + .segment {
|
|
418
|
+
position: relative;
|
|
419
|
+
z-index: 1;
|
|
420
|
+
outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));
|
|
421
|
+
outline-offset: 2px;
|
|
422
|
+
}
|
|
423
|
+
/* Floated, so it is not drawn into the fieldset's top border (the popover rule). */
|
|
424
|
+
.menu-popover > .color-scheme legend {
|
|
425
|
+
float: inline-start;
|
|
426
|
+
inline-size: 100%;
|
|
427
|
+
margin-block-end: 0.375rem;
|
|
428
|
+
}
|
|
429
|
+
.menu-popover > .color-scheme .segments {
|
|
430
|
+
clear: both;
|
|
431
|
+
}
|
|
432
|
+
@media (forced-colors: active) {
|
|
433
|
+
.segments input:checked + .segment {
|
|
434
|
+
forced-color-adjust: none;
|
|
435
|
+
background: Highlight;
|
|
436
|
+
color: HighlightText;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
@media screen and (max-width: 992px) {
|
|
440
|
+
header:not(.vendor) nav.inline,
|
|
441
|
+
header:not(.vendor) .utility-row,
|
|
442
|
+
header > site-main-nav.bar {
|
|
443
|
+
display: none;
|
|
444
|
+
}
|
|
445
|
+
header.vendor .utility-row {
|
|
446
|
+
display: contents;
|
|
447
|
+
}
|
|
448
|
+
header.vendor .utility-row > nav.inline {
|
|
449
|
+
grid-column: 2;
|
|
450
|
+
justify-self: end;
|
|
451
|
+
}
|
|
452
|
+
header.vendor .utility-row > .color-scheme {
|
|
453
|
+
grid-column: 1 / -1;
|
|
454
|
+
justify-self: end;
|
|
455
|
+
margin-block-end: 0.5rem;
|
|
456
|
+
}
|
|
457
|
+
.menu-toggle {
|
|
458
|
+
display: inline-flex;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
@media screen and (min-width: 993px) {
|
|
462
|
+
.menu-toggle,
|
|
463
|
+
[popover] {
|
|
464
|
+
display: none;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
`];
|
|
468
|
+
}
|
|
469
|
+
constructor() {
|
|
470
|
+
super(), this.rootLinkDomain = "https://www.library.virginia.edu", this.variant = "full", this.noMainNav = !1, this.colorSchemeSwitch = !1, this.scheme = new R(this, () => this.colorSchemeSwitch, () => this.noStyle), this.schemeName = `uva-color-scheme-${++V}`, this.mainNavItems = null, this.warnedMainNav = !1, this.siteLinks = null, this.warnedInvalid = !1, this.onMenuLinkClick = (e) => {
|
|
471
|
+
if (e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;
|
|
472
|
+
let t = e.composedPath(), n = t.findIndex((e) => e instanceof Element && e.localName === "a"), r = t.findIndex((e) => e instanceof HTMLElement && e.id === this.menuId);
|
|
473
|
+
if (n < 0 || r < n) return;
|
|
474
|
+
let i = t[r];
|
|
475
|
+
i.matches(":popover-open") && i.hidePopover();
|
|
476
|
+
}, this.addEventListener("click", this.onMenuLinkClick);
|
|
477
|
+
}
|
|
478
|
+
connectedCallback() {
|
|
479
|
+
super.connectedCallback(), this.hasUpdated ? this.syncChildren() : this.syncMainNav();
|
|
480
|
+
}
|
|
481
|
+
disconnectedCallback() {
|
|
482
|
+
super.disconnectedCallback(), this.observer?.disconnect();
|
|
483
|
+
}
|
|
484
|
+
willUpdate(e) {
|
|
485
|
+
if (!e.has("colorSchemeSwitch")) return;
|
|
486
|
+
let t = this.scheme.active;
|
|
487
|
+
if (this.scheme.sync(), this.lightDom && this.hasUpdated && t !== this.scheme.active) {
|
|
488
|
+
let e = [...this.querySelector(":scope > header")?.children ?? []].filter(Y);
|
|
489
|
+
for (let t of [this.holder, this.mainNavHolder]) t && e.push(t);
|
|
490
|
+
this.prepend(...e);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
updated(e) {
|
|
494
|
+
e.has("colorSchemeSwitch") && this.hasUpdated && this.adoptAlerts();
|
|
495
|
+
}
|
|
496
|
+
firstUpdated() {
|
|
497
|
+
this.syncChildren();
|
|
498
|
+
}
|
|
499
|
+
logoSrc() {
|
|
500
|
+
return this.scheme.logoDark ? H : h(this.rootLinkDomain, "/sites/default/files/2022-09/library_rgb.png");
|
|
501
|
+
}
|
|
502
|
+
onSchemeChange(e) {
|
|
503
|
+
let t = e.target;
|
|
504
|
+
t.checked && (this.scheme.choose(t.value), m(this, [
|
|
505
|
+
"site-header",
|
|
506
|
+
"color-scheme",
|
|
507
|
+
t.value
|
|
508
|
+
]));
|
|
509
|
+
}
|
|
510
|
+
schemeControl(e) {
|
|
511
|
+
let { preference: t, systemDark: n } = this.scheme, i = ` (currently ${n ? "dark" : "light"})`, a = `${this.schemeName}-${e}`;
|
|
512
|
+
return r`<fieldset class="color-scheme ${e}">
|
|
513
|
+
<legend class=${e === "inline" ? "visually-hidden" : ""}>Theme</legend>
|
|
514
|
+
<div class="segments">
|
|
515
|
+
${U.map((e) => r`<label
|
|
516
|
+
><input
|
|
517
|
+
type="radio"
|
|
518
|
+
name=${a}
|
|
519
|
+
value=${e.value}
|
|
520
|
+
.checked=${t === e.value}
|
|
521
|
+
@change=${this.onSchemeChange}
|
|
522
|
+
/><span class="segment"
|
|
523
|
+
>${e.label}${e.value === "system" ? r`<span class="visually-hidden">${i}</span>` : o}</span
|
|
524
|
+
></label
|
|
525
|
+
>`)}
|
|
526
|
+
</div>
|
|
527
|
+
</fieldset>`;
|
|
528
|
+
}
|
|
529
|
+
syncChildren() {
|
|
530
|
+
this.adoptAlerts(), this.syncSources();
|
|
531
|
+
}
|
|
532
|
+
syncSources() {
|
|
533
|
+
let e = [...this.syncSiteLinks(), ...this.syncMainNav()];
|
|
534
|
+
this.watch(e);
|
|
535
|
+
}
|
|
536
|
+
get slottedMainNav() {
|
|
537
|
+
return [...this.children].filter(q).flatMap((e) => e instanceof HTMLSlotElement ? e.assignedElements({ flatten: !0 }) : [e]);
|
|
538
|
+
}
|
|
539
|
+
adoptMainNav() {
|
|
540
|
+
let e = [...this.children].filter(q);
|
|
541
|
+
return e.length && !this.mainNavHolder && (this.mainNavHolder = document.createElement("div"), this.mainNavHolder.hidden = !0, this.mainNavHolder.className = "main-nav-source"), this.mainNavHolder && (this.mainNavHolder.append(...e), this.mainNavHolder.parentNode !== this && this.append(this.mainNavHolder)), this.mainNavHolder ? [...this.mainNavHolder.children] : [];
|
|
542
|
+
}
|
|
543
|
+
syncMainNav() {
|
|
544
|
+
let e = this.lightDom ? this.adoptMainNav() : this.slottedMainNav;
|
|
545
|
+
if (!e.length) return this.mainNavItems &&= null, e;
|
|
546
|
+
let t = e.flatMap((e, t) => t === 0 ? f(e) : [{}]), n = d(t);
|
|
547
|
+
(n.invalid || n.flattened) && !this.warnedMainNav && (this.warnedMainNav = !0, console.warn(`${this.localName}: ignoring invalid slot="${K}" entries (each needs a label, and an href or links; deeper levels are shown in their group).`));
|
|
548
|
+
let r = n.items.length ? n.items : null;
|
|
549
|
+
return JSON.stringify(r) !== JSON.stringify(this.mainNavItems) && (this.mainNavItems = r), e;
|
|
550
|
+
}
|
|
551
|
+
adoptAlerts() {
|
|
552
|
+
if (!this.lightDom) return;
|
|
553
|
+
let e = this.querySelector(":scope > header"), t = [...this.children].filter(Y);
|
|
554
|
+
if (!e || !t.length) return;
|
|
555
|
+
let n = e.firstChild;
|
|
556
|
+
for (; Y(n);) n = n.nextSibling;
|
|
557
|
+
for (let r of t) e.insertBefore(r, n);
|
|
558
|
+
}
|
|
559
|
+
get slotted() {
|
|
560
|
+
return this.renderRoot.querySelector(`slot[name="${W}"]`)?.assignedElements({ flatten: !0 }) ?? [];
|
|
561
|
+
}
|
|
562
|
+
adoptSiteLinks() {
|
|
563
|
+
let e = [...this.children].filter(G);
|
|
564
|
+
return e.length && !this.holder && (this.holder = document.createElement("div"), this.holder.hidden = !0, this.holder.className = "site-links-source"), this.holder && (this.holder.append(...e), this.holder.parentNode !== this && this.append(this.holder)), this.holder ? [...this.holder.children] : [];
|
|
565
|
+
}
|
|
566
|
+
syncSiteLinks() {
|
|
567
|
+
let e = this.lightDom ? this.adoptSiteLinks() : this.slotted, t = [], n = !1;
|
|
568
|
+
for (let r of e) {
|
|
569
|
+
let e = (r.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
570
|
+
if (!(r instanceof HTMLAnchorElement) || !r.hasAttribute("href") || !e) {
|
|
571
|
+
n = !0;
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
let i = (e) => r.getAttribute(e) ?? void 0;
|
|
575
|
+
t.push({
|
|
576
|
+
href: r.getAttribute("href"),
|
|
577
|
+
text: e,
|
|
578
|
+
current: i("aria-current"),
|
|
579
|
+
target: i("target"),
|
|
580
|
+
rel: i("rel"),
|
|
581
|
+
hreflang: i("hreflang")
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
return n && !this.warnedInvalid && (this.warnedInvalid = !0, console.warn(`${this.localName}: ignoring slot="${W}" children that are not <a href> elements with text.`)), this.siteLinks = t.length ? t : null, e;
|
|
585
|
+
}
|
|
586
|
+
watch(e) {
|
|
587
|
+
this.observer ??= new MutationObserver(() => this.syncChildren()), this.observer.disconnect();
|
|
588
|
+
let t = {
|
|
589
|
+
attributes: !0,
|
|
590
|
+
attributeFilter: X,
|
|
591
|
+
characterData: !0,
|
|
592
|
+
childList: !0,
|
|
593
|
+
subtree: !0
|
|
594
|
+
};
|
|
595
|
+
if (this.lightDom) this.observer.observe(this, { childList: !0 }), this.holder && this.observer.observe(this.holder, t), this.mainNavHolder && this.observer.observe(this.mainNavHolder, {
|
|
596
|
+
...t,
|
|
597
|
+
attributeFilter: ["href"]
|
|
598
|
+
});
|
|
599
|
+
else for (let n of e) this.observer.observe(n, t);
|
|
600
|
+
}
|
|
601
|
+
onSourcesChange() {
|
|
602
|
+
this.syncSources();
|
|
603
|
+
}
|
|
604
|
+
get menuId() {
|
|
605
|
+
return this._menuId ??= this.lightDom ? `utility-menu-${++ee}` : "utility-menu", this._menuId;
|
|
606
|
+
}
|
|
607
|
+
renderWithScheme(e, t, n, i) {
|
|
608
|
+
let a = this.rootLinkDomain, s = this.variant === "vendor", c = this.menuId, l = `--${c}`, u = r`<button
|
|
609
|
+
popovertarget=${c}
|
|
610
|
+
aria-controls=${c}
|
|
611
|
+
class="menu-toggle"
|
|
612
|
+
style="anchor-name: ${l}"
|
|
613
|
+
>
|
|
614
|
+
<svg
|
|
615
|
+
aria-hidden="true"
|
|
616
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
617
|
+
width="28"
|
|
618
|
+
height="28"
|
|
619
|
+
viewBox="0 0 24 24"
|
|
620
|
+
fill="none"
|
|
621
|
+
stroke="currentColor"
|
|
622
|
+
stroke-width="2"
|
|
623
|
+
stroke-linecap="butt"
|
|
624
|
+
stroke-linejoin="bevel"
|
|
625
|
+
>
|
|
626
|
+
<line x1="3" y1="12" x2="21" y2="12"></line>
|
|
627
|
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
628
|
+
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
629
|
+
</svg>
|
|
630
|
+
Menu
|
|
631
|
+
</button>
|
|
632
|
+
<div id=${c} popover class="menu-popover" style="--menu-anchor: ${l}">
|
|
633
|
+
${n ? i(!0) : o}
|
|
634
|
+
<nav class="menu" aria-label=${`${t} menu`}>
|
|
635
|
+
<ul>
|
|
636
|
+
${e}
|
|
637
|
+
</ul>
|
|
638
|
+
</nav>
|
|
639
|
+
${this.schemeControl("menu")}
|
|
640
|
+
</div>
|
|
641
|
+
${n ? i(!1) : o}`;
|
|
642
|
+
return r`
|
|
643
|
+
<header part="header" class=${s ? "vendor" : ""}>
|
|
644
|
+
${this.lightDom ? o : r`<slot name="skip-link"></slot><slot name="alerts"></slot>`}
|
|
645
|
+
<a class="logo" href=${h(a, "/")}
|
|
646
|
+
><img src=${this.logoSrc()} alt="UVA Library home" width="304" height="69"
|
|
647
|
+
/></a>
|
|
648
|
+
<div class="utility-row">
|
|
649
|
+
<nav class="inline" aria-label=${t}>
|
|
650
|
+
<ul>
|
|
651
|
+
${e}
|
|
652
|
+
</ul>
|
|
653
|
+
</nav>
|
|
654
|
+
${this.schemeControl("inline")}
|
|
655
|
+
</div>
|
|
656
|
+
${s ? o : u}
|
|
657
|
+
</header>
|
|
658
|
+
${this.lightDom ? o : r`<div hidden>
|
|
659
|
+
<slot name="site-links" @slotchange=${this.onSourcesChange}></slot>
|
|
660
|
+
</div>
|
|
661
|
+
<div hidden>
|
|
662
|
+
<slot name="main-nav" @slotchange=${this.onSourcesChange}></slot>
|
|
663
|
+
</div>`}
|
|
664
|
+
`;
|
|
665
|
+
}
|
|
666
|
+
render() {
|
|
667
|
+
let e = this.rootLinkDomain, t = this.variant === "vendor", n = t ? null : this.siteLinks, i = n ? n.map((e) => r`<li>
|
|
668
|
+
<a
|
|
669
|
+
href=${e.href}
|
|
670
|
+
aria-current=${u(e.current)}
|
|
671
|
+
target=${u(e.target)}
|
|
672
|
+
rel=${u(e.rel)}
|
|
673
|
+
hreflang=${u(e.hreflang)}
|
|
674
|
+
>${e.text}</a
|
|
675
|
+
>
|
|
676
|
+
</li>`) : (t ? B : z).map((t) => r`<li><a href=${h(e, t.path)}>${t.label}</a></li>`), a = n ? this.siteLinksLabel || "Site" : "Utility", s = this.menuId, c = `--${s}`, l = !t && !this.noMainNav, d = r`<button
|
|
677
|
+
popovertarget=${s}
|
|
678
|
+
aria-controls=${s}
|
|
679
|
+
class="menu-toggle"
|
|
680
|
+
style="anchor-name: ${c}"
|
|
681
|
+
>
|
|
682
|
+
<svg
|
|
683
|
+
aria-hidden="true"
|
|
684
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
685
|
+
width="28"
|
|
686
|
+
height="28"
|
|
687
|
+
viewBox="0 0 24 24"
|
|
688
|
+
fill="none"
|
|
689
|
+
stroke="currentColor"
|
|
690
|
+
stroke-width="2"
|
|
691
|
+
stroke-linecap="butt"
|
|
692
|
+
stroke-linejoin="bevel"
|
|
693
|
+
>
|
|
694
|
+
<line x1="3" y1="12" x2="21" y2="12"></line>
|
|
695
|
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
696
|
+
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
697
|
+
</svg>
|
|
698
|
+
Menu
|
|
699
|
+
</button>
|
|
700
|
+
<nav class="menu" aria-label=${`${a} menu`}>
|
|
701
|
+
<ul id=${s} popover style="--menu-anchor: ${c}">
|
|
702
|
+
${i}
|
|
703
|
+
</ul>
|
|
704
|
+
</nav>`, f = r`<div hidden>
|
|
705
|
+
<slot name="site-links" @slotchange=${this.onSourcesChange}></slot>
|
|
706
|
+
</div>`, p = (t) => r`<site-main-nav
|
|
707
|
+
class=${t ? "accordion" : "bar"}
|
|
708
|
+
layout=${u(t ? "accordion" : void 0)}
|
|
709
|
+
?no-shadow-dom=${this.lightDom}
|
|
710
|
+
?no-style=${this.noStyle}
|
|
711
|
+
label=${this.mainNavLabel || "Main"}
|
|
712
|
+
root-link-domain=${e}
|
|
713
|
+
items-src=${u(this.mainNavSrc || void 0)}
|
|
714
|
+
current=${u(this.mainNavCurrent || void 0)}
|
|
715
|
+
.items=${this.mainNavItems ?? void 0}
|
|
716
|
+
@site-main-nav-error=${t ? Z : o}
|
|
717
|
+
></site-main-nav>`, m = r`<button
|
|
718
|
+
popovertarget=${s}
|
|
719
|
+
aria-controls=${s}
|
|
720
|
+
class="menu-toggle"
|
|
721
|
+
style="anchor-name: ${c}"
|
|
722
|
+
>
|
|
723
|
+
<svg
|
|
724
|
+
aria-hidden="true"
|
|
725
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
726
|
+
width="28"
|
|
727
|
+
height="28"
|
|
728
|
+
viewBox="0 0 24 24"
|
|
729
|
+
fill="none"
|
|
730
|
+
stroke="currentColor"
|
|
731
|
+
stroke-width="2"
|
|
732
|
+
stroke-linecap="butt"
|
|
733
|
+
stroke-linejoin="bevel"
|
|
734
|
+
>
|
|
735
|
+
<line x1="3" y1="12" x2="21" y2="12"></line>
|
|
736
|
+
<line x1="3" y1="6" x2="21" y2="6"></line>
|
|
737
|
+
<line x1="3" y1="18" x2="21" y2="18"></line>
|
|
738
|
+
</svg>
|
|
739
|
+
Menu
|
|
740
|
+
</button>
|
|
741
|
+
<div id=${s} popover class="menu-popover" style="--menu-anchor: ${c}">
|
|
742
|
+
${p(!0)}
|
|
743
|
+
<nav class="menu" aria-label=${`${a} menu`}>
|
|
744
|
+
<ul>
|
|
745
|
+
${i}
|
|
746
|
+
</ul>
|
|
747
|
+
</nav>
|
|
748
|
+
</div>
|
|
749
|
+
${p(!1)}`, g = r`<div hidden>
|
|
750
|
+
<slot name="site-links" @slotchange=${this.onSourcesChange}></slot>
|
|
751
|
+
</div>
|
|
752
|
+
<div hidden>
|
|
753
|
+
<slot name="main-nav" @slotchange=${this.onSourcesChange}></slot>
|
|
754
|
+
</div>`;
|
|
755
|
+
return this.scheme.active ? this.renderWithScheme(i, a, l, p) : r`
|
|
756
|
+
<header part="header" class=${t ? "vendor" : ""}>
|
|
757
|
+
${this.lightDom ? o : r`<slot name="skip-link"></slot><slot name="alerts"></slot>`}
|
|
758
|
+
<a class="logo" href=${h(e, "/")}
|
|
759
|
+
><img src=${this.logoSrc()} alt="UVA Library home" width="304" height="69"
|
|
760
|
+
/></a>
|
|
761
|
+
<nav class="inline" aria-label=${a}>
|
|
762
|
+
<ul>
|
|
763
|
+
${i}
|
|
764
|
+
</ul>
|
|
765
|
+
</nav>
|
|
766
|
+
${t ? o : l ? m : d}
|
|
767
|
+
</header>
|
|
768
|
+
${this.lightDom ? o : l ? g : f}
|
|
769
|
+
`;
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
// src/components/site-header/site-header.ts
|
|
773
|
+
a([e({
|
|
774
|
+
type: String,
|
|
775
|
+
attribute: "root-link-domain"
|
|
776
|
+
})], Q.prototype, "rootLinkDomain", void 0), a([e({
|
|
777
|
+
type: String,
|
|
778
|
+
reflect: !0
|
|
779
|
+
})], Q.prototype, "variant", void 0), a([e({
|
|
780
|
+
type: String,
|
|
781
|
+
attribute: "site-links-label"
|
|
782
|
+
})], Q.prototype, "siteLinksLabel", void 0), a([e({
|
|
783
|
+
type: Boolean,
|
|
784
|
+
attribute: "no-main-nav"
|
|
785
|
+
})], Q.prototype, "noMainNav", void 0), a([e({
|
|
786
|
+
type: String,
|
|
787
|
+
attribute: "main-nav-label"
|
|
788
|
+
})], Q.prototype, "mainNavLabel", void 0), a([e({
|
|
789
|
+
type: String,
|
|
790
|
+
attribute: "main-nav-src"
|
|
791
|
+
})], Q.prototype, "mainNavSrc", void 0), a([e({
|
|
792
|
+
type: String,
|
|
793
|
+
attribute: "main-nav-current"
|
|
794
|
+
})], Q.prototype, "mainNavCurrent", void 0), a([e({
|
|
795
|
+
type: Boolean,
|
|
796
|
+
attribute: "color-scheme-switch"
|
|
797
|
+
})], Q.prototype, "colorSchemeSwitch", void 0), a([n()], Q.prototype, "mainNavItems", void 0), a([n()], Q.prototype, "siteLinks", void 0), i("site-header", Q);
|
|
798
|
+
var $ = customElements.get("site-main-nav");
|
|
799
|
+
$ && $ !== p && console.warn("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.");
|
|
800
|
+
export { R as t };
|
|
801
|
+
|
|
802
|
+
//# sourceMappingURL=site-header-BwDkZ2LL.js.map
|