@uvalib/web-components 1.8.4 → 1.9.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 +32 -0
- package/README.md +486 -60
- package/dist/base/clipboard.d.ts +9 -0
- package/dist/base/clipboard.js +30 -0
- package/dist/base/clipboard.js.map +1 -0
- package/dist/base.css +188 -3
- package/dist/components/site-page/SitePage.js +2 -1
- package/dist/components/site-page/SitePage.js.map +1 -1
- package/dist/components/site-style/SiteStyle.js +2 -1
- package/dist/components/site-style/SiteStyle.js.map +1 -1
- package/dist/components/uvalib-citation/UvalibCitation.d.ts +124 -0
- package/dist/components/uvalib-citation/UvalibCitation.js +545 -0
- package/dist/components/uvalib-citation/UvalibCitation.js.map +1 -0
- package/dist/components/uvalib-citation/uvalib-citation.d.ts +1 -0
- package/dist/components/uvalib-citation/uvalib-citation.js +4 -0
- package/dist/components/uvalib-citation/uvalib-citation.js.map +1 -0
- package/dist/components/uvalib-dialog/UvalibDialog.d.ts +167 -0
- package/dist/components/uvalib-dialog/UvalibDialog.js +688 -0
- package/dist/components/uvalib-dialog/UvalibDialog.js.map +1 -0
- package/dist/components/uvalib-dialog/uvalib-dialog.d.ts +1 -0
- package/dist/components/uvalib-dialog/uvalib-dialog.js +4 -0
- package/dist/components/uvalib-dialog/uvalib-dialog.js.map +1 -0
- package/dist/components/uvalib-filter/UvalibFilter.d.ts +92 -9
- package/dist/components/uvalib-filter/UvalibFilter.js +748 -60
- package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -1
- package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -4
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
- package/dist/custom-elements.json +5881 -3592
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/base.js +41 -1
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/color-scheme.js +4 -0
- package/dist/styles/color-scheme.js.map +1 -1
- package/dist/styles/controls.js +4 -0
- package/dist/styles/controls.js.map +1 -1
- package/dist/styles/field-text.d.ts +1 -0
- package/dist/styles/field-text.js +21 -0
- package/dist/styles/field-text.js.map +1 -0
- package/dist/styles/font-fallback.d.ts +7 -0
- package/dist/styles/font-fallback.js +15 -0
- package/dist/styles/font-fallback.js.map +1 -1
- package/dist/styles/hidden.js +13 -1
- package/dist/styles/hidden.js.map +1 -1
- package/dist/styles/table.d.ts +1 -0
- package/dist/styles/table.js +164 -0
- package/dist/styles/table.js.map +1 -0
- package/dist/tokens.css +4 -0
- package/dist-cdn/base.css +188 -3
- package/dist-cdn/chunks/{base-DfLI8lpa.js → base-CHMHBPeI.js} +58 -7
- package/dist-cdn/chunks/base-CHMHBPeI.js.map +1 -0
- package/dist-cdn/chunks/clipboard-CNG7Y_5X.js +18 -0
- package/dist-cdn/chunks/clipboard-CNG7Y_5X.js.map +1 -0
- package/dist-cdn/chunks/if-defined-COiQb-gl.js +6 -0
- package/dist-cdn/chunks/if-defined-COiQb-gl.js.map +1 -0
- package/dist-cdn/chunks/{site-header-CEmNtmk5.js → site-header-B78a_ldi.js} +27 -22
- package/dist-cdn/chunks/site-header-B78a_ldi.js.map +1 -0
- package/dist-cdn/chunks/{site-main-nav-CAwKq_x5.js → site-main-nav-CmMq2t8t.js} +52 -51
- package/dist-cdn/chunks/site-main-nav-CmMq2t8t.js.map +1 -0
- package/dist-cdn/custom-elements.json +5881 -3592
- package/dist-cdn/manifest.json +4 -2
- package/dist-cdn/site-header.js +1 -1
- package/dist-cdn/site-main-nav.js +1 -1
- package/dist-cdn/site-page.js +48 -48
- package/dist-cdn/site-page.js.map +1 -1
- package/dist-cdn/site-style.js +7 -7
- package/dist-cdn/site-style.js.map +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +8 -5
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +135 -8
- package/dist-cdn/tokens.css +4 -0
- package/dist-cdn/uvalib-citation.js +382 -0
- package/dist-cdn/uvalib-citation.js.map +1 -0
- package/dist-cdn/uvalib-dialog.js +419 -0
- package/dist-cdn/uvalib-dialog.js.map +1 -0
- package/dist-cdn/uvalib-filter.js +603 -69
- package/dist-cdn/uvalib-filter.js.map +1 -1
- package/dist-cdn/uvalib-metadata.js +49 -49
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/package.json +9 -1
- package/skills/uvalib-web-components/SKILL.md +8 -5
- package/skills/uvalib-web-components/reference/components.md +135 -8
- package/dist-cdn/chunks/base-DfLI8lpa.js.map +0 -1
- package/dist-cdn/chunks/site-header-CEmNtmk5.js.map +0 -1
- package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-header-B78a_ldi.js","names":["unsafeCSS","nothing","ifDefined","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","o","trackEvent","siteLink","accessible","normalizeItems","readItemsMarkup","SiteMainNav","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","ACCOUNT_URL","TAG","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","a","link","menu","popover","brand","header","row","edge","items","top","crowded","li","was","keep","holder","logo","name","input","hint","systemDark","where","preference","A","sources","moved","raw","s","result","incoming","ref","invalid","el","text","content","vendor","id","anchor","mainNav","mainNavEl","label","own","classic","classicHidden","accordion","withMainNav","withMainNavHidden","end","hidden","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) 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`;\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 /* base.css's .uvalib-button family: library.virginia.edu's blue-alt button, and a\n light-blue one on the dark surface (dark text 8.9:1). */\n --uva-color-button-bg: light-dark(var(--uva-blue-alt, #007bac), #55c4ec);\n --uva-color-button-text: light-dark(#ffffff, #10172b);\n --uva-color-button-hover-bg: light-dark(var(--uva-blue-alt-A, #005679), #91d8f2);\n --uva-color-button-subtle-bg: light-dark(var(--uva-blue-alt-300, #bfe7f7), #0d3247);\n --uva-color-button-subtle-hover-bg: light-dark(var(--uva-blue-alt-200, #91d8f2), #134a66);\n /* <site-alerts>: library.virginia.edu's alert colours, and a muted dark palette. Text\n is 7:1 or more (WCAG AAA) on every alert background in both schemes. */\n --uva-color-alert-text: light-dark(var(--uva-grey-darkest, #2b2b2b), #e8e8e8);\n --uva-color-alert-link: light-dark(var(--uva-blue-alt-B, #141e3c), #ffffff);\n --uva-color-alert-header-bg: light-dark(var(--uva-teal, #25cad3), #0e4a57);\n --uva-color-alert-header-text: light-dark(#000000, #e8e8e8);\n --uva-color-alert-critical-bg: light-dark(var(--uva-red-100, #fbcfda), #4a1622);\n --uva-color-alert-critical-border: light-dark(var(--uva-red-B, #b30000), #ef3f6b);\n --uva-color-alert-warning-bg: light-dark(var(--uva-yellow-100, #fef6c8), #3d3510);\n --uva-color-alert-warning-border: light-dark(var(--uva-yellow, #ecc602), #ecc602);\n --uva-color-alert-info-bg: light-dark(var(--uva-blue-alt-300, #bfe7f7), #0d3247);\n --uva-color-alert-info-border: light-dark(var(--uva-blue-alt, #007bac), #55c4ec);\n --uva-color-alert-regional-bg: light-dark(var(--uva-yellow-100, #fef6c8), #3d3510);\n --uva-color-alert-regional-border: light-dark(var(--uva-yellow, #ecc602), #ecc602);\n --uva-color-alert-regional-info-bg: light-dark(var(--uva-teal-200, #c8f2f4), #0f3a3d);\n --uva-color-alert-regional-info-border: light-dark(var(--uva-teal, #25cad3), #25cad3);\n /* base.css's success badge (.uvalib-badge--success), beside the alert colours the other\n status badges read: text (--uva-color-alert-text) is 7:1 or more in both schemes. */\n --uva-color-status-success-bg: light-dark(var(--uva-green-200, #ddefdc), #173d1c);\n --uva-color-status-success-border: light-dark(var(--uva-green-A, #4e9737), #62bb46);\n /* Highlighted search terms (<mark> in base.css's .uvalib-result__snippet):\n library.virginia.edu's orange-200 with dark text (9.5:1), and a dark orange with white\n text (7.6:1). */\n --uva-color-highlight: light-dark(var(--uva-brand-orange-200, #ffc999), #854200);\n --uva-color-on-highlight: light-dark(var(--uva-grey-darkest, #2b2b2b), #ffffff);\n /* base.css's .uvalib-table: the row rules (decorative) and the stripes, where body text\n is 12.5:1 in light and 12.6:1 in dark (AAA); muted text 6.7:1 and 6.9:1. */\n --uva-color-table-border: light-dark(var(--uva-grey-100, #dadada), #4f5a7a);\n --uva-color-table-stripe: light-dark(var(--uva-grey-200, #f1f1f1), #1a2340);\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/** The analytics category. */\nconst TAG = 'site-header';\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 * `site-name` shows a sub-site's name after the logo, past a thin divider, as a link to the\n * site's home (`site-name-href`, default `/`); the logo still links to library.virginia.edu.\n * The name is not a heading (the page keeps its own `<h1>`) and its link is named\n * \"<name> home\". On wide screens it sits in the logo row, wrapping to at most two lines (keep\n * it short), so the header is no taller, while the links (and theme control) fit beside it on\n * one line; when they would not, and at 992px and below, it gets its own lines under the\n * logo, so the links are laid out exactly as without it. The `vendor` variant shows it too.\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 `<site-alerts show=\"header\">`), shown as a full-bleed row at the very top of `<header>` (flush with its top and both edges, outside its padding), after the skip link and before the logo row. In light mode the children are moved to the start of `<header>`. The header never loads alerts itself.\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); `['site-header', 'link-click', <label>]` for a utility or site link, `['site-header', 'logo-click']`, `['site-header', 'site-name-click']` (the `site-name` link), `['site-header', 'skip-link']` (a slotted skip link) and `['site-header', 'menu-open']` when the Menu popover opens; and the main navigation's menu opens and link clicks (see `<site-main-nav>`). Never a URL. Bubbles and is composed.\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 // site-name (.brand, .site-name): the logo, a divider and the site's name, centred on the\n // logo, at most two lines (10em, 18em from 1200px), so the logo row is no taller and the\n // utility links keep their room down to 993px. At 992px and below the name gets its own lines\n // under the logo, no wider than it, so the logo column is exactly as wide as before and the\n // Menu button (or vendor link) keeps its place.\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, .brand) {\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 .brand {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.25rem 0.625rem;\n min-inline-size: 0;\n }\n .site-name {\n max-inline-size: 10em;\n padding-inline-start: 0.625rem;\n border-inline-start: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n font-size: 1.125rem;\n font-weight: 700;\n line-height: 1.2;\n text-decoration: none;\n overflow-wrap: anywhere;\n }\n .site-name:hover {\n text-decoration: underline;\n }\n @media screen and (min-width: 1200px) {\n .site-name {\n max-inline-size: 18em;\n }\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 .brand {\n max-inline-size: 225px;\n }\n .site-name {\n flex-basis: 100%;\n max-inline-size: none;\n padding: 0;\n border: 0;\n }\n }\n .brand.stacked {\n max-inline-size: 225px;\n }\n .stacked > .site-name {\n flex-basis: 100%;\n max-inline-size: none;\n padding: 0;\n border: 0;\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 /**\n * The sub-site's name, shown after the library logo as a link to the site's home\n * (`site-name-href`). The logo still links to library.virginia.edu. Not a heading.\n */\n @property({ type: String, attribute: 'site-name' }) siteName?: string;\n /** Where the site name links (default `/`, the site's own home). */\n @property({ type: String, attribute: 'site-name-href' }) siteNameHref?: 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 this.addEventListener('click', this.trackClick);\n }\n\n /**\n * Analytics for the header's own links (never their URLs): the logo, the utility or site\n * links by label, and a skip link slotted into `skip-link`. Links inside the main\n * navigation (it reports its own) and the alerts are left alone.\n */\n private trackClick = (e: Event): void => {\n const path = e.composedPath();\n const a = path.find((n): n is HTMLAnchorElement => n instanceof HTMLAnchorElement);\n if (\n !a ||\n path.some((n) => n instanceof Element && /^site-(main-nav|alerts)$/.test(n.localName))\n )\n return;\n if (a.slot === 'skip-link' && a.parentNode === this) trackEvent(this, [TAG, 'skip-link']);\n else if (a.matches('.logo')) trackEvent(this, [TAG, 'logo-click']);\n else if (a.matches('.site-name')) trackEvent(this, [TAG, 'site-name-click']);\n else if (a.closest('nav.inline, nav.menu') && this.renderRoot.contains(a))\n trackEvent(this, [TAG, 'link-click', a.textContent!.replace(/\\s+/g, ' ').trim()]);\n };\n\n /** The Menu popover opening (not closing). */\n private trackToggle = (e: Event): void => {\n const t = e.composedPath()[0];\n if (t instanceof HTMLElement && t.id === this.menuId && (e as ToggleEvent).newState === 'open')\n trackEvent(this, [TAG, 'menu-open']);\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 // Fitted on the next frame, outside the observer's callback: the fit changes the height.\n this.resizeObserver ??= new ResizeObserver(() =>\n requestAnimationFrame(() => {\n if (this.getBoundingClientRect().width !== this.fittedWidth) this.fitName();\n }),\n );\n this.resizeObserver.observe(this);\n // The web font is narrower than its fallback: fit again once it has loaded.\n void this.ownerDocument.fonts?.ready.then(() => this.fitName());\n // `toggle` neither bubbles nor leaves the shadow root: capture it on the render root\n // (adding the same listener again on a reconnect does nothing).\n this.renderRoot.addEventListener('toggle', this.trackToggle, true);\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.resizeObserver?.disconnect();\n this.observer?.disconnect();\n }\n\n /** Which header template render() uses: with dark mode, with a site name, or neither. */\n private get template(): string {\n return this.scheme.active ? 'scheme' : this.name ? 'named' : 'plain';\n }\n private renderedTemplate?: string;\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('colorSchemeSwitch')) this.scheme.sync();\n // Light mode: turning dark mode or the site name on or off swaps the header template, and\n // Lit clears everything after its start marker: the alerts moved into the old <header>\n // and the hidden source holders. Move them before the marker; updated() re-adopts the\n // alerts.\n const was = this.renderedTemplate;\n this.renderedTemplate = this.template;\n if (this.lightDom && this.hasUpdated && was !== this.renderedTemplate) {\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 this.templateSwapped = true;\n }\n }\n private templateSwapped = false;\n\n protected override updated(): void {\n this.fitName();\n if (!this.templateSwapped) return;\n this.templateSwapped = false;\n this.adoptAlerts();\n }\n\n /** Watches the host's width, so the site name is re-fitted when it changes. */\n private resizeObserver?: ResizeObserver;\n private fittedWidth = -1;\n\n /**\n * Wide screens: the site name shares the logo row only while the links (and the theme\n * control) still fit on one line beside it; otherwise it goes under the logo, as on narrow\n * screens, so nothing overflows or wraps. Always measured with the name in the row, so the\n * result depends on the width alone and never flips back and forth.\n */\n private fitName = (): void => {\n const brand = this.renderRoot.querySelector<HTMLElement>('.brand');\n if (!brand) return;\n this.fittedWidth = this.getBoundingClientRect().width;\n brand.classList.remove('stacked');\n if (!matchMedia('screen and (min-width: 993px)').matches) return;\n const header = brand.parentElement!;\n const row = header.querySelector<HTMLElement>(':scope > .utility-row, :scope > nav.inline');\n if (!row) return;\n const edge =\n header.getBoundingClientRect().right - parseFloat(getComputedStyle(header).paddingRight);\n const items = [...row.querySelectorAll('nav.inline li')];\n const top = items[0]?.getBoundingClientRect().top;\n const crowded =\n row.getBoundingClientRect().right > edge + 0.5 ||\n row.scrollWidth > row.clientWidth + 0.5 ||\n items.some(\n (li) =>\n Math.abs(li.getBoundingClientRect().top - top!) > 0.5 ||\n li.querySelector('a')!.getClientRects().length > 1,\n );\n brand.classList.toggle('stacked', crowded);\n };\n\n protected override firstUpdated(): void {\n this.syncChildren();\n }\n\n /** The site name, trimmed, or empty for none. */\n private get name(): string {\n return (this.siteName ?? '').replace(/\\s+/g, ' ').trim();\n }\n\n /**\n * The logo, and with `site-name` the site's name after it. Their link names differ (\"UVA\n * Library home\", \"<name> home\"), and each starts with its visible text, for voice control.\n */\n private brand() {\n const logo = html`<a class=\"logo\" href=${siteLink(this.rootLinkDomain, '/')}\n ><img src=${this.logoSrc()} alt=\"UVA Library home\" width=\"304\" height=\"69\"\n /></a>`;\n const name = this.name;\n if (!name) return logo;\n return html`<div class=\"brand\">\n ${logo}<a class=\"site-name\" href=${this.siteNameHref || '/'} aria-label=${`${name} home`}\n >${name}</a\n >\n </div>`;\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, [TAG, '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 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 ${this.brand()}\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 const end = vendor ? nothing : mainNav ? withMainNav : classic;\n const hidden = this.lightDom ? nothing : mainNav ? withMainNavHidden : classicHidden;\n // A template of its own, so the header without a site name stays byte-identical.\n if (this.name)\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 ${this.brand()}\n <nav class=\"inline\" aria-label=${label}>\n <ul>\n ${items}\n </ul>\n </nav>\n ${end}\n </header>\n ${hidden}\n `;\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 ${end}\n </header>\n ${hidden}\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":";;;;;;;AAmBA,IAAMsB,IAAOtB,EAAU,oCAAQ,GAOzBuB,IAAiB,qDAEVC,IAAc,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoEtBF,EAAK;;;QAGLtB,EAAUuB,CAAc,EAAE;;;;UAIxBD,EAAK;;;UAGLtB,EAAUuB,CAAc,EAAE;;;;GChGvBE,IAA2B,uBAE3BC,IAAoB,yBAE3BC,IAAS,8BACTC,IAAa,gCAGbC,oBAAS,IAAI,QAAyC,GAEtDC,KAAgB,MACpBC,MAAM,WAAWA,MAAM,SAASA,IAAI;AAGtC,SAAgBC,EAAqB,IAAgB,UAAmB;CACtE,IAAMC,IAAMC,EAAI,aAAa;CAC7B,IAAI;EACF,OAAO,CAAC,CAACD,GAAK,WAAW,SAAS,wBAAwB;CAC5D,QAAQ;EACN,OAAO;CACT;AACF;AAGA,SAAgBE,EAAe,IAAgB,UAAiC;CAC9E,IAAMC,IAAOP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WAAA,YAAA,KAAA,CAAA,GAEjD/E,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAiB,CAAC,CAAA,GAAA8E,EAAA,WAAA,gBAAA,KAAA,CAAA,GAGtD/E,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAS,WAAW;AAAc,CAAC,CAAA,GAAA8E,EAAA,WAAA,aAAA,KAAA,CAAA,GAEpD/E,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAiB,CAAC,CAAA,GAAA8E,EAAA,WAAA,gBAAA,KAAA,CAAA,GAEtD/E,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAA8E,EAAA,WAAA,cAAA,KAAA,CAAA,GAKpD/E,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAmB,CAAC,CAAA,GAAA8E,EAAA,WAAA,kBAAA,KAAA,CAAA,GAUxD/E,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAS,WAAW;AAAsB,CAAC,CAAA,GAAA8E,EAAA,WAAA,qBAAA,KAAA,CAAA,GAU5D/E,EAAA,CAAAE,EAAM,CAAA,GAAA6E,EAAA,WAAA,gBAAA,KAAA,CAAA,GAMN/E,EAAA,CAAAE,EAAM,CAAA,GAAA6E,EAAA,WAAA,aAAA,KAAA,CAAA,GChdTxE,EAAO,eAAewE,CAAU;AAIhC,IAAMkD,IAAa,eAAe,IAAI,eAAe;AACjDA,KAAcA,MAAe/G,KAC/B,QAAQ,KACN,gKACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { a as e, f as t, i as n, l as r, m as i, n as a,
|
|
1
|
+
import { a as e, f as t, i as n, l as r, m as i, n as a, p as o, r as s, t as c } from "./UvalibElement-pGONDAwB.js";
|
|
2
|
+
import { t as l } from "./if-defined-COiQb-gl.js";
|
|
2
3
|
import { a as u } from "./analytics-DTTihuBD.js";
|
|
3
4
|
import { t as d } from "./accessible-DJv7YOtS.js";
|
|
4
5
|
import { t as f } from "./link-DbJSwj16.js";
|
|
5
|
-
//
|
|
6
|
-
var p = (e) =>
|
|
7
|
-
function
|
|
6
|
+
// src/components/site-main-nav/main-nav-items.ts
|
|
7
|
+
var p = (e) => typeof e == "string" ? e.replace(/\s+/g, " ").trim() : "";
|
|
8
|
+
function m(e) {
|
|
8
9
|
let t = {
|
|
9
10
|
items: [],
|
|
10
11
|
invalid: !1,
|
|
@@ -13,7 +14,7 @@ function h(e) {
|
|
|
13
14
|
if (!Array.isArray(e)) return t.invalid = e != null, t;
|
|
14
15
|
let n = (e, r, i) => {
|
|
15
16
|
for (let a of e) {
|
|
16
|
-
let e = a ?? {}, o =
|
|
17
|
+
let e = a ?? {}, o = p(e.label), s = p(e.href), c = Array.isArray(e.items) && e.items.length ? e.items : null;
|
|
17
18
|
c ? (t.flattened = !0, o && s && r.push({
|
|
18
19
|
label: o,
|
|
19
20
|
href: s
|
|
@@ -24,7 +25,7 @@ function h(e) {
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
for (let r of e) {
|
|
27
|
-
let e = r ?? {}, i =
|
|
28
|
+
let e = r ?? {}, i = p(e.label), a = p(e.href), o = Array.isArray(e.items) && e.items.length ? e.items : null;
|
|
28
29
|
if (!i) t.invalid = !0;
|
|
29
30
|
else if (o) {
|
|
30
31
|
let e = [];
|
|
@@ -42,15 +43,15 @@ function h(e) {
|
|
|
42
43
|
}
|
|
43
44
|
return t;
|
|
44
45
|
}
|
|
45
|
-
var
|
|
46
|
-
function
|
|
46
|
+
var h = (e) => (e.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
47
|
+
function g(e) {
|
|
47
48
|
let t = e.localName === "ul" ? e : e.querySelector(":scope > ul") ?? void 0;
|
|
48
49
|
if (!t) return [{}];
|
|
49
50
|
let n = (e) => {
|
|
50
51
|
if (e.localName !== "li") return {};
|
|
51
52
|
let t = [...e.children], r = t.find((e) => e.localName === "ul"), i = t.find((e) => e.localName !== "ul");
|
|
52
53
|
if (!i) return {};
|
|
53
|
-
let a =
|
|
54
|
+
let a = h(i), o = i.localName === "a" ? i.getAttribute("href") : null;
|
|
54
55
|
return r ? {
|
|
55
56
|
label: a,
|
|
56
57
|
href: o,
|
|
@@ -62,17 +63,17 @@ function _(e) {
|
|
|
62
63
|
};
|
|
63
64
|
return [...t.children].map(n);
|
|
64
65
|
}
|
|
65
|
-
var
|
|
66
|
+
var _ = {
|
|
66
67
|
attempts: 2,
|
|
67
68
|
retryDelay: 1e3,
|
|
68
69
|
timeout: 1e4
|
|
69
70
|
};
|
|
70
|
-
async function
|
|
71
|
-
let t, n = Math.max(1,
|
|
71
|
+
async function v(e) {
|
|
72
|
+
let t, n = Math.max(1, _.attempts);
|
|
72
73
|
for (let r = 0; r < n; r++) {
|
|
73
|
-
r > 0 && await new Promise((e) => setTimeout(e,
|
|
74
|
+
r > 0 && await new Promise((e) => setTimeout(e, _.retryDelay));
|
|
74
75
|
try {
|
|
75
|
-
let t = await fetch(e, { signal: AbortSignal.timeout(
|
|
76
|
+
let t = await fetch(e, { signal: AbortSignal.timeout(_.timeout) });
|
|
76
77
|
if (!t.ok) throw Error(`${t.status} ${t.statusText} for ${e}`);
|
|
77
78
|
return await t.json();
|
|
78
79
|
} catch (e) {
|
|
@@ -81,23 +82,23 @@ async function y(e) {
|
|
|
81
82
|
}
|
|
82
83
|
throw t instanceof Error ? t : Error(String(t));
|
|
83
84
|
}
|
|
84
|
-
var
|
|
85
|
-
function
|
|
86
|
-
let t =
|
|
85
|
+
var y = /* @__PURE__ */ new Map();
|
|
86
|
+
function b(e) {
|
|
87
|
+
let t = y.get(e);
|
|
87
88
|
if (!t) {
|
|
88
|
-
let n =
|
|
89
|
-
let n =
|
|
89
|
+
let n = v(e).then((t) => {
|
|
90
|
+
let n = m(t);
|
|
90
91
|
if (!n.items.length) throw Error(`no valid main navigation entries in ${e}`);
|
|
91
92
|
return n;
|
|
92
93
|
});
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
y.set(e, t = n), n.catch(() => {
|
|
95
|
+
y.get(e) === n && y.delete(e);
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
return t;
|
|
98
99
|
}
|
|
99
100
|
// src/components/site-main-nav/main-nav-data.ts
|
|
100
|
-
var
|
|
101
|
+
var x = [
|
|
101
102
|
{
|
|
102
103
|
label: "About",
|
|
103
104
|
items: [
|
|
@@ -182,8 +183,8 @@ var S = [
|
|
|
182
183
|
}
|
|
183
184
|
]
|
|
184
185
|
}
|
|
185
|
-
],
|
|
186
|
-
function
|
|
186
|
+
], S = 0, C = "main-nav", w = (e) => e instanceof Element && e.getAttribute("slot") === C, T = ["href", "slot"], E = "\n .toggle:focus-visible,\n .top-link:focus-visible,\n .panel a:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: -4px;\n }\n .toggle[aria-expanded='true']:focus-visible,\n .toggle:hover:focus-visible,\n .top-link:hover:focus-visible,\n .panel a:hover:focus-visible {\n outline-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n", D = o(E), O = (e) => o(E.replace(/(^|,)\s*\./gm, `$1 ${e} .`));
|
|
187
|
+
function k(e, t) {
|
|
187
188
|
try {
|
|
188
189
|
let n = new URL(e, t);
|
|
189
190
|
return `${n.host.replace(/^www\./, "")}${n.pathname.replace(/\/+$/, "")}`;
|
|
@@ -191,15 +192,15 @@ function A(e, t) {
|
|
|
191
192
|
return null;
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
|
-
var
|
|
195
|
+
var A = (e, t) => {
|
|
195
196
|
try {
|
|
196
197
|
return new URL(e, t).hash;
|
|
197
198
|
} catch {
|
|
198
199
|
return "";
|
|
199
200
|
}
|
|
200
|
-
},
|
|
201
|
+
}, j = class extends c {
|
|
201
202
|
constructor(...e) {
|
|
202
|
-
super(...e), this.label = "Main", this.rootLinkDomain = "https://www.library.virginia.edu", this.layout = "bar", this.slotItems = null, this.fetched = null, this.open = null, this.propItems = null, this.warned = /* @__PURE__ */ new Set(), this.idBase = `main-nav-${++
|
|
203
|
+
super(...e), this.label = "Main", this.rootLinkDomain = "https://www.library.virginia.edu", this.layout = "bar", this.slotItems = null, this.fetched = null, this.open = null, this.propItems = null, this.warned = /* @__PURE__ */ new Set(), this.idBase = `main-nav-${++S}`, this.onLocationChange = () => {
|
|
203
204
|
this.current || this.requestUpdate();
|
|
204
205
|
}, this.listeningLocation = !1, this.onOutsidePointer = (e) => {
|
|
205
206
|
let t = this.navEl;
|
|
@@ -282,7 +283,7 @@ var j = (e, t) => {
|
|
|
282
283
|
background-color: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));
|
|
283
284
|
text-decoration: none;
|
|
284
285
|
}
|
|
285
|
-
${
|
|
286
|
+
${D}
|
|
286
287
|
/* Current page, and the group holding it: bold with a thick underline, not colour alone. */
|
|
287
288
|
[aria-current]:not([aria-current='false']),
|
|
288
289
|
.panel a[aria-current]:not([aria-current='false']):hover {
|
|
@@ -365,7 +366,7 @@ var j = (e, t) => {
|
|
|
365
366
|
`];
|
|
366
367
|
}
|
|
367
368
|
installLightStyles(e) {
|
|
368
|
-
super.installLightStyles(e),
|
|
369
|
+
super.installLightStyles(e), s(`${this.localName}-focus`, [O(this.localName)], {
|
|
369
370
|
root: e,
|
|
370
371
|
scope: !1,
|
|
371
372
|
layer: !1
|
|
@@ -409,19 +410,19 @@ var j = (e, t) => {
|
|
|
409
410
|
return e.invalid && this.warnOnce("invalid", t), e.flattened && this.warnOnce("flattened", t), e.items.length ? e.items : null;
|
|
410
411
|
}
|
|
411
412
|
adoptSource() {
|
|
412
|
-
let e = [...this.children].filter(
|
|
413
|
+
let e = [...this.children].filter(w);
|
|
413
414
|
return e.length && !this.holder && (this.holder = document.createElement("div"), this.holder.hidden = !0, this.holder.className = "main-nav-source"), this.holder && (this.holder.append(...e), this.holder.parentNode !== this && this.append(this.holder)), this.holder ? [...this.holder.children] : [];
|
|
414
415
|
}
|
|
415
416
|
syncSource() {
|
|
416
|
-
let e = this.lightDom ? this.adoptSource() : [...this.children].filter(
|
|
417
|
+
let e = this.lightDom ? this.adoptSource() : [...this.children].filter(w), t = null;
|
|
417
418
|
if (e.length) {
|
|
418
|
-
let n = e.flatMap((e, t) => t === 0 ?
|
|
419
|
-
t = this.use(
|
|
419
|
+
let n = e.flatMap((e, t) => t === 0 ? g(e) : [{}]);
|
|
420
|
+
t = this.use(m(n), "slot=\"main-nav\"");
|
|
420
421
|
}
|
|
421
422
|
JSON.stringify(t) !== JSON.stringify(this.slotItems) && (this.slotItems = t), this.observer ??= new MutationObserver(() => this.syncSource()), this.observer.disconnect();
|
|
422
423
|
let n = {
|
|
423
424
|
attributes: !0,
|
|
424
|
-
attributeFilter:
|
|
425
|
+
attributeFilter: T,
|
|
425
426
|
characterData: !0,
|
|
426
427
|
childList: !0,
|
|
427
428
|
subtree: !0
|
|
@@ -429,9 +430,9 @@ var j = (e, t) => {
|
|
|
429
430
|
this.lightDom ? (this.observer.observe(this, { childList: !0 }), this.holder && this.observer.observe(this.holder, n)) : this.observer.observe(this, n);
|
|
430
431
|
}
|
|
431
432
|
willUpdate(e) {
|
|
432
|
-
e.has("items") && (this.propItems = this.items == null ? null : this.use(
|
|
433
|
+
e.has("items") && (this.propItems = this.items == null ? null : this.use(m(this.items), "items")), e.has("itemsSrc") && this.fetchedFor !== this.itemsSrc && (this.fetched = null, this.fetchedFor = void 0);
|
|
433
434
|
let t = this.itemsSrc;
|
|
434
|
-
t && !this.slotItems && !this.propItems && this.fetchedFor !== t && (this.fetchedFor = t,
|
|
435
|
+
t && !this.slotItems && !this.propItems && this.fetchedFor !== t && (this.fetchedFor = t, b(t).then((e) => {
|
|
435
436
|
this.itemsSrc === t && (this.fetched = this.use(e, "items-src"));
|
|
436
437
|
}, (e) => {
|
|
437
438
|
this.itemsSrc === t && this.dispatchEvent(new CustomEvent("site-main-nav-error", {
|
|
@@ -450,7 +451,7 @@ var j = (e, t) => {
|
|
|
450
451
|
(e.has("open") || e.has("layout")) && this.listenOutside(this.isConnected && this.open !== null && this.layout === "bar");
|
|
451
452
|
}
|
|
452
453
|
get shown() {
|
|
453
|
-
return this.slotItems ?? this.propItems ?? this.fetched ??
|
|
454
|
+
return this.slotItems ?? this.propItems ?? this.fetched ?? x;
|
|
454
455
|
}
|
|
455
456
|
get navEl() {
|
|
456
457
|
return this.renderRoot.querySelector("nav.main-nav");
|
|
@@ -534,10 +535,10 @@ var j = (e, t) => {
|
|
|
534
535
|
return `${this.idBase}-${e}`;
|
|
535
536
|
}
|
|
536
537
|
currentHref(e) {
|
|
537
|
-
let t = this.current || this.ownerDocument.defaultView?.location.href || "", n = this.ownerDocument.baseURI, r =
|
|
538
|
+
let t = this.current || this.ownerDocument.defaultView?.location.href || "", n = this.ownerDocument.baseURI, r = k(t, n);
|
|
538
539
|
if (!r) return null;
|
|
539
|
-
let i = e.filter((e) =>
|
|
540
|
-
return i.find((e) => a &&
|
|
540
|
+
let i = e.filter((e) => k(e, n) === r), a = A(t, n);
|
|
541
|
+
return i.find((e) => a && A(e, n) === a) ?? i.find((e) => !A(e, n)) ?? (a ? null : i[0]) ?? null;
|
|
541
542
|
}
|
|
542
543
|
resolve(e) {
|
|
543
544
|
return e.startsWith("#") ? e : f(this.rootLinkDomain, e);
|
|
@@ -575,28 +576,28 @@ var j = (e, t) => {
|
|
|
575
576
|
if (!e.items) {
|
|
576
577
|
let t = !a && i(e.href);
|
|
577
578
|
return t && (a = !0), r`<li>
|
|
578
|
-
<a class="top-link" href=${e.href} aria-current=${
|
|
579
|
+
<a class="top-link" href=${e.href} aria-current=${l(t || void 0)}
|
|
579
580
|
>${e.label}</a
|
|
580
581
|
>
|
|
581
582
|
</li>`;
|
|
582
583
|
}
|
|
583
|
-
let o = this.panelId(t), s = this.open === t, c = !a && e.items.some((e) => e.href === n),
|
|
584
|
+
let o = this.panelId(t), s = this.open === t, c = !a && e.items.some((e) => e.href === n), u = !1;
|
|
584
585
|
return c && (a = !0), r`<li>
|
|
585
586
|
<button
|
|
586
587
|
type="button"
|
|
587
588
|
class="toggle"
|
|
588
589
|
aria-expanded=${s ? "true" : "false"}
|
|
589
590
|
aria-controls=${o}
|
|
590
|
-
aria-current=${
|
|
591
|
+
aria-current=${l(c ? "true" : void 0)}
|
|
591
592
|
@click=${() => this.onToggle(t)}
|
|
592
593
|
>
|
|
593
594
|
${e.label}
|
|
594
595
|
</button>
|
|
595
596
|
<ul class="panel" id=${o} ?hidden=${!s}>
|
|
596
597
|
${e.items.map((e) => {
|
|
597
|
-
let t = c && !
|
|
598
|
-
return t && (
|
|
599
|
-
<a href=${e.href} aria-current=${
|
|
598
|
+
let t = c && !u && e.href === n;
|
|
599
|
+
return t && (u = !0), r`<li>
|
|
600
|
+
<a href=${e.href} aria-current=${l(t ? "page" : void 0)}
|
|
600
601
|
>${e.label}</a
|
|
601
602
|
>
|
|
602
603
|
</li>`;
|
|
@@ -609,13 +610,13 @@ var j = (e, t) => {
|
|
|
609
610
|
}
|
|
610
611
|
};
|
|
611
612
|
// src/components/site-main-nav/site-main-nav.ts
|
|
612
|
-
a([e({ type: String })],
|
|
613
|
+
a([e({ type: String })], j.prototype, "label", void 0), a([e({
|
|
613
614
|
type: String,
|
|
614
615
|
attribute: "root-link-domain"
|
|
615
|
-
})],
|
|
616
|
+
})], j.prototype, "rootLinkDomain", void 0), a([e({
|
|
616
617
|
type: String,
|
|
617
618
|
attribute: "items-src"
|
|
618
|
-
})],
|
|
619
|
-
export {
|
|
619
|
+
})], j.prototype, "itemsSrc", void 0), a([e({ type: String })], j.prototype, "layout", void 0), a([e({ type: String })], j.prototype, "current", void 0), a([e({ attribute: !1 })], j.prototype, "items", void 0), a([n()], j.prototype, "slotItems", void 0), a([n()], j.prototype, "fetched", void 0), a([n()], j.prototype, "open", void 0), i("site-main-nav", j);
|
|
620
|
+
export { m as n, g as r, j as t };
|
|
620
621
|
|
|
621
|
-
//# sourceMappingURL=site-main-nav-
|
|
622
|
+
//# sourceMappingURL=site-main-nav-CmMq2t8t.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-main-nav-CmMq2t8t.js","names":["unsafeCSS","ifDefined","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","o","trackEvent","accessible","siteLink","str","v","normalizeItems","out","raw","collect","nodes","label","href","kids","into","depth","links","text","el","readItemsMarkup","list","source","readLi","li","sub","k","head","mainNavTiming","fetchJson","error","attempts","response","url","cache","loadMainNavItems","p","promise","result","json","MAIN_NAV_SNAPSHOT","\"label\"","\"items\"","\"href\"","navCounter","MAIN_NAV","isSourceChild","SOURCE_ATTRS","FOCUS_RULES","focusRules","lightFocusRules","tag","pageKey","u","base","hashOf","SiteMainNav","_args","nav","root","win","on","target","type","kind","what","moved","sources","next","s","content","changed","src","key","index","opening","doc","to","tops","top","open","openButton","panel","button","here","matches","hrefs","h","hash","a","group","items","item","l","all","current","mark","marked","cur","id","expanded","has","linkMarked"],"sources":["../../src/components/site-main-nav/main-nav-items.ts","../../src/components/site-main-nav/main-nav-data.ts","../../src/components/site-main-nav/SiteMainNav.ts","../../src/components/site-main-nav/site-main-nav.ts"],"sourcesContent":["// Data helpers for <site-main-nav>: the item types, normalising items from any source\n// (property, JSON, markup) to the two levels the nav shows, and the `items-src` loader.\n// Internal apart from the types. No side effects on import.\n\n/** A link inside a main-navigation group. */\nexport interface MainNavLink {\n label: string;\n href: string;\n}\n\n/**\n * One top-level main-navigation entry: a group (a button that discloses `items`) or, with\n * no `items`, a direct link to `href`. A group's own `href` is not shown.\n */\nexport interface MainNavItem {\n label: string;\n href?: string;\n items?: MainNavLink[];\n}\n\n/** What normalising found besides the items: skipped entries, flattened deeper levels. */\nexport interface NormalizeResult {\n items: MainNavItem[];\n invalid: boolean;\n flattened: boolean;\n}\n\nconst str = (v: unknown): string => (typeof v === 'string' ? v.replace(/\\s+/g, ' ').trim() : '');\n\n/**\n * Reduce untrusted items (a property, JSON or parsed markup) to the two levels the nav\n * shows. Entries without a label, links without an href, and groups with no valid links\n * are skipped (`invalid`); links nested deeper than a group are lifted into it\n * (`flattened`), and a deeper level's own label is dropped unless it has an href.\n */\nexport function normalizeItems(raw: unknown): NormalizeResult {\n const out: NormalizeResult = { items: [], invalid: false, flattened: false };\n if (!Array.isArray(raw)) {\n out.invalid = raw != null;\n return out;\n }\n const collect = (nodes: unknown[], into: MainNavLink[], depth: number): void => {\n for (const n of nodes) {\n const o = (n ?? {}) as Record<string, unknown>;\n const label = str(o.label);\n const href = str(o.href);\n const kids = Array.isArray(o.items) && o.items.length ? o.items : null;\n if (kids) {\n out.flattened = true;\n if (label && href) into.push({ label, href });\n collect(kids, into, depth + 1);\n } else if (label && href) {\n into.push({ label, href });\n } else {\n out.invalid = true;\n }\n }\n };\n for (const n of raw) {\n const o = (n ?? {}) as Record<string, unknown>;\n const label = str(o.label);\n const href = str(o.href);\n const kids = Array.isArray(o.items) && o.items.length ? o.items : null;\n if (!label) {\n out.invalid = true;\n } else if (kids) {\n const links: MainNavLink[] = [];\n collect(kids, links, 2);\n if (links.length) out.items.push({ label, items: links });\n else if (href) out.items.push({ label, href });\n else out.invalid = true;\n } else if (href) {\n out.items.push({ label, href });\n } else {\n out.invalid = true;\n }\n }\n return out;\n}\n\nconst text = (el: Element): string => (el.textContent ?? '').replace(/\\s+/g, ' ').trim();\n\n/**\n * Read `<nav><ul><li>…</li></ul></nav>` (or a bare `<ul>`) markup into raw items: an\n * `<li>` holding an `<a href>` (and no list) is a direct link; an `<li>` whose first child\n * element is a label (`<span>`, or any element but a list) followed by a `<ul>` is a group.\n * Anything else is reported as invalid by normalizeItems().\n */\nexport function readItemsMarkup(source: Element): unknown[] {\n const list =\n source.localName === 'ul' ? source : (source.querySelector(':scope > ul') ?? undefined);\n if (!list) return [{}];\n const readLi = (li: Element): unknown => {\n if (li.localName !== 'li') return {};\n const kids = [...li.children];\n const sub = kids.find((k) => k.localName === 'ul');\n const head = kids.find((k) => k.localName !== 'ul');\n if (!head) return {};\n const label = text(head);\n const href = head.localName === 'a' ? head.getAttribute('href') : null;\n if (!sub) return head.localName === 'a' ? { label, href } : { label };\n return { label, href, items: [...sub.children].map(readLi) };\n };\n return [...list.children].map(readLi);\n}\n\n/**\n * `items-src` fetch: how many attempts, the delay between them (ms) and each attempt's\n * timeout (ms). With the defaults a hung server is given up on after about 21 s.\n */\nexport const mainNavTiming = { attempts: 2, retryDelay: 1000, timeout: 10_000 };\n\nasync function fetchJson(url: string): Promise<unknown> {\n let error: unknown;\n const attempts = Math.max(1, mainNavTiming.attempts);\n for (let i = 0; i < attempts; i++) {\n if (i > 0) await new Promise((r) => setTimeout(r, mainNavTiming.retryDelay));\n try {\n // A hung attempt times out and counts as a failed attempt.\n const response = await fetch(url, { signal: AbortSignal.timeout(mainNavTiming.timeout) });\n if (!response.ok) throw new Error(`${response.status} ${response.statusText} for ${url}`);\n return await response.json();\n } catch (e) {\n error = e;\n }\n }\n throw error instanceof Error ? error : new Error(String(error));\n}\n\nconst cache = new Map<string, Promise<NormalizeResult>>();\n\n/**\n * The items at `url` (JSON in the `MainNavItem[]` shape), fetched once per URL and shared by\n * every nav on the page. A response with no valid entries is an error. Failures are not\n * cached, so a later load tries again.\n */\nexport function loadMainNavItems(url: string): Promise<NormalizeResult> {\n let p = cache.get(url);\n if (!p) {\n const promise = fetchJson(url).then((json) => {\n const result = normalizeItems(json);\n if (!result.items.length) throw new Error(`no valid main navigation entries in ${url}`);\n return result;\n });\n cache.set(url, (p = promise));\n promise.catch(() => {\n if (cache.get(url) === promise) cache.delete(url);\n });\n }\n return p;\n}\n","// GENERATED by scripts/sync-main-nav.mjs from a saved page on 2026-11-14 — do not edit.\n// The desktop \"Main navigation\" of library.virginia.edu. Regenerate with `pnpm sync:main-nav`.\nimport type { MainNavItem } from './main-nav-items.js';\n\n/** The day the snapshot was taken (YYYY-MM-DD). */\nexport const MAIN_NAV_SNAPSHOT_DATE = '2026-11-14';\n\n/** The library main navigation, as on library.virginia.edu when the snapshot was taken. */\nexport const MAIN_NAV_SNAPSHOT: readonly MainNavItem[] = [\n {\n \"label\": \"About\",\n \"items\": [\n {\n \"label\": \"About UVA Library\",\n \"href\": \"/about-uva-library\"\n },\n {\n \"label\": \"News & announcements\",\n \"href\": \"https://library.virginia.edu/news/all?mtm_campaign=main-nav\"\n },\n {\n \"label\": \"Plan a visit\",\n \"href\": \"/about-uva-library#visit\"\n },\n {\n \"label\": \"Library Assessment\",\n \"href\": \"/assessment\"\n },\n {\n \"label\": \"Staff directory\",\n \"href\": \"/staff\"\n }\n ]\n },\n {\n \"label\": \"Using the Library\",\n \"items\": [\n {\n \"label\": \"Search, borrow, request\",\n \"href\": \"/services\"\n },\n {\n \"label\": \"Library spaces\",\n \"href\": \"/spaces\"\n },\n {\n \"label\": \"Equipment & technology\",\n \"href\": \"/equipment-and-tech\"\n }\n ]\n },\n {\n \"label\": \"Research & teaching support\",\n \"items\": [\n {\n \"label\": \"Research & teaching support\",\n \"href\": \"/research-and-teaching\"\n },\n {\n \"label\": \"Research support\",\n \"href\": \"/research-and-teaching/research\"\n },\n {\n \"label\": \"Instruction assistance\",\n \"href\": \"/research-and-teaching/teach\"\n },\n {\n \"label\": \"Writing & publication\",\n \"href\": \"/research-and-teaching/write\"\n }\n ]\n },\n {\n \"label\": \"Get help\",\n \"items\": [\n {\n \"label\": \"Get help\",\n \"href\": \"/help\"\n },\n {\n \"label\": \"Ask a Librarian\",\n \"href\": \"/askalibrarian\"\n },\n {\n \"label\": \"Accessibility services\",\n \"href\": \"/accessibility\"\n },\n {\n \"label\": \"Subject specialists\",\n \"href\": \"https://guides.lib.virginia.edu/subjectlibrarians\"\n }\n ]\n }\n];\n","import { html, css, unsafeCSS, 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 { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { siteLink } from '../link.js';\nimport { MAIN_NAV_SNAPSHOT } from './main-nav-data.js';\nimport {\n loadMainNavItems,\n normalizeItems,\n readItemsMarkup,\n type MainNavItem,\n type NormalizeResult,\n} from './main-nav-items.js';\n\nexport type { MainNavItem, MainNavLink } from './main-nav-items.js';\n\n/** Light-DOM instances share the document id space, so every instance numbers its own ids. */\nlet navCounter = 0;\n\nconst MAIN_NAV = 'main-nav';\nconst isSourceChild = (n: Node): n is Element =>\n n instanceof Element && n.getAttribute('slot') === MAIN_NAV;\n/** Attributes of the source markup that change what the nav renders. */\nconst SOURCE_ATTRS = ['href', 'slot'];\n\n/**\n * Focus rings: inset (as on the live site) so an open panel or a neighbour never covers\n * them; orange on white, brand blue where the background is grey (hover, the open group),\n * so the ring keeps 3:1 contrast.\n */\nconst FOCUS_RULES = `\n .toggle:focus-visible,\n .top-link:focus-visible,\n .panel a:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: -4px;\n }\n .toggle[aria-expanded='true']:focus-visible,\n .toggle:hover:focus-visible,\n .top-link:hover:focus-visible,\n .panel a:hover:focus-visible {\n outline-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n`;\nconst focusRules = unsafeCSS(FOCUS_RULES);\n/** The focus rules scoped to `tag`, for the unlayered light-mode sheet. */\nconst lightFocusRules = (tag: string) =>\n unsafeCSS(FOCUS_RULES.replace(/(^|,)\\s*\\./gm, `$1 ${tag} .`));\n\n/** A URL reduced to what \"the same page\" means here: host (without `www.`) and path. */\nfunction pageKey(href: string, base: string): string | null {\n try {\n const u = new URL(href, base);\n return `${u.host.replace(/^www\\./, '')}${u.pathname.replace(/\\/+$/, '')}`;\n } catch {\n return null;\n }\n}\nconst hashOf = (href: string, base: string): string => {\n try {\n return new URL(href, base).hash;\n } catch {\n return '';\n }\n};\n\n/**\n * The UVA Library main navigation (About, Using the Library, Research & teaching support,\n * Get help), as on library.virginia.edu, following the WAI-ARIA disclosure navigation\n * pattern: one `<nav>` landmark; each group is a `<button aria-expanded aria-controls>`\n * followed by its list of links, and an entry with no group is a plain link. Click, Enter or\n * Space toggles a group and only one is open at a time; Escape closes it and returns focus to\n * its button; arrow keys, Home and End move between the buttons and between a panel's links,\n * and ArrowDown on an open button moves into its panel. In the `bar` layout a panel also closes\n * when focus leaves the nav or on a pointer press outside it. There is no hover-to-open.\n *\n * The items come from, in order of precedence: a `<nav slot=\"main-nav\">` child holding\n * `<ul><li><a href>…</a></li></ul>` (a direct link) or `<li><span>Group</span><ul><li><a href>…`\n * (a group), kept hidden and watched for changes; the `items` property; JSON at `items-src`;\n * and the snapshot of the live menu bundled with the component (see `pnpm sync:main-nav`).\n * Invalid entries are skipped and levels deeper than two are flattened, each with one console\n * warning. Relative hrefs are joined to `root-link-domain`; absolute ones are kept, and\n * fragment-only ones (`#…`, a hash route) stay on this page. A plain click on a link closes\n * the open group.\n *\n * The link for the current page (`current`, default the page location, followed through\n * same-document navigations; host and path, ignoring the query, the hash, a trailing slash\n * and a leading `www.`) gets `aria-current=\"page\"`, and its group button\n * `aria-current=\"true\"`, shown bold with a thick underline. Of links that differ only by\n * hash, the one with the page's hash is marked, else the one without a hash; if every one\n * has a hash, the first is marked while the page has none, and none for a hash none has.\n *\n * `<site-header>` renders it: as a row under the logo on wide screens and as an accordion in\n * the Menu popover on narrow ones.\n *\n * @tagname site-main-nav\n * @slot main-nav - Optional `<nav>` (or `<ul>`) whose list replaces the menu: `<li><a href>` for a direct link, `<li><span>Group</span><ul><li><a href>…</a></li></ul></li>` for a group. It is never shown itself; in light mode it is moved into a hidden holder.\n * @fires site-main-nav-error - `items-src` could not be loaded: both attempts failed (network error, a 10 s timeout per attempt, or no valid entries), after about 21 s at worst; the nav shows the bundled snapshot. `detail` is `{ src, message }`. Bubbles and is composed.\n * @fires uvalib-analytics-event - For `<site-analytics>`: a group was opened, `['site-main-nav', 'menu-open', <the group's label>]` (not on close), and a link was clicked, `['site-main-nav', 'link-click', '<Group> > <Link>']` (a top-level link: its label alone; never the URL). Bubbles and is composed.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Top-level button colour.\n * @cssprop [--uva-brand-blue=#232d4b] - Bar bottom border, chevrons, panel links, and the hover and expanded button text.\n * @cssprop [--uva-grey-100=#dadada] - Hover and expanded button background, and panel link hover background.\n * @cssprop [--uva-brand-orange=#e57200] - Focus ring colour, and the underline of the current page's link and group (also bold, with a 3px underline).\n * @cssprop [--uva-font-family=franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif] - Font family.\n * @cssprop --uva-color-text - Dark-mode role token: top-level button text (else `--uva-grey-darkest`).\n * @cssprop --uva-color-link - Dark-mode role token: chevrons, panel links, hover text and the focus ring over hover (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-hover - Dark-mode role token: hover and open-group background (else `--uva-grey-100`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: bar and panel background (else #ffffff).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: bar bottom rule (else `--uva-brand-blue`).\n * @cssprop --uva-color-shadow - Dark-mode role token: panel shadow colour (else rgba(0, 0, 0, 0.2)).\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 SiteMainNav extends UvalibElement {\n static styles = [\n accessible,\n css`\n :host {\n display: block;\n font-family: var(\n --uva-font-family,\n franklin-gothic-urw,\n 'UVA Franklin Fallback',\n Arial,\n Helvetica,\n sans-serif\n );\n font-size: 17px;\n line-height: 1.5;\n }\n :host([hidden]) {\n display: none;\n }\n ul {\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .panel[hidden] {\n display: none;\n }\n .toggle,\n .top-link {\n display: flex;\n align-items: center;\n box-sizing: border-box;\n margin: 0;\n border: 0;\n border-radius: 0;\n background: transparent;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n font: inherit;\n font-weight: 500;\n line-height: 1.5;\n text-align: start;\n text-decoration: none;\n cursor: pointer;\n }\n /* Chevron: a rotated border box, turned over when expanded. */\n .toggle::after {\n content: '';\n flex: none;\n inline-size: 0.5em;\n block-size: 0.5em;\n margin-inline-start: 0.75em;\n border-style: solid;\n border-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-width: 0 1px 1px 0;\n transform: translateY(-0.15em) rotate(45deg);\n }\n .toggle[aria-expanded='true']::after {\n transform: translateY(0.15em) rotate(-135deg);\n }\n /* Grey for hover and the open group only, never for focus: the orange focus ring\n would fall below 3:1 against it. */\n .toggle:hover,\n .toggle[aria-expanded='true'],\n .top-link:hover {\n background-color: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n .panel a {\n display: block;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font-weight: 400;\n text-decoration: underline;\n }\n .panel a:hover {\n background-color: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));\n text-decoration: none;\n }\n ${focusRules}\n /* Current page, and the group holding it: bold with a thick underline, not colour alone. */\n [aria-current]:not([aria-current='false']),\n .panel a[aria-current]:not([aria-current='false']):hover {\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\n /* Bar: a full-width row with the brand-blue rule, content capped at 1600px. */\n .bar {\n border-bottom: 5px solid var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n background: var(--uva-color-surface-raised, #ffffff);\n }\n .bar > ul {\n display: flex;\n flex-wrap: wrap;\n box-sizing: border-box;\n max-inline-size: 1600px;\n margin-inline: auto;\n padding-inline: 16px;\n }\n .bar > ul > li {\n position: relative;\n display: flex;\n }\n .bar .toggle,\n .bar .top-link {\n padding: 11.5px 17px;\n }\n .bar .panel {\n position: absolute;\n top: 100%;\n inset-inline-start: 0;\n z-index: 1000;\n box-sizing: border-box;\n inline-size: max-content;\n min-inline-size: 100%;\n max-inline-size: 20rem;\n background: var(--uva-color-surface-raised, #ffffff);\n border-radius: 0 0 4px 4px;\n box-shadow: 0 8px 16px var(--uva-color-shadow, rgba(0, 0, 0, 0.2));\n /* Invisible normally; forced colors paint it, so the panel keeps an edge. */\n outline: 1px solid transparent;\n }\n .bar .panel a {\n padding: 8.5px 17px;\n }\n\n /* Accordion (the header's narrow-screen Menu popover): full-width rows, panels in flow. */\n .accordion .toggle,\n .accordion .top-link {\n inline-size: 100%;\n justify-content: space-between;\n padding: 0.375rem 0.5rem;\n }\n .accordion .toggle::after {\n margin-inline-end: 0.25em;\n }\n .accordion .panel {\n position: static;\n padding-inline-start: 1rem;\n }\n .accordion .panel a {\n padding: 0.375rem 0.5rem;\n }\n\n /* Forced colors drop backgrounds and shadows: outline the open group and hovered\n controls instead. */\n @media (forced-colors: active) {\n .toggle[aria-expanded='true']:not(:focus-visible),\n .toggle:hover:not(:focus-visible),\n .top-link:hover:not(:focus-visible),\n .panel a:hover:not(:focus-visible) {\n outline: 1px solid CanvasText;\n outline-offset: -1px;\n }\n }\n `,\n ];\n\n /**\n * Light mode: the focus rules again, unlayered. A page's own accessibility sheet (which\n * `<site-page>` installs unlayered) would otherwise beat the layered component rules.\n */\n protected override installLightStyles(root?: Document | ShadowRoot): void {\n super.installLightStyles(root);\n installLightDomStyles(`${this.localName}-focus`, [lightFocusRules(this.localName)], {\n root,\n scope: false,\n layer: false,\n });\n }\n\n /** Accessible name of the navigation landmark. */\n @property({ type: String }) label = 'Main';\n @property({ type: String, attribute: 'root-link-domain' }) rootLinkDomain =\n 'https://www.library.virginia.edu';\n /** URL of JSON in the `MainNavItem[]` shape (needs CORS); the snapshot is shown until it loads, and if it fails. */\n @property({ type: String, attribute: 'items-src' }) itemsSrc?: string;\n /** `bar` (a row of buttons with floating panels) or `accordion` (stacked, panels in flow). */\n @property({ type: String }) layout: 'bar' | 'accordion' = 'bar';\n /**\n * The URL whose link is marked current. Default: the page location, followed through\n * same-document navigations (`popstate`, `hashchange`, and the Navigation API's\n * `currententrychange` where supported).\n */\n @property({ type: String }) current?: string;\n /**\n * The menu, replacing the bundled snapshot (but not `slot=\"main-nav\"` markup):\n * `{ label, href }` for a direct link, `{ label, items: [{ label, href }] }` for a group.\n * Unset or empty uses `items-src` or the snapshot.\n */\n @property({ attribute: false }) items?: MainNavItem[];\n\n /** Items from slotted markup, or null when there is none. */\n @state() private slotItems: MainNavItem[] | null = null;\n /** Items loaded from `items-src`. */\n @state() private fetched: MainNavItem[] | null = null;\n /** Index of the open group. */\n @state() private open: number | null = null;\n\n private propItems: MainNavItem[] | null = null;\n private fetchedFor?: string;\n /** The shown items last rendered, to close the open group when they change. */\n private shownKey?: string;\n private warned = new Set<string>();\n private observer?: MutationObserver;\n private holder?: HTMLDivElement;\n private readonly idBase = `main-nav-${++navCounter}`;\n\n override connectedCallback(): void {\n super.connectedCallback();\n // Read the markup before the first render where it is already there (no second update);\n // the observer catches markup parsed or added later.\n this.syncSource();\n this.listenLocation(true);\n // Reconnected while a group was open: watch for outside presses again.\n this.listenOutside(this.open !== null && this.layout === 'bar');\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.listenOutside(false);\n this.listenLocation(false);\n }\n\n /** Same-document navigation: re-mark the current page when `current` is not set. */\n private onLocationChange = (): void => {\n if (!this.current) this.requestUpdate();\n };\n\n private locationTargets(): { target: EventTarget; type: string }[] {\n const win = this.ownerDocument.defaultView;\n if (!win) return [];\n const nav = (win as Window & { navigation?: EventTarget }).navigation;\n return [\n { target: win, type: 'popstate' },\n { target: win, type: 'hashchange' },\n ...(nav ? [{ target: nav, type: 'currententrychange' }] : []),\n ];\n }\n\n private listeningLocation = false;\n private listenLocation(on: boolean): void {\n if (on === this.listeningLocation) return;\n this.listeningLocation = on;\n for (const { target, type } of this.locationTargets()) {\n if (on) target.addEventListener(type, this.onLocationChange);\n else target.removeEventListener(type, this.onLocationChange);\n }\n }\n\n private warnOnce(kind: 'invalid' | 'flattened', what: string): void {\n if (this.warned.has(kind)) return;\n this.warned.add(kind);\n console.warn(\n kind === 'invalid'\n ? `${this.localName}: ignoring invalid ${what} entries (each needs a label, and an href or links).`\n : `${this.localName}: ${what} nests deeper than two levels; the deeper links are shown in their group.`,\n );\n }\n\n private use(result: NormalizeResult, what: string): MainNavItem[] | null {\n if (result.invalid) this.warnOnce('invalid', what);\n if (result.flattened) this.warnOnce('flattened', what);\n return result.items.length ? result.items : null;\n }\n\n /** Light mode: move `slot=\"main-nav\"` children into a hidden holder this element owns. */\n private adoptSource(): Element[] {\n const moved = [...this.children].filter(isSourceChild);\n if (moved.length && !this.holder) {\n this.holder = document.createElement('div');\n this.holder.hidden = true;\n this.holder.className = 'main-nav-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 `slot=\"main-nav\"` markup, render it, and watch it for changes. */\n private syncSource(): void {\n const sources = this.lightDom ? this.adoptSource() : [...this.children].filter(isSourceChild);\n let next: MainNavItem[] | null = null;\n if (sources.length) {\n const raw = sources.flatMap((s, i) => (i === 0 ? readItemsMarkup(s) : [{}]));\n next = this.use(normalizeItems(raw), 'slot=\"main-nav\"');\n }\n // Only a real change re-renders.\n if (JSON.stringify(next) !== JSON.stringify(this.slotItems)) this.slotItems = next;\n this.observer ??= new MutationObserver(() => this.syncSource());\n this.observer.disconnect();\n const content = {\n attributes: true,\n attributeFilter: SOURCE_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 } else {\n // Shadow mode: the host's children are only the source markup.\n this.observer.observe(this, content);\n }\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('items')) {\n this.propItems = this.items == null ? null : this.use(normalizeItems(this.items), 'items');\n }\n if (changed.has('itemsSrc') && this.fetchedFor !== this.itemsSrc) {\n this.fetched = null;\n this.fetchedFor = undefined;\n }\n const src = this.itemsSrc;\n // Fetch only when items-src is what would be shown. The result arrives asynchronously.\n if (src && !this.slotItems && !this.propItems && this.fetchedFor !== src) {\n this.fetchedFor = src;\n loadMainNavItems(src).then(\n (result) => {\n if (this.itemsSrc !== src) return;\n this.fetched = this.use(result, 'items-src');\n },\n (error: unknown) => {\n if (this.itemsSrc !== src) return;\n this.dispatchEvent(\n new CustomEvent('site-main-nav-error', {\n detail: { src, message: error instanceof Error ? error.message : String(error) },\n bubbles: true,\n composed: true,\n }),\n );\n },\n );\n }\n // A different menu: the open index would point at another group, so close it.\n const key = JSON.stringify(this.shown);\n if (this.shownKey !== undefined && key !== this.shownKey) this.open = null;\n this.shownKey = key;\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has('open') || changed.has('layout')) {\n this.listenOutside(this.isConnected && this.open !== null && this.layout === 'bar');\n }\n }\n\n /** The items shown, by precedence. */\n private get shown(): readonly MainNavItem[] {\n return this.slotItems ?? this.propItems ?? this.fetched ?? MAIN_NAV_SNAPSHOT;\n }\n\n // --- behaviour ----------------------------------------------------------------------\n\n private get navEl(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>('nav.main-nav');\n }\n\n /** The top-level buttons and direct links, in order. */\n private get tops(): HTMLElement[] {\n const nav = this.navEl;\n return nav\n ? [...nav.querySelectorAll<HTMLElement>(':scope > ul > li > :is(.toggle, .top-link)')]\n : [];\n }\n\n private setOpen(index: number | null): void {\n this.open = index;\n }\n\n private onToggle(index: number): void {\n const opening = this.open !== index;\n this.setOpen(opening ? index : null);\n const label = this.shown[index]?.label;\n if (opening && label) trackEvent(this, ['site-main-nav', 'menu-open', label]);\n }\n\n private onOutsidePointer = (e: Event): void => {\n const nav = this.navEl;\n if (nav && !e.composedPath().includes(nav)) this.setOpen(null);\n };\n\n private listening = false;\n private listenOutside(on: boolean): void {\n if (on === this.listening) return;\n this.listening = on;\n const doc = this.ownerDocument;\n if (on) doc.addEventListener('pointerdown', this.onOutsidePointer, true);\n else doc.removeEventListener('pointerdown', this.onOutsidePointer, true);\n }\n\n private onFocusOut(e: FocusEvent): void {\n if (this.layout !== 'bar' || this.open === null) return;\n const to = e.relatedTarget as Node | null;\n // A null relatedTarget (a click on nothing focusable) is left to the pointerdown check.\n if (to && !this.navEl?.contains(to)) this.setOpen(null);\n }\n\n /** Arrow keys, Home and End over `nodes`, from `index` (as the live site's script does). */\n private move(e: KeyboardEvent, nodes: HTMLElement[], index: number): void {\n let to: number;\n switch (e.key) {\n case 'ArrowUp':\n case 'ArrowLeft':\n to = Math.max(0, index - 1);\n break;\n case 'ArrowDown':\n case 'ArrowRight':\n to = Math.min(nodes.length - 1, index + 1);\n break;\n case 'Home':\n to = 0;\n break;\n case 'End':\n to = nodes.length - 1;\n break;\n default:\n return;\n }\n e.preventDefault();\n nodes[to]?.focus();\n }\n\n private onKeyDown(e: KeyboardEvent): void {\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n const target = e.target as HTMLElement;\n const tops = this.tops;\n const top = tops.indexOf(target);\n const open = this.open;\n const openButton = open === null ? null : this.toggleAt(open);\n if (top >= 0) {\n if (e.key === 'Escape') {\n if (open === null) return; // nothing to close: let a surrounding popover handle it\n e.preventDefault();\n this.setOpen(null);\n } else if (e.key === 'ArrowDown' && openButton === target) {\n e.preventDefault();\n this.panelOf(openButton)?.querySelector<HTMLElement>('a')?.focus();\n } else {\n this.move(e, tops, top);\n }\n return;\n }\n const panel = target.closest('.panel');\n if (!panel || !openButton || this.panelOf(openButton) !== panel) return;\n if (e.key === 'Escape') {\n e.preventDefault();\n this.setOpen(null);\n openButton.focus();\n return;\n }\n const links = [...panel.querySelectorAll<HTMLElement>('a')];\n this.move(e, links, links.indexOf(target));\n }\n\n private toggleAt(index: number): HTMLElement | null {\n return (\n this.navEl?.querySelector<HTMLElement>(`[aria-controls=\"${this.panelId(index)}\"]`) ?? null\n );\n }\n\n /** A group button's panel: the list right after it, whose id it controls. */\n private panelOf(button: HTMLElement): HTMLElement | null {\n const next = button.nextElementSibling as HTMLElement | null;\n return next && next.id === button.getAttribute('aria-controls') ? next : null;\n }\n\n private panelId(index: number): string {\n return `${this.idBase}-${index}`;\n }\n\n // --- rendering ----------------------------------------------------------------------\n\n /** The one link to mark current: same host and path; then the same hash; then no hash. */\n private currentHref(hrefs: string[]): string | null {\n const here = this.current || this.ownerDocument.defaultView?.location.href || '';\n const base = this.ownerDocument.baseURI;\n const key = pageKey(here, base);\n if (!key) return null;\n const matches = hrefs.filter((h) => pageKey(h, base) === key);\n const hash = hashOf(here, base);\n return (\n matches.find((h) => hash && hashOf(h, base) === hash) ??\n matches.find((h) => !hashOf(h, base)) ??\n // Every match has a hash: with no hash of its own the page is theirs, so the first is\n // marked; a hash none of them has (a hash route the menu does not list) marks none.\n (hash ? null : matches[0]) ??\n null\n );\n }\n\n /** A link's href: fragment-only (`#…`) stays on this page; others go through siteLink. */\n private resolve(href: string): string {\n return href.startsWith('#') ? href : siteLink(this.rootLinkDomain, href);\n }\n\n /**\n * A plain click on a link closes the open group, so a single-page app that handles the\n * navigation in place does not leave the panel open. Modified clicks (a new tab or\n * window) keep it open.\n */\n private onClick(e: MouseEvent): void {\n const a = e.composedPath().find((n) => n instanceof HTMLAnchorElement);\n // Only the menu's own links (rendered here), never anything else on the click's path.\n if (a && this.renderRoot.contains(a)) {\n const text = (n: Node | null | undefined) =>\n (n?.textContent ?? '').replace(/\\s+/g, ' ').trim();\n // `Group > Link` for a link in a group, the link alone for a top-level one.\n const group = text(a.closest('.panel')?.previousElementSibling);\n const label = text(a);\n if (label)\n trackEvent(this, ['site-main-nav', 'link-click', group ? `${group} > ${label}` : label]);\n }\n if (this.open === null || e.button !== 0) return;\n if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;\n if (e.composedPath().some((n) => n instanceof Element && n.localName === 'a')) {\n this.setOpen(null);\n }\n }\n\n render() {\n const items = this.shown.map((item) => ({\n label: item.label,\n href: item.items ? undefined : this.resolve(item.href!),\n items: item.items?.map((l) => ({ label: l.label, href: this.resolve(l.href) })),\n }));\n const all = items.flatMap((i) => (i.items ? i.items.map((l) => l.href) : [i.href!]));\n const current = this.currentHref(all);\n const mark = (href: string) => (href === current ? 'page' : undefined);\n let marked = false;\n return html`<nav\n class=\"main-nav ${this.layout === 'accordion' ? 'accordion' : 'bar'}\"\n aria-label=${this.label}\n @keydown=${this.onKeyDown}\n @focusout=${this.onFocusOut}\n @click=${this.onClick}\n >\n <ul>\n ${items.map((item, i) => {\n if (!item.items) {\n const cur = !marked && mark(item.href!);\n if (cur) marked = true;\n return html`<li>\n <a class=\"top-link\" href=${item.href!} aria-current=${ifDefined(cur || undefined)}\n >${item.label}</a\n >\n </li>`;\n }\n const id = this.panelId(i);\n const expanded = this.open === i;\n const has = !marked && item.items.some((l) => l.href === current);\n let linkMarked = false;\n if (has) marked = true;\n return html`<li>\n <button\n type=\"button\"\n class=\"toggle\"\n aria-expanded=${expanded ? 'true' : 'false'}\n aria-controls=${id}\n aria-current=${ifDefined(has ? 'true' : undefined)}\n @click=${() => this.onToggle(i)}\n >\n ${item.label}\n </button>\n <ul class=\"panel\" id=${id} ?hidden=${!expanded}>\n ${item.items.map((l) => {\n const cur = has && !linkMarked && l.href === current;\n if (cur) linkMarked = true;\n return html`<li>\n <a href=${l.href} aria-current=${ifDefined(cur ? 'page' : undefined)}\n >${l.label}</a\n >\n </li>`;\n })}\n </ul>\n </li>`;\n })}\n </ul>\n </nav>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { SiteMainNav } from './SiteMainNav.js';\n\ndefine('site-main-nav', SiteMainNav);\n"],"mappings":";;;;;;AA2BA,IAAMkB,KAAO,MAAwB,OAAOC,KAAM,WAAWA,EAAE,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK,IAAI;AAQ7F,SAAgBC,EAAe,GAA+B;CAC5D,IAAMC,IAAuB;EAAE,OAAO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