@uvalib/web-components 1.8.5 → 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 +22 -0
- package/README.md +485 -59
- 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/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 +4402 -2139
- 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/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-B3tNX103.js → base-CHMHBPeI.js} +42 -2
- package/dist-cdn/chunks/{base-B3tNX103.js.map → base-CHMHBPeI.js.map} +1 -1
- 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 +4402 -2139
- 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 +3 -3
- package/dist-cdn/site-style.js +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/site-header-CEmNtmk5.js.map +0 -1
- package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +0 -1
|
@@ -226,7 +226,8 @@ var a = e`
|
|
|
226
226
|
uvalib-combobox,
|
|
227
227
|
uvalib-image-regions,
|
|
228
228
|
uvalib-map,
|
|
229
|
-
uvalib-filter-drawer
|
|
229
|
+
uvalib-filter-drawer,
|
|
230
|
+
uvalib-filter
|
|
230
231
|
):not(:defined)[hidden],
|
|
231
232
|
:where(uvalib-combobox, uvalib-image-regions):not(:defined) > [hidden] {
|
|
232
233
|
display: none;
|
|
@@ -358,6 +359,13 @@ var a = e`
|
|
|
358
359
|
line-height: 1.5;
|
|
359
360
|
color: var(--uva-color-text-muted, #4b5563);
|
|
360
361
|
}
|
|
362
|
+
/* A collapsed filter group (<uvalib-filter collapsible collapsed>) draws only its 44px
|
|
363
|
+
legend button once it upgrades: hold that height. Low specificity, so the [hidden] rule
|
|
364
|
+
above still wins. */
|
|
365
|
+
:where(uvalib-filter[collapsible][collapsed]):not(:defined) {
|
|
366
|
+
display: block;
|
|
367
|
+
min-block-size: 44px;
|
|
368
|
+
}
|
|
361
369
|
/* A filter drawer on a phone (the default 48rem breakpoint): once it upgrades only its 44px
|
|
362
370
|
"Search and filters" button shows, so hold that height and keep the form and filters out
|
|
363
371
|
of sight meanwhile; nothing moves when it upgrades. A page with its own breakpoint adds the
|
|
@@ -372,6 +380,38 @@ var a = e`
|
|
|
372
380
|
display: none;
|
|
373
381
|
}
|
|
374
382
|
}
|
|
383
|
+
/* A dialog before <uvalib-dialog> upgrades: its children are the dialog's content, never
|
|
384
|
+
shown in the page, so nothing flashes or moves. Once defined, a closed dialog renders
|
|
385
|
+
nothing (its host is display: contents around a closed <dialog>). */
|
|
386
|
+
uvalib-dialog:not(:defined) {
|
|
387
|
+
display: none;
|
|
388
|
+
}
|
|
389
|
+
/* A citation before <uvalib-citation> upgrades: only the first format's citation, boxed
|
|
390
|
+
as it will be, with the label and 44px format bar held above it (none for hide-label)
|
|
391
|
+
and the 44px Copy citation row below, so nothing moves when it upgrades (an app's
|
|
392
|
+
citations property cannot be held). */
|
|
393
|
+
uvalib-citation:not(:defined) {
|
|
394
|
+
display: block;
|
|
395
|
+
font-size: 1rem;
|
|
396
|
+
line-height: 1.5;
|
|
397
|
+
}
|
|
398
|
+
uvalib-citation:not(:defined):has(> [data-format]) {
|
|
399
|
+
padding-block: calc(2rem + 44px + 0.75rem) calc(0.75rem + 44px);
|
|
400
|
+
}
|
|
401
|
+
uvalib-citation[hide-label]:not(:defined):has(> [data-format]) {
|
|
402
|
+
padding-block-start: calc(44px + 0.75rem);
|
|
403
|
+
}
|
|
404
|
+
uvalib-citation:not(:defined) > [data-format] {
|
|
405
|
+
margin: 0;
|
|
406
|
+
padding: 0.75rem 1rem;
|
|
407
|
+
border: 1px solid transparent;
|
|
408
|
+
overflow-wrap: anywhere;
|
|
409
|
+
text-wrap: pretty;
|
|
410
|
+
}
|
|
411
|
+
uvalib-citation:not(:defined) > [data-format] ~ [data-format],
|
|
412
|
+
uvalib-citation:not(:defined) > [slot] {
|
|
413
|
+
display: none;
|
|
414
|
+
}
|
|
375
415
|
/* Printing a <site-page> (issue #20; its own styles leave out the chrome): a dark scheme
|
|
376
416
|
prints light (the role tokens resolve to their light values), and the content's links
|
|
377
417
|
are black and underlined, so they are told apart without colour. Content is <main> in
|
|
@@ -400,4 +440,4 @@ var a = e`
|
|
|
400
440
|
`;
|
|
401
441
|
export { i as a, n as i, l as n, a as r, c as t };
|
|
402
442
|
|
|
403
|
-
//# sourceMappingURL=base-
|
|
443
|
+
//# sourceMappingURL=base-CHMHBPeI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-B3tNX103.js","names":["unsafeCSS","i","r","fontFallback","FACES","loadFontFallback","fonts","doc","face","tokens","METADATA_LIMITS","metadataLimits","lists","n","l","TYPEKIT_URL","base"],"sources":["../../src/styles/font-fallback.ts","../../src/styles/tokens.ts","../../src/styles/base.ts"],"sourcesContent":["import { css } from 'lit';\n\n/**\n * A metric-matched fallback for Franklin Gothic URW (issue #32). The Adobe Fonts kit uses\n * `font-display: auto`, so on a slow connection text is drawn in the next font of\n * `--uva-font-family` and redrawn when the kit's files arrive. Plain Arial is wider than\n * Franklin Gothic (by 6% regular, 9% bold), so paragraphs rewrapped and the page moved\n * (layout shift). \"UVA Franklin Fallback\" is the system's Arial scaled to Franklin Gothic's\n * average widths, with its ascent and descent, for each face the kit serves (400, 500, 700 and\n * 400 italic; a 600 rule gets the 700 face, as the kit's own matching does). Measured against\n * the kit in Chromium: the fallback wraps a paragraph like Franklin Gothic in about 99% of\n * widths from 260 to 700px at 16 to 20px, against 55 to 82% for plain Arial.\n *\n * `size-adjust` scales Arial's glyphs; the overrides are Franklin Gothic's ascent (0.95 em) and\n * descent (0.25 em) divided by that scale, with no line gap, so a line is as tall in both.\n * Liberation Sans (Linux) has Arial's metrics. Where neither is installed (Android has Roboto),\n * the face is skipped and the next font in the stack is used, as before.\n */\nexport const fontFallback = css`\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');\n font-weight: 100 450;\n font-style: normal;\n size-adjust: 94.52%;\n ascent-override: 100.93%;\n descent-override: 26.56%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');\n font-weight: 451 599;\n font-style: normal;\n size-adjust: 95.99%;\n ascent-override: 99.18%;\n descent-override: 26.04%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src:\n local('Arial Bold'), local('Arial-BoldMT'), local('Liberation Sans Bold'),\n local('LiberationSans-Bold');\n font-weight: 600 1000;\n font-style: normal;\n size-adjust: 91.32%;\n ascent-override: 104.03%;\n descent-override: 27.38%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src:\n local('Arial Italic'), local('Arial-ItalicMT'), local('Liberation Sans Italic'),\n local('LiberationSans-Italic');\n font-weight: 100 599;\n font-style: italic;\n size-adjust: 95.06%;\n ascent-override: 101.09%;\n descent-override: 26.4%;\n line-gap-override: 0%;\n }\n`;\n\n/** One font per fallback face, so each one is asked for. */\nconst FACES = ['400', '500', '700', 'italic 400'];\n\n/**\n * Load every fallback face now (issue #35). A face from a local() font loads only when text\n * first needs it, so the first italic (or medium) text could be drawn in unscaled Arial and\n * redrawn a moment later. Called once the faces are installed; failures (no Arial or\n * Liberation Sans on the system) are left to the next font in the stack, as before.\n */\nexport function loadFontFallback(doc: Document): void {\n const fonts = doc.fonts;\n if (!fonts?.load) return;\n for (const face of FACES) fonts.load(`${face} 1em \"UVA Franklin Fallback\"`).catch(() => {});\n}\n","// GENERATED by scripts/sync-tokens.mjs from ../monorepo/packages/drupal_library_theme/src/scss/base — do not edit\nimport { css } from 'lit';\n\nexport const tokens = css`\n :root {\n --uva-brand-blue-lightest: #87B9D9;\n --uva-brand-blue-lighter: #3395D4;\n --uva-brand-blue-light: #0370B7;\n --uva-brand-blue-base: #232D4B;\n --uva-brand-blue-300: #87B9D9;\n --uva-brand-blue-200: #3395D4;\n --uva-brand-blue-100: #0370B7;\n --uva-brand-blue: #232D4B;\n --uva-brand-orange-lightest: #FFEAD6;\n --uva-brand-orange-lighter: #FFC999;\n --uva-brand-orange-light: #FFB370;\n --uva-brand-orange-base: #E57200;\n --uva-brand-orange-dark: #B35900;\n --uva-brand-orange-darker: #854200;\n --uva-brand-orange-300: #FFEAD6;\n --uva-brand-orange-200: #FFC999;\n --uva-brand-orange-100: #FFB370;\n --uva-brand-orange: #E57200;\n --uva-brand-orange-A: #B35900;\n --uva-brand-orange-B: #854200;\n --uva-blue-alt-lightest: #BFE7F7;\n --uva-blue-alt-lighter: #91D8F2;\n --uva-blue-alt-light: #55C4EC;\n --uva-blue-alt-base: #007BAC;\n --uva-blue-alt-dark: #005679;\n --uva-blue-alt-darkest: #141E3C;\n --uva-blue-alt-400: #e6f2f7;\n --uva-blue-alt-300: #BFE7F7;\n --uva-blue-alt-200: #91D8F2;\n --uva-blue-alt-100: #55C4EC;\n --uva-blue-alt: #007BAC;\n --uva-blue-alt-A: #005679;\n --uva-blue-alt-B: #141E3C;\n --uva-teal-lightest: #C8F2F4;\n --uva-teal-light: #5BD7DE;\n --uva-teal-base: #25CAD3;\n --uva-teal-dark: #1DA1A8;\n --uva-teal-darker: #16777C;\n --uva-teal-200: #C8F2F4;\n --uva-teal-100: #5BD7DE;\n --uva-teal: #25CAD3;\n --uva-teal-A: #1DA1A8;\n --uva-teal-B: #16777C;\n --uva-green-lightest: #DDEFDC;\n --uva-green-lighter: #89CC74;\n --uva-green-base: #62BB46;\n --uva-green-dark: #4E9737;\n --uva-green-200: #DDEFDC;\n --uva-green-100: #89CC74;\n --uva-green: #62BB46;\n --uva-green-A: #4E9737;\n --uva-red-lightest: #FBCFDA;\n --uva-red-base: #EF3F6B;\n --uva-red-dark: #DF1E43;\n --uva-red-darker: #B30000;\n --uva-red-100: #FBCFDA;\n --uva-red: #EF3F6B;\n --uva-red-A: #DF1E43;\n --uva-red-B: #B30000;\n --uva-yellow-lightest: #FEF6C8;\n --uva-yellow-base: #ECC602;\n --uva-yellow-dark: #B99C02;\n --uva-yellow-100: #FEF6C8;\n --uva-yellow: #ECC602;\n --uva-yellow-A: #B99C02;\n --uva-grey-lightest: #F1F1F1;\n --uva-grey-light: #DADADA;\n --uva-grey-base: #808080;\n --uva-grey-dark: #4F4F4F;\n --uva-grey-darkest: #2B2B2B;\n --uva-grey-200: #F1F1F1;\n --uva-grey-100: #DADADA;\n --uva-grey-50: #ADADAD;\n --uva-grey: #808080;\n --uva-grey-A: #4F4F4F;\n --uva-grey-B: #2B2B2B;\n --uva-font-family: franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif;\n --uva-font-size-base: 17px;\n }\n`;\n","import { css, unsafeCSS } from 'lit';\n\n/**\n * `<uvalib-metadata>` long lists before it upgrades (issue #34): a list of more than N values\n * shows its first N and a line for its \"Show all\" button (4px above a 32px button), as the\n * upgraded element does. CSS cannot read N from the attribute into :nth-child(), so the rules\n * are written out for limits 1 to 12; a page with a larger limit adds its own (README). A row's\n * own data-limit on its <dd> wins over list-limit (data-limit=\"0\" shows them all); a data-limit\n * on the list itself works once upgraded but is not held before.\n */\nconst METADATA_LIMITS = Array.from({ length: 12 }, (_, i) => i + 1);\nconst metadataLimits = unsafeCSS(\n METADATA_LIMITS.map((n) => {\n const lists = [\n `uvalib-metadata[list-limit=\"${n}\"]:not(:defined) > dl > dd:not([data-limit]) > :is(ul, ol):not([data-limit])`,\n `uvalib-metadata:not(:defined) > dl > dd[data-limit=\"${n}\"] > :is(ul, ol)`,\n ];\n return (\n `${lists.map((l) => `${l} > li:nth-child(n + ${n + 1})`).join(',\\n')} { display: none; }\\n` +\n `${lists.map((l) => `${l}:has(> li:nth-child(${n + 1}))::after`).join(',\\n')} { content: ''; display: block; block-size: 2.25rem; }`\n );\n }).join('\\n'),\n);\n\nexport const TYPEKIT_URL = 'https://use.typekit.net/oym8nvz.css';\n\n// The body background has no fallback: without dark mode it stays transparent, as before.\n//\n// site-page:not(:defined) applies when base.css is linked in <head>, before the element\n// upgrades: its own formatting context (flow-root), so a heading's top margin cannot collapse\n// through to <body> and shift the page once the element upgrades, and invisible, so its\n// content does not paint above where the header will go. If the script never loads, the\n// content appears anyway after two seconds.\nexport const base = css`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n html,\n body {\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 }\n html {\n font-size: var(--uva-font-size-base, 17px);\n }\n body {\n margin: 0;\n line-height: 1.5;\n min-height: 100vh;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n background-color: var(--uva-color-surface);\n }\n site-page:not(:defined) {\n display: flow-root;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-breadcrumbs:not(:defined),\n uvalib-card:not(:defined),\n uvalib-card-grid:not(:defined),\n uvalib-pager:not(:defined),\n uvalib-contents:not(:defined),\n uvalib-metadata:not(:defined),\n uvalib-tag-list:not(:defined) {\n display: block;\n line-height: 1.5;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n /* A chip row: hidden, one 44px row tall (with the scrolling row's padding), the raw\n children kept on one line so they cannot make it taller. */\n uvalib-chip-group:not(:defined) {\n display: block;\n min-height: 44px;\n max-width: 100%;\n overflow: hidden;\n white-space: nowrap;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-chip-group[scroll]:not(:defined) {\n min-height: calc(44px + 0.75rem);\n }\n /* A description: one line of it (0.875rem at 1.5, 0.25rem below the row). */\n uvalib-chip-group[description]:not(:defined) {\n padding-block-end: 1.5625rem;\n }\n /* Its text is drawn from attributes: hold one line until it upgrades. */\n uvalib-results-count:not(:defined) {\n display: block;\n min-block-size: 1.5em;\n }\n uvalib-tag-list:not(:defined)[hidden],\n uvalib-results-count:not(:defined)[hidden] {\n display: none;\n }\n /* The pre-upgrade rules here set display, which beats the hidden attribute's (issue #7).\n More specific than each of them (two pseudo-classes or attributes), so it needs no importance flag. */\n :where(\n site-page,\n uvalib-breadcrumbs,\n uvalib-card,\n uvalib-card-grid,\n uvalib-pager,\n uvalib-contents,\n uvalib-metadata,\n uvalib-chip-group,\n uvalib-tabs,\n uvalib-combobox,\n uvalib-image-regions,\n uvalib-map,\n uvalib-filter-drawer\n ):not(:defined)[hidden],\n :where(uvalib-combobox, uvalib-image-regions):not(:defined) > [hidden] {\n display: none;\n }\n /* A record's details before <uvalib-metadata> upgrades (issue #34): the rows already laid\n out as it lays them out (label beside value from 36rem of its own width, stacked below;\n 8px above and below each row, a 1px rule between rows; lists without bullets, 4px apart),\n so the page does not move when it upgrades. Rows the attributes add (creator, rights,\n citation) are not in the page's <dl> and cannot be held. */\n uvalib-metadata:not(:defined) {\n container-type: inline-size;\n font-size: 1rem;\n }\n uvalib-metadata:not(:defined) > dl {\n display: grid;\n grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr);\n column-gap: 1.5rem;\n margin: 0;\n }\n uvalib-metadata:not(:defined) > dl > dt {\n grid-column: 1;\n margin: 0;\n padding-block: 0.5rem;\n font-weight: 700;\n }\n uvalib-metadata:not(:defined) > dl > dd {\n grid-column: 2;\n margin: 0;\n padding-block: 0.5rem;\n }\n uvalib-metadata:not(:defined) > dl > dt:not(:first-child),\n uvalib-metadata:not(:defined) > dl > dt:not(:first-child) + dd {\n border-block-start: 1px solid transparent;\n }\n uvalib-metadata:not(:defined) > dl > dd > :is(ul, ol) {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n uvalib-metadata:not(:defined) > dl > dd li + li {\n margin-block-start: 0.25rem;\n }\n @container (width < 36rem) {\n uvalib-metadata:not(:defined) > dl {\n grid-template-columns: minmax(0, 1fr);\n }\n uvalib-metadata:not(:defined) > dl > :is(dt, dd) {\n grid-column: 1;\n }\n uvalib-metadata:not(:defined) > dl > dt {\n padding-block-end: 0;\n }\n uvalib-metadata:not(:defined) > dl > dd {\n padding-block-start: 0;\n }\n uvalib-metadata:not(:defined) > dl > dt:not(:first-child) + dd {\n border-block-start: 0;\n }\n }\n ${metadataLimits}\n /* Tabs stay readable before the script runs: a block, one panel, and a gap the\n size of the tab row (44px) plus its 1rem margin, so the first panel does not\n jump when the element upgrades. Later data-tab panels stay hidden. */\n uvalib-tabs:not(:defined) {\n display: block;\n padding-block-start: calc(44px + 1rem);\n }\n uvalib-tabs:not(:defined) > [data-tab] ~ [data-tab] {\n display: none;\n }\n /* A combobox: its label (from the attribute) and one 44px field (plus a one-line\n description) held, so nothing moves when it upgrades. A fallback <input list> child\n works meanwhile; the other children (options, a datalist) stay out of sight. */\n uvalib-combobox:not(:defined) {\n display: block;\n min-block-size: calc(1.5em + 0.25rem + 44px);\n line-height: 1.5;\n }\n uvalib-combobox[description]:not(:defined) {\n min-block-size: calc(3em + 0.5rem + 44px);\n }\n uvalib-combobox:not(:defined)::before {\n content: attr(label);\n display: block;\n margin-block-end: 0.25rem;\n font-weight: 600;\n }\n uvalib-combobox:not(:defined) > :not(input) {\n display: none;\n }\n uvalib-combobox:not(:defined) > input {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: 44px;\n font: inherit;\n line-height: 1.2;\n }\n /* Image regions: the image at its own width and the list beside it (or under it), the\n layout the element keeps once it upgrades, so the image does not move. */\n uvalib-image-regions:not(:defined) {\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n align-items: flex-start;\n }\n uvalib-image-regions:not(:defined) > :is(img, picture) {\n display: block;\n flex: 0 1 auto;\n min-width: 0;\n max-width: 100%;\n height: auto;\n }\n uvalib-image-regions:not(:defined) > :is(ol, ul) {\n flex: 1 1 14rem;\n min-width: 0;\n }\n /* A map: its key instructions (the same text it shows) and the map's height held above\n the child list, so the list does not move when the map is drawn over the page's\n Leaflet. Padding, not margin, so it cannot collapse with the list's own top margin. */\n uvalib-map:not(:defined) {\n display: block;\n }\n uvalib-map:not(:defined)::before {\n content: 'Tab or arrow keys move between places; Enter opens one. With the map focused, arrow keys pan and + and − zoom.';\n display: block;\n padding-block-end: calc(0.5rem + max(12rem, var(--uvalib-map-height, min(24rem, 75vw))));\n font-size: 0.875rem;\n line-height: 1.5;\n color: var(--uva-color-text-muted, #4b5563);\n }\n /* A filter drawer on a phone (the default 48rem breakpoint): once it upgrades only its 44px\n \"Search and filters\" button shows, so hold that height and keep the form and filters out\n of sight meanwhile; nothing moves when it upgrades. A page with its own breakpoint adds the\n same two rules in a media query of that width (see the README). Low specificity, so the\n [hidden] rule above still wins. */\n @media (max-width: 48rem) {\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) {\n display: block;\n min-block-size: 44px;\n }\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) > * {\n display: none;\n }\n }\n /* Printing a <site-page> (issue #20; its own styles leave out the chrome): a dark scheme\n prints light (the role tokens resolve to their light values), and the content's links\n are black and underlined, so they are told apart without colour. Content is <main> in\n light DOM and the unslotted children in shadow DOM. print-chrome keeps the page as it is\n shown, apart from the light scheme. */\n @media print {\n :root[data-uva-color-scheme]:has(site-page) {\n color-scheme: light;\n --uva-color-scheme: light;\n }\n /* Light DOM's trail, here too, as the pre-upgrade rule above (unlayered) would win. */\n site-page:not([print-chrome]) > [slot='breadcrumbs'] {\n display: none;\n }\n site-page:not([print-chrome]) > :not([slot], site-header, site-footer, .alerts-list) :any-link,\n site-page:not([print-chrome]) > :any-link:not([slot], .skip-link) {\n color: #000;\n text-decoration: underline;\n }\n }\n @keyframes uvalib-site-page-reveal {\n to {\n visibility: visible;\n }\n }\n`;\n"],"mappings":";;AAkBA,IAAaG,IAAe,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDzBC,IAAQ;CAAC;CAAO;CAAO;CAAO;AAAY;AAQhD,SAAgBC,EAAiB,GAAqB;CACpD,IAAMC,IAAQC,EAAI;CAClB,IAAKD,GAAO,MACZ,KAAK,IAAME,KAAQJ,GAAO,EAAM,KAAK,GAAGI,EAAK,6BAA6B,CAAC,CAAC,YAAY,CAAC,CAAC;AAC5F;;AC3EA,IAAaC,IAAS,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCOnBC,IAAkB,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAMT,IAAI,CAAC,GAC5DU,IAAiBX,EACrBU,EAAgB,KAAK,MAAM;CACzB,IAAME,IAAQ,CACZ,+BAA+BC,EAAE,+EACjC,uDAAuDA,EAAE,iBAC3D;CACA,OACE,GAAGD,EAAM,KAAK,MAAM,GAAGE,EAAE,sBAAsBD,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE,uBAClED,EAAM,KAAK,MAAM,GAAGE,EAAE,sBAAsBD,IAAI,EAAE,UAAU,CAAC,CAAC,KAAK,KAAK,EAAE;AAEjF,CAAC,CAAC,CAAC,KAAK,IAAI,CACd,GAEaE,IAAc,uCASdC,IAAO,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkJnBL,EAAe"}
|
|
1
|
+
{"version":3,"file":"base-CHMHBPeI.js","names":["unsafeCSS","i","r","fontFallback","FACES","loadFontFallback","fonts","doc","face","tokens","METADATA_LIMITS","metadataLimits","lists","n","l","TYPEKIT_URL","base"],"sources":["../../src/styles/font-fallback.ts","../../src/styles/tokens.ts","../../src/styles/base.ts"],"sourcesContent":["import { css } from 'lit';\n\n/**\n * A metric-matched fallback for Franklin Gothic URW (issue #32). The Adobe Fonts kit uses\n * `font-display: auto`, so on a slow connection text is drawn in the next font of\n * `--uva-font-family` and redrawn when the kit's files arrive. Plain Arial is wider than\n * Franklin Gothic (by 6% regular, 9% bold), so paragraphs rewrapped and the page moved\n * (layout shift). \"UVA Franklin Fallback\" is the system's Arial scaled to Franklin Gothic's\n * average widths, with its ascent and descent, for each face the kit serves (400, 500, 700 and\n * 400 italic; a 600 rule gets the 700 face, as the kit's own matching does). Measured against\n * the kit in Chromium: the fallback wraps a paragraph like Franklin Gothic in about 99% of\n * widths from 260 to 700px at 16 to 20px, against 55 to 82% for plain Arial.\n *\n * `size-adjust` scales Arial's glyphs; the overrides are Franklin Gothic's ascent (0.95 em) and\n * descent (0.25 em) divided by that scale, with no line gap, so a line is as tall in both.\n * Liberation Sans (Linux) has Arial's metrics. Where neither is installed (Android has Roboto),\n * the face is skipped and the next font in the stack is used, as before.\n */\nexport const fontFallback = css`\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');\n font-weight: 100 450;\n font-style: normal;\n size-adjust: 94.52%;\n ascent-override: 100.93%;\n descent-override: 26.56%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src: local('Arial'), local('ArialMT'), local('Liberation Sans'), local('LiberationSans');\n font-weight: 451 599;\n font-style: normal;\n size-adjust: 95.99%;\n ascent-override: 99.18%;\n descent-override: 26.04%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src:\n local('Arial Bold'), local('Arial-BoldMT'), local('Liberation Sans Bold'),\n local('LiberationSans-Bold');\n font-weight: 600 1000;\n font-style: normal;\n size-adjust: 91.32%;\n ascent-override: 104.03%;\n descent-override: 27.38%;\n line-gap-override: 0%;\n }\n @font-face {\n font-family: 'UVA Franklin Fallback';\n src:\n local('Arial Italic'), local('Arial-ItalicMT'), local('Liberation Sans Italic'),\n local('LiberationSans-Italic');\n font-weight: 100 599;\n font-style: italic;\n size-adjust: 95.06%;\n ascent-override: 101.09%;\n descent-override: 26.4%;\n line-gap-override: 0%;\n }\n`;\n\n/** One font per fallback face, so each one is asked for. */\nconst FACES = ['400', '500', '700', 'italic 400'];\n\n/**\n * Load every fallback face now (issue #35). A face from a local() font loads only when text\n * first needs it, so the first italic (or medium) text could be drawn in unscaled Arial and\n * redrawn a moment later. Called once the faces are installed; failures (no Arial or\n * Liberation Sans on the system) are left to the next font in the stack, as before.\n */\nexport function loadFontFallback(doc: Document): void {\n const fonts = doc.fonts;\n if (!fonts?.load) return;\n for (const face of FACES) fonts.load(`${face} 1em \"UVA Franklin Fallback\"`).catch(() => {});\n}\n","// GENERATED by scripts/sync-tokens.mjs from ../monorepo/packages/drupal_library_theme/src/scss/base — do not edit\nimport { css } from 'lit';\n\nexport const tokens = css`\n :root {\n --uva-brand-blue-lightest: #87B9D9;\n --uva-brand-blue-lighter: #3395D4;\n --uva-brand-blue-light: #0370B7;\n --uva-brand-blue-base: #232D4B;\n --uva-brand-blue-300: #87B9D9;\n --uva-brand-blue-200: #3395D4;\n --uva-brand-blue-100: #0370B7;\n --uva-brand-blue: #232D4B;\n --uva-brand-orange-lightest: #FFEAD6;\n --uva-brand-orange-lighter: #FFC999;\n --uva-brand-orange-light: #FFB370;\n --uva-brand-orange-base: #E57200;\n --uva-brand-orange-dark: #B35900;\n --uva-brand-orange-darker: #854200;\n --uva-brand-orange-300: #FFEAD6;\n --uva-brand-orange-200: #FFC999;\n --uva-brand-orange-100: #FFB370;\n --uva-brand-orange: #E57200;\n --uva-brand-orange-A: #B35900;\n --uva-brand-orange-B: #854200;\n --uva-blue-alt-lightest: #BFE7F7;\n --uva-blue-alt-lighter: #91D8F2;\n --uva-blue-alt-light: #55C4EC;\n --uva-blue-alt-base: #007BAC;\n --uva-blue-alt-dark: #005679;\n --uva-blue-alt-darkest: #141E3C;\n --uva-blue-alt-400: #e6f2f7;\n --uva-blue-alt-300: #BFE7F7;\n --uva-blue-alt-200: #91D8F2;\n --uva-blue-alt-100: #55C4EC;\n --uva-blue-alt: #007BAC;\n --uva-blue-alt-A: #005679;\n --uva-blue-alt-B: #141E3C;\n --uva-teal-lightest: #C8F2F4;\n --uva-teal-light: #5BD7DE;\n --uva-teal-base: #25CAD3;\n --uva-teal-dark: #1DA1A8;\n --uva-teal-darker: #16777C;\n --uva-teal-200: #C8F2F4;\n --uva-teal-100: #5BD7DE;\n --uva-teal: #25CAD3;\n --uva-teal-A: #1DA1A8;\n --uva-teal-B: #16777C;\n --uva-green-lightest: #DDEFDC;\n --uva-green-lighter: #89CC74;\n --uva-green-base: #62BB46;\n --uva-green-dark: #4E9737;\n --uva-green-200: #DDEFDC;\n --uva-green-100: #89CC74;\n --uva-green: #62BB46;\n --uva-green-A: #4E9737;\n --uva-red-lightest: #FBCFDA;\n --uva-red-base: #EF3F6B;\n --uva-red-dark: #DF1E43;\n --uva-red-darker: #B30000;\n --uva-red-100: #FBCFDA;\n --uva-red: #EF3F6B;\n --uva-red-A: #DF1E43;\n --uva-red-B: #B30000;\n --uva-yellow-lightest: #FEF6C8;\n --uva-yellow-base: #ECC602;\n --uva-yellow-dark: #B99C02;\n --uva-yellow-100: #FEF6C8;\n --uva-yellow: #ECC602;\n --uva-yellow-A: #B99C02;\n --uva-grey-lightest: #F1F1F1;\n --uva-grey-light: #DADADA;\n --uva-grey-base: #808080;\n --uva-grey-dark: #4F4F4F;\n --uva-grey-darkest: #2B2B2B;\n --uva-grey-200: #F1F1F1;\n --uva-grey-100: #DADADA;\n --uva-grey-50: #ADADAD;\n --uva-grey: #808080;\n --uva-grey-A: #4F4F4F;\n --uva-grey-B: #2B2B2B;\n --uva-font-family: franklin-gothic-urw, \"UVA Franklin Fallback\", Arial, Helvetica, sans-serif;\n --uva-font-size-base: 17px;\n }\n`;\n","import { css, unsafeCSS } from 'lit';\n\n/**\n * `<uvalib-metadata>` long lists before it upgrades (issue #34): a list of more than N values\n * shows its first N and a line for its \"Show all\" button (4px above a 32px button), as the\n * upgraded element does. CSS cannot read N from the attribute into :nth-child(), so the rules\n * are written out for limits 1 to 12; a page with a larger limit adds its own (README). A row's\n * own data-limit on its <dd> wins over list-limit (data-limit=\"0\" shows them all); a data-limit\n * on the list itself works once upgraded but is not held before.\n */\nconst METADATA_LIMITS = Array.from({ length: 12 }, (_, i) => i + 1);\nconst metadataLimits = unsafeCSS(\n METADATA_LIMITS.map((n) => {\n const lists = [\n `uvalib-metadata[list-limit=\"${n}\"]:not(:defined) > dl > dd:not([data-limit]) > :is(ul, ol):not([data-limit])`,\n `uvalib-metadata:not(:defined) > dl > dd[data-limit=\"${n}\"] > :is(ul, ol)`,\n ];\n return (\n `${lists.map((l) => `${l} > li:nth-child(n + ${n + 1})`).join(',\\n')} { display: none; }\\n` +\n `${lists.map((l) => `${l}:has(> li:nth-child(${n + 1}))::after`).join(',\\n')} { content: ''; display: block; block-size: 2.25rem; }`\n );\n }).join('\\n'),\n);\n\nexport const TYPEKIT_URL = 'https://use.typekit.net/oym8nvz.css';\n\n// The body background has no fallback: without dark mode it stays transparent, as before.\n//\n// site-page:not(:defined) applies when base.css is linked in <head>, before the element\n// upgrades: its own formatting context (flow-root), so a heading's top margin cannot collapse\n// through to <body> and shift the page once the element upgrades, and invisible, so its\n// content does not paint above where the header will go. If the script never loads, the\n// content appears anyway after two seconds.\nexport const base = css`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n html,\n body {\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 }\n html {\n font-size: var(--uva-font-size-base, 17px);\n }\n body {\n margin: 0;\n line-height: 1.5;\n min-height: 100vh;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n background-color: var(--uva-color-surface);\n }\n site-page:not(:defined) {\n display: flow-root;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-breadcrumbs:not(:defined),\n uvalib-card:not(:defined),\n uvalib-card-grid:not(:defined),\n uvalib-pager:not(:defined),\n uvalib-contents:not(:defined),\n uvalib-metadata:not(:defined),\n uvalib-tag-list:not(:defined) {\n display: block;\n line-height: 1.5;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n /* A chip row: hidden, one 44px row tall (with the scrolling row's padding), the raw\n children kept on one line so they cannot make it taller. */\n uvalib-chip-group:not(:defined) {\n display: block;\n min-height: 44px;\n max-width: 100%;\n overflow: hidden;\n white-space: nowrap;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-chip-group[scroll]:not(:defined) {\n min-height: calc(44px + 0.75rem);\n }\n /* A description: one line of it (0.875rem at 1.5, 0.25rem below the row). */\n uvalib-chip-group[description]:not(:defined) {\n padding-block-end: 1.5625rem;\n }\n /* Its text is drawn from attributes: hold one line until it upgrades. */\n uvalib-results-count:not(:defined) {\n display: block;\n min-block-size: 1.5em;\n }\n uvalib-tag-list:not(:defined)[hidden],\n uvalib-results-count:not(:defined)[hidden] {\n display: none;\n }\n /* The pre-upgrade rules here set display, which beats the hidden attribute's (issue #7).\n More specific than each of them (two pseudo-classes or attributes), so it needs no importance flag. */\n :where(\n site-page,\n uvalib-breadcrumbs,\n uvalib-card,\n uvalib-card-grid,\n uvalib-pager,\n uvalib-contents,\n uvalib-metadata,\n uvalib-chip-group,\n uvalib-tabs,\n uvalib-combobox,\n uvalib-image-regions,\n uvalib-map,\n uvalib-filter-drawer,\n uvalib-filter\n ):not(:defined)[hidden],\n :where(uvalib-combobox, uvalib-image-regions):not(:defined) > [hidden] {\n display: none;\n }\n /* A record's details before <uvalib-metadata> upgrades (issue #34): the rows already laid\n out as it lays them out (label beside value from 36rem of its own width, stacked below;\n 8px above and below each row, a 1px rule between rows; lists without bullets, 4px apart),\n so the page does not move when it upgrades. Rows the attributes add (creator, rights,\n citation) are not in the page's <dl> and cannot be held. */\n uvalib-metadata:not(:defined) {\n container-type: inline-size;\n font-size: 1rem;\n }\n uvalib-metadata:not(:defined) > dl {\n display: grid;\n grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr);\n column-gap: 1.5rem;\n margin: 0;\n }\n uvalib-metadata:not(:defined) > dl > dt {\n grid-column: 1;\n margin: 0;\n padding-block: 0.5rem;\n font-weight: 700;\n }\n uvalib-metadata:not(:defined) > dl > dd {\n grid-column: 2;\n margin: 0;\n padding-block: 0.5rem;\n }\n uvalib-metadata:not(:defined) > dl > dt:not(:first-child),\n uvalib-metadata:not(:defined) > dl > dt:not(:first-child) + dd {\n border-block-start: 1px solid transparent;\n }\n uvalib-metadata:not(:defined) > dl > dd > :is(ul, ol) {\n margin: 0;\n padding: 0;\n list-style: none;\n }\n uvalib-metadata:not(:defined) > dl > dd li + li {\n margin-block-start: 0.25rem;\n }\n @container (width < 36rem) {\n uvalib-metadata:not(:defined) > dl {\n grid-template-columns: minmax(0, 1fr);\n }\n uvalib-metadata:not(:defined) > dl > :is(dt, dd) {\n grid-column: 1;\n }\n uvalib-metadata:not(:defined) > dl > dt {\n padding-block-end: 0;\n }\n uvalib-metadata:not(:defined) > dl > dd {\n padding-block-start: 0;\n }\n uvalib-metadata:not(:defined) > dl > dt:not(:first-child) + dd {\n border-block-start: 0;\n }\n }\n ${metadataLimits}\n /* Tabs stay readable before the script runs: a block, one panel, and a gap the\n size of the tab row (44px) plus its 1rem margin, so the first panel does not\n jump when the element upgrades. Later data-tab panels stay hidden. */\n uvalib-tabs:not(:defined) {\n display: block;\n padding-block-start: calc(44px + 1rem);\n }\n uvalib-tabs:not(:defined) > [data-tab] ~ [data-tab] {\n display: none;\n }\n /* A combobox: its label (from the attribute) and one 44px field (plus a one-line\n description) held, so nothing moves when it upgrades. A fallback <input list> child\n works meanwhile; the other children (options, a datalist) stay out of sight. */\n uvalib-combobox:not(:defined) {\n display: block;\n min-block-size: calc(1.5em + 0.25rem + 44px);\n line-height: 1.5;\n }\n uvalib-combobox[description]:not(:defined) {\n min-block-size: calc(3em + 0.5rem + 44px);\n }\n uvalib-combobox:not(:defined)::before {\n content: attr(label);\n display: block;\n margin-block-end: 0.25rem;\n font-weight: 600;\n }\n uvalib-combobox:not(:defined) > :not(input) {\n display: none;\n }\n uvalib-combobox:not(:defined) > input {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: 44px;\n font: inherit;\n line-height: 1.2;\n }\n /* Image regions: the image at its own width and the list beside it (or under it), the\n layout the element keeps once it upgrades, so the image does not move. */\n uvalib-image-regions:not(:defined) {\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n align-items: flex-start;\n }\n uvalib-image-regions:not(:defined) > :is(img, picture) {\n display: block;\n flex: 0 1 auto;\n min-width: 0;\n max-width: 100%;\n height: auto;\n }\n uvalib-image-regions:not(:defined) > :is(ol, ul) {\n flex: 1 1 14rem;\n min-width: 0;\n }\n /* A map: its key instructions (the same text it shows) and the map's height held above\n the child list, so the list does not move when the map is drawn over the page's\n Leaflet. Padding, not margin, so it cannot collapse with the list's own top margin. */\n uvalib-map:not(:defined) {\n display: block;\n }\n uvalib-map:not(:defined)::before {\n content: 'Tab or arrow keys move between places; Enter opens one. With the map focused, arrow keys pan and + and − zoom.';\n display: block;\n padding-block-end: calc(0.5rem + max(12rem, var(--uvalib-map-height, min(24rem, 75vw))));\n font-size: 0.875rem;\n line-height: 1.5;\n color: var(--uva-color-text-muted, #4b5563);\n }\n /* A collapsed filter group (<uvalib-filter collapsible collapsed>) draws only its 44px\n legend button once it upgrades: hold that height. Low specificity, so the [hidden] rule\n above still wins. */\n :where(uvalib-filter[collapsible][collapsed]):not(:defined) {\n display: block;\n min-block-size: 44px;\n }\n /* A filter drawer on a phone (the default 48rem breakpoint): once it upgrades only its 44px\n \"Search and filters\" button shows, so hold that height and keep the form and filters out\n of sight meanwhile; nothing moves when it upgrades. A page with its own breakpoint adds the\n same two rules in a media query of that width (see the README). Low specificity, so the\n [hidden] rule above still wins. */\n @media (max-width: 48rem) {\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) {\n display: block;\n min-block-size: 44px;\n }\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) > * {\n display: none;\n }\n }\n /* A dialog before <uvalib-dialog> upgrades: its children are the dialog's content, never\n shown in the page, so nothing flashes or moves. Once defined, a closed dialog renders\n nothing (its host is display: contents around a closed <dialog>). */\n uvalib-dialog:not(:defined) {\n display: none;\n }\n /* A citation before <uvalib-citation> upgrades: only the first format's citation, boxed\n as it will be, with the label and 44px format bar held above it (none for hide-label)\n and the 44px Copy citation row below, so nothing moves when it upgrades (an app's\n citations property cannot be held). */\n uvalib-citation:not(:defined) {\n display: block;\n font-size: 1rem;\n line-height: 1.5;\n }\n uvalib-citation:not(:defined):has(> [data-format]) {\n padding-block: calc(2rem + 44px + 0.75rem) calc(0.75rem + 44px);\n }\n uvalib-citation[hide-label]:not(:defined):has(> [data-format]) {\n padding-block-start: calc(44px + 0.75rem);\n }\n uvalib-citation:not(:defined) > [data-format] {\n margin: 0;\n padding: 0.75rem 1rem;\n border: 1px solid transparent;\n overflow-wrap: anywhere;\n text-wrap: pretty;\n }\n uvalib-citation:not(:defined) > [data-format] ~ [data-format],\n uvalib-citation:not(:defined) > [slot] {\n display: none;\n }\n /* Printing a <site-page> (issue #20; its own styles leave out the chrome): a dark scheme\n prints light (the role tokens resolve to their light values), and the content's links\n are black and underlined, so they are told apart without colour. Content is <main> in\n light DOM and the unslotted children in shadow DOM. print-chrome keeps the page as it is\n shown, apart from the light scheme. */\n @media print {\n :root[data-uva-color-scheme]:has(site-page) {\n color-scheme: light;\n --uva-color-scheme: light;\n }\n /* Light DOM's trail, here too, as the pre-upgrade rule above (unlayered) would win. */\n site-page:not([print-chrome]) > [slot='breadcrumbs'] {\n display: none;\n }\n site-page:not([print-chrome]) > :not([slot], site-header, site-footer, .alerts-list) :any-link,\n site-page:not([print-chrome]) > :any-link:not([slot], .skip-link) {\n color: #000;\n text-decoration: underline;\n }\n }\n @keyframes uvalib-site-page-reveal {\n to {\n visibility: visible;\n }\n }\n`;\n"],"mappings":";;AAkBA,IAAaG,IAAe,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDzBC,IAAQ;CAAC;CAAO;CAAO;CAAO;AAAY;AAQhD,SAAgBC,EAAiB,GAAqB;CACpD,IAAMC,IAAQC,EAAI;CAClB,IAAKD,GAAO,MACZ,KAAK,IAAME,KAAQJ,GAAO,EAAM,KAAK,GAAGI,EAAK,6BAA6B,CAAC,CAAC,YAAY,CAAC,CAAC;AAC5F;;AC3EA,IAAaC,IAAS,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCOnBC,IAAkB,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAMT,IAAI,CAAC,GAC5DU,IAAiBX,EACrBU,EAAgB,KAAK,MAAM;CACzB,IAAME,IAAQ,CACZ,+BAA+BC,EAAE,+EACjC,uDAAuDA,EAAE,iBAC3D;CACA,OACE,GAAGD,EAAM,KAAK,MAAM,GAAGE,EAAE,sBAAsBD,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE,uBAClED,EAAM,KAAK,MAAM,GAAGE,EAAE,sBAAsBD,IAAI,EAAE,UAAU,CAAC,CAAC,KAAK,KAAK,EAAE;AAEjF,CAAC,CAAC,CAAC,KAAK,IAAI,CACd,GAEaE,IAAc,uCASdC,IAAO,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmJnBL,EAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/base/clipboard.ts
|
|
2
|
+
async function e(e, t) {
|
|
3
|
+
let n = navigator.clipboard;
|
|
4
|
+
if (t && typeof ClipboardItem == "function" && typeof n?.write == "function") try {
|
|
5
|
+
await n.write([new ClipboardItem({
|
|
6
|
+
"text/plain": new Blob([e], { type: "text/plain" }),
|
|
7
|
+
"text/html": new Blob([t], { type: "text/html" })
|
|
8
|
+
})]);
|
|
9
|
+
return;
|
|
10
|
+
} catch {}
|
|
11
|
+
await n.writeText(e);
|
|
12
|
+
}
|
|
13
|
+
function t(e) {
|
|
14
|
+
e && e.ownerDocument?.getSelection()?.selectAllChildren(e);
|
|
15
|
+
}
|
|
16
|
+
export { t as n, e as t };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=clipboard-CNG7Y_5X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard-CNG7Y_5X.js","names":["copyText","clipboard","html","text","selectContents","node"],"sources":["../../src/base/clipboard.ts"],"sourcesContent":["/**\n * Copy `text` to the clipboard. With `html`, it is copied as both `text/html` and\n * `text/plain` (a `ClipboardItem`), so emphasis such as an italic title survives a paste into\n * a word processor, falling back to plain text where that is not supported or refused.\n * Rejects when nothing could be copied (no clipboard, or permission denied).\n */\nexport async function copyText(text: string, html?: string): Promise<void> {\n const clipboard = navigator.clipboard;\n if (html && typeof ClipboardItem === 'function' && typeof clipboard?.write === 'function') {\n try {\n await clipboard.write([\n new ClipboardItem({\n 'text/plain': new Blob([text], { type: 'text/plain' }),\n 'text/html': new Blob([html], { type: 'text/html' }),\n }),\n ]);\n return;\n } catch {\n // Some browsers refuse HTML: plain text below.\n }\n }\n await clipboard.writeText(text);\n}\n\n/** Select everything in `node`, so that the visitor can copy it with the keyboard. */\nexport function selectContents(node: Node | null | undefined): void {\n if (node) node.ownerDocument?.getSelection()?.selectAllChildren(node);\n}\n"],"mappings":";AAMA,eAAsBA,EAAS,GAAc,GAA8B;CACzE,IAAMC,IAAY,UAAU;CAC5B,IAAIC,KAAQ,OAAO,iBAAkB,cAAc,OAAOD,GAAW,SAAU,YAC7E,IAAI;EACF,MAAMA,EAAU,MAAM,CACpB,IAAI,cAAc;GAChB,cAAc,IAAI,KAAK,CAACE,CAAI,GAAG,EAAE,MAAM,aAAa,CAAC;GACrD,aAAa,IAAI,KAAK,CAACD,CAAI,GAAG,EAAE,MAAM,YAAY,CAAC;EACrD,CAAC,CACH,CAAC;EACD;CACF,QAAQ,CAER;CAEF,MAAMD,EAAU,UAAUE,CAAI;AAChC;AAGA,SAAgBC,EAAe,GAAqC;CAClE,AAAIC,KAAMA,EAAK,eAAe,aAAa,CAAC,EAAE,kBAAkBA,CAAI;AACtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if-defined-COiQb-gl.js","names":["t","A","o"],"sources":["../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/if-defined.js"],"sourcesContent":["import{nothing as t}from\"../lit-html.js\";\n/**\n * @license\n * Copyright 2018 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const o=o=>o??t;export{o as ifDefined};\n//# sourceMappingURL=if-defined.js.map\n"],"ignoreList":[0],"mappings":";;AAKG,IAAME,KAAE,MAAGA,KAAGF"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./UvalibElement-pGONDAwB.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
2
|
+
import { t as u } from "./if-defined-COiQb-gl.js";
|
|
3
|
+
import { a as d } from "./analytics-DTTihuBD.js";
|
|
4
|
+
import { t as f } from "./link-DbJSwj16.js";
|
|
5
|
+
import { t as p } from "./accessible-DJv7YOtS.js";
|
|
6
|
+
import { n as m, r as h, t as g } from "./site-main-nav-CmMq2t8t.js";
|
|
6
7
|
// src/styles/color-scheme.ts
|
|
7
8
|
var _ = s("\n --uva-color-border: #7a84a0;\n"), v = "color: var(--uva-color-pre-footer-text, #ffffff);", y = t`
|
|
8
9
|
@supports (color: light-dark(#000, #fff)) {
|
|
@@ -56,6 +57,10 @@ var _ = s("\n --uva-color-border: #7a84a0;\n"), v = "color: var(--uva-color-pre
|
|
|
56
57
|
text (7.6:1). */
|
|
57
58
|
--uva-color-highlight: light-dark(var(--uva-brand-orange-200, #ffc999), #854200);
|
|
58
59
|
--uva-color-on-highlight: light-dark(var(--uva-grey-darkest, #2b2b2b), #ffffff);
|
|
60
|
+
/* base.css's .uvalib-table: the row rules (decorative) and the stripes, where body text
|
|
61
|
+
is 12.5:1 in light and 12.6:1 in dark (AAA); muted text 6.7:1 and 6.9:1. */
|
|
62
|
+
--uva-color-table-border: light-dark(var(--uva-grey-100, #dadada), #4f5a7a);
|
|
63
|
+
--uva-color-table-stripe: light-dark(var(--uva-grey-200, #f1f1f1), #1a2340);
|
|
59
64
|
}
|
|
60
65
|
:root[data-uva-color-scheme='system'] {
|
|
61
66
|
color-scheme: light dark;
|
|
@@ -254,7 +259,7 @@ var R = class {
|
|
|
254
259
|
"hreflang"
|
|
255
260
|
], ne = (e) => e.stopPropagation(), Q = class extends l {
|
|
256
261
|
static {
|
|
257
|
-
this.styles = [
|
|
262
|
+
this.styles = [p, t`
|
|
258
263
|
:host {
|
|
259
264
|
display: block;
|
|
260
265
|
width: 100%;
|
|
@@ -545,14 +550,14 @@ var R = class {
|
|
|
545
550
|
constructor() {
|
|
546
551
|
super(), this.rootLinkDomain = "https://www.library.virginia.edu", this.variant = "full", this.noMainNav = !1, this.colorSchemeSwitch = !1, this.scheme = new R(this, () => this.colorSchemeSwitch, () => this.noStyle), this.schemeName = `uva-color-scheme-${++W}`, this.mainNavItems = null, this.warnedMainNav = !1, this.siteLinks = null, this.warnedInvalid = !1, this.trackClick = (e) => {
|
|
547
552
|
let t = e.composedPath(), n = t.find((e) => e instanceof HTMLAnchorElement);
|
|
548
|
-
n && !t.some((e) => e instanceof Element && /^site-(main-nav|alerts)$/.test(e.localName)) && (n.slot === "skip-link" && n.parentNode === this ?
|
|
553
|
+
n && !t.some((e) => e instanceof Element && /^site-(main-nav|alerts)$/.test(e.localName)) && (n.slot === "skip-link" && n.parentNode === this ? d(this, [B, "skip-link"]) : n.matches(".logo") ? d(this, [B, "logo-click"]) : n.matches(".site-name") ? d(this, [B, "site-name-click"]) : n.closest("nav.inline, nav.menu") && this.renderRoot.contains(n) && d(this, [
|
|
549
554
|
B,
|
|
550
555
|
"link-click",
|
|
551
556
|
n.textContent.replace(/\s+/g, " ").trim()
|
|
552
557
|
]));
|
|
553
558
|
}, this.trackToggle = (e) => {
|
|
554
559
|
let t = e.composedPath()[0];
|
|
555
|
-
t instanceof HTMLElement && t.id === this.menuId && e.newState === "open" &&
|
|
560
|
+
t instanceof HTMLElement && t.id === this.menuId && e.newState === "open" && d(this, [B, "menu-open"]);
|
|
556
561
|
}, this.onMenuLinkClick = (e) => {
|
|
557
562
|
if (e.button !== 0 || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;
|
|
558
563
|
let t = e.composedPath(), n = t.findIndex((e) => e instanceof Element && e.localName === "a"), r = t.findIndex((e) => e instanceof HTMLElement && e.id === this.menuId);
|
|
@@ -598,7 +603,7 @@ var R = class {
|
|
|
598
603
|
return (this.siteName ?? "").replace(/\s+/g, " ").trim();
|
|
599
604
|
}
|
|
600
605
|
brand() {
|
|
601
|
-
let e = r`<a class="logo" href=${
|
|
606
|
+
let e = r`<a class="logo" href=${f(this.rootLinkDomain, "/")}
|
|
602
607
|
><img src=${this.logoSrc()} alt="UVA Library home" width="304" height="69"
|
|
603
608
|
/></a>`, t = this.name;
|
|
604
609
|
return t ? r`<div class="brand">
|
|
@@ -608,11 +613,11 @@ var R = class {
|
|
|
608
613
|
</div>` : e;
|
|
609
614
|
}
|
|
610
615
|
logoSrc() {
|
|
611
|
-
return this.scheme.logoDark ? G :
|
|
616
|
+
return this.scheme.logoDark ? G : f(this.rootLinkDomain, "/sites/default/files/2022-09/library_rgb.png");
|
|
612
617
|
}
|
|
613
618
|
onSchemeChange(e) {
|
|
614
619
|
let t = e.target;
|
|
615
|
-
t.checked && (this.scheme.choose(t.value),
|
|
620
|
+
t.checked && (this.scheme.choose(t.value), d(this, [
|
|
616
621
|
B,
|
|
617
622
|
"color-scheme",
|
|
618
623
|
t.value
|
|
@@ -654,7 +659,7 @@ var R = class {
|
|
|
654
659
|
syncMainNav() {
|
|
655
660
|
let e = this.lightDom ? this.adoptMainNav() : this.slottedMainNav;
|
|
656
661
|
if (!e.length) return this.mainNavItems &&= null, e;
|
|
657
|
-
let t = e.flatMap((e, t) => t === 0 ?
|
|
662
|
+
let t = e.flatMap((e, t) => t === 0 ? h(e) : [{}]), n = m(t);
|
|
658
663
|
(n.invalid || n.flattened) && !this.warnedMainNav && (this.warnedMainNav = !0, console.warn(`${this.localName}: ignoring invalid slot="${Y}" entries (each needs a label, and an href or links; deeper levels are shown in their group).`));
|
|
659
664
|
let r = n.items.length ? n.items : null;
|
|
660
665
|
return JSON.stringify(r) !== JSON.stringify(this.mainNavItems) && (this.mainNavItems = r), e;
|
|
@@ -782,7 +787,7 @@ var R = class {
|
|
|
782
787
|
hreflang=${u(e.hreflang)}
|
|
783
788
|
>${e.text}</a
|
|
784
789
|
>
|
|
785
|
-
</li>`) : (t ? H : V).map((t) => r`<li><a href=${
|
|
790
|
+
</li>`) : (t ? H : V).map((t) => r`<li><a href=${f(e, t.path)}>${t.label}</a></li>`), a = n ? this.siteLinksLabel || "Site" : "Utility", s = this.menuId, c = `--${s}`, l = !t && !this.noMainNav, d = r`<button
|
|
786
791
|
popovertarget=${s}
|
|
787
792
|
aria-controls=${s}
|
|
788
793
|
class="menu-toggle"
|
|
@@ -810,9 +815,9 @@ var R = class {
|
|
|
810
815
|
<ul id=${s} popover style="--menu-anchor: ${c}">
|
|
811
816
|
${i}
|
|
812
817
|
</ul>
|
|
813
|
-
</nav>`,
|
|
818
|
+
</nav>`, p = r`<div hidden>
|
|
814
819
|
<slot name="site-links" @slotchange=${this.onSourcesChange}></slot>
|
|
815
|
-
</div>`,
|
|
820
|
+
</div>`, m = (t) => r`<site-main-nav
|
|
816
821
|
class=${t ? "accordion" : "bar"}
|
|
817
822
|
layout=${u(t ? "accordion" : void 0)}
|
|
818
823
|
?no-shadow-dom=${this.lightDom}
|
|
@@ -823,7 +828,7 @@ var R = class {
|
|
|
823
828
|
current=${u(this.mainNavCurrent || void 0)}
|
|
824
829
|
.items=${this.mainNavItems ?? void 0}
|
|
825
830
|
@site-main-nav-error=${t ? ne : o}
|
|
826
|
-
></site-main-nav>`,
|
|
831
|
+
></site-main-nav>`, h = r`<button
|
|
827
832
|
popovertarget=${s}
|
|
828
833
|
aria-controls=${s}
|
|
829
834
|
class="menu-toggle"
|
|
@@ -848,21 +853,21 @@ var R = class {
|
|
|
848
853
|
Menu
|
|
849
854
|
</button>
|
|
850
855
|
<div id=${s} popover class="menu-popover" style="--menu-anchor: ${c}">
|
|
851
|
-
${
|
|
856
|
+
${m(!0)}
|
|
852
857
|
<nav class="menu" aria-label=${`${a} menu`}>
|
|
853
858
|
<ul>
|
|
854
859
|
${i}
|
|
855
860
|
</ul>
|
|
856
861
|
</nav>
|
|
857
862
|
</div>
|
|
858
|
-
${
|
|
863
|
+
${m(!1)}`, g = r`<div hidden>
|
|
859
864
|
<slot name="site-links" @slotchange=${this.onSourcesChange}></slot>
|
|
860
865
|
</div>
|
|
861
866
|
<div hidden>
|
|
862
867
|
<slot name="main-nav" @slotchange=${this.onSourcesChange}></slot>
|
|
863
868
|
</div>`;
|
|
864
|
-
if (this.scheme.active) return this.renderWithScheme(i, a, l,
|
|
865
|
-
let _ = t ? o : l ?
|
|
869
|
+
if (this.scheme.active) return this.renderWithScheme(i, a, l, m);
|
|
870
|
+
let _ = t ? o : l ? h : d, v = this.lightDom ? o : l ? g : p;
|
|
866
871
|
return this.name ? r`
|
|
867
872
|
<header part="header" class=${t ? "vendor" : ""}>
|
|
868
873
|
${this.lightDom ? o : r`<slot name="skip-link"></slot><slot name="alerts"></slot>`}
|
|
@@ -878,7 +883,7 @@ var R = class {
|
|
|
878
883
|
` : r`
|
|
879
884
|
<header part="header" class=${t ? "vendor" : ""}>
|
|
880
885
|
${this.lightDom ? o : r`<slot name="skip-link"></slot><slot name="alerts"></slot>`}
|
|
881
|
-
<a class="logo" href=${
|
|
886
|
+
<a class="logo" href=${f(e, "/")}
|
|
882
887
|
><img src=${this.logoSrc()} alt="UVA Library home" width="304" height="69"
|
|
883
888
|
/></a>
|
|
884
889
|
<nav class="inline" aria-label=${a}>
|
|
@@ -925,7 +930,7 @@ a([e({
|
|
|
925
930
|
attribute: "color-scheme-switch"
|
|
926
931
|
})], Q.prototype, "colorSchemeSwitch", void 0), a([n()], Q.prototype, "mainNavItems", void 0), a([n()], Q.prototype, "siteLinks", void 0), i("site-header", Q);
|
|
927
932
|
var $ = customElements.get("site-main-nav");
|
|
928
|
-
$ && $ !==
|
|
933
|
+
$ && $ !== g && console.warn("site-header: <site-main-nav> is already defined by another copy of @uvalib/web-components; the header uses that one. Load the components from one source only.");
|
|
929
934
|
export { R as t };
|
|
930
935
|
|
|
931
|
-
//# sourceMappingURL=site-header-
|
|
936
|
+
//# sourceMappingURL=site-header-B78a_ldi.js.map
|
|
@@ -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,EAAO,IAAIK,CAAG;CAC3B,IAAIE,GAAM,OAAOA;CACjB,IAAI;EACF,OAAON,EAAaI,EAAI,aAAa,aAAa,QAAQT,CAAwB,CAAC;CACrF,QAAQ;EACN,OAAO;CACT;AACF;AAGA,SAAgBY,EAAa,IAAgB,UAAmB;CAC9D,OAAO,CAAC,CAACH,EAAI,aAAa,aAAaN,CAAU,CAAC,CAAC;AAC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