@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.
Files changed (75) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +485 -59
  3. package/dist/base/clipboard.d.ts +9 -0
  4. package/dist/base/clipboard.js +30 -0
  5. package/dist/base/clipboard.js.map +1 -0
  6. package/dist/base.css +188 -3
  7. package/dist/components/uvalib-citation/UvalibCitation.d.ts +124 -0
  8. package/dist/components/uvalib-citation/UvalibCitation.js +545 -0
  9. package/dist/components/uvalib-citation/UvalibCitation.js.map +1 -0
  10. package/dist/components/uvalib-citation/uvalib-citation.d.ts +1 -0
  11. package/dist/components/uvalib-citation/uvalib-citation.js +4 -0
  12. package/dist/components/uvalib-citation/uvalib-citation.js.map +1 -0
  13. package/dist/components/uvalib-dialog/UvalibDialog.d.ts +167 -0
  14. package/dist/components/uvalib-dialog/UvalibDialog.js +688 -0
  15. package/dist/components/uvalib-dialog/UvalibDialog.js.map +1 -0
  16. package/dist/components/uvalib-dialog/uvalib-dialog.d.ts +1 -0
  17. package/dist/components/uvalib-dialog/uvalib-dialog.js +4 -0
  18. package/dist/components/uvalib-dialog/uvalib-dialog.js.map +1 -0
  19. package/dist/components/uvalib-filter/UvalibFilter.d.ts +92 -9
  20. package/dist/components/uvalib-filter/UvalibFilter.js +748 -60
  21. package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -1
  22. package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -4
  23. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  24. package/dist/custom-elements.json +4402 -2139
  25. package/dist/index.d.ts +4 -0
  26. package/dist/index.js +2 -0
  27. package/dist/index.js.map +1 -1
  28. package/dist/styles/base.js +41 -1
  29. package/dist/styles/base.js.map +1 -1
  30. package/dist/styles/color-scheme.js +4 -0
  31. package/dist/styles/color-scheme.js.map +1 -1
  32. package/dist/styles/controls.js +4 -0
  33. package/dist/styles/controls.js.map +1 -1
  34. package/dist/styles/field-text.d.ts +1 -0
  35. package/dist/styles/field-text.js +21 -0
  36. package/dist/styles/field-text.js.map +1 -0
  37. package/dist/styles/hidden.js +13 -1
  38. package/dist/styles/hidden.js.map +1 -1
  39. package/dist/styles/table.d.ts +1 -0
  40. package/dist/styles/table.js +164 -0
  41. package/dist/styles/table.js.map +1 -0
  42. package/dist/tokens.css +4 -0
  43. package/dist-cdn/base.css +188 -3
  44. package/dist-cdn/chunks/{base-B3tNX103.js → base-CHMHBPeI.js} +42 -2
  45. package/dist-cdn/chunks/{base-B3tNX103.js.map → base-CHMHBPeI.js.map} +1 -1
  46. package/dist-cdn/chunks/clipboard-CNG7Y_5X.js +18 -0
  47. package/dist-cdn/chunks/clipboard-CNG7Y_5X.js.map +1 -0
  48. package/dist-cdn/chunks/if-defined-COiQb-gl.js +6 -0
  49. package/dist-cdn/chunks/if-defined-COiQb-gl.js.map +1 -0
  50. package/dist-cdn/chunks/{site-header-CEmNtmk5.js → site-header-B78a_ldi.js} +27 -22
  51. package/dist-cdn/chunks/site-header-B78a_ldi.js.map +1 -0
  52. package/dist-cdn/chunks/{site-main-nav-CAwKq_x5.js → site-main-nav-CmMq2t8t.js} +52 -51
  53. package/dist-cdn/chunks/site-main-nav-CmMq2t8t.js.map +1 -0
  54. package/dist-cdn/custom-elements.json +4402 -2139
  55. package/dist-cdn/manifest.json +4 -2
  56. package/dist-cdn/site-header.js +1 -1
  57. package/dist-cdn/site-main-nav.js +1 -1
  58. package/dist-cdn/site-page.js +3 -3
  59. package/dist-cdn/site-style.js +1 -1
  60. package/dist-cdn/skills/uvalib-web-components/SKILL.md +8 -5
  61. package/dist-cdn/skills/uvalib-web-components/reference/components.md +135 -8
  62. package/dist-cdn/tokens.css +4 -0
  63. package/dist-cdn/uvalib-citation.js +382 -0
  64. package/dist-cdn/uvalib-citation.js.map +1 -0
  65. package/dist-cdn/uvalib-dialog.js +419 -0
  66. package/dist-cdn/uvalib-dialog.js.map +1 -0
  67. package/dist-cdn/uvalib-filter.js +603 -69
  68. package/dist-cdn/uvalib-filter.js.map +1 -1
  69. package/dist-cdn/uvalib-metadata.js +49 -49
  70. package/dist-cdn/uvalib-metadata.js.map +1 -1
  71. package/package.json +9 -1
  72. package/skills/uvalib-web-components/SKILL.md +8 -5
  73. package/skills/uvalib-web-components/reference/components.md +135 -8
  74. package/dist-cdn/chunks/site-header-CEmNtmk5.js.map +0 -1
  75. package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"uvalib-metadata.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","langDir","normalize","safeHref","SourceChildren","accessible","STATEMENTS","rightsName","u","href","host","path","m","licence","tool","specialCollectionsCitation","title","RIGHTS_INFO_TEXT","STATUS_MS","LIST","FOCUSABLE","limitOf","v","instances","structuralRules","shadowStructure","UvalibMetadata","nodes","root","sheet","node","kind","message","dl","key","cells","c","rows","row","label","value","list","limit","noun","clone","base","unsafe","el","size","a","span","doc","frag","dot","comma","download","A","items","own","rights","statement","info","more","text","p","source","changed","dd","open","li","l","lower","first","button","place","target","shownFrom","ri","vi"],"sources":["../src/components/uvalib-metadata/rights.ts","../src/components/uvalib-metadata/UvalibMetadata.ts","../src/components/uvalib-metadata/uvalib-metadata.ts"],"sourcesContent":["/** rightsstatements.org's statements, by their id in the URL, with their short names. */\nconst STATEMENTS: Record<string, string> = {\n INC: 'In Copyright',\n 'INC-OW-EU': 'In Copyright – EU Orphan Work',\n 'INC-EDU': 'In Copyright – Educational Use Permitted',\n 'INC-NC': 'In Copyright – Non-Commercial Use Permitted',\n 'INC-RUU': 'In Copyright – Rights-holder(s) Unlocatable or Unidentifiable',\n 'NOC-CR': 'No Copyright – Contractual Restrictions',\n 'NOC-NC': 'No Copyright – Non-Commercial Use Only',\n 'NOC-OKLR': 'No Copyright – Other Known Legal Restrictions',\n 'NOC-US': 'No Copyright – United States',\n CNE: 'Copyright Not Evaluated',\n UND: 'Copyright Undetermined',\n NKC: 'No Known Copyright',\n};\n\n/**\n * The short name of a rightsstatements.org statement or Creative Commons licence or tool from\n * its URL (\"In Copyright\", \"CC BY-NC 4.0\", \"CC0 1.0\", \"Public Domain Mark 1.0\"), or\n * `undefined` for any other URL.\n */\nexport function rightsName(href: string): string | undefined {\n let u: URL;\n try {\n u = new URL(href);\n } catch {\n return undefined;\n }\n const host = u.hostname.toLowerCase().replace(/^www\\./, '');\n const path = u.pathname;\n if (host === 'rightsstatements.org') {\n const m = /^\\/(?:vocab|page|data)\\/([a-z-]+)\\/\\d/i.exec(path);\n return m ? STATEMENTS[m[1]!.toUpperCase()] : undefined;\n }\n if (host === 'creativecommons.org') {\n const licence = /^\\/licenses\\/((?:by|nc|nd|sa)(?:-(?:by|nc|nd|sa))*)\\/(\\d+(?:\\.\\d+)*)/i.exec(\n path,\n );\n if (licence) return `CC ${licence[1]!.toUpperCase()} ${licence[2]}`;\n const tool = /^\\/publicdomain\\/(zero|mark)\\/(\\d+(?:\\.\\d+)*)/i.exec(path);\n if (tool)\n return tool[1]!.toLowerCase() === 'zero' ? `CC0 ${tool[2]}` : `Public Domain Mark ${tool[2]}`;\n }\n return undefined;\n}\n\n/** The Albert and Shirley Small Special Collections Library's citation for a title or collection. */\nexport const specialCollectionsCitation = (title: string): string =>\n `${title}, Albert and Shirley Small Special Collections Library, University of Virginia`;\n","import { css, html, nothing, unsafeCSS, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { langDir } from '../../base/inline-copy.js';\nimport { normalize, safeHref, SourceChildren } from '../../base/source-children.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { rightsName, specialCollectionsCitation } from './rights.js';\n\n/** A link value: a download when it has `download` or a `size` (\"EPUB · 184 KB\"). */\nexport interface MetadataLink {\n label: string;\n href: string;\n /** The file's size as shown, such as `184 KB`. */\n size?: string;\n /** The `download` attribute: `true` for an empty one, a string for a file name. */\n download?: boolean | string;\n}\n\n/** One value: text, or a link. */\nexport type MetadataValue = string | number | MetadataLink;\n\n/** A row: its label and one value, or several (shown as a list). */\nexport interface MetadataItem {\n label: string;\n value: MetadataValue | MetadataValue[];\n /** A list value: show this many and a “Show all N” button (0: no limit). Wins over `list-limit`. */\n limit?: number;\n /** The noun in “Show all 34 participants”, instead of the label with a lowercase first letter. */\n limitLabel?: string;\n}\n\n/**\n * A value as drawn: a template or text (from `items`), or `source`, prepared copies of an\n * author's `<dd>` content that are never inserted themselves (each render set clones them).\n * `lang`/`dir` come from the source `<dd>`.\n */\ninterface Value {\n content?: TemplateResult | string;\n source?: Node[];\n lang?: string;\n dir?: string;\n /** A list value: how many `<li>` it has. */\n count?: number;\n /** The row's own limit (`data-limit`), winning over `list-limit`. */\n limit?: number;\n /** The noun in the toggle (`data-limit-label`). */\n limitLabel?: string;\n}\n\n/** A row as drawn; `lang`/`dir` come from the source `<dt>`. */\ninterface Row {\n label: string;\n lang?: string;\n dir?: string;\n values: Value[];\n}\n\nconst RIGHTS_INFO_TEXT = 'More about rights and permissions';\nconst STATUS_MS = 5000;\n/** The list in a value: a `<ul>` or `<ol>` that is a direct child of the `<dd>`. */\nconst LIST = ':scope > ul, :scope > ol';\n/** What takes focus inside a revealed value, before the value itself. */\nconst FOCUSABLE = 'a[href], button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n/** A limit: a whole number of at least 0, else undefined. */\nconst limitOf = (v: unknown): number | undefined => {\n if (v === null || v === undefined || (typeof v === 'string' && !v.trim())) return undefined;\n const n = Math.trunc(Number(v));\n return Number.isFinite(n) ? Math.max(0, n) : undefined;\n};\n\nlet instances = 0;\n\n/**\n * The rules kept with `no-style`: unmarked value lists, the terms and values stacked, the\n * visually hidden text hidden, and `[hidden]` hides.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} dl, ${host} dd { margin: 0; }\n ${host} dd :is(ul, ol) { list-style: none; margin: 0; padding: 0; }\n ${host} :where(.more) {\n display: inline-flex;\n align-items: center;\n box-sizing: border-box;\n min-height: 24px;\n min-width: 24px;\n margin-top: 0.25rem;\n }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/**\n * A record's details as a description list, as on the library's digital collections: label\n * and value side by side on wide screens (the element's own width, 36rem and up), stacked on\n * narrow ones. Values may be text, links or lists (subjects).\n *\n * Give the rows as a `<dl>` child (so the page reads the same before the script loads):\n * `<dt>` labels and `<dd>` values, optionally wrapped in a `<div>` per row; several `<dd>`\n * after one `<dt>` are several values. The values are copied as written (links, lists,\n * `download` attributes kept); a link with `data-size=\"184 KB\"` is shown as a download,\n * \"EPUB · 184 KB\". The list follows changes to the children. Apps set the `items`\n * property instead (`{ label, value }`, winning over the children while set).\n *\n * Built-in rows for credit and rights (as Special Collections asks): `creator` and\n * `organization` come first; `rights` (a rightsstatements.org or Creative Commons URL, shown\n * as its short name linked to it, or plain text) and `citation` (\"How to cite\", with a Copy\n * citation button that announces \"Copied\" politely) come last. `citation-title` builds the\n * Special Collections citation, \"<title>, Albert and Shirley Small Special Collections\n * Library, University of Virginia\".\n *\n * Long lists: `list-limit=\"8\"` shortens every value that is a list (a `<ul>`/`<ol>` in the\n * `<dd>`) of more than 8 items to its first 8 and a “Show all 34 participants” button\n * (`aria-expanded`, `aria-controls`) that reveals the rest in place and moves focus to the\n * first one; it then reads “Show fewer”. `data-limit` on a `<dd>` or its list sets that row's\n * own limit (`0`: none); the noun is the label with a lowercase first letter, or\n * `data-limit-label`. Every value stays in the markup (the hidden ones `hidden`).\n *\n * @tagname uvalib-metadata\n * @fires uvalib-analytics-event - For `<site-analytics>`: the Copy citation button, `['uvalib-metadata', 'copy-citation']`, and a list's toggle, `['uvalib-metadata', 'show-all'|'show-fewer', 'row N']` (N from 1, the row's place in the list; never its label or values). Downloads are left to Matomo's own download tracking. Bubbles and is composed.\n * @cssprop [--uva-blue-alt-dark=#005679] - Link colour.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Value colour.\n * @cssprop --uva-color-utility-link - Dark-mode role token: link colour (else `--uva-blue-alt-dark`).\n * @cssprop --uva-color-text - Dark-mode role token: value colour (else `--uva-grey-darkest`).\n * @cssprop --uva-color-text-muted - Dark-mode role token: label and status colour (else #4b5563).\n * @cssprop --uva-color-border - Dark-mode role token: row dividers (else #dadada).\n * @cssprop --uva-color-link - Dark-mode role token: the buttons' text and the Copy citation button's border (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: the button's background (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibMetadata extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n container-type: inline-size;\n font-size: 1rem;\n line-height: 1.5;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n overflow-wrap: anywhere;\n }\n .row {\n display: grid;\n grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr);\n column-gap: 1.5rem;\n padding-block: 0.5rem;\n border-top: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));\n }\n .row:first-child {\n border-top: 0;\n }\n /* Short labels balanced; values and the citation without a one-word last line. */\n dt {\n grid-column: 1;\n color: var(--uva-color-text-muted, #4b5563);\n font-weight: 700;\n text-wrap: balance;\n }\n dd {\n grid-column: 2;\n text-wrap: pretty;\n }\n @container (width < 36rem) {\n .row {\n grid-template-columns: minmax(0, 1fr);\n }\n dt,\n dd {\n grid-column: 1;\n }\n }\n dd li + li {\n margin-top: 0.25rem;\n }\n a {\n color: var(--uva-color-utility-link, var(--uva-blue-alt-dark, #005679));\n text-decoration: underline;\n }\n .citation {\n margin: 0 0 0.5rem;\n }\n .copy {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem 0.75rem;\n }\n .uvalib-button {\n min-height: 44px;\n padding: 0.25rem 0.75rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font: inherit;\n cursor: pointer;\n }\n .status {\n color: var(--uva-color-text-muted, #4b5563);\n }\n /* As <uvalib-tag-list>'s Show all: an underlined text button, 2rem square at least. */\n .more {\n min-height: 2rem;\n min-width: 2rem;\n padding: 0.15rem 0;\n border: 0;\n background: none;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font: inherit;\n text-align: start;\n text-decoration: underline;\n cursor: pointer;\n }\n @media (forced-colors: active) {\n .more {\n color: ButtonText;\n }\n }\n `,\n ];\n\n /** The creator (author, photographer…), shown first. */\n @property({ type: String }) creator?: string;\n\n /** The organization holding or crediting the item, shown after the creator. */\n @property({ type: String }) organization?: string;\n\n /**\n * The rights statement: a rightsstatements.org or Creative Commons URL (shown as its short\n * name, linked), another http(s) URL (shown as `rights-label`, or \"Rights statement\"), or\n * plain text.\n */\n @property({ type: String }) rights?: string;\n\n /** The link text for a `rights` URL, instead of its short name. */\n @property({ type: String, attribute: 'rights-label' }) rightsLabel?: string;\n\n /**\n * A \"More about rights and permissions\" link under the statement, such as\n * `https://www.library.virginia.edu/policies/use-of-materials`.\n */\n @property({ type: String, attribute: 'rights-info' }) rightsInfo?: string;\n\n /** \"How to cite\": the citation, as written. Wins over `citation-title`. */\n @property({ type: String }) citation?: string;\n\n /**\n * A title or collection name for the Special Collections citation: \"<title>, Albert and\n * Shirley Small Special Collections Library, University of Virginia\".\n */\n @property({ type: String, attribute: 'citation-title' }) citationTitle?: string;\n\n /**\n * The rows as data, for apps that build them in JavaScript: `{ label, value }`, a value\n * being text, a link `{ label, href, size?, download? }` or an array of them (a list).\n * Wins over the children while set; `undefined` goes back to them.\n */\n @property({ attribute: false }) items?: MetadataItem[];\n\n /**\n * Shorten every list value of more than this many items to its first ones and a “Show all\n * N” button. Zero or empty shows every item. A row's `data-limit` wins.\n */\n @property({ type: Number, attribute: 'list-limit' }) listLimit?: number;\n\n @state() private childRows: Row[] = [];\n /** The list values shown in full (after Show all), by `row-value` place. */\n private open = new Set<string>();\n /** The items this element hid, so that only those are shown again. */\n private hid = new WeakSet<Element>();\n private readonly uid = `uvalib-metadata-${++instances}`;\n /** The Copy citation button's result, announced politely. */\n @state() private status = '';\n\n private sourceKey = '';\n private warned = new Set<string>();\n private timer?: ReturnType<typeof setTimeout>;\n\n constructor() {\n super();\n new SourceChildren(\n this,\n () => this.lightDom,\n (nodes) => this.read(nodes),\n );\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n },\n );\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearTimeout(this.timer);\n this.status = '';\n }\n\n private warnOnce(kind: string, message: string): void {\n if (this.warned.has(kind)) return;\n this.warned.add(kind);\n console.warn(`${this.localName}: ${message}`);\n }\n\n /** Read the rows from the first `<dl>` among the children. */\n private read(nodes: Node[]): void {\n let dl: Element | null = null;\n for (const n of nodes) {\n if (!(n instanceof Element)) continue;\n dl = n.localName === 'dl' ? n : n.querySelector('dl');\n if (dl) break;\n }\n const key = dl?.outerHTML ?? '';\n // Only a real change re-renders.\n if (key === this.sourceKey) return;\n this.sourceKey = key;\n this.childRows = dl ? this.parse(dl) : [];\n }\n\n private parse(dl: Element): Row[] {\n const cells = [...dl.children].flatMap((c) => (c.localName === 'div' ? [...c.children] : [c]));\n const rows: Row[] = [];\n let row: Row | undefined;\n for (const c of cells) {\n if (c.localName === 'dt') {\n const label = normalize(c.textContent);\n if (!label) continue;\n // Several <dt> before their values name one row.\n if (row && !row.values.length) row.label += ` / ${label}`;\n else rows.push((row = { label, values: [], ...langDir(c) }));\n } else if (c.localName === 'dd') {\n if (!row) {\n this.warnOnce('dd', 'ignoring a <dd> with no <dt> before it.');\n continue;\n }\n const value: Value = { source: [...c.childNodes].map((n) => this.copy(n)), ...langDir(c) };\n const list = c.querySelector(LIST);\n if (list) {\n value.count = list.querySelectorAll(':scope > li').length;\n const limit = limitOf(c.getAttribute('data-limit') ?? list.getAttribute('data-limit'));\n if (limit !== undefined) value.limit = limit;\n const noun = normalize(\n c.getAttribute('data-limit-label') ?? list.getAttribute('data-limit-label'),\n );\n if (noun) value.limitLabel = noun;\n }\n row.values.push(value);\n }\n }\n return rows.filter((r) => r.values.length);\n }\n\n /**\n * A copy of an author's node: links with an unsafe href (javascript:, data:, …) replaced\n * by their content, with one warning; sizes added to downloads once (not when the link's\n * text already ends with it), `data-size` dropped; ids dropped in light DOM.\n */\n private copy(n: Node): Node {\n const clone = n.cloneNode(true);\n if (!(clone instanceof Element)) return clone;\n const base = this.ownerDocument.baseURI;\n const unsafe: Element[] = [];\n for (const el of [clone, ...clone.querySelectorAll('*')]) {\n if (this.lightDom) el.removeAttribute('id');\n el.removeAttribute('data-limit');\n el.removeAttribute('data-limit-label');\n if (el.localName !== 'a') continue;\n const href = el.getAttribute('href');\n if (href !== null && !safeHref(href, base)) {\n this.warnOnce(\n 'href',\n 'showing a link as text: its href is not http(s), mailto, tel or relative.',\n );\n unsafe.push(el);\n }\n const size = normalize(el.getAttribute('data-size'));\n el.removeAttribute('data-size');\n if (size && !normalize(el.textContent).endsWith(size)) el.append(this.sizeNodes(size));\n }\n // An unsafe link keeps only its content (in a <span> when it is the copied node itself).\n for (const a of unsafe.reverse()) {\n if (a !== clone) {\n a.replaceWith(...a.childNodes);\n continue;\n }\n const span = this.ownerDocument.createElement('span');\n span.append(...a.childNodes);\n return span;\n }\n return clone;\n }\n\n /** \" · 184 KB\", read as \", 184 KB\". */\n private sizeNodes(size: string): DocumentFragment {\n const doc = this.ownerDocument;\n const frag = doc.createDocumentFragment();\n const dot = doc.createElement('span');\n dot.setAttribute('aria-hidden', 'true');\n dot.textContent = ' · ';\n const comma = doc.createElement('span');\n comma.className = 'visually-hidden';\n comma.textContent = ', ';\n frag.append(dot, comma, size);\n return frag;\n }\n\n private renderValue(v: MetadataValue): TemplateResult | string {\n if (v === null || v === undefined) return '';\n if (typeof v !== 'object') return String(v);\n const label = normalize(v.label);\n const href = v.href == null ? '' : String(v.href);\n if (!href || !safeHref(href, this.ownerDocument.baseURI)) {\n if (href)\n this.warnOnce(\n 'href',\n 'showing a link as text: its href is not http(s), mailto, tel or relative.',\n );\n return label;\n }\n const size = normalize(v.size);\n const download = v.download === true ? '' : v.download || undefined;\n return html`<a href=${href} download=${download ?? nothing}\n >${label}${\n size\n ? html`<span aria-hidden=\"true\"> · </span><span class=\"visually-hidden\">, </span>${size}`\n : nothing\n }</a\n >`;\n }\n\n private fromItems(items: readonly MetadataItem[]): Row[] {\n const rows: Row[] = [];\n for (const i of items) {\n const label = normalize(i?.label);\n if (!label) {\n this.warnOnce('label', 'ignoring rows with no label.');\n continue;\n }\n const value = Array.isArray(i.value)\n ? html`<ul role=\"list\">\n ${i.value.map((v) => html`<li>${this.renderValue(v)}</li>`)}\n </ul>`\n : this.renderValue(i.value);\n const v: Value = { content: value };\n if (Array.isArray(i.value)) {\n v.count = i.value.length;\n const limit = limitOf(i.limit);\n if (limit !== undefined) v.limit = limit;\n const noun = normalize(i.limitLabel);\n if (noun) v.limitLabel = noun;\n }\n rows.push({ label, values: [v] });\n }\n return rows;\n }\n\n /** The citation text: `citation`, else the Special Collections one for `citation-title`. */\n private get citationText(): string {\n const own = normalize(this.citation);\n if (own) return own;\n const title = normalize(this.citationTitle);\n return title ? specialCollectionsCitation(title) : '';\n }\n\n private renderRights(): TemplateResult | typeof nothing {\n const rights = normalize(this.rights);\n if (!rights) return nothing;\n const base = this.ownerDocument.baseURI;\n const isUrl = /^https?:\\/\\//i.test(rights);\n const statement = isUrl\n ? html`<a href=${rights} rel=\"license\"\n >${normalize(this.rightsLabel) || rightsName(rights) || 'Rights statement'}</a\n >`\n : rights;\n const info = normalize(this.rightsInfo);\n const more =\n info && safeHref(info, base)\n ? html`<div><a href=${info}>${RIGHTS_INFO_TEXT}</a></div>`\n : nothing;\n return html`<div class=\"row\">\n <dt>Rights</dt>\n <dd>\n <div>${statement}</div>\n ${more}\n </dd>\n </div>`;\n }\n\n private renderCitation(): TemplateResult | typeof nothing {\n const text = this.citationText;\n if (!text) return nothing;\n return html`<div class=\"row\">\n <dt>How to cite</dt>\n <dd>\n <p class=\"citation\">${text}</p>\n <div class=\"copy\">\n <button type=\"button\" class=\"uvalib-button\" @click=${this.copyCitation}>\n Copy citation\n </button>\n <span class=\"status\" role=\"status\">${this.status}</span>\n </div>\n </dd>\n </div>`;\n }\n\n /** Copy the citation; on failure select it, so the keyboard can copy it. */\n private async copyCitation(): Promise<void> {\n trackEvent(this, ['uvalib-metadata', 'copy-citation']);\n clearTimeout(this.timer);\n // Cleared first, so a second copy is announced again.\n this.status = '';\n await this.updateComplete;\n let message = 'Copied';\n try {\n await navigator.clipboard.writeText(this.citationText);\n } catch {\n const p = this.renderRoot.querySelector('.citation');\n if (p) this.ownerDocument.getSelection()?.selectAllChildren(p);\n message = 'Could not copy: the citation is selected, copy it with your keyboard';\n }\n this.status = message;\n this.timer = setTimeout(() => (this.status = ''), STATUS_MS);\n }\n\n private get rows(): Row[] {\n return this.items ? this.fromItems(this.items) : this.childRows;\n }\n\n /** The rows' source the clones below were made for. */\n private clonedFor?: unknown;\n private clones = new WeakMap<Node[], Node[]>();\n\n /**\n * A value's nodes: fresh clones of its prepared source whenever the rows shown change\n * (new markup, or back from `items`), reused by unrelated updates (the citation status) so\n * that focus in a value is not lost.\n */\n private nodesOf(source: Node[]): Node[] {\n let c = this.clones.get(source);\n if (!c) this.clones.set(source, (c = source.map((n) => n.cloneNode(true))));\n return c;\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.toggleAttribute('data-empty', !this.renderRoot.querySelector('.row'));\n this.applyLimits();\n }\n\n /** The rendered `<dl>` (in light DOM, not the author's source). */\n private get list(): HTMLElement | null {\n const root = this.renderRoot;\n return root instanceof ShadowRoot\n ? root.querySelector('dl')\n : (root as HTMLElement).querySelector(':scope > dl');\n }\n\n /**\n * Hide the items past each shortened list's limit (until Show all), and show again the\n * ones this element hid when the list is open or no longer shortened.\n */\n private applyLimits(): void {\n const dl = this.list;\n if (!dl) return;\n for (const dd of dl.querySelectorAll<HTMLElement>(':scope > .row > dd')) {\n const list = dd.querySelector(LIST);\n if (!list) continue;\n const key = dd.dataset.key;\n const limit = key === undefined ? Infinity : Number(dd.dataset.limit);\n const open = key !== undefined && this.open.has(key);\n [...list.children].forEach((li, i) => {\n if (!(li instanceof HTMLElement) || li.localName !== 'li') return;\n if (!open && i >= limit) {\n if (!li.hidden) this.hid.add(li);\n li.hidden = true;\n } else if (this.hid.has(li)) {\n li.hidden = false;\n this.hid.delete(li);\n }\n });\n if (key === undefined) continue;\n if (!list.id) list.id = `${this.uid}-list-${key}`;\n dd.querySelector(':scope > .more')?.setAttribute('aria-controls', list.id);\n }\n }\n\n /** A value's limit: its own, else `list-limit`; 0 for none. */\n private limitFor(v: Value): number {\n return v.limit ?? limitOf(this.listLimit) ?? 0;\n }\n\n private get locale(): string {\n return this.closest('[lang]')?.getAttribute('lang') || 'en';\n }\n\n /** The toggle's noun: `data-limit-label`, else the label with a lowercase first letter\n * (kept as written when it starts with an acronym, “ORCID iDs”). */\n private noun(r: Row, v: Value): TemplateResult | string {\n if (v.limitLabel) return v.limitLabel;\n const l = r.label;\n let lower = l;\n if (!/^\\p{Lu}{2}/u.test(l)) {\n const first = l.charAt(0);\n try {\n lower = first.toLocaleLowerCase(r.lang || this.locale) + l.slice(1);\n } catch {\n lower = first.toLowerCase() + l.slice(1);\n }\n }\n return r.lang || r.dir\n ? html`<span lang=${r.lang ?? nothing} dir=${r.dir ?? nothing}>${lower}</span>`\n : lower;\n }\n\n private formatCount(n: number): string {\n try {\n return n.toLocaleString(this.locale);\n } catch {\n return n.toLocaleString('en');\n }\n }\n\n private async toggleList(e: Event, key: string, limit: number): Promise<void> {\n const button = e.currentTarget as HTMLElement;\n const open = !this.open.has(key);\n if (open) this.open.add(key);\n else this.open.delete(key);\n const row = button.closest('.row');\n const place = row?.parentElement ? [...row.parentElement.children].indexOf(row) + 1 : 1;\n trackEvent(this, ['uvalib-metadata', open ? 'show-all' : 'show-fewer', `row ${place}`]);\n this.requestUpdate();\n await this.updateComplete;\n if (!button.isConnected) return;\n if (!open) {\n button.focus();\n return;\n }\n const li = button.parentElement?.querySelector(LIST)?.children[limit];\n if (!(li instanceof HTMLElement)) return;\n let target = li.querySelector<HTMLElement>(FOCUSABLE);\n if (!target) {\n li.tabIndex = -1;\n target = li;\n }\n target.focus();\n }\n\n private renderToggle(r: Row, v: Value, key: string, limit: number) {\n const open = this.open.has(key);\n const noun = this.noun(r, v);\n return html`<button\n type=\"button\"\n class=\"more\"\n aria-expanded=${open ? 'true' : 'false'}\n @click=${(e: Event) => this.toggleList(e, key, limit)}\n >\n ${\n open\n ? html`Show fewer<span class=\"visually-hidden\"> ${noun}</span>`\n : html`Show all ${this.formatCount(v.count ?? 0)} ${noun}`\n }\n </button>`;\n }\n\n protected override render() {\n const text = (label: string, value?: string) => {\n const v = normalize(value);\n return v\n ? html`<div class=\"row\">\n <dt>${label}</dt>\n <dd>${v}</dd>\n </div>`\n : nothing;\n };\n const shownFrom = this.items ?? this.childRows;\n if (shownFrom !== this.clonedFor) {\n this.clonedFor = shownFrom;\n this.clones = new WeakMap();\n this.open = new Set();\n }\n return html`<dl>\n ${text('Creator', this.creator)}${text('Organization', this.organization)}\n ${this.rows.map(\n (r, ri) =>\n html`<div class=\"row\">\n <dt lang=${r.lang ?? nothing} dir=${r.dir ?? nothing}>${r.label}</dt>\n ${r.values.map((v, vi) => {\n const limit = this.limitFor(v);\n const key = limit > 0 && (v.count ?? 0) > limit ? `${ri}-${vi}` : undefined;\n return html`<dd\n lang=${v.lang ?? nothing}\n dir=${v.dir ?? nothing}\n data-key=${key ?? nothing}\n data-limit=${key ? limit : nothing}\n >\n ${v.source ? this.nodesOf(v.source) : v.content}${\n key ? this.renderToggle(r, v, key, limit) : nothing\n }\n </dd>`;\n })}\n </div>`,\n )}\n ${this.renderRights()}${this.renderCitation()}\n </dl>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibMetadata } from './UvalibMetadata.js';\n\ndefine('uvalib-metadata', UvalibMetadata);\n"],"mappings":";;;;;;AACA,IAAMoB,IAAqC;CACzC,KAAK;CACL,aAAa;CACb,WAAW;CACX,UAAU;CACV,WAAW;CACX,UAAU;CACV,UAAU;CACV,YAAY;CACZ,UAAU;CACV,KAAK;CACL,KAAK;CACL,KAAK;AACP;AAOA,SAAgBC,EAAW,GAAkC;CAC3D,IAAIC;CACJ,IAAI;EACF,IAAI,IAAI,IAAIC,CAAI;CAClB,QAAQ;EACN;CACF;CACA,IAAMC,IAAOF,EAAE,SAAS,YAAY,CAAC,CAAC,QAAQ,UAAU,EAAE,GACpDG,IAAOH,EAAE;CACf,IAAIE,MAAS,wBAAwB;EACnC,IAAME,IAAI,yCAAyC,KAAKD,CAAI;EAC5D,OAAOC,IAAIN,EAAWM,EAAE,EAAE,CAAE,YAAY,KAAK,KAAA;CAC/C;CACA,IAAIF,MAAS,uBAAuB;EAClC,IAAMG,IAAU,wEAAwE,KACtFF,CACF;EACA,IAAIE,GAAS,OAAO,MAAMA,EAAQ,EAAE,CAAE,YAAY,EAAE,GAAGA,EAAQ;EAC/D,IAAMC,IAAO,iDAAiD,KAAKH,CAAI;EACvE,IAAIG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orate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","selectContents","copyText","langDir","normalize","safeHref","SourceChildren","accessible","STATEMENTS","rightsName","u","href","host","path","m","licence","tool","specialCollectionsCitation","title","RIGHTS_INFO_TEXT","STATUS_MS","LIST","FOCUSABLE","limitOf","v","instances","structuralRules","shadowStructure","UvalibMetadata","nodes","root","sheet","node","kind","message","dl","key","cells","c","rows","row","label","value","list","limit","noun","clone","base","unsafe","el","size","a","span","doc","frag","dot","comma","download","A","items","own","rights","statement","info","more","text","source","changed","dd","open","li","l","lower","first","button","place","target","shownFrom","ri","vi"],"sources":["../src/components/uvalib-metadata/rights.ts","../src/components/uvalib-metadata/UvalibMetadata.ts","../src/components/uvalib-metadata/uvalib-metadata.ts"],"sourcesContent":["/** rightsstatements.org's statements, by their id in the URL, with their short names. */\nconst STATEMENTS: Record<string, string> = {\n INC: 'In Copyright',\n 'INC-OW-EU': 'In Copyright – EU Orphan Work',\n 'INC-EDU': 'In Copyright – Educational Use Permitted',\n 'INC-NC': 'In Copyright – Non-Commercial Use Permitted',\n 'INC-RUU': 'In Copyright – Rights-holder(s) Unlocatable or Unidentifiable',\n 'NOC-CR': 'No Copyright – Contractual Restrictions',\n 'NOC-NC': 'No Copyright – Non-Commercial Use Only',\n 'NOC-OKLR': 'No Copyright – Other Known Legal Restrictions',\n 'NOC-US': 'No Copyright – United States',\n CNE: 'Copyright Not Evaluated',\n UND: 'Copyright Undetermined',\n NKC: 'No Known Copyright',\n};\n\n/**\n * The short name of a rightsstatements.org statement or Creative Commons licence or tool from\n * its URL (\"In Copyright\", \"CC BY-NC 4.0\", \"CC0 1.0\", \"Public Domain Mark 1.0\"), or\n * `undefined` for any other URL.\n */\nexport function rightsName(href: string): string | undefined {\n let u: URL;\n try {\n u = new URL(href);\n } catch {\n return undefined;\n }\n const host = u.hostname.toLowerCase().replace(/^www\\./, '');\n const path = u.pathname;\n if (host === 'rightsstatements.org') {\n const m = /^\\/(?:vocab|page|data)\\/([a-z-]+)\\/\\d/i.exec(path);\n return m ? STATEMENTS[m[1]!.toUpperCase()] : undefined;\n }\n if (host === 'creativecommons.org') {\n const licence = /^\\/licenses\\/((?:by|nc|nd|sa)(?:-(?:by|nc|nd|sa))*)\\/(\\d+(?:\\.\\d+)*)/i.exec(\n path,\n );\n if (licence) return `CC ${licence[1]!.toUpperCase()} ${licence[2]}`;\n const tool = /^\\/publicdomain\\/(zero|mark)\\/(\\d+(?:\\.\\d+)*)/i.exec(path);\n if (tool)\n return tool[1]!.toLowerCase() === 'zero' ? `CC0 ${tool[2]}` : `Public Domain Mark ${tool[2]}`;\n }\n return undefined;\n}\n\n/** The Albert and Shirley Small Special Collections Library's citation for a title or collection. */\nexport const specialCollectionsCitation = (title: string): string =>\n `${title}, Albert and Shirley Small Special Collections Library, University of Virginia`;\n","import { css, html, nothing, unsafeCSS, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { copyText, selectContents } from '../../base/clipboard.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { langDir } from '../../base/inline-copy.js';\nimport { normalize, safeHref, SourceChildren } from '../../base/source-children.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { rightsName, specialCollectionsCitation } from './rights.js';\n\n/** A link value: a download when it has `download` or a `size` (\"EPUB · 184 KB\"). */\nexport interface MetadataLink {\n label: string;\n href: string;\n /** The file's size as shown, such as `184 KB`. */\n size?: string;\n /** The `download` attribute: `true` for an empty one, a string for a file name. */\n download?: boolean | string;\n}\n\n/** One value: text, or a link. */\nexport type MetadataValue = string | number | MetadataLink;\n\n/** A row: its label and one value, or several (shown as a list). */\nexport interface MetadataItem {\n label: string;\n value: MetadataValue | MetadataValue[];\n /** A list value: show this many and a “Show all N” button (0: no limit). Wins over `list-limit`. */\n limit?: number;\n /** The noun in “Show all 34 participants”, instead of the label with a lowercase first letter. */\n limitLabel?: string;\n}\n\n/**\n * A value as drawn: a template or text (from `items`), or `source`, prepared copies of an\n * author's `<dd>` content that are never inserted themselves (each render set clones them).\n * `lang`/`dir` come from the source `<dd>`.\n */\ninterface Value {\n content?: TemplateResult | string;\n source?: Node[];\n lang?: string;\n dir?: string;\n /** A list value: how many `<li>` it has. */\n count?: number;\n /** The row's own limit (`data-limit`), winning over `list-limit`. */\n limit?: number;\n /** The noun in the toggle (`data-limit-label`). */\n limitLabel?: string;\n}\n\n/** A row as drawn; `lang`/`dir` come from the source `<dt>`. */\ninterface Row {\n label: string;\n lang?: string;\n dir?: string;\n values: Value[];\n}\n\nconst RIGHTS_INFO_TEXT = 'More about rights and permissions';\nconst STATUS_MS = 5000;\n/** The list in a value: a `<ul>` or `<ol>` that is a direct child of the `<dd>`. */\nconst LIST = ':scope > ul, :scope > ol';\n/** What takes focus inside a revealed value, before the value itself. */\nconst FOCUSABLE = 'a[href], button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n\n/** A limit: a whole number of at least 0, else undefined. */\nconst limitOf = (v: unknown): number | undefined => {\n if (v === null || v === undefined || (typeof v === 'string' && !v.trim())) return undefined;\n const n = Math.trunc(Number(v));\n return Number.isFinite(n) ? Math.max(0, n) : undefined;\n};\n\nlet instances = 0;\n\n/**\n * The rules kept with `no-style`: unmarked value lists, the terms and values stacked, the\n * visually hidden text hidden, and `[hidden]` hides.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} dl, ${host} dd { margin: 0; }\n ${host} dd :is(ul, ol) { list-style: none; margin: 0; padding: 0; }\n ${host} :where(.more) {\n display: inline-flex;\n align-items: center;\n box-sizing: border-box;\n min-height: 24px;\n min-width: 24px;\n margin-top: 0.25rem;\n }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/**\n * A record's details as a description list, as on the library's digital collections: label\n * and value side by side on wide screens (the element's own width, 36rem and up), stacked on\n * narrow ones. Values may be text, links or lists (subjects).\n *\n * Give the rows as a `<dl>` child (so the page reads the same before the script loads):\n * `<dt>` labels and `<dd>` values, optionally wrapped in a `<div>` per row; several `<dd>`\n * after one `<dt>` are several values. The values are copied as written (links, lists,\n * `download` attributes kept); a link with `data-size=\"184 KB\"` is shown as a download,\n * \"EPUB · 184 KB\". The list follows changes to the children. Apps set the `items`\n * property instead (`{ label, value }`, winning over the children while set).\n *\n * Built-in rows for credit and rights (as Special Collections asks): `creator` and\n * `organization` come first; `rights` (a rightsstatements.org or Creative Commons URL, shown\n * as its short name linked to it, or plain text) and `citation` (\"How to cite\", with a Copy\n * citation button that announces \"Copied\" politely) come last. `citation-title` builds the\n * Special Collections citation, \"<title>, Albert and Shirley Small Special Collections\n * Library, University of Virginia\".\n *\n * Long lists: `list-limit=\"8\"` shortens every value that is a list (a `<ul>`/`<ol>` in the\n * `<dd>`) of more than 8 items to its first 8 and a “Show all 34 participants” button\n * (`aria-expanded`, `aria-controls`) that reveals the rest in place and moves focus to the\n * first one; it then reads “Show fewer”. `data-limit` on a `<dd>` or its list sets that row's\n * own limit (`0`: none); the noun is the label with a lowercase first letter, or\n * `data-limit-label`. Every value stays in the markup (the hidden ones `hidden`).\n *\n * @tagname uvalib-metadata\n * @fires uvalib-analytics-event - For `<site-analytics>`: the Copy citation button, `['uvalib-metadata', 'copy-citation']`, and a list's toggle, `['uvalib-metadata', 'show-all'|'show-fewer', 'row N']` (N from 1, the row's place in the list; never its label or values). Downloads are left to Matomo's own download tracking. Bubbles and is composed.\n * @cssprop [--uva-blue-alt-dark=#005679] - Link colour.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Value colour.\n * @cssprop --uva-color-utility-link - Dark-mode role token: link colour (else `--uva-blue-alt-dark`).\n * @cssprop --uva-color-text - Dark-mode role token: value colour (else `--uva-grey-darkest`).\n * @cssprop --uva-color-text-muted - Dark-mode role token: label and status colour (else #4b5563).\n * @cssprop --uva-color-border - Dark-mode role token: row dividers (else #dadada).\n * @cssprop --uva-color-link - Dark-mode role token: the buttons' text and the Copy citation button's border (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: the button's background (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibMetadata extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n container-type: inline-size;\n font-size: 1rem;\n line-height: 1.5;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n overflow-wrap: anywhere;\n }\n .row {\n display: grid;\n grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr);\n column-gap: 1.5rem;\n padding-block: 0.5rem;\n border-top: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));\n }\n .row:first-child {\n border-top: 0;\n }\n /* Short labels balanced; values and the citation without a one-word last line. */\n dt {\n grid-column: 1;\n color: var(--uva-color-text-muted, #4b5563);\n font-weight: 700;\n text-wrap: balance;\n }\n dd {\n grid-column: 2;\n text-wrap: pretty;\n }\n @container (width < 36rem) {\n .row {\n grid-template-columns: minmax(0, 1fr);\n }\n dt,\n dd {\n grid-column: 1;\n }\n }\n dd li + li {\n margin-top: 0.25rem;\n }\n a {\n color: var(--uva-color-utility-link, var(--uva-blue-alt-dark, #005679));\n text-decoration: underline;\n }\n .citation {\n margin: 0 0 0.5rem;\n }\n .copy {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem 0.75rem;\n }\n .uvalib-button {\n min-height: 44px;\n padding: 0.25rem 0.75rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font: inherit;\n cursor: pointer;\n }\n .status {\n color: var(--uva-color-text-muted, #4b5563);\n }\n /* As <uvalib-tag-list>'s Show all: an underlined text button, 2rem square at least. */\n .more {\n min-height: 2rem;\n min-width: 2rem;\n padding: 0.15rem 0;\n border: 0;\n background: none;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font: inherit;\n text-align: start;\n text-decoration: underline;\n cursor: pointer;\n }\n @media (forced-colors: active) {\n .more {\n color: ButtonText;\n }\n }\n `,\n ];\n\n /** The creator (author, photographer…), shown first. */\n @property({ type: String }) creator?: string;\n\n /** The organization holding or crediting the item, shown after the creator. */\n @property({ type: String }) organization?: string;\n\n /**\n * The rights statement: a rightsstatements.org or Creative Commons URL (shown as its short\n * name, linked), another http(s) URL (shown as `rights-label`, or \"Rights statement\"), or\n * plain text.\n */\n @property({ type: String }) rights?: string;\n\n /** The link text for a `rights` URL, instead of its short name. */\n @property({ type: String, attribute: 'rights-label' }) rightsLabel?: string;\n\n /**\n * A \"More about rights and permissions\" link under the statement, such as\n * `https://www.library.virginia.edu/policies/use-of-materials`.\n */\n @property({ type: String, attribute: 'rights-info' }) rightsInfo?: string;\n\n /** \"How to cite\": the citation, as written. Wins over `citation-title`. */\n @property({ type: String }) citation?: string;\n\n /**\n * A title or collection name for the Special Collections citation: \"<title>, Albert and\n * Shirley Small Special Collections Library, University of Virginia\".\n */\n @property({ type: String, attribute: 'citation-title' }) citationTitle?: string;\n\n /**\n * The rows as data, for apps that build them in JavaScript: `{ label, value }`, a value\n * being text, a link `{ label, href, size?, download? }` or an array of them (a list).\n * Wins over the children while set; `undefined` goes back to them.\n */\n @property({ attribute: false }) items?: MetadataItem[];\n\n /**\n * Shorten every list value of more than this many items to its first ones and a “Show all\n * N” button. Zero or empty shows every item. A row's `data-limit` wins.\n */\n @property({ type: Number, attribute: 'list-limit' }) listLimit?: number;\n\n @state() private childRows: Row[] = [];\n /** The list values shown in full (after Show all), by `row-value` place. */\n private open = new Set<string>();\n /** The items this element hid, so that only those are shown again. */\n private hid = new WeakSet<Element>();\n private readonly uid = `uvalib-metadata-${++instances}`;\n /** The Copy citation button's result, announced politely. */\n @state() private status = '';\n\n private sourceKey = '';\n private warned = new Set<string>();\n private timer?: ReturnType<typeof setTimeout>;\n\n constructor() {\n super();\n new SourceChildren(\n this,\n () => this.lightDom,\n (nodes) => this.read(nodes),\n );\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n },\n );\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearTimeout(this.timer);\n this.status = '';\n }\n\n private warnOnce(kind: string, message: string): void {\n if (this.warned.has(kind)) return;\n this.warned.add(kind);\n console.warn(`${this.localName}: ${message}`);\n }\n\n /** Read the rows from the first `<dl>` among the children. */\n private read(nodes: Node[]): void {\n let dl: Element | null = null;\n for (const n of nodes) {\n if (!(n instanceof Element)) continue;\n dl = n.localName === 'dl' ? n : n.querySelector('dl');\n if (dl) break;\n }\n const key = dl?.outerHTML ?? '';\n // Only a real change re-renders.\n if (key === this.sourceKey) return;\n this.sourceKey = key;\n this.childRows = dl ? this.parse(dl) : [];\n }\n\n private parse(dl: Element): Row[] {\n const cells = [...dl.children].flatMap((c) => (c.localName === 'div' ? [...c.children] : [c]));\n const rows: Row[] = [];\n let row: Row | undefined;\n for (const c of cells) {\n if (c.localName === 'dt') {\n const label = normalize(c.textContent);\n if (!label) continue;\n // Several <dt> before their values name one row.\n if (row && !row.values.length) row.label += ` / ${label}`;\n else rows.push((row = { label, values: [], ...langDir(c) }));\n } else if (c.localName === 'dd') {\n if (!row) {\n this.warnOnce('dd', 'ignoring a <dd> with no <dt> before it.');\n continue;\n }\n const value: Value = { source: [...c.childNodes].map((n) => this.copy(n)), ...langDir(c) };\n const list = c.querySelector(LIST);\n if (list) {\n value.count = list.querySelectorAll(':scope > li').length;\n const limit = limitOf(c.getAttribute('data-limit') ?? list.getAttribute('data-limit'));\n if (limit !== undefined) value.limit = limit;\n const noun = normalize(\n c.getAttribute('data-limit-label') ?? list.getAttribute('data-limit-label'),\n );\n if (noun) value.limitLabel = noun;\n }\n row.values.push(value);\n }\n }\n return rows.filter((r) => r.values.length);\n }\n\n /**\n * A copy of an author's node: links with an unsafe href (javascript:, data:, …) replaced\n * by their content, with one warning; sizes added to downloads once (not when the link's\n * text already ends with it), `data-size` dropped; ids dropped in light DOM.\n */\n private copy(n: Node): Node {\n const clone = n.cloneNode(true);\n if (!(clone instanceof Element)) return clone;\n const base = this.ownerDocument.baseURI;\n const unsafe: Element[] = [];\n for (const el of [clone, ...clone.querySelectorAll('*')]) {\n if (this.lightDom) el.removeAttribute('id');\n el.removeAttribute('data-limit');\n el.removeAttribute('data-limit-label');\n if (el.localName !== 'a') continue;\n const href = el.getAttribute('href');\n if (href !== null && !safeHref(href, base)) {\n this.warnOnce(\n 'href',\n 'showing a link as text: its href is not http(s), mailto, tel or relative.',\n );\n unsafe.push(el);\n }\n const size = normalize(el.getAttribute('data-size'));\n el.removeAttribute('data-size');\n if (size && !normalize(el.textContent).endsWith(size)) el.append(this.sizeNodes(size));\n }\n // An unsafe link keeps only its content (in a <span> when it is the copied node itself).\n for (const a of unsafe.reverse()) {\n if (a !== clone) {\n a.replaceWith(...a.childNodes);\n continue;\n }\n const span = this.ownerDocument.createElement('span');\n span.append(...a.childNodes);\n return span;\n }\n return clone;\n }\n\n /** \" · 184 KB\", read as \", 184 KB\". */\n private sizeNodes(size: string): DocumentFragment {\n const doc = this.ownerDocument;\n const frag = doc.createDocumentFragment();\n const dot = doc.createElement('span');\n dot.setAttribute('aria-hidden', 'true');\n dot.textContent = ' · ';\n const comma = doc.createElement('span');\n comma.className = 'visually-hidden';\n comma.textContent = ', ';\n frag.append(dot, comma, size);\n return frag;\n }\n\n private renderValue(v: MetadataValue): TemplateResult | string {\n if (v === null || v === undefined) return '';\n if (typeof v !== 'object') return String(v);\n const label = normalize(v.label);\n const href = v.href == null ? '' : String(v.href);\n if (!href || !safeHref(href, this.ownerDocument.baseURI)) {\n if (href)\n this.warnOnce(\n 'href',\n 'showing a link as text: its href is not http(s), mailto, tel or relative.',\n );\n return label;\n }\n const size = normalize(v.size);\n const download = v.download === true ? '' : v.download || undefined;\n return html`<a href=${href} download=${download ?? nothing}\n >${label}${\n size\n ? html`<span aria-hidden=\"true\"> · </span><span class=\"visually-hidden\">, </span>${size}`\n : nothing\n }</a\n >`;\n }\n\n private fromItems(items: readonly MetadataItem[]): Row[] {\n const rows: Row[] = [];\n for (const i of items) {\n const label = normalize(i?.label);\n if (!label) {\n this.warnOnce('label', 'ignoring rows with no label.');\n continue;\n }\n const value = Array.isArray(i.value)\n ? html`<ul role=\"list\">\n ${i.value.map((v) => html`<li>${this.renderValue(v)}</li>`)}\n </ul>`\n : this.renderValue(i.value);\n const v: Value = { content: value };\n if (Array.isArray(i.value)) {\n v.count = i.value.length;\n const limit = limitOf(i.limit);\n if (limit !== undefined) v.limit = limit;\n const noun = normalize(i.limitLabel);\n if (noun) v.limitLabel = noun;\n }\n rows.push({ label, values: [v] });\n }\n return rows;\n }\n\n /** The citation text: `citation`, else the Special Collections one for `citation-title`. */\n private get citationText(): string {\n const own = normalize(this.citation);\n if (own) return own;\n const title = normalize(this.citationTitle);\n return title ? specialCollectionsCitation(title) : '';\n }\n\n private renderRights(): TemplateResult | typeof nothing {\n const rights = normalize(this.rights);\n if (!rights) return nothing;\n const base = this.ownerDocument.baseURI;\n const isUrl = /^https?:\\/\\//i.test(rights);\n const statement = isUrl\n ? html`<a href=${rights} rel=\"license\"\n >${normalize(this.rightsLabel) || rightsName(rights) || 'Rights statement'}</a\n >`\n : rights;\n const info = normalize(this.rightsInfo);\n const more =\n info && safeHref(info, base)\n ? html`<div><a href=${info}>${RIGHTS_INFO_TEXT}</a></div>`\n : nothing;\n return html`<div class=\"row\">\n <dt>Rights</dt>\n <dd>\n <div>${statement}</div>\n ${more}\n </dd>\n </div>`;\n }\n\n private renderCitation(): TemplateResult | typeof nothing {\n const text = this.citationText;\n if (!text) return nothing;\n return html`<div class=\"row\">\n <dt>How to cite</dt>\n <dd>\n <p class=\"citation\">${text}</p>\n <div class=\"copy\">\n <button type=\"button\" class=\"uvalib-button\" @click=${this.copyCitation}>\n Copy citation\n </button>\n <span class=\"status\" role=\"status\">${this.status}</span>\n </div>\n </dd>\n </div>`;\n }\n\n /** Copy the citation; on failure select it, so the keyboard can copy it. */\n private async copyCitation(): Promise<void> {\n trackEvent(this, ['uvalib-metadata', 'copy-citation']);\n clearTimeout(this.timer);\n // Cleared first, so a second copy is announced again.\n this.status = '';\n await this.updateComplete;\n let message = 'Copied';\n try {\n await copyText(this.citationText);\n } catch {\n selectContents(this.renderRoot.querySelector('.citation'));\n message = 'Could not copy: the citation is selected, copy it with your keyboard';\n }\n this.status = message;\n this.timer = setTimeout(() => (this.status = ''), STATUS_MS);\n }\n\n private get rows(): Row[] {\n return this.items ? this.fromItems(this.items) : this.childRows;\n }\n\n /** The rows' source the clones below were made for. */\n private clonedFor?: unknown;\n private clones = new WeakMap<Node[], Node[]>();\n\n /**\n * A value's nodes: fresh clones of its prepared source whenever the rows shown change\n * (new markup, or back from `items`), reused by unrelated updates (the citation status) so\n * that focus in a value is not lost.\n */\n private nodesOf(source: Node[]): Node[] {\n let c = this.clones.get(source);\n if (!c) this.clones.set(source, (c = source.map((n) => n.cloneNode(true))));\n return c;\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.toggleAttribute('data-empty', !this.renderRoot.querySelector('.row'));\n this.applyLimits();\n }\n\n /** The rendered `<dl>` (in light DOM, not the author's source). */\n private get list(): HTMLElement | null {\n const root = this.renderRoot;\n return root instanceof ShadowRoot\n ? root.querySelector('dl')\n : (root as HTMLElement).querySelector(':scope > dl');\n }\n\n /**\n * Hide the items past each shortened list's limit (until Show all), and show again the\n * ones this element hid when the list is open or no longer shortened.\n */\n private applyLimits(): void {\n const dl = this.list;\n if (!dl) return;\n for (const dd of dl.querySelectorAll<HTMLElement>(':scope > .row > dd')) {\n const list = dd.querySelector(LIST);\n if (!list) continue;\n const key = dd.dataset.key;\n const limit = key === undefined ? Infinity : Number(dd.dataset.limit);\n const open = key !== undefined && this.open.has(key);\n [...list.children].forEach((li, i) => {\n if (!(li instanceof HTMLElement) || li.localName !== 'li') return;\n if (!open && i >= limit) {\n if (!li.hidden) this.hid.add(li);\n li.hidden = true;\n } else if (this.hid.has(li)) {\n li.hidden = false;\n this.hid.delete(li);\n }\n });\n if (key === undefined) continue;\n if (!list.id) list.id = `${this.uid}-list-${key}`;\n dd.querySelector(':scope > .more')?.setAttribute('aria-controls', list.id);\n }\n }\n\n /** A value's limit: its own, else `list-limit`; 0 for none. */\n private limitFor(v: Value): number {\n return v.limit ?? limitOf(this.listLimit) ?? 0;\n }\n\n private get locale(): string {\n return this.closest('[lang]')?.getAttribute('lang') || 'en';\n }\n\n /** The toggle's noun: `data-limit-label`, else the label with a lowercase first letter\n * (kept as written when it starts with an acronym, “ORCID iDs”). */\n private noun(r: Row, v: Value): TemplateResult | string {\n if (v.limitLabel) return v.limitLabel;\n const l = r.label;\n let lower = l;\n if (!/^\\p{Lu}{2}/u.test(l)) {\n const first = l.charAt(0);\n try {\n lower = first.toLocaleLowerCase(r.lang || this.locale) + l.slice(1);\n } catch {\n lower = first.toLowerCase() + l.slice(1);\n }\n }\n return r.lang || r.dir\n ? html`<span lang=${r.lang ?? nothing} dir=${r.dir ?? nothing}>${lower}</span>`\n : lower;\n }\n\n private formatCount(n: number): string {\n try {\n return n.toLocaleString(this.locale);\n } catch {\n return n.toLocaleString('en');\n }\n }\n\n private async toggleList(e: Event, key: string, limit: number): Promise<void> {\n const button = e.currentTarget as HTMLElement;\n const open = !this.open.has(key);\n if (open) this.open.add(key);\n else this.open.delete(key);\n const row = button.closest('.row');\n const place = row?.parentElement ? [...row.parentElement.children].indexOf(row) + 1 : 1;\n trackEvent(this, ['uvalib-metadata', open ? 'show-all' : 'show-fewer', `row ${place}`]);\n this.requestUpdate();\n await this.updateComplete;\n if (!button.isConnected) return;\n if (!open) {\n button.focus();\n return;\n }\n const li = button.parentElement?.querySelector(LIST)?.children[limit];\n if (!(li instanceof HTMLElement)) return;\n let target = li.querySelector<HTMLElement>(FOCUSABLE);\n if (!target) {\n li.tabIndex = -1;\n target = li;\n }\n target.focus();\n }\n\n private renderToggle(r: Row, v: Value, key: string, limit: number) {\n const open = this.open.has(key);\n const noun = this.noun(r, v);\n return html`<button\n type=\"button\"\n class=\"more\"\n aria-expanded=${open ? 'true' : 'false'}\n @click=${(e: Event) => this.toggleList(e, key, limit)}\n >\n ${\n open\n ? html`Show fewer<span class=\"visually-hidden\"> ${noun}</span>`\n : html`Show all ${this.formatCount(v.count ?? 0)} ${noun}`\n }\n </button>`;\n }\n\n protected override render() {\n const text = (label: string, value?: string) => {\n const v = normalize(value);\n return v\n ? html`<div class=\"row\">\n <dt>${label}</dt>\n <dd>${v}</dd>\n </div>`\n : nothing;\n };\n const shownFrom = this.items ?? this.childRows;\n if (shownFrom !== this.clonedFor) {\n this.clonedFor = shownFrom;\n this.clones = new WeakMap();\n this.open = new Set();\n }\n return html`<dl>\n ${text('Creator', this.creator)}${text('Organization', this.organization)}\n ${this.rows.map(\n (r, ri) =>\n html`<div class=\"row\">\n <dt lang=${r.lang ?? nothing} dir=${r.dir ?? nothing}>${r.label}</dt>\n ${r.values.map((v, vi) => {\n const limit = this.limitFor(v);\n const key = limit > 0 && (v.count ?? 0) > limit ? `${ri}-${vi}` : undefined;\n return html`<dd\n lang=${v.lang ?? nothing}\n dir=${v.dir ?? nothing}\n data-key=${key ?? nothing}\n data-limit=${key ? limit : nothing}\n >\n ${v.source ? this.nodesOf(v.source) : v.content}${\n key ? this.renderToggle(r, v, key, limit) : nothing\n }\n </dd>`;\n })}\n </div>`,\n )}\n ${this.renderRights()}${this.renderCitation()}\n </dl>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibMetadata } from './UvalibMetadata.js';\n\ndefine('uvalib-metadata', UvalibMetadata);\n"],"mappings":";;;;;;;AACA,IAAMsB,IAAqC;CACzC,KAAK;CACL,aAAa;CACb,WAAW;CACX,UAAU;CACV,WAAW;CACX,UAAU;CACV,UAAU;CACV,YAAY;CACZ,UAAU;CACV,KAAK;CACL,KAAK;CACL,KAAK;AACP;AAOA,SAAgBC,EAAW,GAAkC;CAC3D,IAAIC;CACJ,IAAI;EACF,IAAI,IAAI,IAAIC,CAAI;CAClB,QAAQ;EACN;CACF;CACA,IAAMC,IAAOF,EAAE,SAAS,YAAY,CAAC,CAAC,QAAQ,UAAU,EAAE,GACpDG,IAAOH,EAAE;CACf,IAAIE,MAAS,wBAAwB;EACnC,IAAME,IAAI,yCAAyC,KAAKD,CAAI;EAC5D,OAAOC,IAAIN,EAAWM,EAAE,EAAE,CAAE,YAAY,KAAK,KAAA;CAC/C;CACA,IAAIF,MAAS,uBAAuB;EAClC,IAAMG,IAAU,wEAAwE,KACtFF,CACF;EACA,IAAIE,GAAS,OAAO,MAAMA,EAAQ,EAAE,CAAE,YAAY,EAAE,GAAGA,EAAQ;EAC/D,IAAMC,IAAO,iDAAiD,KAAKH,CAAI;EACvE,IAAIG,GACF,OAAOA,EAAK,EAAE,CAAE,YAAY,MAAM,SAAS,OAAOA,EAAK,OAAO,sBAAsBA,EAAK;CAC7F;AAEF;AAGA,IAAaC,KAA8B,MACzC,GAAGC,EAAM,iFCYLC,IAAmB,qCACnBC,IAAY,KAEZC,IAAO,4BAEPC,IAAY,+EAGZC,KAAW,MAAmC;CAClD,IAAIC,KAAM,QAA4B,OAAOA,KAAM,YAAY,CAACA,EAAE,KAAK,GAAI;CAC3E,IAAMjC,IAAI,KAAK,MAAM,OAAOiC,CAAC,CAAC;CAC9B,OAAO,OAAO,SAASjC,CAAC,IAAI,KAAK,IAAI,GAAGA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AA,CAAA,GAMpDxC,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAc,CAAC,CAAA,GAAAuC,EAAA,WAAA,cAAA,KAAA,CAAA,GAGnDxC,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAuC,EAAA,WAAA,YAAA,KAAA,CAAA,GAMzBxC,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAiB,CAAC,CAAA,GAAAuC,EAAA,WAAA,iBAAA,KAAA,CAAA,GAOtDxC,EAAA,CAAAC,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAAuC,EAAA,WAAA,SAAA,KAAA,CAAA,GAM7BxC,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAAuC,EAAA,WAAA,aAAA,KAAA,CAAA,GAElDxC,EAAA,CAAAE,EAAM,CAAA,GAAAsC,EAAA,WAAA,aAAA,KAAA,CAAA,GAONxC,EAAA,CAAAE,EAAM,CAAA,GAAAsC,EAAA,WAAA,UAAA,KAAA,CAAA,GClRTjC,EAAO,mBAAmBiC,CAAc"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uvalib/web-components",
