@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.
Files changed (254) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/README.md +1164 -2
  3. package/bin/install-skill.mjs +139 -0
  4. package/dist/base/UvalibElement.d.ts +21 -0
  5. package/dist/base/UvalibElement.js +68 -0
  6. package/dist/base/UvalibElement.js.map +1 -0
  7. package/dist/base/analytics.d.ts +44 -0
  8. package/dist/base/analytics.js +59 -0
  9. package/dist/base/analytics.js.map +1 -0
  10. package/dist/base/color-scheme.d.ts +93 -0
  11. package/dist/base/color-scheme.js +267 -0
  12. package/dist/base/color-scheme.js.map +1 -0
  13. package/dist/base/define.d.ts +2 -0
  14. package/dist/base/define.js +6 -0
  15. package/dist/base/define.js.map +1 -0
  16. package/dist/base/heading-level.d.ts +12 -0
  17. package/dist/base/heading-level.js +52 -0
  18. package/dist/base/heading-level.js.map +1 -0
  19. package/dist/base/light-dom-styles.d.ts +18 -0
  20. package/dist/base/light-dom-styles.js +134 -0
  21. package/dist/base/light-dom-styles.js.map +1 -0
  22. package/dist/base.css +30 -0
  23. package/dist/base.d.ts +5 -0
  24. package/dist/base.js +5 -0
  25. package/dist/base.js.map +1 -0
  26. package/dist/components/bento-box/ArticlesSection.d.ts +19 -0
  27. package/dist/components/bento-box/ArticlesSection.js +22 -0
  28. package/dist/components/bento-box/ArticlesSection.js.map +1 -0
  29. package/dist/components/bento-box/BentoBox.d.ts +85 -0
  30. package/dist/components/bento-box/BentoBox.js +366 -0
  31. package/dist/components/bento-box/BentoBox.js.map +1 -0
  32. package/dist/components/bento-box/BentoSection.d.ts +115 -0
  33. package/dist/components/bento-box/BentoSection.js +486 -0
  34. package/dist/components/bento-box/BentoSection.js.map +1 -0
  35. package/dist/components/bento-box/CatalogSection.d.ts +18 -0
  36. package/dist/components/bento-box/CatalogSection.js +19 -0
  37. package/dist/components/bento-box/CatalogSection.js.map +1 -0
  38. package/dist/components/bento-box/LibGuidesSection.d.ts +24 -0
  39. package/dist/components/bento-box/LibGuidesSection.js +73 -0
  40. package/dist/components/bento-box/LibGuidesSection.js.map +1 -0
  41. package/dist/components/bento-box/VirgoSection.d.ts +19 -0
  42. package/dist/components/bento-box/VirgoSection.js +58 -0
  43. package/dist/components/bento-box/VirgoSection.js.map +1 -0
  44. package/dist/components/bento-box/WebsiteSection.d.ts +25 -0
  45. package/dist/components/bento-box/WebsiteSection.js +40 -0
  46. package/dist/components/bento-box/WebsiteSection.js.map +1 -0
  47. package/dist/components/bento-box/bento-box.d.ts +1 -0
  48. package/dist/components/bento-box/bento-box.js +13 -0
  49. package/dist/components/bento-box/bento-box.js.map +1 -0
  50. package/dist/components/bento-box/bento-data.d.ts +147 -0
  51. package/dist/components/bento-box/bento-data.js +422 -0
  52. package/dist/components/bento-box/bento-data.js.map +1 -0
  53. package/dist/components/events-section/EventsSection.d.ts +91 -0
  54. package/dist/components/events-section/EventsSection.js +435 -0
  55. package/dist/components/events-section/EventsSection.js.map +1 -0
  56. package/dist/components/events-section/events-data.d.ts +90 -0
  57. package/dist/components/events-section/events-data.js +174 -0
  58. package/dist/components/events-section/events-data.js.map +1 -0
  59. package/dist/components/events-section/events-section.d.ts +1 -0
  60. package/dist/components/events-section/events-section.js +4 -0
  61. package/dist/components/events-section/events-section.js.map +1 -0
  62. package/dist/components/library-hours/hours-data.d.ts +104 -0
  63. package/dist/components/library-hours/hours-data.js +267 -0
  64. package/dist/components/library-hours/hours-data.js.map +1 -0
  65. package/dist/components/library-hours-setup/LibraryHoursSetup.d.ts +21 -0
  66. package/dist/components/library-hours-setup/LibraryHoursSetup.js +59 -0
  67. package/dist/components/library-hours-setup/LibraryHoursSetup.js.map +1 -0
  68. package/dist/components/library-hours-setup/library-hours-setup.d.ts +1 -0
  69. package/dist/components/library-hours-setup/library-hours-setup.js +5 -0
  70. package/dist/components/library-hours-setup/library-hours-setup.js.map +1 -0
  71. package/dist/components/library-weekly-hours/LibraryWeeklyHours.d.ts +107 -0
  72. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js +502 -0
  73. package/dist/components/library-weekly-hours/LibraryWeeklyHours.js.map +1 -0
  74. package/dist/components/library-weekly-hours/library-weekly-hours.d.ts +1 -0
  75. package/dist/components/library-weekly-hours/library-weekly-hours.js +4 -0
  76. package/dist/components/library-weekly-hours/library-weekly-hours.js.map +1 -0
  77. package/dist/components/link.d.ts +2 -0
  78. package/dist/components/link.js +7 -0
  79. package/dist/components/link.js.map +1 -0
  80. package/dist/components/site-analytics/SiteAnalytics.d.ts +44 -0
  81. package/dist/components/site-analytics/SiteAnalytics.js +161 -0
  82. package/dist/components/site-analytics/SiteAnalytics.js.map +1 -0
  83. package/dist/components/site-analytics/SiteAnalyticsMixin.d.ts +8 -0
  84. package/dist/components/site-analytics/SiteAnalyticsMixin.js +22 -0
  85. package/dist/components/site-analytics/SiteAnalyticsMixin.js.map +1 -0
  86. package/dist/components/site-analytics/site-analytics.d.ts +1 -0
  87. package/dist/components/site-analytics/site-analytics.js +4 -0
  88. package/dist/components/site-analytics/site-analytics.js.map +1 -0
  89. package/dist/components/site-footer/SiteFooter.d.ts +34 -0
  90. package/dist/components/site-footer/SiteFooter.js +275 -0
  91. package/dist/components/site-footer/SiteFooter.js.map +1 -0
  92. package/dist/components/site-footer/icons.d.ts +4 -0
  93. package/dist/components/site-footer/icons.js +7 -0
  94. package/dist/components/site-footer/icons.js.map +1 -0
  95. package/dist/components/site-footer/site-footer.d.ts +1 -0
  96. package/dist/components/site-footer/site-footer.js +4 -0
  97. package/dist/components/site-footer/site-footer.js.map +1 -0
  98. package/dist/components/site-header/SiteHeader.d.ts +154 -0
  99. package/dist/components/site-header/SiteHeader.js +845 -0
  100. package/dist/components/site-header/SiteHeader.js.map +1 -0
  101. package/dist/components/site-header/site-header.d.ts +1 -0
  102. package/dist/components/site-header/site-header.js +12 -0
  103. package/dist/components/site-header/site-header.js.map +1 -0
  104. package/dist/components/site-hours-section/SiteHoursSection.d.ts +63 -0
  105. package/dist/components/site-hours-section/SiteHoursSection.js +243 -0
  106. package/dist/components/site-hours-section/SiteHoursSection.js.map +1 -0
  107. package/dist/components/site-hours-section/site-hours-section.d.ts +1 -0
  108. package/dist/components/site-hours-section/site-hours-section.js +4 -0
  109. package/dist/components/site-hours-section/site-hours-section.js.map +1 -0
  110. package/dist/components/site-main-nav/SiteMainNav.d.ts +136 -0
  111. package/dist/components/site-main-nav/SiteMainNav.js +678 -0
  112. package/dist/components/site-main-nav/SiteMainNav.js.map +1 -0
  113. package/dist/components/site-main-nav/main-nav-data.d.ts +5 -0
  114. package/dist/components/site-main-nav/main-nav-data.js +90 -0
  115. package/dist/components/site-main-nav/main-nav-data.js.map +1 -0
  116. package/dist/components/site-main-nav/main-nav-items.d.ts +49 -0
  117. package/dist/components/site-main-nav/main-nav-items.js +138 -0
  118. package/dist/components/site-main-nav/main-nav-items.js.map +1 -0
  119. package/dist/components/site-main-nav/site-main-nav.d.ts +1 -0
  120. package/dist/components/site-main-nav/site-main-nav.js +4 -0
  121. package/dist/components/site-main-nav/site-main-nav.js.map +1 -0
  122. package/dist/components/site-page/SitePage.d.ts +145 -0
  123. package/dist/components/site-page/SitePage.js +480 -0
  124. package/dist/components/site-page/SitePage.js.map +1 -0
  125. package/dist/components/site-page/alerts.d.ts +24 -0
  126. package/dist/components/site-page/alerts.js +78 -0
  127. package/dist/components/site-page/alerts.js.map +1 -0
  128. package/dist/components/site-page/site-page.d.ts +1 -0
  129. package/dist/components/site-page/site-page.js +7 -0
  130. package/dist/components/site-page/site-page.js.map +1 -0
  131. package/dist/components/site-style/SiteStyle.d.ts +37 -0
  132. package/dist/components/site-style/SiteStyle.js +76 -0
  133. package/dist/components/site-style/SiteStyle.js.map +1 -0
  134. package/dist/components/site-style/site-style.d.ts +1 -0
  135. package/dist/components/site-style/site-style.js +4 -0
  136. package/dist/components/site-style/site-style.js.map +1 -0
  137. package/dist/components/uvalib-analytics/UvalibAnalytics.d.ts +10 -0
  138. package/dist/components/uvalib-analytics/UvalibAnalytics.js +11 -0
  139. package/dist/components/uvalib-analytics/UvalibAnalytics.js.map +1 -0
  140. package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.d.ts +13 -0
  141. package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js +25 -0
  142. package/dist/components/uvalib-analytics/UvalibAnalyticsMixin.js.map +1 -0
  143. package/dist/components/uvalib-analytics/uvalib-analytics.d.ts +1 -0
  144. package/dist/components/uvalib-analytics/uvalib-analytics.js +4 -0
  145. package/dist/components/uvalib-analytics/uvalib-analytics.js.map +1 -0
  146. package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +46 -0
  147. package/dist/components/uvalib-date-range/UvalibDateRange.js +339 -0
  148. package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -0
  149. package/dist/components/uvalib-date-range/uvalib-date-range.d.ts +1 -0
  150. package/dist/components/uvalib-date-range/uvalib-date-range.js +4 -0
  151. package/dist/components/uvalib-date-range/uvalib-date-range.js.map +1 -0
  152. package/dist/components/uvalib-filter/UvalibFilter.d.ts +73 -0
  153. package/dist/components/uvalib-filter/UvalibFilter.js +279 -0
  154. package/dist/components/uvalib-filter/UvalibFilter.js.map +1 -0
  155. package/dist/components/uvalib-filter/uvalib-filter.d.ts +1 -0
  156. package/dist/components/uvalib-filter/uvalib-filter.js +4 -0
  157. package/dist/components/uvalib-filter/uvalib-filter.js.map +1 -0
  158. package/dist/custom-elements.json +15178 -0
  159. package/dist/data/fetch-json.d.ts +28 -0
  160. package/dist/data/fetch-json.js +43 -0
  161. package/dist/data/fetch-json.js.map +1 -0
  162. package/dist/data/new-york.d.ts +5 -0
  163. package/dist/data/new-york.js +23 -0
  164. package/dist/data/new-york.js.map +1 -0
  165. package/dist/data/sites.d.ts +12 -0
  166. package/dist/data/sites.js +89 -0
  167. package/dist/data/sites.js.map +1 -0
  168. package/dist/index.d.ts +33 -0
  169. package/dist/index.js +22 -0
  170. package/dist/index.js.map +1 -0
  171. package/dist/styles/accessible.d.ts +1 -0
  172. package/dist/styles/accessible.js +37 -0
  173. package/dist/styles/accessible.js.map +1 -0
  174. package/dist/styles/base.d.ts +2 -0
  175. package/dist/styles/base.js +41 -0
  176. package/dist/styles/base.js.map +1 -0
  177. package/dist/styles/color-scheme.d.ts +1 -0
  178. package/dist/styles/color-scheme.js +81 -0
  179. package/dist/styles/color-scheme.js.map +1 -0
  180. package/dist/styles/tokens.d.ts +1 -0
  181. package/dist/styles/tokens.js +85 -0
  182. package/dist/styles/tokens.js.map +1 -0
  183. package/dist/styles/w3-subset.d.ts +1 -0
  184. package/dist/styles/w3-subset.js +33 -0
  185. package/dist/styles/w3-subset.js.map +1 -0
  186. package/dist/tokens.css +152 -0
  187. package/dist-cdn/base.css +30 -0
  188. package/dist-cdn/bento-box.js +1035 -0
  189. package/dist-cdn/bento-box.js.map +1 -0
  190. package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js +174 -0
  191. package/dist-cdn/chunks/SiteAnalytics-T1Wx3lsb.js.map +1 -0
  192. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js +695 -0
  193. package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +1 -0
  194. package/dist-cdn/chunks/accessible-GqhVn5_H.js +40 -0
  195. package/dist-cdn/chunks/accessible-GqhVn5_H.js.map +1 -0
  196. package/dist-cdn/chunks/analytics-C8D8n_wt.js +55 -0
  197. package/dist-cdn/chunks/analytics-C8D8n_wt.js.map +1 -0
  198. package/dist-cdn/chunks/base-DCGd2Oii.js +117 -0
  199. package/dist-cdn/chunks/base-DCGd2Oii.js.map +1 -0
  200. package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js +25 -0
  201. package/dist-cdn/chunks/fetch-json-Cyqv-gLU.js.map +1 -0
  202. package/dist-cdn/chunks/heading-level-DIuNS44-.js +31 -0
  203. package/dist-cdn/chunks/heading-level-DIuNS44-.js.map +1 -0
  204. package/dist-cdn/chunks/hours-data-Bw6vkIw7.js +181 -0
  205. package/dist-cdn/chunks/hours-data-Bw6vkIw7.js.map +1 -0
  206. package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js +346 -0
  207. package/dist-cdn/chunks/library-weekly-hours-ByQ8ugxh.js.map +1 -0
  208. package/dist-cdn/chunks/link-DbJSwj16.js +7 -0
  209. package/dist-cdn/chunks/link-DbJSwj16.js.map +1 -0
  210. package/dist-cdn/chunks/new-york-DkcnqvJ4.js +18 -0
  211. package/dist-cdn/chunks/new-york-DkcnqvJ4.js.map +1 -0
  212. package/dist-cdn/chunks/repeat-CIFUYkyh.js +101 -0
  213. package/dist-cdn/chunks/repeat-CIFUYkyh.js.map +1 -0
  214. package/dist-cdn/chunks/site-header-BwDkZ2LL.js +802 -0
  215. package/dist-cdn/chunks/site-header-BwDkZ2LL.js.map +1 -0
  216. package/dist-cdn/chunks/site-main-nav-BLAAunnr.js +605 -0
  217. package/dist-cdn/chunks/site-main-nav-BLAAunnr.js.map +1 -0
  218. package/dist-cdn/chunks/static-html-1mTAG6nS.js +22 -0
  219. package/dist-cdn/chunks/static-html-1mTAG6nS.js.map +1 -0
  220. package/dist-cdn/custom-elements.json +15178 -0
  221. package/dist-cdn/events-section.js +401 -0
  222. package/dist-cdn/events-section.js.map +1 -0
  223. package/dist-cdn/library-hours-setup.js +28 -0
  224. package/dist-cdn/library-hours-setup.js.map +1 -0
  225. package/dist-cdn/library-weekly-hours.js +1 -0
  226. package/dist-cdn/manifest.json +23 -0
  227. package/dist-cdn/site-analytics.js +6 -0
  228. package/dist-cdn/site-analytics.js.map +1 -0
  229. package/dist-cdn/site-footer.js +267 -0
  230. package/dist-cdn/site-footer.js.map +1 -0
  231. package/dist-cdn/site-header.js +1 -0
  232. package/dist-cdn/site-hours-section.js +145 -0
  233. package/dist-cdn/site-hours-section.js.map +1 -0
  234. package/dist-cdn/site-main-nav.js +1 -0
  235. package/dist-cdn/site-page.js +317 -0
  236. package/dist-cdn/site-page.js.map +1 -0
  237. package/dist-cdn/site-style.js +42 -0
  238. package/dist-cdn/site-style.js.map +1 -0
  239. package/dist-cdn/skills/uvalib-web-components/SKILL.md +276 -0
  240. package/dist-cdn/skills/uvalib-web-components/reference/components.md +631 -0
  241. package/dist-cdn/skills/uvalib-web-components/reference/migration.md +74 -0
  242. package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +147 -0
  243. package/dist-cdn/tokens.css +152 -0
  244. package/dist-cdn/uvalib-analytics.js +6 -0
  245. package/dist-cdn/uvalib-analytics.js.map +1 -0
  246. package/dist-cdn/uvalib-date-range.js +262 -0
  247. package/dist-cdn/uvalib-date-range.js.map +1 -0
  248. package/dist-cdn/uvalib-filter.js +184 -0
  249. package/dist-cdn/uvalib-filter.js.map +1 -0
  250. package/package.json +152 -4
  251. package/skills/uvalib-web-components/SKILL.md +276 -0
  252. package/skills/uvalib-web-components/reference/components.md +631 -0
  253. package/skills/uvalib-web-components/reference/migration.md +74 -0
  254. package/skills/uvalib-web-components/reference/snippets.md +147 -0
