@uvalib/web-components 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.11.1 — 2026-11-26
4
+
5
+ ### Fixes
6
+
7
+ - hold <uvalib-pager>'s space before it upgrades (issue #39)
8
+
9
+ ### Other
10
+
11
+ - Merge branch 'fix/pager-preupgrade': hold <uvalib-pager>'s space before it upgrades (issue #39)
12
+
3
13
  ## v1.11.0 — 2026-11-25
4
14
 
5
15
  ### Features
package/README.md CHANGED
@@ -402,6 +402,7 @@ When a visitor prints a page (meeting minutes, a finding aid, an article), `<sit
402
402
  - **Previous/next.** `prev-href` and `next-href` (either may be omitted; with neither, nothing is rendered). Each link shows a “Previous” or “Next” kicker and, when set, `prev-label` or `next-label`. A long title truncates; the full text stays in the accessible name. The links use `rel="prev"` and `rel="next"`. The landmark’s name is `label`, or “Sections”.
403
403
  - **Numbered pages.** Set `pages` (a positive count; it wins over previous/next, with one warning if those are set too). `page` is the current page, clamped to that range, and is text with `aria-current="page"`, not a link. Other pages use `href-template`, which must contain `{page}` (the default is `?page={page}`). A long range keeps the first page, a window around the current page, the last page, and an ellipsis where numbers are skipped. The landmark’s name is `label`, or “Pagination”.
404
404
  - **One landmark name.** Two pagers with the same accessible name fail the accessibility check. Give the second a different `label`.
405
+ - **Before the script runs.** base.css draws the pager invisibly from its attributes, laid out as it will be, so the text under a top pager does not move when it upgrades. Put the titles in `prev-label` and `next-label` (not set later from script) for the hold to be exact. Numbered pages are exact except near the end of a long range on a container of about 280–310px. For load more, set `has-more="false"` on the last page: without it the button's room is held. If the script never loads, the space stays empty (nothing is shown that is not a link).
405
406
  - **Load more.** `mode="load-more"` replaces the landmark with a group: a “Load more” button (`.uvalib-button`) and a polite “Showing N of M” (`shown` and `total`). It wins over numbered pages and previous/next, with one warning when those are also set. The button hides once `shown` has reached a positive `total`. Without a known total (ranked or semantic search), leave `total` unset (or 0): the count reads “Showing N” and the button stays. Add `has-more` while there is more and remove it (or set `hasMore = false`; `has-more="false"` also works, for templates that print false) after the last page. Once set, `has-more` alone decides whether the button shows, over `total`; `hasMore = undefined` returns to following `total`. It is one flag rather than a `has-more`/`no-more` pair, so the two can never contradict each other. If the button goes away while it has focus and `loaded()` was not called first, focus moves to the first new item of the `for` list, or else to the count, never to the page. `page` is the last loaded page (default 1). A click fires `load-more` with `{ page }` set to the next page. Call `loaded(firstNewElement)`, or set `for` to the list’s id and call `loaded()`, and focus moves to that new item (an element that cannot take focus gets `tabindex="-1"`). The group’s name is `label`, or “More results”.
406
407
  - **Single-page apps.** A plain click fires `uvalib-card-navigate` (`detail: { href, position }`) or `uvalib-pager-navigate` (`detail: { href, kind, page? }`). Cancel it with `preventDefault()` and route in the app. `position` is `'single'` or `'1'`, `'2'`, …. `kind` is `'next'`, `'previous'` or `'number'`, and `page` is set only for `'number'`.
407
408
  - **Styles.** A raised surface, a 1px border, and on hover or focus the shadow `0 0 20px 0 #DADADA`. Focusing the heading link draws the focus ring on the card. The chip is `--uva-blue-alt-300` on `--uva-blue-alt-dark` (6.13:1: WCAG AA for normal text, short of AAA’s 7:1). Dark mode follows the role tokens. `no-style` keeps the stretch, the grid and the truncation, and drops the colours.
package/dist/base.css CHANGED
@@ -115,6 +115,85 @@
115
115
  uvalib-results-count:not(:defined)[hidden] {
116
116
  display: none;
117
117
  }
