@uvalib/web-components 0.0.0-stage → 1.0.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 (254) hide show
  1. package/CHANGELOG.md +162 -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 +468 -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 +1023 -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 +52 -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 +52 -0
  254. package/skills/uvalib-web-components/reference/snippets.md +147 -0
@@ -0,0 +1,605 @@
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 "./UvalibElement-BnI-eRRR.js";
2
+ import { i as u } from "./analytics-C8D8n_wt.js";
3
+ import { t as d } from "./accessible-GqhVn5_H.js";
4
+ import { t as f } from "./link-DbJSwj16.js";
5
+ // node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/if-defined.js
6
+ var p = (e) => e ?? o, m = (e) => typeof e == "string" ? e.replace(/\s+/g, " ").trim() : "";
7
+ function h(e) {
8
+ let t = {
9
+ items: [],
10
+ invalid: !1,
11
+ flattened: !1
12
+ };
13
+ if (!Array.isArray(e)) return t.invalid = e != null, t;
14
+ let n = (e, r, i) => {
15
+ for (let a of e) {
16
+ let e = a ?? {}, o = m(e.label), s = m(e.href), c = Array.isArray(e.items) && e.items.length ? e.items : null;
17
+ c ? (t.flattened = !0, o && s && r.push({
18
+ label: o,
19
+ href: s
20
+ }), n(c, r, i + 1)) : o && s ? r.push({
21
+ label: o,
22
+ href: s
23
+ }) : t.invalid = !0;
24
+ }
25
+ };
26
+ for (let r of e) {
27
+ let e = r ?? {}, i = m(e.label), a = m(e.href), o = Array.isArray(e.items) && e.items.length ? e.items : null;
28
+ if (!i) t.invalid = !0;
29
+ else if (o) {
30
+ let e = [];
31
+ n(o, e, 2), e.length ? t.items.push({
32
+ label: i,
33
+ items: e
34
+ }) : a ? t.items.push({
35
+ label: i,
36
+ href: a
37
+ }) : t.invalid = !0;
38
+ } else a ? t.items.push({
39
+ label: i,
40
+ href: a
41
+ }) : t.invalid = !0;
42
+ }
43
+ return t;
44
+ }
45
+ var g = (e) => (e.textContent ?? "").replace(/\s+/g, " ").trim();
46
+ function _(e) {
47
+ let t = e.localName === "ul" ? e : e.querySelector(":scope > ul") ?? void 0;
48
+ if (!t) return [{}];
49
+ let n = (e) => {
50
+ if (e.localName !== "li") return {};
51
+ let t = [...e.children], r = t.find((e) => e.localName === "ul"), i = t.find((e) => e.localName !== "ul");
52
+ if (!i) return {};
53
+ let a = g(i), o = i.localName === "a" ? i.getAttribute("href") : null;
54
+ return r ? {
55
+ label: a,
56
+ href: o,
57
+ items: [...r.children].map(n)
58
+ } : i.localName === "a" ? {
59
+ label: a,
60
+ href: o
61
+ } : { label: a };
62
+ };
63
+ return [...t.children].map(n);
64
+ }
65
+ var v = {
66
+ attempts: 2,
67
+ retryDelay: 1e3,
68
+ timeout: 1e4
69
+ };
70
+ async function y(e) {
71
+ let t, n = Math.max(1, v.attempts);
72
+ for (let r = 0; r < n; r++) {
73
+ r > 0 && await new Promise((e) => setTimeout(e, v.retryDelay));
74
+ try {
75
+ let t = await fetch(e, { signal: AbortSignal.timeout(v.timeout) });
76
+ if (!t.ok) throw Error(`${t.status} ${t.statusText} for ${e}`);
77
+ return await t.json();
78
+ } catch (e) {
79
+ t = e;
80
+ }
81
+ }
82
+ throw t instanceof Error ? t : Error(String(t));
83
+ }
84
+ var b = /* @__PURE__ */ new Map();
85
+ function x(e) {
86
+ let t = b.get(e);
87
+ if (!t) {
88
+ let n = y(e).then((t) => {
89
+ let n = h(t);
90
+ if (!n.items.length) throw Error(`no valid main navigation entries in ${e}`);
91
+ return n;
92
+ });
93
+ b.set(e, t = n), n.catch(() => {
94
+ b.get(e) === n && b.delete(e);
95
+ });
96
+ }
97
+ return t;
98
+ }
99
+ // src/components/site-main-nav/main-nav-data.ts
100
+ var S = [
101
+ {
102
+ label: "About",
103
+ items: [
104
+ {
105
+ label: "About UVA Library",
106
+ href: "/about-uva-library"
107
+ },
108
+ {
109
+ label: "News & announcements",
110
+ href: "https://library.virginia.edu/news/all?mtm_campaign=main-nav"
111
+ },
112
+ {
113
+ label: "Plan a visit",
114
+ href: "/about-uva-library#visit"
115
+ },
116
+ {
117
+ label: "Library Assessment",
118
+ href: "/assessment"
119
+ },
120
+ {
121
+ label: "Staff directory",
122
+ href: "/staff"
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ label: "Using the Library",
128
+ items: [
129
+ {
130
+ label: "Search, borrow, request",
131
+ href: "/services"
132
+ },
133
+ {
134
+ label: "Library spaces",
135
+ href: "/spaces"
136
+ },
137
+ {
138
+ label: "Equipment & technology",
139
+ href: "/equipment-and-tech"
140
+ }
141
+ ]
142
+ },
143
+ {
144
+ label: "Research & teaching support",
145
+ items: [
146
+ {
147
+ label: "Research & teaching support",
148
+ href: "/research-and-teaching"
149
+ },
150
+ {
151
+ label: "Research support",
152
+ href: "/research-and-teaching/research"
153
+ },
154
+ {
155
+ label: "Instruction assistance",
156
+ href: "/research-and-teaching/teach"
157
+ },
158
+ {
159
+ label: "Writing & publication",
160
+ href: "/research-and-teaching/write"
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ label: "Get help",
166
+ items: [
167
+ {
168
+ label: "Get help",
169
+ href: "/help"
170
+ },
171
+ {
172
+ label: "Ask a Librarian",
173
+ href: "/askalibrarian"
174
+ },
175
+ {
176
+ label: "Accessibility services",
177
+ href: "/accessibility"
178
+ },
179
+ {
180
+ label: "Subject specialists",
181
+ href: "https://guides.lib.virginia.edu/subjectlibrarians"
182
+ }
183
+ ]
184
+ }
185
+ ], C = 0, w = "main-nav", T = (e) => e instanceof Element && e.getAttribute("slot") === w, E = ["href", "slot"], D = "\n .toggle:focus-visible,\n .top-link:focus-visible,\n .panel a:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: -4px;\n }\n .toggle[aria-expanded='true']:focus-visible,\n .toggle:hover:focus-visible,\n .top-link:hover:focus-visible,\n .panel a:hover:focus-visible {\n outline-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n", O = s(D), k = (e) => s(D.replace(/(^|,)\s*\./gm, `$1 ${e} .`));
186
+ function A(e, t) {
187
+ try {
188
+ let n = new URL(e, t);
189
+ return `${n.host.replace(/^www\./, "")}${n.pathname.replace(/\/+$/, "")}`;
190
+ } catch {
191
+ return null;
192
+ }
193
+ }
194
+ var j = (e, t) => {
195
+ try {
196
+ return new URL(e, t).hash;
197
+ } catch {
198
+ return "";
199
+ }
200
+ }, M = class extends l {
201
+ constructor(...e) {
202
+ super(...e), this.label = "Main", this.rootLinkDomain = "https://www.library.virginia.edu", this.layout = "bar", this.slotItems = null, this.fetched = null, this.open = null, this.propItems = null, this.warned = /* @__PURE__ */ new Set(), this.idBase = `main-nav-${++C}`, this.onLocationChange = () => {
203
+ this.current || this.requestUpdate();
204
+ }, this.listeningLocation = !1, this.onOutsidePointer = (e) => {
205
+ let t = this.navEl;
206
+ t && !e.composedPath().includes(t) && this.setOpen(null);
207
+ }, this.listening = !1;
208
+ }
209
+ static {
210
+ this.styles = [d, t`
211
+ :host {
212
+ display: block;
213
+ font-family: var(--uva-font-family, franklin-gothic-urw, Arial, Helvetica, sans-serif);
214
+ font-size: 17px;
215
+ line-height: 1.5;
216
+ }
217
+ :host([hidden]) {
218
+ display: none;
219
+ }
220
+ ul {
221
+ list-style: none;
222
+ margin: 0;
223
+ padding: 0;
224
+ }
225
+ .panel[hidden] {
226
+ display: none;
227
+ }
228
+ .toggle,
229
+ .top-link {
230
+ display: flex;
231
+ align-items: center;
232
+ box-sizing: border-box;
233
+ margin: 0;
234
+ border: 0;
235
+ border-radius: 0;
236
+ background: transparent;
237
+ color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));
238
+ font: inherit;
239
+ font-weight: 500;
240
+ line-height: 1.5;
241
+ text-align: start;
242
+ text-decoration: none;
243
+ cursor: pointer;
244
+ }
245
+ /* Chevron: a rotated border box, turned over when expanded. */
246
+ .toggle::after {
247
+ content: '';
248
+ flex: none;
249
+ inline-size: 0.5em;
250
+ block-size: 0.5em;
251
+ margin-inline-start: 0.75em;
252
+ border-style: solid;
253
+ border-color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
254
+ border-width: 0 1px 1px 0;
255
+ transform: translateY(-0.15em) rotate(45deg);
256
+ }
257
+ .toggle[aria-expanded='true']::after {
258
+ transform: translateY(0.15em) rotate(-135deg);
259
+ }
260
+ /* Grey for hover and the open group only, never for focus: the orange focus ring
261
+ would fall below 3:1 against it. */
262
+ .toggle:hover,
263
+ .toggle[aria-expanded='true'],
264
+ .top-link:hover {
265
+ background-color: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));
266
+ color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
267
+ }
268
+ .panel a {
269
+ display: block;
270
+ color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));
271
+ font-weight: 400;
272
+ text-decoration: underline;
273
+ }
274
+ .panel a:hover {
275
+ background-color: var(--uva-color-surface-hover, var(--uva-grey-100, #dadada));
276
+ text-decoration: none;
277
+ }
278
+ ${O}
279
+ /* Current page, and the group holding it: bold with a thick underline, not colour alone. */
280
+ [aria-current]:not([aria-current='false']),
281
+ .panel a[aria-current]:not([aria-current='false']):hover {
282
+ font-weight: 700;
283
+ text-decoration-line: underline;
284
+ text-decoration-thickness: 3px;
285
+ text-decoration-color: var(--uva-color-current, var(--uva-brand-orange, #e57200));
286
+ text-underline-offset: 0.3em;
287
+ }
288
+
289
+ /* Bar: a full-width row with the brand-blue rule, content capped at 1600px. */
290
+ .bar {
291
+ border-bottom: 5px solid var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));
292
+ background: var(--uva-color-surface-raised, #ffffff);
293
+ }
294
+ .bar > ul {
295
+ display: flex;
296
+ flex-wrap: wrap;
297
+ box-sizing: border-box;
298
+ max-inline-size: 1600px;
299
+ margin-inline: auto;
300
+ padding-inline: 16px;
301
+ }
302
+ .bar > ul > li {
303
+ position: relative;
304
+ display: flex;
305
+ }
306
+ .bar .toggle,
307
+ .bar .top-link {
308
+ padding: 11.5px 17px;
309
+ }
310
+ .bar .panel {
311
+ position: absolute;
312
+ top: 100%;
313
+ inset-inline-start: 0;
314
+ z-index: 1000;
315
+ box-sizing: border-box;
316
+ inline-size: max-content;
317
+ min-inline-size: 100%;
318
+ max-inline-size: 20rem;
319
+ background: var(--uva-color-surface-raised, #ffffff);
320
+ border-radius: 0 0 4px 4px;
321
+ box-shadow: 0 8px 16px var(--uva-color-shadow, rgba(0, 0, 0, 0.2));
322
+ /* Invisible normally; forced colors paint it, so the panel keeps an edge. */
323
+ outline: 1px solid transparent;
324
+ }
325
+ .bar .panel a {
326
+ padding: 8.5px 17px;
327
+ }
328
+
329
+ /* Accordion (the header's narrow-screen Menu popover): full-width rows, panels in flow. */
330
+ .accordion .toggle,
331
+ .accordion .top-link {
332
+ inline-size: 100%;
333
+ justify-content: space-between;
334
+ padding: 0.375rem 0.5rem;
335
+ }
336
+ .accordion .toggle::after {
337
+ margin-inline-end: 0.25em;
338
+ }
339
+ .accordion .panel {
340
+ position: static;
341
+ padding-inline-start: 1rem;
342
+ }
343
+ .accordion .panel a {
344
+ padding: 0.375rem 0.5rem;
345
+ }
346
+
347
+ /* Forced colors drop backgrounds and shadows: outline the open group and hovered
348
+ controls instead. */
349
+ @media (forced-colors: active) {
350
+ .toggle[aria-expanded='true']:not(:focus-visible),
351
+ .toggle:hover:not(:focus-visible),
352
+ .top-link:hover:not(:focus-visible),
353
+ .panel a:hover:not(:focus-visible) {
354
+ outline: 1px solid CanvasText;
355
+ outline-offset: -1px;
356
+ }
357
+ }
358
+ `];
359
+ }
360
+ installLightStyles(e) {
361
+ super.installLightStyles(e), c(`${this.localName}-focus`, [k(this.localName)], {
362
+ root: e,
363
+ scope: !1,
364
+ layer: !1
365
+ });
366
+ }
367
+ connectedCallback() {
368
+ super.connectedCallback(), this.syncSource(), this.listenLocation(!0), this.listenOutside(this.open !== null && this.layout === "bar");
369
+ }
370
+ disconnectedCallback() {
371
+ super.disconnectedCallback(), this.observer?.disconnect(), this.listenOutside(!1), this.listenLocation(!1);
372
+ }
373
+ locationTargets() {
374
+ let e = this.ownerDocument.defaultView;
375
+ if (!e) return [];
376
+ let t = e.navigation;
377
+ return [
378
+ {
379
+ target: e,
380
+ type: "popstate"
381
+ },
382
+ {
383
+ target: e,
384
+ type: "hashchange"
385
+ },
386
+ ...t ? [{
387
+ target: t,
388
+ type: "currententrychange"
389
+ }] : []
390
+ ];
391
+ }
392
+ listenLocation(e) {
393
+ if (e !== this.listeningLocation) {
394
+ this.listeningLocation = e;
395
+ for (let { target: t, type: n } of this.locationTargets()) e ? t.addEventListener(n, this.onLocationChange) : t.removeEventListener(n, this.onLocationChange);
396
+ }
397
+ }
398
+ warnOnce(e, t) {
399
+ this.warned.has(e) || (this.warned.add(e), console.warn(e === "invalid" ? `${this.localName}: ignoring invalid ${t} entries (each needs a label, and an href or links).` : `${this.localName}: ${t} nests deeper than two levels; the deeper links are shown in their group.`));
400
+ }
401
+ use(e, t) {
402
+ return e.invalid && this.warnOnce("invalid", t), e.flattened && this.warnOnce("flattened", t), e.items.length ? e.items : null;
403
+ }
404
+ adoptSource() {
405
+ let e = [...this.children].filter(T);
406
+ return e.length && !this.holder && (this.holder = document.createElement("div"), this.holder.hidden = !0, this.holder.className = "main-nav-source"), this.holder && (this.holder.append(...e), this.holder.parentNode !== this && this.append(this.holder)), this.holder ? [...this.holder.children] : [];
407
+ }
408
+ syncSource() {
409
+ let e = this.lightDom ? this.adoptSource() : [...this.children].filter(T), t = null;
410
+ if (e.length) {
411
+ let n = e.flatMap((e, t) => t === 0 ? _(e) : [{}]);
412
+ t = this.use(h(n), "slot=\"main-nav\"");
413
+ }
414
+ JSON.stringify(t) !== JSON.stringify(this.slotItems) && (this.slotItems = t), this.observer ??= new MutationObserver(() => this.syncSource()), this.observer.disconnect();
415
+ let n = {
416
+ attributes: !0,
417
+ attributeFilter: E,
418
+ characterData: !0,
419
+ childList: !0,
420
+ subtree: !0
421
+ };
422
+ this.lightDom ? (this.observer.observe(this, { childList: !0 }), this.holder && this.observer.observe(this.holder, n)) : this.observer.observe(this, n);
423
+ }
424
+ willUpdate(e) {
425
+ e.has("items") && (this.propItems = this.items == null ? null : this.use(h(this.items), "items")), e.has("itemsSrc") && this.fetchedFor !== this.itemsSrc && (this.fetched = null, this.fetchedFor = void 0);
426
+ let t = this.itemsSrc;
427
+ t && !this.slotItems && !this.propItems && this.fetchedFor !== t && (this.fetchedFor = t, x(t).then((e) => {
428
+ this.itemsSrc === t && (this.fetched = this.use(e, "items-src"));
429
+ }, (e) => {
430
+ this.itemsSrc === t && this.dispatchEvent(new CustomEvent("site-main-nav-error", {
431
+ detail: {
432
+ src: t,
433
+ message: e instanceof Error ? e.message : String(e)
434
+ },
435
+ bubbles: !0,
436
+ composed: !0
437
+ }));
438
+ }));
439
+ let n = JSON.stringify(this.shown);
440
+ this.shownKey !== void 0 && n !== this.shownKey && (this.open = null), this.shownKey = n;
441
+ }
442
+ updated(e) {
443
+ (e.has("open") || e.has("layout")) && this.listenOutside(this.isConnected && this.open !== null && this.layout === "bar");
444
+ }
445
+ get shown() {
446
+ return this.slotItems ?? this.propItems ?? this.fetched ?? S;
447
+ }
448
+ get navEl() {
449
+ return this.renderRoot.querySelector("nav.main-nav");
450
+ }
451
+ get tops() {
452
+ let e = this.navEl;
453
+ return e ? [...e.querySelectorAll(":scope > ul > li > :is(.toggle, .top-link)")] : [];
454
+ }
455
+ setOpen(e) {
456
+ this.open = e;
457
+ }
458
+ onToggle(e) {
459
+ let t = this.open !== e;
460
+ this.setOpen(t ? e : null);
461
+ let n = this.shown[e]?.label;
462
+ t && n && u(this, [
463
+ "site-main-nav",
464
+ "menu-open",
465
+ n
466
+ ]);
467
+ }
468
+ listenOutside(e) {
469
+ if (e === this.listening) return;
470
+ this.listening = e;
471
+ let t = this.ownerDocument;
472
+ e ? t.addEventListener("pointerdown", this.onOutsidePointer, !0) : t.removeEventListener("pointerdown", this.onOutsidePointer, !0);
473
+ }
474
+ onFocusOut(e) {
475
+ if (this.layout !== "bar" || this.open === null) return;
476
+ let t = e.relatedTarget;
477
+ t && !this.navEl?.contains(t) && this.setOpen(null);
478
+ }
479
+ move(e, t, n) {
480
+ let r;
481
+ switch (e.key) {
482
+ case "ArrowUp":
483
+ case "ArrowLeft":
484
+ r = Math.max(0, n - 1);
485
+ break;
486
+ case "ArrowDown":
487
+ case "ArrowRight":
488
+ r = Math.min(t.length - 1, n + 1);
489
+ break;
490
+ case "Home":
491
+ r = 0;
492
+ break;
493
+ case "End":
494
+ r = t.length - 1;
495
+ break;
496
+ default: return;
497
+ }
498
+ e.preventDefault(), t[r]?.focus();
499
+ }
500
+ onKeyDown(e) {
501
+ if (e.altKey || e.ctrlKey || e.metaKey) return;
502
+ let t = e.target, n = this.tops, r = n.indexOf(t), i = this.open, a = i === null ? null : this.toggleAt(i);
503
+ if (r >= 0) {
504
+ if (e.key === "Escape") {
505
+ if (i === null) return;
506
+ e.preventDefault(), this.setOpen(null);
507
+ } else e.key === "ArrowDown" && a === t ? (e.preventDefault(), this.panelOf(a)?.querySelector("a")?.focus()) : this.move(e, n, r);
508
+ return;
509
+ }
510
+ let o = t.closest(".panel");
511
+ if (!o || !a || this.panelOf(a) !== o) return;
512
+ if (e.key === "Escape") {
513
+ e.preventDefault(), this.setOpen(null), a.focus();
514
+ return;
515
+ }
516
+ let s = [...o.querySelectorAll("a")];
517
+ this.move(e, s, s.indexOf(t));
518
+ }
519
+ toggleAt(e) {
520
+ return this.navEl?.querySelector(`[aria-controls="${this.panelId(e)}"]`) ?? null;
521
+ }
522
+ panelOf(e) {
523
+ let t = e.nextElementSibling;
524
+ return t && t.id === e.getAttribute("aria-controls") ? t : null;
525
+ }
526
+ panelId(e) {
527
+ return `${this.idBase}-${e}`;
528
+ }
529
+ currentHref(e) {
530
+ let t = this.current || this.ownerDocument.defaultView?.location.href || "", n = this.ownerDocument.baseURI, r = A(t, n);
531
+ if (!r) return null;
532
+ let i = e.filter((e) => A(e, n) === r), a = j(t, n);
533
+ return i.find((e) => a && j(e, n) === a) ?? i.find((e) => !j(e, n)) ?? (a ? null : i[0]) ?? null;
534
+ }
535
+ resolve(e) {
536
+ return e.startsWith("#") ? e : f(this.rootLinkDomain, e);
537
+ }
538
+ onClick(e) {
539
+ this.open !== null && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.composedPath().some((e) => e instanceof Element && e.localName === "a") && this.setOpen(null));
540
+ }
541
+ render() {
542
+ let e = this.shown.map((e) => ({
543
+ label: e.label,
544
+ href: e.items ? void 0 : this.resolve(e.href),
545
+ items: e.items?.map((e) => ({
546
+ label: e.label,
547
+ href: this.resolve(e.href)
548
+ }))
549
+ })), t = e.flatMap((e) => e.items ? e.items.map((e) => e.href) : [e.href]), n = this.currentHref(t), i = (e) => e === n ? "page" : void 0, a = !1;
550
+ return r`<nav
551
+ class="main-nav ${this.layout === "accordion" ? "accordion" : "bar"}"
552
+ aria-label=${this.label}
553
+ @keydown=${this.onKeyDown}
554
+ @focusout=${this.onFocusOut}
555
+ @click=${this.onClick}
556
+ >
557
+ <ul>
558
+ ${e.map((e, t) => {
559
+ if (!e.items) {
560
+ let t = !a && i(e.href);
561
+ return t && (a = !0), r`<li>
562
+ <a class="top-link" href=${e.href} aria-current=${p(t || void 0)}
563
+ >${e.label}</a
564
+ >
565
+ </li>`;
566
+ }
567
+ let o = this.panelId(t), s = this.open === t, c = !a && e.items.some((e) => e.href === n), l = !1;
568
+ return c && (a = !0), r`<li>
569
+ <button
570
+ type="button"
571
+ class="toggle"
572
+ aria-expanded=${s ? "true" : "false"}
573
+ aria-controls=${o}
574
+ aria-current=${p(c ? "true" : void 0)}
575
+ @click=${() => this.onToggle(t)}
576
+ >
577
+ ${e.label}
578
+ </button>
579
+ <ul class="panel" id=${o} ?hidden=${!s}>
580
+ ${e.items.map((e) => {
581
+ let t = c && !l && e.href === n;
582
+ return t && (l = !0), r`<li>
583
+ <a href=${e.href} aria-current=${p(t ? "page" : void 0)}
584
+ >${e.label}</a
585
+ >
586
+ </li>`;
587
+ })}
588
+ </ul>
589
+ </li>`;
590
+ })}
591
+ </ul>
592
+ </nav>`;
593
+ }
594
+ };
595
+ // src/components/site-main-nav/site-main-nav.ts
596
+ a([e({ type: String })], M.prototype, "label", void 0), a([e({
597
+ type: String,
598
+ attribute: "root-link-domain"
599
+ })], M.prototype, "rootLinkDomain", void 0), a([e({
600
+ type: String,
601
+ attribute: "items-src"
602
+ })], M.prototype, "itemsSrc", void 0), a([e({ type: String })], M.prototype, "layout", void 0), a([e({ type: String })], M.prototype, "current", void 0), a([e({ attribute: !1 })], M.prototype, "items", void 0), a([n()], M.prototype, "slotItems", void 0), a([n()], M.prototype, "fetched", void 0), a([n()], M.prototype, "open", void 0), i("site-main-nav", M);
603
+ export { p as i, h as n, _ as r, M as t };
604
+
605
+ //# sourceMappingURL=site-main-nav-BLAAunnr.js.map