@uvalib/web-components 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +515 -47
  3. package/dist/base/url-param.d.ts +23 -0
  4. package/dist/base/url-param.js +49 -0
  5. package/dist/base/url-param.js.map +1 -0
  6. package/dist/base.css +289 -1
  7. package/dist/components/uvalib-card/UvalibCard.d.ts +19 -5
  8. package/dist/components/uvalib-card/UvalibCard.js +112 -9
  9. package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
  10. package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +156 -0
  11. package/dist/components/uvalib-chip-group/UvalibChipGroup.js +747 -0
  12. package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -0
  13. package/dist/components/uvalib-chip-group/uvalib-chip-group.d.ts +1 -0
  14. package/dist/components/uvalib-chip-group/uvalib-chip-group.js +4 -0
  15. package/dist/components/uvalib-chip-group/uvalib-chip-group.js.map +1 -0
  16. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +148 -0
  17. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +1248 -0
  18. package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -0
  19. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.d.ts +1 -0
  20. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js +4 -0
  21. package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js.map +1 -0
  22. package/dist/components/uvalib-lightbox/UvalibLightbox.js +8 -1
  23. package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
  24. package/dist/components/uvalib-lightbox/media.d.ts +1 -18
  25. package/dist/components/uvalib-lightbox/media.js +1 -42
  26. package/dist/components/uvalib-lightbox/media.js.map +1 -1
  27. package/dist/components/uvalib-pager/UvalibPager.d.ts +58 -4
  28. package/dist/components/uvalib-pager/UvalibPager.js +232 -8
  29. package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
  30. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +27 -1
  31. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +192 -26
  32. package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
  33. package/dist/components/uvalib-results-count/UvalibResultsCount.d.ts +62 -0
  34. package/dist/components/uvalib-results-count/UvalibResultsCount.js +208 -0
  35. package/dist/components/uvalib-results-count/UvalibResultsCount.js.map +1 -0
  36. package/dist/components/uvalib-results-count/uvalib-results-count.d.ts +1 -0
  37. package/dist/components/uvalib-results-count/uvalib-results-count.js +4 -0
  38. package/dist/components/uvalib-results-count/uvalib-results-count.js.map +1 -0
  39. package/dist/components/uvalib-tabs/UvalibTabs.d.ts +127 -0
  40. package/dist/components/uvalib-tabs/UvalibTabs.js +821 -0
  41. package/dist/components/uvalib-tabs/UvalibTabs.js.map +1 -0
  42. package/dist/components/uvalib-tabs/uvalib-tabs.d.ts +1 -0
  43. package/dist/components/uvalib-tabs/uvalib-tabs.js +4 -0
  44. package/dist/components/uvalib-tabs/uvalib-tabs.js.map +1 -0
  45. package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +89 -0
  46. package/dist/components/uvalib-tag-list/UvalibTagList.js +411 -0
  47. package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -0
  48. package/dist/components/uvalib-tag-list/uvalib-tag-list.d.ts +1 -0
  49. package/dist/components/uvalib-tag-list/uvalib-tag-list.js +4 -0
  50. package/dist/components/uvalib-tag-list/uvalib-tag-list.js.map +1 -0
  51. package/dist/custom-elements.json +7140 -2630
  52. package/dist/index.d.ts +8 -0
  53. package/dist/index.js +5 -0
  54. package/dist/index.js.map +1 -1
  55. package/dist/styles/base.js +35 -1
  56. package/dist/styles/base.js.map +1 -1
  57. package/dist/styles/color-scheme.js +4 -0
  58. package/dist/styles/color-scheme.js.map +1 -1
  59. package/dist/styles/controls.js +2 -0
  60. package/dist/styles/controls.js.map +1 -1
  61. package/dist/styles/results.d.ts +1 -0
  62. package/dist/styles/results.js +257 -0
  63. package/dist/styles/results.js.map +1 -0
  64. package/dist/tokens.css +4 -0
  65. package/dist-cdn/base.css +289 -1
  66. package/dist-cdn/chunks/{base-CAFQWnZG.js → base-p5pk0vb2.js} +36 -2
  67. package/dist-cdn/chunks/{base-CAFQWnZG.js.map → base-p5pk0vb2.js.map} +1 -1
  68. package/dist-cdn/chunks/inline-copy-BANQSMIR.js +69 -0
  69. package/dist-cdn/chunks/inline-copy-BANQSMIR.js.map +1 -0
  70. package/dist-cdn/chunks/{site-header-C9V7Wuw2.js → site-header-BlOYvQg1.js} +5 -1
  71. package/dist-cdn/chunks/site-header-BlOYvQg1.js.map +1 -0
  72. package/dist-cdn/chunks/source-children-BHsDwCvL.js +53 -0
  73. package/dist-cdn/chunks/source-children-BHsDwCvL.js.map +1 -0
  74. package/dist-cdn/chunks/url-param-C1sk_F1d.js +28 -0
  75. package/dist-cdn/chunks/url-param-C1sk_F1d.js.map +1 -0
  76. package/dist-cdn/custom-elements.json +7140 -2630
  77. package/dist-cdn/manifest.json +7 -2
  78. package/dist-cdn/site-header.js +1 -1
  79. package/dist-cdn/site-page.js +2 -2
  80. package/dist-cdn/site-style.js +1 -1
  81. package/dist-cdn/skills/uvalib-web-components/SKILL.md +179 -19
  82. package/dist-cdn/skills/uvalib-web-components/reference/components.md +220 -6
  83. package/dist-cdn/tokens.css +4 -0
  84. package/dist-cdn/uvalib-card.js +94 -20
  85. package/dist-cdn/uvalib-card.js.map +1 -1
  86. package/dist-cdn/uvalib-chip-group.js +496 -0
  87. package/dist-cdn/uvalib-chip-group.js.map +1 -0
  88. package/dist-cdn/uvalib-contents.js +2 -1
  89. package/dist-cdn/uvalib-contents.js.map +1 -1
  90. package/dist-cdn/uvalib-date-histogram.js +850 -0
  91. package/dist-cdn/uvalib-date-histogram.js.map +1 -0
  92. package/dist-cdn/uvalib-lightbox.js +26 -48
  93. package/dist-cdn/uvalib-lightbox.js.map +1 -1
  94. package/dist-cdn/uvalib-metadata.js +2 -1
  95. package/dist-cdn/uvalib-metadata.js.map +1 -1
  96. package/dist-cdn/uvalib-pager.js +141 -7
  97. package/dist-cdn/uvalib-pager.js.map +1 -1
  98. package/dist-cdn/uvalib-photo-grid.js +121 -19
  99. package/dist-cdn/uvalib-photo-grid.js.map +1 -1
  100. package/dist-cdn/uvalib-results-count.js +101 -0
  101. package/dist-cdn/uvalib-results-count.js.map +1 -0
  102. package/dist-cdn/uvalib-tabs.js +436 -0
  103. package/dist-cdn/uvalib-tabs.js.map +1 -0
  104. package/dist-cdn/uvalib-tag-list.js +267 -0
  105. package/dist-cdn/uvalib-tag-list.js.map +1 -0
  106. package/package.json +24 -3
  107. package/skills/uvalib-web-components/SKILL.md +179 -19
  108. package/skills/uvalib-web-components/reference/components.md +220 -6
  109. package/dist-cdn/chunks/site-header-C9V7Wuw2.js.map +0 -1
  110. package/dist-cdn/chunks/source-children-RuAec527.js +0 -119
  111. package/dist-cdn/chunks/source-children-RuAec527.js.map +0 -1