118
+
119
+ uvalib-pager:not(:defined) { line-height: inherit; }
120
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-'])):is([prev-href]:not([prev-href='']), [next-href]:not([next-href=''])) {
121
+ display: flex;
122
+ flex-wrap: wrap;
123
+ justify-content: space-between;
124
+ gap: 1rem;
125
+ }
126
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[prev-href]:not([prev-href=''])::before, uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[next-href]:not([next-href=''])::after {
127
+ display: block;
128
+ max-width: 48%;
129
+ min-width: 0;
130
+ min-height: 2.75rem;
131
+ padding-block-start: calc(0.75 * 1lh + 0.15rem);
132
+ padding-block-start: calc(1lh * 0.75rem / 1em + 0.15rem);
133
+ overflow: hidden;
134
+ white-space: nowrap;
135
+ visibility: hidden;
136
+ }
137
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[prev-href]:not([prev-href=''])::before { content: attr(prev-label); }
138
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[next-href]:not([next-href=''])::after { content: attr(next-label); margin-inline-start: auto; }
139
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[prev-href]:not([prev-href=''])[no-style]::before, uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[next-href]:not([next-href=''])[no-style]::after { padding-block-start: calc(1lh + 0.15rem); }
140
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[prev-href]:not([prev-href='']):is(:not([prev-label]), [prev-label=''])::before, uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[next-href]:not([next-href='']):is(:not([next-label]), [next-label=''])::after {
141
+ padding-block-start: 0;
142
+ font-size: 0.75rem;
143
+ letter-spacing: 0.04em;
144
+ text-transform: uppercase;
145
+ }
146
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[prev-href]:not([prev-href='']):is(:not([prev-label]), [prev-label=''])::before { content: 'Previous'; }
147
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[next-href]:not([next-href='']):is(:not([next-label]), [next-label=''])::after { content: 'Next'; }
148
+ uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[prev-href]:not([prev-href=''])[no-style]:is(:not([prev-label]), [prev-label=''])::before, uvalib-pager:not(:defined, [hidden], [mode='load-more' i], [pages]:not([pages=''], [pages='0'], [pages^='-']))[next-href]:not([next-href=''])[no-style]:is(:not([next-label]), [next-label=''])::after {
149
+ padding-block-start: 0;
150
+ font-size: inherit;
151
+ letter-spacing: normal;
152
+ text-transform: none;
153
+ }
154
+ uvalib-pager[pages]:not(:defined, [hidden], [mode='load-more' i], [pages=''], [pages='0'], [pages^='-']) { container-type: inline-size; }
155
+ uvalib-pager[pages]:not(:defined, [hidden], [mode='load-more' i], [pages=''], [pages='0'], [pages^='-'])::before { content: ''; display: block; block-size: 2.75rem; }
156
+ @container (width < 11.75rem) { uvalib-pager[pages='4']:not(:defined, [hidden], [mode='load-more' i])::before { block-size: 5.75rem; } }
157
+ @container (width < 14.75rem) { uvalib-pager[pages='5']:not(:defined, [hidden], [mode='load-more' i])::before { block-size: 5.75rem; } }
158
+ @container (width < 17.75rem) { uvalib-pager[pages='6']:not(:defined, [hidden], [mode='load-more' i])::before { block-size: 5.75rem; } }
159
+ @container (width < 20.75rem) { uvalib-pager[pages='7']:not(:defined, [hidden], [mode='load-more' i])::before { block-size: 5.75rem; } }
160
+ @container (width < 18.25rem) {
161
+ uvalib-pager[pages]:not(:defined, [hidden], [mode='load-more' i], [pages=''], [pages='0'], [pages^='-']):not([pages='1'], [pages='2'], [pages='3'], [pages='4'], [pages='5'], [pages='6'], [pages='7'])::before { block-size: 5.75rem; }
162
+ }
163
+ @container (16.5rem <= width < 18.25rem) {
164
+ uvalib-pager[pages]:not(:defined, [hidden], [mode='load-more' i], [pages=''], [pages='0'], [pages^='-']):not([pages='1'], [pages='2'], [pages='3'], [pages='4'], [pages='5'], [pages='6'], [pages='7']):is(:not([page]), [page='1'], [page='2'], [page='3'])::before {
165
+ block-size: 2.75rem;
166
+ }
167
+ }
168
+ uvalib-pager[mode='load-more' i]:not(:defined, [hidden]) {
169
+ display: flex;
170
+ flex-wrap: wrap;
171
+ align-items: center;
172
+ gap: 0.75rem 1rem;
173
+ }
174
+ uvalib-pager[mode='load-more' i]:not(:defined, [hidden])::before {
175
+ content: 'Showing ' attr(shown);
176
+ min-width: 0;
177
+ overflow-wrap: anywhere;
178
+ visibility: hidden;
179
+ }
180
+ uvalib-pager[mode='load-more' i]:not(:defined, [hidden])[total]:not([total=''], [total='0'])::before {
181
+ content: 'Showing ' attr(shown) ' of ' attr(total);
182
+ }
183
+ uvalib-pager[mode='load-more' i]:not(:defined, [hidden]):not([has-more='false' i])::after {
184
+ content: 'Load more';
185
+ display: block;
186
+ min-width: 44px;
187
+ min-height: 44px;
188
+ padding: 0.5rem 1.25rem;
189
+ border: 2px solid transparent;
190
+ font: inherit;
191
+ font-size: 1rem;
192
+ line-height: 1.2;
193
+ visibility: hidden;
194
+ }
195
+ uvalib-pager[mode='load-more' i]:not(:defined, [hidden])[no-style]::after { border-width: 0; }
196
+
118
197
  /* The pre-upgrade rules here set display, which beats the hidden attribute's (issue #7).
119
198
  More specific than each of them (two pseudo-classes or attributes), so it needs no importance flag. */
120
199
  :where(