@uvalib/web-components 1.8.5 → 1.10.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 (98) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +719 -72
  3. package/bin/install-skill.mjs +174 -54
  4. package/dist/base/clipboard.d.ts +9 -0
  5. package/dist/base/clipboard.js +30 -0
  6. package/dist/base/clipboard.js.map +1 -0
  7. package/dist/base.css +301 -3
  8. package/dist/components/uvalib-citation/UvalibCitation.d.ts +124 -0
  9. package/dist/components/uvalib-citation/UvalibCitation.js +545 -0
  10. package/dist/components/uvalib-citation/UvalibCitation.js.map +1 -0
  11. package/dist/components/uvalib-citation/uvalib-citation.d.ts +1 -0
  12. package/dist/components/uvalib-citation/uvalib-citation.js +4 -0
  13. package/dist/components/uvalib-citation/uvalib-citation.js.map +1 -0
  14. package/dist/components/uvalib-dialog/UvalibDialog.d.ts +167 -0
  15. package/dist/components/uvalib-dialog/UvalibDialog.js +688 -0
  16. package/dist/components/uvalib-dialog/UvalibDialog.js.map +1 -0
  17. package/dist/components/uvalib-dialog/uvalib-dialog.d.ts +1 -0
  18. package/dist/components/uvalib-dialog/uvalib-dialog.js +4 -0
  19. package/dist/components/uvalib-dialog/uvalib-dialog.js.map +1 -0
  20. package/dist/components/uvalib-filter/UvalibFilter.d.ts +92 -9
  21. package/dist/components/uvalib-filter/UvalibFilter.js +748 -60
  22. package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -1
  23. package/dist/components/uvalib-list-filter/UvalibListFilter.d.ts +162 -0
  24. package/dist/components/uvalib-list-filter/UvalibListFilter.js +685 -0
  25. package/dist/components/uvalib-list-filter/UvalibListFilter.js.map +1 -0
  26. package/dist/components/uvalib-list-filter/uvalib-list-filter.d.ts +1 -0
  27. package/dist/components/uvalib-list-filter/uvalib-list-filter.js +4 -0
  28. package/dist/components/uvalib-list-filter/uvalib-list-filter.js.map +1 -0
  29. package/dist/components/uvalib-metadata/UvalibMetadata.js +3 -4
  30. package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
  31. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.d.ts +28 -1
  32. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js +139 -3
  33. package/dist/components/uvalib-pagefind-search/UvalibPagefindSearch.js.map +1 -1
  34. package/dist/custom-elements.json +9503 -6086
  35. package/dist/edition.css +758 -0
  36. package/dist/index.d.ts +6 -0
  37. package/dist/index.js +3 -0
  38. package/dist/index.js.map +1 -1
  39. package/dist/styles/base.js +112 -1
  40. package/dist/styles/base.js.map +1 -1
  41. package/dist/styles/color-scheme.js +4 -0
  42. package/dist/styles/color-scheme.js.map +1 -1
  43. package/dist/styles/controls.js +6 -0
  44. package/dist/styles/controls.js.map +1 -1
  45. package/dist/styles/edition.d.ts +1 -0
  46. package/dist/styles/edition.js +747 -0
  47. package/dist/styles/edition.js.map +1 -0
  48. package/dist/styles/field-text.d.ts +1 -0
  49. package/dist/styles/field-text.js +21 -0
  50. package/dist/styles/field-text.js.map +1 -0
  51. package/dist/styles/hidden.js +15 -1
  52. package/dist/styles/hidden.js.map +1 -1
  53. package/dist/styles/layout.d.ts +1 -0
  54. package/dist/styles/layout.js +92 -0
  55. package/dist/styles/layout.js.map +1 -0
  56. package/dist/styles/table.d.ts +1 -0
  57. package/dist/styles/table.js +164 -0
  58. package/dist/styles/table.js.map +1 -0
  59. package/dist/tokens.css +4 -0
  60. package/dist-cdn/base.css +301 -3
  61. package/dist-cdn/chunks/{base-B3tNX103.js → base-DXkGlSgH.js} +113 -2
  62. package/dist-cdn/chunks/base-DXkGlSgH.js.map +1 -0
  63. package/dist-cdn/chunks/clipboard-CNG7Y_5X.js +18 -0
  64. package/dist-cdn/chunks/clipboard-CNG7Y_5X.js.map +1 -0
  65. package/dist-cdn/chunks/if-defined-COiQb-gl.js +6 -0
  66. package/dist-cdn/chunks/if-defined-COiQb-gl.js.map +1 -0
  67. package/dist-cdn/chunks/{site-header-CEmNtmk5.js → site-header-B78a_ldi.js} +27 -22
  68. package/dist-cdn/chunks/site-header-B78a_ldi.js.map +1 -0
  69. package/dist-cdn/chunks/{site-main-nav-CAwKq_x5.js → site-main-nav-CmMq2t8t.js} +52 -51
  70. package/dist-cdn/chunks/site-main-nav-CmMq2t8t.js.map +1 -0
  71. package/dist-cdn/custom-elements.json +9503 -6086
  72. package/dist-cdn/edition.css +758 -0
  73. package/dist-cdn/manifest.json +7 -3
  74. package/dist-cdn/site-header.js +1 -1
  75. package/dist-cdn/site-main-nav.js +1 -1
  76. package/dist-cdn/site-page.js +3 -3
  77. package/dist-cdn/site-style.js +1 -1
  78. package/dist-cdn/skills/uvalib-web-components/SKILL.md +34 -10
  79. package/dist-cdn/skills/uvalib-web-components/reference/components.md +188 -9
  80. package/dist-cdn/tokens.css +4 -0
  81. package/dist-cdn/uvalib-citation.js +382 -0
  82. package/dist-cdn/uvalib-citation.js.map +1 -0
  83. package/dist-cdn/uvalib-dialog.js +419 -0
  84. package/dist-cdn/uvalib-dialog.js.map +1 -0
  85. package/dist-cdn/uvalib-filter.js +603 -69
  86. package/dist-cdn/uvalib-filter.js.map +1 -1
  87. package/dist-cdn/uvalib-list-filter.js +451 -0
  88. package/dist-cdn/uvalib-list-filter.js.map +1 -0
  89. package/dist-cdn/uvalib-metadata.js +49 -49
  90. package/dist-cdn/uvalib-metadata.js.map +1 -1
  91. package/dist-cdn/uvalib-pagefind-search.js +118 -48
  92. package/dist-cdn/uvalib-pagefind-search.js.map +1 -1
  93. package/package.json +14 -1
  94. package/skills/uvalib-web-components/SKILL.md +34 -10
  95. package/skills/uvalib-web-components/reference/components.md +188 -9
  96. package/dist-cdn/chunks/base-B3tNX103.js.map +0 -1
  97. package/dist-cdn/chunks/site-header-CEmNtmk5.js.map +0 -1
  98. package/dist-cdn/chunks/site-main-nav-CAwKq_x5.js.map +0 -1