@@ -613,13 +613,14 @@ A breadcrumb trail, as on library.virginia.edu: links separated by slashes, endi
613
613
 
614
614
  ## `<uvalib-card>`
615
615
 
616
- One card: a collection (title and “N texts”), a photo (image, count, date, category, title, excerpt) or any other raised summary. With `href`, the heading is the link and a pseudo-element stretches that link over the card, so the whole card is one click. The arrow is only a visual aid. The card is never wrapped in an `<a>`. A clickable card must not contain another link, button or other control: the stretched link covers it. A static card (no `href`, or an empty or unsafe one) has no stretch, so its excerpt may contain links. With `href`, the heading needs an accessible name (text, or an image `alt` or `aria-label`); otherwise the link is hidden. Regions are light-DOM children. Give `slot="media"`, `slot="badge"`, `slot="heading"`, `slot="meta"` or `slot="chip"`; anything else (including text) is the excerpt. An image needs a real alt, or `alt=""` when the heading already names it. A date belongs in `<time>` in the meta slot. One element per chip. The heading level defaults like `<events-section>`: one below the nearest heading before the card, or 3 when there is none. `heading-level` (1–6) wins. An invalid value is ignored.
616
+ One card: a collection (title and “N texts”), a photo (image, count, date, category, title, excerpt) or any other raised summary. With `href`, the heading is the link and a pseudo-element stretches that link over the card, so the whole card is one click. The arrow is only a visual aid. The card is never wrapped in an `<a>`. A clickable card must not contain another link, button or other control: the stretched link covers it. A static card (no `href`, or an empty or unsafe one) has no stretch, so its excerpt and `actions` slot may contain links. With `href`, the heading needs an accessible name (text, or an image `alt` or `aria-label`); otherwise the link is hidden. `media-shape="circle"` draws the media as a centered circle, for a person or avatar. The image keeps its alt, and the count badge still sits on it. Any other shape is ignored. Regions are light-DOM children. Give `slot="media"`, `slot="badge"`, `slot="heading"`, `slot="meta"`, `slot="chip"` or `slot="actions"`; anything else (including text) is the excerpt. An image needs a real alt, or `alt=""` when the heading already names it. A date belongs in `<time>` in the meta slot. One element per chip. `actions` is a row of links or buttons on a static card (“Read the story”, “Photos (132)”). The heading level defaults like `<events-section>`: one below the nearest heading before the card, or 3 when there is none. `heading-level` (1–6) wins. An invalid value is ignored.
617
617
 
618
618
  ### Attributes
619
619
 
620
620
  | Attribute | Type | Default | Description |
621
621
  |---|---|---|---|
622
622
  | `href` | `string \| undefined` | | Makes the card one link: the heading stretches over the card. Empty is not a link. |
623
+ | `media-shape` | `string` | `''` | `circle` crops the media to a centered circle and keeps the image alt. Anything else is ignored, with one console warning. |
623
624
  | `heading-level` | `number \| undefined` | | Heading level of the title, 1–6. Unset, it is one below the nearest heading before this card, or 3 when there is none. Any other value is ignored. |
624
625
  | `no-shadow-dom` | `boolean` | `false` | |
625
626
  | `no-style` | `boolean` | `false` | |
