@uvalib/web-components 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +172 -0
- package/README.md +1164 -2
- package/bin/install-skill.mjs +139 -0
- package/dist/base/UvalibElement.d.ts +21 -0
- package/dist/base/UvalibElement.js +68 -0
- package/dist/base/UvalibElement.js.map +1 -0
- package/dist/base/analytics.d.ts +44 -0
- package/dist/base/analytics.js +59 -0
- package/dist/base/analytics.js.map +1 -0
- package/dist/base/color-scheme.d.ts +93 -0
- package/dist/base/color-scheme.js +267 -0
- package/dist/base/color-scheme.js.map +1 -0
- package/dist/base/define.d.ts +2 -0
- package/dist/base/define.js +6 -0
- package/dist/base/define.js.map +1 -0
- package/dist/base/heading-level.d.ts +12 -0
- package/dist/base/heading-level.js +52 -0
- package/dist/base/heading-level.js.map +1 -0
- package/dist/base/light-dom-styles.d.ts +18 -0
- package/dist/base/light-dom-styles.js +134 -0
- package/dist/base/light-dom-styles.js.map +1 -0
- package/dist/base.css +30 -0
- package/dist/base.d.ts +5 -0
- package/dist/base.js +5 -0
- package/dist/base.js.map +1 -0
- package/dist/components/bento-box/ArticlesSection.d.ts +19 -0
- package/dist/components/bento-box/ArticlesSection.js +22 -0
- package/dist/components/bento-box/ArticlesSection.js.map +1 -0
- package/dist/components/bento-box/BentoBox.d.ts +85 -0
- package/dist/components/bento-box/BentoBox.js +366 -0
- package/dist/components/bento-box/BentoBox.js.map +1 -0
- package/dist/components/bento-box/BentoSection.d.ts +115 -0
- package/dist/components/bento-box/BentoSection.js +486 -0
- package/dist/components/bento-box/BentoSection.js.map +1 -0
- package/dist/components/bento-box/CatalogSection.d.ts +18 -0
- package/dist/components/bento-box/CatalogSection.js +19 -0
- package/dist/components/bento-box/CatalogSection.js.map +1 -0
- package/dist/components/bento-box/LibGuidesSection.d.ts +24 -0
- package/dist/components/bento-box/LibGuidesSection.js +73 -0
- package/dist/components/bento-box/LibGuidesSection.js.map +1 -0
- package/dist/components/bento-box/VirgoSection.d.ts +19 -0
- package/dist/components/bento-box/VirgoSection.js +58 -0
- package/dist/components/bento-box/VirgoSection.js.map +1 -0
- package/dist/components/bento-box/WebsiteSection.d.ts +25 -0
- package/dist/components/bento-box/WebsiteSection.js +40 -0
- package/dist/components/bento-box/WebsiteSection.js.map +1 -0
- package/dist/components/bento-box/bento-box.d.ts +1 -0
- package/dist/components/bento-box/bento-box.js +13 -0
- package/dist/components/bento-box/bento-box.js.map +1 -0
- package/dist/components/bento-box/bento-data.d.ts +147 -0
- package/dist/components/bento-box/bento-data.js +422 -0
- package/dist/components/bento-box/bento-data.js.map +1 -0
- package/dist/components/events-section/EventsSection.d.ts +91 -0
- package/dist/components/events-section/EventsSection.js +435 -0
- package/dist/components/events-section/EventsSection.js.map +1 -0
- package/dist/components/events-section/events-data.d.ts +90 -0
- package/dist/components/events-section/events-data.js +174 -0
- package/dist/components/events-section/events-data.js.map +1 -0
- package/dist/components/events-section/events-section.d.ts +1 -0
- package/dist/components/events-section/events-section.js +4 -0
- package/dist/components/events-section/events-section.js.map +1 -0
- package/dist/components/library-hours/hours-data.d.ts +104 -0
- package/dist/components/library-hours/hours-data.js +267 -0
- package/dist/components/library-hours/hours-data.js.map +1 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.d.ts +21 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.js +59 -0
- package/dist/components/library-hours-setup/LibraryHoursSetup.js.map +1 -0
- package/dist/components/library-hours-setup/library-hours-setup.d.ts +1 -0
- package/dist/components/library-hours-setup/library-hours-setup.js +5 -0
- package/dist/components/library-hours-setup/library-hours-setup.js.map +1 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.d.ts +107 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +502 -0
- package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.d.ts +1 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.js +4 -0
- package/dist/components/library-weekly-hours/library-weekly-hours.js.map +1 -0
- package/dist/components/link.d.ts +2 -0
- package/dist/components/link.js +7 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/site-analytics/SiteAnalytics.d.ts +44 -0
- package/dist/components/site-analytics/SiteAnalytics.js +161 -0
- package/dist/components/site-analytics/SiteAnalytics.js.map +1 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.d.ts +8 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.js +22 -0
- package/dist/components/site-analytics/SiteAnalyticsMixin.js.map +1 -0
- package/dist/components/site-analytics/site-analytics.d.ts +1 -0
- package/dist/components/site-analytics/site-analytics.js +4 -0
- package/dist/components/site-analytics/site-analytics.js.map +1 -0
- package/dist/components/site-footer/SiteFooter.d.ts +34 -0
- package/dist/components/site-footer/SiteFooter.js +275 -0
- package/dist/components/site-footer/SiteFooter.js.map +1 -0
- package/dist/components/site-footer/icons.d.ts +4 -0
- package/dist/components/site-footer/icons.js +7 -0
- package/dist/components/site-footer/icons.js.map +1 -0
- package/dist/components/site-footer/site-footer.d.ts +1 -0
- package/dist/components/site-footer/site-footer.js +4 -0
- package/dist/components/site-footer/site-footer.js.map +1 -0
- package/dist/components/site-header/SiteHeader.d.ts +154 -0
- package/dist/components/site-header/SiteHeader.js +845 -0
- package/dist/components/site-header/SiteHeader.js.map +1 -0
- package/dist/components/site-header/site-header.d.ts +1 -0
- package/dist/components/site-header/site-header.js +12 -0
- package/dist/components/site-header/site-header.js.map +1 -0
- package/dist/components/site-hours-section/SiteHoursSection.d.ts +63 -0
- package/dist/components/site-hours-section/SiteHoursSection.js +243 -0
- package/dist/components/site-hours-section/SiteHoursSection.js.map +1 -0
- package/dist/components/site-hours-section/site-hours-section.d.ts +1 -0
- package/dist/components/site-hours-section/site-hours-section.js +4 -0
- package/dist/components/site-hours-section/site-hours-section.js.map +1 -0
- package/dist/components/site-main-nav/SiteMainNav.d.ts +136 -0
- package/dist/components/site-main-nav/SiteMainNav.js +678 -0
- package/dist/components/site-main-nav/SiteMainNav.js.map +1 -0
- package/dist/components/site-main-nav/main-nav-data.d.ts +5 -0
- package/dist/components/site-main-nav/main-nav-data.js +90 -0
- package/dist/components/site-main-nav/main-nav-data.js.map +1 -0
- package/dist/components/site-main-nav/main-nav-items.d.ts +49 -0
- package/dist/components/site-main-nav/main-nav-items.js +138 -0
- package/dist/components/site-main-nav/main-nav-items.js.map +1 -0
- package/dist/components/site-main-nav/site-main-nav.d.ts +1 -0
- package/dist/components/site-main-nav/site-main-nav.js +4 -0
- package/dist/components/site-main-nav/site-main-nav.js.map +1 -0
- package/dist/components/site-page/SitePage.d.ts +145 -0
- package/dist/components/site-page/SitePage.js +480 -0
- package/dist/components/site-page/SitePage.js.map +1 -0
- package/dist/components/site-page/alerts.d.ts +24 -0
- package/dist/components/site-page/alerts.js +78 -0
- package/dist/components/site-page/alerts.js.map +1 -0
- package/dist/components/site-page/site-page.d.ts +1 -0
- package/dist/components/site-page/site-page.js +7 -0
- package/dist/components/site-page/site-page.js.map +1 -0
- package/dist/components/site-style/SiteStyle.d.ts +37 -0
- package/dist/components/site-style/SiteStyle.js +76 -0
- package/dist/components/site-style/SiteStyle.js.map +1 -0
- package/dist/components/site-style/site-style.d.ts +1 -0
- package/dist/components/site-style/site-style.js +4 -0
- package/dist/components/site-style/site-style.js.map +1 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.d.ts +10 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.js +11 -0
- package/dist/components/uvalib-analytics/UvalibAnalytics.js.map +1 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.d.ts +13 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js +25 -0
- package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js.map +1 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.d.ts +1 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.js +4 -0
- package/dist/components/uvalib-analytics/uvalib-analytics.js.map +1 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +46 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js +339 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.d.ts +1 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.js +4 -0
- package/dist/components/uvalib-date-range/uvalib-date-range.js.map +1 -0
- package/dist/components/uvalib-filter/UvalibFilter.d.ts +73 -0
- package/dist/components/uvalib-filter/UvalibFilter.js +279 -0
- package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -0
- package/dist/components/uvalib-filter/uvalib-filter.d.ts +1 -0
- package/dist/components/uvalib-filter/uvalib-filter.js +4 -0
- package/dist/components/uvalib-filter/uvalib-filter.js.map +1 -0
- package/dist/custom-elements.json +15178 -0
- package/dist/data/fetch-json.d.ts +28 -0
- package/dist/data/fetch-json.js +43 -0
- package/dist/data/fetch-json.js.map +1 -0
- package/dist/data/new-york.d.ts +5 -0
- package/dist/data/new-york.js +23 -0
- package/dist/data/new-york.js.map +1 -0
- package/dist/data/sites.d.ts +12 -0
- package/dist/data/sites.js +89 -0
- package/dist/data/sites.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/accessible.d.ts +1 -0
- package/dist/styles/accessible.js +37 -0
- package/dist/styles/accessible.js.map +1 -0
- package/dist/styles/base.d.ts +2 -0
- package/dist/styles/base.js +41 -0
- package/dist/styles/base.js.map +1 -0
- package/dist/styles/color-scheme.d.ts +1 -0
- package/dist/styles/color-scheme.js +81 -0
- package/dist/styles/color-scheme.js.map +1 -0
- package/dist/styles/tokens.d.ts +1 -0
- package/dist/styles/tokens.js +85 -0
- package/dist/styles/tokens.js.map +1 -0
- package/dist/styles/w3-subset.d.ts +1 -0
- package/dist/styles/w3-subset.js +33 -0
- package/dist/styles/w3-subset.js.map +1 -0
- package/dist/tokens.css +152 -0
- package/dist-cdn/base.css +30 -0
- package/dist-cdn/bento-box.js +1035 -0
- package/dist-cdn/bento-box.js.map +1 -0
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js +174 -0
- package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js.map +1 -0
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js +695 -0
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +1 -0
- package/dist-cdn/chunks/accessible-GqhVn5_H.js +40 -0
- package/dist-cdn/chunks/accessible-GqhVn5_H.js.map +1 -0
- package/dist-cdn/chunks/analytics-C8D8n_wt.js +55 -0
- package/dist-cdn/chunks/analytics-C8D8n_wt.js.map +1 -0
- package/dist-cdn/chunks/base-DCGd2Oii.js +117 -0
- package/dist-cdn/chunks/base-DCGd2Oii.js.map +1 -0
- package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js +25 -0
- package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js.map +1 -0
- package/dist-cdn/chunks/heading-level-DIuNS44-.js +31 -0
- package/dist-cdn/chunks/heading-level-DIuNS44-.js.map +1 -0
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js +181 -0
- package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +1 -0
- package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js +346 -0
- package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js.map +1 -0
- package/dist-cdn/chunks/link-DbJSwj16.js +7 -0
- package/dist-cdn/chunks/link-DbJSwj16.js.map +1 -0
- package/dist-cdn/chunks/new-york-DkcnqvJ4.js +18 -0
- package/dist-cdn/chunks/new-york-DkcnqvJ4.js.map +1 -0
- package/dist-cdn/chunks/repeat-CIFUYkyh.js +101 -0
- package/dist-cdn/chunks/repeat-CIFUYkyh.js.map +1 -0
- package/dist-cdn/chunks/site-header-BwDkZ2LL.js +802 -0
- package/dist-cdn/chunks/site-header-BwDkZ2LL.js.map +1 -0
- package/dist-cdn/chunks/site-main-nav-BLAAunnr.js +605 -0
- package/dist-cdn/chunks/site-main-nav-BLAAunnr.js.map +1 -0
- package/dist-cdn/chunks/static-html-1mTAG6nS.js +22 -0
- package/dist-cdn/chunks/static-html-1mTAG6nS.js.map +1 -0
- package/dist-cdn/custom-elements.json +15178 -0
- package/dist-cdn/events-section.js +401 -0
- package/dist-cdn/events-section.js.map +1 -0
- package/dist-cdn/library-hours-setup.js +28 -0
- package/dist-cdn/library-hours-setup.js.map +1 -0
- package/dist-cdn/library-weekly-hours.js +1 -0
- package/dist-cdn/manifest.json +23 -0
- package/dist-cdn/site-analytics.js +6 -0
- package/dist-cdn/site-analytics.js.map +1 -0
- package/dist-cdn/site-footer.js +267 -0
- package/dist-cdn/site-footer.js.map +1 -0
- package/dist-cdn/site-header.js +1 -0
- package/dist-cdn/site-hours-section.js +145 -0
- package/dist-cdn/site-hours-section.js.map +1 -0
- package/dist-cdn/site-main-nav.js +1 -0
- package/dist-cdn/site-page.js +317 -0
- package/dist-cdn/site-page.js.map +1 -0
- package/dist-cdn/site-style.js +42 -0
- package/dist-cdn/site-style.js.map +1 -0
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +276 -0
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +631 -0
- package/dist-cdn/skills/uvalib-web-components/reference/migration.md +74 -0
- package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +147 -0
- package/dist-cdn/tokens.css +152 -0
- package/dist-cdn/uvalib-analytics.js +6 -0
- package/dist-cdn/uvalib-analytics.js.map +1 -0
- package/dist-cdn/uvalib-date-range.js +262 -0
- package/dist-cdn/uvalib-date-range.js.map +1 -0
- package/dist-cdn/uvalib-filter.js +184 -0
- package/dist-cdn/uvalib-filter.js.map +1 -0
- package/package.json +152 -4
- package/skills/uvalib-web-components/SKILL.md +276 -0
- package/skills/uvalib-web-components/reference/components.md +631 -0
- package/skills/uvalib-web-components/reference/migration.md +74 -0
- package/skills/uvalib-web-components/reference/snippets.md +147 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BentoSection, type SectionResults } from './BentoSection.js';
|
|
2
|
+
import { type VirgoItem, type VirgoPool } from './bento-data.js';
|
|
3
|
+
/**
|
|
4
|
+
* A Virgo pool's results (the catalog or the articles): each entry is its title linking to
|
|
5
|
+
* Virgo, then its authors, and a row with the published date and the formats (with, for a
|
|
6
|
+
* work with several editions, how many: on the same line, so every entry keeps one shape). Not registered itself.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class VirgoSection extends BentoSection<VirgoItem> {
|
|
9
|
+
protected abstract readonly pool: VirgoPool;
|
|
10
|
+
protected fetchResults(query: string, limit: number, signal: AbortSignal): Promise<SectionResults<VirgoItem>>;
|
|
11
|
+
protected seeAllUrl(query: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* An `li` with `body`, or, when there is none, an empty one hidden from assistive
|
|
14
|
+
* technology, so every entry has the same lines (and height) as its placeholder.
|
|
15
|
+
*/
|
|
16
|
+
private line;
|
|
17
|
+
protected renderItem(r: VirgoItem): import("lit").TemplateResult;
|
|
18
|
+
protected renderPlaceholderBody(): import("lit").TemplateResult<1>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { BentoSection } from './BentoSection.js';
|
|
3
|
+
import { formatPublished, searchVirgo, virgoSearchUrl, } from './bento-data.js';
|
|
4
|
+
/**
|
|
5
|
+
* A Virgo pool's results (the catalog or the articles): each entry is its title linking to
|
|
6
|
+
* Virgo, then its authors, and a row with the published date and the formats (with, for a
|
|
7
|
+
* work with several editions, how many: on the same line, so every entry keeps one shape). Not registered itself.
|
|
8
|
+
*/
|
|
9
|
+
export class VirgoSection extends BentoSection {
|
|
10
|
+
fetchResults(query, limit, signal) {
|
|
11
|
+
return searchVirgo(this.pool, query, limit, signal);
|
|
12
|
+
}
|
|
13
|
+
seeAllUrl(query) {
|
|
14
|
+
return virgoSearchUrl(this.pool, query);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An `li` with `body`, or, when there is none, an empty one hidden from assistive
|
|
18
|
+
* technology, so every entry has the same lines (and height) as its placeholder.
|
|
19
|
+
*/
|
|
20
|
+
line(cls, body) {
|
|
21
|
+
return body
|
|
22
|
+
? html `<li class="${cls} li-1">${body}</li>`
|
|
23
|
+
: html `<li class="${cls} li-1" aria-hidden="true"> </li>`;
|
|
24
|
+
}
|
|
25
|
+
renderItem(r) {
|
|
26
|
+
const editions = r.editions > 1
|
|
27
|
+
? html `<span class="bs-results--editions"
|
|
28
|
+
>${r.formats.length ? ', ' : ''}${r.editions} editions</span
|
|
29
|
+
>`
|
|
30
|
+
: '';
|
|
31
|
+
const formats = r.formats.length || editions ? html `${r.formats.join('/')}${editions}` : '';
|
|
32
|
+
return this.entry(html `<a href=${r.url} class="bs-results--title">${r.title}</a>
|
|
33
|
+
<ul class="ul-0">
|
|
34
|
+
${this.line('bs-results--author', r.authors.join('; '))}
|
|
35
|
+
<li>
|
|
36
|
+
<ul class="ul-1">
|
|
37
|
+
${this.line('bs-results--date', r.published
|
|
38
|
+
? html `<time datetime=${r.published}>${formatPublished(r.published)}</time>`
|
|
39
|
+
: '')}
|
|
40
|
+
${this.line('bs-results--format', formats)}
|
|
41
|
+
</ul>
|
|
42
|
+
</li>
|
|
43
|
+
</ul>`);
|
|
44
|
+
}
|
|
45
|
+
renderPlaceholderBody() {
|
|
46
|
+
return html `<a class="bs-results--title">Library search result</a>
|
|
47
|
+
<ul class="ul-0">
|
|
48
|
+
<li class="bs-results--author li-1">Author, Example</li>
|
|
49
|
+
<li>
|
|
50
|
+
<ul class="ul-1">
|
|
51
|
+
<li class="bs-results--date li-1">2024</li>
|
|
52
|
+
<li class="bs-results--format li-1">Book</li>
|
|
53
|
+
</ul>
|
|
54
|
+
</li>
|
|
55
|
+
</ul>`;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=VirgoSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VirgoSection.js","sourceRoot":"","sources":["../../../src/components/bento-box/VirgoSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AACtE,OAAO,EACL,eAAe,EACf,WAAW,EACX,cAAc,GAGf,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,MAAM,OAAgB,YAAa,SAAQ,YAAuB;IAGtD,YAAY,CACpB,KAAa,EACb,KAAa,EACb,MAAmB;QAEnB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAES,SAAS,CAAC,KAAa;QAC/B,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACK,IAAI,CAAC,GAAW,EAAE,IAAa;QACrC,OAAO,IAAI;YACT,CAAC,CAAC,IAAI,CAAA,cAAc,GAAG,UAAU,IAAI,OAAO;YAC5C,CAAC,CAAC,IAAI,CAAA,cAAc,GAAG,kCAAkC,CAAC;IAC9D,CAAC;IAES,UAAU,CAAC,CAAY;QAC/B,MAAM,QAAQ,GACZ,CAAC,CAAC,QAAQ,GAAG,CAAC;YACZ,CAAC,CAAC,IAAI,CAAA;eACC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,QAAQ;YAC5C;YACJ,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5F,OAAO,IAAI,CAAC,KAAK,CACf,IAAI,CAAA,WAAW,CAAC,CAAC,GAAG,8BAA8B,CAAC,CAAC,KAAK;;YAEnD,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;;gBAGjD,IAAI,CAAC,IAAI,CACT,kBAAkB,EAClB,CAAC,CAAC,SAAS;YACT,CAAC,CAAC,IAAI,CAAA,kBAAkB,CAAC,CAAC,SAAS,IAAI,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS;YAC5E,CAAC,CAAC,EAAE,CACP;gBACC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC;;;cAG1C,CACT,CAAC;IACJ,CAAC;IAES,qBAAqB;QAC7B,OAAO,IAAI,CAAA;;;;;;;;;YASH,CAAC;IACX,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BentoSection, type SectionResults } from './BentoSection.js';
|
|
2
|
+
import { type WebsiteItem } from './bento-data.js';
|
|
3
|
+
/**
|
|
4
|
+
* The library website's first pages (pages, people, libraries, news) matching `query`, from
|
|
5
|
+
* Drupal's search index, with its excerpt (the matched words marked). The index sends no
|
|
6
|
+
* CORS headers, so this section works on library.virginia.edu (or wherever
|
|
7
|
+
* `BentoBox.endpoints.website` points to a same-origin copy) only.
|
|
8
|
+
*
|
|
9
|
+
* @tagname website-section
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebsiteSection extends BentoSection<WebsiteItem> {
|
|
12
|
+
readonly analyticsName = "Library website";
|
|
13
|
+
protected readonly heading = "Website";
|
|
14
|
+
protected readonly sourceName = "Library website";
|
|
15
|
+
protected readonly describe = "Results from the main Library website.";
|
|
16
|
+
protected readonly home: {
|
|
17
|
+
text: string;
|
|
18
|
+
url: string;
|
|
19
|
+
};
|
|
20
|
+
protected entryClass: string;
|
|
21
|
+
protected fetchResults(query: string, limit: number, signal: AbortSignal): Promise<SectionResults<WebsiteItem>>;
|
|
22
|
+
protected seeAllUrl(query: string): string;
|
|
23
|
+
protected renderItem(w: WebsiteItem): import("lit").TemplateResult;
|
|
24
|
+
protected renderPlaceholderBody(): import("lit").TemplateResult<1>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { BentoSection, renderRuns } from './BentoSection.js';
|
|
3
|
+
import { searchWebsite, websiteSearchUrl } from './bento-data.js';
|
|
4
|
+
/**
|
|
5
|
+
* The library website's first pages (pages, people, libraries, news) matching `query`, from
|
|
6
|
+
* Drupal's search index, with its excerpt (the matched words marked). The index sends no
|
|
7
|
+
* CORS headers, so this section works on library.virginia.edu (or wherever
|
|
8
|
+
* `BentoBox.endpoints.website` points to a same-origin copy) only.
|
|
9
|
+
*
|
|
10
|
+
* @tagname website-section
|
|
11
|
+
*/
|
|
12
|
+
export class WebsiteSection extends BentoSection {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.analyticsName = 'Library website';
|
|
16
|
+
this.heading = 'Website';
|
|
17
|
+
this.sourceName = 'Library website';
|
|
18
|
+
this.describe = 'Results from the main Library website.';
|
|
19
|
+
this.home = {
|
|
20
|
+
text: 'Search Library website',
|
|
21
|
+
url: 'https://library.virginia.edu/search/content',
|
|
22
|
+
};
|
|
23
|
+
this.entryClass = '';
|
|
24
|
+
}
|
|
25
|
+
fetchResults(query, limit, signal) {
|
|
26
|
+
return searchWebsite(query, limit, signal);
|
|
27
|
+
}
|
|
28
|
+
seeAllUrl(query) {
|
|
29
|
+
return websiteSearchUrl(query);
|
|
30
|
+
}
|
|
31
|
+
renderItem(w) {
|
|
32
|
+
return this.entry(html `<div class="bento-section-title"><a href=${w.url}>${w.title}</a></div>
|
|
33
|
+
<div class="bento-section-desc">${renderRuns(w.excerpt)}</div>`);
|
|
34
|
+
}
|
|
35
|
+
renderPlaceholderBody() {
|
|
36
|
+
return html `<div class="bento-section-title"><a>Library page</a></div>
|
|
37
|
+
<div class="bento-section-desc">Library website page</div>`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=WebsiteSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebsiteSection.js","sourceRoot":"","sources":["../../../src/components/bento-box/WebsiteSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAuB,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAoB,MAAM,iBAAiB,CAAC;AAEpF;;;;;;;GAOG;AACH,MAAM,OAAO,cAAe,SAAQ,YAAyB;IAA7D;;QACW,kBAAa,GAAG,iBAAiB,CAAC;QACxB,YAAO,GAAG,SAAS,CAAC;QACpB,eAAU,GAAG,iBAAiB,CAAC;QAC/B,aAAQ,GAAG,wCAAwC,CAAC;QACpD,SAAI,GAAG;YACxB,IAAI,EAAE,wBAAwB;YAC9B,GAAG,EAAE,6CAA6C;SACnD,CAAC;QACiB,eAAU,GAAG,EAAE,CAAC;IAyBrC,CAAC;IAvBW,YAAY,CACpB,KAAa,EACb,KAAa,EACb,MAAmB;QAEnB,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAES,SAAS,CAAC,KAAa;QAC/B,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAES,UAAU,CAAC,CAAc;QACjC,OAAO,IAAI,CAAC,KAAK,CACf,IAAI,CAAA,4CAA4C,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK;0CAC5B,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAClE,CAAC;IACJ,CAAC;IAES,qBAAqB;QAC7B,OAAO,IAAI,CAAA;iEACkD,CAAC;IAChE,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { define } from '../../base/define.js';
|
|
2
|
+
import { ArticlesSection } from './ArticlesSection.js';
|
|
3
|
+
import { BentoBox } from './BentoBox.js';
|
|
4
|
+
import { CatalogSection } from './CatalogSection.js';
|
|
5
|
+
import { LibGuidesSection } from './LibGuidesSection.js';
|
|
6
|
+
import { WebsiteSection } from './WebsiteSection.js';
|
|
7
|
+
// The sections first, so the box's first render upgrades them at once.
|
|
8
|
+
define('catalog-section', CatalogSection);
|
|
9
|
+
define('articles-section', ArticlesSection);
|
|
10
|
+
define('libguides-section', LibGuidesSection);
|
|
11
|
+
define('website-section', WebsiteSection);
|
|
12
|
+
define('bento-box', BentoBox);
|
|
13
|
+
//# sourceMappingURL=bento-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bento-box.js","sourceRoot":"","sources":["../../../src/components/bento-box/bento-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,uEAAuE;AACvE,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC1C,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;AAC5C,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;AAC9C,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;AAC1C,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/** The URLs the sections fetch, shared by every element on the page. */
|
|
2
|
+
export interface BentoEndpoints {
|
|
3
|
+
/** Virgo's guest token: POST, answers a JWT as text. */
|
|
4
|
+
authorize: string;
|
|
5
|
+
/** The Virgo catalog pool's search (POST, Bearer token). */
|
|
6
|
+
catalog: string;
|
|
7
|
+
/** The Virgo articles pool's search (POST, Bearer token). */
|
|
8
|
+
articles: string;
|
|
9
|
+
/** The LibGuides search proxy (GET, `?q=`). */
|
|
10
|
+
guides: string;
|
|
11
|
+
/** The library website's Drupal search index (GET, JSON:API). Same origin only: no CORS. */
|
|
12
|
+
website: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Where the results come from (exposed to pages as `BentoBox.endpoints`). A page can also set
|
|
16
|
+
* `window.uvalibBentoEndpoints` (any of the keys) before the script runs; it is merged in at
|
|
17
|
+
* the first fetch. Requests are cached, so a change applies to the next search.
|
|
18
|
+
*
|
|
19
|
+
* The guides proxy is the us-east-1 one: the us-east-2 proxy ignores `q` and answers cached
|
|
20
|
+
* results. The website index is relative, as Drupal serves it on its own origin only.
|
|
21
|
+
*/
|
|
22
|
+
export declare const bentoEndpoints: BentoEndpoints;
|
|
23
|
+
/** Fetch attempts, the delay between them (ms) and each attempt's timeout (ms). */
|
|
24
|
+
export declare const bentoTiming: {
|
|
25
|
+
retries: number;
|
|
26
|
+
retryDelay: number;
|
|
27
|
+
timeout: number;
|
|
28
|
+
};
|
|
29
|
+
declare global {
|
|
30
|
+
interface Window {
|
|
31
|
+
/** Optional endpoint overrides for <bento-box>, read at its first fetch. */
|
|
32
|
+
uvalibBentoEndpoints?: Partial<BentoEndpoints>;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Copy the known endpoint keys (non-empty strings only) from `from` into the shared endpoints. */
|
|
36
|
+
export declare function setBentoEndpoints(from: Partial<BentoEndpoints> | null | undefined): void;
|
|
37
|
+
/**
|
|
38
|
+
* Virgo's guest token, fetched once per page and shared by every section; a failure is not
|
|
39
|
+
* kept, so the next search asks again.
|
|
40
|
+
*/
|
|
41
|
+
export declare function guestToken(): Promise<string>;
|
|
42
|
+
/** One Virgo result, reduced to what a section shows. */
|
|
43
|
+
export interface VirgoItem {
|
|
44
|
+
title: string;
|
|
45
|
+
/** The item's Virgo page. */
|
|
46
|
+
url: string;
|
|
47
|
+
/** At most five, then "and N more". */
|
|
48
|
+
authors: string[];
|
|
49
|
+
/** As Virgo sends it: `YYYY`, `YYYY-MM` or `YYYY-MM-DD` (see `formatPublished`). */
|
|
50
|
+
published?: string;
|
|
51
|
+
/** The catalog's formats, or the articles' publication types. */
|
|
52
|
+
formats: string[];
|
|
53
|
+
/** How many records (editions) the result groups; 1 for most. */
|
|
54
|
+
editions: number;
|
|
55
|
+
/** An articles record shown to guests without its details (Virgo's sign-in placeholder). */
|
|
56
|
+
signIn: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface Results<T> {
|
|
59
|
+
items: T[];
|
|
60
|
+
/** The total number of results, when the source says. */
|
|
61
|
+
total?: number;
|
|
62
|
+
}
|
|
63
|
+
export type VirgoPool = 'catalog' | 'articles';
|
|
64
|
+
/** The neutral title shown instead. */
|
|
65
|
+
export declare const SIGN_IN_TITLE = "Article details available after signing in to Virgo";
|
|
66
|
+
/**
|
|
67
|
+
* Virgo's `{ pagination, group_list }` reduced to VirgoItem: the first record of each group
|
|
68
|
+
* (a multi-edition work shows once, with its edition count). Records without a title or an
|
|
69
|
+
* identifier are skipped.
|
|
70
|
+
*/
|
|
71
|
+
export declare function parseVirgo(json: unknown, pool: VirgoPool): Results<VirgoItem>;
|
|
72
|
+
/**
|
|
73
|
+
* `query` as a Virgo `keyword: {…}` clause. Braces delimit the clause, so any in the query
|
|
74
|
+
* become spaces rather than closing it early or opening another.
|
|
75
|
+
*/
|
|
76
|
+
export declare function virgoKeyword(query: string): string;
|
|
77
|
+
/** The search body both Virgo pools take. */
|
|
78
|
+
export declare function virgoBody(query: string, limit: number): string;
|
|
79
|
+
/**
|
|
80
|
+
* The first `limit` results for `query` in `pool`. A 401 (an expired guest token) fetches a
|
|
81
|
+
* new token and tries once more.
|
|
82
|
+
*/
|
|
83
|
+
export declare function searchVirgo(pool: VirgoPool, query: string, limit: number, signal?: AbortSignal): Promise<Results<VirgoItem>>;
|
|
84
|
+
/** Virgo's "see all" search for `query` in the catalog or the articles. */
|
|
85
|
+
export declare function virgoSearchUrl(pool: VirgoPool, query: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* Virgo's published date for display, read as a calendar date (no time zone can shift it):
|
|
88
|
+
* a bare year as is, `YYYY-MM` as "Jul 2026", `YYYY-MM-DD` as "Jul 28, 2026"; anything else
|
|
89
|
+
* as sent.
|
|
90
|
+
*/
|
|
91
|
+
export declare function formatPublished(value: string): string;
|
|
92
|
+
export interface Link {
|
|
93
|
+
text: string;
|
|
94
|
+
url: string;
|
|
95
|
+
}
|
|
96
|
+
/** A run of text; `mark` runs are the words the search matched. */
|
|
97
|
+
export interface TextRun {
|
|
98
|
+
text: string;
|
|
99
|
+
mark?: boolean;
|
|
100
|
+
}
|
|
101
|
+
/** One subject guide page, as plain text and URLs. */
|
|
102
|
+
export interface GuideItem {
|
|
103
|
+
title: string;
|
|
104
|
+
url: string;
|
|
105
|
+
/** The guide the page belongs to. */
|
|
106
|
+
guide?: Link;
|
|
107
|
+
author?: Link;
|
|
108
|
+
subjects: Link[];
|
|
109
|
+
/** The matching text, with the matched words marked. */
|
|
110
|
+
highlights: TextRun[];
|
|
111
|
+
}
|
|
112
|
+
/** `value` as an absolute http(s) URL, or undefined. */
|
|
113
|
+
export declare function safeUrl(value: unknown, base?: string): string | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Text runs of `node`: `<mark>` / `<strong>` (as `markTag` says) become marked runs, every
|
|
116
|
+
* other element only gives its text. Whitespace is collapsed and the ends trimmed.
|
|
117
|
+
*/
|
|
118
|
+
export declare function textRuns(node: Node, markTag: string): TextRun[];
|
|
119
|
+
/** The proxy's `{ data: { results, fulllink } }` reduced to GuideItem and the "see all" URL. */
|
|
120
|
+
export declare function parseGuides(json: unknown): Results<GuideItem> & {
|
|
121
|
+
seeAll?: string;
|
|
122
|
+
};
|
|
123
|
+
/** The LibGuides site search for `query` (when the proxy does not send its own link). */
|
|
124
|
+
export declare function guidesSearchUrl(query: string): string;
|
|
125
|
+
/** The first `limit` subject guide pages for `query`. */
|
|
126
|
+
export declare function searchGuides(query: string, limit: number, signal?: AbortSignal): Promise<Results<GuideItem> & {
|
|
127
|
+
seeAll?: string;
|
|
128
|
+
}>;
|
|
129
|
+
/** One page of the library website. */
|
|
130
|
+
export interface WebsiteItem {
|
|
131
|
+
/** Plain text: Drupal titles are never HTML. */
|
|
132
|
+
title: string;
|
|
133
|
+
url: string;
|
|
134
|
+
/** Drupal's excerpt, with the matched words marked; for a person without one, their job title. */
|
|
135
|
+
excerpt: TextRun[];
|
|
136
|
+
}
|
|
137
|
+
export declare const WEBSITE_BASE = "https://library.virginia.edu";
|
|
138
|
+
/** The JSON:API query: `filter[fulltext]`, `page[limit]` and an OR group over TYPES. */
|
|
139
|
+
export declare function websiteParams(query: string, limit: number): URLSearchParams;
|
|
140
|
+
/** Drupal's JSON:API answer reduced to WebsiteItem (links on https://library.virginia.edu). */
|
|
141
|
+
export declare function parseWebsite(json: unknown): Results<WebsiteItem>;
|
|
142
|
+
/** The first `limit` website pages for `query`. */
|
|
143
|
+
export declare function searchWebsite(query: string, limit: number, signal?: AbortSignal): Promise<Results<WebsiteItem>>;
|
|
144
|
+
/** The website's own search page for `query`. */
|
|
145
|
+
export declare function websiteSearchUrl(query: string): string;
|
|
146
|
+
/** Forget cached results and the token, and re-read `window.uvalibBentoEndpoints` (for tests). */
|
|
147
|
+
export declare function resetBentoCache(): void;
|