@@ -0,0 +1,382 @@
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/clipboard-CNG7Y_5X.js";
4
+ import { t as m } from "./chunks/inline-copy-BANQSMIR.js";
5
+ import { n as h, r as g, t as _ } from "./chunks/source-children-BHsDwCvL.js";
6
+ import { t as v } from "./chunks/accessible-DJv7YOtS.js";
7
+ // src/components/uvalib-citation/UvalibCitation.ts
8
+ var y = "uvalib-citation", b = "uvalib-citation-format", x = 5e3, S = { settle: 1e3 }, C = 0, w = t`<svg class="check" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path d="M3 8.5l3.2 3.2L13 4.8" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>`, T = (e) => `
9
+ ${e} { display: block; min-width: 0; }
10
+ /* Its own formatting context: the format bar's negative margin (focus-ring room) stays in. */
11
+ ${e} .wrap { display: flow-root; }
12
+ ${e} .formats {
13
+ display: flex;
14
+ flex-wrap: nowrap;
15
+ overflow-x: auto;
16
+ min-width: 0;
17
+ }
18
+ ${e} .format {
19
+ position: relative;
20
+ display: inline-flex;
21
+ flex: none;
22
+ box-sizing: border-box;
23
+ min-width: 44px;
24
+ min-height: 44px;
25
+ margin: 0;
26
+ cursor: pointer;
27
+ }
28
+ ${e} .format input {
29
+ position: absolute;
30
+ inset: 0;
31
+ width: 100%;
32
+ height: 100%;
33
+ margin: 0;
34
+ opacity: 0;
35
+ cursor: inherit;
36
+ }
37
+ ${e} .face {
38
+ display: inline-flex;
39
+ flex: 1;
40
+ align-items: center;
41
+ justify-content: center;
42
+ gap: 0.375rem;
43
+ white-space: nowrap;
44
+ }
45
+ ${e} .check { flex: none; width: 1em; height: 1em; }
46
+ ${e} .format input:not(:checked) + .face .check { display: none; }
47
+ ${e} .format input:focus-visible + .face {
48
+ outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));
49
+ outline-offset: 2px;
50
+ }
51
+ ${e} .actions { display: flex; flex-wrap: wrap; align-items: center; }
52
+ ${e} .extra { display: contents; }
53
+ ${e} .uvalib-button { box-sizing: border-box; min-height: 44px; }
54
+ ${e} .visually-hidden {
55
+ position: absolute;
56
+ width: 1px;
57
+ height: 1px;
58
+ margin: -1px;
59
+ padding: 0;
60
+ overflow: hidden;
61
+ clip: rect(0, 0, 0, 0);
62
+ white-space: nowrap;
63
+ border: 0;
64
+ }
65
+ ${e}[hidden], ${e} [hidden] { display: none !important; }
66
+ `, E = c(T(":host")), D = c("var(--uva-color-control-border, var(--uva-grey, #808080))"), O = c("var(--uva-color-link, var(--uva-brand-blue, #232d4b))"), k = c("var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b))"), A = class extends u {
67
+ static {
68
+ this.styles = [
69
+ v,
70
+ E,
71
+ n`
72
+ :host {
73
+ font-size: 1rem;
74
+ line-height: 1.5;
75
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
76
+ }
77
+ .label {
78
+ margin: 0 0 0.5rem;
79
+ font-weight: 700;
80
+ }
81
+ /* The padding keeps the focus ring inside the scroll box; the bar itself is 44px. */
82
+ .formats {
83
+ padding: 0.375rem;
84
+ margin: -0.375rem -0.375rem 0.375rem;
85
+ }
86
+ .face {
87
+ padding: 0.25rem 0.75rem;
88
+ border: 1px solid ${D};
89
+ background: var(--uva-color-surface-raised, #fff);
90
+ color: ${O};
91
+ font-size: 0.875rem;
92
+ font-weight: 600;
93
+ line-height: 1.3;
94
+ }
95
+ .format + .format {
96
+ margin-inline-start: -1px;
97
+ }
98
+ .format:first-child .face {
99
+ border-start-start-radius: 0.3rem;
100
+ border-end-start-radius: 0.3rem;
101
+ }
102
+ .format:last-child .face {
103
+ border-start-end-radius: 0.3rem;
104
+ border-end-end-radius: 0.3rem;
105
+ }
106
+ .format:hover input:not(:checked) + .face {
107
+ position: relative;
108
+ border-color: ${O};
109
+ }
110
+ .format input:checked + .face {
111
+ position: relative;
112
+ border-color: ${k};
113
+ background: ${k};
114
+ color: var(--uva-color-on-accent, #fff);
115
+ }
116
+ .format input:focus-visible + .face {
117
+ position: relative;
118
+ z-index: 1;
119
+ }
120
+ .citation {
121
+ margin: 0;
122
+ padding: 0.75rem 1rem;
123
+ border: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));
124
+ border-radius: 0.3rem;
125
+ background: var(--uva-color-surface-raised, #fff);
126
+ overflow-wrap: anywhere;
127
+ text-wrap: pretty;
128
+ }
129
+ .actions {
130
+ gap: 0.5rem 0.75rem;
131
+ margin-top: 0.75rem;
132
+ }
133
+ .uvalib-button {
134
+ display: inline-flex;
135
+ align-items: center;
136
+ padding: 0.25rem 0.75rem;
137
+ border: 1px solid ${O};
138
+ border-radius: 0.3rem;
139
+ background: var(--uva-color-surface-raised, #fff);
140
+ color: ${O};
141
+ font: inherit;
142
+ text-decoration: none;
143
+ cursor: pointer;
144
+ }
145
+ a.uvalib-button {
146
+ text-decoration: underline;
147
+ }
148
+ .uvalib-button:hover {
149
+ text-decoration: underline;
150
+ }
151
+ slot[name='actions']::slotted(*) {
152
+ min-height: 44px;
153
+ }
154
+ .status {
155
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
156
+ font-weight: 600;
157
+ }
158
+ @media (forced-colors: active) {
159
+ .face,
160
+ .citation,
161
+ .uvalib-button {
162
+ border-color: ButtonText;
163
+ }
164
+ .face,
165
+ button.uvalib-button {
166
+ color: ButtonText;
167
+ }
168
+ a.uvalib-button {
169
+ color: LinkText;
170
+ }
171
+ .format input:checked + .face {
172
+ forced-color-adjust: none;
173
+ border-color: Highlight;
174
+ background: Highlight;
175
+ color: HighlightText;
176
+ }
177
+ .format input:focus-visible + .face {
178
+ outline-color: Highlight;
179
+ }
180
+ }
181
+ `
182
+ ];
183
+ }
184
+ constructor() {
185
+ super(), this.label = "Cite this item", this.hideLabel = !1, this.format = "", this.remember = !1, this.risHref = "", this.risLabel = "Download RIS", this.childFormats = [], this.status = "", this.uid = `${y}-${++C}`, this.sourceKey = "", this.restored = !1, this.warned = /* @__PURE__ */ new Set(), this.made = [], this.source = new _(this, () => this.lightDom, (e) => this.read(e));
186
+ }
187
+ createRenderRoot() {
188
+ let e = super.createRenderRoot();
189
+ if (e instanceof ShadowRoot && this.noStyle) {
190
+ let t = E.styleSheet;
191
+ t && (e.adoptedStyleSheets = [t]);
192
+ }
193
+ return e;
194
+ }
195
+ connectedCallback() {
196
+ if (super.connectedCallback(), this.lightDom && this.noStyle) {
197
+ let e = this.getRootNode();
198
+ l(`${y}::structure`, c(T(y)), {
199
+ root: e instanceof ShadowRoot || e instanceof Document ? e : void 0,
200
+ scope: !1
201
+ });
202
+ }
203
+ }
204
+ disconnectedCallback() {
205
+ super.disconnectedCallback(), clearTimeout(this.timer), this.flushFormat(), this.status = "";
206
+ }
207
+ warnOnce(e, t) {
208
+ this.warned.has(e) || (this.warned.add(e), console.warn(`${y}: ${t}`));
209
+ }
210
+ read(e) {
211
+ let t = [];
212
+ for (let n of e) {
213
+ if (!(n instanceof Element) || !n.hasAttribute("data-format")) continue;
214
+ let e = h(n.getAttribute("data-format"));
215
+ e ? t.push({
216
+ name: e,
217
+ ...m(n.childNodes, this.ownerDocument)
218
+ }) : this.warnOnce("format", "ignoring a citation with an empty data-format.");
219
+ }
220
+ let n = this.unique(t), r = n.map((e) => `${e.name}\u0000${e.key}`).join("");
221
+ r !== this.sourceKey && (this.sourceKey = r, this.childFormats = n);
222
+ }
223
+ unique(e) {
224
+ let t = /* @__PURE__ */ new Set();
225
+ return e.filter((e) => {
226
+ let n = e.name.toLowerCase();
227
+ return t.has(n) ? (this.warnOnce("duplicate", `ignoring a second citation named "${e.name}".`), !1) : (t.add(n), !0);
228
+ });
229
+ }
230
+ fromItems(e) {
231
+ if (e === this.madeFrom) return this.made;
232
+ let t = this.ownerDocument, n = [];
233
+ for (let r of e) {
234
+ let e = h(r?.format);
235
+ if (!e) {
236
+ this.warnOnce("format", "ignoring a citation with no format.");
237
+ continue;
238
+ }
239
+ let i;
240
+ if (typeof r.html == "string") {
241
+ let e = t.createElement("template");
242
+ e.innerHTML = r.html, i = [...e.content.childNodes];
243
+ } else i = [t.createTextNode(r.text == null ? "" : String(r.text))];
244
+ n.push({
245
+ name: e,
246
+ ...m(i, t)
247
+ });
248
+ }
249
+ return this.madeFrom = e, this.made = this.unique(n), this.made;
250
+ }
251
+ get formats() {
252
+ return this.citations ? this.fromItems(this.citations) : this.childFormats;
253
+ }
254
+ get selected() {
255
+ let e = this.formats, t = h(this.format);
256
+ return e.find((e) => e.name === t) ?? e.find((e) => e.name.toLowerCase() === t.toLowerCase()) ?? e[0];
257
+ }
258
+ willUpdate(e) {
259
+ if (super.willUpdate(e), this.remember && !this.restored && this.formats.length) {
260
+ this.restored = !0;
261
+ let e = j(), t = e && this.formats.find((t) => t.name.toLowerCase() === e);
262
+ t && (this.format = t.name);
263
+ }
264
+ }
265
+ updated(e) {
266
+ super.updated(e), this.toggleAttribute("data-empty", !this.formats.length), this.lightDom && this.placeActions();
267
+ }
268
+ placeActions() {
269
+ let e = this.querySelector(":scope > .wrap .extra");
270
+ if (e) for (let t of this.source.nodes()) t instanceof Element && t.getAttribute("slot") === "actions" && e.append(t);
271
+ }
272
+ choose(e) {
273
+ let t = this.selected?.name ?? "";
274
+ e !== t && (this.format = e, clearTimeout(this.timer), this.status = "", this.remember && M(e.toLowerCase()), this.dispatchEvent(new CustomEvent("uvalib-citation-format", {
275
+ detail: { format: e },
276
+ bubbles: !0,
277
+ composed: !0
278
+ })), this.pending ??= t, clearTimeout(this.settleTimer), this.settleTimer = setTimeout(() => this.flushFormat(), S.settle));
279
+ }
280
+ flushFormat() {
281
+ clearTimeout(this.settleTimer);
282
+ let e = this.pending;
283
+ this.pending = void 0;
284
+ let t = this.selected?.name;
285
+ e !== void 0 && t && t !== e && d(this, [
286
+ y,
287
+ "format",
288
+ t
289
+ ]);
290
+ }
291
+ get citationEl() {
292
+ return this.renderRoot.querySelector(".citation");
293
+ }
294
+ async copy() {
295
+ let e = this.selected;
296
+ if (!e) return;
297
+ d(this, [
298
+ y,
299
+ "copy",
300
+ e.name
301
+ ]), clearTimeout(this.timer), this.status = "", await this.updateComplete;
302
+ let t = this.ownerDocument.createElement("div");
303
+ t.append(...e.nodes.map((e) => e.cloneNode(!0)));
304
+ let n = h(t.textContent), r = `${e.name} citation copied`;
305
+ try {
306
+ await p(n, e.rich ? t.innerHTML.trim() : void 0), this.timer = setTimeout(() => this.status = "", x);
307
+ } catch {
308
+ f(this.citationEl), r = `Could not copy: the ${e.name} citation is selected, copy it with your keyboard`;
309
+ }
310
+ this.status = r;
311
+ }
312
+ download() {
313
+ d(this, [
314
+ y,
315
+ "download",
316
+ "ris"
317
+ ]);
318
+ }
319
+ renderRis() {
320
+ let e = h(this.risHref);
321
+ return e ? g(e, this.ownerDocument.baseURI) ? i`<a class="uvalib-button" href=${e} download @click=${this.download}
322
+ >${h(this.risLabel) || "Download RIS"}</a
323
+ >` : (this.warnOnce("href", "ignoring ris-href: it is not http(s) or relative."), s) : s;
324
+ }
325
+ render() {
326
+ let e = this.formats, t = this.selected;
327
+ if (!t) return s;
328
+ let n = `${this.uid}-label`;
329
+ return i`<div class="wrap" role="group" aria-labelledby=${n}>
330
+ <p class="label ${this.hideLabel ? "visually-hidden" : ""}" id=${n}>
331
+ ${h(this.label) || "Cite this item"}
332
+ </p>
333
+ <div class="formats" role="radiogroup" aria-label="Citation format">
334
+ ${e.map((e) => i`<label class="format"
335
+ ><input
336
+ type="radio"
337
+ name="${this.uid}-format"
338
+ .checked=${e === t}
339
+ @change=${() => this.choose(e.name)}
340
+ /><span class="face">${w}<span>${e.name}</span></span></label
341
+ >`)}
342
+ </div>
343
+ <div class="citation" role="region" aria-label="${t.name} citation">${t.nodes}</div>
344
+ <div class="actions">
345
+ <button type="button" class="uvalib-button" @click=${this.copy}>Copy citation</button>
346
+ ${this.renderRis()}
347
+ <span class="extra">${this.lightDom ? s : i`<slot name="actions"></slot>`}</span>
348
+ <span class="status" role="status">${this.status}</span>
349
+ </div>
350
+ </div>`;
351
+ }
352
+ };
353
+ o([e({ type: String })], A.prototype, "label", void 0), o([e({
354
+ type: Boolean,
355
+ reflect: !0,
356
+ attribute: "hide-label"
357
+ })], A.prototype, "hideLabel", void 0), o([e({
358
+ type: String,
359
+ reflect: !0
360
+ })], A.prototype, "format", void 0), o([e({ type: Boolean })], A.prototype, "remember", void 0), o([e({ attribute: !1 })], A.prototype, "citations", void 0), o([e({
361
+ type: String,
362
+ attribute: "ris-href"
363
+ })], A.prototype, "risHref", void 0), o([e({
364
+ type: String,
365
+ attribute: "ris-label"
366
+ })], A.prototype, "risLabel", void 0), o([r()], A.prototype, "childFormats", void 0), o([r()], A.prototype, "status", void 0);
367
+ function j() {
368
+ try {
369
+ return localStorage.getItem("uvalib-citation-format")?.toLowerCase() || void 0;
370
+ } catch {
371
+ return;
372
+ }
373
+ }
374
+ function M(e) {
375
+ try {
376
+ localStorage.setItem(b, e);
377
+ } catch {}
378
+ }
379
+ // src/components/uvalib-citation/uvalib-citation.ts
380
+ a("uvalib-citation", A);
381
+
382
+ //# sourceMappingURL=uvalib-citation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uvalib-citation.js","names":["unsafeCSS","nothing","_decorate","property","state","n","w","i","r$1","b","define","__decorate","A","r","installLightDomStyles","UvalibElement","trackEvent","selectContents","copyText","inlineCopy","normalize","safeHref","SourceChildren","accessible","TAG","STORAGE_KEY","STATUS_MS","citationTiming","uid","CHECK","structuralRules","host","shadowStructure","BORDER","LINK","ACCENT","UvalibCitation","nodes","root","sheet","node","kind","message","formats","name","unique","key","f","seen","k","items","doc","source","t","all","want","changed","stored","readStored","match","row","before","writeStored","from","now","box","text","href","labelId","x"],"sources":["../src/components/uvalib-citation/UvalibCitation.ts","../src/components/uvalib-citation/uvalib-citation.ts"],"sourcesContent":["import { css, html, nothing, svg, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { copyText, selectContents } from '../../base/clipboard.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { inlineCopy } from '../../base/inline-copy.js';\nimport { normalize, safeHref, SourceChildren } from '../../base/source-children.js';\nimport { accessible } from '../../styles/accessible.js';\n\n/** One format's citation, for apps: plain `text`, or `html` with inline emphasis only. */\nexport interface CitationItem {\n /** The format's name, shown on its radio and in the status: `MLA`, `APA`, `Chicago`… */\n format: string;\n /** The citation as plain text (never parsed as HTML). */\n text?: string;\n /**\n * The citation with inline markup such as `<i>` for a title. Only inline elements (`i`,\n * `em`, `b`, `strong`, `span`, `cite`…) are kept, without attributes other than `lang` and\n * `dir`; anything else is reduced to its text. Wins over `text`.\n */\n html?: string;\n}\n\n/** A format as drawn: its name, the safe copy of its citation, and that copy's key. */\ninterface Format {\n name: string;\n nodes: Node[];\n key: string;\n rich: boolean;\n}\n\nconst TAG = 'uvalib-citation';\n/** The visitor's last format with `remember` (localStorage is per origin: per site). */\nexport const STORAGE_KEY = 'uvalib-citation-format';\nconst STATUS_MS = 5000;\n/**\n * Format changes within `settle` ms count as one for analytics (arrowing through the radios\n * reports once, for the format the visitor ends on; nothing when it is where they started).\n * Tests may shorten it.\n */\nexport const citationTiming = { settle: 1000 };\nlet uid = 0;\n\n/** The tick on the selected format, so the state never rests on colour alone. */\nconst CHECK = svg`<svg class=\"check\" viewBox=\"0 0 16 16\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M3 8.5l3.2 3.2L13 4.8\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>`;\n\n/**\n * Kept with `no-style`: the stacking, each radio laid over its 44px segment, the visually\n * hidden text, and `[hidden]`. `host` is `:host` or the tag.\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; min-width: 0; }\n /* Its own formatting context: the format bar's negative margin (focus-ring room) stays in. */\n ${host} .wrap { display: flow-root; }\n ${host} .formats {\n display: flex;\n flex-wrap: nowrap;\n overflow-x: auto;\n min-width: 0;\n }\n ${host} .format {\n position: relative;\n display: inline-flex;\n flex: none;\n box-sizing: border-box;\n min-width: 44px;\n min-height: 44px;\n margin: 0;\n cursor: pointer;\n }\n ${host} .format input {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n opacity: 0;\n cursor: inherit;\n }\n ${host} .face {\n display: inline-flex;\n flex: 1;\n align-items: center;\n justify-content: center;\n gap: 0.375rem;\n white-space: nowrap;\n }\n ${host} .check { flex: none; width: 1em; height: 1em; }\n ${host} .format input:not(:checked) + .face .check { display: none; }\n ${host} .format input:focus-visible + .face {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n ${host} .actions { display: flex; flex-wrap: wrap; align-items: center; }\n ${host} .extra { display: contents; }\n ${host} .uvalib-button { box-sizing: border-box; min-height: 44px; }\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 LINK = unsafeCSS('var(--uva-color-link, var(--uva-brand-blue, #232d4b))');\nconst ACCENT = unsafeCSS('var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b))');\n\n/**\n * One record's citation in several formats (MLA, APA, Chicago, Bluebook…), a radio group to\n * choose one, and a Copy citation button, as in Virgo's Cite dialog. Inline on a record page\n * or inside a dialog: it assumes nothing about where it sits.\n *\n * Give each format as a child, `<blockquote data-format=\"MLA\">…</blockquote>` (any element\n * with `data-format`), so the page reads the same before the script loads (with `base.css`,\n * only the first shows then, and the chooser's and button's space is held). Inline markup in\n * a citation (`<i>` or `<em>` for a title) is kept; other elements are reduced to their text\n * and nothing is parsed as HTML. Apps set the `citations` property instead (`[{ format, text,\n * html? }]`, winning over the children while set); `html` keeps only inline elements, too.\n *\n * The formats are native radios drawn as one segmented bar (`role=\"radiogroup\"`, \"Citation\n * format\"): one tab stop, the arrow keys move and select, and the selected one is filled and\n * ticked. `format` names the selected one (default the first). With `remember`, the visitor's\n * last choice is kept in localStorage (per site) and wins over `format` on their next record.\n *\n * The selected citation is shown as selectable text in a region named \"<format> citation\".\n * Copy citation copies it as plain text and as HTML where the browser allows (so an italic\n * title stays italic when pasted into a word processor) and says \"MLA citation copied\" in a\n * polite status next to the button, in the text colour (AAA), not in a toast. If the clipboard\n * is unavailable, the citation is selected and the status says to copy it with the keyboard.\n *\n * `ris-href` adds a \"Download RIS\" link (`ris-label`) with a `download` attribute. Other export\n * links go in the `actions` slot (`<a slot=\"actions\" href=\"…\" download>EndNote</a>`), after it.\n *\n * @tagname uvalib-citation\n * @slot actions - More export links or buttons, after Copy citation and Download RIS.\n * @fires uvalib-citation-format - The visitor chose another format: `detail` is `{ format }`. Not fired when the app sets `format`. Bubbles and is composed.\n * @fires uvalib-analytics-event - For `<site-analytics>`, on the visitor's actions only: `['uvalib-citation', 'format', '<format>']` (once the visitor settles on one, a second after the last change), `['uvalib-citation', 'copy', '<format>']` and `['uvalib-citation', 'download', 'ris']`. Never the citation. Bubbles and is composed.\n * @cssprop --uva-color-text - Dark-mode role token: label, citation and status colour (else `--uva-grey-darkest`).\n * @cssprop --uva-color-border - Dark-mode role token: the citation's border (else #dadada).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: the citation's, segments' and buttons' background (else #fff).\n * @cssprop --uva-color-control-border - Dark-mode role token: segment border (else `--uva-grey`, #808080).\n * @cssprop --uva-color-link - Dark-mode role token: segment and button text, button border (else `--uva-brand-blue`).\n * @cssprop --uva-color-accent-bg - Dark-mode role token: the selected segment (else `--uva-brand-blue`).\n * @cssprop --uva-color-on-accent - Dark-mode role token: the selected segment's text (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibCitation extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n font-size: 1rem;\n line-height: 1.5;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n }\n .label {\n margin: 0 0 0.5rem;\n font-weight: 700;\n }\n /* The padding keeps the focus ring inside the scroll box; the bar itself is 44px. */\n .formats {\n padding: 0.375rem;\n margin: -0.375rem -0.375rem 0.375rem;\n }\n .face {\n padding: 0.25rem 0.75rem;\n border: 1px solid ${BORDER};\n background: var(--uva-color-surface-raised, #fff);\n color: ${LINK};\n font-size: 0.875rem;\n font-weight: 600;\n line-height: 1.3;\n }\n .format + .format {\n margin-inline-start: -1px;\n }\n .format:first-child .face {\n border-start-start-radius: 0.3rem;\n border-end-start-radius: 0.3rem;\n }\n .format:last-child .face {\n border-start-end-radius: 0.3rem;\n border-end-end-radius: 0.3rem;\n }\n .format:hover input:not(:checked) + .face {\n position: relative;\n border-color: ${LINK};\n }\n .format input:checked + .face {\n position: relative;\n border-color: ${ACCENT};\n background: ${ACCENT};\n color: var(--uva-color-on-accent, #fff);\n }\n .format input:focus-visible + .face {\n position: relative;\n z-index: 1;\n }\n .citation {\n margin: 0;\n padding: 0.75rem 1rem;\n border: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n overflow-wrap: anywhere;\n text-wrap: pretty;\n }\n .actions {\n gap: 0.5rem 0.75rem;\n margin-top: 0.75rem;\n }\n .uvalib-button {\n display: inline-flex;\n align-items: center;\n padding: 0.25rem 0.75rem;\n border: 1px solid ${LINK};\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: ${LINK};\n font: inherit;\n text-decoration: none;\n cursor: pointer;\n }\n a.uvalib-button {\n text-decoration: underline;\n }\n .uvalib-button:hover {\n text-decoration: underline;\n }\n slot[name='actions']::slotted(*) {\n min-height: 44px;\n }\n .status {\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n font-weight: 600;\n }\n @media (forced-colors: active) {\n .face,\n .citation,\n .uvalib-button {\n border-color: ButtonText;\n }\n .face,\n button.uvalib-button {\n color: ButtonText;\n }\n a.uvalib-button {\n color: LinkText;\n }\n .format input:checked + .face {\n forced-color-adjust: none;\n border-color: Highlight;\n background: Highlight;\n color: HighlightText;\n }\n .format input:focus-visible + .face {\n outline-color: Highlight;\n }\n }\n `,\n ];\n\n /** The group's visible label and accessible name. */\n @property({ type: String }) label = 'Cite this item';\n\n /** Hide the label visually (it still names the group), for a dialog whose heading says it. */\n @property({ type: Boolean, reflect: true, attribute: 'hide-label' }) hideLabel = false;\n\n /** The selected format's name (default the first). Reflected when the visitor chooses one. */\n @property({ type: String, reflect: true }) format = '';\n\n /** Keep the visitor's last format in localStorage (per site), winning over `format`. */\n @property({ type: Boolean }) remember = false;\n\n /**\n * The citations as data, for apps: `{ format, text?, html? }`. Wins over the children while\n * set; `undefined` goes back to them.\n */\n @property({ attribute: false }) citations?: CitationItem[];\n\n /** A RIS file for the record: adds a download link. */\n @property({ type: String, attribute: 'ris-href' }) risHref = '';\n\n /** The RIS link's text. */\n @property({ type: String, attribute: 'ris-label' }) risLabel = 'Download RIS';\n\n @state() private childFormats: Format[] = [];\n @state() private status = '';\n\n private readonly uid = `${TAG}-${++uid}`;\n private readonly source: SourceChildren;\n private sourceKey = '';\n private restored = false;\n private warned = new Set<string>();\n private timer?: ReturnType<typeof setTimeout>;\n /** The format change waiting to settle: where the burst started. */\n private pending?: string;\n private settleTimer?: ReturnType<typeof setTimeout>;\n /** The `citations` array the formats below were made from. */\n private madeFrom?: CitationItem[];\n private made: Format[] = [];\n\n constructor() {\n super();\n this.source = new SourceChildren(\n this,\n () => this.lightDom,\n (nodes) => this.read(nodes),\n );\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(`${TAG}::structure`, unsafeCSS(structuralRules(TAG)), {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n });\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearTimeout(this.timer);\n this.flushFormat();\n this.status = '';\n }\n\n private warnOnce(kind: string, message: string): void {\n if (this.warned.has(kind)) return;\n this.warned.add(kind);\n console.warn(`${TAG}: ${message}`);\n }\n\n /** Read the formats from the children with `data-format` (not the `actions` slot). */\n private read(nodes: Node[]): void {\n const formats: Format[] = [];\n for (const n of nodes) {\n if (!(n instanceof Element) || !n.hasAttribute('data-format')) continue;\n const name = normalize(n.getAttribute('data-format'));\n if (!name) {\n this.warnOnce('format', 'ignoring a citation with an empty data-format.');\n continue;\n }\n formats.push({ name, ...inlineCopy(n.childNodes, this.ownerDocument) });\n }\n const unique = this.unique(formats);\n const key = unique.map((f) => `${f.name}\\u0000${f.key}`).join('\\u0001');\n if (key === this.sourceKey) return;\n this.sourceKey = key;\n this.childFormats = unique;\n }\n\n /** The first of each name, with one warning for the others. */\n private unique(formats: Format[]): Format[] {\n const seen = new Set<string>();\n return formats.filter((f) => {\n const k = f.name.toLowerCase();\n if (seen.has(k)) {\n this.warnOnce('duplicate', `ignoring a second citation named \"${f.name}\".`);\n return false;\n }\n seen.add(k);\n return true;\n });\n }\n\n /** The formats from `citations`, made once per array. */\n private fromItems(items: readonly CitationItem[]): Format[] {\n if (items === this.madeFrom) return this.made;\n const doc = this.ownerDocument;\n const formats: Format[] = [];\n for (const i of items) {\n const name = normalize(i?.format);\n if (!name) {\n this.warnOnce('format', 'ignoring a citation with no format.');\n continue;\n }\n let source: Node[];\n if (typeof i.html === 'string') {\n // A template's content is inert: nothing in it runs or loads.\n const t = doc.createElement('template');\n t.innerHTML = i.html;\n source = [...t.content.childNodes];\n } else source = [doc.createTextNode(i.text == null ? '' : String(i.text))];\n formats.push({ name, ...inlineCopy(source, doc) });\n }\n this.madeFrom = items as CitationItem[];\n this.made = this.unique(formats);\n return this.made;\n }\n\n private get formats(): Format[] {\n return this.citations ? this.fromItems(this.citations) : this.childFormats;\n }\n\n /** The selected format: `format` (case-insensitive), else the first. */\n private get selected(): Format | undefined {\n const all = this.formats;\n const want = normalize(this.format);\n return (\n all.find((f) => f.name === want) ??\n all.find((f) => f.name.toLowerCase() === want.toLowerCase()) ??\n all[0]\n );\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n super.willUpdate(changed);\n // With `remember`, the visitor's last format wins once, when this record has it.\n if (this.remember && !this.restored && this.formats.length) {\n this.restored = true;\n const stored = readStored();\n const match = stored && this.formats.find((f) => f.name.toLowerCase() === stored);\n if (match) this.format = match.name;\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n this.toggleAttribute('data-empty', !this.formats.length);\n if (this.lightDom) this.placeActions();\n }\n\n /** Light DOM has no slots: move `slot=\"actions\"` children into the actions row. */\n private placeActions(): void {\n const row = this.querySelector(':scope > .wrap .extra');\n if (!row) return;\n for (const n of this.source.nodes())\n if (n instanceof Element && n.getAttribute('slot') === 'actions') row.append(n);\n }\n\n private choose(name: string): void {\n const before = this.selected?.name ?? '';\n if (name === before) return;\n this.format = name;\n clearTimeout(this.timer);\n this.status = '';\n if (this.remember) writeStored(name.toLowerCase());\n this.dispatchEvent(\n new CustomEvent('uvalib-citation-format', {\n detail: { format: name },\n bubbles: true,\n composed: true,\n }),\n );\n this.pending ??= before;\n clearTimeout(this.settleTimer);\n this.settleTimer = setTimeout(() => this.flushFormat(), citationTiming.settle);\n }\n\n /** Report the format the visitor settled on, unless it is where they started. */\n private flushFormat(): void {\n clearTimeout(this.settleTimer);\n const from = this.pending;\n this.pending = undefined;\n const now = this.selected?.name;\n if (from === undefined || !now || now === from) return;\n trackEvent(this, [TAG, 'format', now]);\n }\n\n private get citationEl(): HTMLElement | null {\n return this.renderRoot.querySelector<HTMLElement>('.citation');\n }\n\n private async copy(): Promise<void> {\n const f = this.selected;\n if (!f) return;\n trackEvent(this, [TAG, 'copy', f.name]);\n clearTimeout(this.timer);\n // Cleared first, so a second copy is announced again.\n this.status = '';\n await this.updateComplete;\n // The safe copy itself, not the rendered region (which holds Lit's markers).\n const box = this.ownerDocument.createElement('div');\n box.append(...f.nodes.map((n) => n.cloneNode(true)));\n const text = normalize(box.textContent);\n let message = `${f.name} citation copied`;\n try {\n await copyText(text, f.rich ? box.innerHTML.trim() : undefined);\n this.timer = setTimeout(() => (this.status = ''), STATUS_MS);\n } catch {\n selectContents(this.citationEl);\n message = `Could not copy: the ${f.name} citation is selected, copy it with your keyboard`;\n }\n this.status = message;\n }\n\n private download(): void {\n trackEvent(this, [TAG, 'download', 'ris']);\n }\n\n private renderRis() {\n const href = normalize(this.risHref);\n if (!href) return nothing;\n if (!safeHref(href, this.ownerDocument.baseURI)) {\n this.warnOnce('href', 'ignoring ris-href: it is not http(s) or relative.');\n return nothing;\n }\n return html`<a class=\"uvalib-button\" href=${href} download @click=${this.download}\n >${normalize(this.risLabel) || 'Download RIS'}</a\n >`;\n }\n\n protected override render() {\n const formats = this.formats;\n const f = this.selected;\n if (!f) return nothing;\n const labelId = `${this.uid}-label`;\n return html`<div class=\"wrap\" role=\"group\" aria-labelledby=${labelId}>\n <p class=\"label ${this.hideLabel ? 'visually-hidden' : ''}\" id=${labelId}>\n ${normalize(this.label) || 'Cite this item'}\n </p>\n <div class=\"formats\" role=\"radiogroup\" aria-label=\"Citation format\">\n ${formats.map(\n (x) =>\n html`<label class=\"format\"\n ><input\n type=\"radio\"\n name=\"${this.uid}-format\"\n .checked=${x === f}\n @change=${() => this.choose(x.name)}\n /><span class=\"face\">${CHECK}<span>${x.name}</span></span></label\n >`,\n )}\n </div>\n <div class=\"citation\" role=\"region\" aria-label=\"${f.name} citation\">${f.nodes}</div>\n <div class=\"actions\">\n <button type=\"button\" class=\"uvalib-button\" @click=${this.copy}>Copy citation</button>\n ${this.renderRis()}\n <span class=\"extra\">${this.lightDom ? nothing : html`<slot name=\"actions\"></slot>`}</span>\n <span class=\"status\" role=\"status\">${this.status}</span>\n </div>\n </div>`;\n }\n}\n\nfunction readStored(): string | undefined {\n try {\n return localStorage.getItem(STORAGE_KEY)?.toLowerCase() || undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction writeStored(name: string): void {\n try {\n localStorage.setItem(STORAGE_KEY, name);\n } catch {\n // Storage blocked (private mode, a sandbox): the choice lasts for this page only.\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibCitation } from './UvalibCitation.js';\n\ndefine('uvalib-citation', UvalibCitation);\n"],"mappings":";;;;;;;AAgCA,IAAMwB,IAAM,mBAECC,IAAc,0BACrBC,IAAY,KAMLC,IAAiB,EAAE,QAAQ,IAAK,GACzCC,IAAM,GAGJC,IAAQ,CAAG,2NAMXC,KAAmB,MAAiB;IACtCC,EAAK;;IAELA,EAAK;IACLA,EAAK;;;;;;IAMLA,EAAK;;;;;;;;;;IAULA,EAAK;;;;;;;;;IASLA,EAAK;;;;;;;;IAQLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;IAILA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;;;;;;;;;;;IAWLA,EAAK,YAAYA,EAAK;GAEpBC,IAAkBhC,EAAU8B,EAAgB,OAAO,CAAC,GAEpDG,IAASjC,EAAU,2DAA2D,GAC9EkC,IAAOlC,EAAU,uDAAuD,GACxEmC,IAASnC,EAAU,4DAA4D,GAyCxEoC,IAAb,cAAoCrB,EAAc;;EAChC,KAAA,SAAA;GACdQ;GACAS;GACA,CAAG;;;;;;;;;;;;;;;;;4BAiBqBC,EAAO;;iBAElBC,EAAK;;;;;;;;;;;;;;;;;;wBAkBEA,EAAK;;;;wBAILC,EAA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