@@ -0,0 +1,1035 @@
1
+ import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./chunks/UvalibElement-BnI-eRRR.js";
2
+ import { n as u, t as d } from "./chunks/static-html-1mTAG6nS.js";
3
+ import { a as f, i as p } from "./chunks/analytics-C8D8n_wt.js";
4
+ import { t as m } from "./chunks/heading-level-DIuNS44-.js";
5
+ import { t as h } from "./chunks/accessible-GqhVn5_H.js";
6
+ import { n as ee, t as g } from "./chunks/fetch-json-Cyqv-gLU.js";
7
+ // src/components/bento-box/BentoSection.ts
8
+ var te = 5, _ = 3, v = 50, y = (e) => `
9
+ ${e} { display: block; }
10
+ ${e} .bs-results--placeholder { visibility: hidden; }
11
+ ${e} .bs-results--stack { display: grid; }
12
+ ${e} .bs-results--stack > * { grid-area: 1 / 1; min-width: 0; }
13
+ ${e} .bs-results--message { align-self: start; z-index: 1; }
14
+ ${e} .bs-results--see-all { display: inline; }
15
+ ${e} .bs-results--guide { font-weight: normal; }
16
+ ${e} .bs-results--title,
17
+ ${e} .bento-section-title,
18
+ ${e} .bs-results--highlights {
19
+ display: -webkit-box;
20
+ -webkit-box-orient: vertical;
21
+ -webkit-line-clamp: 2;
22
+ line-clamp: 2;
23
+ overflow: hidden;
24
+ }
25
+ ${e} .bento-section-desc {
26
+ display: -webkit-box;
27
+ -webkit-box-orient: vertical;
28
+ -webkit-line-clamp: 3;
29
+ line-clamp: 3;
30
+ overflow: hidden;
31
+ }
32
+ /* Placeholders take every clamped block's full height. Results don't (a one-line title sits
33
+ right above its author); the reserve list behind them holds the placeholders' height. */
34
+ ${e} .bs-results--placeholder .bs-results--title,
35
+ ${e} .bs-results--placeholder .bento-section-title,
36
+ ${e} .bs-results--placeholder .bs-results--highlights {
37
+ min-height: 3em;
38
+ min-height: 2lh;
39
+ }
40
+ ${e} .bs-results--placeholder .bento-section-desc {
41
+ min-height: 4.5em;
42
+ min-height: 3lh;
43
+ }
44
+ ${e} .bs-results--reserve { visibility: hidden; pointer-events: none; }
45
+ ${e} .bs-results--author,
46
+ ${e} .bs-results--date,
47
+ ${e} .bs-results--format,
48
+ ${e} .bs-results--byline {
49
+ overflow: hidden;
50
+ white-space: nowrap;
51
+ text-overflow: ellipsis;
52
+ }
53
+ /* A guide with no author or subjects keeps its placeholder's line. */
54
+ ${e} .bs-results--byline { min-height: 1.5em; min-height: 1lh; }
55
+ ${e}[hidden], ${e} [hidden] { display: none !important; }
56
+ ${e} .visually-hidden {
57
+ position: absolute;
58
+ width: 1px;
59
+ height: 1px;
60
+ margin: -1px;
61
+ padding: 0;
62
+ overflow: hidden;
63
+ clip: rect(0, 0, 0, 0);
64
+ white-space: nowrap;
65
+ border: 0;
66
+ }
67
+ `, b = s(y(":host")), x = (e) => e.map((e) => e.mark ? u`<mark>${e.text}</mark>` : e.text), S = class extends l {
68
+ static {
69
+ this.styles = [
70
+ h,
71
+ b,
72
+ t`
73
+ :host {
74
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
75
+ background: var(--uva-color-surface-raised, #fff);
76
+ border: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));
77
+ border-top: none;
78
+ line-height: 1.5;
79
+ min-width: 0;
80
+ }
81
+ a {
82
+ color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
83
+ }
84
+ /* One line whatever the count's length, so the header keeps its height. */
85
+ .bs-results--header {
86
+ display: flex;
87
+ justify-content: space-between;
88
+ align-items: center;
89
+ gap: 0.5rem 1rem;
90
+ padding: 0.5rem 1rem;
91
+ background: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));
92
+ }
93
+ .bs-results--header > :is(h1, h2, h3, h4, h5, h6) {
94
+ min-width: 0;
95
+ overflow: hidden;
96
+ text-overflow: ellipsis;
97
+ white-space: nowrap;
98
+ margin: 0;
99
+ font-size: 1.0625rem;
100
+ line-height: 1.5;
101
+ text-transform: uppercase;
102
+ }
103
+ .bs-results--body {
104
+ padding: 1rem;
105
+ }
106
+ .bs-results--body > p {
107
+ margin: 0 0 1rem;
108
+ }
109
+ .bs-results--list {
110
+ margin: 0 0 1rem;
111
+ padding-inline-start: 1.5rem;
112
+ }
113
+ .bs-results--list--entry,
114
+ .bs-results--list > li {
115
+ border-bottom: 1px solid var(--uva-color-border, var(--uva-grey-100, #dadada));
116
+ margin-bottom: 1rem;
117
+ padding-bottom: 1rem;
118
+ }
119
+ .bs-results--list > li:last-child {
120
+ border-bottom: none;
121
+ margin-bottom: 0;
122
+ }
123
+ .bs-results--title,
124
+ .bento-section-title {
125
+ font-weight: 700;
126
+ }
127
+ .ul-0,
128
+ .ul-1 {
129
+ list-style: none;
130
+ margin: 0;
131
+ padding: 0;
132
+ }
133
+ .ul-1 {
134
+ display: flex;
135
+ justify-content: space-between;
136
+ gap: 1rem;
137
+ }
138
+ .ul-1 > li {
139
+ min-width: 0;
140
+ }
141
+ .bs-results--teaser {
142
+ padding: 0.5rem 0;
143
+ }
144
+ .bs-results--message {
145
+ margin: 0;
146
+ }
147
+ .uvalib-button {
148
+ display: inline-block;
149
+ white-space: nowrap;
150
+ font: inherit;
151
+ line-height: 1.5;
152
+ padding: 0.1rem 0.75rem;
153
+ border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));
154
+ border-radius: 0.3rem;
155
+ background: var(--uva-color-surface-raised, #fff);
156
+ color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
157
+ text-decoration: none;
158
+ cursor: pointer;
159
+ }
160
+ .bs-results--message .uvalib-button {
161
+ margin-inline-start: 0.5rem;
162
+ }
163
+ .uvalib-button[aria-disabled='true'] {
164
+ cursor: progress;
165
+ }
166
+ `
167
+ ];
168
+ }
169
+ get seeAllIn() {
170
+ return this.sourceName;
171
+ }
172
+ get state() {
173
+ return this._state;
174
+ }
175
+ createRenderRoot() {
176
+ let e = super.createRenderRoot();
177
+ if (e instanceof ShadowRoot && this.noStyle) {
178
+ let t = b.styleSheet;
179
+ t && (e.adoptedStyleSheets = [t]);
180
+ }
181
+ return e;
182
+ }
183
+ constructor() {
184
+ super(), this.query = "", this.limit = 5, this.noResultDescribe = "No results found.", this.entryClass = "bs-results--list--entry", this._state = "loading", this.retrying = !1, this.inferredLevel = _, this.loadId = 0, this.onClick = (e) => {
185
+ let t = e.composedPath(), n = this.renderRoot.querySelector(".bs-results--list");
186
+ for (let e of t) {
187
+ if (e === this) return;
188
+ if (e instanceof Element) {
189
+ if (e.matches(".bs-results--see-all button")) {
190
+ p(this, [
191
+ "bento-box",
192
+ "see-all-click",
193
+ this.analyticsName
194
+ ]);
195
+ return;
196
+ }
197
+ if (e.matches("a[href]")) {
198
+ let e = t.find((e) => e instanceof HTMLLIElement && e.parentNode === n);
199
+ if (!e || e.classList.contains("bs-results--placeholder")) return;
200
+ let r = [...n.children].indexOf(e) + 1;
201
+ p(this, [
202
+ "bento-box",
203
+ "result-click",
204
+ this.analyticsName,
205
+ r
206
+ ]);
207
+ return;
208
+ }
209
+ }
210
+ }
211
+ }, this.addEventListener("click", this.onClick);
212
+ }
213
+ connectedCallback() {
214
+ super.connectedCallback();
215
+ let e = m(this);
216
+ if (this.inferredLevel = e === null ? _ : Math.min(e + 1, 6), this.lightDom && this.noStyle) {
217
+ let e = this.getRootNode(), t = e instanceof ShadowRoot || e instanceof Document ? e : void 0;
218
+ c(`${this.localName}::structure`, s(y(this.localName)), {
219
+ root: t,
220
+ scope: !1
221
+ });
222
+ }
223
+ this.hasUpdated && this._state === "loading" && this.load();
224
+ }
225
+ disconnectedCallback() {
226
+ super.disconnectedCallback(), this.controller && (this.loadId++, this.controller.abort(), this.controller = void 0, this._state = "loading");
227
+ }
228
+ get count() {
229
+ let e = Math.trunc(this.limit);
230
+ return Number.isFinite(e) && e > 0 ? Math.min(e, v) : te;
231
+ }
232
+ get level() {
233
+ let e = Math.trunc(this.headingLevel ?? NaN);
234
+ return e >= 1 && e <= 6 ? e : this.inferredLevel;
235
+ }
236
+ get q() {
237
+ return (this.query ?? "").trim();
238
+ }
239
+ willUpdate(e) {
240
+ this.isConnected && (!this.hasUpdated || e.has("query") || e.has("limit")) && this.load();
241
+ }
242
+ updated(e) {
243
+ e.has("_state") && this.dispatchEvent(new Event("bento-state", {
244
+ bubbles: !0,
245
+ composed: !0
246
+ }));
247
+ }
248
+ async load() {
249
+ let e = ++this.loadId;
250
+ this.controller?.abort();
251
+ let t = this.q;
252
+ if (!t) {
253
+ this.controller = void 0, this.results = void 0, this._state = "empty", this.reportedQuery = void 0;
254
+ return;
255
+ }
256
+ let n = this.controller = new AbortController();
257
+ this._state = "loading", this.results = void 0;
258
+ try {
259
+ let r = await this.fetchResults(t, this.count, n.signal);
260
+ if (e !== this.loadId) return;
261
+ this.results = {
262
+ ...r,
263
+ items: r.items.slice(0, this.count)
264
+ }, this._state = this.results.items.length ? "ready" : "empty", t !== this.reportedQuery && (this.reportedQuery = t, f(this, t, this.analyticsName, r.total ?? (this._state === "empty" ? 0 : void 0)));
265
+ } catch {
266
+ if (e !== this.loadId) return;
267
+ this.results = void 0, this._state = "error", this.reportedQuery = void 0;
268
+ } finally {
269
+ this.controller === n && (this.controller = void 0);
270
+ }
271
+ }
272
+ async retry() {
273
+ if (this.retrying) return;
274
+ let e = this.focusedInside();
275
+ this.retrying = !0;
276
+ try {
277
+ await this.load();
278
+ } finally {
279
+ this.retrying = !1;
280
+ }
281
+ if (await this.updateComplete, !e) return;
282
+ let t = this.renderRoot;
283
+ this._state === "ready" ? t.querySelector(".bs-results--list a[href]")?.focus() : this._state === "error" ? t.querySelector(".bs-results--message button")?.focus() : t.querySelector(".bs-results--message")?.focus();
284
+ }
285
+ focusedInside() {
286
+ let e = this.renderRoot instanceof ShadowRoot ? this.renderRoot.activeElement : document.activeElement;
287
+ return !!e && this.renderRoot.contains(e) && e !== this;
288
+ }
289
+ renderSeeAll() {
290
+ let e = new URL(this.results?.seeAll ?? this.seeAllUrl(this.q)), t = [...e.searchParams];
291
+ e.search = "";
292
+ let n = this._state === "ready" ? this.results?.total : void 0;
293
+ return u`<form class="bs-results--see-all" action=${e.href} method="get">
294
+ ${t.map(([e, t]) => u`<input type="hidden" name=${e} .value=${t} />`)}
295
+ <button type="submit" class="uvalib-button">
296
+ See all
297
+ ${n === void 0 ? o : u`<span class="bs-results--qty">${n.toLocaleString("en-US")}</span>`}
298
+ results<span class="visually-hidden"> in ${this.seeAllIn}</span>
299
+ </button>
300
+ </form>`;
301
+ }
302
+ renderMessage() {
303
+ return this.retrying || this._state === "error" ? u`${this.sourceName[0].toUpperCase()}${this.sourceName.slice(1)} results are
304
+ unavailable right now.
305
+ <button
306
+ type="button"
307
+ class="uvalib-button"
308
+ aria-disabled=${this.retrying ? "true" : o}
309
+ @click=${this.retry}
310
+ >
311
+ ${this.retrying ? "Retrying…" : "Retry"}<span class="visually-hidden">
312
+ ${this.sourceName}</span
313
+ >
314
+ </button>` : this._state === "empty" ? this.noResultDescribe : o;
315
+ }
316
+ renderPlaceholder() {
317
+ return u`<li class="${this.entryClass} bs-results--placeholder" aria-hidden="true">
318
+ ${this.renderPlaceholderBody()}
319
+ </li>`;
320
+ }
321
+ entry(e) {
322
+ return u`<li class=${this.entryClass || o}>${e}</li>`;
323
+ }
324
+ render() {
325
+ let e = d(`h${this.level}`), t = this._state === "loading", n = this._state === "ready" ? this.results?.items ?? [] : [], r = n.length ? 0 : t && !this.retrying ? this.count : 1, i = this.renderMessage(), a = t || this._state === "ready";
326
+ return u`<div class="bs-results--header">
327
+ <${e}>${this.heading}</${e}>
328
+ ${a && this.q ? this.renderSeeAll() : u`<div><a href=${this.home.url} class="uvalib-button">${this.home.text}</a></div>`}
329
+ </div>
330
+ <div class="bs-results--body">
331
+ <p>${this.describe}</p>
332
+ <div class="bs-results--stack">
333
+ <ol class="bs-results--list" aria-busy=${t ? "true" : "false"}>
334
+ ${n.map((e) => this.renderItem(e))}
335
+ ${Array.from({ length: r }, () => this.renderPlaceholder())}
336
+ </ol>
337
+ ${n.length ? u`<ol class="bs-results--list bs-results--reserve" aria-hidden="true">
338
+ ${n.map(() => this.renderPlaceholder())}
339
+ </ol>` : o}
340
+ ${i === o ? o : u`<p class="bs-results--message" tabindex="-1">${i}</p>`}
341
+ </div>
342
+ </div>`;
343
+ }
344
+ };
345
+ a([e({ type: String })], S.prototype, "query", void 0), a([e({ type: Number })], S.prototype, "limit", void 0), a([e({
346
+ type: String,
347
+ attribute: "no-result-describe"
348
+ })], S.prototype, "noResultDescribe", void 0), a([e({
349
+ type: Number,
350
+ attribute: "heading-level"
351
+ })], S.prototype, "headingLevel", void 0), a([n()], S.prototype, "_state", void 0), a([n()], S.prototype, "results", void 0), a([n()], S.prototype, "retrying", void 0), a([n()], S.prototype, "inferredLevel", void 0);
352
+ // src/components/bento-box/bento-data.ts
353
+ var C = {
354
+ authorize: "https://search.lib.virginia.edu/authorize",
355
+ catalog: "https://pool-solr-ws-uva-library.internal.lib.virginia.edu/api/search",
356
+ articles: "https://pool-eds-ws.internal.lib.virginia.edu/api/search",
357
+ guides: "https://qmo3jwybkg.execute-api.us-east-1.amazonaws.com/production/library/libguides-proxy",
358
+ website: "/jsonapi/index/default_index"
359
+ }, w = {
360
+ retries: 2,
361
+ retryDelay: 1e3,
362
+ timeout: 1e4
363
+ }, ne = [
364
+ "authorize",
365
+ "catalog",
366
+ "articles",
367
+ "guides",
368
+ "website"
369
+ ];
370
+ function T(e) {
371
+ for (let t of ne) {
372
+ let n = e?.[t];
373
+ typeof n == "string" && n && (C[t] = n);
374
+ }
375
+ }
376
+ var E = !1;
377
+ function D() {
378
+ return E || (E = !0, T(globalThis.window?.uvalibBentoEndpoints)), C;
379
+ }
380
+ var O = (e) => e >= 500 || e === 408 || e === 429, k = /* @__PURE__ */ new Map();
381
+ function A(e, t, n) {
382
+ if (n?.aborted) return Promise.reject(n.reason);
383
+ let r = k.get(e);
384
+ if (!r) {
385
+ let n = new AbortController(), i = {
386
+ controller: n,
387
+ waiting: 0,
388
+ settled: !1,
389
+ promise: t(n.signal)
390
+ };
391
+ i.promise.then(() => i.settled = !0, () => {
392
+ i.settled = !0, k.get(e) === i && k.delete(e);
393
+ }), k.set(e, r = i);
394
+ }
395
+ let i = r;
396
+ return n ? (i.waiting++, new Promise((t, r) => {
397
+ let a = !1, o = () => {
398
+ a || (a = !0, n.removeEventListener("abort", s), i.waiting--);
399
+ }, s = () => {
400
+ o(), !i.settled && i.waiting === 0 && (i.controller.abort(n.reason), k.get(e) === i && k.delete(e)), r(n.reason);
401
+ };
402
+ n.addEventListener("abort", s, { once: !0 }), i.promise.then((e) => {
403
+ o(), t(e);
404
+ }, (e) => {
405
+ o(), r(e);
406
+ });
407
+ })) : i.promise;
408
+ }
409
+ var j, M;
410
+ function N() {
411
+ if (!j) {
412
+ M = void 0;
413
+ let e = ee(D().authorize, w, {
414
+ method: "POST",
415
+ retryStatus: O
416
+ }).then((t) => {
417
+ let n = t.trim();
418
+ if (!n) throw Error("empty Virgo guest token");
419
+ return j === e && (M = n), n;
420
+ });
421
+ j = e, e.catch(() => {
422
+ j === e && (j = void 0);
423
+ });
424
+ }
425
+ return j;
426
+ }
427
+ function re(e) {
428
+ M === e && (j = M = void 0);
429
+ }
430
+ var ie = {
431
+ catalog: "https://search.lib.virginia.edu/sources/uva_library/items/",
432
+ articles: "https://search.lib.virginia.edu/sources/articles/items/"
433
+ }, ae = /^please sign in to see more/i, oe = "Article details available after signing in to Virgo", P = 5, F = (e) => typeof e == "string" ? e.replace(/\s+/g, " ").trim() : "";
434
+ function se(e, t) {
435
+ let n = e, r = Array.isArray(n?.group_list) ? n.group_list : [], i = [];
436
+ for (let e of r) {
437
+ let n = Array.isArray(e?.record_list) ? e.record_list[0] : void 0, r = Array.isArray(n?.fields) ? n.fields : [], a = (e) => r.filter(e).map((e) => F(e.value)), o = (e) => a(e).find(Boolean) ?? "", s = o((e) => e.type === "title"), c = o((e) => e.type === "identifier");
438
+ if (!s || !c) continue;
439
+ let l = t === "articles" && ae.test(s), u = a((e) => e.type === "author").filter(Boolean);
440
+ u.length > P && (u = [...u.slice(0, P), `and ${u.length - P} more`]);
441
+ let d = Math.trunc(Number(e.count));
442
+ i.push({
443
+ title: l ? oe : s,
444
+ url: ie[t] + encodeURIComponent(c),
445
+ authors: u,
446
+ published: o((e) => e.name === "published_date") || void 0,
447
+ formats: a((e) => e.name === (t === "articles" ? "pub_type" : "format")).filter(Boolean),
448
+ editions: d > 1 ? d : 1,
449
+ signIn: l
450
+ });
451
+ }
452
+ let a = Number(n?.pagination?.total);
453
+ return {
454
+ items: i,
455
+ total: Number.isFinite(a) && a >= 0 ? a : void 0
456
+ };
457
+ }
458
+ function I(e) {
459
+ return `keyword: {${e.replace(/[{}]/g, " ")}}`;
460
+ }
461
+ function ce(e, t) {
462
+ return JSON.stringify({
463
+ query: I(e),
464
+ pagination: {
465
+ start: 0,
466
+ rows: t
467
+ },
468
+ sort: {
469
+ sort_id: "SortRelevance",
470
+ order: "desc"
471
+ },
472
+ filters: [{
473
+ pool_id: "uva_library",
474
+ facets: []
475
+ }]
476
+ });
477
+ }
478
+ function le(e, t, n, r) {
479
+ let i = D()[e], a = ce(t, n);
480
+ return A(`POST ${i}\n${a}`, async (t) => {
481
+ for (let n = 0;; n++) {
482
+ let r = await N();
483
+ if (t.aborted) throw t.reason;
484
+ let o = {
485
+ method: "POST",
486
+ headers: {
487
+ Accept: "application/json",
488
+ "Content-Type": "application/json",
489
+ Authorization: `Bearer ${r}`
490
+ },
491
+ body: a,
492
+ signal: t,
493
+ retryStatus: O
494
+ };
495
+ try {
496
+ return se(await g(i, w, o), e);
497
+ } catch (e) {
498
+ if (n === 0 && e.status === 401) {
499
+ re(r);
500
+ continue;
501
+ }
502
+ throw e;
503
+ }
504
+ }
505
+ }, r);
506
+ }
507
+ function ue(e, t) {
508
+ return `https://search.lib.virginia.edu/?${new URLSearchParams(e === "catalog" ? {
509
+ q: t,
510
+ pool: "uva_library"
511
+ } : {
512
+ q: I(t),
513
+ pool: "articles"
514
+ })}`;
515
+ }
516
+ var de = [
517
+ "Jan",
518
+ "Feb",
519
+ "Mar",
520
+ "Apr",
521
+ "May",
522
+ "Jun",
523
+ "Jul",
524
+ "Aug",
525
+ "Sep",
526
+ "Oct",
527
+ "Nov",
528
+ "Dec"
529
+ ];
530
+ function fe(e) {
531
+ let t = /^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/.exec(e);
532
+ if (!t) return e;
533
+ let [, n, r, i] = t, a = r ? de[Number(r) - 1] : void 0;
534
+ if (!r) return n;
535
+ if (!a) return e;
536
+ if (!i) return `${a} ${n}`;
537
+ let o = Number(i), s = new Date(Date.UTC(Number(n), Number(r) - 1, o));
538
+ return s.getUTCDate() === o ? new Intl.DateTimeFormat("en-US", {
539
+ timeZone: "UTC",
540
+ year: "numeric",
541
+ month: "short",
542
+ day: "numeric"
543
+ }).format(s) : e;
544
+ }
545
+ var L = /* @__PURE__ */ new Set(["http:", "https:"]);
546
+ function R(e, t) {
547
+ if (typeof e == "string" && e.trim()) try {
548
+ let n = new URL(e.trim(), t);
549
+ return L.has(n.protocol) ? n.href : void 0;
550
+ } catch {
551
+ return;
552
+ }
553
+ }
554
+ var z = "https://guides.lib.virginia.edu/", B = (e) => {
555
+ let t = R(e?.getAttribute("href"), z), n = F(e?.textContent);
556
+ return t && n ? {
557
+ text: n,
558
+ url: t
559
+ } : void 0;
560
+ };
561
+ function V(e, t) {
562
+ let n = [], r = (e, t) => {
563
+ if (!e) return;
564
+ let r = n[n.length - 1];
565
+ r && !!r.mark === t ? r.text += e : n.push(t ? {
566
+ text: e,
567
+ mark: t
568
+ } : { text: e });
569
+ }, i = (e, n) => {
570
+ if (e.nodeType === Node.TEXT_NODE) r(e.data, n);
571
+ else if (e.nodeType === Node.ELEMENT_NODE) {
572
+ let r = e;
573
+ if (r.localName === "script" || r.localName === "style" || r.localName === "template") return;
574
+ let a = n || r.localName === t;
575
+ r.childNodes.forEach((e) => i(e, a));
576
+ }
577
+ };
578
+ e.childNodes.forEach((e) => i(e, !1));
579
+ for (let e of n) e.text = e.text.replace(/\s+/g, " ");
580
+ return n.length && (n[0].text = n[0].text.trimStart(), n[n.length - 1].text = n[n.length - 1].text.trimEnd()), n.filter((e) => e.text);
581
+ }
582
+ var H = (e) => new DOMParser().parseFromString(e, "text/html");
583
+ function pe(e) {
584
+ let t = e?.data, n = typeof t?.results == "string" ? t.results : "", r = [];
585
+ for (let e of H(n).querySelectorAll(".s-srch-result")) {
586
+ let t = e.querySelector(".s-srch-result-title"), n = B(t?.querySelector(":scope > a"));
587
+ if (!n) continue;
588
+ let i = e.querySelectorAll(".s-srch-result-meta")[1], a = i?.querySelector(".s-srch-result-highlights");
589
+ r.push({
590
+ title: n.text,
591
+ url: n.url,
592
+ guide: B(t?.querySelector(".s-srch-result-guide a")),
593
+ author: B(i?.querySelector(".s-srch-result-author a")),
594
+ subjects: [...i?.querySelectorAll(".s-srch-result-subjects a") ?? []].map(B).filter((e) => !!e),
595
+ highlights: a ? V(a, "mark") : []
596
+ });
597
+ }
598
+ return {
599
+ items: r,
600
+ seeAll: R(t?.fulllink)
601
+ };
602
+ }
603
+ function me(e) {
604
+ return `${z}srch.php?${new URLSearchParams({
605
+ default_lg: "1",
606
+ q: e
607
+ })}`;
608
+ }
609
+ function U(e, t) {
610
+ return `${e}${e.includes("?") ? "&" : "?"}${t}`;
611
+ }
612
+ function he(e, t, n) {
613
+ let r = U(D().guides, new URLSearchParams({ q: e }));
614
+ return A(`GET ${r}`, async (e) => pe(await g(r, w, {
615
+ signal: e,
616
+ retryStatus: O
617
+ })), n).then((e) => ({
618
+ ...e,
619
+ items: e.items.slice(0, t)
620
+ }));
621
+ }
622
+ var ge = [
623
+ "page",
624
+ "person",
625
+ "library",
626
+ "article"
627
+ ], W = "https://library.virginia.edu";
628
+ function _e(e, t) {
629
+ let n = new URLSearchParams();
630
+ n.set("filter[fulltext]", e), n.set("page[limit]", String(t)), n.set("filter[types-group][group][conjunction]", "OR");
631
+ for (let e of ge) n.set(`filter[${e}-filter][condition][path]`, "type"), n.set(`filter[${e}-filter][condition][value]`, e), n.set(`filter[${e}-filter][condition][memberOf]`, "types-group");
632
+ return n;
633
+ }
634
+ function ve(e) {
635
+ let t = e, n = Array.isArray(t?.data) ? t.data : [], r = [];
636
+ for (let e of n) {
637
+ let n = e?.attributes ?? {}, i = F(n.title), a = F(n.path?.alias), o = n.drupal_internal__nid, s = a.startsWith("/") ? a : o == null ? "" : `/node/${encodeURI(String(o))}`, c = s ? R(s, W) : void 0;
638
+ if (!i || !c || !c.startsWith("https://library.virginia.edu/")) continue;
639
+ let l = t?.meta?.extra_data?.[String(o)]?.excerpt, u = typeof l == "string" && l ? V(H(l).body, "strong") : [];
640
+ if (!u.length && e.type === "node--person") {
641
+ let e = n.field_uva_ldap_title, t = (Array.isArray(e) ? e : [e]).map(F).filter(Boolean).join("; ");
642
+ t && (u = [{ text: t }]);
643
+ }
644
+ r.push({
645
+ title: i,
646
+ url: c,
647
+ excerpt: u
648
+ });
649
+ }
650
+ let i = Number(t?.meta?.count);
651
+ return {
652
+ items: r,
653
+ total: Number.isFinite(i) && i >= 0 ? i : void 0
654
+ };
655
+ }
656
+ function ye(e, t, n) {
657
+ let r = U(D().website, _e(e, t));
658
+ return A(`GET ${r}`, async (e) => ve(await g(r, w, {
659
+ signal: e,
660
+ retryStatus: O
661
+ })), n);
662
+ }
663
+ function be(e) {
664
+ return `${W}/search/content?${new URLSearchParams({ search_api_fulltext: e })}`;
665
+ }
666
+ // src/components/bento-box/VirgoSection.ts
667
+ var G = class extends S {
668
+ fetchResults(e, t, n) {
669
+ return le(this.pool, e, t, n);
670
+ }
671
+ seeAllUrl(e) {
672
+ return ue(this.pool, e);
673
+ }
674
+ line(e, t) {
675
+ return t ? r`<li class="${e} li-1">${t}</li>` : r`<li class="${e} li-1" aria-hidden="true"> </li>`;
676
+ }
677
+ renderItem(e) {
678
+ let t = e.editions > 1 ? r`<span class="bs-results--editions"
679
+ >${e.formats.length ? ", " : ""}${e.editions} editions</span
680
+ >` : "", n = e.formats.length || t ? r`${e.formats.join("/")}${t}` : "";
681
+ return this.entry(r`<a href=${e.url} class="bs-results--title">${e.title}</a>
682
+ <ul class="ul-0">
683
+ ${this.line("bs-results--author", e.authors.join("; "))}
684
+ <li>
685
+ <ul class="ul-1">
686
+ ${this.line("bs-results--date", e.published ? r`<time datetime=${e.published}>${fe(e.published)}</time>` : "")}
687
+ ${this.line("bs-results--format", n)}
688
+ </ul>
689
+ </li>
690
+ </ul>`);
691
+ }
692
+ renderPlaceholderBody() {
693
+ return r`<a class="bs-results--title">Library search result</a>
694
+ <ul class="ul-0">
695
+ <li class="bs-results--author li-1">Author, Example</li>
696
+ <li>
697
+ <ul class="ul-1">
698
+ <li class="bs-results--date li-1">2024</li>
699
+ <li class="bs-results--format li-1">Book</li>
700
+ </ul>
701
+ </li>
702
+ </ul>`;
703
+ }
704
+ }, xe = class extends G {
705
+ constructor(...e) {
706
+ super(...e), this.pool = "articles", this.analyticsName = "Virgo articles", this.heading = "Article", this.sourceName = "Virgo article", this.describe = "An aggregation of tens of millions of articles made available through Library subscriptions.", this.home = {
707
+ text: "Search articles",
708
+ url: "https://search.lib.virginia.edu/"
709
+ };
710
+ }
711
+ get seeAllIn() {
712
+ return "Virgo articles";
713
+ }
714
+ }, K = [
715
+ "catalog",
716
+ "articles",
717
+ "libguides",
718
+ "website"
719
+ ], q = 2;
720
+ function J(e) {
721
+ let t = e;
722
+ if (typeof e == "string") {
723
+ let n = e.trim();
724
+ try {
725
+ t = n.startsWith("[") ? JSON.parse(n) : n.split(/[\s,]+/);
726
+ } catch {
727
+ t = [];
728
+ }
729
+ }
730
+ let n = new Set(K), r = [...new Set((Array.isArray(t) ? t : []).map((e) => typeof e == "string" ? e.trim().toLowerCase() : "").filter((e) => n.has(e)))];
731
+ return r.length ? r : [...K];
732
+ }
733
+ function Y(e = location.search) {
734
+ let t = new URLSearchParams(e);
735
+ return t.get("q") ?? t.get("query");
736
+ }
737
+ var X = (e) => `
738
+ ${e} { display: block; }
739
+ ${e} .bs-results-container > * { min-width: 0; }
740
+ ${e}[hidden], ${e} [hidden] { display: none !important; }
741
+ ${e} .visually-hidden {
742
+ position: absolute;
743
+ width: 1px;
744
+ height: 1px;
745
+ margin: -1px;
746
+ padding: 0;
747
+ overflow: hidden;
748
+ clip: rect(0, 0, 0, 0);
749
+ white-space: nowrap;
750
+ border: 0;
751
+ }
752
+ `, Z = s(X(":host")), Se = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 2a8 8 0 0 1 6.32 12.9l5.39 5.4-1.41 1.41-5.4-5.39A8 8 0 1 1 10 2zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12z'/%3E%3C/svg%3E\")", Ce = 0, Q = class extends l {
753
+ constructor(...e) {
754
+ super(...e), this.query = "", this.limit = 5, this.searchDescribe = "This page searches Virgo, Virgo articles, subject guides, and the Library website.", this.noResultDescribe = "No results found.", this.placeholder = "Search anything...", this.boxes = [
755
+ "catalog",
756
+ "articles",
757
+ "libguides",
758
+ "website"
759
+ ], this.inferredLevel = q, this.status = "", this.uid = `bento-box-${++Ce}`, this.announcePending = !1, this.onPopState = () => {
760
+ this.query = Y() ?? this.fallbackQuery ?? "";
761
+ }, this.onSectionState = () => {
762
+ let e = this.sections();
763
+ e.some((e) => e.state === "loading") ? (this.announcePending = !0, this.status = "") : this.announcePending && (this.announcePending = !1, this.status = e.some((e) => e.state === "error") ? "Results updated. Some results are unavailable." : "Results updated.");
764
+ };
765
+ }
766
+ static {
767
+ this.styles = [
768
+ h,
769
+ Z,
770
+ t`
771
+ :host {
772
+ container-type: inline-size;
773
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
774
+ line-height: 1.5;
775
+ }
776
+ .bento-search-bar {
777
+ display: block;
778
+ margin: 2rem 0;
779
+ }
780
+ .bento-search-bar form {
781
+ display: flex;
782
+ max-width: 40rem;
783
+ margin: 0 auto;
784
+ }
785
+ .bento-search-bar input {
786
+ flex: 1;
787
+ min-width: 0;
788
+ min-height: 3rem;
789
+ box-sizing: border-box;
790
+ padding: 0.5rem 1rem;
791
+ font: inherit;
792
+ font-size: max(1rem, 1em);
793
+ color: var(--uva-color-input-text, #1f2937);
794
+ background: var(--uva-color-surface-raised, #fff);
795
+ border: 1px solid var(--uva-color-control-border, var(--uva-grey, #808080));
796
+ border-inline-end: 0;
797
+ border-radius: 0.3rem 0 0 0.3rem;
798
+ }
799
+ .bento-search-bar button {
800
+ padding: 0 0.75rem;
801
+ border: 1px solid var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
802
+ border-radius: 0 0.3rem 0.3rem 0;
803
+ background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
804
+ color: var(--uva-color-on-accent, #fff);
805
+ cursor: pointer;
806
+ }
807
+ .bento-search-bar button::before {
808
+ content: '';
809
+ display: block;
810
+ width: 1.5rem;
811
+ height: 1.5rem;
812
+ background: currentColor;
813
+ mask: ${s(Se)} center / contain no-repeat;
814
+ }
815
+ .bento-search-bar p {
816
+ margin: 1rem 0 0;
817
+ text-align: center;
818
+ }
819
+ .bs-header > :is(h1, h2, h3, h4, h5, h6) {
820
+ margin: 2rem 0 0;
821
+ font-size: 1.5rem;
822
+ font-weight: 500;
823
+ line-height: 1.3;
824
+ }
825
+ .bs-search-term {
826
+ font-style: italic;
827
+ }
828
+ .bs-header p {
829
+ margin: 1rem 0;
830
+ font-size: 1.25rem;
831
+ }
832
+ .bs-results-container {
833
+ display: grid;
834
+ grid-template-columns: repeat(2, minmax(0, 1fr));
835
+ gap: 2rem;
836
+ }
837
+ @container (width < 48rem) {
838
+ .bs-results-container {
839
+ grid-template-columns: minmax(0, 1fr);
840
+ }
841
+ }
842
+ `
843
+ ];
844
+ }
845
+ static get endpoints() {
846
+ return C;
847
+ }
848
+ static set endpoints(e) {
849
+ T(e);
850
+ }
851
+ createRenderRoot() {
852
+ let e = super.createRenderRoot();
853
+ if (e instanceof ShadowRoot && this.noStyle) {
854
+ let t = Z.styleSheet;
855
+ t && (e.adoptedStyleSheets = [t]);
856
+ }
857
+ return e;
858
+ }
859
+ connectedCallback() {
860
+ super.connectedCallback();
861
+ let e = m(this);
862
+ if (this.inferredLevel = e === null ? q : Math.min(e + 1, 6), this.lightDom && this.noStyle) {
863
+ let e = this.getRootNode(), t = e instanceof ShadowRoot || e instanceof Document ? e : void 0;
864
+ c(`${this.localName}::structure`, s(X(this.localName)), {
865
+ root: t,
866
+ scope: !1
867
+ });
868
+ }
869
+ this.fallbackQuery ??= this.query;
870
+ let t = Y();
871
+ t !== null && (this.query = t), window.addEventListener("popstate", this.onPopState), this.addEventListener("bento-state", this.onSectionState);
872
+ }
873
+ disconnectedCallback() {
874
+ super.disconnectedCallback(), window.removeEventListener("popstate", this.onPopState), this.removeEventListener("bento-state", this.onSectionState);
875
+ }
876
+ get level() {
877
+ let e = Math.trunc(this.headingLevel ?? NaN);
878
+ return e >= 1 && e <= 6 ? e : this.inferredLevel;
879
+ }
880
+ get q() {
881
+ return (this.query ?? "").trim();
882
+ }
883
+ sections() {
884
+ return [...this.renderRoot.querySelectorAll(".bs-results-container > .bs-results--block")];
885
+ }
886
+ willUpdate(e) {
887
+ e.has("query") && (this.status = "", this.announcePending = !!this.q);
888
+ }
889
+ search(e) {
890
+ e.preventDefault();
891
+ let t = e.currentTarget.elements.namedItem("q").value.trim();
892
+ if (t === this.q) return;
893
+ let n = new URL(location.href);
894
+ n.searchParams.delete("query"), t ? n.searchParams.set("q", t) : n.searchParams.delete("q"), history.pushState({ query: t }, "", n), this.query = t;
895
+ }
896
+ renderSection(e, t) {
897
+ let n = d(`${e}-section`);
898
+ return u`<${n}
899
+ class="bs-results--block"
900
+ ?no-shadow-dom=${this.lightDom}
901
+ ?no-style=${this.noStyle}
902
+ .query=${this.q}
903
+ .limit=${this.limit}
904
+ .noResultDescribe=${this.noResultDescribe}
905
+ .headingLevel=${t}
906
+ ></${n}>`;
907
+ }
908
+ render() {
909
+ let e = this.level, t = d(`h${e}`), n = this.q, r = J(this.boxes), i = `${this.uid}-q`, a = `${this.uid}-describe`;
910
+ return u`<bento-search class="bento-search-bar">
911
+ <search>
912
+ <form action="https://search.lib.virginia.edu/search" method="get" @submit=${this.search}>
913
+ <span class="icon-search" aria-hidden="true"></span>
914
+ <label class="visually-hidden" for=${i}>Search</label>
915
+ <input
916
+ id=${i}
917
+ name="q"
918
+ type="search"
919
+ placeholder=${this.placeholder}
920
+ .value=${n}
921
+ aria-describedby=${a}
922
+ enterkeyhint="search"
923
+ autocapitalize="none"
924
+ autocorrect="off"
925
+ spellcheck="false"
926
+ />
927
+ <button type="submit" class="uvalib-button-home-search">
928
+ <span class="visually-hidden">Search</span>
929
+ </button>
930
+ </form>
931
+ </search>
932
+ <p id=${a}>${this.searchDescribe}</p>
933
+ </bento-search>
934
+ ${n ? u`<div class="bs-header">
935
+ <${t}>You searched for <span class="bs-search-term">${n}</span></${t}>
936
+ <p>Here are the results:</p>
937
+ </div>
938
+ <div class="bs-results-container">
939
+ ${r.map((t) => this.renderSection(t, Math.min(e + 1, 6)))}
940
+ </div>` : o}
941
+ <div class="visually-hidden" role="status">${this.status}</div>`;
942
+ }
943
+ };
944
+ a([e({ type: String })], Q.prototype, "query", void 0), a([e({ type: Number })], Q.prototype, "limit", void 0), a([e({
945
+ type: String,
946
+ attribute: "search-describe"
947
+ })], Q.prototype, "searchDescribe", void 0), a([e({
948
+ type: String,
949
+ attribute: "no-result-describe"
950
+ })], Q.prototype, "noResultDescribe", void 0), a([e({ type: String })], Q.prototype, "placeholder", void 0), a([e({ converter: { fromAttribute: J } })], Q.prototype, "boxes", void 0), a([e({
951
+ type: Number,
952
+ attribute: "heading-level"
953
+ })], Q.prototype, "headingLevel", void 0), a([n()], Q.prototype, "inferredLevel", void 0), a([n()], Q.prototype, "status", void 0);
954
+ // src/components/bento-box/CatalogSection.ts
955
+ var $ = class extends G {
956
+ constructor(...e) {
957
+ super(...e), this.pool = "catalog", this.analyticsName = "Virgo catalog", this.heading = "Virgo Catalog", this.sourceName = "Virgo catalog", this.describe = "Books, journals, manuscripts & archival material, maps, music and sound recordings, theses and dissertations, and videos.", this.home = {
958
+ text: "Search Virgo",
959
+ url: "https://search.lib.virginia.edu/"
960
+ };
961
+ }
962
+ }, we = class extends S {
963
+ constructor(...e) {
964
+ super(...e), this.analyticsName = "Subject guides", this.heading = "Subject Guides", this.sourceName = "subject guide", this.describe = "Subject guides contain topic-specific information to help with research and coursework.", this.home = {
965
+ text: "Search Guides",
966
+ url: "https://guides.lib.virginia.edu/srch.php"
967
+ };
968
+ }
969
+ get seeAllIn() {
970
+ return "subject guides";
971
+ }
972
+ fetchResults(e, t, n) {
973
+ return he(e, t, n);
974
+ }
975
+ seeAllUrl(e) {
976
+ return me(e);
977
+ }
978
+ renderItem(e) {
979
+ let t = e.author ? r`<span class="bs-results--guide-author"
980
+ >by <a href=${e.author.url}>${e.author.text}</a></span
981
+ >` : o, n = e.subjects.length ? r`<span class="bs-results--subjects"
982
+ >Subjects:
983
+ ${e.subjects.map((e, t) => r`${t ? ", " : ""}<a href=${e.url}>${e.text}</a>`)}</span
984
+ >` : o;
985
+ return this.entry(r`<span class="bs-results--title"
986
+ ><a href=${e.url}>${e.title}</a>${e.guide ? r` <span class="bs-results--guide"
987
+ >on <a href=${e.guide.url}>${e.guide.text}</a></span
988
+ >` : o}</span
989
+ >
990
+ <ul class="ul-0">
991
+ <li class="bs-results--teaser li-1">
992
+ <div class="bs-results--byline">
993
+ ${t}${e.author && e.subjects.length ? r` <span aria-hidden="true">|</span> ` : o}${n}
994
+ </div>
995
+ <div class="bs-results--highlights">${x(e.highlights)}</div>
996
+ </li>
997
+ </ul>`);
998
+ }
999
+ renderPlaceholderBody() {
1000
+ return r`<span class="bs-results--title"
1001
+ ><a>Library subject guide</a>
1002
+ <span class="bs-results--guide">on <a>Research</a></span></span
1003
+ >
1004
+ <ul class="ul-0">
1005
+ <li class="bs-results--teaser li-1">
1006
+ <div class="bs-results--byline">by <a>Librarian</a></div>
1007
+ <div class="bs-results--highlights">Research help</div>
1008
+ </li>
1009
+ </ul>`;
1010
+ }
1011
+ }, Te = class extends S {
1012
+ constructor(...e) {
1013
+ super(...e), this.analyticsName = "Library website", this.heading = "Website", this.sourceName = "Library website", this.describe = "Results from the main Library website.", this.home = {
1014
+ text: "Search Library website",
1015
+ url: "https://library.virginia.edu/search/content"
1016
+ }, this.entryClass = "";
1017
+ }
1018
+ fetchResults(e, t, n) {
1019
+ return ye(e, t, n);
1020
+ }
1021
+ seeAllUrl(e) {
1022
+ return be(e);
1023
+ }
1024
+ renderItem(e) {
1025
+ return this.entry(r`<div class="bento-section-title"><a href=${e.url}>${e.title}</a></div>
1026
+ <div class="bento-section-desc">${x(e.excerpt)}</div>`);
1027
+ }
1028
+ renderPlaceholderBody() {
1029
+ return r`<div class="bento-section-title"><a>Library page</a></div>
1030
+ <div class="bento-section-desc">Library website page</div>`;
1031
+ }
1032
+ };
1033
+ i("catalog-section", $), i("articles-section", xe), i("libguides-section", we), i("website-section", Te), i("bento-box", Q);
1034
+
1035
+ //# sourceMappingURL=bento-box.js.map