@@ -633,6 +634,7 @@ One card: a collection (title and “N texts”), a photo (image, count, date, c
633
634
  | `heading` | The card title. With `href`, this heading’s link is the card, so it needs an accessible name. |
634
635
  | `meta` | Date (`<time>`) or byline, under the title. |
635
636
  | `chip` | Category. One element per chip. |
637
+ | `actions` | Links or buttons on a static card. A clickable card must not contain them; the card link covers them. |
636
638
  | (default) | Excerpt. A static card may put links here; a clickable card must not contain other controls. |
637
639
 
638
640
  ### Events
@@ -684,6 +686,45 @@ A grid of `<uvalib-card>` elements. It is a list, so a screen reader announces h
684
686
  |---|---|---|
685
687
  | `--uvalib-card-min` | | Set from `min-card-width` when that value is a length. The grid uses it as the `auto-fill` minimum. |
686
688
 
689
+ ## `<uvalib-chip-group>`
690
+
691
+ A row of chips: a segmented control or single-select filter (`mode="single"`), filter chips that toggle (`mode="multi"`), or suggestion chips that go somewhere (`mode="links"`), as in a year rail with counts (“2005 213”), a sort toggle (“Most photos \| Date \| Title A–Z”) or “Try: snow on the Lawn”. Give the chips as children, `<button value="2005" data-count="213">2005</button>` (the value is the `value` attribute, else `data-value`, else the text; `disabled` disables), or `<a href>` in `links` mode, or set the `items` property (`{ value, label, count?, href?, disabled? }`), which wins over the children while set. The chips follow later changes to the children. `single`: native radios drawn as chips, in a `role="radiogroup"` named by `label`. Tab enters the group at the selected chip, the arrow keys move and select (as any radio group), and `value` is the selected chip's value. `multi`: toggle buttons with `aria-pressed`, and `value` is an array (as an attribute, comma-separated). `links`: links, or buttons that fire `select`, with no selected state; a chip whose href is unsafe (`javascript:`) is plain text, and an empty href is a button. A count is shown in a smaller muted span after the label and read as part of the name: “2005, 213 items”, with `count-label` in place of “items”. A selected chip is filled, keeps its border and shows a tick. Chips wrap on a narrow screen; `scroll` keeps them on one row that scrolls sideways, with its scrollbar shown and a fade at an edge with more chips. Each chip is a target at least 44px square. `segmented` joins the chips into one bar that does not wrap (a long label wraps inside its segment), like the header's Light / Dark / System control. `url-param` (for example `year`) keeps the value in the address (`?year=2005`, a multi value comma-separated, inside the hash on a hash route). It is read on connect; the markup's `value` stands for the address without the parameter, and any other value is written, an empty one as `?year=`. Each change is one `pushState`: in `multi` at once, in `single` once the visitor settles (a second after the last change, so arrowing through a year rail adds one entry, none if it ends where it started). Back and Forward are followed and fire `change` with `restored: true`.
692
+
693
+ ### Attributes
694
+
695
+ | Attribute | Type | Default | Description |
696
+ |---|---|---|---|
697
+ | `mode` | `ChipGroupMode` | `'single'` | `single` (radios: one value), `multi` (toggles: an array of values) or `links`. |
698
+ | `label` | `string` | `''` | The group's accessible name (required), also the first part of the analytics name. |
699
+ | `value` | `string \| string[]` | `''` | The selection: a chip's value in `single`, an array of values in `multi` (as an attribute, comma-separated). Setting it does not fire `change`. Unused in `links`. |
700
+ | `count-label` | `string` | `'items'` | The word after a count in each chip's accessible name: “2005, 213 items”. |
701
+ | `scroll` | `boolean` | `false` | One row that scrolls sideways instead of wrapping. |
702
+ | `segmented` | `boolean` | `false` | Join the chips into one segmented bar. |
703
+ | `url-param` | `string` | `''` | Query parameter that keeps the value in the address, for example `year` → `?year=2005`. |
704
+ | `no-shadow-dom` | `boolean` | `false` | |
705
+ | `no-style` | `boolean` | `false` | |
706
+
707
+ ### Events
708
+
709
+ | Event | Description |
710
+ |---|---|
711
+ | `change` | The visitor changed the selection (`single`, `multi`), or Back or Forward changed it through `url-param`: `detail` is `{ value, restored? }` (a string in `single`, an array in `multi`; `restored` is true for Back and Forward). Not fired when the app sets `value`. Bubbles and is composed. |
712
+ | `select` | `links` mode: a chip was chosen. `detail` is `{ value, href? }`. For a link, a plain primary click fires it cancelable: cancel it (`preventDefault()`) to route in the app, and the click's default is prevented too. Bubbles and is composed. |
713
+ | `uvalib-analytics-event` | For `<site-analytics>`, on the visitor's actions only: `['uvalib-chip-group', 'change', '<label>: <chip label>', <count>?]` (in `single`, one second after the last change, for the chip then selected; in `multi`, for the chip toggled), and `['uvalib-chip-group', 'select', '<label>']` in `links` mode (never the chip or its URL). The count is sent when it is a number. Bubbles and is composed. |
714
+
715
+ ### CSS custom properties
716
+
717
+ | Property | Default | Description |
718
+ |---|---|---|
719
+ | `--uva-color-surface-raised` | | Dark-mode role token: chip background (else #fff). |
720
+ | `--uva-color-control-border` | | Dark-mode role token: chip border (else `--uva-grey`, #808080). |
721
+ | `--uva-color-link` | | Dark-mode role token: chip text and hover border (else `--uva-brand-blue`). |
722
+ | `--uva-color-text-muted` | | Dark-mode role token: the count (else #4f4f4f). |
723
+ | `--uva-color-accent-bg` | | Dark-mode role token: selected chip background and border (else `--uva-brand-blue`). |
724
+ | `--uva-color-on-accent` | | Dark-mode role token: selected chip text (else #fff). |
725
+ | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
726
+ | `--uva-color-surface` | | Dark-mode role token: the page background the scrolling row fades into at an edge with more chips (else #fff). |
727
+
687
728
  ## `<uvalib-contents>`
688
729
 
689
730
  Sub-navigation or a table of contents, as library.virginia.edu's sub-navigation: a `<nav>` landmark (named by `label`, "Contents" by default) with the label as a visible headline, and a nested list of links with dividers between the top-level entries and a bar beside each nested level. Give the list as a child: an `<ol>` or `<ul>` of `<li>` elements, each with an `<a href>` (or plain text for a group label) and, for sub-entries, a nested `<ol>`/`<ul>`, to any depth. Other children (a heading) are ignored. The list follows changes to the children. Apps set the `items` property instead (`{ label, href?, children? }`, winning over the children while set). The current entry gets `aria-current`: `page` for the link to this page, `location` for the link to the section of it in the URL's hash. It is found from the page URL (path, and hash for in-page sections), followed through same-document navigations (`hashchange`, `popstate` and the Navigation API), or from the `current` attribute (a URL, resolved like the links). An entry whose href has a query string matches only that query (`?part=2`); one without matches the page whatever its query. Hash-only hrefs are places on that page. With `current` unset, a valid `aria-current` on a source link (`page`, `location` or `true`) is used instead, the first of each kind. `lang` and `dir` on the source links and items, and inline markup in their text (`em`, `cite`, `code`, `abbr`…, copied element by element, never as HTML), are kept. On narrow screens the list collapses into a disclosure: the headline becomes a button with `aria-expanded`, and the list starts closed (as the Electronic Text Collections' Contents does on phones, so the text comes first) until the reader opens it, or while the `open` attribute is set; opening it shows the current entry. Narrow means the viewport (`collapse-below`, 64rem by default), not the element's own width: a contents sidebar is always far narrower than 64rem, so a container query could not tell a phone from a desktop. `sticky` keeps it in view in a sidebar on wide screens; a list longer than the window then scrolls, and the current entry is scrolled into view inside it (never the page). Single-page apps: the list is drawn from copies of the children, so a router's own click handlers on them do not run. Listen for `uvalib-contents-navigate` and cancel it to route in place; hash links need nothing.
@@ -727,6 +768,65 @@ Sub-navigation or a table of contents, as library.virginia.edu's sub-navigation:
727
768
  | `--uva-color-surface-raised` | | Dark-mode role token: the button's background (else #fff). |
728
769
  | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
729
770
 
771
+ ## `<uvalib-date-histogram>`
772
+
773
+ Monthly or yearly counts as bars: a date distribution for a search page, an archive timeline or a card. Give `items` (`{ date, count }`, `date` a `YYYY` or `YYYY-MM`) or a child `<table>` (the no-JS fallback). `granularity="month"` draws twelve bars for every year from the first date to the last, including months with a count of zero. A year-only count in a month chart, a day, or any other date is a chip beside the chart. Each bar is a button named like "October 2015: 5,311 photos". Arrow keys move between bars; Enter or Space selects. `selected` is one bucket (`2015-10`, `2015`) or a range (`2015-03/2016-01`, also `..` or an en dash). The selection is `aria-pressed`, an inset ring and a stripe, not colour alone. Choosing a bar fires `select` with `{ from, to }` as ISO dates (a month runs from its first day to its last). Choosing the selected bar again clears it (`from` and `to` are empty strings). `range-for` is the id of a `<uvalib-date-range>`. A bar click sets that element's `value`. Its `date-range-change` (and its `value` when this element connects, reconnects, or the range is added later) highlights the buckets that overlap the range. A value that is exactly the range's own `min` and `max` is no selection. Setting `selected` here updates the date range; setting the date range's `value` in script does not, unless this element connects afterwards or the range fires `date-range-change`. `variant="strip"` is the small per-year row for a card: not interactive, `role="img"`, one bar per year whatever `granularity` is. The chart reserves its height before the counts arrive: one bar track, or one track per year when those years are already known from the data, a linked date range or the table (`--uvalib-date-histogram-bar-size`, 8rem, plus the year-row gap). Filling the bars in does not move the page. On a narrow screen a month row scrolls inside the component; "Scroll sideways to see more." shows while it overflows. Years wrap.
774
+
775
+ ### Attributes
776
+
777
+ | Attribute | Type | Default | Description |
778
+ |---|---|---|---|
779
+ | `items` | `HistogramItem[]` | `[]` | Counts to draw. When non-empty, wins over the child table. Set a new array to update. |
780
+ | `granularity` | `'year' \| 'month'` | `'month'` | `month` (twelve bars per year) or `year`. Anything else is month, with one console warning. |
781
+ | `scale` | `'linear' \| 'log'` | `'linear'` | `log` scales bar height by log(count + 1). Anything else is linear. |
782
+ | `selected` | `string` | `''` | One bucket (`2015-10` or `2015`) or a range (`2015-03/2016-01`). A linked date range writes a range here. Empty when nothing is selected. |
783
+ | `range-for` | `string` | `''` | Id of a `<uvalib-date-range>` to keep in step with, both ways. |
784
+ | `variant` | `string` | `''` | `strip`: a non-interactive per-year row (`role="img"`). Anything else is the bar chart. |
785
+ | `unit` | `string` | `'items'` | Word after the count in each bar's name. Plural; a count of one drops a trailing s. |
786
+ | `label` | `string` | `'Dates'` | Accessible name of the bar group, and the start of the strip's summary. |
787
+ | `no-shadow-dom` | `boolean` | `false` | |
788
+ | `no-style` | `boolean` | `false` | |
789
+
790
+ ### Slots
791
+
792
+ | Slot | Description |
793
+ |---|---|
794
+ | (default) | A `<table>` of dates and counts: two columns (date, count) or a year-by-month grid. Without JavaScript it is the fallback. With JavaScript it supplies the counts when `items` is empty. Show as table lists those counts, including odd dates; once `items` is set it lists `items` instead. |
795
+
796
+ ### CSS parts
797
+
798
+ | Part | Description |
799
+ |---|---|
800
+ | `chart` | The bar chart (shadow mode). |
801
+ | `bar` | A bar button, or a strip segment (shadow mode). |
802
+ | `table` | The generated table in Show as table (shadow mode). |
803
+
804
+ ### Events
805
+
806
+ | Event | Description |
807
+ |---|---|
808
+ | `select` | A bar or an odd-date chip was chosen, or the current one chosen again to clear it. `detail` is `{ from, to }` (ISO dates, or the odd token). Empty strings clear the selection. Not fired when `selected` is set in script or when a linked date range changes. Bubbles and is composed. |
809
+ | `uvalib-analytics-event` | For `<site-analytics>`: `['uvalib-date-histogram', 'select', '<from>–<to>']` when both ends are ISO dates, or `'other'` for any other choice. Not fired when the selection is cleared, set in script, or restored from a date range. Bubbles and is composed. |
810
+
811
+ ### CSS custom properties
812
+
813
+ | Property | Default | Description |
814
+ |---|---|---|
815
+ | `--uvalib-date-histogram-bar-size` | `8rem` | Height of each bar track. The chart reserves one track, or one per known year, before the counts arrive. |
816
+ | `--uvalib-date-histogram-strip-size` | `1.5rem` | Height of `variant="strip"`. |
817
+ | `--uva-brand-blue` | `#232d4b` | Bar fill. |
818
+ | `--uva-brand-orange` | `#e57200` | Focus ring when `--uva-color-focus` is unset. |
819
+ | `--uva-font-family` | `inherit` | Font family. |
820
+ | `--uva-color-accent-bg` | | Dark-mode role token: bar fill (else `--uva-brand-blue`). |
821
+ | `--uva-color-on-accent` | | Dark-mode role token: the selection stripe (else #fff). |
822
+ | `--uva-color-text` | | Dark-mode role token: labels and the selection ring (else #2b2b2b). |
823
+ | `--uva-color-text-muted` | | Dark-mode role token: the scroll hint (else #4b5563). |
824
+ | `--uva-color-track` | | Dark-mode role token: the empty part of a bar (else #e5e7eb). |
825
+ | `--uva-color-surface` | | Dark-mode role token: the sticky year label (else #fff). |
826
+ | `--uva-color-surface-raised` | | Dark-mode role token: odd-date chips (else #fff). |
827
+ | `--uva-color-control-border` | | Dark-mode role token: bar, chip and table borders (else #808080). |
828
+ | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
829
+
730
830
  ## `<uvalib-date-range>`
731
831
 
732
832
  A date-range picker: a two-thumb year slider plus "From" and "To" date inputs. `min` and `max` (ISO dates, `YYYY-MM-DD`) are required; without valid ones the element renders nothing and logs a console warning once. The start can never pass the end, and both stay within `min`..`max`.
@@ -935,7 +1035,7 @@ Pagefind's default search UI (`PagefindUI`, from the site's own Pagefind bundle)
935
1035
 
936
1036
  ## `<uvalib-pager>`
937
1037
 
938
- Previous/next section links, as on a reading page, or a numbered page list. Previous/next: set `prev-href` and `next-href` (either may be omitted). Each link shows a “Previous” or “Next” kicker and, when `prev-label` or `next-label` is set, that title. A visually hidden “: ” sits between them, so the accessible name is punctuated even when CSS is off. A long title truncates visually; the full text stays in the accessible name. The links use `rel="prev"` and `rel="next"`. With neither href, nothing is rendered. Numbered pages: set `pages` (a positive count). `page` is the current page, clamped to `1…pages`. Each link’s href comes from `href-template`, which must contain `{page}` (the default is `?page={page}`). The current page is text with `aria-current="page"`, not a link. Long ranges collapse to the first page, a window around the current page, the last page, and an ellipsis where numbers are skipped. `pages` wins when previous/next attributes are also set, with one console warning. The landmark’s accessible name is `label`, or “Sections” for previous/next and “Pagination” for numbered pages. An empty `label` uses that default. Two pagers on one page need different labels: a repeated landmark name fails the accessibility check.
1038
+ Previous/next section links, as on a reading page, or a numbered page list. Previous/next: set `prev-href` and `next-href` (either may be omitted). Each link shows a “Previous” or “Next” kicker and, when `prev-label` or `next-label` is set, that title. A visually hidden “: ” sits between them, so the accessible name is punctuated even when CSS is off. A long title truncates visually; the full text stays in the accessible name. The links use `rel="prev"` and `rel="next"`. With neither href, nothing is rendered. Numbered pages: set `pages` (a positive count). `page` is the current page, clamped to `1…pages`. Each link’s href comes from `href-template`, which must contain `{page}` (the default is `?page={page}`). The current page is text with `aria-current="page"`, not a link. Long ranges collapse to the first page, a window around the current page, the last page, and an ellipsis where numbers are skipped. `pages` wins when previous/next attributes are also set, with one console warning. Load more: `mode="load-more"` shows a “Load more” button and “Showing N of M” (`shown` of `total`). It wins over numbered pages and previous/next, with one warning when those are also set. The button is not a link and the control is a group, not a navigation landmark. The button hides once `shown` has reached a positive `total`. `page` is the last loaded page (default 1). A click fires `load-more` with `{ page }` set to the next page and reports `['uvalib-pager', 'load-more', '', page]`. Nothing is reported on render. Call `loaded(firstNewElement)`, or set `for` to a list id and call `loaded()`, and focus moves to that new item. The landmark’s accessible name is `label`, or “Sections” for previous/next and “Pagination” for numbered pages. Load more uses `label` or “More results”. An empty `label` uses that default. Two pagers on one page need different labels: a repeated landmark name fails the accessibility check.
939
1039
 
940
1040
  ### Attributes
941
1041
 
@@ -945,7 +1045,11 @@ Previous/next section links, as on a reading page, or a numbered page list. Prev
945
1045
  | `prev-label` | `string \| undefined` | | Title of the previous section, under the “Previous” kicker. |
946
1046
  | `next-href` | `string \| undefined` | | Href of the next section. Omitted, that side is not shown. |
947
1047
  | `next-label` | `string \| undefined` | | Title of the next section, under the “Next” kicker. |
948
- | `page` | `number \| undefined` | | Current page, from 1. Clamped to `pages`. Used when `pages` is set. |
1048
+ | `mode` | `string \| undefined` | | `load-more` shows a Load more button instead of previous/next or numbered pages. Any other value, including empty, leaves the pager in its other modes. |
1049
+ | `shown` | `number \| undefined` | | How many results are already shown. Used by `mode="load-more"` as N in “Showing N of M”. |
1050
+ | `total` | `number \| undefined` | | How many results there are. Used by `mode="load-more"` as M in “Showing N of M”. |
1051
+ | `for` | `string \| undefined` | | Id of the list Load more appends to. `loaded()` focuses the first child added after the click. Ignored when `loaded` is passed an element. |
1052
+ | `page` | `number \| undefined` | | Current page, from 1. Clamped to `pages`. Used when `pages` is set. In load-more, the last loaded page (default 1); a click asks for the next one. |
949
1053
  | `pages` | `number \| undefined` | | How many pages. A positive number selects numbered pages and ignores previous/next. Zero, negative or non-numeric does not. |
950
1054
  | `href-template` | `string \| undefined` | | Href of each numbered page, with `{page}` where the number goes. Default `?page={page}` when omitted. Without `{page}`, numbered links are not made. |
951
1055
  | `label` | `string \| undefined` | | Accessible name of the navigation landmark. Default “Pagination” for numbered pages and “Sections” for previous/next. Empty uses that default. A second pager on the page needs its own name. |
@@ -956,7 +1060,8 @@ Previous/next section links, as on a reading page, or a numbered page list. Prev
956
1060
 
957
1061
  | Event | Description |
958
1062
  |---|---|
959
- | `uvalib-analytics-event` | For `<site-analytics>`: a primary-button click that was not already canceled, including a modified click, on a page link `['uvalib-pager', 'page-change', 'number', <n>]`, or on a section link `['uvalib-pager', 'page-change', 'next'\|'previous']` (no page number: that mode has none). Never the label or URL. Bubbles and is composed. |
1063
+ | `load-more` | A primary click on Load more: `detail` is `{ page }` (the next page). Bubbles and is composed. |
1064
+ | `uvalib-analytics-event` | For `<site-analytics>`: a primary-button click that was not already canceled, including a modified click, on a page link `['uvalib-pager', 'page-change', 'number', <n>]`, on a section link `['uvalib-pager', 'page-change', 'next'\|'previous']`, or on Load more `['uvalib-pager', 'load-more', '', <next page>]`. Never the label or URL. Nothing on render. Bubbles and is composed. |
960
1065
  | `uvalib-pager-navigate` | A plain click on a pager link: `detail` is `{ href, kind, page? }` (`kind` is `'next'`, `'previous'` or `'number'`; `page` is set for `'number'`). Cancel it (`preventDefault()`) to route in the app; the click’s default is then prevented. Bubbles and is composed. |
961
1066
 
962
1067
  ### CSS custom properties
@@ -969,10 +1074,13 @@ Previous/next section links, as on a reading page, or a numbered page list. Prev
969
1074
  | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
970
1075
  | `--uva-color-accent-bg` | | Dark-mode role token: current page background (else `--uva-brand-blue`). |
971
1076
  | `--uva-color-on-accent` | | Text on the current page background (else #fff). |
1077
+ | `--uva-color-button-bg` | | Load more background (else `--uva-blue-alt`). |
1078
+ | `--uva-color-button-text` | | Load more text (else #fff). Dark mode’s own text is dark on the light button. |
1079
+ | `--uva-color-button-hover-bg` | | Load more hover background (else `--uva-blue-alt-A`). |
972
1080
 
973
1081
  ## `<uvalib-photo-grid>`
974
1082
 
975
- 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.
1083
+ 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.
976
1084
 
977
1085
  ### Attributes
978
1086
 
@@ -986,7 +1094,7 @@ Justified rows of thumbnails. Each direct child that is a link or a button is on
986
1094
 
987
1095
  | Slot | Description |
988
1096
  |---|---|
989
- | (default) | The thumbnails: one `<a href>` or `<button>` per photo, each with an `<img>`. |
1097
+ | (default) | The thumbnails: one `<a href>` or `<button>` per photo, each with an `<img>`. A `<span slot="badge">` inside an item is drawn over that thumbnail. |
990
1098
 
991
1099
  ### CSS custom properties
992
1100
 
@@ -998,6 +1106,112 @@ Justified rows of thumbnails. Each direct child that is a link or a button is on
998
1106
  | `--uva-grey-darkest` | `#2b2b2b` | Caption colour when `--uva-color-text` is unset. |
999
1107
  | `--uva-brand-orange` | `#e57200` | Focus ring when `--uva-color-focus` is unset. |
1000
1108
 
1109
+ ## `<uvalib-results-count>`
1110
+
1111
+ The results summary of a search or listing page, such as “Showing 48 of 3,694 shoots”, and a polite live region that tells screen reader users when it changes. Set `total` (how many match), `shown` (how many are on the page) and `noun` (plural, default “results”; `singular` for a total of one). The visible text follows at once: “Showing 48 of 3,694 shoots”, “Showing all 12 shoots” (shown is the total, or unset), “Showing 1 shoot” or “No shoots” (a total of 0, or 0 shown); with only `shown`, “Showing 48 shoots”. Numbers use thousands separators. A missing or blank `shown` or `total` is unset, not 0. The announcement waits until the text has not changed for `announce-delay` milliseconds (default 1000, as `<bento-box>` and `<uvalib-pagefind-search>` settle), so typing in a filter box is announced once. The first render is never announced; when it has no count yet (the data still loading), the first count that arrives is. A count is announced again when it comes back after a different one (a new search with the same number of results), but not when nothing was shown in between. The announcement is cleared from the hidden region five seconds later, so reading the page finds the count once. `<bento-box>` and `<uvalib-pagefind-search>` announce their own counts: use this element for your own listings, not beside them.
1112
+
1113
+ ### Attributes
1114
+
1115
+ | Attribute | Type | Default | Description |
1116
+ |---|---|---|---|
1117
+ | `shown` | `number \| undefined` | | How many results are shown on the page. |
1118
+ | `total` | `number \| undefined` | | How many results match in all. |
1119
+ | `noun` | `string` | `'results'` | What is counted, plural: “results” by default. |
1120
+ | `singular` | `string` | `''` | What is counted, singular, for a total of one. Default: “result” when `noun` is unset, else `noun`. |
1121
+ | `announce-delay` | `number` | `1000` | Milliseconds the text must stay the same before it is announced. |
1122
+ | `no-shadow-dom` | `boolean` | `false` | |
1123
+ | `no-style` | `boolean` | `false` | |
1124
+
1125
+ ### CSS parts
1126
+
1127
+ | Part | Description |
1128
+ |---|---|
1129
+ | `text` | The visible summary. |
1130
+
1131
+ ### CSS custom properties
1132
+
1133
+ | Property | Default | Description |
1134
+ |---|---|---|
1135
+ | `--uva-color-text-muted` | | Dark-mode role token: text colour (else `--uva-grey-A`, #4f4f4f). |
1136
+
1137
+ ## `<uvalib-tabs>`
1138
+
1139
+ Tabs, as on library.virginia.edu: a row of buttons over one visible panel. Each panel is a child with `data-tab="Events"` (and an `id` when the tab should be linkable). Or put `<button slot="tab">` elements first and one panel element after each; the button text is the label and those buttons are hidden, because the component draws the real tabs. The selected panel stays visible across the upgrade. With `base.css`, later `data-tab` panels stay hidden before the element upgrades, and space is reserved for the tab row so the first panel does not jump. The tab row wraps on a narrow screen. Arrow keys, Home and End move between tabs. Selection follows the arrow unless `activation="manual"`, in which case Enter or Space selects the focused tab. `selected` is the panel id (a label or a 0-based index also selects). It reflects the panel id. `url-param` writes that id into the query string, or into the hash when the page is a hash route (`#/stories?tab=events`). `url-param="hash"` uses the hash itself (`#events`) and leaves a hash route (`#/…`) alone.
1140
+
1141
+ ### Attributes
1142
+
1143
+ | Attribute | Type | Default | Description |
1144
+ |---|---|---|---|
1145
+ | `selected` | `string` | `''` | The selected tab. A panel id, the tab label, or a 0-based index. Reflects the panel id once the tabs have been read. Empty selects the first tab. |
1146
+ | `activation` | `string` | `''` | `manual`: arrow keys move focus and Enter or Space selects. Anything else, including empty, selects as the arrow moves. |
1147
+ | `url-param` | `string` | `''` | Name of the query parameter that stores the selected panel id, so the tab is linkable and Back restores it. `hash` stores it in the hash (`#panel-id`) instead. Empty does not touch the URL. |
1148
+ | `label` | `string` | `''` | Accessible name of the tab list. Empty uses “Tabs”. |
1149
+ | `no-shadow-dom` | `boolean` | `false` | |
1150
+ | `no-style` | `boolean` | `false` | |
1151
+
1152
+ ### Slots
1153
+
1154
+ | Slot | Description |
1155
+ |---|---|
1156
+ | (default) | The panels. Each element with `data-tab` is a panel, or each element that is not a `slot="tab"` button. |
1157
+ | `tab` | A `<button>` whose text labels the panel that follows. Hidden once the tabs are drawn. |
1158
+
1159
+ ### Events
1160
+
1161
+ | Event | Description |
1162
+ |---|---|
1163
+ | `change` | The selected tab changed after the first render, including a script setting `selected` and the Back button. `detail` is `{ id, label, index }` (`id` is the panel id, `index` from 0). Not fired on the first render. Bubbles and is composed. |
1164
+ | `uvalib-analytics-event` | For `<site-analytics>`: a click or arrow-key selection, `['uvalib-tabs', 'change', '<tab label>']`. The label is cut to 100 characters. Not fired on the first render, when `selected` is set from script, or when Back or the hash restores a tab. |
1165
+
1166
+ ### CSS custom properties
1167
+
1168
+ | Property | Default | Description |
1169
+ |---|---|---|
1170
+ | `--uva-color-button-bg` | | Dark-mode role token: unselected tab background (else `--uva-blue-alt-base`). |
1171
+ | `--uva-color-button-text` | | Text on an unselected tab (else #fff). |
1172
+ | `--uva-color-button-hover-bg` | | Dark-mode role token: unselected tab hover (else `--uva-blue-alt-dark`). |
1173
+ | `--uva-color-accent-bg` | | Dark-mode role token: selected tab background (else `--uva-brand-blue`). |
1174
+ | `--uva-color-on-accent` | | Selected tab text and the selected underline (else #fff). |
1175
+ | `--uva-color-focus` | | Dark-mode role token: focus outline (else `--uva-brand-orange`). |
1176
+ | `--uva-blue-alt-base` | `#007BAC` | Unselected tab when `--uva-color-button-bg` is unset. |
1177
+ | `--uva-blue-alt-dark` | `#005679` | Unselected hover when `--uva-color-button-hover-bg` is unset. |
1178
+ | `--uva-brand-blue` | `#232D4B` | Selected tab when `--uva-color-accent-bg` is unset. |
1179
+ | `--uva-brand-orange` | `#E57200` | Focus outline when `--uva-color-focus` is unset. |
1180
+
1181
+ ## `<uvalib-tag-list>`
1182
+
1183
+ 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.
1184
+
1185
+ ### Attributes
1186
+
1187
+ | Attribute | Type | Default | Description |
1188
+ |---|---|---|---|
1189
+ | `label` | `string` | `''` | The list's name: shown above the tags (and, with `track-label`, the analytics name). |
1190
+ | `hide-label` | `boolean` | `false` | Hide the label visually; it still names the list. |
1191
+ | `track-label` | `boolean` | `false` | Send the label as the analytics name. Only for fixed text the page author wrote, never a label filled from a record. Without it the name is `list N`. |
1192
+ | `limit` | `number \| undefined` | | Show this many tags and a “Show all N” button. Zero or empty shows every tag. |
1193
+ | `href-template` | `string` | `''` | Href for tags without their own, with `{tag}` where the URL-encoded text goes, for example `/search?q={tag}`. Empty: such tags are plain text. |
1194
+ | `no-shadow-dom` | `boolean` | `false` | |
1195
+ | `no-style` | `boolean` | `false` | |
1196
+
1197
+ ### Events
1198
+
1199
+ | Event | Description |
1200
+ |---|---|
1201
+ | `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. |
1202
+ | `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. |
1203
+
1204
+ ### CSS custom properties
1205
+
1206
+ | Property | Default | Description |
1207
+ |---|---|---|
1208
+ | `--uva-blue-alt-300` | `#BFE7F7` | Plain tag background (the card chip's). |
1209
+ | `--uva-blue-alt-dark` | `#005679` | Plain tag text. |
1210
+ | `--uva-color-link` | | Dark-mode role token: link tag text (else `--uva-brand-blue`). |
1211
+ | `--uva-color-control-border` | | Dark-mode role token: link tag outline (else `--uva-grey`). |
1212
+ | `--uva-color-text` | | Dark-mode role token: the label (else `--uva-grey-darkest`). |
1213
+ | `--uva-color-focus` | | Dark-mode role token: focus ring (else `--uva-brand-orange`). |
1214
+
1001
1215
  ## `<website-section>`
1002
1216
 
1003
1217
  The library website's first pages (pages, people, libraries, news) matching `query`, from Drupal's search index, with its excerpt (the matched words marked). The index sends no CORS headers, so this section works on library.virginia.edu (or wherever `BentoBox.endpoints.website` points to a same-origin copy) only.
@@ -123,6 +123,10 @@
123
123
  --uva-color-alert-regional-border: light-dark(var(--uva-yellow, #ecc602), #ecc602);
124
124
  --uva-color-alert-regional-info-bg: light-dark(var(--uva-teal-200, #c8f2f4), #0f3a3d);
125
125
  --uva-color-alert-regional-info-border: light-dark(var(--uva-teal, #25cad3), #25cad3);
126
+ /* base.css's success badge (.uvalib-badge--success), beside the alert colours the other
127
+ status badges read: text (--uva-color-alert-text) is 7:1 or more in both schemes. */
128
+ --uva-color-status-success-bg: light-dark(var(--uva-green-200, #ddefdc), #173d1c);
129
+ --uva-color-status-success-border: light-dark(var(--uva-green-A, #4e9737), #62bb46);
126
130
  }
127
131
  :root[data-uva-color-scheme='system'] {
128
132
  color-scheme: light dark;
@@ -52,14 +52,69 @@ var m = 3, h = /* @__PURE__ */ new Set([
52
52
  object-fit: cover;
53
53
  }
54
54
  ${e} .badge { position: absolute; z-index: 0; }
55
+ ${g(e, "[media-shape='circle' i]")} .media {
56
+ width: 8rem;
57
+ max-width: 100%;
58
+ margin-inline: auto;
59
+ }
60
+ ${g(e, "[media-shape='circle' i]")} .media img,
61
+ ${g(e, "[media-shape='circle' i]")} .media video {
62
+ width: 100%;
63
+ aspect-ratio: 1;
64
+ border-radius: 50%;
65
+ object-fit: cover;
66
+ }
67
+ ${e} .actions {
68
+ display: flex;
69
+ flex-wrap: wrap;
70
+ align-items: center;
71
+ gap: 0.75rem;
72
+ }
73
+ ${e} .actions a,
74
+ ${e} .actions button {
75
+ display: inline-flex;
76
+ align-items: center;
77
+ min-width: 44px;
78
+ min-height: 44px;
79
+ }
80
+
55
81
  ${e} .card-source { display: none !important; }
56
82
  ${e}[hidden], ${e} [hidden] { display: none !important; }
57
- `, v = o(_(":host")), y = (e) => o(`${e} .title { margin-block: 0; }`), b = {
83
+ @media (forced-colors: active) {
84
+ ${g(e, "[media-shape='circle' i]")} .media img,
85
+ ${g(e, "[media-shape='circle' i]")} .media video {
86
+ border: 1px solid CanvasText;
87
+ }
88
+ }
89
+ `, v = o(_(":host")), y = t`
90
+ slot::slotted(img.uvalib-circle),
91
+ slot::slotted(video.uvalib-circle) {
92
+ display: block;
93
+ width: 8rem;
94
+ max-width: 100%;
95
+ margin-inline: auto;
96
+ aspect-ratio: 1;
97
+ border-radius: 50%;
98
+ object-fit: cover;
99
+ }
100
+ slot::slotted([slot='actions']) {
101
+ display: inline-flex;
102
+ align-items: center;
103
+ min-width: 44px;
104
+ min-height: 44px;
105
+ }
106
+ @media (forced-colors: active) {
107
+ slot::slotted(img.uvalib-circle),
108
+ slot::slotted(video.uvalib-circle) {
109
+ border: 1px solid CanvasText;
110
+ }
111
+ }
112
+ `, b = (e) => o(`${e} .title { margin-block: 0; }`), x = {
58
113
  attributeFilter: ["slot"],
59
114
  attributes: !0,
60
115
  childList: !0,
61
116
  subtree: !0
62
- }, x = n`<svg
117
+ }, S = n`<svg
63
118
  class="arrow"
64
119
  viewBox="0 0 20 20"
65
120
  width="1em"
@@ -75,16 +130,17 @@ var m = 3, h = /* @__PURE__ */ new Set([
75
130
  stroke-linecap="round"
76
131
  stroke-linejoin="round"
77
132
  ></path>
78
- </svg>`, S = class extends c {
133
+ </svg>`, C = class extends c {
79
134
  constructor(...e) {
80
- super(...e), this.inferred = m, this.warnedHref = !1, this.warnedNested = !1, this.warnedHeading = !1, this.saved = [], this.captured = !1, this.own = /* @__PURE__ */ new WeakSet(), this.placing = !1, this.onSlotChange = () => {
81
- this.syncHidden(), this.warnNested();
135
+ super(...e), this.mediaShape = "", this.inferred = m, this.warnedHref = !1, this.warnedNested = !1, this.warnedHeading = !1, this.warnedShape = !1, this.saved = [], this.captured = !1, this.own = /* @__PURE__ */ new WeakSet(), this.placing = !1, this.onSlotChange = () => {
136
+ this.syncShape(), this.syncHidden(), this.warnNested();
82
137
  };
83
138
  }
84
139
  static {
85
140
  this.styles = [
86
141
  p,
87
142
  v,
143
+ y,
88
144
  t`
89
145
  :host {
90
146
  color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
@@ -181,6 +237,15 @@ var m = 3, h = /* @__PURE__ */ new Set([
181
237
  aspect-ratio: 3 / 2;
182
238
  object-fit: cover;
183
239
  }
240
+ ::slotted(img.uvalib-circle),
241
+ ::slotted(video.uvalib-circle) {
242
+ width: 8rem;
243
+ max-width: 100%;
244
+ margin-inline: auto;
245
+ aspect-ratio: 1;
246
+ border-radius: 50%;
247
+ object-fit: cover;
248
+ }
184
249
  ::slotted([slot='chip']) {
185
250
  background: var(--uva-blue-alt-300, #bfe7f7);
186
251
  color: var(--uva-blue-alt-dark, #005679);
@@ -204,11 +269,7 @@ var m = 3, h = /* @__PURE__ */ new Set([
204
269
  }
205
270
  createRenderRoot() {
206
271
  let e = super.createRenderRoot();
207
- if (e instanceof ShadowRoot && this.noStyle) {
208
- let t = v.styleSheet;
209
- t && (e.adoptedStyleSheets = [t]);
210
- }
211
- return e;
272
+ return e instanceof ShadowRoot && this.noStyle && (e.adoptedStyleSheets = [v.styleSheet, y.styleSheet].filter((e) => !!e)), e;
212
273
  }
213
274
  connectedCallback() {
214
275
  if ((this.hasAttribute("no-shadow-dom") || this.noShadowDom) && !this.hasUpdated && !this.captured) {
@@ -220,7 +281,7 @@ var m = 3, h = /* @__PURE__ */ new Set([
220
281
  this.noStyle && s(`${this.localName}::structure`, o(_(this.localName)), {
221
282
  root: t,
222
283
  scope: !1
223
- }), s(`${this.localName}::title-margin`, y(this.localName), {
284
+ }), s(`${this.localName}::title-margin`, b(this.localName), {
224
285
  root: t,
225
286
  scope: !1,
226
287
  layer: !1
@@ -255,6 +316,14 @@ var m = 3, h = /* @__PURE__ */ new Set([
255
316
  renderSlot(e) {
256
317
  return this.lightDom ? a : e ? n`<slot name=${e} @slotchange=${this.onSlotChange}></slot>` : n`<slot @slotchange=${this.onSlotChange}></slot>`;
257
318
  }
319
+ syncShape() {
320
+ let e = this.mediaShape.trim().toLowerCase() === "circle";
321
+ for (let t of this.querySelectorAll("img, video")) {
322
+ if (!(t instanceof HTMLElement)) continue;
323
+ let n = t.getAttribute("slot") === "media" || !!t.closest("[data-region=\"media\"]");
324
+ t.classList.toggle("uvalib-circle", e && n);
325
+ }
326
+ }
258
327
  position() {
259
328
  let e = this.closest("uvalib-card-grid");
260
329
  if (!e) return { name: "single" };
@@ -355,38 +424,42 @@ var m = 3, h = /* @__PURE__ */ new Set([
355
424
  t.toggleAttribute("hidden", n);
356
425
  }
357
426
  }
427
+ warnShape() {
428
+ let e = this.mediaShape.trim().toLowerCase();
429
+ e && e !== "circle" && !this.warnedShape && (this.warnedShape = !0, console.warn(`${this.localName}: media-shape "${this.mediaShape.trim()}" is not supported. Use "circle".`));
430
+ }
358
431
  warnNested() {
359
- this.linkHref && !this.warnedNested && [...this.querySelectorAll("a[href], button, input:not([type=\"hidden\"]), select, textarea, summary, [role=\"button\"], [role=\"link\"], [tabindex]:not([tabindex=\"-1\"])")].filter((e) => !e.classList.contains("title-link")).length && (this.warnedNested = !0, console.warn(`${this.localName}: a clickable card (one with href) must not contain other links, buttons or controls; the card link covers them.`));
432
+ this.linkHref && !this.warnedNested && [...this.querySelectorAll("a[href], button, input:not([type=\"hidden\"]), select, textarea, summary, [role=\"button\"], [role=\"link\"], [tabindex]:not([tabindex=\"-1\"])")].filter((e) => !e.classList.contains("title-link")).length && (this.warnedNested = !0, console.warn(`${this.localName}: a clickable card (one with href) must not contain other links, buttons or controls; the card link covers them. Use a static card for an actions row.`));
360
433
  }
361
434
  arm() {
362
435
  if (!this.lightDom) return;
363
436
  this.observer ??= new MutationObserver(() => this.onAuthorChange());
364
437
  let e = this.sourceEl(), t = this.renderRoot.querySelector(".card");
365
- e && this.observer.observe(e, b), t && this.observer.observe(t, b), this.observer.observe(this, { childList: !0 });
438
+ e && this.observer.observe(e, x), t && this.observer.observe(t, x), this.observer.observe(this, { childList: !0 });
366
439
  }
367
440
  onAuthorChange() {
368
441
  if (!this.placing && this.lightDom) {
369
442
  this.placing = !0, this.observer?.disconnect();
370
443
  try {
371
- this.ingest(), this.reclaim(), this.distribute(), this.syncHidden(), this.warnNested();
444
+ this.ingest(), this.reclaim(), this.distribute(), this.syncShape(), this.syncHidden(), this.warnNested();
372
445
  } finally {
373
446
  this.placing = !1, this.arm();
374
447
  }
375
448
  }
376
449
  }
377
450
  willUpdate() {
378
- this.infer(), this.lightDom && this.hasUpdated && !this.placing && (this.observer?.disconnect(), this.reclaim());
451
+ this.infer(), this.warnShape(), this.lightDom && this.hasUpdated && !this.placing && (this.observer?.disconnect(), this.reclaim());
379
452
  }
380
453
  firstUpdated() {
381
454
  if (this.lightDom) for (let e of this.childNodes) this.own.add(e);
382
455
  }
383
456
  updated() {
384
- if (!this.lightDom) this.syncHidden(), this.warnNested();
457
+ if (this.syncShape(), !this.lightDom) this.syncHidden(), this.warnNested();
385
458
  else if (!this.placing) {
386
459
  this.placing = !0, this.observer?.disconnect();
387
460
  try {
388
461
  let e = this.sourceEl();
389
- e && this.saved.length && (e.append(...this.saved), this.saved = []), this.ingest(), this.distribute(), this.syncHidden(), this.warnNested();
462
+ e && this.saved.length && (e.append(...this.saved), this.saved = []), this.ingest(), this.distribute(), this.syncShape(), this.syncHidden(), this.warnNested();
390
463
  } finally {
391
464
  this.placing = !1, this.arm();
392
465
  }
@@ -394,7 +467,7 @@ var m = 3, h = /* @__PURE__ */ new Set([
394
467
  }
395
468
  headingEl(e) {
396
469
  let t = u(`h${this.level}`), n = this.linkHref;
397
- return n ? l`<${t} class="title"><a class="title-link" href=${n}>${e}${x}</a></${t}>` : l`<${t} class="title">${e}</${t}>`;
470
+ return n ? l`<${t} class="title"><a class="title-link" href=${n}>${e}${S}</a></${t}>` : l`<${t} class="title">${e}</${t}>`;
398
471
  }
399
472
  render() {
400
473
  let e = n`<span class="title-text" data-region="heading"
@@ -411,14 +484,15 @@ var m = 3, h = /* @__PURE__ */ new Set([
411
484
  <div class="meta" data-region="meta">${this.renderSlot("meta")}</div>
412
485
  <div class="chips" data-region="chip">${this.renderSlot("chip")}</div>
413
486
  <div class="excerpt" data-region="excerpt">${this.renderSlot()}</div>
487
+ <div class="actions" data-region="actions">${this.renderSlot("actions")}</div>
414
488
  </div>
415
489
  </div>`;
416
490
  }
417
491
  };
418
492
  // src/components/uvalib-card/uvalib-card.ts
419
- i([e({ type: String })], S.prototype, "href", void 0), i([e({
493
+ i([e({ type: String })], C.prototype, "href", void 0), i([e({ attribute: "media-shape" })], C.prototype, "mediaShape", void 0), i([e({
420
494
  type: Number,
421
495
  attribute: "heading-level"
422
- })], S.prototype, "headingLevel", void 0), r("uvalib-card", S);
496
+ })], C.prototype, "headingLevel", void 0), r("uvalib-card", C);
423
497
 
424
498
  //# sourceMappingURL=uvalib-card.js.map