@uvalib/web-components 1.2.0 → 1.4.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 (200) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +849 -47
  3. package/dist/analytics.d.ts +10 -0
  4. package/dist/analytics.js +9 -0
  5. package/dist/analytics.js.map +1 -0
  6. package/dist/base/UvalibElement.js +8 -5
  7. package/dist/base/UvalibElement.js.map +1 -1
  8. package/dist/base/analytics-state.d.ts +7 -0
  9. package/dist/base/analytics-state.js.map +1 -1
  10. package/dist/base/light-dom-styles.d.ts +13 -0
  11. package/dist/base/light-dom-styles.js +26 -0
  12. package/dist/base/light-dom-styles.js.map +1 -1
  13. package/dist/base/search-tracker.d.ts +57 -0
  14. package/dist/base/search-tracker.js +51 -0
  15. package/dist/base/search-tracker.js.map +1 -0
  16. package/dist/base.css +286 -14
  17. package/dist/base.d.ts +2 -0
  18. package/dist/base.js +1 -0
  19. package/dist/base.js.map +1 -1
  20. package/dist/components/site-analytics/SiteAnalytics.d.ts +20 -1
  21. package/dist/components/site-analytics/SiteAnalytics.js +93 -12
  22. package/dist/components/site-analytics/SiteAnalytics.js.map +1 -1
  23. package/dist/components/site-page/SitePage.d.ts +23 -0
  24. package/dist/components/site-page/SitePage.js +77 -0
  25. package/dist/components/site-page/SitePage.js.map +1 -1
  26. package/dist/components/uvalib-back-to-top/UvalibBackToTop.d.ts +58 -0
  27. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js +250 -0
  28. package/dist/components/uvalib-back-to-top/UvalibBackToTop.js.map +1 -0
  29. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts +1 -0
  30. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js +4 -0
  31. package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js.map +1 -0
  32. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.d.ts +14 -0
  33. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js +56 -4
  34. package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js.map +1 -1
  35. package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +25 -3
  36. package/dist/components/uvalib-chip-group/UvalibChipGroup.js +80 -10
  37. package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -1
  38. package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +212 -0
  39. package/dist/components/uvalib-combobox/UvalibCombobox.js +1088 -0
  40. package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -0
  41. package/dist/components/uvalib-combobox/uvalib-combobox.d.ts +1 -0
  42. package/dist/components/uvalib-combobox/uvalib-combobox.js +4 -0
  43. package/dist/components/uvalib-combobox/uvalib-combobox.js.map +1 -0
  44. package/dist/components/uvalib-contents/UvalibContents.d.ts +53 -0
  45. package/dist/components/uvalib-contents/UvalibContents.js +202 -3
  46. package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
  47. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +56 -17
  48. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +285 -81
  49. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -1
  50. package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +6 -0
  51. package/dist/components/uvalib-date-range/UvalibDateRange.js +23 -0
  52. package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -1
  53. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +113 -0
  54. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +589 -0
  55. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -0
  56. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.d.ts +1 -0
  57. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js +4 -0
  58. package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js.map +1 -0
  59. package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +138 -0
  60. package/dist/components/uvalib-image-regions/UvalibImageRegions.js +689 -0
  61. package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -0
  62. package/dist/components/uvalib-image-regions/regions.d.ts +57 -0
  63. package/dist/components/uvalib-image-regions/regions.js +117 -0
  64. package/dist/components/uvalib-image-regions/regions.js.map +1 -0
  65. package/dist/components/uvalib-image-regions/uvalib-image-regions.d.ts +1 -0
  66. package/dist/components/uvalib-image-regions/uvalib-image-regions.js +4 -0
  67. package/dist/components/uvalib-image-regions/uvalib-image-regions.js.map +1 -0
  68. package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +79 -0
  69. package/dist/components/uvalib-lightbox/UvalibLightbox.js +295 -16
  70. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  71. package/dist/components/uvalib-map/UvalibMap.d.ts +251 -0
  72. package/dist/components/uvalib-map/UvalibMap.js +1395 -0
  73. package/dist/components/uvalib-map/UvalibMap.js.map +1 -0
  74. package/dist/components/uvalib-map/uvalib-map.d.ts +1 -0
  75. package/dist/components/uvalib-map/uvalib-map.js +4 -0
  76. package/dist/components/uvalib-map/uvalib-map.js.map +1 -0
  77. package/dist/components/uvalib-metadata/UvalibMetadata.d.ts +39 -2
  78. package/dist/components/uvalib-metadata/UvalibMetadata.js +214 -8
  79. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  80. package/dist/components/uvalib-pager/UvalibPager.d.ts +22 -3
  81. package/dist/components/uvalib-pager/UvalibPager.js +42 -4
  82. package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
  83. package/dist/custom-elements.json +9641 -3131
  84. package/dist/index.d.ts +8 -0
  85. package/dist/index.js +5 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/pagefind.css +4 -0
  88. package/dist/styles/base.js +119 -0
  89. package/dist/styles/base.js.map +1 -1
  90. package/dist/styles/color-scheme.js +5 -0
  91. package/dist/styles/color-scheme.js.map +1 -1
  92. package/dist/styles/controls.js +6 -0
  93. package/dist/styles/controls.js.map +1 -1
  94. package/dist/styles/hidden.d.ts +2 -0
  95. package/dist/styles/hidden.js +51 -0
  96. package/dist/styles/hidden.js.map +1 -0
  97. package/dist/styles/message.d.ts +1 -0
  98. package/dist/styles/message.js +82 -0
  99. package/dist/styles/message.js.map +1 -0
  100. package/dist/styles/pagefind.js +4 -0
  101. package/dist/styles/pagefind.js.map +1 -1
  102. package/dist/styles/result-list.d.ts +1 -0
  103. package/dist/styles/result-list.js +111 -0
  104. package/dist/styles/result-list.js.map +1 -0
  105. package/dist/styles/results.js +0 -15
  106. package/dist/styles/results.js.map +1 -1
  107. package/dist/testing/index.d.ts +110 -0
  108. package/dist/testing/index.js +100 -0
  109. package/dist/testing/index.js.map +1 -0
  110. package/dist/testing/lighthouse-rules.d.ts +10 -0
  111. package/dist/testing/lighthouse-rules.js +44 -0
  112. package/dist/testing/lighthouse-rules.js.map +1 -0
  113. package/dist/tokens.css +5 -0
  114. package/dist-cdn/analytics.js +32 -0
  115. package/dist-cdn/analytics.js.map +1 -0
  116. package/dist-cdn/base.css +286 -14
  117. package/dist-cdn/bento-box.js +3 -3
  118. package/dist-cdn/chunks/{SiteAnalytics-Cm-FyhYS.js → SiteAnalytics-B9gu5aGO.js} +59 -30
  119. package/dist-cdn/chunks/SiteAnalytics-B9gu5aGO.js.map +1 -0
  120. package/dist-cdn/chunks/{UvalibElement-BnI-eRRR.js → UvalibElement-pGONDAwB.js} +108 -101
  121. package/dist-cdn/chunks/UvalibElement-pGONDAwB.js.map +1 -0
  122. package/dist-cdn/chunks/{accessible-GqhVn5_H.js → accessible-DJv7YOtS.js} +2 -2
  123. package/dist-cdn/chunks/{accessible-GqhVn5_H.js.map → accessible-DJv7YOtS.js.map} +1 -1
  124. package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js.map +1 -1
  125. package/dist-cdn/chunks/{base-p5pk0vb2.js → base-BI8h0Gf3.js} +121 -2
  126. package/dist-cdn/chunks/base-BI8h0Gf3.js.map +1 -0
  127. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js → library-weekly-hours-CrV3TlP5.js} +3 -3
  128. package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js.map → library-weekly-hours-CrV3TlP5.js.map} +1 -1
  129. package/dist-cdn/chunks/regions-B8ExwUGP.js +86 -0
  130. package/dist-cdn/chunks/regions-B8ExwUGP.js.map +1 -0
  131. package/dist-cdn/chunks/{repeat-CIFUYkyh.js → repeat-m5Zd_QeP.js} +2 -2
  132. package/dist-cdn/chunks/{repeat-CIFUYkyh.js.map → repeat-m5Zd_QeP.js.map} +1 -1
  133. package/dist-cdn/chunks/{site-header-BlOYvQg1.js → site-header-DYRMpdBj.js} +9 -4
  134. package/dist-cdn/chunks/{site-header-BlOYvQg1.js.map → site-header-DYRMpdBj.js.map} +1 -1
  135. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js → site-main-nav-DURrQMal.js} +3 -3
  136. package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js.map → site-main-nav-DURrQMal.js.map} +1 -1
  137. package/dist-cdn/chunks/{static-html-1mTAG6nS.js → static-html-C1rhtCHu.js} +2 -2
  138. package/dist-cdn/chunks/{static-html-1mTAG6nS.js.map → static-html-C1rhtCHu.js.map} +1 -1
  139. package/dist-cdn/custom-elements.json +9641 -3131
  140. package/dist-cdn/events-section.js +3 -3
  141. package/dist-cdn/library-hours-setup.js +2 -2
  142. package/dist-cdn/library-weekly-hours.js +1 -1
  143. package/dist-cdn/manifest.json +10 -2
  144. package/dist-cdn/pagefind.css +4 -0
  145. package/dist-cdn/site-alerts.js +4 -4
  146. package/dist-cdn/site-analytics.js +2 -2
  147. package/dist-cdn/site-footer.js +2 -2
  148. package/dist-cdn/site-header.js +1 -1
  149. package/dist-cdn/site-hours-section.js +4 -4
  150. package/dist-cdn/site-main-nav.js +1 -1
  151. package/dist-cdn/site-page.js +56 -11
  152. package/dist-cdn/site-page.js.map +1 -1
  153. package/dist-cdn/site-style.js +2 -2
  154. package/dist-cdn/skills/uvalib-web-components/SKILL.md +98 -13
  155. package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  156. package/dist-cdn/skills/uvalib-web-components/reference/components.md +302 -14
  157. package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +1 -1
  158. package/dist-cdn/tokens.css +5 -0
  159. package/dist-cdn/uvalib-analytics.js +2 -2
  160. package/dist-cdn/uvalib-back-to-top.js +156 -0
  161. package/dist-cdn/uvalib-back-to-top.js.map +1 -0
  162. package/dist-cdn/uvalib-breadcrumbs.js +31 -11
  163. package/dist-cdn/uvalib-breadcrumbs.js.map +1 -1
  164. package/dist-cdn/uvalib-card-grid.js +1 -1
  165. package/dist-cdn/uvalib-card.js +3 -3
  166. package/dist-cdn/uvalib-chip-group.js +53 -14
  167. package/dist-cdn/uvalib-chip-group.js.map +1 -1
  168. package/dist-cdn/uvalib-combobox.js +667 -0
  169. package/dist-cdn/uvalib-combobox.js.map +1 -0
  170. package/dist-cdn/uvalib-contents.js +100 -22
  171. package/dist-cdn/uvalib-contents.js.map +1 -1
  172. package/dist-cdn/uvalib-date-histogram.js +237 -127
  173. package/dist-cdn/uvalib-date-histogram.js.map +1 -1
  174. package/dist-cdn/uvalib-date-range.js +14 -2
  175. package/dist-cdn/uvalib-date-range.js.map +1 -1
  176. package/dist-cdn/uvalib-filter-drawer.js +355 -0
  177. package/dist-cdn/uvalib-filter-drawer.js.map +1 -0
  178. package/dist-cdn/uvalib-filter.js +3 -3
  179. package/dist-cdn/uvalib-image-regions.js +460 -0
  180. package/dist-cdn/uvalib-image-regions.js.map +1 -0
  181. package/dist-cdn/uvalib-lightbox.js +214 -59
  182. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  183. package/dist-cdn/uvalib-map.js +667 -0
  184. package/dist-cdn/uvalib-map.js.map +1 -0
  185. package/dist-cdn/uvalib-metadata.js +150 -24
  186. package/dist-cdn/uvalib-metadata.js.map +1 -1
  187. package/dist-cdn/uvalib-pager.js +29 -17
  188. package/dist-cdn/uvalib-pager.js.map +1 -1
  189. package/dist-cdn/uvalib-photo-grid.js +2 -2
  190. package/dist-cdn/uvalib-results-count.js +2 -2
  191. package/dist-cdn/uvalib-tabs.js +2 -2
  192. package/dist-cdn/uvalib-tag-list.js +2 -2
  193. package/package.json +43 -1
  194. package/skills/uvalib-web-components/SKILL.md +98 -13
  195. package/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
  196. package/skills/uvalib-web-components/reference/components.md +302 -14
  197. package/skills/uvalib-web-components/reference/snippets.md +1 -1
  198. package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js.map +0 -1
  199. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +0 -1
  200. package/dist-cdn/chunks/base-p5pk0vb2.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","structuralRules","shadowStructure","UvalibMetadata","nodes","root","sheet","node","kind","message","dl","key","cells","c","rows","row","label","clone","base","unsafe","el","size","a","span","doc","frag","dot","comma","v","download","A","items","value","own","rights","statement","info","more","text","p","source","changed","shownFrom"],"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}\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}\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\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}[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 * @tagname uvalib-metadata\n * @fires uvalib-analytics-event - For `<site-analytics>`: the Copy citation button, `['uvalib-metadata', 'copy-citation']`. 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 button's text and 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 dt {\n grid-column: 1;\n color: var(--uva-color-text-muted, #4b5563);\n font-weight: 700;\n }\n dd {\n grid-column: 2;\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 `,\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 @state() private childRows: Row[] = [];\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 row.values.push({ source: [...c.childNodes].map((n) => this.copy(n)), ...langDir(c) });\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 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 rows.push({ label, values: [{ content: value }] });\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 }\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 }\n return html`<dl>\n ${text('Creator', this.creator)}${text('Organization', this.organization)}\n ${this.rows.map(\n (r) =>\n html`<div class=\"row\">\n <dt lang=${r.lang ?? nothing} dir=${r.dir ?? nothing}>${r.label}</dt>\n ${r.values.map(\n (v) =>\n html`<dd lang=${v.lang ?? nothing} dir=${v.dir ?? nothing}>\n ${v.source ? this.nodesOf(v.source) : v.content}\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,GACF,OAAOA,EAAK,EAAE,CAAE,YAAY,MAAM,SAAS,OAAOA,EAAK,OAAO,sBAAsBA,EAAK;CAC7F;AAEF;AAGA,IAAaC,KAA8B,MACzC,GAAGC,EAAM,iFCCLC,IAAmB,qCACnBC,IAAY,KAMZC,KAAmB,MAAiB;IACtCT,EAAK;IACLA,EAAK,OAAOA,EAAK;IACjBA,EAAK;IACLA,EAAK,YAAYA,EAAK;GAEpBU,IAAkBlC,EAAUiC,EAAgB,OAAO,CAAC,GAiC7CE,IAAb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AAW,GAAM,CAAC,CAAA,GAAAgC,EAAA,WAAA,SAAA,KAAA,CAAA,GAE7BjC,EAAA,CAAAE,EAAM,CAAA,GAAA+B,EAAA,WAAA,aAAA,KAAA,CAAA,GAENjC,EAAA,CAAAE,EAAM,CAAA,GAAA+B,EAAA,WAAA,UAAA,KAAA,CAAA,GC3MT1B,EAAO,mBAAmB0B,CAAc"}
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 dt {\n grid-column: 1;\n color: var(--uva-color-text-muted, #4b5563);\n font-weight: 700;\n }\n dd {\n grid-column: 2;\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,GACF,OAAOA,EAAK,EAAE,CAAE,YAAY,MAAM,SAAS,OAAOA,EAAK,OAAO,sBAAsBA,EAAK;CAC7F;AAEF;AAGA,IAAaC,KAA8B,MACzC,GAAGC,EAAM,iFCWLC,IAAmB,qCACnBC,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A,GAGzBtC,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAqC,EAAA,WAAA,gBAAA,KAAA,CAAA,GAOzBtC,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAqC,EAAA,WAAA,UAAA,KAAA,CAAA,GAGzBtC,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAe,CAAC,CAAA,GAAAqC,EAAA,WAAA,eAAA,KAAA,CAAA,GAMpDtC,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAc,CAAC,CAAA,GAAAqC,EAAA,WAAA,cAAA,KAAA,CAAA,GAGnDtC,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAqC,EAAA,WAAA,YAAA,KAAA,CAAA,GAMzBtC,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAiB,CAAC,CAAA,GAAAqC,EAAA,WAAA,iBAAA,KAAA,CAAA,GAOtDtC,EAAA,CAAAC,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAAqC,EAAA,WAAA,SAAA,KAAA,CAAA,GAM7BtC,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAa,CAAC,CAAA,GAAAqC,EAAA,WAAA,aAAA,KAAA,CAAA,GAElDtC,EAAA,CAAAE,EAAM,CAAA,GAAAoC,EAAA,WAAA,aAAA,KAAA,CAAA,GAONtC,EAAA,CAAAE,EAAM,CAAA,GAAAoC,EAAA,WAAA,UAAA,KAAA,CAAA,GC9QT/B,EAAO,mBAAmB+B,CAAc"}
@@ -1,13 +1,13 @@
1
- import { a as e, f as t, l as n, m as r, n as i, o as a, p as o, r as s, t as c } from "./chunks/UvalibElement-BnI-eRRR.js";
1
+ import { a as e, f as t, l as n, m as r, n as i, o as a, p as o, r as s, t as c } from "./chunks/UvalibElement-pGONDAwB.js";
2
2
  import { a as l } from "./chunks/analytics-DTTihuBD.js";
3
- import { t as u } from "./chunks/accessible-GqhVn5_H.js";
3
+ import { t as u } from "./chunks/accessible-DJv7YOtS.js";
4
4
  // src/components/uvalib-pager/UvalibPager.ts
5
5
  var d = /* @__PURE__ */ new Set([
6
6
  "http:",
7
7
  "https:",
8
8
  "mailto:",
9
9
  "tel:"
10
- ]), f = "?page={page}", p = (e) => `
10
+ ]), f = "?page={page}", p = { fromAttribute: (e) => e !== null && e.trim().toLowerCase() !== "false" }, m = (e) => `
11
11
  ${e} { display: block; min-width: 0; max-width: 100%; }
12
12
  ${e} nav.sections {
13
13
  display: flex;
@@ -98,14 +98,14 @@ var d = /* @__PURE__ */ new Set([
98
98
  ${e} .uvalib-button { border: 2px solid ButtonText; }
99
99
  ${e} .uvalib-button:focus-visible { outline: 3px solid Highlight; }
100
100
  }
101
- `, m = o(p(":host")), h = class extends c {
101
+ `, h = o(m(":host")), g = class extends c {
102
102
  constructor(...e) {
103
- super(...e), this.warnedHref = !1, this.warnedBoth = !1, this.warnedPages = !1, this.warnedTemplate = !1, this.warnedLoad = !1, this.pendingCount = -1;
103
+ super(...e), this.warnedHref = !1, this.warnedBoth = !1, this.warnedPages = !1, this.warnedTemplate = !1, this.warnedLoad = !1, this.pendingCount = -1, this.buttonHadFocus = !1;
104
104
  }
105
105
  static {
106
106
  this.styles = [
107
107
  u,
108
- m,
108
+ h,
109
109
  t`
110
110
  a {
111
111
  color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
@@ -174,7 +174,7 @@ var d = /* @__PURE__ */ new Set([
174
174
  createRenderRoot() {
175
175
  let e = super.createRenderRoot();
176
176
  if (e instanceof ShadowRoot && this.noStyle) {
177
- let t = m.styleSheet;
177
+ let t = h.styleSheet;
178
178
  t && (e.adoptedStyleSheets = [t]);
179
179
  }
180
180
  return e;
@@ -182,7 +182,7 @@ var d = /* @__PURE__ */ new Set([
182
182
  connectedCallback() {
183
183
  if (super.connectedCallback(), this.lightDom && this.noStyle) {
184
184
  let e = this.getRootNode();
185
- s(`${this.localName}::structure`, o(p(this.localName)), {
185
+ s(`${this.localName}::structure`, o(m(this.localName)), {
186
186
  root: e instanceof ShadowRoot || e instanceof Document ? e : void 0,
187
187
  scope: !1
188
188
  });
@@ -217,7 +217,16 @@ var d = /* @__PURE__ */ new Set([
217
217
  return (this.prevHref ?? "").trim() !== "" || (this.nextHref ?? "").trim() !== "" || (this.prevLabel ?? "").trim() !== "" || (this.nextLabel ?? "").trim() !== "";
218
218
  }
219
219
  willUpdate() {
220
- this.loadMore ? (this.numbered || this.hasPrevNext()) && !this.warnedLoad && (this.warnedLoad = !0, console.warn(`${this.localName}: mode="load-more" is set, so previous/next and numbered pages are not shown.`)) : (this.hasAttribute("pages") && !this.numbered && !this.warnedPages && (this.warnedPages = !0, console.warn(`${this.localName}: pages must be a positive number to show numbered pages.`)), this.numbered && this.hasPrevNext() && !this.warnedBoth && (this.warnedBoth = !0, console.warn(`${this.localName}: pages is set, so numbered pages are shown and previous/next are ignored.`)), this.numbered && !this.template().includes("{page}") && !this.warnedTemplate && (this.warnedTemplate = !0, console.warn(`${this.localName}: href-template must contain {page}.`)));
220
+ this.buttonHadFocus = !!this.renderRoot?.querySelector?.(".more button")?.matches(":focus"), this.loadMore ? (this.numbered || this.hasPrevNext()) && !this.warnedLoad && (this.warnedLoad = !0, console.warn(`${this.localName}: mode="load-more" is set, so previous/next and numbered pages are not shown.`)) : (this.hasAttribute("pages") && !this.numbered && !this.warnedPages && (this.warnedPages = !0, console.warn(`${this.localName}: pages must be a positive number to show numbered pages.`)), this.numbered && this.hasPrevNext() && !this.warnedBoth && (this.warnedBoth = !0, console.warn(`${this.localName}: pages is set, so numbered pages are shown and previous/next are ignored.`)), this.numbered && !this.template().includes("{page}") && !this.warnedTemplate && (this.warnedTemplate = !0, console.warn(`${this.localName}: href-template must contain {page}.`)));
221
+ }
222
+ updated() {
223
+ if (!this.buttonHadFocus || (this.buttonHadFocus = !1, this.renderRoot.querySelector(".more button"))) return;
224
+ if (this.firstNew()) {
225
+ this.loaded();
226
+ return;
227
+ }
228
+ let e = this.renderRoot.querySelector(".more .status");
229
+ e && (e.tabIndex = -1, e.focus());
221
230
  }
222
231
  template() {
223
232
  return (this.hrefTemplate?.trim() ?? "") || f;
@@ -376,9 +385,9 @@ var d = /* @__PURE__ */ new Set([
376
385
  }));
377
386
  }
378
387
  renderLoadMore() {
379
- let e = this.count(this.shown), t = this.count(this.total), r = t > 0 && e >= t;
388
+ let e = this.count(this.shown), t = this.count(this.total), r = typeof this.hasMore == "boolean" ? !this.hasMore : t > 0 && e >= t;
380
389
  return n`<div class="more" role="group" aria-label=${this.navLabel}>
381
- <div class="status" role="status">Showing ${e} of ${t}</div>
390
+ <div class="status" role="status">Showing ${e}${t > 0 ? ` of ${t}` : ""}</div>
382
391
  ${r ? a : n`<button type="button" class="uvalib-button" @click=${this.onLoadMore}>
383
392
  Load more
384
393
  </button>`}
@@ -392,21 +401,24 @@ var d = /* @__PURE__ */ new Set([
392
401
  i([e({
393
402
  type: String,
394
403
  attribute: "prev-href"
395
- })], h.prototype, "prevHref", void 0), i([e({
404
+ })], g.prototype, "prevHref", void 0), i([e({
396
405
  type: String,
397
406
  attribute: "prev-label"
398
- })], h.prototype, "prevLabel", void 0), i([e({
407
+ })], g.prototype, "prevLabel", void 0), i([e({
399
408
  type: String,
400
409
  attribute: "next-href"
401
- })], h.prototype, "nextHref", void 0), i([e({
410
+ })], g.prototype, "nextHref", void 0), i([e({
402
411
  type: String,
403
412
  attribute: "next-label"
404
- })], h.prototype, "nextLabel", void 0), i([e({ type: String })], h.prototype, "mode", void 0), i([e({ type: Number })], h.prototype, "shown", void 0), i([e({ type: Number })], h.prototype, "total", void 0), i([e({
413
+ })], g.prototype, "nextLabel", void 0), i([e({ type: String })], g.prototype, "mode", void 0), i([e({ type: Number })], g.prototype, "shown", void 0), i([e({ type: Number })], g.prototype, "total", void 0), i([e({
414
+ attribute: "has-more",
415
+ converter: p
416
+ })], g.prototype, "hasMore", void 0), i([e({
405
417
  type: String,
406
418
  attribute: "for"
407
- })], h.prototype, "listFor", void 0), i([e({ type: Number })], h.prototype, "page", void 0), i([e({ type: Number })], h.prototype, "pages", void 0), i([e({
419
+ })], g.prototype, "listFor", void 0), i([e({ type: Number })], g.prototype, "page", void 0), i([e({ type: Number })], g.prototype, "pages", void 0), i([e({
408
420
  type: String,
409
421
  attribute: "href-template"
410
- })], h.prototype, "hrefTemplate", void 0), i([e({ type: String })], h.prototype, "label", void 0), r("uvalib-pager", h);
422
+ })], g.prototype, "hrefTemplate", void 0), i([e({ type: String })], g.prototype, "label", void 0), r("uvalib-pager", g);
411
423
 
412
424
  //# sourceMappingURL=uvalib-pager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uvalib-pager.js","names":["unsafeCSS","nothing","_decorate","property","n","i","b","define","__decorate","A","r","installLightDomStyles","UvalibElement","trackEvent","accessible","SAFE_SCHEMES","DEFAULT_TEMPLATE","structuralRules","host","shadowStructure","UvalibPager","_args","root","sheet","node","total","value","ok","href","raw","template","current","set","nums","a","out","kind","page","detail","go","item","kicker","title","label","prev","next","id","found","list","ul","el","roots","slot","inner","given","firstNew","target","shown","done"],"sources":["../src/components/uvalib-pager/UvalibPager.ts","../src/components/uvalib-pager/uvalib-pager.ts"],"sourcesContent":["import { css, html, nothing, unsafeCSS } from 'lit';\nimport { property } 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 { accessible } from '../../styles/accessible.js';\n\n/** Schemes a pager may link to; anything else is shown as text, not a link. */\nconst SAFE_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nconst DEFAULT_TEMPLATE = '?page={page}';\n\n/**\n * Kept with `no-style`: the previous/next row, the truncation of a long section title (the\n * full text stays in the accessible name), the page list, the “Page ” prefix hidden\n * visually, and a target at least 24px. `host` is `:host` or the tag.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; min-width: 0; max-width: 100%; }\n ${host} nav.sections {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n align-items: stretch;\n gap: 1rem;\n }\n ${host} a.pager-prev, ${host} a.pager-next {\n display: inline-flex;\n flex-direction: column;\n justify-content: center;\n gap: 0.15rem;\n max-width: 48%;\n min-width: 0;\n min-height: 2.75rem;\n overflow: hidden;\n text-decoration: none;\n }\n ${host} a.pager-next { margin-inline-start: auto; text-align: end; align-items: flex-end; }\n ${host} .pager-title {\n display: block;\n max-width: 100%;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n ${host} ol {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n ${host} ol a, ${host} ol .page {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2.75rem;\n min-height: 2.75rem;\n padding: 0.25rem;\n box-sizing: border-box;\n text-decoration: none;\n }\n ${host} .more {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.75rem 1rem;\n min-width: 0;\n max-width: 100%;\n }\n ${host} .status { margin: 0; min-width: 0; overflow-wrap: anywhere; }\n ${host} .uvalib-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 44px;\n min-height: 44px;\n margin: 0;\n padding: 0.5rem 1.25rem;\n font: inherit;\n font-size: 1rem;\n line-height: 1.2;\n text-align: center;\n cursor: pointer;\n }\n ${host} .uvalib-button:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n @media (forced-colors: active) {\n ${host} .uvalib-button { border: 2px solid ButtonText; }\n ${host} .uvalib-button:focus-visible { outline: 3px solid Highlight; }\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\ntype Kind = 'next' | 'previous' | 'number';\ntype WindowItem = number | 'gap';\n\n/**\n * Previous/next section links, as on a reading page, or a numbered page list.\n *\n * Previous/next: set `prev-href` and `next-href` (either may be omitted). Each link shows\n * a “Previous” or “Next” kicker and, when `prev-label` or `next-label` is set, that title.\n * A visually hidden “: ” sits between them, so the accessible name is punctuated even\n * when CSS is off. A long title truncates visually; the full text stays in the accessible\n * name. The links use `rel=\"prev\"` and `rel=\"next\"`. With neither href, nothing is rendered.\n *\n * Numbered pages: set `pages` (a positive count). `page` is the current page, clamped to\n * `1…pages`. Each link’s href comes from `href-template`, which must contain `{page}`\n * (the default is `?page={page}`). The current page is text with `aria-current=\"page\"`,\n * not a link. Long ranges collapse to the first page, a window around the current page,\n * the last page, and an ellipsis where numbers are skipped. `pages` wins when previous/next\n * attributes are also set, with one console warning.\n *\n * Load more: `mode=\"load-more\"` shows a “Load more” button and “Showing N of M” (`shown`\n * of `total`). It wins over numbered pages and previous/next, with one warning when those\n * are also set. The button is not a link and the control is a group, not a navigation\n * landmark. The button hides once `shown` has reached a positive `total`. `page` is the\n * last loaded page (default 1). A click fires `load-more` with `{ page }` set to the next\n * page and reports `['uvalib-pager', 'load-more', '', page]`. Nothing is reported on\n * render. Call `loaded(firstNewElement)`, or set `for` to a list id and call `loaded()`,\n * and focus moves to that new item.\n *\n * The landmark’s accessible name is `label`, or “Sections” for previous/next and\n * “Pagination” for numbered pages. Load more uses `label` or “More results”. An empty\n * `label` uses that default. Two pagers on one page need different labels: a repeated\n * landmark name fails the accessibility check.\n *\n * @tagname uvalib-pager\n * @fires uvalib-analytics-event - For `<site-analytics>`: a primary-button click that was not already canceled, including a modified click, on a page link `['uvalib-pager', 'page-change', 'number', <n>]`, on a section link `['uvalib-pager', 'page-change', 'next'|'previous']`, or on Load more `['uvalib-pager', 'load-more', '', <next page>]`. Never the label or URL. Nothing on render. Bubbles and is composed.\n * @fires load-more - A primary click on Load more: `detail` is `{ page }` (the next page). Bubbles and is composed.\n * @fires uvalib-pager-navigate - A plain click on a pager link: `detail` is `{ href, kind, page? }` (`kind` is `'next'`, `'previous'` or `'number'`; `page` is set for `'number'`). Cancel it (`preventDefault()`) to route in the app; the click’s default is then prevented. Bubbles and is composed.\n * @cssprop --uva-color-link - Dark-mode role token: link colour (else `--uva-brand-blue`).\n * @cssprop --uva-color-text - Dark-mode role token: current page (else `--uva-grey-darkest`).\n * @cssprop --uva-color-text-muted - Dark-mode role token: the Previous/Next kicker (else #4f4f4f).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: current page background (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Text on the current page background (else #fff).\n * @cssprop --uva-color-button-bg - Load more background (else `--uva-blue-alt`).\n * @cssprop --uva-color-button-text - Load more text (else #fff). Dark mode’s own text is dark on the light button.\n * @cssprop --uva-color-button-hover-bg - Load more hover background (else `--uva-blue-alt-A`).\n */\nexport class UvalibPager extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n a {\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n a:hover .pager-title,\n a:hover {\n text-decoration: underline;\n }\n .pager-dir {\n color: var(--uva-color-text-muted, #4f4f4f);\n font-size: 0.75rem;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n }\n .page[aria-current='page'] {\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n color: var(--uva-color-on-accent, #fff);\n border-radius: 0.25rem;\n font-weight: 600;\n }\n .ellipsis {\n display: inline-flex;\n align-items: center;\n min-height: 2.75rem;\n padding-inline: 0.25rem;\n }\n .status {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n }\n .uvalib-button {\n border: 2px solid var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));\n border-radius: 5px;\n background: var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));\n color: var(--uva-color-button-text, #ffffff);\n }\n .uvalib-button:hover {\n border-color: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));\n background: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));\n }\n .uvalib-button:active {\n border-color: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n }\n @media (forced-colors: active) {\n .page[aria-current='page'] {\n background: CanvasText;\n color: Canvas;\n forced-color-adjust: none;\n }\n a {\n color: LinkText;\n }\n .uvalib-button {\n background: ButtonFace;\n color: ButtonText;\n border: 2px solid ButtonText;\n forced-color-adjust: none;\n }\n .uvalib-button:focus-visible {\n outline: 3px solid Highlight;\n }\n }\n `,\n ];\n\n /** Href of the previous section. Omitted, that side is not shown. */\n @property({ type: String, attribute: 'prev-href' }) prevHref?: string;\n\n /** Title of the previous section, under the “Previous” kicker. */\n @property({ type: String, attribute: 'prev-label' }) prevLabel?: string;\n\n /** Href of the next section. Omitted, that side is not shown. */\n @property({ type: String, attribute: 'next-href' }) nextHref?: string;\n\n /** Title of the next section, under the “Next” kicker. */\n @property({ type: String, attribute: 'next-label' }) nextLabel?: string;\n\n /**\n * `load-more` shows a Load more button instead of previous/next or numbered pages.\n * Any other value, including empty, leaves the pager in its other modes.\n */\n @property({ type: String }) mode?: string;\n\n /** How many results are already shown. Used by `mode=\"load-more\"` as N in “Showing N of M”. */\n @property({ type: Number }) shown?: number;\n\n /** How many results there are. Used by `mode=\"load-more\"` as M in “Showing N of M”. */\n @property({ type: Number }) total?: number;\n\n /**\n * Id of the list Load more appends to. `loaded()` focuses the first child added after\n * the click. Ignored when `loaded` is passed an element.\n */\n @property({ type: String, attribute: 'for' }) listFor?: string;\n\n /** Current page, from 1. Clamped to `pages`. Used when `pages` is set. In load-more, the last loaded page (default 1); a click asks for the next one. */\n @property({ type: Number }) page?: number;\n\n /**\n * How many pages. A positive number selects numbered pages and ignores previous/next.\n * Zero, negative or non-numeric does not.\n */\n @property({ type: Number }) pages?: number;\n\n /**\n * Href of each numbered page, with `{page}` where the number goes.\n * Default `?page={page}` when omitted. Without `{page}`, numbered links are not made.\n */\n @property({ type: String, attribute: 'href-template' }) hrefTemplate?: string;\n\n /**\n * Accessible name of the navigation landmark. Default “Pagination” for numbered pages\n * and “Sections” for previous/next. Empty uses that default. A second pager on the\n * page needs its own name.\n */\n @property({ type: String }) label?: string;\n\n private warnedHref = false;\n private warnedBoth = false;\n private warnedPages = false;\n private warnedTemplate = false;\n private warnedLoad = false;\n /** Child count of the `for` list at the last Load more click, or -1 when there was no list. */\n private pendingCount = -1;\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 /** Positive finite `pages` selects numbered mode. `Number(\"foo\")` from the attribute is not. */\n private get pageCount(): number {\n const n = Math.trunc(this.pages ?? Number.NaN);\n return Number.isFinite(n) && n > 0 ? n : 0;\n }\n\n private get numbered(): boolean {\n return this.pageCount > 0;\n }\n\n private get loadMore(): boolean {\n return (this.mode ?? '').trim().toLowerCase() === 'load-more';\n }\n\n private get currentPage(): number {\n const total = this.pageCount;\n const n = Math.trunc(this.page ?? 1);\n if (!Number.isFinite(n) || n < 1) return 1;\n return Math.min(n, Math.max(total, 1));\n }\n\n private get navLabel(): string {\n const text = this.label?.trim() ?? '';\n if (text) return text;\n if (this.loadMore) return 'More results';\n return this.numbered ? 'Pagination' : 'Sections';\n }\n\n /** A non-negative integer, or 0 when the value is missing or not a positive count. */\n private count(value: number | undefined): number {\n const n = Math.trunc(value ?? Number.NaN);\n return Number.isFinite(n) && n > 0 ? n : 0;\n }\n\n /** The page a Load more click asks for. `page` is the last loaded page and defaults to 1. */\n private nextPage(): number {\n const n = Math.trunc(this.page ?? Number.NaN);\n const current = Number.isFinite(n) && n >= 1 ? n : 1;\n return current + 1;\n }\n\n private hasPrevNext(): boolean {\n return (\n (this.prevHref ?? '').trim() !== '' ||\n (this.nextHref ?? '').trim() !== '' ||\n (this.prevLabel ?? '').trim() !== '' ||\n (this.nextLabel ?? '').trim() !== ''\n );\n }\n\n protected override willUpdate(): void {\n if (this.loadMore) {\n if ((this.numbered || this.hasPrevNext()) && !this.warnedLoad) {\n this.warnedLoad = true;\n console.warn(\n `${this.localName}: mode=\"load-more\" is set, so previous/next and numbered pages are not shown.`,\n );\n }\n return;\n }\n if (this.hasAttribute('pages') && !this.numbered && !this.warnedPages) {\n this.warnedPages = true;\n console.warn(`${this.localName}: pages must be a positive number to show numbered pages.`);\n }\n if (this.numbered && this.hasPrevNext() && !this.warnedBoth) {\n this.warnedBoth = true;\n console.warn(\n `${this.localName}: pages is set, so numbered pages are shown and previous/next are ignored.`,\n );\n }\n if (this.numbered && !this.template().includes('{page}') && !this.warnedTemplate) {\n this.warnedTemplate = true;\n console.warn(`${this.localName}: href-template must contain {page}.`);\n }\n }\n\n private template(): string {\n const raw = this.hrefTemplate?.trim() ?? '';\n return raw || DEFAULT_TEMPLATE;\n }\n\n private safe(href: string): boolean {\n let ok = false;\n try {\n ok = SAFE_SCHEMES.has(new URL(href, this.ownerDocument.baseURI).protocol);\n } catch {\n ok = false;\n }\n if (!ok && !this.warnedHref) {\n this.warnedHref = true;\n console.warn(\n `${this.localName}: not linking a page whose href is not http(s), mailto, tel or relative.`,\n );\n }\n return ok;\n }\n\n private sideHref(href: string | undefined): string | null {\n const raw = href?.trim() ?? '';\n if (!raw || !this.safe(raw)) return null;\n return raw;\n }\n\n private hrefFor(n: number): string | null {\n const template = this.template();\n if (!template.includes('{page}')) return null;\n const href = template.replaceAll('{page}', String(n));\n return this.safe(href) ? href : null;\n }\n\n /**\n * Pages to show. At most seven steps stay whole. Otherwise: the first, the last, and a\n * window around the current page (pages 1–4 when near the start, the last four when near\n * the end), with a gap wherever numbers are skipped.\n */\n private window(): WindowItem[] {\n const total = this.pageCount;\n const current = this.currentPage;\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const set = new Set<number>([1, total, current - 1, current, current + 1]);\n if (current <= 3) for (let i = 1; i <= 4; i++) set.add(i);\n if (current >= total - 2) for (let i = total - 3; i <= total; i++) set.add(i);\n const nums = [...set].filter((n) => n >= 1 && n <= total).sort((a, b) => a - b);\n const out: WindowItem[] = [];\n for (let i = 0; i < nums.length; i++) {\n const n = nums[i]!;\n if (i > 0 && n - nums[i - 1]! > 1) out.push('gap');\n out.push(n);\n }\n return out;\n }\n\n /**\n * A plain primary-button click fires a cancelable `uvalib-pager-navigate`. A click that\n * was already canceled, or that is not the primary button, is ignored. Modified clicks\n * are tracked and do not fire the navigate event.\n */\n private onClick(e: MouseEvent): void {\n const node = e.target instanceof Node ? e.target : null;\n const el = node instanceof Element ? node : node?.parentElement;\n const a = el?.closest('a[href]');\n if (!(a instanceof HTMLAnchorElement) || !this.renderRoot.contains(a)) return;\n const kind = a.dataset.kind as Kind | undefined;\n if (kind !== 'next' && kind !== 'previous' && kind !== 'number') return;\n if (e.defaultPrevented || e.button !== 0) return;\n const page = kind === 'number' ? Number(a.dataset.page) : undefined;\n if (kind === 'number' && page !== undefined && Number.isFinite(page))\n trackEvent(this, ['uvalib-pager', 'page-change', 'number', page]);\n else trackEvent(this, ['uvalib-pager', 'page-change', kind]);\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n const detail: { href: string | null; kind: Kind; page?: number } = {\n href: a.getAttribute('href'),\n kind,\n };\n if (page !== undefined && Number.isFinite(page)) detail.page = page;\n const go = new CustomEvent('uvalib-pager-navigate', {\n detail,\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(go)) e.preventDefault();\n }\n\n private pageBits(n: number) {\n return html`<span class=\"visually-hidden\">Page </span>${n}`;\n }\n\n private renderNumbered() {\n const current = this.currentPage;\n return html`<nav class=\"pages\" aria-label=${this.navLabel} @click=${this.onClick}>\n <ol role=\"list\">\n ${this.window().map((item) =>\n item === 'gap'\n ? html`<li aria-hidden=\"true\"><span class=\"ellipsis\">…</span></li>`\n : html`<li role=\"listitem\">\n ${\n item === current\n ? html`<span class=\"page\" aria-current=\"page\">${this.pageBits(item)}</span>`\n : this.hrefFor(item)\n ? html`<a href=${this.hrefFor(item)!} data-kind=\"number\" data-page=${item}\n >${this.pageBits(item)}</a\n >`\n : html`<span class=\"page\">${this.pageBits(item)}</span>`\n }\n </li>`,\n )}\n </ol>\n </nav>`;\n }\n\n private renderSide(kind: 'previous' | 'next', href: string, label: string | undefined) {\n const kicker = kind === 'previous' ? 'Previous' : 'Next';\n const title = label?.trim() ?? '';\n const className = kind === 'previous' ? 'pager-prev' : 'pager-next';\n return html`<a\n class=${className}\n rel=${kind === 'previous' ? 'prev' : 'next'}\n href=${href}\n data-kind=${kind}\n >\n <span class=\"pager-dir\">${kicker}</span>\n ${\n title\n ? html`<span class=\"visually-hidden\">: </span><span class=\"pager-title\">${title}</span>`\n : nothing\n }\n </a>`;\n }\n\n private renderSections() {\n const prev = this.sideHref(this.prevHref);\n const next = this.sideHref(this.nextHref);\n if (!prev && !next) return nothing;\n return html`<nav class=\"sections\" aria-label=${this.navLabel} @click=${this.onClick}>\n ${prev ? this.renderSide('previous', prev, this.prevLabel) : nothing}\n ${next ? this.renderSide('next', next, this.nextLabel) : nothing}\n </nav>`;\n }\n\n private listEl(): HTMLElement | null {\n const id = (this.listFor ?? '').trim();\n if (!id) return null;\n const node = this.getRootNode();\n const root = node instanceof Document || node instanceof ShadowRoot ? node : null;\n const found = root?.getElementById(id) ?? this.ownerDocument.getElementById(id);\n return found instanceof HTMLElement ? found : null;\n }\n\n /** Cards in a grid live in its `<ul>`, not as host children once light DOM has placed them. */\n private entries(list: HTMLElement): HTMLElement[] {\n if (list.localName === 'uvalib-card-grid') {\n const ul = (list.shadowRoot ?? list).querySelector('ul');\n if (ul) return [...ul.children].filter((n): n is HTMLElement => n instanceof HTMLElement);\n }\n return [...list.children].filter((n): n is HTMLElement => n instanceof HTMLElement);\n }\n\n private firstNew(): HTMLElement | null {\n const list = this.listEl();\n if (!list || this.pendingCount < 0) return null;\n return this.entries(list)[this.pendingCount] ?? null;\n }\n\n private isDisabled(el: HTMLElement): boolean {\n return (\n (el instanceof HTMLButtonElement ||\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement) &&\n el.disabled\n );\n }\n\n private canFocus(el: HTMLElement): boolean {\n if (this.isDisabled(el)) return false;\n if (el.hasAttribute('tabindex')) return true;\n if (el instanceof HTMLAnchorElement) return el.hasAttribute('href');\n if (el instanceof HTMLButtonElement) return true;\n return (\n el.localName === 'summary' ||\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement\n );\n }\n\n /** A link or control inside a new list item, including one slotted into a card grid. */\n private focusIn(el: HTMLElement): HTMLElement | null {\n const roots: Element[] = [];\n const slot = el.querySelector('slot');\n if (slot) roots.push(...slot.assignedElements({ flatten: true }));\n else roots.push(el);\n for (const root of roots) {\n if (!(root instanceof HTMLElement)) continue;\n if (root !== el && this.canFocus(root)) return root;\n const inner = root.querySelector<HTMLElement>(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary',\n );\n if (inner && this.canFocus(inner)) return inner;\n }\n return null;\n }\n\n /**\n * Move focus to `firstNew`, or to the first item added to the `for` list since the\n * click. A card grid counts the items in its list. An element that cannot take focus\n * gets `tabindex=\"-1\"`. A disabled field is not treated as focusable. The target is\n * focused so its ring shows.\n */\n loaded(firstNew?: HTMLElement): void {\n const given = firstNew instanceof HTMLElement && firstNew.isConnected ? firstNew : null;\n let target = given ?? this.firstNew();\n if (!(target instanceof HTMLElement)) return;\n if (!given) target = this.focusIn(target) ?? target;\n if (this.isDisabled(target)) {\n target.tabIndex = -1;\n this.pendingCount = -1;\n return;\n }\n if (!this.canFocus(target)) target.tabIndex = -1;\n // lib.dom in this project has no focusVisible; the option is what draws the ring.\n target.focus({ focusVisible: true } as FocusOptions);\n this.pendingCount = -1;\n }\n\n private onLoadMore(e: MouseEvent): void {\n if (e.defaultPrevented || e.button !== 0) return;\n const page = this.nextPage();\n const list = this.listEl();\n this.pendingCount = list ? this.entries(list).length : -1;\n trackEvent(this, ['uvalib-pager', 'load-more', '', page]);\n this.dispatchEvent(\n new CustomEvent('load-more', { detail: { page }, bubbles: true, composed: true }),\n );\n }\n\n private renderLoadMore() {\n const shown = this.count(this.shown);\n const total = this.count(this.total);\n const done = total > 0 && shown >= total;\n return html`<div class=\"more\" role=\"group\" aria-label=${this.navLabel}>\n <div class=\"status\" role=\"status\">Showing ${shown} of ${total}</div>\n ${\n done\n ? nothing\n : html`<button type=\"button\" class=\"uvalib-button\" @click=${this.onLoadMore}>\n Load more\n </button>`\n }\n </div>`;\n }\n\n protected override render() {\n if (this.loadMore) return this.renderLoadMore();\n return this.numbered ? this.renderNumbered() : this.renderSections();\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibPager } from './UvalibPager.js';\n\ndefine('uvalib-pager', UvalibPager);\n"],"mappings":";;;;AAQA,IAAMe,oBAAe,IAAI,IAAI;CAAC;CAAS;CAAU;CAAW;AAAM,CAAC,GAE7DC,IAAmB,gBAOnBC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;;;;;;;IAOLA,EAAK,iBAAiBA,EAAK;;;;;;;;;;;IAW3BA,EAAK;IACLA,EAAK;;;;;;;;IAQLA,EAAK;;;;;;;;IAQLA,EAAK,SAASA,EAAK;;;;;;;;;;IAUnBA,EAAK;;;;;;;;IAQLA,E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"version":3,"file":"uvalib-pager.js","names":["unsafeCSS","nothing","_decorate","property","n","i","b","define","__decorate","A","r","installLightDomStyles","UvalibElement","trackEvent","accessible","SAFE_SCHEMES","DEFAULT_TEMPLATE","hasMoreConverter","value","structuralRules","host","shadowStructure","UvalibPager","_args","root","sheet","node","total","status","ok","href","raw","template","current","set","nums","a","out","kind","page","detail","go","item","kicker","title","label","prev","next","id","found","list","ul","el","roots","slot","inner","given","firstNew","target","shown","done"],"sources":["../src/components/uvalib-pager/UvalibPager.ts","../src/components/uvalib-pager/uvalib-pager.ts"],"sourcesContent":["import { css, html, nothing, unsafeCSS } from 'lit';\nimport { property } 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 { accessible } from '../../styles/accessible.js';\n\n/** Schemes a pager may link to; anything else is shown as text, not a link. */\nconst SAFE_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nconst DEFAULT_TEMPLATE = '?page={page}';\n\n/**\n * `has-more` is a boolean attribute that can also say no: present is true, and removing it\n * or `has-more=\"false\"` (what many templates print for a false value) is false.\n */\nconst hasMoreConverter = {\n fromAttribute: (value: string | null): boolean =>\n value !== null && value.trim().toLowerCase() !== 'false',\n};\n\n/**\n * Kept with `no-style`: the previous/next row, the truncation of a long section title (the\n * full text stays in the accessible name), the page list, the “Page ” prefix hidden\n * visually, and a target at least 24px. `host` is `:host` or the tag.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; min-width: 0; max-width: 100%; }\n ${host} nav.sections {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n align-items: stretch;\n gap: 1rem;\n }\n ${host} a.pager-prev, ${host} a.pager-next {\n display: inline-flex;\n flex-direction: column;\n justify-content: center;\n gap: 0.15rem;\n max-width: 48%;\n min-width: 0;\n min-height: 2.75rem;\n overflow: hidden;\n text-decoration: none;\n }\n ${host} a.pager-next { margin-inline-start: auto; text-align: end; align-items: flex-end; }\n ${host} .pager-title {\n display: block;\n max-width: 100%;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n ${host} ol {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n ${host} ol a, ${host} ol .page {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 2.75rem;\n min-height: 2.75rem;\n padding: 0.25rem;\n box-sizing: border-box;\n text-decoration: none;\n }\n ${host} .more {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.75rem 1rem;\n min-width: 0;\n max-width: 100%;\n }\n ${host} .status { margin: 0; min-width: 0; overflow-wrap: anywhere; }\n ${host} .uvalib-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-width: 44px;\n min-height: 44px;\n margin: 0;\n padding: 0.5rem 1.25rem;\n font: inherit;\n font-size: 1rem;\n line-height: 1.2;\n text-align: center;\n cursor: pointer;\n }\n ${host} .uvalib-button:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n @media (forced-colors: active) {\n ${host} .uvalib-button { border: 2px solid ButtonText; }\n ${host} .uvalib-button:focus-visible { outline: 3px solid Highlight; }\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\ntype Kind = 'next' | 'previous' | 'number';\ntype WindowItem = number | 'gap';\n\n/**\n * Previous/next section links, as on a reading page, or a numbered page list.\n *\n * Previous/next: set `prev-href` and `next-href` (either may be omitted). Each link shows\n * a “Previous” or “Next” kicker and, when `prev-label` or `next-label` is set, that title.\n * A visually hidden “: ” sits between them, so the accessible name is punctuated even\n * when CSS is off. A long title truncates visually; the full text stays in the accessible\n * name. The links use `rel=\"prev\"` and `rel=\"next\"`. With neither href, nothing is rendered.\n *\n * Numbered pages: set `pages` (a positive count). `page` is the current page, clamped to\n * `1…pages`. Each link’s href comes from `href-template`, which must contain `{page}`\n * (the default is `?page={page}`). The current page is text with `aria-current=\"page\"`,\n * not a link. Long ranges collapse to the first page, a window around the current page,\n * the last page, and an ellipsis where numbers are skipped. `pages` wins when previous/next\n * attributes are also set, with one console warning.\n *\n * Load more: `mode=\"load-more\"` shows a “Load more” button and “Showing N of M” (`shown`\n * of `total`), or “Showing N” when `total` is unset or 0 (ranked search often cannot know\n * it). It wins over numbered pages and previous/next, with one warning when those\n * are also set. The button is not a link and the control is a group, not a navigation\n * landmark. Once `has-more` has been set (the attribute, or the `hasMore` property), it\n * alone decides whether the button shows: present (or `hasMore = true`) shows it; removed,\n * `has-more=\"false\"` or `hasMore = false` hides it. Left unset, the button hides once\n * `shown` has reached a positive `total`, and stays with no total. `page` is the\n * last loaded page (default 1). A click fires `load-more` with `{ page }` set to the next\n * page and reports `['uvalib-pager', 'load-more', '', page]`. Nothing is reported on\n * render. Call `loaded(firstNewElement)`, or set `for` to a list id and call `loaded()`,\n * and focus moves to that new item.\n *\n * The landmark’s accessible name is `label`, or “Sections” for previous/next and\n * “Pagination” for numbered pages. Load more uses `label` or “More results”. An empty\n * `label` uses that default. Two pagers on one page need different labels: a repeated\n * landmark name fails the accessibility check.\n *\n * @tagname uvalib-pager\n * @fires uvalib-analytics-event - For `<site-analytics>`: a primary-button click that was not already canceled, including a modified click, on a page link `['uvalib-pager', 'page-change', 'number', <n>]`, on a section link `['uvalib-pager', 'page-change', 'next'|'previous']`, or on Load more `['uvalib-pager', 'load-more', '', <next page>]`. Never the label or URL. Nothing on render. Bubbles and is composed.\n * @fires load-more - A primary click on Load more: `detail` is `{ page }` (the next page). Bubbles and is composed.\n * @fires uvalib-pager-navigate - A plain click on a pager link: `detail` is `{ href, kind, page? }` (`kind` is `'next'`, `'previous'` or `'number'`; `page` is set for `'number'`). Cancel it (`preventDefault()`) to route in the app; the click’s default is then prevented. Bubbles and is composed.\n * @cssprop --uva-color-link - Dark-mode role token: link colour (else `--uva-brand-blue`).\n * @cssprop --uva-color-text - Dark-mode role token: current page (else `--uva-grey-darkest`).\n * @cssprop --uva-color-text-muted - Dark-mode role token: the Previous/Next kicker (else #4f4f4f).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: current page background (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Text on the current page background (else #fff).\n * @cssprop --uva-color-button-bg - Load more background (else `--uva-blue-alt`).\n * @cssprop --uva-color-button-text - Load more text (else #fff). Dark mode’s own text is dark on the light button.\n * @cssprop --uva-color-button-hover-bg - Load more hover background (else `--uva-blue-alt-A`).\n */\nexport class UvalibPager extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n a {\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n a:hover .pager-title,\n a:hover {\n text-decoration: underline;\n }\n .pager-dir {\n color: var(--uva-color-text-muted, #4f4f4f);\n font-size: 0.75rem;\n letter-spacing: 0.04em;\n text-transform: uppercase;\n }\n .page[aria-current='page'] {\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n color: var(--uva-color-on-accent, #fff);\n border-radius: 0.25rem;\n font-weight: 600;\n }\n .ellipsis {\n display: inline-flex;\n align-items: center;\n min-height: 2.75rem;\n padding-inline: 0.25rem;\n }\n .status {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n }\n .uvalib-button {\n border: 2px solid var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));\n border-radius: 5px;\n background: var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));\n color: var(--uva-color-button-text, #ffffff);\n }\n .uvalib-button:hover {\n border-color: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));\n background: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));\n }\n .uvalib-button:active {\n border-color: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n }\n @media (forced-colors: active) {\n .page[aria-current='page'] {\n background: CanvasText;\n color: Canvas;\n forced-color-adjust: none;\n }\n a {\n color: LinkText;\n }\n .uvalib-button {\n background: ButtonFace;\n color: ButtonText;\n border: 2px solid ButtonText;\n forced-color-adjust: none;\n }\n .uvalib-button:focus-visible {\n outline: 3px solid Highlight;\n }\n }\n `,\n ];\n\n /** Href of the previous section. Omitted, that side is not shown. */\n @property({ type: String, attribute: 'prev-href' }) prevHref?: string;\n\n /** Title of the previous section, under the “Previous” kicker. */\n @property({ type: String, attribute: 'prev-label' }) prevLabel?: string;\n\n /** Href of the next section. Omitted, that side is not shown. */\n @property({ type: String, attribute: 'next-href' }) nextHref?: string;\n\n /** Title of the next section, under the “Next” kicker. */\n @property({ type: String, attribute: 'next-label' }) nextLabel?: string;\n\n /**\n * `load-more` shows a Load more button instead of previous/next or numbered pages.\n * Any other value, including empty, leaves the pager in its other modes.\n */\n @property({ type: String }) mode?: string;\n\n /** How many results are already shown. Used by `mode=\"load-more\"` as N in “Showing N of M”. */\n @property({ type: Number }) shown?: number;\n\n /** How many results there are. Used by `mode=\"load-more\"` as M in “Showing N of M”. Unset or 0 (an unknown total), the count reads “Showing N”. */\n @property({ type: Number }) total?: number;\n\n /**\n * Whether `mode=\"load-more\"` has more to load, for when `total` is not known. Unset\n * (the default), the button follows `total`. Set, it decides: the attribute present\n * means true; removing it, `has-more=\"false\"` or `hasMore = false` means false.\n * `hasMore = undefined` returns to following `total`.\n */\n @property({ attribute: 'has-more', converter: hasMoreConverter }) hasMore?: boolean;\n\n /**\n * Id of the list Load more appends to. `loaded()` focuses the first child added after\n * the click. Ignored when `loaded` is passed an element.\n */\n @property({ type: String, attribute: 'for' }) listFor?: string;\n\n /** Current page, from 1. Clamped to `pages`. Used when `pages` is set. In load-more, the last loaded page (default 1); a click asks for the next one. */\n @property({ type: Number }) page?: number;\n\n /**\n * How many pages. A positive number selects numbered pages and ignores previous/next.\n * Zero, negative or non-numeric does not.\n */\n @property({ type: Number }) pages?: number;\n\n /**\n * Href of each numbered page, with `{page}` where the number goes.\n * Default `?page={page}` when omitted. Without `{page}`, numbered links are not made.\n */\n @property({ type: String, attribute: 'href-template' }) hrefTemplate?: string;\n\n /**\n * Accessible name of the navigation landmark. Default “Pagination” for numbered pages\n * and “Sections” for previous/next. Empty uses that default. A second pager on the\n * page needs its own name.\n */\n @property({ type: String }) label?: string;\n\n private warnedHref = false;\n private warnedBoth = false;\n private warnedPages = false;\n private warnedTemplate = false;\n private warnedLoad = false;\n /** Child count of the `for` list at the last Load more click, or -1 when there was no list. */\n private pendingCount = -1;\n /** Load more had focus just before this update. */\n private buttonHadFocus = false;\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 /** Positive finite `pages` selects numbered mode. `Number(\"foo\")` from the attribute is not. */\n private get pageCount(): number {\n const n = Math.trunc(this.pages ?? Number.NaN);\n return Number.isFinite(n) && n > 0 ? n : 0;\n }\n\n private get numbered(): boolean {\n return this.pageCount > 0;\n }\n\n private get loadMore(): boolean {\n return (this.mode ?? '').trim().toLowerCase() === 'load-more';\n }\n\n private get currentPage(): number {\n const total = this.pageCount;\n const n = Math.trunc(this.page ?? 1);\n if (!Number.isFinite(n) || n < 1) return 1;\n return Math.min(n, Math.max(total, 1));\n }\n\n private get navLabel(): string {\n const text = this.label?.trim() ?? '';\n if (text) return text;\n if (this.loadMore) return 'More results';\n return this.numbered ? 'Pagination' : 'Sections';\n }\n\n /** A non-negative integer, or 0 when the value is missing or not a positive count. */\n private count(value: number | undefined): number {\n const n = Math.trunc(value ?? Number.NaN);\n return Number.isFinite(n) && n > 0 ? n : 0;\n }\n\n /** The page a Load more click asks for. `page` is the last loaded page and defaults to 1. */\n private nextPage(): number {\n const n = Math.trunc(this.page ?? Number.NaN);\n const current = Number.isFinite(n) && n >= 1 ? n : 1;\n return current + 1;\n }\n\n private hasPrevNext(): boolean {\n return (\n (this.prevHref ?? '').trim() !== '' ||\n (this.nextHref ?? '').trim() !== '' ||\n (this.prevLabel ?? '').trim() !== '' ||\n (this.nextLabel ?? '').trim() !== ''\n );\n }\n\n protected override willUpdate(): void {\n this.buttonHadFocus = !!this.renderRoot?.querySelector?.('.more button')?.matches(':focus');\n if (this.loadMore) {\n if ((this.numbered || this.hasPrevNext()) && !this.warnedLoad) {\n this.warnedLoad = true;\n console.warn(\n `${this.localName}: mode=\"load-more\" is set, so previous/next and numbered pages are not shown.`,\n );\n }\n return;\n }\n if (this.hasAttribute('pages') && !this.numbered && !this.warnedPages) {\n this.warnedPages = true;\n console.warn(`${this.localName}: pages must be a positive number to show numbered pages.`);\n }\n if (this.numbered && this.hasPrevNext() && !this.warnedBoth) {\n this.warnedBoth = true;\n console.warn(\n `${this.localName}: pages is set, so numbered pages are shown and previous/next are ignored.`,\n );\n }\n if (this.numbered && !this.template().includes('{page}') && !this.warnedTemplate) {\n this.warnedTemplate = true;\n console.warn(`${this.localName}: href-template must contain {page}.`);\n }\n }\n\n /**\n * When Load more goes away while it has focus (the last page came in and `loaded()` was\n * not called first), focus would fall to the page. Move it to the first new item of the\n * `for` list, or else to the count.\n */\n protected override updated(): void {\n if (!this.buttonHadFocus) return;\n this.buttonHadFocus = false;\n if (this.renderRoot.querySelector('.more button')) return;\n if (this.firstNew()) {\n this.loaded();\n return;\n }\n const status = this.renderRoot.querySelector<HTMLElement>('.more .status');\n if (!status) return;\n status.tabIndex = -1;\n status.focus();\n }\n\n private template(): string {\n const raw = this.hrefTemplate?.trim() ?? '';\n return raw || DEFAULT_TEMPLATE;\n }\n\n private safe(href: string): boolean {\n let ok = false;\n try {\n ok = SAFE_SCHEMES.has(new URL(href, this.ownerDocument.baseURI).protocol);\n } catch {\n ok = false;\n }\n if (!ok && !this.warnedHref) {\n this.warnedHref = true;\n console.warn(\n `${this.localName}: not linking a page whose href is not http(s), mailto, tel or relative.`,\n );\n }\n return ok;\n }\n\n private sideHref(href: string | undefined): string | null {\n const raw = href?.trim() ?? '';\n if (!raw || !this.safe(raw)) return null;\n return raw;\n }\n\n private hrefFor(n: number): string | null {\n const template = this.template();\n if (!template.includes('{page}')) return null;\n const href = template.replaceAll('{page}', String(n));\n return this.safe(href) ? href : null;\n }\n\n /**\n * Pages to show. At most seven steps stay whole. Otherwise: the first, the last, and a\n * window around the current page (pages 1–4 when near the start, the last four when near\n * the end), with a gap wherever numbers are skipped.\n */\n private window(): WindowItem[] {\n const total = this.pageCount;\n const current = this.currentPage;\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const set = new Set<number>([1, total, current - 1, current, current + 1]);\n if (current <= 3) for (let i = 1; i <= 4; i++) set.add(i);\n if (current >= total - 2) for (let i = total - 3; i <= total; i++) set.add(i);\n const nums = [...set].filter((n) => n >= 1 && n <= total).sort((a, b) => a - b);\n const out: WindowItem[] = [];\n for (let i = 0; i < nums.length; i++) {\n const n = nums[i]!;\n if (i > 0 && n - nums[i - 1]! > 1) out.push('gap');\n out.push(n);\n }\n return out;\n }\n\n /**\n * A plain primary-button click fires a cancelable `uvalib-pager-navigate`. A click that\n * was already canceled, or that is not the primary button, is ignored. Modified clicks\n * are tracked and do not fire the navigate event.\n */\n private onClick(e: MouseEvent): void {\n const node = e.target instanceof Node ? e.target : null;\n const el = node instanceof Element ? node : node?.parentElement;\n const a = el?.closest('a[href]');\n if (!(a instanceof HTMLAnchorElement) || !this.renderRoot.contains(a)) return;\n const kind = a.dataset.kind as Kind | undefined;\n if (kind !== 'next' && kind !== 'previous' && kind !== 'number') return;\n if (e.defaultPrevented || e.button !== 0) return;\n const page = kind === 'number' ? Number(a.dataset.page) : undefined;\n if (kind === 'number' && page !== undefined && Number.isFinite(page))\n trackEvent(this, ['uvalib-pager', 'page-change', 'number', page]);\n else trackEvent(this, ['uvalib-pager', 'page-change', kind]);\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n const detail: { href: string | null; kind: Kind; page?: number } = {\n href: a.getAttribute('href'),\n kind,\n };\n if (page !== undefined && Number.isFinite(page)) detail.page = page;\n const go = new CustomEvent('uvalib-pager-navigate', {\n detail,\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(go)) e.preventDefault();\n }\n\n private pageBits(n: number) {\n return html`<span class=\"visually-hidden\">Page </span>${n}`;\n }\n\n private renderNumbered() {\n const current = this.currentPage;\n return html`<nav class=\"pages\" aria-label=${this.navLabel} @click=${this.onClick}>\n <ol role=\"list\">\n ${this.window().map((item) =>\n item === 'gap'\n ? html`<li aria-hidden=\"true\"><span class=\"ellipsis\">…</span></li>`\n : html`<li role=\"listitem\">\n ${\n item === current\n ? html`<span class=\"page\" aria-current=\"page\">${this.pageBits(item)}</span>`\n : this.hrefFor(item)\n ? html`<a href=${this.hrefFor(item)!} data-kind=\"number\" data-page=${item}\n >${this.pageBits(item)}</a\n >`\n : html`<span class=\"page\">${this.pageBits(item)}</span>`\n }\n </li>`,\n )}\n </ol>\n </nav>`;\n }\n\n private renderSide(kind: 'previous' | 'next', href: string, label: string | undefined) {\n const kicker = kind === 'previous' ? 'Previous' : 'Next';\n const title = label?.trim() ?? '';\n const className = kind === 'previous' ? 'pager-prev' : 'pager-next';\n return html`<a\n class=${className}\n rel=${kind === 'previous' ? 'prev' : 'next'}\n href=${href}\n data-kind=${kind}\n >\n <span class=\"pager-dir\">${kicker}</span>\n ${\n title\n ? html`<span class=\"visually-hidden\">: </span><span class=\"pager-title\">${title}</span>`\n : nothing\n }\n </a>`;\n }\n\n private renderSections() {\n const prev = this.sideHref(this.prevHref);\n const next = this.sideHref(this.nextHref);\n if (!prev && !next) return nothing;\n return html`<nav class=\"sections\" aria-label=${this.navLabel} @click=${this.onClick}>\n ${prev ? this.renderSide('previous', prev, this.prevLabel) : nothing}\n ${next ? this.renderSide('next', next, this.nextLabel) : nothing}\n </nav>`;\n }\n\n private listEl(): HTMLElement | null {\n const id = (this.listFor ?? '').trim();\n if (!id) return null;\n const node = this.getRootNode();\n const root = node instanceof Document || node instanceof ShadowRoot ? node : null;\n const found = root?.getElementById(id) ?? this.ownerDocument.getElementById(id);\n return found instanceof HTMLElement ? found : null;\n }\n\n /** Cards in a grid live in its `<ul>`, not as host children once light DOM has placed them. */\n private entries(list: HTMLElement): HTMLElement[] {\n if (list.localName === 'uvalib-card-grid') {\n const ul = (list.shadowRoot ?? list).querySelector('ul');\n if (ul) return [...ul.children].filter((n): n is HTMLElement => n instanceof HTMLElement);\n }\n return [...list.children].filter((n): n is HTMLElement => n instanceof HTMLElement);\n }\n\n private firstNew(): HTMLElement | null {\n const list = this.listEl();\n if (!list || this.pendingCount < 0) return null;\n return this.entries(list)[this.pendingCount] ?? null;\n }\n\n private isDisabled(el: HTMLElement): boolean {\n return (\n (el instanceof HTMLButtonElement ||\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement) &&\n el.disabled\n );\n }\n\n private canFocus(el: HTMLElement): boolean {\n if (this.isDisabled(el)) return false;\n if (el.hasAttribute('tabindex')) return true;\n if (el instanceof HTMLAnchorElement) return el.hasAttribute('href');\n if (el instanceof HTMLButtonElement) return true;\n return (\n el.localName === 'summary' ||\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement\n );\n }\n\n /** A link or control inside a new list item, including one slotted into a card grid. */\n private focusIn(el: HTMLElement): HTMLElement | null {\n const roots: Element[] = [];\n const slot = el.querySelector('slot');\n if (slot) roots.push(...slot.assignedElements({ flatten: true }));\n else roots.push(el);\n for (const root of roots) {\n if (!(root instanceof HTMLElement)) continue;\n if (root !== el && this.canFocus(root)) return root;\n const inner = root.querySelector<HTMLElement>(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), summary',\n );\n if (inner && this.canFocus(inner)) return inner;\n }\n return null;\n }\n\n /**\n * Move focus to `firstNew`, or to the first item added to the `for` list since the\n * click. A card grid counts the items in its list. An element that cannot take focus\n * gets `tabindex=\"-1\"`. A disabled field is not treated as focusable. The target is\n * focused so its ring shows.\n */\n loaded(firstNew?: HTMLElement): void {\n const given = firstNew instanceof HTMLElement && firstNew.isConnected ? firstNew : null;\n let target = given ?? this.firstNew();\n if (!(target instanceof HTMLElement)) return;\n if (!given) target = this.focusIn(target) ?? target;\n if (this.isDisabled(target)) {\n target.tabIndex = -1;\n this.pendingCount = -1;\n return;\n }\n if (!this.canFocus(target)) target.tabIndex = -1;\n // lib.dom in this project has no focusVisible; the option is what draws the ring.\n target.focus({ focusVisible: true } as FocusOptions);\n this.pendingCount = -1;\n }\n\n private onLoadMore(e: MouseEvent): void {\n if (e.defaultPrevented || e.button !== 0) return;\n const page = this.nextPage();\n const list = this.listEl();\n this.pendingCount = list ? this.entries(list).length : -1;\n trackEvent(this, ['uvalib-pager', 'load-more', '', page]);\n this.dispatchEvent(\n new CustomEvent('load-more', { detail: { page }, bubbles: true, composed: true }),\n );\n }\n\n private renderLoadMore() {\n const shown = this.count(this.shown);\n const total = this.count(this.total);\n const done = typeof this.hasMore === 'boolean' ? !this.hasMore : total > 0 && shown >= total;\n return html`<div class=\"more\" role=\"group\" aria-label=${this.navLabel}>\n <div class=\"status\" role=\"status\">Showing ${shown}${total > 0 ? ` of ${total}` : ''}</div>\n ${\n done\n ? nothing\n : html`<button type=\"button\" class=\"uvalib-button\" @click=${this.onLoadMore}>\n Load more\n </button>`\n }\n </div>`;\n }\n\n protected override render() {\n if (this.loadMore) return this.renderLoadMore();\n return this.numbered ? this.renderNumbered() : this.renderSections();\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibPager } from './UvalibPager.js';\n\ndefine('uvalib-pager', UvalibPager);\n"],"mappings":";;;;AAQA,IAAMe,oBAAe,IAAI,IAAI;CAAC;CAAS;CAAU;CAAW;AAAM,CAAC,GAE7DC,IAAmB,gBAMnBC,IAAmB,EACvB,gBAAgB,MACdC,MAAU,QAAQA,EAAM,KAAK,CAAC,CAAC,YAAY,MAAM,QACrD,GAOMC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;;;;;;;IAOLA,EAAK,iBAAiBA,EAAK;;;;;;;;;;;IAW3BA,EAAK;IACLA,EAAK;;;;;;;;IAQLA,EAAK;;;;;;;;IAQLA,EAAK,SAASA,EAAK;;;;;;;;;;IAUnBA,EAAK;;;;;;;;IAQLA,EAAK;IACLA,EAAK;;;;;;;;;;;;;;;IAeLA,EAAK;;;;IAILA,EAAK;;;;;;;;;;;IAWLA,EAAK,YAAYA,EAAK;;MAEpBA,EAAK;MACLA,EAAK;;GAGLC,IAAkBrB,EAAUmB,EAAgB,OAAO,CAAC,GAqD7CG,IAAb,cAAiCV,EAAc;;EAyIpB,A,aARJ,KAAA,aAAA,IACA,KAAA,aAAA,IACC,KAAA,cAAA,IACG,KAAA,iBAAA,IACJ,KAAA,aAAA,IAEE,KAAA,eAAA,IAEE,KAAA,iBAAA;;;EAxIT,KAAA,SAAA;GACdE;GACAO;GACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DL;;CAwEA,mBAAsE;EACpE,IAAMG,IAAO,MAAM,iBAAiB;EACpC,IAAIA,aAAgB,cAAc,KAAK,SAAS;GAC9C,IAAMC,IAAQJ,EAAgB;GAC9B,AAA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-BnI-eRRR.js";
2
- import { t as s } from "./chunks/accessible-GqhVn5_H.js";
1
+ import { a as e, l as t, m as n, n as r, p as i, r as a, t as o } from "./chunks/UvalibElement-pGONDAwB.js";
2
+ import { t as s } from "./chunks/accessible-DJv7YOtS.js";
3
3
  // src/components/uvalib-photo-grid/UvalibPhotoGrid.ts
4
4
  var c = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), l = (e) => `
5
5
  ${e} {
@@ -1,5 +1,5 @@
1
- import { a as e, f as t, i as n, l as r, m as i, n as a, p as o, r as s, t as c } from "./chunks/UvalibElement-BnI-eRRR.js";
2
- import { t as l } from "./chunks/accessible-GqhVn5_H.js";
1
+ import { a as e, f as t, i as n, l as r, m as i, n as a, p as o, r as s, t as c } from "./chunks/UvalibElement-pGONDAwB.js";
2
+ import { t as l } from "./chunks/accessible-DJv7YOtS.js";
3
3
  var u = 5e3, d = (e) => e.toLocaleString("en-US"), f = (e) => {
4
4
  let t = typeof e == "number" ? e : NaN;
5
5
  return Number.isFinite(t) && t >= 0 ? Math.trunc(t) : void 0;
@@ -1,6 +1,6 @@
1
- import { a as e, f as t, l as n, m as r, n as i, p as a, r as o, t as s } from "./chunks/UvalibElement-BnI-eRRR.js";
1
+ import { a as e, f as t, l as n, m as r, n as i, p as a, r as o, t as s } from "./chunks/UvalibElement-pGONDAwB.js";
2
2
  import { a as c } from "./chunks/analytics-DTTihuBD.js";
3
- import { t as l } from "./chunks/accessible-GqhVn5_H.js";
3
+ import { t as l } from "./chunks/accessible-DJv7YOtS.js";
4
4
  // src/components/uvalib-tabs/UvalibTabs.ts
5
5
  var u = (e) => `
6
6
  ${e} { display: block; min-width: 0; max-width: 100%; }
@@ -1,8 +1,8 @@
1
- import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./chunks/UvalibElement-BnI-eRRR.js";
1
+ import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./chunks/UvalibElement-pGONDAwB.js";
2
2
  import { a as u } from "./chunks/analytics-DTTihuBD.js";
3
3
  import { n as d, t as f } from "./chunks/inline-copy-BANQSMIR.js";
4
4
  import { n as p, r as m, t as h } from "./chunks/source-children-BHsDwCvL.js";
5
- import { t as g } from "./chunks/accessible-GqhVn5_H.js";
5
+ import { t as g } from "./chunks/accessible-DJv7YOtS.js";
6
6
  // src/components/uvalib-tag-list/UvalibTagList.ts
7
7
  var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e) => e?.trim() || void 0, y = (e) => `
8
8
  ${e} { display: block; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uvalib/web-components",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "UVA Library reusable web components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,6 +35,14 @@
35
35
  "types": "./dist/base.d.ts",
36
36
  "default": "./dist/base.js"
37
37
  },
38
+ "./analytics.js": {
39
+ "types": "./dist/analytics.d.ts",
40
+ "default": "./dist/analytics.js"
41
+ },
42
+ "./testing": {
43
+ "types": "./dist/testing/index.d.ts",
44
+ "default": "./dist/testing/index.js"
45
+ },
38
46
  "./site-page.js": {
39
47
  "types": "./dist/components/site-page/site-page.d.ts",
40
48
  "default": "./dist/components/site-page/site-page.js"
@@ -151,6 +159,26 @@
151
159
  "types": "./dist/components/uvalib-tabs/uvalib-tabs.d.ts",
152
160
  "default": "./dist/components/uvalib-tabs/uvalib-tabs.js"
153
161
  },
162
+ "./uvalib-combobox.js": {
163
+ "types": "./dist/components/uvalib-combobox/uvalib-combobox.d.ts",
164
+ "default": "./dist/components/uvalib-combobox/uvalib-combobox.js"
165
+ },
166
+ "./uvalib-image-regions.js": {
167
+ "types": "./dist/components/uvalib-image-regions/uvalib-image-regions.d.ts",
168
+ "default": "./dist/components/uvalib-image-regions/uvalib-image-regions.js"
169
+ },
170
+ "./uvalib-map.js": {
171
+ "types": "./dist/components/uvalib-map/uvalib-map.d.ts",
172
+ "default": "./dist/components/uvalib-map/uvalib-map.js"
173
+ },
174
+ "./uvalib-filter-drawer.js": {
175
+ "types": "./dist/components/uvalib-filter-drawer/uvalib-filter-drawer.d.ts",
176
+ "default": "./dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js"
177
+ },
178
+ "./uvalib-back-to-top.js": {
179
+ "types": "./dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts",
180
+ "default": "./dist/components/uvalib-back-to-top/uvalib-back-to-top.js"
181
+ },
154
182
  "./tokens.css": "./dist/tokens.css",
155
183
  "./base.css": "./dist/base.css",
156
184
  "./pagefind.css": "./dist/pagefind.css",
@@ -193,10 +221,23 @@
193
221
  "dependencies": {
194
222
  "lit": "^3.2.0"
195
223
  },
224
+ "peerDependencies": {
225
+ "@axe-core/playwright": "^4.10.0",
226
+ "leaflet": "^1.9.4"
227
+ },
228
+ "peerDependenciesMeta": {
229
+ "@axe-core/playwright": {
230
+ "optional": true
231
+ },
232
+ "leaflet": {
233
+ "optional": true
234
+ }
235
+ },
196
236
  "devDependencies": {
197
237
  "@custom-elements-manifest/analyzer": "^0.11.0",
198
238
  "@lhci/cli": "0.15.1",
199
239
  "@open-wc/testing": "^5.0.0",
240
+ "@types/leaflet": "^1.9.22",
200
241
  "@types/mocha": "^10.0.10",
201
242
  "@web/dev-server-esbuild": "^2.0.1",
202
243
  "@web/test-runner": "^1.0.1",
@@ -204,6 +245,7 @@
204
245
  "@web/test-runner-playwright": "^1.0.1",
205
246
  "axe-core": "^4.14.0",
206
247
  "eslint": "^10.14.0",
248
+ "leaflet": "^1.9.4",
207
249
  "pagefind": "1.5.2",
208
250
  "pixelmatch": "^8.0.0",
209
251
  "playground-elements": "^0.21.2",