@uvalib/web-components 1.7.0 → 1.8.3

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 (140) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +60 -15
  3. package/dist/base/states.d.ts +12 -0
  4. package/dist/base/states.js +33 -0
  5. package/dist/base/states.js.map +1 -0
  6. package/dist/base.css +69 -6
  7. package/dist/components/bento-box/BentoBox.js +1 -0
  8. package/dist/components/bento-box/BentoBox.js.map +1 -1
  9. package/dist/components/events-section/EventsSection.js +1 -0
  10. package/dist/components/events-section/EventsSection.js.map +1 -1
  11. package/dist/components/library-hours/hours-data.js +1 -1
  12. package/dist/components/library-hours/hours-data.js.map +1 -1
  13. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +1 -0
  14. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -1
  15. package/dist/components/site-main-nav/SiteMainNav.d.ts +1 -1
  16. package/dist/components/site-main-nav/SiteMainNav.js +9 -2
  17. package/dist/components/site-main-nav/SiteMainNav.js.map +1 -1
  18. package/dist/components/site-page/SitePage.d.ts +1 -1
  19. package/dist/components/site-page/SitePage.js +3 -2
  20. package/dist/components/site-page/SitePage.js.map +1 -1
  21. package/dist/components/site-style/SiteStyle.d.ts +1 -1
  22. package/dist/components/site-style/SiteStyle.js +3 -2
  23. package/dist/components/site-style/SiteStyle.js.map +1 -1
  24. package/dist/components/uvalib-card/UvalibCard.js +6 -0
  25. package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
  26. package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +27 -0
  27. package/dist/components/uvalib-combobox/UvalibCombobox.js +85 -1
  28. package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -1
  29. package/dist/components/uvalib-contents/UvalibContents.js +5 -0
  30. package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
  31. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +6 -0
  32. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +10 -0
  33. package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -1
  34. package/dist/components/uvalib-image-regions/UvalibImageRegions.js +2 -0
  35. package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -1
  36. package/dist/components/uvalib-image-regions/regions.d.ts +6 -2
  37. package/dist/components/uvalib-image-regions/regions.js +6 -3
  38. package/dist/components/uvalib-image-regions/regions.js.map +1 -1
  39. package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +9 -2
  40. package/dist/components/uvalib-lightbox/UvalibLightbox.js +23 -3
  41. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  42. package/dist/components/uvalib-lightbox/compare.d.ts +30 -3
  43. package/dist/components/uvalib-lightbox/compare.js +98 -29
  44. package/dist/components/uvalib-lightbox/compare.js.map +1 -1
  45. package/dist/components/uvalib-map/UvalibMap.js +2 -2
  46. package/dist/components/uvalib-map/UvalibMap.js.map +1 -1
  47. package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -0
  48. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  49. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +3 -1
  50. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
  51. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +3 -3
  52. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +16 -8
  53. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
  54. package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +4 -1
  55. package/dist/components/uvalib-tag-list/UvalibTagList.js +9 -2
  56. package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -1
  57. package/dist/custom-elements.json +1992 -1681
  58. package/dist/pagefind.css +8 -1
  59. package/dist/styles/base.js +8 -1
  60. package/dist/styles/base.js.map +1 -1
  61. package/dist/styles/font-fallback.d.ts +17 -0
  62. package/dist/styles/font-fallback.js +64 -0
  63. package/dist/styles/font-fallback.js.map +1 -0
  64. package/dist/styles/message.js +4 -0
  65. package/dist/styles/message.js.map +1 -1
  66. package/dist/styles/pagefind.js +8 -1
  67. package/dist/styles/pagefind.js.map +1 -1
  68. package/dist/styles/result-list.js +25 -4
  69. package/dist/styles/result-list.js.map +1 -1
  70. package/dist/styles/results.js +17 -2
  71. package/dist/styles/results.js.map +1 -1
  72. package/dist/styles/tokens.js +1 -1
  73. package/dist/tokens.css +47 -1
  74. package/dist-cdn/base.css +69 -6
  75. package/dist-cdn/bento-box.js +1 -0
  76. package/dist-cdn/bento-box.js.map +1 -1
  77. package/dist-cdn/chunks/{base-BI8h0Gf3.js → base-CIX_-Rmo.js} +58 -6
  78. package/dist-cdn/chunks/base-CIX_-Rmo.js.map +1 -0
  79. package/dist-cdn/chunks/{compare-DV6ltvsJ.js → compare-C0nhByn7.js} +66 -29
  80. package/dist-cdn/chunks/compare-C0nhByn7.js.map +1 -0
  81. package/dist-cdn/chunks/{hours-data-Bw6vkIw7.js → hours-data-gMu5uT7H.js} +2 -2
  82. package/dist-cdn/chunks/hours-data-gMu5uT7H.js.map +1 -0
  83. package/dist-cdn/chunks/{library-weekly-hours-CrV3TlP5.js → library-weekly-hours-BJgxAyah.js} +3 -2
  84. package/dist-cdn/chunks/library-weekly-hours-BJgxAyah.js.map +1 -0
  85. package/dist-cdn/chunks/{regions-B8ExwUGP.js → regions-B-rOwa-v.js} +15 -15
  86. package/dist-cdn/chunks/regions-B-rOwa-v.js.map +1 -0
  87. package/dist-cdn/chunks/{site-header-DYRMpdBj.js → site-header-CEmNtmk5.js} +2 -2
  88. package/dist-cdn/chunks/{site-header-DYRMpdBj.js.map → site-header-CEmNtmk5.js.map} +1 -1
  89. package/dist-cdn/chunks/{site-main-nav-DURrQMal.js → site-main-nav-CAwKq_x5.js} +9 -2
  90. package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +1 -0
  91. package/dist-cdn/chunks/states-DGXGzcte.js +17 -0
  92. package/dist-cdn/chunks/states-DGXGzcte.js.map +1 -0
  93. package/dist-cdn/custom-elements.json +1992 -1681
  94. package/dist-cdn/events-section.js +1 -0
  95. package/dist-cdn/events-section.js.map +1 -1
  96. package/dist-cdn/library-hours-setup.js +1 -1
  97. package/dist-cdn/library-weekly-hours.js +1 -1
  98. package/dist-cdn/manifest.json +1 -1
  99. package/dist-cdn/pagefind.css +8 -1
  100. package/dist-cdn/site-header.js +1 -1
  101. package/dist-cdn/site-hours-section.js +1 -1
  102. package/dist-cdn/site-main-nav.js +1 -1
  103. package/dist-cdn/site-page.js +50 -46
  104. package/dist-cdn/site-page.js.map +1 -1
  105. package/dist-cdn/site-style.js +6 -6
  106. package/dist-cdn/site-style.js.map +1 -1
  107. package/dist-cdn/skills/uvalib-web-components/SKILL.md +6 -5
  108. package/dist-cdn/skills/uvalib-web-components/reference/components.md +36 -9
  109. package/dist-cdn/tokens.css +47 -1
  110. package/dist-cdn/uvalib-card.js +6 -0
  111. package/dist-cdn/uvalib-card.js.map +1 -1
  112. package/dist-cdn/uvalib-combobox.js +107 -68
  113. package/dist-cdn/uvalib-combobox.js.map +1 -1
  114. package/dist-cdn/uvalib-contents.js +5 -0
  115. package/dist-cdn/uvalib-contents.js.map +1 -1
  116. package/dist-cdn/uvalib-filter-drawer.js +27 -25
  117. package/dist-cdn/uvalib-filter-drawer.js.map +1 -1
  118. package/dist-cdn/uvalib-image-regions.js +3 -1
  119. package/dist-cdn/uvalib-image-regions.js.map +1 -1
  120. package/dist-cdn/uvalib-lightbox.js +80 -69
  121. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  122. package/dist-cdn/uvalib-map.js +2 -2
  123. package/dist-cdn/uvalib-map.js.map +1 -1
  124. package/dist-cdn/uvalib-metadata.js +3 -0
  125. package/dist-cdn/uvalib-metadata.js.map +1 -1
  126. package/dist-cdn/uvalib-pagefind-search.js +2 -1
  127. package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
  128. package/dist-cdn/uvalib-photo-grid.js +4 -5
  129. package/dist-cdn/uvalib-photo-grid.js.map +1 -1
  130. package/dist-cdn/uvalib-tag-list.js +21 -16
  131. package/dist-cdn/uvalib-tag-list.js.map +1 -1
  132. package/package.json +1 -1
  133. package/skills/uvalib-web-components/SKILL.md +6 -5
  134. package/skills/uvalib-web-components/reference/components.md +36 -9
  135. package/dist-cdn/chunks/base-BI8h0Gf3.js.map +0 -1
  136. package/dist-cdn/chunks/compare-DV6ltvsJ.js.map +0 -1
  137. package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +0 -1
  138. package/dist-cdn/chunks/library-weekly-hours-CrV3TlP5.js.map +0 -1
  139. package/dist-cdn/chunks/regions-B8ExwUGP.js.map +0 -1
  140. package/dist-cdn/chunks/site-main-nav-DURrQMal.js.map +0 -1
@@ -2,9 +2,10 @@ 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
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-DJv7YOtS.js";
5
+ import { n as g, t as _ } from "./chunks/states-DGXGzcte.js";
6
+ import { t as v } from "./chunks/accessible-DJv7YOtS.js";
6
7
  // src/components/uvalib-tag-list/UvalibTagList.ts
7
- var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e) => e?.trim() || void 0, y = (e) => `
8
+ var y = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), b = (e) => e?.trim() || void 0, x = (e) => `
8
9
  ${e} { display: block; }
9
10
  ${e} ul {
10
11
  display: flex;
@@ -36,11 +37,11 @@ var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e)
36
37
  border: 0;
37
38
  }
38
39
  ${e}[hidden], ${e} [hidden] { display: none !important; }