3
- "version": "1.8.5",
3
+ "version": "1.9.0",
4
4
  "description": "UVA Library reusable web components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -179,6 +179,14 @@
179
179
  "types": "./dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts",
180
180
  "default": "./dist/components/uvalib-back-to-top/uvalib-back-to-top.js"
181
181
  },
182
+ "./uvalib-dialog.js": {
183
+ "types": "./dist/components/uvalib-dialog/uvalib-dialog.d.ts",
184
+ "default": "./dist/components/uvalib-dialog/uvalib-dialog.js"
185
+ },
186
+ "./uvalib-citation.js": {
187
+ "types": "./dist/components/uvalib-citation/uvalib-citation.d.ts",
188
+ "default": "./dist/components/uvalib-citation/uvalib-citation.js"
189
+ },
182
190
  "./tokens.css": "./dist/tokens.css",
183
191
  "./base.css": "./dist/base.css",
184
192
  "./pagefind.css": "./dist/pagefind.css",
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: uvalib-web-components
3
- description: Use when building or editing UVA Library web pages or sites with @uvalib/web-components: the header, footer, page wrapper and other page chrome (<site-page>, <site-header>, <site-main-nav>, <site-footer>, <site-alerts>, <site-analytics>/<uvalib-analytics>, <site-style>), and other uvalib-* components (breadcrumbs, cards, pager, tabs, contents, metadata, chips, tags, results count, filter, filter drawer, date range, date histogram, combobox, map (Leaflet), lightbox, photo grid, image regions, back to top, Pagefind search), the library hours, events and bento-box elements (e.g. <uvalib-card>, <uvalib-chip-group>, <library-weekly-hours>), base.css classes, or script/link URLs on unpkg.internal.lib.virginia.edu (incl. migrating old /web-components/latest/ or cdn-v URLs). Covers CDN vs npm, version pinning, shadow vs light DOM, theming with --uva-* tokens, WCAG 2.2 AA accessibility testing, requesting components via GitHub issues, and a verification checklist.
3
+ description: Use when building or editing UVA Library web pages or sites with @uvalib/web-components: the header, footer, page wrapper and other page chrome (<site-page>, <site-header>, <site-main-nav>, <site-footer>, <site-alerts>, <site-analytics>/<uvalib-analytics>, <site-style>), and other uvalib-* components (breadcrumbs, cards, pager, tabs, contents, metadata, citation, chips, tags, results count, filter, filter drawer, dialog, date range, date histogram, combobox, map (Leaflet), lightbox, photo grid, image regions, back to top, Pagefind search), the library hours, events and bento-box elements (e.g. <uvalib-card>, <uvalib-chip-group>, <library-weekly-hours>), base.css classes (incl. tables), or script/link URLs on unpkg.internal.lib.virginia.edu (incl. migrating old /web-components/latest/ or cdn-v URLs). Covers CDN vs npm, version pinning, shadow vs light DOM, theming with --uva-* tokens, WCAG 2.2 AA accessibility testing, requesting components via GitHub issues, and a verification checklist.
4
4
  ---
