@uvalib/web-components 1.9.0 → 1.11.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.
- package/CHANGELOG.md +39 -0
- package/README.md +277 -18
- package/bin/install-skill.mjs +174 -54
- package/dist/base.css +121 -2
- package/dist/components/uvalib-contents/UvalibContents.d.ts +66 -2
- package/dist/components/uvalib-contents/UvalibContents.js +277 -29
- package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
- package/dist/components/uvalib-list-filter/UvalibListFilter.d.ts +162 -0
- package/dist/components/uvalib-list-filter/UvalibListFilter.js +685 -0
- package/dist/components/uvalib-list-filter/UvalibListFilter.js.map +1 -0
- package/dist/components/uvalib-list-filter/uvalib-list-filter.d.ts +1 -0
- package/dist/components/uvalib-list-filter/uvalib-list-filter.js +4 -0
- package/dist/components/uvalib-list-filter/uvalib-list-filter.js.map +1 -0
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.d.ts +54 -1
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +230 -3
- package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
- package/dist/custom-elements.json +7757 -6209
- package/dist/edition.css +758 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/pagefind.css +144 -0
- package/dist/styles/base.js +78 -1
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/controls.js +2 -0
- package/dist/styles/controls.js.map +1 -1
- package/dist/styles/edition.d.ts +1 -0
- package/dist/styles/edition.js +747 -0
- package/dist/styles/edition.js.map +1 -0
- package/dist/styles/hidden.js +2 -0
- package/dist/styles/hidden.js.map +1 -1
- package/dist/styles/layout.d.ts +1 -0
- package/dist/styles/layout.js +92 -0
- package/dist/styles/layout.js.map +1 -0
- package/dist/styles/pagefind.js +150 -0
- package/dist/styles/pagefind.js.map +1 -1
- package/dist-cdn/base.css +121 -2
- package/dist-cdn/chunks/{base-CHMHBPeI.js → base-DmImIMld.js} +79 -2
- package/dist-cdn/chunks/base-DmImIMld.js.map +1 -0
- package/dist-cdn/custom-elements.json +7757 -6209
- package/dist-cdn/edition.css +758 -0
- package/dist-cdn/manifest.json +5 -3
- package/dist-cdn/pagefind.css +144 -0
- package/dist-cdn/site-page.js +1 -1
- package/dist-cdn/site-style.js +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +29 -8
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +65 -4
- package/dist-cdn/uvalib-contents.js +185 -47
- package/dist-cdn/uvalib-contents.js.map +1 -1
- package/dist-cdn/uvalib-list-filter.js +451 -0
- package/dist-cdn/uvalib-list-filter.js.map +1 -0
- package/dist-cdn/uvalib-pagefind-search.js +149 -49
- package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
- package/package.json +6 -1
- package/skills/uvalib-web-components/SKILL.md +29 -8
- package/skills/uvalib-web-components/reference/components.md +65 -4
- package/dist-cdn/chunks/base-CHMHBPeI.js.map +0 -1
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { a as e, d as t, f as n, i as r, l as i, m as a, n as o, o as s, p as c, r as l, t as u } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
|
+
import { a as d } from "./chunks/analytics-DTTihuBD.js";
|
|
3
|
+
import { n as f, t as p } from "./chunks/url-param-C1sk_F1d.js";
|
|
4
|
+
import { t as m } from "./chunks/accessible-DJv7YOtS.js";
|
|
5
|
+
// src/styles/message.ts
|
|
6
|
+
var h = n`
|
|
7
|
+
.uvalib-message {
|
|
8
|
+
display: block;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
max-inline-size: 100%;
|
|
11
|
+
margin-block: 1rem;
|
|
12
|
+
padding: 0.75rem 1rem;
|
|
13
|
+
border: 1px solid transparent;
|
|
14
|
+
border-inline-start: 6px solid var(--uva-color-alert-info-border, var(--uva-blue-alt, #007bac));
|
|
15
|
+
border-radius: 0.3rem;
|
|
16
|
+
background: var(--uva-color-alert-info-bg, var(--uva-blue-alt-300, #bfe7f7));
|
|
17
|
+
color: var(--uva-color-alert-text, var(--uva-grey-darkest, #2b2b2b));
|
|
18
|
+
line-height: 1.5;
|
|
19
|
+
overflow-wrap: anywhere;
|
|
20
|
+
text-wrap: pretty;
|
|
21
|
+
}
|
|
22
|
+
.uvalib-message > :first-child {
|
|
23
|
+
margin-block-start: 0;
|
|
24
|
+
}
|
|
25
|
+
.uvalib-message > :last-child {
|
|
26
|
+
margin-block-end: 0;
|
|
27
|
+
}
|
|
28
|
+
.uvalib-message a,
|
|
29
|
+
.uvalib-message a:visited {
|
|
30
|
+
color: var(--uva-color-alert-link, var(--uva-blue-alt-B, #141e3c));
|
|
31
|
+
text-decoration: underline;
|
|
32
|
+
}
|
|
33
|
+
/* The ring follows the text colour, chosen to read on the message's own background. */
|
|
34
|
+
.uvalib-message a:focus-visible {
|
|
35
|
+
outline: 2px solid currentColor;
|
|
36
|
+
outline-offset: 2px;
|
|
37
|
+
}
|
|
38
|
+
.uvalib-message__label {
|
|
39
|
+
font-weight: 700;
|
|
40
|
+
}
|
|
41
|
+
.uvalib-message__icon {
|
|
42
|
+
display: inline-block;
|
|
43
|
+
inline-size: 1.25em;
|
|
44
|
+
block-size: 1.25em;
|
|
45
|
+
margin-inline-end: 0.35em;
|
|
46
|
+
vertical-align: -0.25em;
|
|
47
|
+
}
|
|
48
|
+
.uvalib-message--error {
|
|
49
|
+
border-inline-start-color: var(--uva-color-alert-critical-border, var(--uva-red-B, #b30000));
|
|
50
|
+
background: var(--uva-color-alert-critical-bg, var(--uva-red-100, #fbcfda));
|
|
51
|
+
}
|
|
52
|
+
.uvalib-message--warning {
|
|
53
|
+
border-inline-start-color: var(--uva-color-alert-warning-border, var(--uva-yellow, #ecc602));
|
|
54
|
+
background: var(--uva-color-alert-warning-bg, var(--uva-yellow-100, #fef6c8));
|
|
55
|
+
}
|
|
56
|
+
.uvalib-message:is(.uvalib-message--info, .uvalib-message--notice) {
|
|
57
|
+
border-inline-start-color: var(--uva-color-alert-info-border, var(--uva-blue-alt, #007bac));
|
|
58
|
+
background: var(--uva-color-alert-info-bg, var(--uva-blue-alt-300, #bfe7f7));
|
|
59
|
+
}
|
|
60
|
+
.uvalib-message--success {
|
|
61
|
+
border-inline-start-color: var(--uva-color-status-success-border, var(--uva-green-A, #4e9737));
|
|
62
|
+
background: var(--uva-color-status-success-bg, var(--uva-green-200, #ddefdc));
|
|
63
|
+
}
|
|
64
|
+
@media (forced-colors: active) {
|
|
65
|
+
.uvalib-message {
|
|
66
|
+
border-color: CanvasText;
|
|
67
|
+
}
|
|
68
|
+
.uvalib-message a:focus-visible {
|
|
69
|
+
outline-color: Highlight;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`, g = "uvalib-list-filter", _ = {
|
|
73
|
+
settle: 1e3,
|
|
74
|
+
url: 250
|
|
75
|
+
}, v = 5e3, y = 0, b = /\p{M}/gu, x = (e) => e.normalize("NFD").replace(b, "").toLowerCase(), S = (e) => x(e).split(/\s+/).filter(Boolean), C = (e) => S(e).toSorted().join(" "), w = (e) => e.toLocaleString("en-US"), T = /* @__PURE__ */ new WeakMap(), E = "data-uvalib-list-filter";
|
|
76
|
+
function D(e) {
|
|
77
|
+
let t = T.get(e);
|
|
78
|
+
t || (t = new (((e.ownerDocument ?? e).defaultView?.CSSStyleSheet) ?? CSSStyleSheet)(), t.replaceSync(`:where([${E}]) > [hidden] { display: none !important; }`), T.set(e, t)), e.adoptedStyleSheets.includes(t) || (e.adoptedStyleSheets = [...e.adoptedStyleSheets, t]);
|
|
79
|
+
}
|
|
80
|
+
var O = t`<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M4 4l8 8M12 4l-8 8" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>`, k = (e) => `
|
|
81
|
+
${e} { display: block; max-width: 100%; font-size: 1rem; line-height: 1.5; }
|
|
82
|
+
${e} .label { display: block; margin-block-end: 0.25rem; }
|
|
83
|
+
${e} .field { position: relative; }
|
|
84
|
+
${e} .input {
|
|
85
|
+
display: block;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
inline-size: 100%;
|
|
88
|
+
min-block-size: 44px;
|
|
89
|
+
margin: 0;
|
|
90
|
+
padding-inline-end: 44px;
|
|
91
|
+
font: inherit;
|
|
92
|
+
line-height: 1.2;
|
|
93
|
+
}
|
|
94
|
+
${e} .input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
|
|
95
|
+
${e} .clear {
|
|
96
|
+
position: absolute;
|
|
97
|
+
inset-block-start: 0;
|
|
98
|
+
inset-inline-end: 0;
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
inline-size: 44px;
|
|
104
|
+
block-size: 44px;
|
|
105
|
+
margin: 0;
|
|
106
|
+
padding: 0;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
}
|
|
109
|
+
${e} .count { margin: 0.25rem 0 0; }
|
|
110
|
+
${e} .visually-hidden {
|
|
111
|
+
position: absolute;
|
|
112
|
+
width: 1px;
|
|
113
|
+
height: 1px;
|
|
114
|
+
margin: -1px;
|
|
115
|
+
padding: 0;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
clip: rect(0, 0, 0, 0);
|
|
118
|
+
white-space: nowrap;
|
|
119
|
+
border: 0;
|
|
120
|
+
}
|
|
121
|
+
${e}[hidden], ${e} [hidden] { display: none !important; }
|
|
122
|
+
`, A = c(k(":host")), j = c("var(--uva-color-control-border, var(--uva-grey, #808080))"), M = c("var(--uva-color-text-muted, var(--uva-grey-A, #4f4f4f))"), N = c("var(--uva-color-input-text, var(--uva-grey-darkest, #2b2b2b))"), P = c("var(--uva-color-surface-raised, #ffffff)"), F = class extends u {
|
|
123
|
+
constructor(...e) {
|
|
124
|
+
super(...e), this.htmlFor = "", this.selector = "", this.label = "Filter", this.hideLabel = !1, this.placeholder = "", this.noun = "items", this.singular = "", this.resultsCount = "", this.queryParam = null, this.value = "", this.shownCount = 0, this.totalCount = 0, this.appliedQuery = "", this.announcement = "", this.uid = `${g}-${++y}`, this.started = !1, this.warned = !1, this.reported = "", this.onInput = (e) => {
|
|
125
|
+
e.stopPropagation(), this.value = e.target.value, this.apply(!0);
|
|
126
|
+
}, this.onKeydown = (e) => {
|
|
127
|
+
e.key === "Escape" && this.value && (e.preventDefault(), this.clear());
|
|
128
|
+
}, this.clear = () => {
|
|
129
|
+
let e = this.input;
|
|
130
|
+
e && (e.value = ""), this.value = "", this.apply(!0), e?.focus(), d(this, [g, "clear"]), this.reported = "";
|
|
131
|
+
}, this.flushUrl = () => {
|
|
132
|
+
if (this.urlTimer === void 0) return;
|
|
133
|
+
clearTimeout(this.urlTimer), this.urlTimer = void 0;
|
|
134
|
+
let e = this.param;
|
|
135
|
+
if (!e) return;
|
|
136
|
+
let t = this.value.trim();
|
|
137
|
+
if ((f(location, e) ?? "") !== t) try {
|
|
138
|
+
history.replaceState(history.state, "", p(location, e, t || null));
|
|
139
|
+
} catch {}
|
|
140
|
+
}, this.onPopState = () => {
|
|
141
|
+
if (!this.started || !this.param) return;
|
|
142
|
+
let e = this.urlQuery() ?? "";
|
|
143
|
+
e !== this.value && (this.value = e, this.reported = C(e), this.apply());
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
static {
|
|
147
|
+
this.styles = [
|
|
148
|
+
m,
|
|
149
|
+
A,
|
|
150
|
+
h,
|
|
151
|
+
n`
|
|
152
|
+
:host {
|
|
153
|
+
color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
|
|
154
|
+
}
|
|
155
|
+
.label {
|
|
156
|
+
font-weight: 600;
|
|
157
|
+
}
|
|
158
|
+
.field {
|
|
159
|
+
max-inline-size: 36rem;
|
|
160
|
+
}
|
|
161
|
+
.input {
|
|
162
|
+
padding-block: 0.5rem;
|
|
163
|
+
padding-inline-start: 0.75rem;
|
|
164
|
+
border: 1px solid ${j};
|
|
165
|
+
border-radius: 5px;
|
|
166
|
+
background: ${P};
|
|
167
|
+
color: ${N};
|
|
168
|
+
}
|
|
169
|
+
.input::placeholder {
|
|
170
|
+
color: ${M};
|
|
171
|
+
opacity: 1;
|
|
172
|
+
}
|
|
173
|
+
.clear {
|
|
174
|
+
border: 0;
|
|
175
|
+
border-radius: 5px;
|
|
176
|
+
background: none;
|
|
177
|
+
color: ${M};
|
|
178
|
+
}
|
|
179
|
+
.clear:hover {
|
|
180
|
+
color: ${N};
|
|
181
|
+
}
|
|
182
|
+
.clear:focus-visible {
|
|
183
|
+
outline-offset: -4px;
|
|
184
|
+
}
|
|
185
|
+
.count {
|
|
186
|
+
color: ${M};
|
|
187
|
+
}
|
|
188
|
+
.uvalib-message {
|
|
189
|
+
margin-block: 0.75rem 0;
|
|
190
|
+
}
|
|
191
|
+
@media (forced-colors: active) {
|
|
192
|
+
.input {
|
|
193
|
+
border-color: CanvasText;
|
|
194
|
+
}
|
|
195
|
+
.clear {
|
|
196
|
+
color: ButtonText;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
`
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
get shown() {
|
|
203
|
+
return this.shownCount;
|
|
204
|
+
}
|
|
205
|
+
get total() {
|
|
206
|
+
return this.totalCount;
|
|
207
|
+
}
|
|
208
|
+
createRenderRoot() {
|
|
209
|
+
let e = super.createRenderRoot();
|
|
210
|
+
if (e instanceof ShadowRoot && this.noStyle) {
|
|
211
|
+
let t = A.styleSheet;
|
|
212
|
+
t && (e.adoptedStyleSheets = [t]);
|
|
213
|
+
}
|
|
214
|
+
return e;
|
|
215
|
+
}
|
|
216
|
+
connectedCallback() {
|
|
217
|
+
if (super.connectedCallback(), this.lightDom && this.noStyle) {
|
|
218
|
+
let e = this.getRootNode();
|
|
219
|
+
l(`${this.localName}::structure`, c(k(this.localName)), {
|
|
220
|
+
root: e instanceof ShadowRoot || e instanceof Document ? e : void 0,
|
|
221
|
+
scope: !1
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
window.addEventListener("popstate", this.onPopState), window.addEventListener("pagehide", this.flushUrl), this.started && this.reset();
|
|
225
|
+
}
|
|
226
|
+
disconnectedCallback() {
|
|
227
|
+
super.disconnectedCallback(), window.removeEventListener("popstate", this.onPopState), window.removeEventListener("pagehide", this.flushUrl), clearTimeout(this.settleTimer), clearTimeout(this.clearing), this.flushUrl(), this.observer?.disconnect(), this.observed = void 0, this.showAll();
|
|
228
|
+
}
|
|
229
|
+
begin() {
|
|
230
|
+
document.readyState === "loading" && !this.collect() ? document.addEventListener("DOMContentLoaded", () => this.start(), { once: !0 }) : this.start();
|
|
231
|
+
}
|
|
232
|
+
start() {
|
|
233
|
+
if (this.started || !this.isConnected) return;
|
|
234
|
+
this.started = !0;
|
|
235
|
+
let e = this.urlQuery();
|
|
236
|
+
e !== null && (this.value = e), this.reported = C(this.value), this.apply();
|
|
237
|
+
}
|
|
238
|
+
willUpdate(e) {
|
|
239
|
+
if (!this.hasUpdated) return this.begin();
|
|
240
|
+
this.started && (e.has("htmlFor") || e.has("selector") ? this.reset() : e.has("value") && this.value !== this.appliedQuery && this.apply());
|
|
241
|
+
}
|
|
242
|
+
refresh() {
|
|
243
|
+
this.started && this.reset();
|
|
244
|
+
}
|
|
245
|
+
reset() {
|
|
246
|
+
this.showAll(), this.index = void 0, this.apply();
|
|
247
|
+
}
|
|
248
|
+
lookupRoot() {
|
|
249
|
+
let e = this.getRootNode();
|
|
250
|
+
return e instanceof ShadowRoot || e instanceof Document ? e : document;
|
|
251
|
+
}
|
|
252
|
+
target() {
|
|
253
|
+
return this.htmlFor ? this.lookupRoot().getElementById(this.htmlFor) : null;
|
|
254
|
+
}
|
|
255
|
+
collect() {
|
|
256
|
+
let e = this.target();
|
|
257
|
+
if (this.htmlFor && !e) return null;
|
|
258
|
+
let t;
|
|
259
|
+
if (this.selector) try {
|
|
260
|
+
t = [...(e ?? this.lookupRoot()).querySelectorAll(this.selector)];
|
|
261
|
+
} catch {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
else if (e) t = e instanceof HTMLTableElement ? [...e.tBodies].flatMap((e) => [...e.rows]) : [...e.children];
|
|
265
|
+
else return null;
|
|
266
|
+
return t.filter((e) => e instanceof HTMLElement);
|
|
267
|
+
}
|
|
268
|
+
build() {
|
|
269
|
+
let e = this.collect();
|
|
270
|
+
if (!e) {
|
|
271
|
+
this.warned || (this.warned = !0, console.warn(`<${g}>: no list found; set "for" to the id of the list, or "selector" to its items.`));
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
let t = e.map((e) => e.parentElement?.closest("[data-filter-group]") ?? null), n = [...new Set(t.filter((e) => e !== null))], r = e[0]?.getRootNode();
|
|
275
|
+
(r instanceof Document || r instanceof ShadowRoot) && D(r);
|
|
276
|
+
for (let t of new Set([...e, ...n].map((e) => e.parentElement))) t?.setAttribute(E, "");
|
|
277
|
+
return this.observe(), {
|
|
278
|
+
items: e,
|
|
279
|
+
hidden: e.map((e) => e.hidden),
|
|
280
|
+
group: t,
|
|
281
|
+
groups: n
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
observe() {
|
|
285
|
+
let e = this.target();
|
|
286
|
+
e && e !== this.observed && (this.observer?.disconnect(), this.observer ??= new MutationObserver(() => {
|
|
287
|
+
this.index = void 0, this.apply();
|
|
288
|
+
}), this.observer.observe(e, {
|
|
289
|
+
childList: !0,
|
|
290
|
+
subtree: !0,
|
|
291
|
+
attributes: !0,
|
|
292
|
+
attributeFilter: ["data-filter-text"]
|
|
293
|
+
}), this.observed = e);
|
|
294
|
+
}
|
|
295
|
+
textOf(e) {
|
|
296
|
+
return e.text ??= e.items.map((e) => x(e.dataset.filterText ?? e.textContent ?? "")), e.text;
|
|
297
|
+
}
|
|
298
|
+
apply(e = !1) {
|
|
299
|
+
this.index ??= this.build();
|
|
300
|
+
let t = this.index, n = this.value, r = this.appliedQuery;
|
|
301
|
+
if (this.appliedQuery = n, !t) {
|
|
302
|
+
this.shownCount = this.totalCount = 0;
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
let i = S(n), a = i.length ? this.textOf(t) : [], { items: o, hidden: s, group: c } = t, l = /* @__PURE__ */ new Map(), u = 0;
|
|
306
|
+
for (let e = 0; e < o.length; e++) {
|
|
307
|
+
let t = !1;
|
|
308
|
+
if (i.length) {
|
|
309
|
+
let n = a[e];
|
|
310
|
+
for (let e of i) if (!n.includes(e)) {
|
|
311
|
+
t = !0;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (s[e] !== t && (s[e] = t, o[e].hidden = t), !t) {
|
|
316
|
+
u++;
|
|
317
|
+
let t = c[e];
|
|
318
|
+
t && l.set(t, (l.get(t) ?? 0) + 1);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
for (let e of t.groups) {
|
|
322
|
+
let t = !l.has(e);
|
|
323
|
+
e.hidden !== t && (e.hidden = t);
|
|
324
|
+
}
|
|
325
|
+
let d = n !== r || u !== this.shownCount || o.length !== this.totalCount;
|
|
326
|
+
this.shownCount = u, this.totalCount = o.length, this.driveResultsCount(), d && (n || r) && this.dispatchEvent(new CustomEvent("uvalib-list-filter-change", {
|
|
327
|
+
detail: {
|
|
328
|
+
query: n,
|
|
329
|
+
shown: u,
|
|
330
|
+
total: o.length
|
|
331
|
+
},
|
|
332
|
+
bubbles: !0,
|
|
333
|
+
composed: !0
|
|
334
|
+
})), e && (clearTimeout(this.settleTimer), this.settleTimer = setTimeout(() => this.settle(), _.settle), clearTimeout(this.urlTimer), this.urlTimer = setTimeout(this.flushUrl, _.url));
|
|
335
|
+
}
|
|
336
|
+
showAll() {
|
|
337
|
+
let e = this.index;
|
|
338
|
+
if (e) {
|
|
339
|
+
e.items.forEach((t, n) => {
|
|
340
|
+
e.hidden[n] && (t.hidden = e.hidden[n] = !1);
|
|
341
|
+
});
|
|
342
|
+
for (let t of e.groups) t.hidden = !1;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
externalCount() {
|
|
346
|
+
return this.resultsCount ? this.lookupRoot().getElementById(this.resultsCount) : null;
|
|
347
|
+
}
|
|
348
|
+
driveResultsCount() {
|
|
349
|
+
let e = this.externalCount();
|
|
350
|
+
e && (e.total = this.totalCount, e.shown = this.shownCount);
|
|
351
|
+
}
|
|
352
|
+
word(e) {
|
|
353
|
+
let t = this.noun.trim() || "items";
|
|
354
|
+
return e === 1 ? this.singular.trim() || (t === "items" ? "item" : t) : t;
|
|
355
|
+
}
|
|
356
|
+
get countText() {
|
|
357
|
+
let e = this.totalCount, t = this.shownCount;
|
|
358
|
+
return e ? t < e ? `Showing ${w(t)} of ${w(e)} ${this.word(e)}` : e === 1 ? `Showing 1 ${this.word(1)}` : `Showing all ${w(e)} ${this.word(e)}` : this.started && this.index ? `No ${this.word(0)}` : "";
|
|
359
|
+
}
|
|
360
|
+
get emptyText() {
|
|
361
|
+
let e = this.appliedQuery.trim();
|
|
362
|
+
return this.totalCount && !this.shownCount && e ? `No ${this.word(0)} match “${e}”.` : "";
|
|
363
|
+
}
|
|
364
|
+
settle() {
|
|
365
|
+
this.externalCount() || this.announce(this.emptyText || this.countText);
|
|
366
|
+
let e = C(this.value);
|
|
367
|
+
e !== this.reported && (e ? d(this, [
|
|
368
|
+
g,
|
|
369
|
+
"filter",
|
|
370
|
+
"",
|
|
371
|
+
this.shownCount
|
|
372
|
+
]) : d(this, [g, "clear"]), this.reported = e);
|
|
373
|
+
}
|
|
374
|
+
announce(e) {
|
|
375
|
+
if (!e) return;
|
|
376
|
+
clearTimeout(this.clearing);
|
|
377
|
+
let t = () => {
|
|
378
|
+
this.announcement = e, this.clearing = setTimeout(() => this.announcement = "", v);
|
|
379
|
+
};
|
|
380
|
+
this.announcement === e ? (this.announcement = "", this.updateComplete.then(() => requestAnimationFrame(t))) : t();
|
|
381
|
+
}
|
|
382
|
+
get input() {
|
|
383
|
+
return this.renderRoot.querySelector(`#${this.uid}-input`);
|
|
384
|
+
}
|
|
385
|
+
get param() {
|
|
386
|
+
let e = this.queryParam;
|
|
387
|
+
return e === null ? "" : e.trim() || "filter";
|
|
388
|
+
}
|
|
389
|
+
urlQuery() {
|
|
390
|
+
let e = this.param;
|
|
391
|
+
return e ? f(location, e) : null;
|
|
392
|
+
}
|
|
393
|
+
render() {
|
|
394
|
+
let e = this.uid, t = this.label.trim() || "Filter", n = !this.resultsCount, r = this.emptyText;
|
|
395
|
+
return i`<label
|
|
396
|
+
class="label ${this.hideLabel ? "visually-hidden" : ""}"
|
|
397
|
+
part="label"
|
|
398
|
+
for="${e}-input"
|
|
399
|
+
>${t}</label
|
|
400
|
+
>
|
|
401
|
+
<div class="field" part="field">
|
|
402
|
+
<input
|
|
403
|
+
id="${e}-input"
|
|
404
|
+
class="input"
|
|
405
|
+
part="input"
|
|
406
|
+
type="search"
|
|
407
|
+
autocomplete="off"
|
|
408
|
+
autocapitalize="off"
|
|
409
|
+
spellcheck="false"
|
|
410
|
+
enterkeyhint="search"
|
|
411
|
+
placeholder=${this.placeholder || s}
|
|
412
|
+
.value=${this.value}
|
|
413
|
+
@input=${this.onInput}
|
|
414
|
+
@keydown=${this.onKeydown}
|
|
415
|
+
@change=${(e) => e.stopPropagation()}
|
|
416
|
+
/><button
|
|
417
|
+
type="button"
|
|
418
|
+
class="clear"
|
|
419
|
+
part="clear"
|
|
420
|
+
aria-label="Clear ${t}"
|
|
421
|
+
?hidden=${!this.value}
|
|
422
|
+
@mousedown=${(e) => e.preventDefault()}
|
|
423
|
+
@click=${this.clear}
|
|
424
|
+
>
|
|
425
|
+
${O}
|
|
426
|
+
</button>
|
|
427
|
+
</div>
|
|
428
|
+
${n ? i`<p class="count" part="count">${this.countText}</p>` : s}
|
|
429
|
+
<p class="uvalib-message" part="empty" ?hidden=${!r}>${r}</p>
|
|
430
|
+
${n ? i`<span class="visually-hidden" role="status" aria-live="polite" aria-atomic="true"
|
|
431
|
+
>${this.announcement}</span
|
|
432
|
+
>` : s}`;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
// src/components/uvalib-list-filter/uvalib-list-filter.ts
|
|
436
|
+
o([e({
|
|
437
|
+
type: String,
|
|
438
|
+
attribute: "for"
|
|
439
|
+
})], F.prototype, "htmlFor", void 0), o([e({ type: String })], F.prototype, "selector", void 0), o([e({ type: String })], F.prototype, "label", void 0), o([e({
|
|
440
|
+
type: Boolean,
|
|
441
|
+
reflect: !0,
|
|
442
|
+
attribute: "hide-label"
|
|
443
|
+
})], F.prototype, "hideLabel", void 0), o([e({ type: String })], F.prototype, "placeholder", void 0), o([e({ type: String })], F.prototype, "noun", void 0), o([e({ type: String })], F.prototype, "singular", void 0), o([e({
|
|
444
|
+
type: String,
|
|
445
|
+
attribute: "results-count"
|
|
446
|
+
})], F.prototype, "resultsCount", void 0), o([e({
|
|
447
|
+
type: String,
|
|
448
|
+
attribute: "query-param"
|
|
449
|
+
})], F.prototype, "queryParam", void 0), o([e({ type: String })], F.prototype, "value", void 0), o([r()], F.prototype, "shownCount", void 0), o([r()], F.prototype, "totalCount", void 0), o([r()], F.prototype, "appliedQuery", void 0), o([r()], F.prototype, "announcement", void 0), a("uvalib-list-filter", F);
|
|
450
|
+
|
|
451
|
+
//# sourceMappingURL=uvalib-list-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uvalib-list-filter.js","names":["unsafeCSS","nothing","_decorate","property","state","n","w","i","r$1","b","define","__decorate","A","r","installLightDomStyles","UvalibElement","trackEvent","paramFromLocation","hrefWithParam","accessible","message","TAG","listFilterTiming","CLEAR_MS","uid","MARKS","fold","s","queryWords","q","queryKey","count","guards","MARK","installGuard","sheet","root","CLEAR_ICON","structuralRules","host","shadowStructure","BORDER","MUTED","TEXT","RAISED","UvalibListFilter","_args","input","name","node","fromUrl","changed","scope","found","items","group","el","groups","g","parent","idx","query","prevQuery","words","text","visible","shown","hide","t","hidden","user","rc","plural","total","key","say","p","id","label","own","empty"],"sources":["../src/styles/message.ts","../src/components/uvalib-list-filter/UvalibListFilter.ts","../src/components/uvalib-list-filter/uvalib-list-filter.ts"],"sourcesContent":["import { css } from 'lit';\n\n// An inline message for a page's own content (issue #8), in base.css only (composed into\n// `controls`): an error, a warning, a notice or a success, at the size of the content around\n// it. The severity look is <site-alerts>' list alerts at inline size: the alert background,\n// a thick start border in the severity colour, and the alert text and link colours, which are\n// 7:1 or more (WCAG AAA) on every alert background in light and dark (the\n// --uva-color-alert-* role tokens; success reads the two --uva-color-status-success-* ones).\n//\n// The severity is never colour alone: the author writes it in the text (`<strong\n// class=\"uvalib-message__label\">Error:</strong>`), optionally with a decorative icon. No\n// CSS-generated prefix: generated content is read inconsistently by screen readers, is not\n// translated with the page, and would double a word the author already wrote.\n//\n// In forced colors, where backgrounds are dropped, every message keeps a system-colour border\n// (thicker at the start), as <site-alerts> does.\n//\n// The text wraps with `text-wrap: pretty` (no one-word last line; ignored where unsupported),\n// not `balance`: the message is a box, and balanced lines would leave empty space in it.\nexport const message = css`\n .uvalib-message {\n display: block;\n box-sizing: border-box;\n max-inline-size: 100%;\n margin-block: 1rem;\n padding: 0.75rem 1rem;\n border: 1px solid transparent;\n border-inline-start: 6px solid var(--uva-color-alert-info-border, var(--uva-blue-alt, #007bac));\n border-radius: 0.3rem;\n background: var(--uva-color-alert-info-bg, var(--uva-blue-alt-300, #bfe7f7));\n color: var(--uva-color-alert-text, var(--uva-grey-darkest, #2b2b2b));\n line-height: 1.5;\n overflow-wrap: anywhere;\n text-wrap: pretty;\n }\n .uvalib-message > :first-child {\n margin-block-start: 0;\n }\n .uvalib-message > :last-child {\n margin-block-end: 0;\n }\n .uvalib-message a,\n .uvalib-message a:visited {\n color: var(--uva-color-alert-link, var(--uva-blue-alt-B, #141e3c));\n text-decoration: underline;\n }\n /* The ring follows the text colour, chosen to read on the message's own background. */\n .uvalib-message a:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n }\n .uvalib-message__label {\n font-weight: 700;\n }\n .uvalib-message__icon {\n display: inline-block;\n inline-size: 1.25em;\n block-size: 1.25em;\n margin-inline-end: 0.35em;\n vertical-align: -0.25em;\n }\n .uvalib-message--error {\n border-inline-start-color: var(--uva-color-alert-critical-border, var(--uva-red-B, #b30000));\n background: var(--uva-color-alert-critical-bg, var(--uva-red-100, #fbcfda));\n }\n .uvalib-message--warning {\n border-inline-start-color: var(--uva-color-alert-warning-border, var(--uva-yellow, #ecc602));\n background: var(--uva-color-alert-warning-bg, var(--uva-yellow-100, #fef6c8));\n }\n .uvalib-message:is(.uvalib-message--info, .uvalib-message--notice) {\n border-inline-start-color: var(--uva-color-alert-info-border, var(--uva-blue-alt, #007bac));\n background: var(--uva-color-alert-info-bg, var(--uva-blue-alt-300, #bfe7f7));\n }\n .uvalib-message--success {\n border-inline-start-color: var(--uva-color-status-success-border, var(--uva-green-A, #4e9737));\n background: var(--uva-color-status-success-bg, var(--uva-green-200, #ddefdc));\n }\n @media (forced-colors: active) {\n .uvalib-message {\n border-color: CanvasText;\n }\n .uvalib-message a:focus-visible {\n outline-color: Highlight;\n }\n }\n`;\n","import { css, html, nothing, svg, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { hrefWithParam, paramFromLocation } from '../../base/url-param.js';\nimport { accessible } from '../../styles/accessible.js';\nimport { message } from '../../styles/message.js';\n\n/** What `uvalib-list-filter-change` carries. */\nexport interface ListFilterChangeDetail {\n /** The text in the field, as typed. */\n query: string;\n /** How many items match (are shown). */\n shown: number;\n /** How many items the list has. */\n total: number;\n}\n\nconst TAG = 'uvalib-list-filter';\n\n/**\n * How long (ms) the filter must stay put before it is announced and reported to analytics\n * (as `<uvalib-results-count>` and the date range settle), and before it is written to the\n * URL. Tests may shorten them.\n */\nexport const listFilterTiming = { settle: 1000, url: 250 };\n/** How long an announcement stays in the live region before it is cleared. */\nconst CLEAR_MS = 5000;\nlet uid = 0;\n\nconst MARKS = /\\p{M}/gu;\n/** Case- and accent-insensitive form: “Ébène” and “ebene” match. */\nexport const fold = (s: string): string => s.normalize('NFD').replace(MARKS, '').toLowerCase();\n/** The query's words, folded: every one must appear in an item, in any order. */\nexport const queryWords = (q: string): string[] => fold(q).split(/\\s+/).filter(Boolean);\n/** The same words in any case or order are the same query (for analytics). */\nconst queryKey = (q: string): string => queryWords(q).toSorted().join(' ');\n\nconst count = (n: number) => n.toLocaleString('en-US');\n\n/** The items as read from the page, with their folded text and what the filter last did. */\ninterface Index {\n items: HTMLElement[];\n /** Folded text per item, read on the first non-empty query. */\n text?: string[];\n hidden: boolean[];\n /** Each item's `[data-filter-group]` ancestor, if any. */\n group: (HTMLElement | null)[];\n groups: HTMLElement[];\n}\n\n/**\n * Hidden items stay hidden whatever `display` the page gives them: one unlayered sheet per\n * root (document or shadow root). It only reaches the direct children of the item and group\n * parents this element marks, so other `[hidden]` content on the page is left alone.\n */\nconst guards = new WeakMap<Document | ShadowRoot, CSSStyleSheet>();\nconst MARK = 'data-uvalib-list-filter';\nfunction installGuard(root: Document | ShadowRoot): void {\n let sheet = guards.get(root);\n if (!sheet) {\n const doc = (root as ShadowRoot).ownerDocument ?? (root as Document);\n const Ctor =\n (doc.defaultView as (Window & typeof globalThis) | null)?.CSSStyleSheet ?? CSSStyleSheet;\n sheet = new Ctor();\n sheet.replaceSync(`:where([${MARK}]) > [hidden] { display: none !important; }`);\n guards.set(root, sheet);\n }\n if (!root.adoptedStyleSheets.includes(sheet))\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];\n}\n\nconst CLEAR_ICON = svg`<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M4 4l8 8M12 4l-8 8\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"/></svg>`;\n\n/**\n * Kept with `no-style`: the label above a 44px field, the 44px clear button inside its end,\n * the visually hidden text, and `[hidden]`. `host` is `:host` or the tag.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; max-width: 100%; font-size: 1rem; line-height: 1.5; }\n ${host} .label { display: block; margin-block-end: 0.25rem; }\n ${host} .field { position: relative; }\n ${host} .input {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: 44px;\n margin: 0;\n padding-inline-end: 44px;\n font: inherit;\n line-height: 1.2;\n }\n ${host} .input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }\n ${host} .clear {\n position: absolute;\n inset-block-start: 0;\n inset-inline-end: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n inline-size: 44px;\n block-size: 44px;\n margin: 0;\n padding: 0;\n cursor: pointer;\n }\n ${host} .count { margin: 0.25rem 0 0; }\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\nconst BORDER = unsafeCSS('var(--uva-color-control-border, var(--uva-grey, #808080))');\nconst MUTED = unsafeCSS('var(--uva-color-text-muted, var(--uva-grey-A, #4f4f4f))');\nconst TEXT = unsafeCSS('var(--uva-color-input-text, var(--uva-grey-darkest, #2b2b2b))');\nconst RAISED = unsafeCSS('var(--uva-color-surface-raised, #ffffff)');\n\n/**\n * A text field that filters a long list on the page as you type: a collection's 473 texts, a\n * staff directory, a table of databases. The list is the page's own markup and stays fully\n * visible without the script.\n *\n * `for` is the id of the list: any element whose children are the items (a `<ul>` or `<ol>`,\n * a `<dl>` of `<div>` rows, a grid of cards; for a `<table>`, the rows of its bodies).\n * `selector` picks the items instead (inside `for` when both are set, else in the page).\n * An item matches when every word typed appears in its `data-filter-text`, or else its text,\n * in any order, ignoring case and accents (“eneide” finds “Énéide”). Items that do not match\n * get the `hidden` attribute (kept hidden whatever `display` the page gives them); clearing\n * the field shows them all again. Thousands of items filter at once on every keystroke: the\n * text is read once, and only items whose state changes are touched.\n *\n * Groups: give each group's wrapper `data-filter-group` (a `<section>` with its heading and\n * its list) and point `selector` at the items; a group whose items are all hidden is hidden\n * too, heading and all.\n *\n * The visible `label` (default “Filter”; `hide-label` hides it visually) names the field, and\n * a Clear button (“Clear <label>”, 44px, shown only with text) or Escape empties it, keeping\n * focus in the field. Under the field a count follows at once (“Showing 12 of 473 texts”;\n * `noun`, plural, and `singular` name the items), and a polite status announces it once the\n * typing settles (a second after the last keystroke), never on every key or at load. When\n * nothing matches, a message says “No texts match “…”.” To put the count elsewhere, point\n * `results-count` at a `<uvalib-results-count>` (give it `total` and `noun` in the markup):\n * the element then sets its `shown` and `total` and leaves the count and announcement to it.\n *\n * With `query-param` (bare: `filter`) the filter is read from that URL parameter at start\n * and written back with `history.replaceState` as you type, so a filtered list can be shared\n * and Back returns to it. The list's content is read once; call `refresh()` after changing an\n * item's text in script (added or removed items and `data-filter-text` changes are noticed).\n *\n * Before it upgrades, `base.css` holds the label, field and count's height, so nothing moves.\n *\n * @tagname uvalib-list-filter\n * @fires uvalib-list-filter-change - The filter was applied with a new query (typing, Clear, Escape, `value` set in script, the URL at start, Back and Forward). `detail` is `{ query, shown, total }`. Not fired at load without a query. Bubbles and is composed.\n * @fires uvalib-analytics-event - For `<site-analytics>`, on the visitor's actions only: `['uvalib-list-filter', 'filter', '', <shown>]` once the typing settles on a new query, and `['uvalib-list-filter', 'clear']` when the visitor empties the field. Never the typed text. Bubbles and is composed.\n * @csspart label - The visible label.\n * @csspart field - The box around the field and its clear button.\n * @csspart input - The text field.\n * @csspart clear - The clear button.\n * @csspart count - The visible count under the field.\n * @csspart empty - The “No … match” message.\n * @cssprop --uva-color-surface-raised - Dark-mode role token: field background (else #fff).\n * @cssprop --uva-color-control-border - Dark-mode role token: field border (else `--uva-grey`, #808080).\n * @cssprop --uva-color-input-text - Dark-mode role token: field text (else #2b2b2b).\n * @cssprop --uva-color-text - Dark-mode role token: label text (else #2b2b2b).\n * @cssprop --uva-color-text-muted - Dark-mode role token: placeholder, count and the clear icon (else #4f4f4f).\n * @cssprop --uva-color-alert-info-bg - Dark-mode role token: the no-match message background.\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibListFilter extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n message,\n css`\n :host {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n }\n .label {\n font-weight: 600;\n }\n .field {\n max-inline-size: 36rem;\n }\n .input {\n padding-block: 0.5rem;\n padding-inline-start: 0.75rem;\n border: 1px solid ${BORDER};\n border-radius: 5px;\n background: ${RAISED};\n color: ${TEXT};\n }\n .input::placeholder {\n color: ${MUTED};\n opacity: 1;\n }\n .clear {\n border: 0;\n border-radius: 5px;\n background: none;\n color: ${MUTED};\n }\n .clear:hover {\n color: ${TEXT};\n }\n .clear:focus-visible {\n outline-offset: -4px;\n }\n .count {\n color: ${MUTED};\n }\n .uvalib-message {\n margin-block: 0.75rem 0;\n }\n @media (forced-colors: active) {\n .input {\n border-color: CanvasText;\n }\n .clear {\n color: ButtonText;\n }\n }\n `,\n ];\n\n /** The id of the list whose children are the items (for a table, its body rows). */\n @property({ type: String, attribute: 'for' }) htmlFor = '';\n\n /** A CSS selector for the items, inside `for` when it is set, else in the page. */\n @property({ type: String }) selector = '';\n\n /** The field's visible label and accessible name. */\n @property({ type: String }) label = 'Filter';\n\n /** Hide the label visually (it still names the field), when a heading beside it says it. */\n @property({ type: Boolean, reflect: true, attribute: 'hide-label' }) hideLabel = false;\n\n /** Placeholder text in the empty field, such as “Title or author”. */\n @property({ type: String }) placeholder = '';\n\n /** What the items are, plural: “items” by default. */\n @property({ type: String }) noun = 'items';\n\n /** What one item is. Default: “item” when `noun` is unset, else `noun`. */\n @property({ type: String }) singular = '';\n\n /** The id of a `<uvalib-results-count>` to drive instead of the element's own count. */\n @property({ type: String, attribute: 'results-count' }) resultsCount = '';\n\n /**\n * The URL parameter to read the filter from and write it to; a bare attribute uses\n * `filter`. Off by default.\n */\n @property({ type: String, attribute: 'query-param' }) queryParam: string | null = null;\n\n /** The text in the field. Setting it filters the list (not reported to analytics). */\n @property({ type: String }) value = '';\n\n @state() private shownCount = 0;\n @state() private totalCount = 0;\n /** The query the shown counts belong to. */\n @state() private appliedQuery = '';\n @state() private announcement = '';\n\n private readonly uid = `${TAG}-${++uid}`;\n private index?: Index;\n private started = false;\n private warned = false;\n private observer?: MutationObserver;\n private observed?: Element;\n /** The words of the last query reported to analytics (or restored), joined. */\n private reported = '';\n private settleTimer?: ReturnType<typeof setTimeout>;\n private urlTimer?: ReturnType<typeof setTimeout>;\n private clearing?: ReturnType<typeof setTimeout>;\n\n /** How many items match now. */\n get shown(): number {\n return this.shownCount;\n }\n\n /** How many items the list has. */\n get total(): number {\n return this.totalCount;\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 window.addEventListener('popstate', this.onPopState);\n window.addEventListener('pagehide', this.flushUrl);\n // Moved in the page: read the list again and filter it as before.\n if (this.started) this.reset();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('popstate', this.onPopState);\n window.removeEventListener('pagehide', this.flushUrl);\n clearTimeout(this.settleTimer);\n clearTimeout(this.clearing);\n this.flushUrl();\n this.observer?.disconnect();\n this.observed = undefined;\n // Without the field there is no way to clear the filter: show the whole list again.\n this.showAll();\n }\n\n /** The list may come after the element in a page still loading: wait for it then. */\n private begin(): void {\n if (document.readyState === 'loading' && !this.collect())\n document.addEventListener('DOMContentLoaded', () => this.start(), { once: true });\n else this.start();\n }\n\n private start(): void {\n if (this.started || !this.isConnected) return;\n this.started = true;\n const fromUrl = this.urlQuery();\n if (fromUrl !== null) this.value = fromUrl;\n this.reported = queryKey(this.value);\n this.apply();\n }\n\n // Filtering in willUpdate: the counts it sets render in the same update.\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (!this.hasUpdated) return this.begin();\n if (!this.started) return;\n if (changed.has('htmlFor') || changed.has('selector')) this.reset();\n else if (changed.has('value') && this.value !== this.appliedQuery) this.apply();\n }\n\n /** Read the list again (an item's text changed in script) and filter it with the current text. */\n refresh(): void {\n if (this.started) this.reset();\n }\n\n private reset(): void {\n this.showAll();\n this.index = undefined;\n this.apply();\n }\n\n // ---- the list\n\n private lookupRoot(): Document | ShadowRoot {\n const node = this.getRootNode();\n return node instanceof ShadowRoot || node instanceof Document ? node : document;\n }\n\n /** The `for` element, if any. */\n private target(): Element | null {\n return this.htmlFor ? this.lookupRoot().getElementById(this.htmlFor) : null;\n }\n\n private collect(): HTMLElement[] | null {\n const scope = this.target();\n if (this.htmlFor && !scope) return null;\n let found: Element[];\n if (this.selector) {\n try {\n found = [...(scope ?? this.lookupRoot()).querySelectorAll(this.selector)];\n } catch {\n return null;\n }\n } else if (!scope) return null;\n else if (scope instanceof HTMLTableElement)\n found = [...scope.tBodies].flatMap((b) => [...b.rows]);\n else found = [...scope.children];\n return found.filter((e): e is HTMLElement => e instanceof HTMLElement);\n }\n\n private build(): Index | undefined {\n const items = this.collect();\n if (!items) {\n if (!this.warned) {\n this.warned = true;\n console.warn(\n `<${TAG}>: no list found; set \"for\" to the id of the list, or \"selector\" to its items.`,\n );\n }\n return undefined;\n }\n const group = items.map(\n (el) => el.parentElement?.closest<HTMLElement>('[data-filter-group]') ?? null,\n );\n const groups = [...new Set(group.filter((g): g is HTMLElement => g !== null))];\n const root = items[0]?.getRootNode();\n if (root instanceof Document || root instanceof ShadowRoot) installGuard(root);\n for (const parent of new Set([...items, ...groups].map((e) => e.parentElement)))\n parent?.setAttribute(MARK, '');\n this.observe();\n return { items, hidden: items.map((el) => el.hidden), group, groups };\n }\n\n /** Added or removed items, and data-filter-text changes, read the list again. */\n private observe(): void {\n const scope = this.target();\n if (!scope || scope === this.observed) return;\n this.observer?.disconnect();\n this.observer ??= new MutationObserver(() => {\n this.index = undefined;\n this.apply();\n });\n this.observer.observe(scope, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['data-filter-text'],\n });\n this.observed = scope;\n }\n\n private textOf(idx: Index): string[] {\n idx.text ??= idx.items.map((el) => fold(el.dataset.filterText ?? el.textContent ?? ''));\n return idx.text;\n }\n\n /** Show or hide every item for the current text (`user`: typed, so settle, report and write the URL). */\n private apply(user = false): void {\n this.index ??= this.build();\n const idx = this.index;\n const query = this.value;\n const prevQuery = this.appliedQuery;\n this.appliedQuery = query;\n if (!idx) {\n this.shownCount = this.totalCount = 0;\n return;\n }\n const words = queryWords(query);\n const text = words.length ? this.textOf(idx) : [];\n const { items, hidden, group } = idx;\n const visible = new Map<HTMLElement, number>();\n let shown = 0;\n for (let i = 0; i < items.length; i++) {\n let hide = false;\n if (words.length) {\n const t = text[i]!;\n for (const w of words) {\n if (!t.includes(w)) {\n hide = true;\n break;\n }\n }\n }\n if (hidden[i] !== hide) {\n hidden[i] = hide;\n items[i]!.hidden = hide;\n }\n if (!hide) {\n shown++;\n const g = group[i];\n if (g) visible.set(g, (visible.get(g) ?? 0) + 1);\n }\n }\n for (const g of idx.groups) {\n const hide = !visible.has(g);\n if (g.hidden !== hide) g.hidden = hide;\n }\n const changed =\n query !== prevQuery || shown !== this.shownCount || items.length !== this.totalCount;\n this.shownCount = shown;\n this.totalCount = items.length;\n this.driveResultsCount();\n if (changed && (query || prevQuery))\n this.dispatchEvent(\n new CustomEvent<ListFilterChangeDetail>('uvalib-list-filter-change', {\n detail: { query, shown, total: items.length },\n bubbles: true,\n composed: true,\n }),\n );\n if (user) {\n clearTimeout(this.settleTimer);\n this.settleTimer = setTimeout(() => this.settle(), listFilterTiming.settle);\n clearTimeout(this.urlTimer);\n this.urlTimer = setTimeout(this.flushUrl, listFilterTiming.url);\n }\n }\n\n private showAll(): void {\n const idx = this.index;\n if (!idx) return;\n idx.items.forEach((el, i) => {\n if (idx.hidden[i]) el.hidden = idx.hidden[i] = false;\n });\n for (const g of idx.groups) g.hidden = false;\n }\n\n private externalCount(): (HTMLElement & { shown?: number; total?: number }) | null {\n return this.resultsCount ? this.lookupRoot().getElementById(this.resultsCount) : null;\n }\n\n private driveResultsCount(): void {\n const rc = this.externalCount();\n if (!rc) return;\n rc.total = this.totalCount;\n rc.shown = this.shownCount;\n }\n\n // ---- what the visitor sees and hears\n\n private word(n: number): string {\n const plural = this.noun.trim() || 'items';\n if (n !== 1) return plural;\n return this.singular.trim() || (plural === 'items' ? 'item' : plural);\n }\n\n /** The visible count: “Showing 12 of 473 texts”, “Showing all 473 texts”. */\n get countText(): string {\n const total = this.totalCount;\n const shown = this.shownCount;\n if (!total) return this.started && this.index ? `No ${this.word(0)}` : '';\n if (shown < total) return `Showing ${count(shown)} of ${count(total)} ${this.word(total)}`;\n if (total === 1) return `Showing 1 ${this.word(1)}`;\n return `Showing all ${count(total)} ${this.word(total)}`;\n }\n\n private get emptyText(): string {\n const q = this.appliedQuery.trim();\n return this.totalCount && !this.shownCount && q ? `No ${this.word(0)} match “${q}”.` : '';\n }\n\n /** The typing settled: announce the count, and report a new query. */\n private settle(): void {\n if (!this.externalCount()) this.announce(this.emptyText || this.countText);\n const key = queryKey(this.value);\n if (key === this.reported) return;\n if (key) trackEvent(this, [TAG, 'filter', '', this.shownCount]);\n else trackEvent(this, [TAG, 'clear']);\n this.reported = key;\n }\n\n private announce(text: string): void {\n if (!text) return;\n clearTimeout(this.clearing);\n const say = () => {\n this.announcement = text;\n this.clearing = setTimeout(() => (this.announcement = ''), CLEAR_MS);\n };\n // The same words still in the region would not be read again: empty it first.\n if (this.announcement === text) {\n this.announcement = '';\n void this.updateComplete.then(() => requestAnimationFrame(say));\n } else say();\n }\n\n private get input(): HTMLInputElement | null {\n return (this.renderRoot as ParentNode).querySelector<HTMLInputElement>(`#${this.uid}-input`);\n }\n\n private onInput = (e: Event): void => {\n e.stopPropagation();\n this.value = (e.target as HTMLInputElement).value;\n this.apply(true);\n };\n\n private onKeydown = (e: KeyboardEvent): void => {\n if (e.key !== 'Escape' || !this.value) return;\n e.preventDefault();\n this.clear();\n };\n\n private clear = (): void => {\n const input = this.input;\n if (input) input.value = '';\n this.value = '';\n this.apply(true);\n input?.focus();\n trackEvent(this, [TAG, 'clear']);\n this.reported = '';\n };\n\n // ---- the URL\n\n private get param(): string {\n const p = this.queryParam;\n return p === null ? '' : p.trim() || 'filter';\n }\n\n /** The filter in the URL, or null with `query-param` off or the parameter missing. */\n private urlQuery(): string | null {\n const name = this.param;\n return name ? paramFromLocation(location, name) : null;\n }\n\n private flushUrl = (): void => {\n if (this.urlTimer === undefined) return;\n clearTimeout(this.urlTimer);\n this.urlTimer = undefined;\n const name = this.param;\n if (!name) return;\n const q = this.value.trim();\n if ((paramFromLocation(location, name) ?? '') === q) return;\n try {\n history.replaceState(history.state, '', hrefWithParam(location, name, q || null));\n } catch {\n // A document whose URL cannot change (about:srcdoc), or too many changes: skip the URL.\n }\n };\n\n /** Back and Forward: follow the URL's filter. */\n private onPopState = (): void => {\n if (!this.started || !this.param) return;\n const q = this.urlQuery() ?? '';\n if (q === this.value) return;\n this.value = q;\n this.reported = queryKey(q);\n this.apply();\n };\n\n protected override render() {\n const id = this.uid;\n const label = this.label.trim() || 'Filter';\n const own = !this.resultsCount;\n const empty = this.emptyText;\n return html`<label\n class=\"label ${this.hideLabel ? 'visually-hidden' : ''}\"\n part=\"label\"\n for=\"${id}-input\"\n >${label}</label\n >\n <div class=\"field\" part=\"field\">\n <input\n id=\"${id}-input\"\n class=\"input\"\n part=\"input\"\n type=\"search\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n enterkeyhint=\"search\"\n placeholder=${this.placeholder || nothing}\n .value=${this.value}\n @input=${this.onInput}\n @keydown=${this.onKeydown}\n @change=${(e: Event) => e.stopPropagation()}\n /><button\n type=\"button\"\n class=\"clear\"\n part=\"clear\"\n aria-label=\"Clear ${label}\"\n ?hidden=${!this.value}\n @mousedown=${(e: MouseEvent) => e.preventDefault()}\n @click=${this.clear}\n >\n ${CLEAR_ICON}\n </button>\n </div>\n ${own ? html`<p class=\"count\" part=\"count\">${this.countText}</p>` : nothing}\n <p class=\"uvalib-message\" part=\"empty\" ?hidden=${!empty}>${empty}</p>\n ${\n own\n ? html`<span class=\"visually-hidden\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"\n >${this.announcement}</span\n >`\n : nothing\n }`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibListFilter } from './UvalibListFilter.js';\n\ndefine('uvalib-list-filter', UvalibListFilter);\n"],"mappings":";;;;;AAmBA,IAAaoB,IAAU,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCApBC,IAAM,sBAOCC,IAAmB;CAAE,QAAQ;CAAM,KAAK;AAAI,GAEnDC,IAAW,KACbC,IAAM,GAEJC,IAAQ,WAEDC,KAAQ,MAAsBC,EAAE,UAAU,KAAK,CAAC,CAAC,QAAQF,GAAO,EAAE,CAAC,CAAC,YAAY,GAEhFG,KAAc,MAAwBF,EAAKG,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,OAAO,GAEhFC,KAAY,MAAsBF,EAAWC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,GAAG,GAEnEE,KAAS,MAAc1B,EAAE,eAAe,OAAO,GAkB/C2B,oBAAS,IAAI,QAA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