39
- `, b = s(y(":host")), x = 0, S = class extends l {
40
+ `, S = s(x(":host")), C = 0, w = class extends l {
40
41
  static {
41
42
  this.styles = [
42
- g,
43
- b,
43
+ v,
44
+ S,
44
45
  t`
45
46
  :host {
46
47
  color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
@@ -106,12 +107,12 @@ var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e)
106
107
  ];
107
108
  }
108
109
  constructor() {
109
- super(), this.label = "", this.hideLabel = !1, this.trackLabel = !1, this.hrefTemplate = "", this.expanded = !1, this.childTags = [], this.uid = `uvalib-tag-list-${++x}`, this.warned = /* @__PURE__ */ new Set(), new h(this, () => this.lightDom, (e) => this.read(e));
110
+ super(), this.label = "", this.hideLabel = !1, this.trackLabel = !1, this.hrefTemplate = "", this.expanded = !1, this.childTags = [], this.uid = `uvalib-tag-list-${++C}`, this.warned = /* @__PURE__ */ new Set(), this.internals = _(this), new h(this, () => this.lightDom, (e) => this.read(e));
110
111
  }
111
112
  createRenderRoot() {
112
113
  let e = super.createRenderRoot();
113
114
  if (e instanceof ShadowRoot && this.noStyle) {
114
- let t = b.styleSheet;
115
+ let t = S.styleSheet;
115
116
  t && (e.adoptedStyleSheets = [t]);
116
117
  }
117
118
  return e;
@@ -119,7 +120,7 @@ var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e)
119
120
  connectedCallback() {
120
121
  if (super.connectedCallback(), this.lightDom && this.noStyle) {
121
122
  let e = this.getRootNode();
122
- c(`${this.localName}::structure`, s(y(this.localName)), {
123
+ c(`${this.localName}::structure`, s(x(this.localName)), {
123
124
  root: e instanceof ShadowRoot || e instanceof Document ? e : void 0,
124
125
  scope: !1
125
126
  });
@@ -150,12 +151,12 @@ var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e)
150
151
  let i = {
151
152
  label: e,
152
153
  ...d(r)
153
- }, a = r instanceof HTMLAnchorElement ? v(r.getAttribute("href")) : void 0;
154
+ }, a = r instanceof HTMLAnchorElement ? b(r.getAttribute("href")) : void 0;
154
155
  a !== void 0 && (i.href = a);
155
156
  let o = f(r.childNodes, this.ownerDocument);
156
157
  o.rich && (i.rich = o.key, i.nodes = o.nodes), t.push(i);
157
158
  }
158
- n && this.warnOnce("text", "ignoring tags with no text."), _(t) !== _(this.childTags) && (this.childTags = t);
159
+ n && this.warnOnce("text", "ignoring tags with no text."), y(t) !== y(this.childTags) && (this.childTags = t);
159
160
  }
160
161
  safe(e) {
161
162
  let t = m(e, this.ownerDocument.baseURI);
@@ -163,7 +164,7 @@ var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e)
163
164
  }
164
165
  get tags() {
165
166
  let e = this.items ? this.items.filter((e) => p(e?.label)).map((e) => {
166
- let t = { label: p(e.label) }, n = v(e.href);
167
+ let t = { label: p(e.label) }, n = b(e.href);
167
168
  return n !== void 0 && (t.href = n), e.lang !== void 0 && (t.lang = e.lang), e.dir && (t.dir = e.dir), t;
168
169
  }) : this.childTags, t = this.hrefTemplate.trim();
169
170
  return e.map((e) => {
@@ -211,7 +212,11 @@ var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e)
211
212
  ]);
212
213
  }
213
214
  updated(e) {
214
- super.updated(e), this.toggleAttribute("data-empty", !this.tags.length);
215
+ super.updated(e);
216
+ let t = this.tags;
217
+ this.toggleAttribute("data-empty", !t.length);
218
+ let n = this.max;
219
+ g(this.internals, "expanded", this.expanded && n > 0 && t.length > n);
215
220
  }
216
221
  renderTag(e, t) {
217
222
  let n = e.nodes ? e.nodes.map((e) => e.cloneNode(!0)) : e.label;
@@ -253,15 +258,15 @@ var _ = (e) => JSON.stringify(e, (e, t) => e === "nodes" ? void 0 : t), v = (e)
253
258
  }
254
259
  };
255
260
  // src/components/uvalib-tag-list/uvalib-tag-list.ts
256
- a([e({ type: String })], S.prototype, "label", void 0), a([e({
261
+ a([e({ type: String })], w.prototype, "label", void 0), a([e({
257
262
  type: Boolean,
258
263
  attribute: "hide-label"
259
- })], S.prototype, "hideLabel", void 0), a([e({
264
+ })], w.prototype, "hideLabel", void 0), a([e({
260
265
  type: Boolean,
261
266
  attribute: "track-label"
262
- })], S.prototype, "trackLabel", void 0), a([e({ type: Number })], S.prototype, "limit", void 0), a([e({
267
+ })], w.prototype, "trackLabel", void 0), a([e({ type: Number })], w.prototype, "limit", void 0), a([e({
263
268
  type: String,
264
269
  attribute: "href-template"
265
- })], S.prototype, "hrefTemplate", void 0), a([e({ attribute: !1 })], S.prototype, "items", void 0), a([n()], S.prototype, "expanded", void 0), a([n()], S.prototype, "childTags", void 0), i("uvalib-tag-list", S);
270
+ })], w.prototype, "hrefTemplate", void 0), a([e({ attribute: !1 })], w.prototype, "items", void 0), a([n()], w.prototype, "expanded", void 0), a([n()], w.prototype, "childTags", void 0), i("uvalib-tag-list", w);
266
271
 
267
272
  //# sourceMappingURL=uvalib-tag-list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uvalib-tag-list.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","langDir","inlineCopy","normalize","safeHref","SourceChildren","accessible","keyOf","tags","k","v","hrefOf","h","structuralRules","host","shadowStructure","instances","UvalibTagList","nodes","root","sheet","node","changed","key","message","invalid","label","tag","href","copy","ok","source","template","t","out","a","index","go","text","A","max","collapsible","labelId","listId","toggleText"],"sources":["../src/components/uvalib-tag-list/UvalibTagList.ts","../src/components/uvalib-tag-list/uvalib-tag-list.ts"],"sourcesContent":["import { css, html, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { inlineCopy, langDir } from '../../base/inline-copy.js';\nimport { normalize, safeHref, SourceChildren } from '../../base/source-children.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\n\n/** One tag: its visible text and, when it is a link, where it goes; `lang`/`dir` if they differ. */\nexport interface TagItem {\n label: string;\n href?: string;\n lang?: string;\n dir?: string;\n}\n\n/** A tag as read and drawn: `nodes` is a safe inline copy of a child's content, `rich` its key. */\ninterface Tag extends TagItem {\n rich?: string;\n nodes?: Node[];\n}\n\n/** Compare two reads, leaving out the copied nodes (their `rich` key stands for them). */\nconst keyOf = (tags: Tag[]) =>\n JSON.stringify(tags, (k, v: unknown) => (k === 'nodes' ? undefined : v));\n\n/** A blank href is no href (it would reload the page and skip `href-template`). */\nconst hrefOf = (h: string | null | undefined): string | undefined => {\n const t = h?.trim();\n return t ? t : undefined;\n};\n\n/**\n * Kept with `no-style`: the tags wrap in a row with gaps, no bullets, every link and the\n * toggle at least 24px with space around (WCAG 2.5.8), the hidden label stays hidden and\n * `[hidden]` hides. `host` is `:host` or the tag name.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n ${host} li { display: flex; max-width: 100%; min-width: 0; }\n ${host} :where(a.tag, .toggle) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-height: 24px;\n min-width: 24px;\n }\n ${host} :where(.toggle) { margin-top: 0.5rem; }\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`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\nlet instances = 0;\n\n/**\n * A labelled list of keywords or subjects that wraps: each tag a link (for example a search\n * for that term) or plain text. Link tags are outlined pills in the link colour; plain tags\n * are filled chips (the card chip's colours), so a link never looks like a label. Every tag\n * and the toggle are at least 2rem (34px) tall and wide, 0.5rem apart.\n *\n * Give the tags as children: `<a href>` for a link, any other element (`<span>`) for plain\n * text. A child's `lang` and `dir` are kept, and so is inline markup inside it (`em`, `cite`,\n * `abbr`, `bdi`, a `span lang`…), copied element by element (never parsed as HTML). Or set\n * `href-template` (with `{tag}`, replaced by the URL-encoded text) to make every tag without\n * its own href a link; a blank href counts as none. Apps can set the `items` property\n * (`{ label, href?, lang?, dir? }`) instead; it wins over the children. Children with no text\n * are skipped with one warning.\n *\n * `label` names the list (shown above it, or visually hidden with `hide-label`); without one\n * a console warning is logged. `limit` shows that many tags and a “Show all N” button\n * (`aria-expanded`, `aria-controls`), which reveals the rest in place and keeps focus.\n *\n * Analytics never sends a tag's text (record tags can be user-submitted or machine-made), and\n * by default not the label either, which a template may fill from a record: the name is the\n * list's place among the tag lists on the page, `list N`. Add `track-label` when the label is\n * fixed text the page author wrote (“Subjects”), to send it instead.\n *\n * @tagname uvalib-tag-list\n * @fires uvalib-analytics-event - For `<site-analytics>`: a primary-button click on a tag link, `['uvalib-tag-list', 'tag-click', '<name>', <n>]` (n from 1, the tag's place in the list), and the toggle, `['uvalib-tag-list', 'show-all'|'show-fewer', '<name>']`. The name is `list N` (N from 1, the list's place among the tag lists in its document or shadow root), or with `track-label` the list's `label`; never the tag text or URL. Bubbles and is composed.\n * @fires uvalib-tag-list-navigate - A plain click on a tag link: `detail` is `{ href, tag, index }` (index from 0). Cancel it (`preventDefault()`) to route in the app; the click's default is then prevented. Bubbles and is composed.\n * @cssprop [--uva-blue-alt-300=#BFE7F7] - Plain tag background (the card chip's).\n * @cssprop [--uva-blue-alt-dark=#005679] - Plain tag text.\n * @cssprop --uva-color-link - Dark-mode role token: link tag text (else `--uva-brand-blue`).\n * @cssprop --uva-color-control-border - Dark-mode role token: link tag outline (else `--uva-grey`).\n * @cssprop --uva-color-text - Dark-mode role token: the label (else `--uva-grey-darkest`).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibTagList extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n }\n .label {\n display: block;\n margin-block-end: 0.5rem;\n font-weight: 600;\n }\n .tag {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n max-width: 100%;\n min-height: 2rem;\n min-width: 2rem;\n padding: 0.15rem 0.7rem;\n border: 1px solid transparent;\n border-radius: 999px;\n font-size: 0.875rem;\n line-height: 1.4;\n overflow-wrap: anywhere;\n }\n span.tag {\n background: var(--uva-blue-alt-300, #bfe7f7);\n color: var(--uva-blue-alt-dark, #005679);\n }\n a.tag {\n border-color: var(--uva-color-control-border, var(--uva-grey, #808080));\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n text-decoration: none;\n }\n a.tag:hover {\n border-color: currentColor;\n text-decoration: underline;\n }\n .toggle {\n min-height: 2rem;\n min-width: 2rem;\n padding: 0.15rem 0.35rem;\n border: 0;\n background: none;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font: inherit;\n font-size: 0.875rem;\n text-decoration: underline;\n cursor: pointer;\n }\n @media (forced-colors: active) {\n span.tag {\n border-color: CanvasText;\n }\n a.tag {\n border-color: LinkText;\n color: LinkText;\n }\n .toggle {\n color: ButtonText;\n }\n }\n `,\n ];\n\n /** The list's name: shown above the tags (and, with `track-label`, the analytics name). */\n @property({ type: String }) label = '';\n\n /** Hide the label visually; it still names the list. */\n @property({ type: Boolean, attribute: 'hide-label' }) hideLabel = false;\n\n /**\n * Send the label as the analytics name. Only for fixed text the page author wrote, never a\n * label filled from a record. Without it the name is `list N`.\n */\n @property({ type: Boolean, attribute: 'track-label' }) trackLabel = false;\n\n /** Show this many tags and a “Show all N” button. Zero or empty shows every tag. */\n @property({ type: Number }) limit?: number;\n\n /**\n * Href for tags without their own, with `{tag}` where the URL-encoded text goes, for\n * example `/search?q={tag}`. Empty: such tags are plain text.\n */\n @property({ type: String, attribute: 'href-template' }) hrefTemplate = '';\n\n /** The tags as data (`{ label, href?, lang?, dir? }`), for apps. Wins over the children while set. */\n @property({ attribute: false }) items?: TagItem[];\n\n /** Whether every tag is shown (after Show all). */\n @state() private expanded = false;\n /** The tags read from the children. */\n @state() private childTags: Tag[] = [];\n\n private readonly uid = `uvalib-tag-list-${++instances}`;\n private warned = new Set<string>();\n\n constructor() {\n super();\n // Light DOM: the children move to a hidden holder before every render, also when the\n // element is connected, moved or reconnected before its first update.\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 protected override firstUpdated(): void {\n if (!normalize(this.label))\n this.warnOnce('label', 'set label to name the list (for example “Subjects”).');\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('items') && this.items?.some((i) => !normalize(i?.label)))\n this.warnOnce('text', 'ignoring tags with no text.');\n }\n\n private warnOnce(key: string, message: string): void {\n if (this.warned.has(key)) return;\n this.warned.add(key);\n console.warn(`${this.localName}: ${message}`);\n }\n\n /** Read the tags from the source children. */\n private read(nodes: Node[]): void {\n const tags: Tag[] = [];\n let invalid = false;\n for (const n of nodes) {\n if (n.nodeType === Node.TEXT_NODE) {\n if (normalize(n.textContent)) invalid = true;\n continue;\n }\n if (!(n instanceof Element)) continue;\n const label = normalize(n.textContent);\n if (!label) {\n invalid = true;\n continue;\n }\n const tag: Tag = { label, ...langDir(n) };\n const href = n instanceof HTMLAnchorElement ? hrefOf(n.getAttribute('href')) : undefined;\n if (href !== undefined) tag.href = href;\n const copy = inlineCopy(n.childNodes, this.ownerDocument);\n if (copy.rich) {\n tag.rich = copy.key;\n tag.nodes = copy.nodes;\n }\n tags.push(tag);\n }\n if (invalid) this.warnOnce('text', 'ignoring tags with no text.');\n if (keyOf(tags) !== keyOf(this.childTags)) this.childTags = tags;\n }\n\n private safe(href: string): boolean {\n const ok = safeHref(href, this.ownerDocument.baseURI);\n if (!ok)\n this.warnOnce(\n 'href',\n 'showing a tag as text: its href is not http(s), mailto, tel or relative.',\n );\n return ok;\n }\n\n /** What is shown: `items` while set, else the children; hrefs from the template; unsafe ones dropped. */\n private get tags(): Tag[] {\n const source: Tag[] = this.items\n ? this.items\n .filter((i) => normalize(i?.label))\n .map((i) => {\n const t: Tag = { label: normalize(i.label) };\n const href = hrefOf(i.href);\n if (href !== undefined) t.href = href;\n if (i.lang !== undefined) t.lang = i.lang;\n if (i.dir) t.dir = i.dir;\n return t;\n })\n : this.childTags;\n const template = this.hrefTemplate.trim();\n return source.map((t) => {\n const href =\n t.href ??\n (template.includes('{tag}')\n ? template.replaceAll('{tag}', encodeURIComponent(t.label))\n : undefined);\n const out: Tag = { ...t };\n if (href !== undefined && this.safe(href)) out.href = href;\n else delete out.href;\n return out;\n });\n }\n\n /** The `limit`, when it hides anything: a positive whole number. */\n private get max(): number {\n const n = Math.trunc(this.limit ?? 0);\n return Number.isFinite(n) && n > 0 ? n : 0;\n }\n\n /** The analytics name: the label with `track-label`, else `list N` (this list's place in its root). */\n private get name(): string {\n const label = normalize(this.label);\n if (this.trackLabel && label) return label;\n const root = this.getRootNode() as Document | ShadowRoot;\n const lists = root.querySelectorAll ? [...root.querySelectorAll(this.localName)] : [];\n const i = lists.indexOf(this);\n return `list ${i < 0 ? 1 : i + 1}`;\n }\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 if (e.defaultPrevented || e.button !== 0) return;\n const index = Number(a.dataset.index);\n trackEvent(this, ['uvalib-tag-list', 'tag-click', this.name, index + 1]);\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n const go = new CustomEvent('uvalib-tag-list-navigate', {\n detail: { href: a.getAttribute('href'), tag: normalize(a.textContent), index },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(go)) e.preventDefault();\n }\n\n private toggle(): void {\n this.expanded = !this.expanded;\n trackEvent(this, ['uvalib-tag-list', this.expanded ? 'show-all' : 'show-fewer', this.name]);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.toggleAttribute('data-empty', !this.tags.length);\n }\n\n private renderTag(t: Tag, i: number) {\n const text = t.nodes ? t.nodes.map((n) => n.cloneNode(true)) : t.label;\n return t.href !== undefined\n ? html`<a\n class=\"tag\"\n href=${t.href}\n data-index=${i}\n lang=${t.lang ?? nothing}\n dir=${t.dir ?? nothing}\n >${text}</a\n >`\n : html`<span class=\"tag\" lang=${t.lang ?? nothing} dir=${t.dir ?? nothing}>${text}</span>`;\n }\n\n protected override render() {\n const tags = this.tags;\n const max = this.max;\n const collapsible = max > 0 && tags.length > max;\n const label = normalize(this.label);\n const labelId = `${this.uid}-label`;\n const listId = `${this.uid}-list`;\n const toggleText = this.expanded ? 'Show fewer' : `Show all ${tags.length}`;\n // One wrapper, always rendered.\n return html`<div class=\"tag-list\" ?hidden=${!tags.length}>\n ${\n label\n ? html`<span id=${labelId} class=${this.hideLabel ? 'label visually-hidden' : 'label'}\n >${label}</span\n >`\n : nothing\n }\n <ul\n role=\"list\"\n id=${listId}\n aria-labelledby=${label ? labelId : nothing}\n @click=${this.onClick}\n >\n ${tags.map(\n (t, i) =>\n html`<li role=\"listitem\" ?hidden=${collapsible && !this.expanded && i >= max}>\n ${this.renderTag(t, i)}\n </li>`,\n )}\n </ul>\n ${\n collapsible\n ? html`<button\n type=\"button\"\n class=\"toggle\"\n aria-expanded=${this.expanded ? 'true' : 'false'}\n aria-controls=${listId}\n @click=${this.toggle}\n >\n ${toggleText}${label ? html`<span class=\"visually-hidden\"> ${label}</span>` : nothing}\n </button>`\n : nothing\n }\n </div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibTagList } from './UvalibTagList.js';\n\ndefine('uvalib-tag-list', UvalibTagList);\n"],"mappings":";;;;;;AAwBA,IAAMqB,KAAS,MACb,KAAK,UAAUC,IAAO,GAAG,MAAgBC,MAAM,UAAU,KAAA,IAAYC,CAAE,GAGnEC,KAAU,MACJC,GAAG,KAAK,KACH,KAAA,GAQXC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;;;;;;;;IAQLA,EAAK;IACLA,EAAK;;;;;;;;IAQLA,EAAK;IACLA,EAAK;;;;;;;;;;;IAWLA,EAAK,YAAYA,EAAK;GAEpBC,IAAkB7B,EAAU2B,EAAgB,OAAO,CAAC,GAEtDG,IAAY,GAmCHC,IAAb,cAAmClB,EAAc;;EAC/B,KAAA,SAAA;GACdO;GACAS;GACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DL;;CAkCA,cAAc;EAIZ,AAHA,MAAM,GAhC4B,KAAA,QAAA,IAG8B,KAAA,YAAA,IAME,KAAA,aAAA,IASG,KAAA,eAAA,IAM3C,KAAA,WAAA,IAEQ,KAAA,YAAA,CAAC,GAEd,KAAA,MAAA,mBAAmB,EAAEC,KAC3B,KAAA,yBAAA,IAAI,IAAY,GAM/B,IAAIX,EACF,YACM,KAAK,WACV,MAAU,KAAK,KAAKa,CAAK,CAC5B;CACF;CAEA,mBAAsE;EACpE,IAAMC,IAAO,MAAM,iBAAiB;EACpC,IAAIA,aAAgB,cAAc,KAAK,SAAS;GAC9C,IAAMC,IAAQL,EAAgB;GAC9B,AAAIK,MAAO,EAAK,qBAAqB,CAACA,C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CAAC,CAAA,GAAA4B,EAAA,WAAA,aAAA,KAAA,CAAA,GAMnD7B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAS,WAAW;AAAc,CAAC,CAAA,GAAA4B,EAAA,WAAA,cAAA,KAAA,CAAA,GAGpD7B,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA4B,EAAA,WAAA,SAAA,KAAA,CAAA,GAMzB7B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAgB,CAAC,CAAA,GAAA4B,EAAA,WAAA,gBAAA,KAAA,CAAA,GAGrD7B,EAAA,CAAAC,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA4B,EAAA,WAAA,SAAA,KAAA,CAAA,GAG7B7B,EAAA,CAAAE,EAAM,CAAA,GAAA2B,EAAA,WAAA,YAAA,KAAA,CAAA,GAEN7B,EAAA,CAAAE,EAAM,CAAA,GAAA2B,EAAA,WAAA,aAAA,KAAA,CAAA,GCxMTtB,EAAO,mBAAmBsB,CAAa"}
1
+ {"version":3,"file":"uvalib-tag-list.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","langDir","inlineCopy","normalize","safeHref","SourceChildren","setState","attachStateInternals","accessible","keyOf","tags","k","v","hrefOf","h","structuralRules","host","shadowStructure","instances","UvalibTagList","nodes","root","sheet","node","changed","key","message","invalid","label","tag","href","copy","ok","source","template","t","out","a","index","go","max","text","A","collapsible","labelId","listId","toggleText"],"sources":["../src/components/uvalib-tag-list/UvalibTagList.ts","../src/components/uvalib-tag-list/uvalib-tag-list.ts"],"sourcesContent":["import { css, html, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { inlineCopy, langDir } from '../../base/inline-copy.js';\nimport { normalize, safeHref, SourceChildren } from '../../base/source-children.js';\nimport { attachStateInternals, setState } from '../../base/states.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\n\n/** One tag: its visible text and, when it is a link, where it goes; `lang`/`dir` if they differ. */\nexport interface TagItem {\n label: string;\n href?: string;\n lang?: string;\n dir?: string;\n}\n\n/** A tag as read and drawn: `nodes` is a safe inline copy of a child's content, `rich` its key. */\ninterface Tag extends TagItem {\n rich?: string;\n nodes?: Node[];\n}\n\n/** Compare two reads, leaving out the copied nodes (their `rich` key stands for them). */\nconst keyOf = (tags: Tag[]) =>\n JSON.stringify(tags, (k, v: unknown) => (k === 'nodes' ? undefined : v));\n\n/** A blank href is no href (it would reload the page and skip `href-template`). */\nconst hrefOf = (h: string | null | undefined): string | undefined => {\n const t = h?.trim();\n return t ? t : undefined;\n};\n\n/**\n * Kept with `no-style`: the tags wrap in a row with gaps, no bullets, every link and the\n * toggle at least 24px with space around (WCAG 2.5.8), the hidden label stays hidden and\n * `[hidden]` hides. `host` is `:host` or the tag name.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} ul {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n ${host} li { display: flex; max-width: 100%; min-width: 0; }\n ${host} :where(a.tag, .toggle) {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n min-height: 24px;\n min-width: 24px;\n }\n ${host} :where(.toggle) { margin-top: 0.5rem; }\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`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\nlet instances = 0;\n\n/**\n * A labelled list of keywords or subjects that wraps: each tag a link (for example a search\n * for that term) or plain text. Link tags are outlined pills in the link colour; plain tags\n * are filled chips (the card chip's colours), so a link never looks like a label. Every tag\n * and the toggle are at least 2rem (34px) tall and wide, 0.5rem apart.\n *\n * Give the tags as children: `<a href>` for a link, any other element (`<span>`) for plain\n * text. A child's `lang` and `dir` are kept, and so is inline markup inside it (`em`, `cite`,\n * `abbr`, `bdi`, a `span lang`…), copied element by element (never parsed as HTML). Or set\n * `href-template` (with `{tag}`, replaced by the URL-encoded text) to make every tag without\n * its own href a link; a blank href counts as none. Apps can set the `items` property\n * (`{ label, href?, lang?, dir? }`) instead; it wins over the children. Children with no text\n * are skipped with one warning.\n *\n * `label` names the list (shown above it, or visually hidden with `hide-label`); without one\n * a console warning is logged. `limit` shows that many tags and a “Show all N” button\n * (`aria-expanded`, `aria-controls`), which reveals the rest in place and keeps focus. Pages\n * can style the list while every tag is shown with `:state(expanded)`.\n *\n * Analytics never sends a tag's text (record tags can be user-submitted or machine-made), and\n * by default not the label either, which a template may fill from a record: the name is the\n * list's place among the tag lists on the page, `list N`. Add `track-label` when the label is\n * fixed text the page author wrote (“Subjects”), to send it instead.\n *\n * @tagname uvalib-tag-list\n * @fires uvalib-analytics-event - For `<site-analytics>`: a primary-button click on a tag link, `['uvalib-tag-list', 'tag-click', '<name>', <n>]` (n from 1, the tag's place in the list), and the toggle, `['uvalib-tag-list', 'show-all'|'show-fewer', '<name>']`. The name is `list N` (N from 1, the list's place among the tag lists in its document or shadow root), or with `track-label` the list's `label`; never the tag text or URL. Bubbles and is composed.\n * @fires uvalib-tag-list-navigate - A plain click on a tag link: `detail` is `{ href, tag, index }` (index from 0). Cancel it (`preventDefault()`) to route in the app; the click's default is then prevented. Bubbles and is composed.\n * @cssstate expanded - Show all was pressed: every tag is shown (the toggle's `aria-expanded=\"true\"`).\n * @cssprop [--uva-blue-alt-300=#BFE7F7] - Plain tag background (the card chip's).\n * @cssprop [--uva-blue-alt-dark=#005679] - Plain tag text.\n * @cssprop --uva-color-link - Dark-mode role token: link tag text (else `--uva-brand-blue`).\n * @cssprop --uva-color-control-border - Dark-mode role token: link tag outline (else `--uva-grey`).\n * @cssprop --uva-color-text - Dark-mode role token: the label (else `--uva-grey-darkest`).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibTagList extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n }\n .label {\n display: block;\n margin-block-end: 0.5rem;\n font-weight: 600;\n }\n .tag {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n max-width: 100%;\n min-height: 2rem;\n min-width: 2rem;\n padding: 0.15rem 0.7rem;\n border: 1px solid transparent;\n border-radius: 999px;\n font-size: 0.875rem;\n line-height: 1.4;\n overflow-wrap: anywhere;\n }\n span.tag {\n background: var(--uva-blue-alt-300, #bfe7f7);\n color: var(--uva-blue-alt-dark, #005679);\n }\n a.tag {\n border-color: var(--uva-color-control-border, var(--uva-grey, #808080));\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n text-decoration: none;\n }\n a.tag:hover {\n border-color: currentColor;\n text-decoration: underline;\n }\n .toggle {\n min-height: 2rem;\n min-width: 2rem;\n padding: 0.15rem 0.35rem;\n border: 0;\n background: none;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n font: inherit;\n font-size: 0.875rem;\n text-decoration: underline;\n cursor: pointer;\n }\n @media (forced-colors: active) {\n span.tag {\n border-color: CanvasText;\n }\n a.tag {\n border-color: LinkText;\n color: LinkText;\n }\n .toggle {\n color: ButtonText;\n }\n }\n `,\n ];\n\n /** The list's name: shown above the tags (and, with `track-label`, the analytics name). */\n @property({ type: String }) label = '';\n\n /** Hide the label visually; it still names the list. */\n @property({ type: Boolean, attribute: 'hide-label' }) hideLabel = false;\n\n /**\n * Send the label as the analytics name. Only for fixed text the page author wrote, never a\n * label filled from a record. Without it the name is `list N`.\n */\n @property({ type: Boolean, attribute: 'track-label' }) trackLabel = false;\n\n /** Show this many tags and a “Show all N” button. Zero or empty shows every tag. */\n @property({ type: Number }) limit?: number;\n\n /**\n * Href for tags without their own, with `{tag}` where the URL-encoded text goes, for\n * example `/search?q={tag}`. Empty: such tags are plain text.\n */\n @property({ type: String, attribute: 'href-template' }) hrefTemplate = '';\n\n /** The tags as data (`{ label, href?, lang?, dir? }`), for apps. Wins over the children while set. */\n @property({ attribute: false }) items?: TagItem[];\n\n /** Whether every tag is shown (after Show all). */\n @state() private expanded = false;\n /** The tags read from the children. */\n @state() private childTags: Tag[] = [];\n\n private readonly uid = `uvalib-tag-list-${++instances}`;\n private warned = new Set<string>();\n private readonly internals = attachStateInternals(this);\n\n constructor() {\n super();\n // Light DOM: the children move to a hidden holder before every render, also when the\n // element is connected, moved or reconnected before its first update.\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 protected override firstUpdated(): void {\n if (!normalize(this.label))\n this.warnOnce('label', 'set label to name the list (for example “Subjects”).');\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('items') && this.items?.some((i) => !normalize(i?.label)))\n this.warnOnce('text', 'ignoring tags with no text.');\n }\n\n private warnOnce(key: string, message: string): void {\n if (this.warned.has(key)) return;\n this.warned.add(key);\n console.warn(`${this.localName}: ${message}`);\n }\n\n /** Read the tags from the source children. */\n private read(nodes: Node[]): void {\n const tags: Tag[] = [];\n let invalid = false;\n for (const n of nodes) {\n if (n.nodeType === Node.TEXT_NODE) {\n if (normalize(n.textContent)) invalid = true;\n continue;\n }\n if (!(n instanceof Element)) continue;\n const label = normalize(n.textContent);\n if (!label) {\n invalid = true;\n continue;\n }\n const tag: Tag = { label, ...langDir(n) };\n const href = n instanceof HTMLAnchorElement ? hrefOf(n.getAttribute('href')) : undefined;\n if (href !== undefined) tag.href = href;\n const copy = inlineCopy(n.childNodes, this.ownerDocument);\n if (copy.rich) {\n tag.rich = copy.key;\n tag.nodes = copy.nodes;\n }\n tags.push(tag);\n }\n if (invalid) this.warnOnce('text', 'ignoring tags with no text.');\n if (keyOf(tags) !== keyOf(this.childTags)) this.childTags = tags;\n }\n\n private safe(href: string): boolean {\n const ok = safeHref(href, this.ownerDocument.baseURI);\n if (!ok)\n this.warnOnce(\n 'href',\n 'showing a tag as text: its href is not http(s), mailto, tel or relative.',\n );\n return ok;\n }\n\n /** What is shown: `items` while set, else the children; hrefs from the template; unsafe ones dropped. */\n private get tags(): Tag[] {\n const source: Tag[] = this.items\n ? this.items\n .filter((i) => normalize(i?.label))\n .map((i) => {\n const t: Tag = { label: normalize(i.label) };\n const href = hrefOf(i.href);\n if (href !== undefined) t.href = href;\n if (i.lang !== undefined) t.lang = i.lang;\n if (i.dir) t.dir = i.dir;\n return t;\n })\n : this.childTags;\n const template = this.hrefTemplate.trim();\n return source.map((t) => {\n const href =\n t.href ??\n (template.includes('{tag}')\n ? template.replaceAll('{tag}', encodeURIComponent(t.label))\n : undefined);\n const out: Tag = { ...t };\n if (href !== undefined && this.safe(href)) out.href = href;\n else delete out.href;\n return out;\n });\n }\n\n /** The `limit`, when it hides anything: a positive whole number. */\n private get max(): number {\n const n = Math.trunc(this.limit ?? 0);\n return Number.isFinite(n) && n > 0 ? n : 0;\n }\n\n /** The analytics name: the label with `track-label`, else `list N` (this list's place in its root). */\n private get name(): string {\n const label = normalize(this.label);\n if (this.trackLabel && label) return label;\n const root = this.getRootNode() as Document | ShadowRoot;\n const lists = root.querySelectorAll ? [...root.querySelectorAll(this.localName)] : [];\n const i = lists.indexOf(this);\n return `list ${i < 0 ? 1 : i + 1}`;\n }\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 if (e.defaultPrevented || e.button !== 0) return;\n const index = Number(a.dataset.index);\n trackEvent(this, ['uvalib-tag-list', 'tag-click', this.name, index + 1]);\n if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n const go = new CustomEvent('uvalib-tag-list-navigate', {\n detail: { href: a.getAttribute('href'), tag: normalize(a.textContent), index },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(go)) e.preventDefault();\n }\n\n private toggle(): void {\n this.expanded = !this.expanded;\n trackEvent(this, ['uvalib-tag-list', this.expanded ? 'show-all' : 'show-fewer', this.name]);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n const tags = this.tags;\n this.toggleAttribute('data-empty', !tags.length);\n const max = this.max;\n setState(this.internals, 'expanded', this.expanded && max > 0 && tags.length > max);\n }\n\n private renderTag(t: Tag, i: number) {\n const text = t.nodes ? t.nodes.map((n) => n.cloneNode(true)) : t.label;\n return t.href !== undefined\n ? html`<a\n class=\"tag\"\n href=${t.href}\n data-index=${i}\n lang=${t.lang ?? nothing}\n dir=${t.dir ?? nothing}\n >${text}</a\n >`\n : html`<span class=\"tag\" lang=${t.lang ?? nothing} dir=${t.dir ?? nothing}>${text}</span>`;\n }\n\n protected override render() {\n const tags = this.tags;\n const max = this.max;\n const collapsible = max > 0 && tags.length > max;\n const label = normalize(this.label);\n const labelId = `${this.uid}-label`;\n const listId = `${this.uid}-list`;\n const toggleText = this.expanded ? 'Show fewer' : `Show all ${tags.length}`;\n // One wrapper, always rendered.\n return html`<div class=\"tag-list\" ?hidden=${!tags.length}>\n ${\n label\n ? html`<span id=${labelId} class=${this.hideLabel ? 'label visually-hidden' : 'label'}\n >${label}</span\n >`\n : nothing\n }\n <ul\n role=\"list\"\n id=${listId}\n aria-labelledby=${label ? labelId : nothing}\n @click=${this.onClick}\n >\n ${tags.map(\n (t, i) =>\n html`<li role=\"listitem\" ?hidden=${collapsible && !this.expanded && i >= max}>\n ${this.renderTag(t, i)}\n </li>`,\n )}\n </ul>\n ${\n collapsible\n ? html`<button\n type=\"button\"\n class=\"toggle\"\n aria-expanded=${this.expanded ? 'true' : 'false'}\n aria-controls=${listId}\n @click=${this.toggle}\n >\n ${toggleText}${label ? html`<span class=\"visually-hidden\"> ${label}</span>` : nothing}\n </button>`\n : nothing\n }\n </div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibTagList } from './UvalibTagList.js';\n\ndefine('uvalib-tag-list', UvalibTagList);\n"],"mappings":";;;;;;;AAyBA,IAAMuB,KAAS,MACb,KAAK,UAAUC,IAAO,GAAG,MAAgBC,MAAM,UAAU,KAAA,IAAYC,CAAE,GAGnEC,KAAU,MACJC,GAAG,KAAK,KACH,KAAA,GAQXC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;;;;;;;;IAQLA,EAAK;IACLA,EAAK;;;;;;;;IAQLA,EAAK;IACLA,EAAK;;;;;;;;;;;IAWLA,EAAK,YAAYA,EAAK;GAEpBC,IAAkB/B,EAAU6B,EAAgB,OAAO,CAAC,GAEtDG,IAAY,GAqCHC,IAAb,cAAmCpB,EAAc;;EAC/B,KAAA,SAAA;GACdS;GACAS;GACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8DL;;CAmCA,cAAc;EAIZ,AAHA,MAAM,GAjC4B,KAAA,QAAA,IAG8B,KAAA,YAAA,IAME,KAAA,aAAA,IASG,KAAA,eAAA,IAM3C,KAAA,WAAA,IAEQ,KAAA,YAAA,CAAC,GAEd,KAAA,MAAA,mBAAmB,EAAEC,KAC3B,KAA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YAAY,KAAKH,EAAI;gBACzE,KAAK,UAAUL,GAAG,CAAC,EAAE;kBAE7B,EAAE;;QAGFQ,IACI,CAAI;;;8BAGc,KAAK,WAAW,SAAS,QAAQ;8BACjCE,EAAO;uBACd,KAAK,OAAO;;gBAEnBC,IAAalB,IAAQ,CAAI,kCAAkCA,EAAM,WAAWzC,EAAQ;yBAExFA,EACL;;CAEL;AACF;;AAhQGC,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA8B,EAAA,WAAA,SAAA,KAAA,CAAA,GAGzB/B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAS,WAAW;AAAa,CAAC,CAAA,GAAA8B,EAAA,WAAA,aAAA,KAAA,CAAA,GAMnD/B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAS,WAAW;AAAc,CAAC,CAAA,GAAA8B,EAAA,WAAA,cAAA,KAAA,CAAA,GAGpD/B,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAA8B,EAAA,WAAA,SAAA,KAAA,CAAA,GAMzB/B,EAAA,CAAAC,EAAS;CAAE,MAAM;CAAQ,WAAW;AAAgB,CAAC,CAAA,GAAA8B,EAAA,WAAA,gBAAA,KAAA,CAAA,GAGrD/B,EAAA,CAAAC,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAA8B,EAAA,WAAA,SAAA,KAAA,CAAA,GAG7B/B,EAAA,CAAAE,EAAM,CAAA,GAAA6B,EAAA,WAAA,YAAA,KAAA,CAAA,GAEN/B,EAAA,CAAAE,EAAM,CAAA,GAAA6B,EAAA,WAAA,aAAA,KAAA,CAAA,GC3MTxB,EAAO,mBAAmBwB,CAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uvalib/web-components",
3
- "version": "1.7.0",
3
+ "version": "1.8.3",
4
4
  "description": "UVA Library reusable web components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -74,8 +74,9 @@ Loading rules:
74
74
 
75
75
  Theme only through the documented surface, never by reaching into internals:
76
76
 
77
- - Inherited `--uva-*` custom properties (colors such as `--uva-brand-blue`, `--uva-brand-orange`; `--uva-font-family`, `--uva-font-size-base`). Set them on `:root` or an ancestor of `<site-page>`. The full set is in `tokens.css`; per-component ones are in reference/components.md. Prefer the library's values; override only with a stated reason.
77
+ - Inherited `--uva-*` custom properties (colors such as `--uva-brand-blue`, `--uva-brand-orange`; `--uva-font-family`, `--uva-font-size-base`). Set them on `:root` or an ancestor of `<site-page>`. The full set is in `tokens.css`; per-component ones are in reference/components.md. Prefer the library's values; override only with a stated reason. If you override `--uva-font-family`, keep `"UVA Franklin Fallback"` right after `franklin-gothic-urw`: it is Arial matched to Franklin Gothic's metrics, so text does not rewrap and shift the page when the Adobe Fonts kit arrives.
78
78
  - `::part()` in shadow mode. On a page, use `site-page::part(header)`, `site-page::part(footer)` and `site-page::part(main)` (`<site-page>` re-exports the header and footer parts; `site-header::part(header)` cannot reach through its shadow root). For a standalone `<site-header>` or `<site-footer>` use `site-header::part(header)` / `site-footer::part(footer)`. In light mode there are no shadow parts; style the elements with ordinary selectors.
79
+ - Custom states for runtime state, in shadow and light mode: `uvalib-combobox:state(open)`, `:state(invalid)`, `:state(loading)`; `uvalib-filter-drawer:state(modal)` (phone layout), `:state(open)`; `uvalib-lightbox:state(open)`; `uvalib-tag-list:state(expanded)`. Style them; never add or watch attributes for that state (there are none) or set it yourself (a page cannot). Browsers without custom states just never match.
79
80
  - Never pierce shadow roots with JS, depend on internal class names, or use `!important` to fight the chrome.
80
81
 
81
82
  ### Dark mode (opt-in)
@@ -594,10 +595,10 @@ A static site (11ty, Jekyll, a generated collection) that searches with [Pagefin
594
595
  For a results list of your own (a collection, a Virgo-like listing, a photo archive), use these instead of hand-made pills, counts and spinners. Classes are in `base.css`; the two elements load from `uvalib-tag-list.js` and `uvalib-results-count.js`.
595
596
 
596
597
  - Badges: `.uvalib-badge` (neutral) with `--category` (the card chip), `--count` (on media, inside `.uvalib-media`; several in `.uvalib-media__badges`), `--status` plus `--success` / `--warning` / `--danger` / `--info`, `--new`, and `--body` for body size. A status badge always says its state in words; an icon in it gets `aria-hidden="true"`. Inside `<uvalib-card>` use its `badge` and `chip` slots instead.
597
- - Toolbar: `.uvalib-toolbar` around `.uvalib-toolbar__field` (label over control; `--grow` takes the spare width), `.uvalib-toolbar__group` (`role="group"` with an `aria-label`, `.uvalib-button` toggles with `aria-pressed`) and `.uvalib-toolbar__summary`. It stacks on phones.
598
+ - Toolbar: `.uvalib-toolbar` around `.uvalib-toolbar__field` (label over control; `--grow` takes the spare width), `.uvalib-toolbar__group` (`role="group"` with an `aria-label`, `.uvalib-button` toggles with `aria-pressed`) and `.uvalib-toolbar__summary`. It stacks when it is itself 30em wide or less (a phone, a sidebar, a drawer): toolbar, result list and photo grid follow their own width (CSS size containers), so give one a width in a shrink-to-fit box.
598
599
  - `<uvalib-results-count shown total noun singular>`: the visible “Showing 48 of 3,694 shoots”, announced politely once it settles (1 s); never the first render, but the first count after an empty one (data loading) is. Leave `shown`/`total` unset while loading. Set `shown` and `total` after every filter change; do not add your own live region for the count. Not beside `<bento-box>` or `<uvalib-pagefind-search>`, which announce their own.
599
600
  - `<uvalib-tag-list label="Subjects" track-label limit="8" href-template="/search?q={tag}">` with `<a href>` or `<span>` children (or `items`): links are outlined pills, plain tags filled chips; a child's `lang`/`dir` and inline markup are kept; `limit` adds “Show all N”. Always set `label` (`hide-label` hides it visually). It reports tag clicks as `list N` and the tag's position, never the tag text; add `track-label` only when the label is fixed text you wrote, never one filled from a record.
600
- - Long result sets (hundreds or thousands of rows): `<ul class="uvalib-result-list">` of `<li class="uvalib-result">` rows holding `__meta` (badges, date), `__title` (the row's one link), `__snippet` (search terms in `<mark>`, drawn bold on `--uva-color-highlight`) and `__actions` (secondary buttons, each with a unique visually hidden name). Plain HTML, never a `<uvalib-card>` per row; rows skip rendering off screen (`content-visibility: auto`). A heading and a list per group for date order.
601
+ - Long result sets (hundreds or thousands of rows): `<ul class="uvalib-result-list">` of `<li class="uvalib-result">` rows holding `__meta` (badges, date), `__title` (the row's one link), `__snippet` (search terms in `<mark>`, drawn bold on `--uva-color-highlight`) and `__actions` (secondary buttons, each with a unique visually hidden name). Plain HTML, never a `<uvalib-card>` per row; rows skip rendering off screen (`content-visibility: auto`); the actions wrap below when the list itself is 40em or narrower. A heading and a list per group for date order.
601
602
  - No results: `.uvalib-empty-state` (decorative `__icon`, a heading, a sentence, one action). Loading: `.uvalib-skeleton` (give it a height, or `--media` for 3:2) and `.uvalib-skeleton-text` (one line), sized like what replaces them, inside an `aria-hidden="true"` container, with `aria-busy="true"` on the region while it loads.
602
603
 
603
604
  ```html snippet
@@ -723,8 +724,8 @@ Use these instead of a hand-built gallery or a carousel. There is no autoplay.
723
724
  - From the page: `open(idOrIndex)` (false if unknown) and `close({ focus })` (after deleting the open item; focus your heading); `uvalib-lightbox-open` (`{ id, index, restored }`) and `uvalib-lightbox-close` (`{ id, index, reason }`) report both. Never click the dialog's own Close.
724
725
  - `<uvalib-image-regions>` from `uvalib-image-regions.js`: numbered outlines on an image (people, objects, inscriptions) with a list of the same regions beside it. Write the page's own `<img width height alt>` and `<ol>` inside, each `<li data-xywh="percent:x,y,w,h">` (or pixels of the natural size, `160,120,320,240`; `image-width`/`image-height` for a IIIF derivative) holding the region's link and your own action buttons, which stay yours; or set `items` (`{ label, x, y, w, h, unit?, href?, description? }[]`). The list is the accessible route: the outlines are `aria-hidden`, not tab stops, and never the only place a name or action is; hovering or focusing an entry highlights its outline (thicker double outline and label) and back, and clicking an outline focuses its entry. `label` names the list. Listen for `uvalib-image-regions-activate` (an outline clicked, before its entry takes focus; `detail: { index, item, entry }`, `entry` the page's own `<li>`; cancelable, so the page can focus its own control in the entry, such as a "Who is this?" field) and `highlight`; never read the shadow DOM's outlines for it. Do not hand-build absolutely positioned outlines. It reports outline clicks itself (the list's label and the number, never a region's label).
725
726
  - Regions in the viewer: `data-regions` on a lightbox link (a JSON array, or `percent:10,20,30,40 Person 1; percent:55,15,20,30 Sign`), or the lightbox's `regions` callback (`({ element, id, href, index }) => regions`). The open image then shows the outlines, their list and a "Show regions" toggle; `regions-label` names the list. For your own buttons in each entry, `data-regions-list="<id>"` (or the `regionsList` callback) names a hidden `<ol>` of `<li data-xywh>` in the page: it is lent to the viewer (same nodes, your listeners and CSS keep working) and put back on close; give each action a unique name ("Confirm Tim Kaine"). In React, create that `<ol>` (and a details element) outside React and make it the `createPortal` target for the entries, never render it inside a portal (README "React and other frameworks").
726
- - Versions in the viewer: `data-versions='[{"label":"Original"},{"label":"AI colorization","href":"color.jpg","note":"The colours are an AI model’s guess."}]'` on a lightbox link (first entry = the link's image; or the `versions` callback) compares them over the photo, the comparison loaded on first use: Switch (default), Reveal (`compare="wipe"`, a divider: click the photo or the slider) or Fade; label AI versions as such and give them a `note`; a version with a different framing (AI-expanded frame, whole plate, crop) gives `"frame": "percent:x,y,w,h"` (the original's box in it; pixels need its `width`/`height`) and is drawn at the original's scale around it; `version-param` (with `url-param`) keeps `?version=wipe:40`; `uvalib-lightbox-version` reports changes.
727
- - `<uvalib-photo-grid>` from `uvalib-photo-grid.js`: justified rows. Each direct `<a href>` or `<button>` is one photo and stays a real control. The row is about 220px, and 140px at 767px and below, unless `row-height` is set (a bare number is pixels). Give each image `width` and `height` so the row does not jump when it loads. An image with no visible text gets a caption from its alt, and a repeated alt is cleared (the original is kept for a lightbox). A different alt is kept. Do not set an `aria-label` that differs from the visible text; the grid will not add a caption beside one. Generated "Photo N" captions renumber when the photos change order. A `<span slot="badge">` inside the item, or `data-badge` on it (“seq”, “3 photos”), is drawn over the thumbnail and stays in the accessible name; an existing `aria-label` gains the badge text. A grid inside a lightbox opens the viewer. The grid reports no analytics.
727
+ - Versions in the viewer: `data-versions='[{"label":"Original"},{"label":"AI colorization","href":"color.jpg","note":"The colours are an AI model’s guess."}]'` on a lightbox link (first entry = the link's image; or the `versions` callback) compares them over the photo, the comparison loaded on first use: Switch (default), Reveal (`compare="wipe"`, a divider: click the photo or the slider) or Fade; label AI versions as such and give them a `note`; a version with a different framing (AI-expanded frame, whole plate, crop) gives `"frame": "percent:x,y,w,h"` (the original's box in it; pixels need its `width`/`height`) and is drawn at the original's scale around it (a crop's frame goes past it: `percent:-25,-25,150,150`); `data-version="1"` (the `version-param` format) opens a link on that version, the original still first; `version-param` (with `url-param`) keeps `?version=wipe:40`; `uvalib-lightbox-version` reports changes.
728
+ - `<uvalib-photo-grid>` from `uvalib-photo-grid.js`: justified rows. Each direct `<a href>` or `<button>` is one photo and stays a real control. The row is about 220px, and 140px when the grid itself is under 48rem (also in a sidebar), unless `row-height` is set (a bare number is pixels). Give each image `width` and `height` so the row does not jump when it loads. An image with no visible text gets a caption from its alt, and a repeated alt is cleared (the original is kept for a lightbox). A different alt is kept. Do not set an `aria-label` that differs from the visible text; the grid will not add a caption beside one. Generated "Photo N" captions renumber when the photos change order. A `<span slot="badge">` inside the item, or `data-badge` on it (“seq”, “3 photos”), is drawn over the thumbnail and stays in the accessible name; an existing `aria-label` gains the badge text. A grid inside a lightbox opens the viewer. The grid reports no analytics.
728
729
 
729
730
  ```html snippet
730
731
  <!doctype html>
@@ -453,7 +453,7 @@ The UVA Library main navigation (About, Using the Library, Research & teaching s
453
453
  | `--uva-brand-blue` | `#232d4b` | Bar bottom border, chevrons, panel links, and the hover and expanded button text. |
454
454
  | `--uva-grey-100` | `#dadada` | Hover and expanded button background, and panel link hover background. |
455
455
  | `--uva-brand-orange` | `#e57200` | Focus ring colour, and the underline of the current page's link and group (also bold, with a 3px underline). |
456
- | `--uva-font-family` | `franklin-gothic-urw, Arial, Helvetica, sans-serif` | Font family. |
456
+ | `--uva-font-family` | `franklin-gothic-urw, "UVA Franklin Fallback", Arial, Helvetica, sans-serif` | Font family. |
457
457
  | `--uva-color-text` | | Dark-mode role token: top-level button text (else `--uva-grey-darkest`). |
458
458
  | `--uva-color-link` | | Dark-mode role token: chevrons, panel links, hover text and the focus ring over hover (else `--uva-brand-blue`). |
459
459
  | `--uva-color-surface-hover` | | Dark-mode role token: hover and open-group background (else `--uva-grey-100`). |
@@ -517,7 +517,7 @@ Page wrapper: skip link (inside the header landmark in shadow mode), header, a s
517
517
  |---|---|---|
518
518
  | `--uva-brand-blue` | `#232d4b` | Skip link background. |
519
519
  | `--uva-brand-orange` | `#e57200` | Focus ring colour (focus-visible outline). |
520
- | `--uva-font-family` | `franklin-gothic-urw, Arial, Helvetica, sans-serif` | Page font family (global styles). |
520
+ | `--uva-font-family` | `franklin-gothic-urw, "UVA Franklin Fallback", Arial, Helvetica, sans-serif` | Page font family (global styles). |
521
521
  | `--uva-font-size-base` | `17px` | Page base font size (global styles). |
522
522
  | `--uva-grey-darkest` | `#2b2b2b` | Page text colour (global styles). |
523
523
  | `--uva-color-surface` | | Dark-mode role token: page background (global styles; else none). |
@@ -549,7 +549,7 @@ Compatibility element. Light mode (`no-shadow-dom`) installs the tokens and base
549
549
 
550
550
  | Property | Default | Description |
551
551
  |---|---|---|
552
- | `--uva-font-family` | `franklin-gothic-urw, Arial, Helvetica, sans-serif` | Font family. |
552
+ | `--uva-font-family` | `franklin-gothic-urw, "UVA Franklin Fallback", Arial, Helvetica, sans-serif` | Font family. |
553
553
  | `--uva-font-size-base` | `17px` | Base font size. |
554
554
  | `--uva-grey-darkest` | `#2b2b2b` | Text colour. |
555
555
  | `--uva-color-text` | | Dark-mode role token: text colour (else `--uva-grey-darkest`). |
@@ -775,7 +775,7 @@ A row of chips: a segmented control or single-select filter (`mode="single"`), f
775
775
 
776
776
  ## `<uvalib-combobox>`
777
777
 
778
- An editable text field that suggests values as you type, from a local list or a URL: a person, place or subject picker. It follows the WAI-ARIA APG “Editable Combobox With List Autocomplete”: a real `<input role="combobox">` and a `role="listbox"` popup under it. Suggestions come from the `items` property (`{ value, label?, description?, disabled? }` objects, or strings), from `<option>` children (directly or inside a `<datalist>`; the `label` attribute or text is the label, `data-description` the second line), or from `src`, a URL template with `{q}` (fetched 250 ms after the last keystroke once the text has `min-length` characters, default 1; a newer keystroke aborts the older request; the response is a JSON array of the same shape, or anything `transform(data, query)` turns into one). `items` wins over the children while set. Local suggestions match anywhere in the label, ignoring case and accents, those starting with the text first, then those with a word starting with it; at most `max-results` (default 50, 0 for all) are shown, which keeps a list of 16,000 people fast. The matched text is bold and underlined in a `<mark>`. Keys: Down opens the list on the first suggestion and moves (wrapping), Up opens on the last, Alt+Down opens without moving, Alt+Up closes, Enter chooses the active suggestion (and then does not submit the form; with none active, Enter submits as in any field), Escape closes the list and a second Escape clears the field, Home, End, Left and Right move the caret, and Tab leaves without choosing. A real clear button (“Clear <label>”, 44px, shown only with text) empties the field and returns focus to it. Free text is allowed: `value` is whatever is in the field, and `selected` the chosen suggestion (or null); typing after choosing clears it, and leaving the field with text that is exactly one suggestion's label chooses it. `must-choose` makes any other text invalid (“Choose one of the suggestions.”). The element is form-associated: with `name` it submits the chosen suggestion's value, or else the text, and a form reset restores the `value` attribute. `required` and `disabled` (also from a disabled fieldset) work as on an input. A polite status says “5 suggestions”, “50 of 1,234 suggestions”, “No suggestions”, “Loading suggestions” or “Couldn't load suggestions” half a second after the list settles (never on the first render); the popup shows the same notes visibly. A failed load never throws. Before it upgrades, `base.css` shows the label (from the attribute) and holds the field's height. A fallback `<input list>` child works as a plain field meanwhile; on upgrade its text, `name` and `placeholder` carry over, and it is disabled so it does not submit twice.
778
+ An editable text field that suggests values as you type, from a local list or a URL: a person, place or subject picker. It follows the WAI-ARIA APG “Editable Combobox With List Autocomplete”: a real `<input role="combobox">` and a `role="listbox"` popup under it. Suggestions come from the `items` property (`{ value, label?, description?, disabled? }` objects, or strings), from `<option>` children (directly or inside a `<datalist>`; the `label` attribute or text is the label, `data-description` the second line), or from `src`, a URL template with `{q}` (fetched 250 ms after the last keystroke once the text has `min-length` characters, default 1; a newer keystroke aborts the older request; the response is a JSON array of the same shape, or anything `transform(data, query)` turns into one). `items` wins over the children while set. Local suggestions match anywhere in the label, ignoring case and accents, those starting with the text first, then those with a word starting with it; at most `max-results` (default 50, 0 for all) are shown, which keeps a list of 16,000 people fast. The matched text is bold and underlined in a `<mark>`. Keys: Down opens the list on the first suggestion and moves (wrapping), Up opens on the last, Alt+Down opens without moving, Alt+Up closes, Enter chooses the active suggestion (and then does not submit the form; with none active, Enter submits as in any field), Escape closes the list and a second Escape clears the field, Home, End, Left and Right move the caret, and Tab leaves without choosing. A real clear button (“Clear <label>”, 44px, shown only with text) empties the field and returns focus to it. Free text is allowed: `value` is whatever is in the field, and `selected` the chosen suggestion (or null); typing after choosing clears it, and leaving the field with text that is exactly one suggestion's label chooses it. `must-choose` makes any other text invalid (“Choose one of the suggestions.”). The element is form-associated: with `name` it submits the chosen suggestion's value, or else the text, and a form reset restores the `value` attribute. `required` and `disabled` (also from a disabled fieldset) work as on an input. A polite status says “5 suggestions”, “50 of 1,234 suggestions”, “No suggestions”, “Loading suggestions” or “Couldn't load suggestions” half a second after the list settles (never on the first render); the popup shows the same notes visibly. A failed load never throws. Where the browser supports the Popover API and CSS anchor positioning, the popup is a manual popover in the top layer, anchored under the field and as wide as it (above it when there is no room below), so an ancestor with `overflow: hidden` or a scrolling panel never clips it. Elsewhere it is positioned under the field inside the element, as before. Pages can style the runtime state with `:state(open)`, `:state(invalid)` and `:state(loading)` (no attributes are added). Before it upgrades, `base.css` shows the label (from the attribute) and holds the field's height. A fallback `<input list>` child works as a plain field meanwhile; on upgrade its text, `name` and `placeholder` carry over, and it is disabled so it does not submit twice.
779
779
 
780
780
  ### Attributes
781
781
 
@@ -806,6 +806,14 @@ An editable text field that suggests values as you type, from a local list or a
806
806
  | `option` | Each suggestion. |
807
807
  | `description` | The hint under the field. |
808
808
 
809
+ ### CSS states
810
+
811
+ | State | Description |
812
+ |---|---|
813
+ | `:state(open)` | The popup is showing (suggestions or a note such as “No suggestions”). |
814
+ | `:state(invalid)` | The text was shown as invalid (`aria-invalid="true"`: `must-choose` text that is not a suggestion, after leaving the field or pressing Enter). |
815
+ | `:state(loading)` | Suggestions from `src` are loading. |
816
+
809
817
  ### Events
810
818
 
811
819
  | Event | Description |
@@ -1022,7 +1030,7 @@ A faceted-search filter: a fieldset of checkboxes (value plus result count), opt
1022
1030
 
1023
1031
  ## `<uvalib-filter-drawer>`
1024
1032
 
1025
- A search page's form and filters: a plain sidebar on wide screens, and on narrow ones a “Search and filters” button that opens them in a modal panel from the side. Put the page's search form, `<uvalib-filter>`s and other facets inside. Above `breakpoint` (default `48rem`) they are shown as written: no button, no dialog role. At and below it only the button is shown; it opens a native `<dialog>` (`showModal()`) with a visible heading (the `label`) and a 44px Close button, which takes focus. Escape, Close and a click on the backdrop close it, and focus returns to the button; widening the window past the breakpoint closes it and keeps focus where it was. While it is open the rest of the page, including `<site-page>`'s header, skip link and alerts, is inert (the browser's modal dialog), so focus cannot leave it except to the browser itself, and nothing else is announced. The children are the same nodes in both layouts (moved, never re-created): typed text, checked boxes, listeners and each filter's state are kept. Inert content is not announced, so results counts and status notices outside the panel would go silent while the visitor filters: name them in `live` (space-separated ids) and the drawer repeats what they announce in its own polite live region while it is open. `count` (the page's number of active filters) is shown on the button when above 0. The drawer never counts by itself: only the page knows which inputs are filters.
1033
+ A search page's form and filters: a plain sidebar on wide screens, and on narrow ones a “Search and filters” button that opens them in a modal panel from the side. Put the page's search form, `<uvalib-filter>`s and other facets inside. Above `breakpoint` (default `48rem`) they are shown as written: no button, no dialog role. At and below it only the button is shown; it opens a native `<dialog>` (`showModal()`) with a visible heading (the `label`) and a 44px Close button, which takes focus. Escape, Close and a click on the backdrop close it, and focus returns to the button; widening the window past the breakpoint closes it and keeps focus where it was. While it is open the rest of the page, including `<site-page>`'s header, skip link and alerts, is inert (the browser's modal dialog), so focus cannot leave it except to the browser itself, and nothing else is announced. The children are the same nodes in both layouts (moved, never re-created): typed text, checked boxes, listeners and each filter's state are kept. Inert content is not announced, so results counts and status notices outside the panel would go silent while the visitor filters: name them in `live` (space-separated ids) and the drawer repeats what they announce in its own polite live region while it is open. `count` (the page's number of active filters) is shown on the button when above 0. The drawer never counts by itself: only the page knows which inputs are filters. Pages can style the runtime layout with `:state(modal)` (at or below the breakpoint: the button and panel) and `:state(open)` (the panel is open).
1026
1034
 
1027
1035
  ### Attributes
1028
1036
 
@@ -1054,6 +1062,13 @@ A search page's form and filters: a plain sidebar on wide screens, and on narrow
1054
1062
  | `close` | The Close button. |
1055
1063
  | `body` | The wrapper of the children, in the sidebar or the panel. |
1056
1064
 
1065
+ ### CSS states
1066
+
1067
+ | State | Description |
1068
+ |---|---|
1069
+ | `:state(modal)` | The viewport is at or below the breakpoint: the button and panel, not the sidebar. |
1070
+ | `:state(open)` | The panel is open. |
1071
+
1057
1072
  ### Events
1058
1073
 
1059
1074
  | Event | Description |
@@ -1136,7 +1151,7 @@ An image with numbered region outlines (people, objects, inscriptions) and a lis
1136
1151
 
1137
1152
  ## `<uvalib-lightbox>`
1138
1153
 
1139
- An accessible image viewer over a set of plain links. With JavaScript a primary click opens a modal dialog; without it (or with a modified click) the link opens the image as before. Wrap the links, or point at them with `selector` (for example `a.pb-image` on a reading page). There is no autoplay and no carousel. The dialog is labelled by the caption (`data-caption`, else the image alt, else the link text). Focus moves to Close on open and back to the trigger on close. Escape and a click on the backdrop close it. With more than one image, Previous and Next and the arrow keys move through the set (wrapping), and a polite “3 of 13” counter is shown. Full size opens the original image in a new tab. A IIIF Image API URL keeps its region; only the size becomes `!W,H` for the viewport. TIFF and JPEG2000 URLs are left as written. `url-param` (for example `photo`) keeps `?photo=<id>` in sync, including on a hash route (`#/text?photo=<id>`): opening pushes a history entry, stepping replaces it, and Back closes. Optional details: children with `slot="details"` (and `data-for` equal to the item's id or its position from 1; without `data-for` they show for every image), or `data-details-id` on a link pointing at an element elsewhere on the page. Either is shown inside the dialog and put back exactly (same place, `hidden` and `slot`) when the viewer moves on or closes. The `data-details-id` element stays in the page (in shadow mode it becomes a child of the lightbox slotted into the dialog), so `getElementById`, the page's CSS (except selectors through its old ancestors) and listeners keep working; nothing is cloned. Details that appear while their image is open (rendered after a fetch) are shown then. `open(idOrIndex)` and `close({ focus })` let the page open or close the viewer itself; `uvalib-lightbox-open` and `uvalib-lightbox-close` say when it did. Optional regions (people, objects, inscriptions): `data-regions` on a link, a JSON array of `{ label, x, y, w, h, unit? }` or `xywh` values each followed by its label, separated by `;` (`percent:10,20,30,40 Person 1; percent:55,15,20,30 Sign`), or the `regions` callback. The open image then shows numbered outlines (`<uvalib-image-regions>`, loaded on first use) and a list of the regions beside it, with a "Show regions" toggle (`aria-pressed`) that hides the outlines. Pixel regions are measured in `data-image-width` × `data-image-height` when set (the viewer shows a resized IIIF image), else in the image's natural size. Or the page's own list, with its own buttons: `data-regions-list="<id>"` on a link (or the `regionsList` callback) names an `<ol>` or `<ul>` of `<li data-xywh>` anywhere in the page, usually `hidden`. While that image is open the list (the same nodes, so the page's listeners keep working) is the region list: in shadow mode it becomes a child of the lightbox slotted into the viewer, not moved into the shadow root, so the page's CSS still applies to it. When the image changes or the viewer closes it goes back where it was, `hidden` as before. It wins over `data-regions`. Optional versions of an image (an original scan and an AI colorization, a restoration, an infrared capture): `data-versions` on a link, a JSON array of `{ label, href?, note? }` whose first entry is the link's own image, or the `versions` callback. The viewer then compares them over the photo (loaded on first use): Switch (a segmented control), Reveal (a divider: click or tap the photo, or use the slider) or Fade (a slider), `compare` choosing the first. A version's `note` shows under the photo while it is visible, and the image's accessible name ends with the label of the version shown. `version-param` (with `url-param`) keeps the comparison in the address: `?version=2` (Switch, the version from 0), `?version=wipe:40` or `?version=fade:60` (the percentage of the other version shown; `wipe:40:2` compares the original with version 2). A version with a different framing (an AI-expanded frame, a crop, the whole plate) gives `frame`, the original's box in it (`percent:x,y,w,h`, or pixels of its `width` × `height`): the viewer draws every version at the original's scale in one box, the original lined up, and regions stay on it.
1154
+ An accessible image viewer over a set of plain links. With JavaScript a primary click opens a modal dialog; without it (or with a modified click) the link opens the image as before. Wrap the links, or point at them with `selector` (for example `a.pb-image` on a reading page). There is no autoplay and no carousel. The dialog is labelled by the caption (`data-caption`, else the image alt, else the link text). Focus moves to Close on open and back to the trigger on close. Escape and a click on the backdrop close it. With more than one image, Previous and Next and the arrow keys move through the set (wrapping), and a polite “3 of 13” counter is shown. Full size opens the original image in a new tab. A IIIF Image API URL keeps its region; only the size becomes `!W,H` for the viewport. TIFF and JPEG2000 URLs are left as written. `url-param` (for example `photo`) keeps `?photo=<id>` in sync, including on a hash route (`#/text?photo=<id>`): opening pushes a history entry, stepping replaces it, and Back closes. Optional details: children with `slot="details"` (and `data-for` equal to the item's id or its position from 1; without `data-for` they show for every image), or `data-details-id` on a link pointing at an element elsewhere on the page. Either is shown inside the dialog and put back exactly (same place, `hidden` and `slot`) when the viewer moves on or closes. The `data-details-id` element stays in the page (in shadow mode it becomes a child of the lightbox slotted into the dialog), so `getElementById`, the page's CSS (except selectors through its old ancestors) and listeners keep working; nothing is cloned. Details that appear while their image is open (rendered after a fetch) are shown then. `open(idOrIndex)` and `close({ focus })` let the page open or close the viewer itself; `uvalib-lightbox-open` and `uvalib-lightbox-close` say when it did. Optional regions (people, objects, inscriptions): `data-regions` on a link, a JSON array of `{ label, x, y, w, h, unit? }` or `xywh` values each followed by its label, separated by `;` (`percent:10,20,30,40 Person 1; percent:55,15,20,30 Sign`), or the `regions` callback. The open image then shows numbered outlines (`<uvalib-image-regions>`, loaded on first use) and a list of the regions beside it, with a "Show regions" toggle (`aria-pressed`) that hides the outlines. Pixel regions are measured in `data-image-width` × `data-image-height` when set (the viewer shows a resized IIIF image), else in the image's natural size. Or the page's own list, with its own buttons: `data-regions-list="<id>"` on a link (or the `regionsList` callback) names an `<ol>` or `<ul>` of `<li data-xywh>` anywhere in the page, usually `hidden`. While that image is open the list (the same nodes, so the page's listeners keep working) is the region list: in shadow mode it becomes a child of the lightbox slotted into the viewer, not moved into the shadow root, so the page's CSS still applies to it. When the image changes or the viewer closes it goes back where it was, `hidden` as before. It wins over `data-regions`. Optional versions of an image (an original scan and an AI colorization, a restoration, an infrared capture): `data-versions` on a link, a JSON array of `{ label, href?, note? }` whose first entry is the link's own image, or the `versions` callback. The viewer then compares them over the photo (loaded on first use): Switch (a segmented control), Reveal (a divider: click or tap the photo, or use the slider) or Fade (a slider), `compare` choosing the first. A version's `note` shows under the photo while it is visible, and the image's accessible name ends with the label of the version shown. `version-param` (with `url-param`) keeps the comparison in the address: `?version=2` (Switch, the version from 0), `?version=wipe:40` or `?version=fade:60` (the percentage of the other version shown; `wipe:40:2` compares the original with version 2). `data-version` on a link (the same values) opens that image on that version, from a click, `open()` or Previous and Next; an address with `version-param` wins. A version with a different framing (an AI-expanded frame, a crop, the whole plate) gives `frame`, the original's box in it (`percent:x,y,w,h`, or pixels of its `width` × `height`): the viewer draws every version at the original's scale in one box, the original lined up, and regions stay on it. Pages can style the element while the viewer is open with `:state(open)`.
1140
1155
 
1141
1156
  ### Attributes
1142
1157
 
@@ -1170,6 +1185,12 @@ An accessible image viewer over a set of plain links. With JavaScript a primary
1170
1185
  | `regions` | The `<uvalib-image-regions>` around an image with regions. |
1171
1186
  | `compare` | The version comparison controls and notes under the photo. |
1172
1187
 
1188
+ ### CSS states
1189
+
1190
+ | State | Description |
1191
+ |---|---|
1192
+ | `:state(open)` | The viewer is open. |
1193
+
1173
1194
  ### Events
1174
1195
 
1175
1196
  | Event | Description |
@@ -1378,13 +1399,13 @@ Previous/next section links, as on a reading page, or a numbered page list. Prev
1378
1399
 
1379
1400
  ## `<uvalib-photo-grid>`
1380
1401
 
1381
- Justified rows of thumbnails. Each direct child that is a link or a button is one photo; its image keeps its shape from the `width` and `height` attributes, or from the loaded image, so the row does not jump when the picture arrives. The row is about 220px tall and shorter on a phone; `row-height` sets that height. Every item stays a real link or button. An image with no visible text gets a visible caption from its alt (the caption is then the accessible name, and a repeated alt is cleared). The original alt is kept in `data-uvalib-alt` so a lightbox still describes the picture. An item with no name at all is captioned “Photo N” and warned about once; that caption is renumbered when the photos change order. An `aria-label` is left as the name: the grid does not add a caption that would disagree with it. Put the grid inside `<uvalib-lightbox>` and a plain click opens the viewer. A badge sits on the thumbnail: `<span slot="badge">` inside the link or button, or `data-badge` on that item (for example “seq” or “3 photos”). It is read after the caption (“The Lawn, 3 photos”). When the item already has an `aria-label`, the badge is appended to that label (the author’s words stay in `data-uvalib-label`) and an alt that repeats those words is cleared. A badge does not replace the alt caption.
1402
+ Justified rows of thumbnails. Each direct child that is a link or a button is one photo; its image keeps its shape from the `width` and `height` attributes, or from the loaded image, so the row does not jump when the picture arrives. The row is about 220px tall and shorter when the grid is narrow (a phone, a sidebar); `row-height` sets that height. Every item stays a real link or button. An image with no visible text gets a visible caption from its alt (the caption is then the accessible name, and a repeated alt is cleared). The original alt is kept in `data-uvalib-alt` so a lightbox still describes the picture. An item with no name at all is captioned “Photo N” and warned about once; that caption is renumbered when the photos change order. An `aria-label` is left as the name: the grid does not add a caption that would disagree with it. Put the grid inside `<uvalib-lightbox>` and a plain click opens the viewer. A badge sits on the thumbnail: `<span slot="badge">` inside the link or button, or `data-badge` on that item (for example “seq” or “3 photos”). It is read after the caption (“The Lawn, 3 photos”). When the item already has an `aria-label`, the badge is appended to that label (the author’s words stay in `data-uvalib-label`) and an alt that repeats those words is cleared. A badge does not replace the alt caption.
1382
1403
 
1383
1404
  ### Attributes
1384
1405
 
1385
1406
  | Attribute | Type | Default | Description |
1386
1407
  |---|---|---|---|
1387
- | `row-height` | `string` | `''` | Row height. A bare number is pixels (`220` is 220px); `px`, `rem`, `em`, `vh`, `vw`, `vmin`, `vmax`, `ch` and `%` are kept. Empty uses 220px, or 140px when the viewport is 767px or narrower. |
1408
+ | `row-height` | `string` | `''` | Row height. A bare number is pixels (`220` is 220px); `px`, `rem`, `em`, `vh`, `vw`, `vmin`, `vmax`, `ch` and `%` are kept. Empty uses 220px, or 140px when the grid itself is narrower than 48rem (a phone, a sidebar, a drawer). |
1388
1409
  | `no-shadow-dom` | `boolean` | `false` | |
1389
1410
  | `no-style` | `boolean` | `false` | |
1390
1411
 
@@ -1478,7 +1499,7 @@ Tabs, as on library.virginia.edu: a row of buttons over one visible panel. Each
1478
1499
 
1479
1500
  ## `<uvalib-tag-list>`
1480
1501
 
1481
- A labelled list of keywords or subjects that wraps: each tag a link (for example a search for that term) or plain text. Link tags are outlined pills in the link colour; plain tags are filled chips (the card chip's colours), so a link never looks like a label. Every tag and the toggle are at least 2rem (34px) tall and wide, 0.5rem apart. Give the tags as children: `<a href>` for a link, any other element (`<span>`) for plain text. A child's `lang` and `dir` are kept, and so is inline markup inside it (`em`, `cite`, `abbr`, `bdi`, a `span lang`…), copied element by element (never parsed as HTML). Or set `href-template` (with `{tag}`, replaced by the URL-encoded text) to make every tag without its own href a link; a blank href counts as none. Apps can set the `items` property (`{ label, href?, lang?, dir? }`) instead; it wins over the children. Children with no text are skipped with one warning. `label` names the list (shown above it, or visually hidden with `hide-label`); without one a console warning is logged. `limit` shows that many tags and a “Show all N” button (`aria-expanded`, `aria-controls`), which reveals the rest in place and keeps focus. Analytics never sends a tag's text (record tags can be user-submitted or machine-made), and by default not the label either, which a template may fill from a record: the name is the list's place among the tag lists on the page, `list N`. Add `track-label` when the label is fixed text the page author wrote (“Subjects”), to send it instead.
1502
+ A labelled list of keywords or subjects that wraps: each tag a link (for example a search for that term) or plain text. Link tags are outlined pills in the link colour; plain tags are filled chips (the card chip's colours), so a link never looks like a label. Every tag and the toggle are at least 2rem (34px) tall and wide, 0.5rem apart. Give the tags as children: `<a href>` for a link, any other element (`<span>`) for plain text. A child's `lang` and `dir` are kept, and so is inline markup inside it (`em`, `cite`, `abbr`, `bdi`, a `span lang`…), copied element by element (never parsed as HTML). Or set `href-template` (with `{tag}`, replaced by the URL-encoded text) to make every tag without its own href a link; a blank href counts as none. Apps can set the `items` property (`{ label, href?, lang?, dir? }`) instead; it wins over the children. Children with no text are skipped with one warning. `label` names the list (shown above it, or visually hidden with `hide-label`); without one a console warning is logged. `limit` shows that many tags and a “Show all N” button (`aria-expanded`, `aria-controls`), which reveals the rest in place and keeps focus. Pages can style the list while every tag is shown with `:state(expanded)`. Analytics never sends a tag's text (record tags can be user-submitted or machine-made), and by default not the label either, which a template may fill from a record: the name is the list's place among the tag lists on the page, `list N`. Add `track-label` when the label is fixed text the page author wrote (“Subjects”), to send it instead.
1482
1503
 
1483
1504
  ### Attributes
1484
1505
 
@@ -1492,6 +1513,12 @@ A labelled list of keywords or subjects that wraps: each tag a link (for example
1492
1513
  | `no-shadow-dom` | `boolean` | `false` | |
1493
1514
  | `no-style` | `boolean` | `false` | |
1494
1515
 
1516
+ ### CSS states
1517
+
1518
+ | State | Description |
1519
+ |---|---|
1520
+ | `:state(expanded)` | Show all was pressed: every tag is shown (the toggle's `aria-expanded="true"`). |
1521
+
1495
1522
  ### Events
1496
1523
 
1497
1524
  | Event | Description |
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-BI8h0Gf3.js","names":["i","tokens","TYPEKIT_URL","base"],"sources":["../../src/styles/tokens.ts","../../src/styles/base.ts"],"sourcesContent":["// GENERATED by scripts/sync-tokens.mjs from ../monorepo/packages/drupal_library_theme/src/scss/base — do not edit\nimport { css } from 'lit';\n\nexport const tokens = css`\n :root {\n --uva-brand-blue-lightest: #87B9D9;\n --uva-brand-blue-lighter: #3395D4;\n --uva-brand-blue-light: #0370B7;\n --uva-brand-blue-base: #232D4B;\n --uva-brand-blue-300: #87B9D9;\n --uva-brand-blue-200: #3395D4;\n --uva-brand-blue-100: #0370B7;\n --uva-brand-blue: #232D4B;\n --uva-brand-orange-lightest: #FFEAD6;\n --uva-brand-orange-lighter: #FFC999;\n --uva-brand-orange-light: #FFB370;\n --uva-brand-orange-base: #E57200;\n --uva-brand-orange-dark: #B35900;\n --uva-brand-orange-darker: #854200;\n --uva-brand-orange-300: #FFEAD6;\n --uva-brand-orange-200: #FFC999;\n --uva-brand-orange-100: #FFB370;\n --uva-brand-orange: #E57200;\n --uva-brand-orange-A: #B35900;\n --uva-brand-orange-B: #854200;\n --uva-blue-alt-lightest: #BFE7F7;\n --uva-blue-alt-lighter: #91D8F2;\n --uva-blue-alt-light: #55C4EC;\n --uva-blue-alt-base: #007BAC;\n --uva-blue-alt-dark: #005679;\n --uva-blue-alt-darkest: #141E3C;\n --uva-blue-alt-400: #e6f2f7;\n --uva-blue-alt-300: #BFE7F7;\n --uva-blue-alt-200: #91D8F2;\n --uva-blue-alt-100: #55C4EC;\n --uva-blue-alt: #007BAC;\n --uva-blue-alt-A: #005679;\n --uva-blue-alt-B: #141E3C;\n --uva-teal-lightest: #C8F2F4;\n --uva-teal-light: #5BD7DE;\n --uva-teal-base: #25CAD3;\n --uva-teal-dark: #1DA1A8;\n --uva-teal-darker: #16777C;\n --uva-teal-200: #C8F2F4;\n --uva-teal-100: #5BD7DE;\n --uva-teal: #25CAD3;\n --uva-teal-A: #1DA1A8;\n --uva-teal-B: #16777C;\n --uva-green-lightest: #DDEFDC;\n --uva-green-lighter: #89CC74;\n --uva-green-base: #62BB46;\n --uva-green-dark: #4E9737;\n --uva-green-200: #DDEFDC;\n --uva-green-100: #89CC74;\n --uva-green: #62BB46;\n --uva-green-A: #4E9737;\n --uva-red-lightest: #FBCFDA;\n --uva-red-base: #EF3F6B;\n --uva-red-dark: #DF1E43;\n --uva-red-darker: #B30000;\n --uva-red-100: #FBCFDA;\n --uva-red: #EF3F6B;\n --uva-red-A: #DF1E43;\n --uva-red-B: #B30000;\n --uva-yellow-lightest: #FEF6C8;\n --uva-yellow-base: #ECC602;\n --uva-yellow-dark: #B99C02;\n --uva-yellow-100: #FEF6C8;\n --uva-yellow: #ECC602;\n --uva-yellow-A: #B99C02;\n --uva-grey-lightest: #F1F1F1;\n --uva-grey-light: #DADADA;\n --uva-grey-base: #808080;\n --uva-grey-dark: #4F4F4F;\n --uva-grey-darkest: #2B2B2B;\n --uva-grey-200: #F1F1F1;\n --uva-grey-100: #DADADA;\n --uva-grey-50: #ADADAD;\n --uva-grey: #808080;\n --uva-grey-A: #4F4F4F;\n --uva-grey-B: #2B2B2B;\n --uva-font-family: franklin-gothic-urw, Arial, Helvetica, sans-serif;\n --uva-font-size-base: 17px;\n }\n`;\n","import { css } from 'lit';\n\nexport const TYPEKIT_URL = 'https://use.typekit.net/oym8nvz.css';\n\n// The body background has no fallback: without dark mode it stays transparent, as before.\n//\n// site-page:not(:defined) applies when base.css is linked in <head>, before the element\n// upgrades: its own formatting context (flow-root), so a heading's top margin cannot collapse\n// through to <body> and shift the page once the element upgrades, and invisible, so its\n// content does not paint above where the header will go. If the script never loads, the\n// content appears anyway after two seconds.\nexport const base = css`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n html,\n body {\n font-family: var(--uva-font-family, franklin-gothic-urw, Arial, Helvetica, sans-serif);\n }\n html {\n font-size: var(--uva-font-size-base, 17px);\n }\n body {\n margin: 0;\n line-height: 1.5;\n min-height: 100vh;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n background-color: var(--uva-color-surface);\n }\n site-page:not(:defined) {\n display: flow-root;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-breadcrumbs:not(:defined),\n uvalib-card:not(:defined),\n uvalib-card-grid:not(:defined),\n uvalib-pager:not(:defined),\n uvalib-contents:not(:defined),\n uvalib-metadata:not(:defined),\n uvalib-tag-list:not(:defined) {\n display: block;\n line-height: 1.5;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n /* A chip row: hidden, one 44px row tall (with the scrolling row's padding), the raw\n children kept on one line so they cannot make it taller. */\n uvalib-chip-group:not(:defined) {\n display: block;\n min-height: 44px;\n max-width: 100%;\n overflow: hidden;\n white-space: nowrap;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-chip-group[scroll]:not(:defined) {\n min-height: calc(44px + 0.75rem);\n }\n /* A description: one line of it (0.875rem at 1.5, 0.25rem below the row). */\n uvalib-chip-group[description]:not(:defined) {\n padding-block-end: 1.5625rem;\n }\n /* Its text is drawn from attributes: hold one line until it upgrades. */\n uvalib-results-count:not(:defined) {\n display: block;\n min-block-size: 1.5em;\n }\n uvalib-tag-list:not(:defined)[hidden],\n uvalib-results-count:not(:defined)[hidden] {\n display: none;\n }\n /* The pre-upgrade rules here set display, which beats the hidden attribute's (issue #7).\n More specific than each of them (two pseudo-classes or attributes), so it needs no importance flag. */\n :where(\n site-page,\n uvalib-breadcrumbs,\n uvalib-card,\n uvalib-card-grid,\n uvalib-pager,\n uvalib-contents,\n uvalib-metadata,\n uvalib-chip-group,\n uvalib-tabs,\n uvalib-combobox,\n uvalib-image-regions,\n uvalib-map,\n uvalib-filter-drawer\n ):not(:defined)[hidden],\n :where(uvalib-combobox, uvalib-image-regions):not(:defined) > [hidden] {\n display: none;\n }\n /* Tabs stay readable before the script runs: a block, one panel, and a gap the\n size of the tab row (44px) plus its 1rem margin, so the first panel does not\n jump when the element upgrades. Later data-tab panels stay hidden. */\n uvalib-tabs:not(:defined) {\n display: block;\n padding-block-start: calc(44px + 1rem);\n }\n uvalib-tabs:not(:defined) > [data-tab] ~ [data-tab] {\n display: none;\n }\n /* A combobox: its label (from the attribute) and one 44px field (plus a one-line\n description) held, so nothing moves when it upgrades. A fallback <input list> child\n works meanwhile; the other children (options, a datalist) stay out of sight. */\n uvalib-combobox:not(:defined) {\n display: block;\n min-block-size: calc(1.5em + 0.25rem + 44px);\n line-height: 1.5;\n }\n uvalib-combobox[description]:not(:defined) {\n min-block-size: calc(3em + 0.5rem + 44px);\n }\n uvalib-combobox:not(:defined)::before {\n content: attr(label);\n display: block;\n margin-block-end: 0.25rem;\n font-weight: 600;\n }\n uvalib-combobox:not(:defined) > :not(input) {\n display: none;\n }\n uvalib-combobox:not(:defined) > input {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: 44px;\n font: inherit;\n line-height: 1.2;\n }\n /* Image regions: the image at its own width and the list beside it (or under it), the\n layout the element keeps once it upgrades, so the image does not move. */\n uvalib-image-regions:not(:defined) {\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n align-items: flex-start;\n }\n uvalib-image-regions:not(:defined) > :is(img, picture) {\n display: block;\n flex: 0 1 auto;\n min-width: 0;\n max-width: 100%;\n height: auto;\n }\n uvalib-image-regions:not(:defined) > :is(ol, ul) {\n flex: 1 1 14rem;\n min-width: 0;\n }\n /* A map: its key instructions (the same text it shows) and the map's height held above\n the child list, so the list does not move when the map is drawn over the page's\n Leaflet. Padding, not margin, so it cannot collapse with the list's own top margin. */\n uvalib-map:not(:defined) {\n display: block;\n }\n uvalib-map:not(:defined)::before {\n content: 'Tab or arrow keys move between places; Enter opens one. With the map focused, arrow keys pan and + and − zoom.';\n display: block;\n padding-block-end: calc(0.5rem + max(12rem, var(--uvalib-map-height, min(24rem, 75vw))));\n font-size: 0.875rem;\n line-height: 1.5;\n color: var(--uva-color-text-muted, #4b5563);\n }\n /* A filter drawer on a phone (the default 48rem breakpoint): once it upgrades only its 44px\n \"Search and filters\" button shows, so hold that height and keep the form and filters out\n of sight meanwhile; nothing moves when it upgrades. A page with its own breakpoint adds the\n same two rules in a media query of that width (see the README). Low specificity, so the\n [hidden] rule above still wins. */\n @media (max-width: 48rem) {\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) {\n display: block;\n min-block-size: 44px;\n }\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) > * {\n display: none;\n }\n }\n /* Printing a <site-page> (issue #20; its own styles leave out the chrome): a dark scheme\n prints light (the role tokens resolve to their light values), and the content's links\n are black and underlined, so they are told apart without colour. Content is <main> in\n light DOM and the unslotted children in shadow DOM. print-chrome keeps the page as it is\n shown, apart from the light scheme. */\n @media print {\n :root[data-uva-color-scheme]:has(site-page) {\n color-scheme: light;\n --uva-color-scheme: light;\n }\n /* Light DOM's trail, here too, as the pre-upgrade rule above (unlayered) would win. */\n site-page:not([print-chrome]) > [slot='breadcrumbs'] {\n display: none;\n }\n site-page:not([print-chrome]) > :not([slot], site-header, site-footer, .alerts-list) :any-link,\n site-page:not([print-chrome]) > :any-link:not([slot], .skip-link) {\n color: #000;\n text-decoration: underline;\n }\n }\n @keyframes uvalib-site-page-reveal {\n to {\n visibility: visible;\n }\n }\n`;\n"],"mappings":";;AAGA,IAAaC,IAAS,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCDZC,IAAc,uCASdC,IAAO,CAAG"}