5
5
 
6
6
  # UVA Library web components
7
7
 
8
- `@uvalib/web-components` provides the UVA Library page chrome as custom elements: `<site-page>` (skip link, header with the library main navigation, one `<main>`, footer), `<site-header>`, `<site-main-nav>` (the main navigation, rendered by the header), `<site-footer>`, `<site-analytics>` (Matomo; also registered as `<uvalib-analytics>`) and `<site-style>` (legacy compatibility), plus `<uvalib-breadcrumbs>` (the breadcrumb trail), `<uvalib-contents>` (sub-navigation or a table of contents) and `<uvalib-metadata>` (a record's details, credit, rights and how to cite), all in section 2, `<uvalib-card>`, `<uvalib-card-grid>` and `<uvalib-pager>` (cards and paging, section 5), `<uvalib-tabs>` (tabbed panels), `<uvalib-back-to-top>` (a back-to-top button for long pages) and `<site-alerts>` (the live library alerts, which `<site-page>` shows itself). It also ships search-page components, `<uvalib-filter>`, `<uvalib-date-range>` and `<uvalib-date-histogram>`, `<uvalib-chip-group>` for segmented controls, filter chips and suggestion chips, `<uvalib-combobox>`, a text field that suggests values as you type, and `<uvalib-filter-drawer>`, the filters as a sidebar or a modal panel on phones (section 6), and three library-hours elements for library.virginia.edu, `<site-hours-section>`, `<library-weekly-hours>` and `<library-hours-setup>`, `<events-section>` for upcoming library events and `<bento-box>` for the library's search results page (section 7), and `pagefind.css` with `<uvalib-pagefind-search>` for a static site's Pagefind search, and `<uvalib-tag-list>`, `<uvalib-results-count>` and `base.css`'s badge, toolbar, empty-state and skeleton classes for results lists (section 6), and `<uvalib-lightbox>`, `<uvalib-photo-grid>` and `<uvalib-image-regions>` for images and `<uvalib-map>` for a map of places over the page's own Leaflet, with a linked list (section 8). Tag names are stable.
8
+ `@uvalib/web-components` provides the UVA Library page chrome as custom elements: `<site-page>` (skip link, header with the library main navigation, one `<main>`, footer), `<site-header>`, `<site-main-nav>` (the main navigation, rendered by the header), `<site-footer>`, `<site-analytics>` (Matomo; also registered as `<uvalib-analytics>`) and `<site-style>` (legacy compatibility), plus `<uvalib-breadcrumbs>` (the breadcrumb trail), `<uvalib-contents>` (sub-navigation or a table of contents), `<uvalib-metadata>` (a record's details, credit, rights and how to cite) and `<uvalib-citation>` (a citation in several formats with Copy citation), all in section 2, `<uvalib-card>`, `<uvalib-card-grid>` and `<uvalib-pager>` (cards and paging, section 5), `<uvalib-tabs>` (tabbed panels), `<uvalib-back-to-top>` (a back-to-top button for long pages) and `<site-alerts>` (the live library alerts, which `<site-page>` shows itself). It also ships search-page components, `<uvalib-filter>`, `<uvalib-date-range>` and `<uvalib-date-histogram>`, `<uvalib-chip-group>` for segmented controls, filter chips and suggestion chips, `<uvalib-combobox>`, a text field that suggests values as you type, and `<uvalib-filter-drawer>`, the filters as a sidebar or a modal panel on phones, and `<uvalib-dialog>`, a modal dialog for search tips, Cite and short forms (section 6), and three library-hours elements for library.virginia.edu, `<site-hours-section>`, `<library-weekly-hours>` and `<library-hours-setup>`, `<events-section>` for upcoming library events and `<bento-box>` for the library's search results page (section 7), and `pagefind.css` with `<uvalib-pagefind-search>` for a static site's Pagefind search, and `<uvalib-tag-list>`, `<uvalib-results-count>` and `base.css`'s badge, toolbar, empty-state and skeleton classes for results lists (section 6), and `<uvalib-lightbox>`, `<uvalib-photo-grid>` and `<uvalib-image-regions>` for images and `<uvalib-map>` for a map of places over the page's own Leaflet, with a linked list (section 8). Tag names are stable.
9
9
 
10
10
  Authority rule: https://www.library.virginia.edu and the UVA Library design system are the source of truth for how the chrome looks and what it says. Do not re-create, copy or restyle the header, footer, logo or links by hand. Use the components, and change appearance only through the theming surface below.
11
11
 
@@ -31,7 +31,7 @@ Loading rules:
31
31
 
32
32
  - One script is enough for the page chrome: `site-page.js` also loads the header (with its main navigation) and footer. For Matomo, give `<site-page>` a `matomo-id` (it loads the analytics code itself), or add `site-analytics.js` and a `<site-analytics>` (or `uvalib-analytics.js` and `<uvalib-analytics>`) element; never both, and never alongside a hand-written Matomo snippet.
33
33
  - Also link `.../v1/base.css` in `<head>` (npm: `@uvalib/web-components/base.css`), unless the page sets `no-global-styles`. `<site-page>` installs the same base styles only after the first paint, so without the link the page shifts once (the default body margin goes away, and a heading's margin stops collapsing through the not-yet-defined `<site-page>`). The link also keeps `<site-page>` invisible until it is defined, with a two-second fallback.
34
- - npm: the define entries (`@uvalib/web-components/site-page.js`, `site-header.js`, `site-main-nav.js`, `site-footer.js`, `site-analytics.js`, `uvalib-analytics.js`, `site-style.js`, `uvalib-breadcrumbs.js`, `uvalib-card.js`, `uvalib-card-grid.js`, `uvalib-pager.js`, `uvalib-contents.js`, `uvalib-metadata.js`, `site-alerts.js`, `uvalib-filter.js`, `uvalib-date-range.js`, `uvalib-date-histogram.js`, `site-hours-section.js`, `library-weekly-hours.js`, `library-hours-setup.js`, `events-section.js`, `bento-box.js`, `uvalib-pagefind-search.js`, `uvalib-lightbox.js`, `uvalib-photo-grid.js`, `uvalib-tabs.js`, `uvalib-chip-group.js`, `uvalib-tag-list.js`, `uvalib-results-count.js`, `uvalib-combobox.js`, `uvalib-image-regions.js`, `uvalib-map.js`, `uvalib-filter-drawer.js`, `uvalib-back-to-top.js`) register the element (`bento-box.js` also registers its four sections, `<catalog-section>`, `<articles-section>`, `<libguides-section>` and `<website-section>`). Importing the package root (`@uvalib/web-components`) gives the classes only and registers nothing. If you use the `SitePage` class directly, also import the header and footer define entries.
34
+ - npm: the define entries (`@uvalib/web-components/site-page.js`, `site-header.js`, `site-main-nav.js`, `site-footer.js`, `site-analytics.js`, `uvalib-analytics.js`, `site-style.js`, `uvalib-breadcrumbs.js`, `uvalib-card.js`, `uvalib-card-grid.js`, `uvalib-pager.js`, `uvalib-contents.js`, `uvalib-metadata.js`, `site-alerts.js`, `uvalib-filter.js`, `uvalib-date-range.js`, `uvalib-date-histogram.js`, `site-hours-section.js`, `library-weekly-hours.js`, `library-hours-setup.js`, `events-section.js`, `bento-box.js`, `uvalib-pagefind-search.js`, `uvalib-lightbox.js`, `uvalib-photo-grid.js`, `uvalib-tabs.js`, `uvalib-chip-group.js`, `uvalib-tag-list.js`, `uvalib-results-count.js`, `uvalib-combobox.js`, `uvalib-image-regions.js`, `uvalib-map.js`, `uvalib-filter-drawer.js`, `uvalib-back-to-top.js`, `uvalib-dialog.js`, `uvalib-citation.js`) register the element (`bento-box.js` also registers its four sections, `<catalog-section>`, `<articles-section>`, `<libguides-section>` and `<website-section>`). Importing the package root (`@uvalib/web-components`) gives the classes only and registers nothing. If you use the `SitePage` class directly, also import the header and footer define entries.
35
35
  - Do not load the same component from both the CDN and npm on one page.
36
36
 
37
37
  ## 2. Required page structure
@@ -43,6 +43,7 @@ Loading rules:
43
43
  - Cards and paging: a collection or photo is a `<uvalib-card>` (`uvalib-card.js`), inside `<uvalib-card-grid>` (`uvalib-card-grid.js`) when there are several. `href` makes the heading the one link for the whole card: never wrap the card in an `<a>`, and do not put another link, button or other control inside a clickable card. The heading needs an accessible name, or the link is hidden. A card with no `href` may contain its own links, including an `actions` slot row (“Read the story”, “Photos (132)”). Do not put that row in a clickable card: the card link covers it, and the component warns. `media-shape="circle"` draws a person or avatar as a circle and keeps the image alt; the count badge still sits on it. An image needs a real alt, or `alt=""` when the heading already names it. Previous/next sections, numbered pages, or `mode="load-more"` (a Load more button and “Showing N of M”, or “Showing N” with no `total`; with an unknown total add `has-more` and remove it, or set `hasMore = false`, after the last page) are one `<uvalib-pager>` (`uvalib-pager.js`); a second pager on the same page needs its own `label`. Load more fires `load-more` (`detail: { page }`, the next page). Call `loaded(firstNew)`, or set `for` to the list id and call `loaded()`, so focus moves to the new item. `<uvalib-tabs>` (`uvalib-tabs.js`) is a tab set: each child with `data-tab` is a panel, or pair `<button slot="tab">` with panels. Arrow keys move, Home and End jump, and `activation="manual"` waits for Enter or Space. `url-param` (or `url-param="hash"`) makes the selected tab linkable and Back restores it. In a single-page app, listen for `uvalib-card-navigate` and `uvalib-pager-navigate` and call `preventDefault()` to route in place.
44
44
  - Sub-navigation and tables of contents: a `<uvalib-contents>` (from `uvalib-contents.js`) holding one `<ol>`/`<ul>` of `<li><a href>` entries, nested lists for sub-entries (plain text in an `<li>` for a group label), never a hand-built `<nav>` list or `<details>` for it. It is the `<nav>` landmark (named and headed by `label`, default "Contents"; set `heading-level` to fit the outline) and marks the current page (`aria-current="page"`) and in-page section (`"location"`, from the hash) itself: do not add `aria-current` by hand unless the route is not the URL, and then prefer `current="<url>"`. It collapses into a disclosure button at 64rem and below (`collapse-below`), closed until opened. In a sidebar add `sticky`. For a long document's table of contents without a build-time list, `headings-from="#article"` (with `levels="2-3"`, `min`) builds it from the headings and adds ids; a build-time list (children) is better where possible, since it works without JavaScript. Apps can set `items` (`[{ label, href?, children? }]`); with history routing, cancel `uvalib-contents-navigate` to route in place.
45
45
  - Record details: a `<uvalib-metadata>` (from `uvalib-metadata.js`) around a plain `<dl>` (`<dt>` label, `<dd>` values; lists such as subjects as a `<ul>` in the `<dd>`). Downloads are `<a href download data-size="184 KB">EPUB</a>`. For credit and rights use its attributes, not your own rows: `creator`, `organization`, `rights` (a rightsstatements.org or Creative Commons URL; it shows the short name), `rights-info` (`https://www.library.virginia.edu/policies/use-of-materials`) and `citation` or `citation-title` (the Special Collections citation "<title>, Albert and Shirley Small Special Collections Library, University of Virginia"), which adds a Copy citation button. A long list (30 participants) gets `list-limit="8"` (or `data-limit` on its `<dd>`), not your own Show more script. Do not add icons from rightsstatements.org or creativecommons.org. With `base.css` linked the page does not move when it upgrades, including `list-limit` (or `data-limit`) from 1 to 12; for a larger limit add the page rule from the README ("No jump on upgrade").
46
+ - Citations in several formats (a record's Cite dialog or a "Cite this item" block): a `<uvalib-citation>` (from `uvalib-citation.js`), never a hand-built tab set, select, copy script or toast. Give each format as `<blockquote data-format="MLA">…</blockquote>` (keep `<i>` for titles; nothing else is kept as markup), or set `citations` (`[{ format, text, html? }]`) in an app; never fetch HTML into it. It draws a "Citation format" radio group (not tabs), the selected citation as selectable text, a 44px Copy citation button (plain text plus HTML, so italics survive a paste) with a polite "MLA citation copied" status, and with `ris-href` a Download RIS link; more export links go in `slot="actions"`. `format` picks the default; `remember` keeps the visitor's last choice per site. In a dialog, add `hide-label` when the dialog's heading says "Cite this item". With `base.css` linked the page does not move when it upgrades. For one simple citation in a record's details, `<uvalib-metadata citation="…">` remains the right choice. It reports `format`, `copy` and `download` (the format name only) to analytics itself.
46
47
  - Long pages (minutes, finding aids, transcriptions, long result lists): a `<uvalib-back-to-top>` (from `uvalib-back-to-top.js`) last in the content inside `<site-page>`, never a hand-built button and scroll script. It stays hidden (`visibility: hidden`, not a tab stop) until the top 400px (`offset`) scroll away, then floats in the bottom corner; activating it scrolls to the top (smooth unless reduced motion) and moves focus to the page's `<h1>` (or `target`, a selector), adding `tabindex="-1"`. The element keeps 4.75rem of space at the end and the button rests there at the bottom, so it never covers the last lines or the footer: do not add your own padding for it. `label` changes its text. `<site-page>` has no attribute for it. It reports `click` to analytics itself.
47
48
  - Content for a band above the footer: put an element with `slot="pre-footer"` inside `<site-page>`.
48
49
  - `no-footer` on `<site-page>` hides the footer (and any pre-footer band). Use it only for tool or app-like pages, such as a full-screen editor, where the site footer does not belong; normal content pages keep the footer.
@@ -57,6 +58,7 @@ Loading rules:
57
58
  - A sub-site's name (Electronic Text Collections, an exhibit or project site): `site-name="…"` on `<site-page>` (and `site-name-href` when its home is not `/`). The header shows it after the logo as a link to the site's home; the logo still links to library.virginia.edu. Never add your own banner, title bar or second logo row for it, and never make it the page's `<h1>` (the page keeps its own). Keep it short (two lines at most on wide screens).
58
59
  - Buttons, toggles and search boxes in the page's own content: use `base.css`'s classes, never hand-rolled button CSS: `.uvalib-button` (on `<button>` or `<a>`), `--secondary` (outline), `--subtle`, `--small`, `--large`; a toggle is a `.uvalib-button` with `aria-pressed="true|false"` (flip it in script); fields are `.uvalib-input` with a visible `<label>`, and a search box is `<form class="uvalib-search-form" role="search">` holding the label, the field and a `.uvalib-button` submit. They need `base.css` linked (`<site-page>` does not install them); it carries the dark-mode role tokens they read. Disable with `disabled` (or `aria-disabled="true"` while busy); a pressed toggle is filled whatever its variant.
59
60
  - Messages in the page's own content (a search error, a "keyword results only" notice): `<div class="uvalib-message uvalib-message--error" role="alert">` (`--warning`, `--info`/`--notice`, `--success`), starting with the severity in words in `<strong class="uvalib-message__label">Error:</strong>`; `role="alert"` only for an error caused by what the visitor did, `role="status"` for notices. Never hand-rolled alert boxes, and never a `<site-alerts>` for them. `hidden` hides every `base.css` class (`el.hidden = true`); no `[hidden]` reset is needed.
61
+ - Data tables (holdings, schedules, statistics): `<table class="uvalib-table">` with a `<caption>` (or `aria-labelledby`) and `<th scope="col|row">`; `--striped`, `--compact`, `.uvalib-table__num` for right-aligned numbers. Wide ones go in `<div class="uvalib-table-scroll" role="region" tabindex="0" aria-labelledby="CAPTION-ID">` (scrolls inside itself, never the page). Grouped data (holdings by library) is a heading per group, at the level the page outline needs, then its table. The opt-in stack variant (`.uvalib-table-stack` > `.uvalib-table--stack`, cells with `data-label`) needs explicit ARIA table roles. Never hand-styled or W3.CSS tables, and never a table for layout.
60
62
  - Printing: `<site-page>` prints only `<main>` (no header, nav, alerts, breadcrumbs or footer), black on white with underlined links and a "UVA Library — site, URL" line; `print-chrome` keeps the chrome. Do not add print rules for the chrome yourself.
61
63
  - Third-party or vendor sites that are not library.virginia.edu: `<site-page header-variant="vendor">` (logo plus Ask a Librarian only). Links default to `root-link-domain="https://www.library.virginia.edu"`; set it only for a non-production domain.
62
64
  - Do not replace a light-mode page's children wholesale (`innerHTML` or `textContent` on `<site-page>`): that destroys the chrome. Append, or update a child container inside it.
@@ -76,7 +78,7 @@ Theme only through the documented surface, never by reaching into internals:
76
78
 
77
79
  - Inherited `--uva-*` custom properties (colors such as `--uva-brand-blue`, `--uva-brand-orange`; `--uva-font-family`, `--uva-font-size-base`). Set them on `:root` or an ancestor of `<site-page>`. The full set is in `tokens.css`; per-component ones are in reference/components.md. Prefer the library's values; override only with a stated reason. If you override `--uva-font-family`, keep `"UVA Franklin Fallback"` right after `franklin-gothic-urw`: it is Arial matched to Franklin Gothic's metrics, so text does not rewrap and shift the page when the Adobe Fonts kit arrives.
78
80
  - `::part()` in shadow mode. On a page, use `site-page::part(header)`, `site-page::part(footer)` and `site-page::part(main)` (`<site-page>` re-exports the header and footer parts; `site-header::part(header)` cannot reach through its shadow root). For a standalone `<site-header>` or `<site-footer>` use `site-header::part(header)` / `site-footer::part(footer)`. In light mode there are no shadow parts; style the elements with ordinary selectors.
79
- - Custom states for runtime state, in shadow and light mode: `uvalib-combobox:state(open)`, `:state(invalid)`, `:state(loading)`; `uvalib-filter-drawer:state(modal)` (phone layout), `:state(open)`; `uvalib-lightbox:state(open)`; `uvalib-tag-list:state(expanded)`. Style them; never add or watch attributes for that state (there are none) or set it yourself (a page cannot). Browsers without custom states just never match.
81
+ - Custom states for runtime state, in shadow and light mode: `uvalib-combobox:state(open)`, `:state(invalid)`, `:state(loading)`; `uvalib-filter-drawer:state(modal)` (phone layout), `:state(open)`; `uvalib-dialog:state(open)`; `uvalib-lightbox:state(open)`; `uvalib-tag-list:state(expanded)`. Style them; never add or watch attributes for that state (there are none) or set it yourself (a page cannot). Browsers without custom states just never match.
80
82
  - Never pierce shadow roots with JS, depend on internal class names, or use `!important` to fight the chrome.
81
83
 
82
84
  ### Dark mode (opt-in)
@@ -421,10 +423,11 @@ A record page with its metadata and a contents sidebar (the sidebar is an ordina
421
423
 
422
424
  For a search results page that needs a checkbox facet, a date-range picker or date counts as bars, use `<uvalib-filter>`, `<uvalib-date-range>` and `<uvalib-date-histogram>` instead of hand-built fieldsets, sliders and charts. They are not page chrome: use them inside `<site-page>` alongside your own results, and load each from its own script (`uvalib-filter.js`, `uvalib-date-range.js`, `uvalib-date-histogram.js`; npm: `@uvalib/web-components/uvalib-filter.js`).
423
425
 
424
- - `<uvalib-filter>`: set `filter` (`{ name, title, position, buckets: [{ key, doc_count, selected }] }`), `value` (selected keys), and optionally `scopes` (`[{ value, label }]` chips), `scopeValue` and `scopesLabel`. `limit="5"` shows five buckets with See more / See less. Events: `filter-change` (`detail: { name, value }`) and `scope-change` (`detail: { value }`).
426
+ - `<uvalib-filter>`: set `filter` (`{ name, title, position, buckets: [{ key, doc_count, selected }] }`), `value` (selected keys), and optionally `scopes` (`[{ value, label }]` chips), `scopeValue` and `scopesLabel`. `limit="5"` shows five buckets with See more / See less. Events: `filter-change` (`detail: { name, value }`) and `scope-change` (`detail: { value }`). For a facet group (Virgo-style Subject, Format…) use its opt-in attributes, never a hand-built accordion, filter box or sort menu: `collapsible` (caret disclosure, `collapsed`, `heading-level`; shows "2 selected" while closed; fires `toggle` `{ open }`), `searchable` (`search-label`, `unit`; checked values stay pinned), `sortable` (`sort="count|name"`; fires `sort` `{ sort }`), `clearable`, `apply-button` (staged changes, one `filter-change` per Apply) and `match="any|all"` (helper text only).
425
427
  - `<uvalib-date-range>`: `min` and `max` (`YYYY-MM-DD`) are required; without them nothing renders and a console warning is logged. Set `value` to `[start, end]`; `label` renames the legend. Events: `date-range-change` (`detail: { value: [start, end] }`) for a visitor's change; `uvalib-date-range-value` (same detail) for any change, script sets included.
426
428
  - `<uvalib-date-histogram>`: set `items` (`[{ date: 'YYYY' | 'YYYY-MM', count }]`) or a child `<table>` (two columns, date and count, or a year-by-month grid). The table is the no-JS fallback and stays available; "Show as table" shows the same counts. `granularity` is `month` (bars grouped by year), `year`, `decade` (for a long span, e.g. 1817–2026: "1810s: 22 meetings", choosing one selects `1810/1819`) or `auto` (months up to 3 years, years up to 30, then decades). `unit` (default `items`) names each bar, for example "October 2015: 5,311 photos". Arrow keys move between bars; Enter or Space selects. `selected` is one bucket or a range (`2015-10` or `2015-10/2016-03`). A choice fires `select` (`detail: { from, to }` as ISO dates). `range-for` names a `<uvalib-date-range>`: a bar sets its `value`, and any change to the range's value, from its controls or set in script (Clear, Back/Forward, a restored URL), highlights the bars it covers (the range fires `uvalib-date-range-value` for every change). On (re)connect a range value that holds a selection wins over `selected`. Setting `selected` in script updates that date range and does not fire `select`. A value equal to that range's own `min` and `max` selects nothing. `scale="log"` sizes bars by log(count + 1). On a narrow screen month rows scroll inside the chart ("Scroll sideways to see more."); year bars wrap. `variant="strip"` is a non-interactive per-year row (`role="img"`) for a card. A date that is not a bucket at that granularity is a chip. Analytics: one `select` named `<from>–<to>` when both ends are ISO dates, otherwise `other`; nothing when the selection is cleared, set in script, or restored from a date range.
427
429
  - A search page's form and facets on phones: wrap them in one `<uvalib-filter-drawer>` (`uvalib-filter-drawer.js`), never a hand-built off-canvas panel, `role="dialog"` div or focus-return script. Above `breakpoint` (default `48rem`) the children are a plain sidebar (lay out the column yourself); at and below it a "Search and filters" button (`label`) opens them in a native modal `<dialog>` with a heading and a Close button that takes focus; Escape, Close and the backdrop close it and focus returns to the button. The rest of the page, `<site-page>`'s header included, is inert while it is open: do not add `inert` or focus-trapping code. Inert regions are not announced, so list the ids of the results count and status notices outside it in `live` (`live="results-count status"`) and it repeats their announcements inside the panel. Set `count` to the number of filters set (shown on the button). The children are moved, never re-created, so form state and filter state survive; call `close()` after running a search if you want the results shown. base.css holds the button's place on phones before it upgrades; with your own `breakpoint`, copy the README's `:not(:defined)` rule for that width. It reports `open` and `close` (the label) to analytics itself.
430
+ - Any modal (search tips, "Help me search", Cite, a sign-in prompt, a request or email form): one `<uvalib-dialog id="…" label="…">` (`uvalib-dialog.js`) around the content, never a hand-built modal, `role="dialog"` div, PrimeVue `<Dialog>` or other framework dialog, focus trap or focus-return script. Open it with `<button type="button" data-uvalib-dialog="<id>">` anywhere in the page (works for buttons rendered later), or `show()` / `open`; close with `close(returnValue)`. `label` is the visible heading and the name (`heading-level`, default 2). Focus goes to the content's `[autofocus]` element (put it on a form's first field) or else the heading, and returns to the opener on every close (or `return-focus`). Escape and Close always close it; the backdrop too unless `persistent`. Use `<form method="dialog">` (Cancel: `value="cancel" formnovalidate`) and read `uvalib-dialog-close`'s `detail.returnValue`. In forms: "required" in words in `.uvalib-required`, help in `.uvalib-help` tied with `aria-describedby`, errors in a `.uvalib-message--error` `role="alert"` summary plus `aria-invalid` and per-field text, a copy/sent confirmation in a `.uvalib-message--success` `role="status"` (never a toast), and links that open a new tab say so. `size="small|medium|large"` (30/40/60rem). Keep the default shadow mode with Vue or React (children are slotted, never moved). It reports `open` and `close` (the label) to analytics itself.
428
431
  - The filter and the date range are controlled: update `value` / `scopeValue` from your own state after each event, and re-run your search.
429
432
  - Do not hard-code ids on the filter's or date range's inner inputs; ids are unique per instance and the markup is internal.
430
433
 
@@ -773,6 +773,49 @@ A row of chips: a segmented control or single-select filter (`mode="single"`), f
773
773
  | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
774
774
  | `--uva-color-surface` | | Dark-mode role token: the page background the scrolling row fades into at an edge with more chips (else #fff). |
775
775
 
776
+ ## `<uvalib-citation>`
777
+
778
+ One record's citation in several formats (MLA, APA, Chicago, Bluebook…), a radio group to choose one, and a Copy citation button, as in Virgo's Cite dialog. Inline on a record page or inside a dialog: it assumes nothing about where it sits. Give each format as a child, `<blockquote data-format="MLA">…</blockquote>` (any element with `data-format`), so the page reads the same before the script loads (with `base.css`, only the first shows then, and the chooser's and button's space is held). Inline markup in a citation (`<i>` or `<em>` for a title) is kept; other elements are reduced to their text and nothing is parsed as HTML. Apps set the `citations` property instead (`[{ format, text, html? }]`, winning over the children while set); `html` keeps only inline elements, too. The formats are native radios drawn as one segmented bar (`role="radiogroup"`, "Citation format"): one tab stop, the arrow keys move and select, and the selected one is filled and ticked. `format` names the selected one (default the first). With `remember`, the visitor's last choice is kept in localStorage (per site) and wins over `format` on their next record. The selected citation is shown as selectable text in a region named "<format> citation". Copy citation copies it as plain text and as HTML where the browser allows (so an italic title stays italic when pasted into a word processor) and says "MLA citation copied" in a polite status next to the button, in the text colour (AAA), not in a toast. If the clipboard is unavailable, the citation is selected and the status says to copy it with the keyboard. `ris-href` adds a "Download RIS" link (`ris-label`) with a `download` attribute. Other export links go in the `actions` slot (`<a slot="actions" href="…" download>EndNote</a>`), after it.
779
+
780
+ ### Attributes
781
+
782
+ | Attribute | Type | Default | Description |
783
+ |---|---|---|---|
784
+ | `label` | `string` | `'Cite this item'` | The group's visible label and accessible name. |
785
+ | `hide-label` | `boolean` | `false` | Hide the label visually (it still names the group), for a dialog whose heading says it. |
786
+ | `format` | `string` | `''` | The selected format's name (default the first). Reflected when the visitor chooses one. |
787
+ | `remember` | `boolean` | `false` | Keep the visitor's last format in localStorage (per site), winning over `format`. |
788
+ | `ris-href` | `string` | `''` | A RIS file for the record: adds a download link. |
789
+ | `ris-label` | `string` | `'Download RIS'` | The RIS link's text. |
790
+ | `no-shadow-dom` | `boolean` | `false` | |
791
+ | `no-style` | `boolean` | `false` | |
792
+
793
+ ### Slots
794
+
795
+ | Slot | Description |
796
+ |---|---|
797
+ | `actions` | More export links or buttons, after Copy citation and Download RIS. |
798
+
799
+ ### Events
800
+
801
+ | Event | Description |
802
+ |---|---|
803
+ | `uvalib-citation-format` | The visitor chose another format: `detail` is `{ format }`. Not fired when the app sets `format`. Bubbles and is composed. |
804
+ | `uvalib-analytics-event` | For `<site-analytics>`, on the visitor's actions only: `['uvalib-citation', 'format', '<format>']` (once the visitor settles on one, a second after the last change), `['uvalib-citation', 'copy', '<format>']` and `['uvalib-citation', 'download', 'ris']`. Never the citation. Bubbles and is composed. |
805
+
806
+ ### CSS custom properties
807
+
808
+ | Property | Default | Description |
809
+ |---|---|---|
810
+ | `--uva-color-text` | | Dark-mode role token: label, citation and status colour (else `--uva-grey-darkest`). |
811
+ | `--uva-color-border` | | Dark-mode role token: the citation's border (else #dadada). |
812
+ | `--uva-color-surface-raised` | | Dark-mode role token: the citation's, segments' and buttons' background (else #fff). |
813
+ | `--uva-color-control-border` | | Dark-mode role token: segment border (else `--uva-grey`, #808080). |
814
+ | `--uva-color-link` | | Dark-mode role token: segment and button text, button border (else `--uva-brand-blue`). |
815
+ | `--uva-color-accent-bg` | | Dark-mode role token: the selected segment (else `--uva-brand-blue`). |
816
+ | `--uva-color-on-accent` | | Dark-mode role token: the selected segment's text (else #fff). |
817
+ | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
818
+
776
819
  ## `<uvalib-combobox>`
777
820
 
778
821
  An editable text field that suggests values as you type, from a local list or a URL: a person, place or subject picker. It follows the WAI-ARIA APG “Editable Combobox With List Autocomplete”: a real `<input role="combobox">` and a `role="listbox"` popup under it. Suggestions come from the `items` property (`{ value, label?, description?, disabled? }` objects, or strings), from `<option>` children (directly or inside a `<datalist>`; the `label` attribute or text is the label, `data-description` the second line), or from `src`, a URL template with `{q}` (fetched 250 ms after the last keystroke once the text has `min-length` characters, default 1; a newer keystroke aborts the older request; the response is a JSON array of the same shape, or anything `transform(data, query)` turns into one). `items` wins over the children while set. Local suggestions match anywhere in the label, ignoring case and accents, those starting with the text first, then those with a word starting with it; at most `max-results` (default 50, 0 for all) are shown, which keeps a list of 16,000 people fast. The matched text is bold and underlined in a `<mark>`. Keys: Down opens the list on the first suggestion and moves (wrapping), Up opens on the last, Alt+Down opens without moving, Alt+Up closes, Enter chooses the active suggestion (and then does not submit the form; with none active, Enter submits as in any field), Escape closes the list and a second Escape clears the field, Home, End, Left and Right move the caret, and Tab leaves without choosing. A real clear button (“Clear <label>”, 44px, shown only with text) empties the field and returns focus to it. Free text is allowed: `value` is whatever is in the field, and `selected` the chosen suggestion (or null); typing after choosing clears it, and leaving the field with text that is exactly one suggestion's label chooses it. `must-choose` makes any other text invalid (“Choose one of the suggestions.”). The element is form-associated: with `name` it submits the chosen suggestion's value, or else the text, and a form reset restores the `value` attribute. `required` and `disabled` (also from a disabled fieldset) work as on an input. A polite status says “5 suggestions”, “50 of 1,234 suggestions”, “No suggestions”, “Loading suggestions” or “Couldn't load suggestions” half a second after the list settles (never on the first render); the popup shows the same notes visibly. A failed load never throws. Where the browser supports the Popover API and CSS anchor positioning, the popup is a manual popover in the top layer, anchored under the field and as wide as it (above it when there is no room below), so an ancestor with `overflow: hidden` or a scrolling panel never clips it. Elsewhere it is positioned under the field inside the element, as before. Pages can style the runtime state with `:state(open)`, `:state(invalid)` and `:state(loading)` (no attributes are added). Before it upgrades, `base.css` shows the label (from the attribute) and holds the field's height. A fallback `<input list>` child works as a plain field meanwhile; on upgrade its text, `name` and `placeholder` carry over, and it is disabled so it does not submit twice.
@@ -982,9 +1025,73 @@ A date-range picker: a two-thumb year slider plus "From" and "To" date inputs. `
982
1025
  | `--uva-color-control-border` | | Dark-mode role token: date input border (else `--uva-grey`, #808080). |
983
1026
  | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
984
1027
 
1028
+ ## `<uvalib-dialog>`
1029
+
1030
+ A modal dialog for content and short forms: search tips, Cite, a sign-in prompt, a request form. Use it instead of a hand-built modal, a `role="dialog"` div or a framework's dialog. The children are the content. In shadow DOM they are slotted, never moved, so the page's CSS, ids, listeners and framework-rendered nodes keep working; with `no-shadow-dom` they are moved into the dialog (the same nodes, in the same document). It opens as a native `<dialog>` with `showModal()`: everything else on the page, `<site-page>`'s shadow header included, is inert while it is open, so focus stays inside without a trap script. The visible heading (`label`, an `<h2>` unless `heading-level` says otherwise) names it, and a 44px Close button is always shown; `description` (or a `slot="description"` child) is shown under the heading and is the dialog's description. Open it with a button anywhere in the page, `<button type="button" data-uvalib-dialog="<id>">` (one delegated listener, so buttons rendered later work too), with an invoker button (`commandfor="<id>" command="--show-modal"`) where the browser has invoker commands, with `show()`, or by setting `open`. On open, focus goes to the content's `[autofocus]` element when it has one (a form dialog: the first field), else to the heading, so a screen reader reads the dialog from the top and long content starts in view. On every close (Close, Escape, the backdrop, a `data-uvalib-dialog-close` button, a `<form method="dialog">` submitted, `close()`) focus returns to the element that opened it; if that is gone, to `return-focus` (a selector, or an element set as the property). Escape always closes it. A click on the backdrop closes it too (the native `closedby="any"`, or the same check in script where the browser lacks it), except with `persistent`, and never when a press starts inside the dialog and ends on the backdrop (a text selection or a drag). A `<form method="dialog">` in the content closes it on submit with the submitter's `value` as `returnValue`; other forms submit as usual. `size` is `small` (30rem), `medium` (the default, 40rem) or `large` (60rem) at most, and never wider or taller than the viewport less 16px on each side; the content scrolls inside it under a header that stays in view.
1031
+
1032
+ ### Attributes
1033
+
1034
+ | Attribute | Type | Default | Description |
1035
+ |---|---|---|---|
1036
+ | `label` | `string` | `''` | The visible heading and the dialog's accessible name. |
1037
+ | `heading-level` | `number` | `2` | The heading's level, 1 to 6 (default 2). |
1038
+ | `description` | `string` | `''` | A short description under the heading (or a `slot="description"` child), read as the dialog's description. |
1039
+ | `size` | `'small' \| 'medium' \| 'large'` | `'medium'` | The widest the dialog gets: `small` (30rem), `medium` (40rem) or `large` (60rem). |
1040
+ | `open` | `boolean` | `false` | Whether it is open. Reflected; setting it opens or closes the dialog (as `show()` and `close()`). |
1041
+ | `persistent` | `boolean` | `false` | A click on the backdrop does not close it (Escape and Close still do). For forms that would lose typed text. |
1042
+ | `return-focus` | `string \| HTMLElement \| null` | `null` | Where focus goes on close when the opener is gone: a selector (in the dialog's root, then the document) or an element. |
1043
+ | `close-label` | `string` | `'Close'` | The Close button's text. |
1044
+ | `no-shadow-dom` | `boolean` | `false` | |
1045
+ | `no-style` | `boolean` | `false` | |
1046
+
1047
+ ### Slots
1048
+
1049
+ | Slot | Description |
1050
+ |---|---|
1051
+ | (default) | The content: text, links, a form. |
1052
+ | `description` | A short description under the heading, read as the dialog's description (instead of the `description` attribute). |
1053
+
1054
+ ### CSS parts
1055
+
1056
+ | Part | Description |
1057
+ |---|---|
1058
+ | `dialog` | The `<dialog>`. |
1059
+ | `header` | The heading row (the heading and Close). |
1060
+ | `heading` | The heading. |
1061
+ | `close` | The Close button. |
1062
+ | `description` | The description under the heading. |
1063
+ | `body` | The scrolling wrapper of the content. |
1064
+
1065
+ ### CSS states
1066
+
1067
+ | State | Description |
1068
+ |---|---|
1069
+ | `:state(open)` | The dialog is open. |
1070
+
1071
+ ### Events
1072
+
1073
+ | Event | Description |
1074
+ |---|---|
1075
+ | `uvalib-dialog-open` | The dialog opened: `detail` is `{ reason }`, `button` (a visitor's opener) or `api` (`show()` or `open`). Bubbles and is composed. |
1076
+ | `uvalib-dialog-close` | The dialog closed: `detail` is `{ reason, returnValue }`, `reason` one of `close-button`, `button` (a `data-uvalib-dialog-close` or invoker close button), `escape`, `backdrop`, `form` (a `<form method="dialog">`), `api` (`close()` or `open = false`) or `removed` (taken out of the page while open). Bubbles and is composed. |
1077
+ | `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-dialog', 'open', '<label>']` when a visitor's button opens it, and `['uvalib-dialog', 'close', '<label>']` when the visitor closes it (Close, a close button, Escape, the backdrop or a dialog form); never on `show()`, `close()` or `open` from script, and never the content. Bubbles and is composed. |
1078
+
1079
+ ### CSS custom properties
1080
+
1081
+ | Property | Default | Description |
1082
+ |---|---|---|
1083
+ | `--uvalib-dialog-width` | | The dialog's widest inline size, instead of `size`'s (still never wider than the viewport less 16px on each side). |
1084
+ | `--uva-color-surface` | | Dark-mode role token: dialog background (else #fff). |
1085
+ | `--uva-color-text` | | Dark-mode role token: dialog text (else `--uva-grey-darkest`, #2b2b2b). |
1086
+ | `--uva-color-text-muted` | | Dark-mode role token: the description (else #4b5563, 7.5:1 on white). |
1087
+ | `--uva-color-border` | | Dark-mode role token: dialog edge and heading rule (else #dadada). |
1088
+ | `--uva-color-button-bg` | | Dark-mode role token: Close's border and text (else `--uva-blue-alt`, #007bac). |
1089
+ | `--uva-color-button-hover-bg` | | Dark-mode role token: hovered Close (else `--uva-blue-alt-A`, #005679). |
1090
+ | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
1091
+
985
1092
  ## `<uvalib-filter>`
986
1093
 
987
- A faceted-search filter: a fieldset of checkboxes (value plus result count), optional toggle chips ("scopes") above them, and "See more" / "See less" buttons when `limit` is set. It is controlled: set `filter`, `value` and `scopeValue` from your search state and listen for the change events.
1094
+ A faceted-search filter: a fieldset of checkboxes (value plus result count), optional toggle chips ("scopes") above them, and "See more" / "See less" buttons when `limit` is set. It is controlled: set `filter`, `value` and `scopeValue` from your search state and listen for the change events. Optional filter-group features, each off by default (without them the markup, events and order are as before): `collapsible` (a caret disclosure button in the legend, with the selected count while collapsed), `searchable` (search within the values), `sortable` (Count \| Name (A–Z)), `clearable` (a Clear button), `apply-button` (stage changes until Apply) and `match` (says how the values combine).
988
1095
 
989
1096
  ### Attributes
990
1097
 
@@ -996,6 +1103,17 @@ A faceted-search filter: a fieldset of checkboxes (value plus result count), opt
996
1103
  | `scopevalue` | `string[]` | `[]` | Pressed scope values (matched case-insensitively). |
997
1104
  | `scopes-label` | `string` | `''` | Accessible name of the scope chip group. Empty (the default) means `Filter <title> by type`. |
998
1105
  | `limit` | `number` | `0` | Maximum buckets to show at first; 0 shows all. "See more" doubles it, "See less" halves it back. |
1106
+ | `collapsible` | `boolean` | `false` | The legend becomes a disclosure button (with the library's caret) that shows and hides the group. |
1107
+ | `collapsed` | `boolean` | `false` | With `collapsible`: the group is closed (its legend button and selected count only). The visitor's toggle updates it; nothing is remembered. |
1108
+ | `heading-level` | `number` | `0` | Wrap the legend's text (or disclosure button) in a heading of this level, 2 to 6. Unset (the default): no heading, as before. |
1109
+ | `searchable` | `boolean` | `false` | A search field above the values that narrows them as the visitor types. |
1110
+ | `search-label` | `string` | `''` | The search field's visible label. Empty (the default) means `Search <title>`. |
1111
+ | `unit` | `string` | `'values'` | What the values are, plural, for the search status ("12 of 340 subjects"). |
1112
+ | `sortable` | `boolean` | `false` | A "Sort by: Count \| Name (A–Z)" control. |
1113
+ | `sort` | `'count' \| 'name'` | `'count'` | The order: `count` (most results first; without `sortable`, the data's own order) or `name` (A–Z). The visitor's choice updates it. |
1114
+ | `clearable` | `boolean` | `false` | A Clear button, shown while something in the group is selected. |
1115
+ | `apply-button` | `boolean` | `false` | Stage checkbox changes until the visitor presses Apply (with Reset back to the applied state); `filter-change` fires on Apply only. |
1116
+ | `match` | `'any' \| 'all' \| undefined` | | Say how the selected values combine, under the legend: `any` ("Matches any selected value") or `all`. Unset: no text. |
999
1117
  | `no-shadow-dom` | `boolean` | `false` | |
1000
1118
  | `no-style` | `boolean` | `false` | |
1001
1119
 
@@ -1005,14 +1123,21 @@ A faceted-search filter: a fieldset of checkboxes (value plus result count), opt
1005
1123
  |---|---|
1006
1124
  | `see-more` | The "See more" button (shadow mode). |
1007
1125
  | `see-less` | The "See less" button (shadow mode). |
1126
+ | `toggle` | The disclosure button in the legend (`collapsible`). |
1127
+ | `search` | The search-within field (`searchable`). |
1128
+ | `clear` | The Clear button (`clearable`). |
1129
+ | `apply` | The Apply button (`apply-button`). |
1130
+ | `reset` | The Reset button (`apply-button`). |
1008
1131
 
1009
1132
  ### Events
1010
1133
 
1011
1134
  | Event | Description |
1012
1135
  |---|---|
1013
- | `filter-change` | A checkbox was toggled. `detail` is `{ name, value }`: the facet name and the new array of selected keys. Does not bubble. |
1136
+ | `filter-change` | A checkbox was toggled, Clear was pressed, or (with `apply-button`) Apply was pressed. `detail` is `{ name, value }`: the facet name and the new array of selected keys (`[]` after Clear). Does not bubble. |
1014
1137
  | `scope-change` | A scope chip was toggled. `detail` is `{ value }`: the new array of pressed scope values. Does not bubble. |
1015
- | `uvalib-analytics-event` | For `<site-analytics>`, on the visitor's changes only: `['uvalib-filter', 'facet-change', '<title>: <value>', 1 \| 0]` (checked or unchecked), `['uvalib-filter', 'scope-change', <scope label>, 1 \| 0]` (pressed or not), and `['uvalib-filter', 'see-more' \| 'see-less', <title>]`. Bubbles and is composed. |
1138
+ | `toggle` | With `collapsible`: the visitor opened or closed the group. `detail` is `{ open }`. Does not bubble. |
1139
+ | `sort` | With `sortable`: the visitor chose a sort. `detail` is `{ sort }` (`count` or `name`). Does not bubble. |
1140
+ | `uvalib-analytics-event` | For `<site-analytics>`, on the visitor's changes only: `['uvalib-filter', 'facet-change', '<title>: <value>', 1 \| 0]` (checked or unchecked; with `apply-button`, one per value when Apply is pressed), `['uvalib-filter', 'scope-change', <scope label>, 1 \| 0]` (pressed or not), `['uvalib-filter', 'see-more' \| 'see-less', <title>]`, `['uvalib-filter', 'toggle', <title>, 1 \| 0]` (opened or closed), `['uvalib-filter', 'sort', '<title>: count' \| '<title>: name']`, `['uvalib-filter', 'clear', <title>, <number cleared>]`, `['uvalib-filter', 'apply', <title>, <number of changes>]` and `['uvalib-filter', 'search', <title>, <number of matches>]` once a search-within settles (never the typed text). Bubbles and is composed. |
1016
1141
 
1017
1142
  ### CSS custom properties
1018
1143
 
@@ -1021,11 +1146,13 @@ A faceted-search filter: a fieldset of checkboxes (value plus result count), opt
1021
1146
  | `--uva-brand-blue` | `#232d4b` | Scope chip text, hover border and pressed background. |
1022
1147
  | `--uva-brand-orange` | `#e57200` | Focus ring colour (focus-visible outline). |
1023
1148
  | `--uva-color-border` | | Dark-mode role token: divider under the scope chips (else #e5e7eb). |
1024
- | `--uva-color-control-border` | | Dark-mode role token: scope chip border (else `--uva-grey`, #808080). |
1025
- | `--uva-color-surface-raised` | | Dark-mode role token: scope chip background (else #fff). |
1026
- | `--uva-color-link` | | Dark-mode role token: scope chip text and hover border (else `--uva-brand-blue`). |
1027
- | `--uva-color-accent-bg` | | Dark-mode role token: pressed chip background and border (else `--uva-brand-blue`). |
1028
- | `--uva-color-on-accent` | | Dark-mode role token: pressed chip text (else #fff). |
1149
+ | `--uva-color-control-border` | | Dark-mode role token: scope chip, search field, sort and button borders (else `--uva-grey`, #808080). |
1150
+ | `--uva-color-surface-raised` | | Dark-mode role token: scope chip, search field, sort and button background (else #fff). |
1151
+ | `--uva-color-link` | | Dark-mode role token: scope chip and button text, the caret, hover border (else `--uva-brand-blue`). |
1152
+ | `--uva-color-accent-bg` | | Dark-mode role token: pressed chip, current sort and Apply background (else `--uva-brand-blue`). |
1153
+ | `--uva-color-on-accent` | | Dark-mode role token: pressed chip, current sort and Apply text (else #fff). |
1154
+ | `--uva-color-text-muted` | | Dark-mode role token: the match text, selected count, search status and staged note (else #4f4f4f). |
1155
+ | `--uva-color-input-text` | | Dark-mode role token: search field text (else #1f2937). |
1029
1156
  | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
1030
1157
 
1031
1158
  ## `<uvalib-filter-drawer>`