@uvalib/web-components 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/README.md +849 -47
- package/dist/analytics.d.ts +10 -0
- package/dist/analytics.js +9 -0
- package/dist/analytics.js.map +1 -0
- package/dist/base/UvalibElement.js +8 -5
- package/dist/base/UvalibElement.js.map +1 -1
- package/dist/base/analytics-state.d.ts +7 -0
- package/dist/base/analytics-state.js.map +1 -1
- package/dist/base/light-dom-styles.d.ts +13 -0
- package/dist/base/light-dom-styles.js +26 -0
- package/dist/base/light-dom-styles.js.map +1 -1
- package/dist/base/search-tracker.d.ts +57 -0
- package/dist/base/search-tracker.js +51 -0
- package/dist/base/search-tracker.js.map +1 -0
- package/dist/base.css +286 -14
- package/dist/base.d.ts +2 -0
- package/dist/base.js +1 -0
- package/dist/base.js.map +1 -1
- package/dist/components/site-analytics/SiteAnalytics.d.ts +20 -1
- package/dist/components/site-analytics/SiteAnalytics.js +93 -12
- package/dist/components/site-analytics/SiteAnalytics.js.map +1 -1
- package/dist/components/site-page/SitePage.d.ts +23 -0
- package/dist/components/site-page/SitePage.js +77 -0
- package/dist/components/site-page/SitePage.js.map +1 -1
- package/dist/components/uvalib-back-to-top/UvalibBackToTop.d.ts +58 -0
- package/dist/components/uvalib-back-to-top/UvalibBackToTop.js +250 -0
- package/dist/components/uvalib-back-to-top/UvalibBackToTop.js.map +1 -0
- package/dist/components/uvalib-back-to-top/uvalib-back-to-top.d.ts +1 -0
- package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js +4 -0
- package/dist/components/uvalib-back-to-top/uvalib-back-to-top.js.map +1 -0
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.d.ts +14 -0
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js +56 -4
- package/dist/components/uvalib-breadcrumbs/UvalibBreadcrumbs.js.map +1 -1
- package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +25 -3
- package/dist/components/uvalib-chip-group/UvalibChipGroup.js +80 -10
- package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -1
- package/dist/components/uvalib-combobox/UvalibCombobox.d.ts +212 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.js +1088 -0
- package/dist/components/uvalib-combobox/UvalibCombobox.js.map +1 -0
- package/dist/components/uvalib-combobox/uvalib-combobox.d.ts +1 -0
- package/dist/components/uvalib-combobox/uvalib-combobox.js +4 -0
- package/dist/components/uvalib-combobox/uvalib-combobox.js.map +1 -0
- package/dist/components/uvalib-contents/UvalibContents.d.ts +53 -0
- package/dist/components/uvalib-contents/UvalibContents.js +202 -3
- package/dist/components/uvalib-contents/UvalibContents.js.map +1 -1
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.d.ts +56 -17
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +285 -81
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -1
- package/dist/components/uvalib-date-range/UvalibDateRange.d.ts +6 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js +23 -0
- package/dist/components/uvalib-date-range/UvalibDateRange.js.map +1 -1
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.d.ts +113 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js +589 -0
- package/dist/components/uvalib-filter-drawer/UvalibFilterDrawer.js.map +1 -0
- package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.d.ts +1 -0
- package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js +4 -0
- package/dist/components/uvalib-filter-drawer/uvalib-filter-drawer.js.map +1 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +138 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js +689 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -0
- package/dist/components/uvalib-image-regions/regions.d.ts +57 -0
- package/dist/components/uvalib-image-regions/regions.js +117 -0
- package/dist/components/uvalib-image-regions/regions.js.map +1 -0
- package/dist/components/uvalib-image-regions/uvalib-image-regions.d.ts +1 -0
- package/dist/components/uvalib-image-regions/uvalib-image-regions.js +4 -0
- package/dist/components/uvalib-image-regions/uvalib-image-regions.js.map +1 -0
- package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +79 -0
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +295 -16
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
- package/dist/components/uvalib-map/UvalibMap.d.ts +251 -0
- package/dist/components/uvalib-map/UvalibMap.js +1395 -0
- package/dist/components/uvalib-map/UvalibMap.js.map +1 -0
- package/dist/components/uvalib-map/uvalib-map.d.ts +1 -0
- package/dist/components/uvalib-map/uvalib-map.js +4 -0
- package/dist/components/uvalib-map/uvalib-map.js.map +1 -0
- package/dist/components/uvalib-metadata/UvalibMetadata.d.ts +39 -2
- package/dist/components/uvalib-metadata/UvalibMetadata.js +214 -8
- package/dist/components/uvalib-metadata/UvalibMetadata.js.map +1 -1
- package/dist/components/uvalib-pager/UvalibPager.d.ts +22 -3
- package/dist/components/uvalib-pager/UvalibPager.js +42 -4
- package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
- package/dist/custom-elements.json +9641 -3131
- package/dist/index.d.ts +8 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/pagefind.css +4 -0
- package/dist/styles/base.js +119 -0
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/color-scheme.js +5 -0
- package/dist/styles/color-scheme.js.map +1 -1
- package/dist/styles/controls.js +6 -0
- package/dist/styles/controls.js.map +1 -1
- package/dist/styles/hidden.d.ts +2 -0
- package/dist/styles/hidden.js +51 -0
- package/dist/styles/hidden.js.map +1 -0
- package/dist/styles/message.d.ts +1 -0
- package/dist/styles/message.js +82 -0
- package/dist/styles/message.js.map +1 -0
- package/dist/styles/pagefind.js +4 -0
- package/dist/styles/pagefind.js.map +1 -1
- package/dist/styles/result-list.d.ts +1 -0
- package/dist/styles/result-list.js +111 -0
- package/dist/styles/result-list.js.map +1 -0
- package/dist/styles/results.js +0 -15
- package/dist/styles/results.js.map +1 -1
- package/dist/testing/index.d.ts +110 -0
- package/dist/testing/index.js +100 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/lighthouse-rules.d.ts +10 -0
- package/dist/testing/lighthouse-rules.js +44 -0
- package/dist/testing/lighthouse-rules.js.map +1 -0
- package/dist/tokens.css +5 -0
- package/dist-cdn/analytics.js +32 -0
- package/dist-cdn/analytics.js.map +1 -0
- package/dist-cdn/base.css +286 -14
- package/dist-cdn/bento-box.js +3 -3
- package/dist-cdn/chunks/{SiteAnalytics-Cm-FyhYS.js → SiteAnalytics-B9gu5aGO.js} +59 -30
- package/dist-cdn/chunks/SiteAnalytics-B9gu5aGO.js.map +1 -0
- package/dist-cdn/chunks/{UvalibElement-BnI-eRRR.js → UvalibElement-pGONDAwB.js} +108 -101
- package/dist-cdn/chunks/UvalibElement-pGONDAwB.js.map +1 -0
- package/dist-cdn/chunks/{accessible-GqhVn5_H.js → accessible-DJv7YOtS.js} +2 -2
- package/dist-cdn/chunks/{accessible-GqhVn5_H.js.map → accessible-DJv7YOtS.js.map} +1 -1
- package/dist-cdn/chunks/analytics-state-Ce8DKe4F.js.map +1 -1
- package/dist-cdn/chunks/{base-p5pk0vb2.js → base-BI8h0Gf3.js} +121 -2
- package/dist-cdn/chunks/base-BI8h0Gf3.js.map +1 -0
- package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js → library-weekly-hours-CrV3TlP5.js} +3 -3
- package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js.map → library-weekly-hours-CrV3TlP5.js.map} +1 -1
- package/dist-cdn/chunks/regions-B8ExwUGP.js +86 -0
- package/dist-cdn/chunks/regions-B8ExwUGP.js.map +1 -0
- package/dist-cdn/chunks/{repeat-CIFUYkyh.js → repeat-m5Zd_QeP.js} +2 -2
- package/dist-cdn/chunks/{repeat-CIFUYkyh.js.map → repeat-m5Zd_QeP.js.map} +1 -1
- package/dist-cdn/chunks/{site-header-BlOYvQg1.js → site-header-DYRMpdBj.js} +9 -4
- package/dist-cdn/chunks/{site-header-BlOYvQg1.js.map → site-header-DYRMpdBj.js.map} +1 -1
- package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js → site-main-nav-DURrQMal.js} +3 -3
- package/dist-cdn/chunks/{site-main-nav-AaxZ9rQf.js.map → site-main-nav-DURrQMal.js.map} +1 -1
- package/dist-cdn/chunks/{static-html-1mTAG6nS.js → static-html-C1rhtCHu.js} +2 -2
- package/dist-cdn/chunks/{static-html-1mTAG6nS.js.map → static-html-C1rhtCHu.js.map} +1 -1
- package/dist-cdn/custom-elements.json +9641 -3131
- package/dist-cdn/events-section.js +3 -3
- package/dist-cdn/library-hours-setup.js +2 -2
- package/dist-cdn/library-weekly-hours.js +1 -1
- package/dist-cdn/manifest.json +10 -2
- package/dist-cdn/pagefind.css +4 -0
- package/dist-cdn/site-alerts.js +4 -4
- package/dist-cdn/site-analytics.js +2 -2
- package/dist-cdn/site-footer.js +2 -2
- package/dist-cdn/site-header.js +1 -1
- package/dist-cdn/site-hours-section.js +4 -4
- package/dist-cdn/site-main-nav.js +1 -1
- package/dist-cdn/site-page.js +56 -11
- package/dist-cdn/site-page.js.map +1 -1
- package/dist-cdn/site-style.js +2 -2
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +98 -13
- package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +302 -14
- package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +1 -1
- package/dist-cdn/tokens.css +5 -0
- package/dist-cdn/uvalib-analytics.js +2 -2
- package/dist-cdn/uvalib-back-to-top.js +156 -0
- package/dist-cdn/uvalib-back-to-top.js.map +1 -0
- package/dist-cdn/uvalib-breadcrumbs.js +31 -11
- package/dist-cdn/uvalib-breadcrumbs.js.map +1 -1
- package/dist-cdn/uvalib-card-grid.js +1 -1
- package/dist-cdn/uvalib-card.js +3 -3
- package/dist-cdn/uvalib-chip-group.js +53 -14
- package/dist-cdn/uvalib-chip-group.js.map +1 -1
- package/dist-cdn/uvalib-combobox.js +667 -0
- package/dist-cdn/uvalib-combobox.js.map +1 -0
- package/dist-cdn/uvalib-contents.js +100 -22
- package/dist-cdn/uvalib-contents.js.map +1 -1
- package/dist-cdn/uvalib-date-histogram.js +237 -127
- package/dist-cdn/uvalib-date-histogram.js.map +1 -1
- package/dist-cdn/uvalib-date-range.js +14 -2
- package/dist-cdn/uvalib-date-range.js.map +1 -1
- package/dist-cdn/uvalib-filter-drawer.js +355 -0
- package/dist-cdn/uvalib-filter-drawer.js.map +1 -0
- package/dist-cdn/uvalib-filter.js +3 -3
- package/dist-cdn/uvalib-image-regions.js +460 -0
- package/dist-cdn/uvalib-image-regions.js.map +1 -0
- package/dist-cdn/uvalib-lightbox.js +214 -59
- package/dist-cdn/uvalib-lightbox.js.map +1 -1
- package/dist-cdn/uvalib-map.js +667 -0
- package/dist-cdn/uvalib-map.js.map +1 -0
- package/dist-cdn/uvalib-metadata.js +150 -24
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/dist-cdn/uvalib-pager.js +29 -17
- package/dist-cdn/uvalib-pager.js.map +1 -1
- package/dist-cdn/uvalib-photo-grid.js +2 -2
- package/dist-cdn/uvalib-results-count.js +2 -2
- package/dist-cdn/uvalib-tabs.js +2 -2
- package/dist-cdn/uvalib-tag-list.js +2 -2
- package/package.json +43 -1
- package/skills/uvalib-web-components/SKILL.md +98 -13
- package/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
- package/skills/uvalib-web-components/reference/components.md +302 -14
- package/skills/uvalib-web-components/reference/snippets.md +1 -1
- package/dist-cdn/chunks/SiteAnalytics-Cm-FyhYS.js.map +0 -1
- package/dist-cdn/chunks/UvalibElement-BnI-eRRR.js.map +0 -1
- package/dist-cdn/chunks/base-p5pk0vb2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics-state-Ce8DKe4F.js","names":["STATE","analyticsState","w","ANALYTICS_EVENTS","f","bufferAnalytics","kept","keep","t","stop","type"],"sources":["../../src/base/analytics-state.ts"],"sourcesContent":["/**\n * The state the analytics elements share, and site-page's buffer for events fired while their\n * code loads. Kept apart from the `track*` helpers (`analytics.ts`), which every component\n * imports, so the components do not carry it.\n */\n\n/** One analytics element on the page, as the shared state sees it. */\nexport interface AnalyticsTracker {\n /** Has no Matomo site id: it neither loads Matomo nor forwards events. */\n off: boolean;\n}\n\n/**\n * State shared by every analytics element on the page, whichever tag, and whichever copy of\n * the bundle defined it (an npm build and a CDN script, or two CDN versions): `Symbol.for`\n * gives every copy the same key. Keep its shape stable across versions.\n */\nexport interface AnalyticsState {\n /** Connected elements, in connection order; the first one not `off` forwards events. */\n trackers: AnalyticsTracker[];\n /** Matomo is set up on the page (by an element, or by a snippet found there first). */\n booted: boolean;\n /** `spa=\"auto\"`: the URL of the last page view, so a route change to it is not counted again. */\n pageUrl?: string;\n}\n\nconst STATE = Symbol.for('@uvalib/web-components/analytics');\n\n/** The page's shared analytics state. */\nexport function analyticsState(): AnalyticsState {\n const w = window as unknown as Record<symbol, AnalyticsState | undefined>;\n return (w[STATE] ??= { trackers: [], booted: false });\n}\n\n/** Every event type the analytics elements listen for, in both families. */\nexport const ANALYTICS_EVENTS = ['uvalib-analytics', 'site-analytics'].flatMap((f) =>\n ['event', 'search', 'pageview', 'content'].map((t) => `${f}-${t}`),\n);\n\n/**\n * Keep the analytics events fired while no element forwards them (an element's code is still\n * loading), to hand over once one does. `flush()` fires them again on `doc`; `drop()` forgets\n * them. Either one stops the buffering.\n */\nexport function bufferAnalytics(doc: Document): { flush(): void; drop(): void } {\n const kept: { type: string; detail: unknown }[] = [];\n const keep = (e: Event) => {\n if (analyticsState().trackers.some((t) => !t.off)) return; // someone forwards it\n kept.push({ type: e.type, detail: (e as CustomEvent).detail });\n };\n for (const t of ANALYTICS_EVENTS) doc.addEventListener(t, keep);\n const stop = () => {\n for (const t of ANALYTICS_EVENTS) doc.removeEventListener(t, keep);\n };\n return {\n flush() {\n stop();\n for (const { type, detail } of kept.splice(0))\n doc.dispatchEvent(new CustomEvent(type, { detail }));\n },\n drop() {\n stop();\n kept.length = 0;\n },\n };\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"analytics-state-Ce8DKe4F.js","names":["STATE","analyticsState","w","ANALYTICS_EVENTS","f","bufferAnalytics","kept","keep","t","stop","type"],"sources":["../../src/base/analytics-state.ts"],"sourcesContent":["/**\n * The state the analytics elements share, and site-page's buffer for events fired while their\n * code loads. Kept apart from the `track*` helpers (`analytics.ts`), which every component\n * imports, so the components do not carry it.\n */\n\n/** One analytics element on the page, as the shared state sees it. */\nexport interface AnalyticsTracker {\n /** Has no Matomo site id: it neither loads Matomo nor forwards events. */\n off: boolean;\n}\n\n/**\n * State shared by every analytics element on the page, whichever tag, and whichever copy of\n * the bundle defined it (an npm build and a CDN script, or two CDN versions): `Symbol.for`\n * gives every copy the same key. Keep its shape stable across versions.\n */\nexport interface AnalyticsState {\n /** Connected elements, in connection order; the first one not `off` forwards events. */\n trackers: AnalyticsTracker[];\n /** Matomo is set up on the page (by an element, or by a snippet found there first). */\n booted: boolean;\n /** `spa=\"auto\"`: the URL of the last page view, so a route change to it is not counted again. */\n pageUrl?: string;\n /**\n * `downloads=\"event\"`: Matomo's link tracking is off, downloads are sent as `download`\n * events, and (`outlinks`) clicks on links to other sites are sent with `trackLink`.\n */\n downloads?: 'event';\n /** With `downloads`: this library sends the outlinks Matomo's link tracking would have. */\n outlinks?: boolean;\n}\n\nconst STATE = Symbol.for('@uvalib/web-components/analytics');\n\n/** The page's shared analytics state. */\nexport function analyticsState(): AnalyticsState {\n const w = window as unknown as Record<symbol, AnalyticsState | undefined>;\n return (w[STATE] ??= { trackers: [], booted: false });\n}\n\n/** Every event type the analytics elements listen for, in both families. */\nexport const ANALYTICS_EVENTS = ['uvalib-analytics', 'site-analytics'].flatMap((f) =>\n ['event', 'search', 'pageview', 'content'].map((t) => `${f}-${t}`),\n);\n\n/**\n * Keep the analytics events fired while no element forwards them (an element's code is still\n * loading), to hand over once one does. `flush()` fires them again on `doc`; `drop()` forgets\n * them. Either one stops the buffering.\n */\nexport function bufferAnalytics(doc: Document): { flush(): void; drop(): void } {\n const kept: { type: string; detail: unknown }[] = [];\n const keep = (e: Event) => {\n if (analyticsState().trackers.some((t) => !t.off)) return; // someone forwards it\n kept.push({ type: e.type, detail: (e as CustomEvent).detail });\n };\n for (const t of ANALYTICS_EVENTS) doc.addEventListener(t, keep);\n const stop = () => {\n for (const t of ANALYTICS_EVENTS) doc.removeEventListener(t, keep);\n };\n return {\n flush() {\n stop();\n for (const { type, detail } of kept.splice(0))\n doc.dispatchEvent(new CustomEvent(type, { detail }));\n },\n drop() {\n stop();\n kept.length = 0;\n },\n };\n}\n"],"mappings":";AAiCA,IAAMA,IAAQ,OAAO,IAAI,kCAAkC;AAG3D,SAAgBC,IAAiC;CAC/C,IAAMC,IAAI;CACV,OAAQ,EAAEF,OAAW;EAAE,UAAU,CAAC;EAAG,QAAQ;CAAM;AACrD;AAGA,IAAaG,IAAmB,CAAC,oBAAoB,gBAAgB,CAAC,CAAC,SAAS,MAC9E;CAAC;CAAS;CAAU;CAAY;AAAS,CAAC,CAAC,KAAK,MAAM,GAAGC,EAAE,GAAG,GAAG,CACnE;AAOA,SAAgBC,EAAgB,GAAgD;CAC9E,IAAMC,IAA4C,CAAC,GAC7CC,KAAQ,MAAa;EACzB,AAAIN,EAAe,CAAC,CAAC,SAAS,MAAM,MAAM,CAACO,EAAE,GAAG,KAChDF,EAAK,KAAK;GAAE,MAAM,EAAE;GAAM,QAAS,EAAkB;EAAO,CAAC;CAC/D;CACA,KAAK,IAAM,KAAKH,GAAkB,EAAI,iBAAiB,GAAGI,CAAI;CAC9D,IAAME,UAAa;EACjB,KAAK,IAAM,KAAKN,GAAkB,EAAI,oBAAoB,GAAGI,CAAI;CACnE;CACA,OAAO;EACL,QAAQ;GACN,EAAK;GACL,KAAK,IAAM,EAAE,SAAM,eAAYD,EAAK,OAAO,CAAC,GAC1C,EAAI,cAAc,IAAI,YAAYI,GAAM,EAAE,UAAO,CAAC,CAAC;EACvD;EACA,OAAO;GAEL,AADAD,EAAK,GACL,EAAK,SAAS;EAChB;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as e } from "./UvalibElement-
|
|
1
|
+
import { f as e } from "./UvalibElement-pGONDAwB.js";
|
|
2
2
|
// src/styles/tokens.ts
|
|
3
3
|
var t = e`
|
|
4
4
|
:root {
|
|
@@ -132,6 +132,10 @@ var t = e`
|
|
|
132
132
|
uvalib-chip-group[scroll]:not(:defined) {
|
|
133
133
|
min-height: calc(44px + 0.75rem);
|
|
134
134
|
}
|
|
135
|
+
/* A description: one line of it (0.875rem at 1.5, 0.25rem below the row). */
|
|
136
|
+
uvalib-chip-group[description]:not(:defined) {
|
|
137
|
+
padding-block-end: 1.5625rem;
|
|
138
|
+
}
|
|
135
139
|
/* Its text is drawn from attributes: hold one line until it upgrades. */
|
|
136
140
|
uvalib-results-count:not(:defined) {
|
|
137
141
|
display: block;
|
|
@@ -141,6 +145,26 @@ var t = e`
|
|
|
141
145
|
uvalib-results-count:not(:defined)[hidden] {
|
|
142
146
|
display: none;
|
|
143
147
|
}
|
|
148
|
+
/* The pre-upgrade rules here set display, which beats the hidden attribute's (issue #7).
|
|
149
|
+
More specific than each of them (two pseudo-classes or attributes), so it needs no importance flag. */
|
|
150
|
+
:where(
|
|
151
|
+
site-page,
|
|
152
|
+
uvalib-breadcrumbs,
|
|
153
|
+
uvalib-card,
|
|
154
|
+
uvalib-card-grid,
|
|
155
|
+
uvalib-pager,
|
|
156
|
+
uvalib-contents,
|
|
157
|
+
uvalib-metadata,
|
|
158
|
+
uvalib-chip-group,
|
|
159
|
+
uvalib-tabs,
|
|
160
|
+
uvalib-combobox,
|
|
161
|
+
uvalib-image-regions,
|
|
162
|
+
uvalib-map,
|
|
163
|
+
uvalib-filter-drawer
|
|
164
|
+
):not(:defined)[hidden],
|
|
165
|
+
:where(uvalib-combobox, uvalib-image-regions):not(:defined) > [hidden] {
|
|
166
|
+
display: none;
|
|
167
|
+
}
|
|
144
168
|
/* Tabs stay readable before the script runs: a block, one panel, and a gap the
|
|
145
169
|
size of the tab row (44px) plus its 1rem margin, so the first panel does not
|
|
146
170
|
jump when the element upgrades. Later data-tab panels stay hidden. */
|
|
@@ -151,6 +175,101 @@ var t = e`
|
|
|
151
175
|
uvalib-tabs:not(:defined) > [data-tab] ~ [data-tab] {
|
|
152
176
|
display: none;
|
|
153
177
|
}
|
|
178
|
+
/* A combobox: its label (from the attribute) and one 44px field (plus a one-line
|
|
179
|
+
description) held, so nothing moves when it upgrades. A fallback <input list> child
|
|
180
|
+
works meanwhile; the other children (options, a datalist) stay out of sight. */
|
|
181
|
+
uvalib-combobox:not(:defined) {
|
|
182
|
+
display: block;
|
|
183
|
+
min-block-size: calc(1.5em + 0.25rem + 44px);
|
|
184
|
+
line-height: 1.5;
|
|
185
|
+
}
|
|
186
|
+
uvalib-combobox[description]:not(:defined) {
|
|
187
|
+
min-block-size: calc(3em + 0.5rem + 44px);
|
|
188
|
+
}
|
|
189
|
+
uvalib-combobox:not(:defined)::before {
|
|
190
|
+
content: attr(label);
|
|
191
|
+
display: block;
|
|
192
|
+
margin-block-end: 0.25rem;
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
}
|
|
195
|
+
uvalib-combobox:not(:defined) > :not(input) {
|
|
196
|
+
display: none;
|
|
197
|
+
}
|
|
198
|
+
uvalib-combobox:not(:defined) > input {
|
|
199
|
+
display: block;
|
|
200
|
+
box-sizing: border-box;
|
|
201
|
+
inline-size: 100%;
|
|
202
|
+
min-block-size: 44px;
|
|
203
|
+
font: inherit;
|
|
204
|
+
line-height: 1.2;
|
|
205
|
+
}
|
|
206
|
+
/* Image regions: the image at its own width and the list beside it (or under it), the
|
|
207
|
+
layout the element keeps once it upgrades, so the image does not move. */
|
|
208
|
+
uvalib-image-regions:not(:defined) {
|
|
209
|
+
display: flex;
|
|
210
|
+
flex-wrap: wrap;
|
|
211
|
+
gap: 1rem;
|
|
212
|
+
align-items: flex-start;
|
|
213
|
+
}
|
|
214
|
+
uvalib-image-regions:not(:defined) > :is(img, picture) {
|
|
215
|
+
display: block;
|
|
216
|
+
flex: 0 1 auto;
|
|
217
|
+
min-width: 0;
|
|
218
|
+
max-width: 100%;
|
|
219
|
+
height: auto;
|
|
220
|
+
}
|
|
221
|
+
uvalib-image-regions:not(:defined) > :is(ol, ul) {
|
|
222
|
+
flex: 1 1 14rem;
|
|
223
|
+
min-width: 0;
|
|
224
|
+
}
|
|
225
|
+
/* A map: its key instructions (the same text it shows) and the map's height held above
|
|
226
|
+
the child list, so the list does not move when the map is drawn over the page's
|
|
227
|
+
Leaflet. Padding, not margin, so it cannot collapse with the list's own top margin. */
|
|
228
|
+
uvalib-map:not(:defined) {
|
|
229
|
+
display: block;
|
|
230
|
+
}
|
|
231
|
+
uvalib-map:not(:defined)::before {
|
|
232
|
+
content: 'Tab or arrow keys move between places; Enter opens one. With the map focused, arrow keys pan and + and − zoom.';
|
|
233
|
+
display: block;
|
|
234
|
+
padding-block-end: calc(0.5rem + max(12rem, var(--uvalib-map-height, min(24rem, 75vw))));
|
|
235
|
+
font-size: 0.875rem;
|
|
236
|
+
line-height: 1.5;
|
|
237
|
+
color: var(--uva-color-text-muted, #4b5563);
|
|
238
|
+
}
|
|
239
|
+
/* A filter drawer on a phone (the default 48rem breakpoint): once it upgrades only its 44px
|
|
240
|
+
"Search and filters" button shows, so hold that height and keep the form and filters out
|
|
241
|
+
of sight meanwhile; nothing moves when it upgrades. A page with its own breakpoint adds the
|
|
242
|
+
same two rules in a media query of that width (see the README). Low specificity, so the
|
|
243
|
+
[hidden] rule above still wins. */
|
|
244
|
+
@media (max-width: 48rem) {
|
|
245
|
+
:where(uvalib-filter-drawer:not([breakpoint])):not(:defined) {
|
|
246
|
+
display: block;
|
|
247
|
+
min-block-size: 44px;
|
|
248
|
+
}
|
|
249
|
+
:where(uvalib-filter-drawer:not([breakpoint])):not(:defined) > * {
|
|
250
|
+
display: none;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/* Printing a <site-page> (issue #20; its own styles leave out the chrome): a dark scheme
|
|
254
|
+
prints light (the role tokens resolve to their light values), and the content's links
|
|
255
|
+
are black and underlined, so they are told apart without colour. Content is <main> in
|
|
256
|
+
light DOM and the unslotted children in shadow DOM. print-chrome keeps the page as it is
|
|
257
|
+
shown, apart from the light scheme. */
|
|
258
|
+
@media print {
|
|
259
|
+
:root[data-uva-color-scheme]:has(site-page) {
|
|
260
|
+
color-scheme: light;
|
|
261
|
+
--uva-color-scheme: light;
|
|
262
|
+
}
|
|
263
|
+
/* Light DOM's trail, here too, as the pre-upgrade rule above (unlayered) would win. */
|
|
264
|
+
site-page:not([print-chrome]) > [slot='breadcrumbs'] {
|
|
265
|
+
display: none;
|
|
266
|
+
}
|
|
267
|
+
site-page:not([print-chrome]) > :not([slot], site-header, site-footer, .alerts-list) :any-link,
|
|
268
|
+
site-page:not([print-chrome]) > :any-link:not([slot], .skip-link) {
|
|
269
|
+
color: #000;
|
|
270
|
+
text-decoration: underline;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
154
273
|
@keyframes uvalib-site-page-reveal {
|
|
155
274
|
to {
|
|
156
275
|
visibility: visible;
|
|
@@ -159,4 +278,4 @@ var t = e`
|
|
|
159
278
|
`;
|
|
160
279
|
export { r as n, t as r, n as t };
|
|
161
280
|
|
|
162
|
-
//# sourceMappingURL=base-
|
|
281
|
+
//# sourceMappingURL=base-BI8h0Gf3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-BI8h0Gf3.js","names":["i","tokens","TYPEKIT_URL","base"],"sources":["../../src/styles/tokens.ts","../../src/styles/base.ts"],"sourcesContent":["// GENERATED by scripts/sync-tokens.mjs from ../monorepo/packages/drupal_library_theme/src/scss/base — do not edit\nimport { css } from 'lit';\n\nexport const tokens = css`\n :root {\n --uva-brand-blue-lightest: #87B9D9;\n --uva-brand-blue-lighter: #3395D4;\n --uva-brand-blue-light: #0370B7;\n --uva-brand-blue-base: #232D4B;\n --uva-brand-blue-300: #87B9D9;\n --uva-brand-blue-200: #3395D4;\n --uva-brand-blue-100: #0370B7;\n --uva-brand-blue: #232D4B;\n --uva-brand-orange-lightest: #FFEAD6;\n --uva-brand-orange-lighter: #FFC999;\n --uva-brand-orange-light: #FFB370;\n --uva-brand-orange-base: #E57200;\n --uva-brand-orange-dark: #B35900;\n --uva-brand-orange-darker: #854200;\n --uva-brand-orange-300: #FFEAD6;\n --uva-brand-orange-200: #FFC999;\n --uva-brand-orange-100: #FFB370;\n --uva-brand-orange: #E57200;\n --uva-brand-orange-A: #B35900;\n --uva-brand-orange-B: #854200;\n --uva-blue-alt-lightest: #BFE7F7;\n --uva-blue-alt-lighter: #91D8F2;\n --uva-blue-alt-light: #55C4EC;\n --uva-blue-alt-base: #007BAC;\n --uva-blue-alt-dark: #005679;\n --uva-blue-alt-darkest: #141E3C;\n --uva-blue-alt-400: #e6f2f7;\n --uva-blue-alt-300: #BFE7F7;\n --uva-blue-alt-200: #91D8F2;\n --uva-blue-alt-100: #55C4EC;\n --uva-blue-alt: #007BAC;\n --uva-blue-alt-A: #005679;\n --uva-blue-alt-B: #141E3C;\n --uva-teal-lightest: #C8F2F4;\n --uva-teal-light: #5BD7DE;\n --uva-teal-base: #25CAD3;\n --uva-teal-dark: #1DA1A8;\n --uva-teal-darker: #16777C;\n --uva-teal-200: #C8F2F4;\n --uva-teal-100: #5BD7DE;\n --uva-teal: #25CAD3;\n --uva-teal-A: #1DA1A8;\n --uva-teal-B: #16777C;\n --uva-green-lightest: #DDEFDC;\n --uva-green-lighter: #89CC74;\n --uva-green-base: #62BB46;\n --uva-green-dark: #4E9737;\n --uva-green-200: #DDEFDC;\n --uva-green-100: #89CC74;\n --uva-green: #62BB46;\n --uva-green-A: #4E9737;\n --uva-red-lightest: #FBCFDA;\n --uva-red-base: #EF3F6B;\n --uva-red-dark: #DF1E43;\n --uva-red-darker: #B30000;\n --uva-red-100: #FBCFDA;\n --uva-red: #EF3F6B;\n --uva-red-A: #DF1E43;\n --uva-red-B: #B30000;\n --uva-yellow-lightest: #FEF6C8;\n --uva-yellow-base: #ECC602;\n --uva-yellow-dark: #B99C02;\n --uva-yellow-100: #FEF6C8;\n --uva-yellow: #ECC602;\n --uva-yellow-A: #B99C02;\n --uva-grey-lightest: #F1F1F1;\n --uva-grey-light: #DADADA;\n --uva-grey-base: #808080;\n --uva-grey-dark: #4F4F4F;\n --uva-grey-darkest: #2B2B2B;\n --uva-grey-200: #F1F1F1;\n --uva-grey-100: #DADADA;\n --uva-grey-50: #ADADAD;\n --uva-grey: #808080;\n --uva-grey-A: #4F4F4F;\n --uva-grey-B: #2B2B2B;\n --uva-font-family: franklin-gothic-urw, Arial, Helvetica, sans-serif;\n --uva-font-size-base: 17px;\n }\n`;\n","import { css } from 'lit';\n\nexport const TYPEKIT_URL = 'https://use.typekit.net/oym8nvz.css';\n\n// The body background has no fallback: without dark mode it stays transparent, as before.\n//\n// site-page:not(:defined) applies when base.css is linked in <head>, before the element\n// upgrades: its own formatting context (flow-root), so a heading's top margin cannot collapse\n// through to <body> and shift the page once the element upgrades, and invisible, so its\n// content does not paint above where the header will go. If the script never loads, the\n// content appears anyway after two seconds.\nexport const base = css`\n *,\n *::before,\n *::after {\n box-sizing: border-box;\n }\n html,\n body {\n font-family: var(--uva-font-family, franklin-gothic-urw, Arial, Helvetica, sans-serif);\n }\n html {\n font-size: var(--uva-font-size-base, 17px);\n }\n body {\n margin: 0;\n line-height: 1.5;\n min-height: 100vh;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n background-color: var(--uva-color-surface);\n }\n site-page:not(:defined) {\n display: flow-root;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-breadcrumbs:not(:defined),\n uvalib-card:not(:defined),\n uvalib-card-grid:not(:defined),\n uvalib-pager:not(:defined),\n uvalib-contents:not(:defined),\n uvalib-metadata:not(:defined),\n uvalib-tag-list:not(:defined) {\n display: block;\n line-height: 1.5;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n /* A chip row: hidden, one 44px row tall (with the scrolling row's padding), the raw\n children kept on one line so they cannot make it taller. */\n uvalib-chip-group:not(:defined) {\n display: block;\n min-height: 44px;\n max-width: 100%;\n overflow: hidden;\n white-space: nowrap;\n visibility: hidden;\n animation: uvalib-site-page-reveal 0s 2s forwards;\n }\n uvalib-chip-group[scroll]:not(:defined) {\n min-height: calc(44px + 0.75rem);\n }\n /* A description: one line of it (0.875rem at 1.5, 0.25rem below the row). */\n uvalib-chip-group[description]:not(:defined) {\n padding-block-end: 1.5625rem;\n }\n /* Its text is drawn from attributes: hold one line until it upgrades. */\n uvalib-results-count:not(:defined) {\n display: block;\n min-block-size: 1.5em;\n }\n uvalib-tag-list:not(:defined)[hidden],\n uvalib-results-count:not(:defined)[hidden] {\n display: none;\n }\n /* The pre-upgrade rules here set display, which beats the hidden attribute's (issue #7).\n More specific than each of them (two pseudo-classes or attributes), so it needs no importance flag. */\n :where(\n site-page,\n uvalib-breadcrumbs,\n uvalib-card,\n uvalib-card-grid,\n uvalib-pager,\n uvalib-contents,\n uvalib-metadata,\n uvalib-chip-group,\n uvalib-tabs,\n uvalib-combobox,\n uvalib-image-regions,\n uvalib-map,\n uvalib-filter-drawer\n ):not(:defined)[hidden],\n :where(uvalib-combobox, uvalib-image-regions):not(:defined) > [hidden] {\n display: none;\n }\n /* Tabs stay readable before the script runs: a block, one panel, and a gap the\n size of the tab row (44px) plus its 1rem margin, so the first panel does not\n jump when the element upgrades. Later data-tab panels stay hidden. */\n uvalib-tabs:not(:defined) {\n display: block;\n padding-block-start: calc(44px + 1rem);\n }\n uvalib-tabs:not(:defined) > [data-tab] ~ [data-tab] {\n display: none;\n }\n /* A combobox: its label (from the attribute) and one 44px field (plus a one-line\n description) held, so nothing moves when it upgrades. A fallback <input list> child\n works meanwhile; the other children (options, a datalist) stay out of sight. */\n uvalib-combobox:not(:defined) {\n display: block;\n min-block-size: calc(1.5em + 0.25rem + 44px);\n line-height: 1.5;\n }\n uvalib-combobox[description]:not(:defined) {\n min-block-size: calc(3em + 0.5rem + 44px);\n }\n uvalib-combobox:not(:defined)::before {\n content: attr(label);\n display: block;\n margin-block-end: 0.25rem;\n font-weight: 600;\n }\n uvalib-combobox:not(:defined) > :not(input) {\n display: none;\n }\n uvalib-combobox:not(:defined) > input {\n display: block;\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: 44px;\n font: inherit;\n line-height: 1.2;\n }\n /* Image regions: the image at its own width and the list beside it (or under it), the\n layout the element keeps once it upgrades, so the image does not move. */\n uvalib-image-regions:not(:defined) {\n display: flex;\n flex-wrap: wrap;\n gap: 1rem;\n align-items: flex-start;\n }\n uvalib-image-regions:not(:defined) > :is(img, picture) {\n display: block;\n flex: 0 1 auto;\n min-width: 0;\n max-width: 100%;\n height: auto;\n }\n uvalib-image-regions:not(:defined) > :is(ol, ul) {\n flex: 1 1 14rem;\n min-width: 0;\n }\n /* A map: its key instructions (the same text it shows) and the map's height held above\n the child list, so the list does not move when the map is drawn over the page's\n Leaflet. Padding, not margin, so it cannot collapse with the list's own top margin. */\n uvalib-map:not(:defined) {\n display: block;\n }\n uvalib-map:not(:defined)::before {\n content: 'Tab or arrow keys move between places; Enter opens one. With the map focused, arrow keys pan and + and − zoom.';\n display: block;\n padding-block-end: calc(0.5rem + max(12rem, var(--uvalib-map-height, min(24rem, 75vw))));\n font-size: 0.875rem;\n line-height: 1.5;\n color: var(--uva-color-text-muted, #4b5563);\n }\n /* A filter drawer on a phone (the default 48rem breakpoint): once it upgrades only its 44px\n \"Search and filters\" button shows, so hold that height and keep the form and filters out\n of sight meanwhile; nothing moves when it upgrades. A page with its own breakpoint adds the\n same two rules in a media query of that width (see the README). Low specificity, so the\n [hidden] rule above still wins. */\n @media (max-width: 48rem) {\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) {\n display: block;\n min-block-size: 44px;\n }\n :where(uvalib-filter-drawer:not([breakpoint])):not(:defined) > * {\n display: none;\n }\n }\n /* Printing a <site-page> (issue #20; its own styles leave out the chrome): a dark scheme\n prints light (the role tokens resolve to their light values), and the content's links\n are black and underlined, so they are told apart without colour. Content is <main> in\n light DOM and the unslotted children in shadow DOM. print-chrome keeps the page as it is\n shown, apart from the light scheme. */\n @media print {\n :root[data-uva-color-scheme]:has(site-page) {\n color-scheme: light;\n --uva-color-scheme: light;\n }\n /* Light DOM's trail, here too, as the pre-upgrade rule above (unlayered) would win. */\n site-page:not([print-chrome]) > [slot='breadcrumbs'] {\n display: none;\n }\n site-page:not([print-chrome]) > :not([slot], site-header, site-footer, .alerts-list) :any-link,\n site-page:not([print-chrome]) > :any-link:not([slot], .skip-link) {\n color: #000;\n text-decoration: underline;\n }\n }\n @keyframes uvalib-site-page-reveal {\n to {\n visibility: visible;\n }\n }\n`;\n"],"mappings":";;AAGA,IAAaC,IAAS,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCDZC,IAAc,uCASdC,IAAO,CAAG"}
|
package/dist-cdn/chunks/{library-weekly-hours-COE7Vv6V.js → library-weekly-hours-CrV3TlP5.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-pGONDAwB.js";
|
|
2
2
|
import { a as u, i as d } from "./analytics-DTTihuBD.js";
|
|
3
3
|
import { t as f } from "./heading-level-DIuNS44-.js";
|
|
4
|
-
import { t as p } from "./accessible-
|
|
4
|
+
import { t as p } from "./accessible-DJv7YOtS.js";
|
|
5
5
|
import { r as m } from "./new-york-DkcnqvJ4.js";
|
|
6
6
|
import { a as h, c as g, d as _, f as v, h as y, i as b, m as x, n as S, o as C, r as w, s as T, t as E, u as D } from "./hours-data-Bw6vkIw7.js";
|
|
7
7
|
// src/components/library-weekly-hours/LibraryWeeklyHours.ts
|
|
@@ -352,4 +352,4 @@ a([e({
|
|
|
352
352
|
attribute: "headinglevelstart"
|
|
353
353
|
})], j.prototype, "headingLevelStart", void 0), a([n()], j.prototype, "inferredLevel", void 0), a([n()], j.prototype, "_state", void 0), a([n()], j.prototype, "today", void 0), a([n()], j.prototype, "view", void 0), a([n()], j.prototype, "pending", void 0), a([n()], j.prototype, "announcement", void 0), i("library-weekly-hours", j);
|
|
354
354
|
|
|
355
|
-
//# sourceMappingURL=library-weekly-hours-
|
|
355
|
+
//# sourceMappingURL=library-weekly-hours-CrV3TlP5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library-weekly-hours-COE7Vv6V.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","trackError","precedingHeadingLevel","accessible","todayInNewYork","hoursTiming","longDate","shortDate","shortWeekday","weekStart","hoursEndpoints","weekHeadingDate","formatDay","loadHours","fullDate","loadLibraries","addDays","setHoursEndpoints","instanceCounter","structuralRules","host","shadowStructure","LibraryWeeklyHours","_args","value","root","sheet","above","node","today","every","start","changed","id","announce","slug","days","background","libraries","library","l","spaces","ids","hours","maxAge","sameWeek","hadFocus","active","day","dates","calId","text","A","lib","cells","building","space","view","level","headingId","tableDays"],"sources":["../../src/components/library-weekly-hours/LibraryWeeklyHours.ts","../../src/components/library-weekly-hours/library-weekly-hours.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackError, trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport {\n addDays,\n formatDay,\n fullDate,\n hoursEndpoints,\n hoursTiming,\n setHoursEndpoints,\n loadHours,\n loadLibraries,\n longDate,\n shortDate,\n shortWeekday,\n todayInNewYork,\n weekHeadingDate,\n weekStart,\n type HoursByCalendar,\n type HoursEndpoints,\n type LibraryInfo,\n} from '../library-hours/hours-data.js';\n\n/** Element ids share the document id space in light DOM, so each instance gets its own prefix. */\nlet instanceCounter = 0;\n\n/** What the table shows: one week's data, kept on screen while the next week loads. */\ninterface WeekView {\n days: string[];\n library: LibraryInfo;\n spaces: LibraryInfo[];\n hours: HoursByCalendar;\n}\n\n/** `loading` until the first data arrives, then `ready`, or `error` when it cannot be loaded. */\nexport type HoursState = 'loading' | 'ready' | 'error';\n\n/**\n * The layout rules the week header and table need even with `no-style`: Drupal's /hours CSS\n * relies on them. `host` is `:host` (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host}[loading] { min-height: var(--library-weekly-hours-min-height, 0); }\n ${host} .hours-placeholder { visibility: hidden; }\n /* One line even when empty, so \"Loading hours…\" giving way to nothing moves nothing below. */\n ${host} .weekly-hours-status { min-height: 1.5em; min-height: 1lh; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .weekly-hours-header-section {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n text-align: center;\n }\n ${host} .weekly-hours-header-section div[role='heading'] { flex: 1; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/**\n * One library's opening hours for a week (Sunday to Saturday, in America/New_York): a\n * header with \"Previous week\" / \"Next week\" buttons and the date range, then a table with a\n * \"Building hours\" row and a row per space in the library. Data comes from the library\n * website's JSON:API (same origin) and LibCal, shared between all hours elements on a page.\n * Used on library.virginia.edu/hours through `<library-hours-setup>`.\n *\n * @tagname library-weekly-hours\n * @fires uvalib-analytics-event - For `<site-analytics>`: `['library-weekly-hours', 'week-change', 'next' | 'previous']` for the week buttons, and `['library-weekly-hours', 'error', 'hours-load']` once when the hours cannot be loaded. Bubbles and is composed.\n * @csspart building-hours - The \"Building hours\" table row (shadow mode).\n * @cssprop [--library-weekly-hours-min-height=0] - Height the element keeps during its first load (while it has the `loading` attribute, before any rows show), so content below does not jump when the hours arrive. Applies with `no-style` too. Pages can reserve the same height before the element upgrades with `library-weekly-hours:not(:defined) { display: block; min-height: … }`.\n * @cssprop [--uva-brand-orange=#e57200] - Border of today's column; focus ring colour.\n * @cssprop [--uva-brand-blue=#232d4b] - Header and button colour.\n * @cssprop --uva-color-border - Dark-mode role token: table cell borders (else #dadada).\n * @cssprop --uva-color-current - Dark-mode role token: today's column border (else `--uva-brand-orange`).\n * @cssprop --uva-color-link - Dark-mode role token: heading, button text and border (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: button background (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class LibraryWeeklyHours extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin-block: 1rem;\n }\n th,\n td {\n padding: 0.5rem;\n border: 1px solid var(--uva-color-border, #dadada);\n text-align: center;\n vertical-align: middle;\n }\n tbody th {\n text-align: start;\n }\n th.today,\n td.today {\n border-inline: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n th.today {\n border-block-start: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n .date-header-day {\n font-weight: bold;\n }\n tbody .date--mobile {\n display: none;\n }\n .uvalib-button {\n font: inherit;\n padding: 0.4rem 0.9rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n cursor: pointer;\n }\n .heading-h1,\n .heading-h2,\n .heading-h3,\n .heading-h4,\n .heading-h5,\n .heading-h6 {\n font-size: 1.25rem;\n font-weight: bold;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n `,\n ];\n\n /**\n * The data endpoints shared by all hours elements: `libraries` (the Drupal JSON:API URL,\n * relative by default) and `hours` (LibCal, with `{ids}`). Assigning an object (or setting\n * a key) changes them for every hours element from the next load on. To repoint before\n * elements already in the HTML start fetching, set `window.uvalibHoursEndpoints` before\n * the define script runs.\n */\n static get endpoints(): HoursEndpoints {\n return hoursEndpoints;\n }\n static set endpoints(value: Partial<HoursEndpoints>) {\n setHoursEndpoints(value);\n }\n\n /** The library's `field_slug` in Drupal (for example `clemons`). */\n @property({ type: String, attribute: 'library-slug' })\n librarySlug?: string;\n\n /** Which week to show: 0 is this week, 1 next week, -1 last week. Changed by the buttons. */\n @property({ type: Number, attribute: 'week-count', reflect: true })\n weekCount = 0;\n\n /** How often (ms) the current week's hours are fetched again. 0 turns it off. */\n @property({ type: Number, attribute: 'refresh-every' })\n refreshEvery = 600000;\n\n /** Hide the \"Building hours\" row (for a library whose building calendar is one of its spaces). */\n @property({ type: Boolean, attribute: 'hide-building-hours', reflect: true })\n hideBuildingHours = false;\n\n /**\n * `aria-level` (1–6) of the week heading, also its `heading-h<n>` class. Unset (the\n * default), the level is one below the nearest heading before the element in the page\n * (`aria-level` 3 under a library's `<h2>` on /hours), or 2 when there is none, and the\n * class stays `heading-h2`, the one the library website's CSS styles.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n /** Old name of `heading-level`, still accepted; `heading-level` wins. */\n @property({ type: Number, attribute: 'headinglevelstart' })\n headingLevelStart?: number;\n\n /** One below the nearest preceding heading, worked out on connect (see `level`). */\n @state() private inferredLevel = 2;\n\n /** `loading` (the default, until data arrives), `ready` or `error`. Read-only. */\n get state(): HoursState {\n return this._state;\n }\n\n @state() private _state: HoursState = 'loading';\n @state() private today = '';\n @state() private view?: WeekView;\n /**\n * During the first load, once the library list is in: the rows the table will have, so\n * placeholder rows can hold their height until the hours arrive.\n */\n @state() private pending?: Omit<WeekView, 'hours'>;\n @state() private announcement = '';\n\n private readonly uid = `library-weekly-hours-${++instanceCounter}`;\n private loadId = 0;\n /** Set by the week buttons and Retry: announce the result of the next load. */\n private userInitiated = false;\n private tickTimer?: ReturnType<typeof setInterval>;\n private refreshTimer?: ReturnType<typeof setInterval>;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? 2 : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n },\n );\n }\n this.today = todayInNewYork();\n clearInterval(this.tickTimer);\n this.tickTimer = setInterval(() => {\n const today = todayInNewYork();\n if (today !== this.today) this.today = today;\n else if (this._state === 'error') void this.load({ background: true });\n }, hoursTiming.tick);\n this.restartRefresh();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearInterval(this.tickTimer);\n clearInterval(this.refreshTimer);\n this.tickTimer = this.refreshTimer = undefined;\n }\n\n private restartRefresh() {\n clearInterval(this.refreshTimer);\n this.refreshTimer = undefined;\n const every = this.refreshEvery;\n if (!this.isConnected || !(every > 0)) return;\n this.refreshTimer = setInterval(() => {\n if (this.weekCount === 0 && this._state !== 'loading')\n void this.load({ background: true, maxAge: every / 2 });\n }, every);\n }\n\n /** The seven `YYYY-MM-DD` dates of the week shown. */\n private get days(): string[] {\n const start = addDays(weekStart(this.today), (Math.trunc(this.weekCount) || 0) * 7);\n return Array.from({ length: 7 }, (_, i) => addDays(start, i));\n }\n\n /** The level set by `heading-level` (or the old `headinglevelstart`), or null. */\n private get explicitLevel(): number | null {\n const n = Math.trunc(this.headingLevel ?? this.headingLevelStart ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : null;\n }\n\n /** The week heading's `aria-level`: as set, else inferred from the page on connect. */\n private get level(): number {\n return this.explicitLevel ?? this.inferredLevel;\n }\n\n /** The `heading-h<n>` class: as set, else `heading-h2` (what the library's CSS styles). */\n private get headingClass(): number {\n return this.explicitLevel ?? 2;\n }\n\n // A plain map: `today` is private, which PropertyValues<this> does not cover.\n protected override willUpdate(changed: Map<PropertyKey, unknown>) {\n if (!this.isConnected || !this.today) return;\n if (!this.hasUpdated || changed.has('librarySlug') || changed.has('weekCount')) {\n void this.load();\n } else if (changed.has('today')) {\n // The date rolled over: reload quietly. The same week keeps its rows on a failure.\n void this.load({ background: this.view?.days[0] === this.days[0] });\n }\n }\n\n protected override updated(changed: PropertyValues<this>) {\n // Only the first load, before any rows show, reserves --library-weekly-hours-min-height.\n this.toggleAttribute('loading', this._state === 'loading' && !this.view);\n // The first value is picked up by connectedCallback.\n if (changed.has('refreshEvery') && changed.get('refreshEvery') !== undefined)\n this.restartRefresh();\n }\n\n /**\n * Load the week shown. The previous rows stay on screen (the table is `aria-busy`) until\n * the new data lands. A `background` load (refresh, retry from the interval or a rollover\n * within the week) does not change the state to loading and, if it fails while rows for\n * the same week are shown, keeps them. Only user-initiated loads announce their result.\n */\n private async load({\n background = false,\n maxAge = Infinity,\n }: { background?: boolean; maxAge?: number } = {}) {\n const id = ++this.loadId;\n const announce = this.userInitiated;\n this.userInitiated = false;\n const slug = this.librarySlug;\n if (!slug) {\n this._state = 'ready';\n this.view = undefined;\n return;\n }\n const days = this.days;\n if (!background) {\n this._state = 'loading';\n this.announcement = '';\n }\n try {\n const libraries = await loadLibraries();\n const library = libraries.find((l) => l.slug === slug);\n if (!library) throw new Error(`no library with slug \"${slug}\"`);\n const spaces = libraries.filter((l) => l.parent === library.id);\n if (id === this.loadId && !this.view) this.pending = { days, library, spaces };\n const ids = [library, ...spaces]\n .map((l) => l.calId)\n .filter((n): n is number => n !== undefined);\n const hours = await loadHours(ids, days[0]!, days[6]!, maxAge);\n if (id !== this.loadId) return; // a newer load owns the element\n this.view = { days, library, spaces, hours };\n this.pending = undefined;\n this._state = 'ready';\n if (announce)\n this.announcement = `Showing hours for ${fullDate(days[0]!)} to ${fullDate(days[6]!)}`;\n } catch {\n if (id !== this.loadId) return;\n const sameWeek = this.view?.days[0] === days[0];\n if (background && sameWeek && this._state !== 'error') return;\n if (!sameWeek) this.view = undefined;\n this.pending = undefined;\n this._state = 'error';\n trackError(this, 'library-weekly-hours', 'hours-load');\n }\n }\n\n private retry() {\n this.userInitiated = true;\n const hadFocus = this.focusedInside();\n void this.load().then(() => {\n // The Retry button is gone once the hours load; keep keyboard focus in the element.\n if (hadFocus && this._state === 'ready' && !this.focusedInside())\n this.renderRoot\n .querySelector<HTMLButtonElement>('.weekly-hours-header-section button')\n ?.focus();\n });\n }\n\n private focusedInside(): boolean {\n const active =\n this.renderRoot instanceof ShadowRoot\n ? this.renderRoot.activeElement\n : document.activeElement;\n return !!active && (this.renderRoot as Node).contains(active) && active !== this;\n }\n\n private previousWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) - 1;\n trackEvent(this, ['library-weekly-hours', 'week-change', 'previous']);\n }\n\n private nextWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) + 1;\n trackEvent(this, ['library-weekly-hours', 'week-change', 'next']);\n }\n\n private renderMobileDate(day: string) {\n return html`<div class=\"date--mobile\">\n <div class=\"date-header-day\">${shortWeekday(day)}</div>\n <div class=\"date-header-month\">${shortDate(day)}</div>\n </div>`;\n }\n\n private renderCells(days: string[], hours: HoursByCalendar, calId: number | undefined) {\n const dates = calId === undefined ? undefined : hours.get(calId);\n return days.map((day) => {\n const text = formatDay(dates?.[day]);\n return html`<td\n aria-label=${text ? `${longDate(day)}: ${text}` : longDate(day)}\n class=${day === this.today ? 'today' : nothing}\n >\n ${this.renderMobileDate(day)}${text}\n </td>`;\n });\n }\n\n /**\n * The first load's rows before the hours arrive: the real row headers with invisible,\n * typical hours text in each cell, so the table already has its final height in whatever\n * font the page uses and nothing below it moves when the hours replace the placeholders.\n */\n private renderPlaceholderRows({ days, library: lib, spaces }: Omit<WeekView, 'hours'>) {\n const cells = () =>\n days.map(\n (day) =>\n html`<td class=${day === this.today ? 'today' : nothing}>\n ${this.renderMobileDate(day)}<span class=\"hours-placeholder\" aria-hidden=\"true\"\n >10am - 10pm</span\n >\n </td>`,\n );\n const building =\n !this.hideBuildingHours && lib.calId !== undefined\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\">Building hours</th>\n ${cells()}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\">\n <span class=${space.siteLink ? 'lib-space-link' : 'lib-space'}>${space.title}</span>\n </th>\n ${cells()}\n </tr>`,\n )}`;\n }\n\n private renderRows(view: WeekView | undefined) {\n if (!view) {\n if (this.pending) return this.renderPlaceholderRows(this.pending);\n // Before the library list is in: the Building hours row nearly every library has, so\n // only a library's extra spaces can still move what follows the table.\n if (this._state === 'loading' && !this.hideBuildingHours)\n return this.renderPlaceholderRows({\n days: this.days,\n library: { calId: 0 } as LibraryInfo,\n spaces: [],\n });\n return nothing;\n }\n const { days, library: lib, spaces, hours } = view;\n const building =\n !this.hideBuildingHours && lib.calId !== undefined && hours.has(lib.calId)\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\" aria-label=\"Building hours\">Building hours</th>\n ${this.renderCells(days, hours, lib.calId)}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\" aria-label=${space.title}>\n ${\n space.siteLink\n ? html`<a class=\"lib-space-link\" href=${space.siteLink}>${space.title}</a>`\n : html`<span class=\"lib-space\">${space.title}</span>`\n }\n </th>\n ${this.renderCells(days, hours, space.calId)}\n </tr>`,\n )}`;\n }\n\n private renderStatus() {\n // Only the first load says so; later loads keep the previous rows (aria-busy) quietly.\n if (this._state === 'loading') return this.view ? nothing : 'Loading hours…';\n if (this._state === 'error')\n return html`Hours are unavailable right now.\n <button type=\"button\" class=\"uvalib-button uvalib-button--basic\" @click=${this.retry}>\n Retry\n </button>`;\n return this.announcement\n ? html`<span class=\"visually-hidden\">${this.announcement}</span>`\n : nothing;\n }\n\n render() {\n if (!this.librarySlug || !this.today) return nothing;\n const days = this.days;\n const level = this.level;\n const headingId = `${this.uid}-heading`;\n // The table shows the data it has (the previous week while the next one loads).\n const tableDays = this.view?.days ?? days;\n return html`<div class=\"weekly-hours-header-section\">\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.previousWeek}\n >\n Previous week\n </button>\n <div\n class=\"heading-h${this.headingClass}\"\n role=\"heading\"\n aria-level=${level}\n id=${headingId}\n >\n ${weekHeadingDate(days[0]!)} - ${weekHeadingDate(days[6]!)}\n </div>\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.nextWeek}\n >\n Next week\n </button>\n </div>\n <table\n class=\"weekly-hours-body-section\"\n aria-busy=${this._state === 'loading' ? 'true' : nothing}\n >\n <colgroup>\n <col class=\"location-column\" />\n ${tableDays.map(() => html`<col />`)}\n <col />\n </colgroup>\n <thead>\n <tr>\n <th colspan=\"2\" scope=\"col\"><span class=\"visually-hidden\">Day</span></th>\n ${tableDays.map(\n (day) =>\n html`<th\n scope=\"col\"\n aria-label=${longDate(day)}\n aria-current=${day === this.today ? 'date' : nothing}\n class=${day === this.today ? 'today' : nothing}\n >\n <div class=\"date-header\">${this.renderMobileDate(day)}</div>\n </th>`,\n )}\n </tr>\n </thead>\n <tbody>\n ${this.renderRows(this.view)}\n </tbody>\n </table>\n <div class=\"weekly-hours-status\" role=\"status\">${this.renderStatus()}</div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { LibraryWeeklyHours } from './LibraryWeeklyHours.js';\n\ndefine('library-weekly-hours', LibraryWeeklyHours);\n"],"mappings":";;;;;;;AA4BA,IAAIgC,IAAkB,GAiBhBC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;IACLA,EAAK;;IAELA,EAAK;IACLA,EAAK,YAAYA,EAAK;IACtBA,EAAK;;;;;;;IAOLA,EAAK;IACLA,EAAK;;;;;;;;;;;GAYHC,IAAkBnC,EAAUiC,EAAgB,OAAO,CAAC,GAqB7CG,IAAb,cAAwCvB,EAAc;;EAuH5B,A,aA5CZ,KAAA,YAAA,GAIG,KAAA,eAAA,KAIK,KAAA,oBAAA,IAgBa,KAAA,gBAAA,GAOK,KAAA,SAAA,WACb,KAAA,QAAA,IAOO,KAAA,eAAA,IAET,KAAA,MAAA,wBAAwB,EAAEmB,KAChC,KAAA,SAAA,GAEO,KAAA,gBAAA;;;EAtHR,KAAA,SAAA;GACdf;GACAkB;GACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDL;;CASA,WAAW,YAA4B;EACrC,OAAOX;CACT;CACA,WAAW,UAAU,GAAgC;EACnD,EAAkBc,CAAK;CACzB;CAmCA,IAAI,QAAoB;EACtB,OAAO,KAAK;CACd;CAmBA,mBAAsE;EACpE,IAAMC,IAAO,MAAM,iBAAiB;EACpC,IAAIA,aAAgB,cAAc,KAAK,SAAS;GAC9C,IAAMC,IAAQL,EAAgB;GAC9B,AAAIK,M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KAAA,CAAA,GACNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,SAAA,KAAA,CAAA,GACNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,QAAA,KAAA,CAAA,GAKNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,WAAA,KAAA,CAAA,GACNlC,EAAA,CAAAE,EAAM,CAAA,GAAAgC,EAAA,WAAA,gBAAA,KAAA,CAAA,GC5MT3B,EAAO,wBAAwB2B,CAAkB"}
|
|
1
|
+
{"version":3,"file":"library-weekly-hours-CrV3TlP5.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","trackError","precedingHeadingLevel","accessible","todayInNewYork","hoursTiming","longDate","shortDate","shortWeekday","weekStart","hoursEndpoints","weekHeadingDate","formatDay","loadHours","fullDate","loadLibraries","addDays","setHoursEndpoints","instanceCounter","structuralRules","host","shadowStructure","LibraryWeeklyHours","_args","value","root","sheet","above","node","today","every","start","changed","id","announce","slug","days","background","libraries","library","l","spaces","ids","hours","maxAge","sameWeek","hadFocus","active","day","dates","calId","text","A","lib","cells","building","space","view","level","headingId","tableDays"],"sources":["../../src/components/library-weekly-hours/LibraryWeeklyHours.ts","../../src/components/library-weekly-hours/library-weekly-hours.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackError, trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { precedingHeadingLevel } from '../../base/heading-level.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\nimport {\n addDays,\n formatDay,\n fullDate,\n hoursEndpoints,\n hoursTiming,\n setHoursEndpoints,\n loadHours,\n loadLibraries,\n longDate,\n shortDate,\n shortWeekday,\n todayInNewYork,\n weekHeadingDate,\n weekStart,\n type HoursByCalendar,\n type HoursEndpoints,\n type LibraryInfo,\n} from '../library-hours/hours-data.js';\n\n/** Element ids share the document id space in light DOM, so each instance gets its own prefix. */\nlet instanceCounter = 0;\n\n/** What the table shows: one week's data, kept on screen while the next week loads. */\ninterface WeekView {\n days: string[];\n library: LibraryInfo;\n spaces: LibraryInfo[];\n hours: HoursByCalendar;\n}\n\n/** `loading` until the first data arrives, then `ready`, or `error` when it cannot be loaded. */\nexport type HoursState = 'loading' | 'ready' | 'error';\n\n/**\n * The layout rules the week header and table need even with `no-style`: Drupal's /hours CSS\n * relies on them. `host` is `:host` (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host}[loading] { min-height: var(--library-weekly-hours-min-height, 0); }\n ${host} .hours-placeholder { visibility: hidden; }\n /* One line even when empty, so \"Loading hours…\" giving way to nothing moves nothing below. */\n ${host} .weekly-hours-status { min-height: 1.5em; min-height: 1lh; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n ${host} .weekly-hours-header-section {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n text-align: center;\n }\n ${host} .weekly-hours-header-section div[role='heading'] { flex: 1; }\n ${host} .visually-hidden {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/**\n * One library's opening hours for a week (Sunday to Saturday, in America/New_York): a\n * header with \"Previous week\" / \"Next week\" buttons and the date range, then a table with a\n * \"Building hours\" row and a row per space in the library. Data comes from the library\n * website's JSON:API (same origin) and LibCal, shared between all hours elements on a page.\n * Used on library.virginia.edu/hours through `<library-hours-setup>`.\n *\n * @tagname library-weekly-hours\n * @fires uvalib-analytics-event - For `<site-analytics>`: `['library-weekly-hours', 'week-change', 'next' | 'previous']` for the week buttons, and `['library-weekly-hours', 'error', 'hours-load']` once when the hours cannot be loaded. Bubbles and is composed.\n * @csspart building-hours - The \"Building hours\" table row (shadow mode).\n * @cssprop [--library-weekly-hours-min-height=0] - Height the element keeps during its first load (while it has the `loading` attribute, before any rows show), so content below does not jump when the hours arrive. Applies with `no-style` too. Pages can reserve the same height before the element upgrades with `library-weekly-hours:not(:defined) { display: block; min-height: … }`.\n * @cssprop [--uva-brand-orange=#e57200] - Border of today's column; focus ring colour.\n * @cssprop [--uva-brand-blue=#232d4b] - Header and button colour.\n * @cssprop --uva-color-border - Dark-mode role token: table cell borders (else #dadada).\n * @cssprop --uva-color-current - Dark-mode role token: today's column border (else `--uva-brand-orange`).\n * @cssprop --uva-color-link - Dark-mode role token: heading, button text and border (else `--uva-brand-blue`).\n * @cssprop --uva-color-surface-raised - Dark-mode role token: button background (else #fff).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class LibraryWeeklyHours extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin-block: 1rem;\n }\n th,\n td {\n padding: 0.5rem;\n border: 1px solid var(--uva-color-border, #dadada);\n text-align: center;\n vertical-align: middle;\n }\n tbody th {\n text-align: start;\n }\n th.today,\n td.today {\n border-inline: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n th.today {\n border-block-start: 2px solid var(--uva-color-current, var(--uva-brand-orange, #e57200));\n }\n .date-header-day {\n font-weight: bold;\n }\n tbody .date--mobile {\n display: none;\n }\n .uvalib-button {\n font: inherit;\n padding: 0.4rem 0.9rem;\n border: 1px solid var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n border-radius: 0.3rem;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n cursor: pointer;\n }\n .heading-h1,\n .heading-h2,\n .heading-h3,\n .heading-h4,\n .heading-h5,\n .heading-h6 {\n font-size: 1.25rem;\n font-weight: bold;\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b));\n }\n `,\n ];\n\n /**\n * The data endpoints shared by all hours elements: `libraries` (the Drupal JSON:API URL,\n * relative by default) and `hours` (LibCal, with `{ids}`). Assigning an object (or setting\n * a key) changes them for every hours element from the next load on. To repoint before\n * elements already in the HTML start fetching, set `window.uvalibHoursEndpoints` before\n * the define script runs.\n */\n static get endpoints(): HoursEndpoints {\n return hoursEndpoints;\n }\n static set endpoints(value: Partial<HoursEndpoints>) {\n setHoursEndpoints(value);\n }\n\n /** The library's `field_slug` in Drupal (for example `clemons`). */\n @property({ type: String, attribute: 'library-slug' })\n librarySlug?: string;\n\n /** Which week to show: 0 is this week, 1 next week, -1 last week. Changed by the buttons. */\n @property({ type: Number, attribute: 'week-count', reflect: true })\n weekCount = 0;\n\n /** How often (ms) the current week's hours are fetched again. 0 turns it off. */\n @property({ type: Number, attribute: 'refresh-every' })\n refreshEvery = 600000;\n\n /** Hide the \"Building hours\" row (for a library whose building calendar is one of its spaces). */\n @property({ type: Boolean, attribute: 'hide-building-hours', reflect: true })\n hideBuildingHours = false;\n\n /**\n * `aria-level` (1–6) of the week heading, also its `heading-h<n>` class. Unset (the\n * default), the level is one below the nearest heading before the element in the page\n * (`aria-level` 3 under a library's `<h2>` on /hours), or 2 when there is none, and the\n * class stays `heading-h2`, the one the library website's CSS styles.\n */\n @property({ type: Number, attribute: 'heading-level' })\n headingLevel?: number;\n\n /** Old name of `heading-level`, still accepted; `heading-level` wins. */\n @property({ type: Number, attribute: 'headinglevelstart' })\n headingLevelStart?: number;\n\n /** One below the nearest preceding heading, worked out on connect (see `level`). */\n @state() private inferredLevel = 2;\n\n /** `loading` (the default, until data arrives), `ready` or `error`. Read-only. */\n get state(): HoursState {\n return this._state;\n }\n\n @state() private _state: HoursState = 'loading';\n @state() private today = '';\n @state() private view?: WeekView;\n /**\n * During the first load, once the library list is in: the rows the table will have, so\n * placeholder rows can hold their height until the hours arrive.\n */\n @state() private pending?: Omit<WeekView, 'hours'>;\n @state() private announcement = '';\n\n private readonly uid = `library-weekly-hours-${++instanceCounter}`;\n private loadId = 0;\n /** Set by the week buttons and Retry: announce the result of the next load. */\n private userInitiated = false;\n private tickTimer?: ReturnType<typeof setInterval>;\n private refreshTimer?: ReturnType<typeof setInterval>;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const above = precedingHeadingLevel(this);\n this.inferredLevel = above === null ? 2 : Math.min(above + 1, 6);\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\n `${this.localName}::structure`,\n unsafeCSS(structuralRules(this.localName)),\n {\n root: node instanceof ShadowRoot || node instanceof Document ? node : undefined,\n scope: false,\n },\n );\n }\n this.today = todayInNewYork();\n clearInterval(this.tickTimer);\n this.tickTimer = setInterval(() => {\n const today = todayInNewYork();\n if (today !== this.today) this.today = today;\n else if (this._state === 'error') void this.load({ background: true });\n }, hoursTiming.tick);\n this.restartRefresh();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n clearInterval(this.tickTimer);\n clearInterval(this.refreshTimer);\n this.tickTimer = this.refreshTimer = undefined;\n }\n\n private restartRefresh() {\n clearInterval(this.refreshTimer);\n this.refreshTimer = undefined;\n const every = this.refreshEvery;\n if (!this.isConnected || !(every > 0)) return;\n this.refreshTimer = setInterval(() => {\n if (this.weekCount === 0 && this._state !== 'loading')\n void this.load({ background: true, maxAge: every / 2 });\n }, every);\n }\n\n /** The seven `YYYY-MM-DD` dates of the week shown. */\n private get days(): string[] {\n const start = addDays(weekStart(this.today), (Math.trunc(this.weekCount) || 0) * 7);\n return Array.from({ length: 7 }, (_, i) => addDays(start, i));\n }\n\n /** The level set by `heading-level` (or the old `headinglevelstart`), or null. */\n private get explicitLevel(): number | null {\n const n = Math.trunc(this.headingLevel ?? this.headingLevelStart ?? Number.NaN);\n return n >= 1 && n <= 6 ? n : null;\n }\n\n /** The week heading's `aria-level`: as set, else inferred from the page on connect. */\n private get level(): number {\n return this.explicitLevel ?? this.inferredLevel;\n }\n\n /** The `heading-h<n>` class: as set, else `heading-h2` (what the library's CSS styles). */\n private get headingClass(): number {\n return this.explicitLevel ?? 2;\n }\n\n // A plain map: `today` is private, which PropertyValues<this> does not cover.\n protected override willUpdate(changed: Map<PropertyKey, unknown>) {\n if (!this.isConnected || !this.today) return;\n if (!this.hasUpdated || changed.has('librarySlug') || changed.has('weekCount')) {\n void this.load();\n } else if (changed.has('today')) {\n // The date rolled over: reload quietly. The same week keeps its rows on a failure.\n void this.load({ background: this.view?.days[0] === this.days[0] });\n }\n }\n\n protected override updated(changed: PropertyValues<this>) {\n // Only the first load, before any rows show, reserves --library-weekly-hours-min-height.\n this.toggleAttribute('loading', this._state === 'loading' && !this.view);\n // The first value is picked up by connectedCallback.\n if (changed.has('refreshEvery') && changed.get('refreshEvery') !== undefined)\n this.restartRefresh();\n }\n\n /**\n * Load the week shown. The previous rows stay on screen (the table is `aria-busy`) until\n * the new data lands. A `background` load (refresh, retry from the interval or a rollover\n * within the week) does not change the state to loading and, if it fails while rows for\n * the same week are shown, keeps them. Only user-initiated loads announce their result.\n */\n private async load({\n background = false,\n maxAge = Infinity,\n }: { background?: boolean; maxAge?: number } = {}) {\n const id = ++this.loadId;\n const announce = this.userInitiated;\n this.userInitiated = false;\n const slug = this.librarySlug;\n if (!slug) {\n this._state = 'ready';\n this.view = undefined;\n return;\n }\n const days = this.days;\n if (!background) {\n this._state = 'loading';\n this.announcement = '';\n }\n try {\n const libraries = await loadLibraries();\n const library = libraries.find((l) => l.slug === slug);\n if (!library) throw new Error(`no library with slug \"${slug}\"`);\n const spaces = libraries.filter((l) => l.parent === library.id);\n if (id === this.loadId && !this.view) this.pending = { days, library, spaces };\n const ids = [library, ...spaces]\n .map((l) => l.calId)\n .filter((n): n is number => n !== undefined);\n const hours = await loadHours(ids, days[0]!, days[6]!, maxAge);\n if (id !== this.loadId) return; // a newer load owns the element\n this.view = { days, library, spaces, hours };\n this.pending = undefined;\n this._state = 'ready';\n if (announce)\n this.announcement = `Showing hours for ${fullDate(days[0]!)} to ${fullDate(days[6]!)}`;\n } catch {\n if (id !== this.loadId) return;\n const sameWeek = this.view?.days[0] === days[0];\n if (background && sameWeek && this._state !== 'error') return;\n if (!sameWeek) this.view = undefined;\n this.pending = undefined;\n this._state = 'error';\n trackError(this, 'library-weekly-hours', 'hours-load');\n }\n }\n\n private retry() {\n this.userInitiated = true;\n const hadFocus = this.focusedInside();\n void this.load().then(() => {\n // The Retry button is gone once the hours load; keep keyboard focus in the element.\n if (hadFocus && this._state === 'ready' && !this.focusedInside())\n this.renderRoot\n .querySelector<HTMLButtonElement>('.weekly-hours-header-section button')\n ?.focus();\n });\n }\n\n private focusedInside(): boolean {\n const active =\n this.renderRoot instanceof ShadowRoot\n ? this.renderRoot.activeElement\n : document.activeElement;\n return !!active && (this.renderRoot as Node).contains(active) && active !== this;\n }\n\n private previousWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) - 1;\n trackEvent(this, ['library-weekly-hours', 'week-change', 'previous']);\n }\n\n private nextWeek() {\n this.userInitiated = true;\n this.weekCount = (Math.trunc(this.weekCount) || 0) + 1;\n trackEvent(this, ['library-weekly-hours', 'week-change', 'next']);\n }\n\n private renderMobileDate(day: string) {\n return html`<div class=\"date--mobile\">\n <div class=\"date-header-day\">${shortWeekday(day)}</div>\n <div class=\"date-header-month\">${shortDate(day)}</div>\n </div>`;\n }\n\n private renderCells(days: string[], hours: HoursByCalendar, calId: number | undefined) {\n const dates = calId === undefined ? undefined : hours.get(calId);\n return days.map((day) => {\n const text = formatDay(dates?.[day]);\n return html`<td\n aria-label=${text ? `${longDate(day)}: ${text}` : longDate(day)}\n class=${day === this.today ? 'today' : nothing}\n >\n ${this.renderMobileDate(day)}${text}\n </td>`;\n });\n }\n\n /**\n * The first load's rows before the hours arrive: the real row headers with invisible,\n * typical hours text in each cell, so the table already has its final height in whatever\n * font the page uses and nothing below it moves when the hours replace the placeholders.\n */\n private renderPlaceholderRows({ days, library: lib, spaces }: Omit<WeekView, 'hours'>) {\n const cells = () =>\n days.map(\n (day) =>\n html`<td class=${day === this.today ? 'today' : nothing}>\n ${this.renderMobileDate(day)}<span class=\"hours-placeholder\" aria-hidden=\"true\"\n >10am - 10pm</span\n >\n </td>`,\n );\n const building =\n !this.hideBuildingHours && lib.calId !== undefined\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\">Building hours</th>\n ${cells()}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\">\n <span class=${space.siteLink ? 'lib-space-link' : 'lib-space'}>${space.title}</span>\n </th>\n ${cells()}\n </tr>`,\n )}`;\n }\n\n private renderRows(view: WeekView | undefined) {\n if (!view) {\n if (this.pending) return this.renderPlaceholderRows(this.pending);\n // Before the library list is in: the Building hours row nearly every library has, so\n // only a library's extra spaces can still move what follows the table.\n if (this._state === 'loading' && !this.hideBuildingHours)\n return this.renderPlaceholderRows({\n days: this.days,\n library: { calId: 0 } as LibraryInfo,\n spaces: [],\n });\n return nothing;\n }\n const { days, library: lib, spaces, hours } = view;\n const building =\n !this.hideBuildingHours && lib.calId !== undefined && hours.has(lib.calId)\n ? html`<tr part=\"building-hours\">\n <th scope=\"row\" colspan=\"2\" aria-label=\"Building hours\">Building hours</th>\n ${this.renderCells(days, hours, lib.calId)}\n </tr>`\n : nothing;\n return html`${building}${spaces.map(\n (space) =>\n html`<tr>\n <th scope=\"row\" colspan=\"2\" aria-label=${space.title}>\n ${\n space.siteLink\n ? html`<a class=\"lib-space-link\" href=${space.siteLink}>${space.title}</a>`\n : html`<span class=\"lib-space\">${space.title}</span>`\n }\n </th>\n ${this.renderCells(days, hours, space.calId)}\n </tr>`,\n )}`;\n }\n\n private renderStatus() {\n // Only the first load says so; later loads keep the previous rows (aria-busy) quietly.\n if (this._state === 'loading') return this.view ? nothing : 'Loading hours…';\n if (this._state === 'error')\n return html`Hours are unavailable right now.\n <button type=\"button\" class=\"uvalib-button uvalib-button--basic\" @click=${this.retry}>\n Retry\n </button>`;\n return this.announcement\n ? html`<span class=\"visually-hidden\">${this.announcement}</span>`\n : nothing;\n }\n\n render() {\n if (!this.librarySlug || !this.today) return nothing;\n const days = this.days;\n const level = this.level;\n const headingId = `${this.uid}-heading`;\n // The table shows the data it has (the previous week while the next one loads).\n const tableDays = this.view?.days ?? days;\n return html`<div class=\"weekly-hours-header-section\">\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.previousWeek}\n >\n Previous week\n </button>\n <div\n class=\"heading-h${this.headingClass}\"\n role=\"heading\"\n aria-level=${level}\n id=${headingId}\n >\n ${weekHeadingDate(days[0]!)} - ${weekHeadingDate(days[6]!)}\n </div>\n <button\n type=\"button\"\n class=\"uvalib-button uvalib-button--basic\"\n aria-describedby=${headingId}\n @click=${this.nextWeek}\n >\n Next week\n </button>\n </div>\n <table\n class=\"weekly-hours-body-section\"\n aria-busy=${this._state === 'loading' ? 'true' : nothing}\n >\n <colgroup>\n <col class=\"location-column\" />\n ${tableDays.map(() => html`<col />`)}\n <col />\n </colgroup>\n <thead>\n <tr>\n <th colspan=\"2\" scope=\"col\"><span class=\"visually-hidden\">Day</span></th>\n ${tableDays.map(\n (day) =>\n html`<th\n scope=\"col\"\n aria-label=${longDate(day)}\n aria-current=${day === this.today ? 'date' : nothing}\n class=${day === this.today ? 'today' : nothing}\n >\n <div class=\"date-header\">${this.renderMobileDate(day)}</div>\n </th>`,\n )}\n </tr>\n </thead>\n <tbody>\n ${this.renderRows(this.view)}\n </tbody>\n </table>\n <div class=\"weekly-hours-status\" role=\"status\">${this.renderStatus()}</div>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { Lib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MT3B,EAAO,wBAAwB2B,CAAkB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// src/components/uvalib-image-regions/regions.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = String(e ?? "").trim(), n = t.lastIndexOf("xywh=");
|
|
4
|
+
n >= 0 && (t = t.slice(n + 5)), t = t.split("&")[0].trim();
|
|
5
|
+
let r = "px", i = /^(pixel|percent):/i.exec(t);
|
|
6
|
+
i && (r = i[1].toLowerCase() === "percent" ? "percent" : "px", t = t.slice(i[0].length));
|
|
7
|
+
let a = t.split(",");
|
|
8
|
+
if (a.length !== 4 || a.some((e) => !/^\s*\d+(\.\d+)?\s*$/.test(e))) return null;
|
|
9
|
+
let [o, s, c, l] = a.map(Number);
|
|
10
|
+
return c <= 0 || l <= 0 ? null : {
|
|
11
|
+
x: o,
|
|
12
|
+
y: s,
|
|
13
|
+
w: c,
|
|
14
|
+
h: l,
|
|
15
|
+
unit: r
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var t = (e) => String(e ?? "").replace(/\s+/g, " ").trim();
|
|
19
|
+
function n(n) {
|
|
20
|
+
if (!n || typeof n != "object") return null;
|
|
21
|
+
let r = n, i = t(r.label), a = null;
|
|
22
|
+
if (typeof r.xywh == "string") a = e(r.xywh);
|
|
23
|
+
else {
|
|
24
|
+
let e = [
|
|
25
|
+
r.x,
|
|
26
|
+
r.y,
|
|
27
|
+
r.w,
|
|
28
|
+
r.h
|
|
29
|
+
].map((e) => typeof e == "string" ? Number(e) : e);
|
|
30
|
+
if (e.every((e) => typeof e == "number" && Number.isFinite(e) && e >= 0)) {
|
|
31
|
+
let [t, n, i, o] = e;
|
|
32
|
+
i > 0 && o > 0 && (a = {
|
|
33
|
+
x: t,
|
|
34
|
+
y: n,
|
|
35
|
+
w: i,
|
|
36
|
+
h: o,
|
|
37
|
+
unit: r.unit === "percent" ? "percent" : "px"
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!a) return null;
|
|
42
|
+
let o = {
|
|
43
|
+
label: i,
|
|
44
|
+
...a
|
|
45
|
+
};
|
|
46
|
+
return r.id != null && t(r.id) && (o.id = t(r.id)), typeof r.href == "string" && r.href.trim() && (o.href = r.href.trim()), r.description != null && t(r.description) && (o.description = t(r.description)), o;
|
|
47
|
+
}
|
|
48
|
+
function r(r) {
|
|
49
|
+
let i = String(r ?? "").trim();
|
|
50
|
+
if (!i) return [];
|
|
51
|
+
if (i.startsWith("[")) try {
|
|
52
|
+
let e = JSON.parse(i);
|
|
53
|
+
return Array.isArray(e) ? e.map(n).filter((e) => e !== null) : [];
|
|
54
|
+
} catch {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
let a = [];
|
|
58
|
+
for (let n of i.split(";")) {
|
|
59
|
+
let r = /^\s*(\S+)\s*(.*)$/.exec(n);
|
|
60
|
+
if (!r) continue;
|
|
61
|
+
let i = e(r[1]);
|
|
62
|
+
i && a.push({
|
|
63
|
+
label: t(r[2]),
|
|
64
|
+
...i
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return a;
|
|
68
|
+
}
|
|
69
|
+
function i(e, t, n) {
|
|
70
|
+
let { x: r, y: i, w: a, h: o } = e;
|
|
71
|
+
if (e.unit === "px") {
|
|
72
|
+
if (!(t > 0) || !(n > 0)) return null;
|
|
73
|
+
r = r / t * 100, a = a / t * 100, i = i / n * 100, o = o / n * 100;
|
|
74
|
+
}
|
|
75
|
+
let s = (e) => Math.min(100, Math.max(0, e)), c = s(r), l = s(i), u = s(r + a), d = s(i + o);
|
|
76
|
+
return u <= c || d <= l ? null : {
|
|
77
|
+
x: c,
|
|
78
|
+
y: l,
|
|
79
|
+
w: u - c,
|
|
80
|
+
h: d - l,
|
|
81
|
+
unit: "percent"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export { n as i, e as n, i as r, r as t };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=regions-B8ExwUGP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regions-B8ExwUGP.js","names":["parseXywh","s","value","at","unit","prefix","parts","p","x","y","w","h","text","v","toRegion","o","label","box","n","out","parseRegions","list","r","entry","m","toPercent","width","height","clamp","left","top","right","bottom"],"sources":["../../src/components/uvalib-image-regions/regions.ts"],"sourcesContent":["/**\n * Region parsing shared by `<uvalib-image-regions>` and `<uvalib-lightbox>` (its\n * `data-regions`). No Lit, no DOM rendering: small enough for the lightbox to import\n * statically.\n */\n\n/** One region on an image. */\nexport interface ImageRegion {\n /** A stable id, sent back in events. */\n id?: string;\n /** The region's name, shown in the list and on the highlighted outline. */\n label: string;\n /** Left edge, in `unit`s from the image's left. */\n x: number;\n /** Top edge, in `unit`s from the image's top. */\n y: number;\n /** Width, in `unit`s. */\n w: number;\n /** Height, in `unit`s. */\n h: number;\n /**\n * `percent` (of the image's width and height) or `px` (pixels of the image's natural size,\n * or of `image-width` × `image-height` when set). Default `px`, as in IIIF.\n */\n unit?: 'px' | 'percent';\n /** Where the region's list entry links. */\n href?: string;\n /** A short description after the label in the list. */\n description?: string;\n}\n\n/** A region box: its unit and four numbers. */\nexport interface RegionBox {\n x: number;\n y: number;\n w: number;\n h: number;\n unit: 'px' | 'percent';\n}\n\n/**\n * A IIIF / Media Fragments `xywh` value: `percent:10,20,30,40`, `pixel:160,120,320,240`\n * or `160,120,320,240` (pixels), optionally as `xywh=…` or a URL ending `#xywh=…`.\n * Returns null for anything else, and for a zero width or height.\n */\nexport function parseXywh(value: string | null | undefined): RegionBox | null {\n let s = String(value ?? '').trim();\n const at = s.lastIndexOf('xywh=');\n if (at >= 0) s = s.slice(at + 5);\n s = s.split('&')[0]!.trim();\n let unit: RegionBox['unit'] = 'px';\n const prefix = /^(pixel|percent):/i.exec(s);\n if (prefix) {\n unit = prefix[1]!.toLowerCase() === 'percent' ? 'percent' : 'px';\n s = s.slice(prefix[0].length);\n }\n const parts = s.split(',');\n if (parts.length !== 4 || parts.some((p) => !/^\\s*\\d+(\\.\\d+)?\\s*$/.test(p))) return null;\n const [x, y, w, h] = parts.map(Number) as [number, number, number, number];\n if (w <= 0 || h <= 0) return null;\n return { x, y, w, h, unit };\n}\n\nconst text = (v: unknown): string =>\n String(v ?? '')\n .replace(/\\s+/g, ' ')\n .trim();\n\n/** A usable region from an unknown value (an `items` entry or JSON), or null. */\nexport function toRegion(v: unknown): ImageRegion | null {\n if (!v || typeof v !== 'object') return null;\n const o = v as Record<string, unknown>;\n const label = text(o.label);\n let box: RegionBox | null = null;\n if (typeof o.xywh === 'string') box = parseXywh(o.xywh);\n else {\n const n = [o.x, o.y, o.w, o.h].map((x) => (typeof x === 'string' ? Number(x) : x));\n if (n.every((x) => typeof x === 'number' && Number.isFinite(x) && x >= 0)) {\n const [x, y, w, h] = n as number[];\n if (w! > 0 && h! > 0)\n box = { x: x!, y: y!, w: w!, h: h!, unit: o.unit === 'percent' ? 'percent' : 'px' };\n }\n }\n if (!box) return null;\n const out: ImageRegion = { label, ...box };\n if (o.id != null && text(o.id)) out.id = text(o.id);\n if (typeof o.href === 'string' && o.href.trim()) out.href = o.href.trim();\n if (o.description != null && text(o.description)) out.description = text(o.description);\n return out;\n}\n\n/**\n * Regions written in an attribute (the lightbox's `data-regions`): a JSON array of region\n * objects, or entries separated by `;`, each an `xywh` value then its label, e.g.\n * `percent:10,20,30,40 Person 1; percent:55,15,20,30 Sign`. Entries that do not parse are\n * dropped.\n */\nexport function parseRegions(value: string | null | undefined): ImageRegion[] {\n const s = String(value ?? '').trim();\n if (!s) return [];\n if (s.startsWith('[')) {\n try {\n const list: unknown = JSON.parse(s);\n return Array.isArray(list)\n ? list.map(toRegion).filter((r): r is ImageRegion => r !== null)\n : [];\n } catch {\n return [];\n }\n }\n const out: ImageRegion[] = [];\n for (const entry of s.split(';')) {\n const m = /^\\s*(\\S+)\\s*(.*)$/.exec(entry);\n if (!m) continue;\n const box = parseXywh(m[1]);\n if (box) out.push({ label: text(m[2]), ...box });\n }\n return out;\n}\n\n/**\n * The box in percent of the image, clamped to it. Pixel boxes need the coordinate space\n * (`width` × `height`); without it they return null (not drawn yet).\n */\nexport function toPercent(box: RegionBox, width: number, height: number): RegionBox | null {\n let { x, y, w, h } = box;\n if (box.unit === 'px') {\n if (!(width > 0) || !(height > 0)) return null;\n x = (x / width) * 100;\n w = (w / width) * 100;\n y = (y / height) * 100;\n h = (h / height) * 100;\n }\n const clamp = (v: number) => Math.min(100, Math.max(0, v));\n const left = clamp(x);\n const top = clamp(y);\n const right = clamp(x + w);\n const bottom = clamp(y + h);\n if (right <= left || bottom <= top) return null;\n return { x: left, y: top, w: right - left, h: bottom - top, unit: 'percent' };\n}\n"],"mappings":";AA6CA,SAAgBA,EAAU,GAAoD;CAC5E,IAAIC,IAAI,OAAOC,KAAS,EAAE,CAAC,CAAC,KAAK,GAC3BC,IAAKF,EAAE,YAAY,OAAO;CAEhC,AADIE,KAAM,MAAG,IAAIF,EAAE,MAAME,IAAK,CAAC,IAC/B,IAAIF,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,CAAE,KAAK;CAC1B,IAAIG,IAA0B,MACxBC,IAAS,qBAAqB,KAAKJ,CAAC;CAC1C,AAAII,MACF,IAAOA,EAAO,EAAE,CAAE,YAAY,MAAM,YAAY,YAAY,MAC5D,IAAIJ,EAAE,MAAMI,EAAO,EAAE,CAAC,MAAM;CAE9B,IAAMC,IAAQL,EAAE,MAAM,GAAG;CACzB,IAAIK,EAAM,WAAW,KAAKA,EAAM,MAAM,MAAM,CAAC,sBAAsB,KAAKC,CAAC,CAAC,GAAG,OAAO;CACpF,IAAM,CAACC,GAAGC,GAAGC,GAAGC,KAAKL,EAAM,IAAI,MAAM;CAErC,OADII,KAAK,KAAKC,KAAK,IAAU,OACtB;EAAE;EAAG;EAAG;EAAG;EAAG;CAAK;AAC5B;AAEA,IAAMC,KAAQ,MACZ,OAAOC,KAAK,EAAE,CAAC,CACZ,QAAQ,QAAQ,GAAG,CAAC,CACpB,KAA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AAIP,CAAQ,CAAC,CAAC,QAAQ,MAAwBQ,MAAM,IAAI,IAC7D,CAAC;CACP,QAAQ;EACN,OAAO,CAAC;CACV;CAEF,IAAMH,IAAqB,CAAC;CAC5B,KAAK,IAAMI,KAAStB,EAAE,MAAM,GAAG,GAAG;EAChC,IAAMuB,IAAI,oBAAoB,KAAKD,CAAK;EACxC,IAAI,CAACC,GAAG;EACR,IAAMP,IAAMjB,EAAUwB,EAAE,EAAE;EAC1B,AAAIP,KAAKE,EAAI,KAAK;GAAE,OAAOP,EAAKY,EAAE,EAAE;GAAG,GAAGP;EAAI,CAAC;CACjD;CACA,OAAOE;AACT;AAMA,SAAgBM,EAAU,GAAgB,GAAe,GAAkC;CACzF,IAAI,EAAE,MAAG,MAAG,MAAG,SAAMR;CACrB,IAAIA,EAAI,SAAS,MAAM;EACrB,IAAI,EAAES,IAAQ,MAAM,EAAEC,IAAS,IAAI,OAAO;EAI1C,AAHA,IAAKnB,IAAIkB,IAAS,KAClB,IAAKhB,IAAIgB,IAAS,KAClB,IAAKjB,IAAIkB,IAAU,KACnB,IAAKhB,IAAIgB,IAAU;CACrB;CACA,IAAMC,KAAS,MAAc,KAAK,IAAI,KAAK,KAAK,IAAI,GAAGf,CAAC,CAAC,GACnDgB,IAAOD,EAAMpB,CAAC,GACdsB,IAAMF,EAAMnB,CAAC,GACbsB,IAAQH,EAAMpB,IAAIE,CAAC,GACnBsB,IAASJ,EAAMnB,IAAIE,CAAC;CAE1B,OADIoB,KAASF,KAAQG,KAAUF,IAAY,OACpC;EAAE,GAAGD;EAAM,GAAGC;EAAK,GAAGC,IAAQF;EAAM,GAAGG,IAASF;EAAK,MAAM;CAAU;AAC9E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as e, u as t } from "./UvalibElement-
|
|
1
|
+
import { s as e, u as t } from "./UvalibElement-pGONDAwB.js";
|
|
2
2
|
// node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directive.js
|
|
3
3
|
var n = {
|
|
4
4
|
ATTRIBUTE: 1,
|
|
@@ -98,4 +98,4 @@ var n = {
|
|
|
98
98
|
});
|
|
99
99
|
export { h as t };
|
|
100
100
|
|
|
101
|
-
//# sourceMappingURL=repeat-
|
|
101
|
+
//# sourceMappingURL=repeat-m5Zd_QeP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeat-
|
|
1
|
+
{"version":3,"file":"repeat-m5Zd_QeP.js","names":["t","e","i","o","c","u","s","t","r","l","p","h","v","o","i","n","f","e","E","j$1","t$1","e$1","e","t","i$1","i","o","v","l","d","n","c","u$1","m","p","M","h","u","s","p$1","a","h$1","v$1","y","x","j","k","w"],"sources":["../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directive.js","../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directive-helpers.js","../../node_modules/.pnpm/lit-html@3.3.3/node_modules/lit-html/directives/repeat.js"],"sourcesContent":["/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}export{i as Directive,t as PartType,e as directive};\n//# sourceMappingURL=directive.js.map\n","import{_$LH as o}from\"./lit-html.js\";\n/**\n * @license\n * Copyright 2020 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */const{I:t}=o,i=o=>o,n=o=>null===o||\"object\"!=typeof o&&\"function\"!=typeof o,e={HTML:1,SVG:2,MATHML:3},l=(o,t)=>void 0===t?void 0!==o?._$litType$:o?._$litType$===t,d=o=>null!=o?._$litType$?.h,c=o=>void 0!==o?._$litDirective$,f=o=>o?._$litDirective$,r=o=>void 0===o.strings,s=()=>document.createComment(\"\"),v=(o,n,e)=>{const l=o._$AA.parentNode,d=void 0===n?o._$AB:n._$AA;if(void 0===e){const i=l.insertBefore(s(),d),n=l.insertBefore(s(),d);e=new t(i,n,o,o.options)}else{const t=e._$AB.nextSibling,n=e._$AM,c=n!==o;if(c){let t;e._$AQ?.(o),e._$AM=o,void 0!==e._$AP&&(t=o._$AU)!==n._$AU&&e._$AP(t)}if(t!==d||c){let o=e._$AA;for(;o!==t;){const t=i(o).nextSibling;i(l).insertBefore(o,d),o=t}}}return e},u=(o,t,i=o)=>(o._$AI(t,i),o),m={},p=(o,t=m)=>o._$AH=t,M=o=>o._$AH,h=o=>{o._$AR(),o._$AA.remove()},j=o=>{o._$AR()};export{e as TemplateResultType,j as clearPart,M as getCommittedValue,f as getDirectiveClass,v as insertPart,d as isCompiledTemplateResult,c as isDirectiveResult,n as isPrimitive,r as isSingleExpression,l as isTemplateResult,h as removePart,u as setChildPartValue,p as setCommittedValue};\n//# sourceMappingURL=directive-helpers.js.map\n","import{noChange as e}from\"../lit-html.js\";import{directive as s,Directive as t,PartType as r}from\"../directive.js\";import{getCommittedValue as l,setChildPartValue as o,insertPart as i,removePart as n,setCommittedValue as f}from\"../directive-helpers.js\";\n/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=s(class extends t{constructor(e){if(super(e),e.type!==r.CHILD)throw Error(\"repeat() can only be used in text expressions\")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return{values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){const d=l(s),{values:p,keys:a}=this.dt(t,r,c);if(!Array.isArray(d))return this.ut=a,p;const h=this.ut??=[],v=[];let m,y,x=0,j=d.length-1,k=0,w=p.length-1;for(;x<=j&&k<=w;)if(null===d[x])x++;else if(null===d[j])j--;else if(h[x]===a[k])v[k]=o(d[x],p[k]),x++,k++;else if(h[j]===a[w])v[w]=o(d[j],p[w]),j--,w--;else if(h[x]===a[w])v[w]=o(d[x],p[w]),i(s,v[w+1],d[x]),x++,w--;else if(h[j]===a[k])v[k]=o(d[j],p[k]),i(s,d[x],d[j]),j--,k++;else if(void 0===m&&(m=u(a,k,w),y=u(h,x,j)),m.has(h[x]))if(m.has(h[j])){const e=y.get(a[k]),t=void 0!==e?d[e]:null;if(null===t){const e=i(s,d[x]);o(e,p[k]),v[k]=e}else v[k]=o(t,p[k]),i(s,d[x],t),d[e]=null;k++}else n(d[j]),j--;else n(d[x]),x++;for(;k<=w;){const e=i(s,v[w+1]);o(e,p[k]),v[k++]=e}for(;x<=j;){const e=d[x++];null!==e&&n(e)}return this.ut=a,f(s,v),e}});export{c as repeat};\n//# sourceMappingURL=repeat.js.map\n"],"ignoreList":[0,1,2],"mappings":";;AAKA,IAAMA,IAAE;CAAC,WAAU;CAAE,OAAM;CAAE,UAAS;CAAE,mBAAkB;CAAE,OAAM;CAAE,SAAQ;AAAC,GAAEC,KAAE,OAAI,GAAGqB,OAAK;CAAC,iBAAgBC;CAAE,QAAOD;AAAC,IAASpB,IAAN,MAAO;CAAC,YAAY,GAAE,CAAC;CAAC,IAAI,OAAM;EAAC,OAAO,KAAK,KAAK;CAAI;CAAC,KAAK,GAAE,GAAE,GAAE;EAAC,KAAK,OAAKqB,GAAE,KAAK,OAAKD,GAAE,KAAK,OAAKG;CAAC;CAAC,KAAK,GAAE,GAAE;EAAC,OAAO,KAAK,OAAOF,GAAED,CAAC;CAAC;CAAC,OAAO,GAAE,GAAE;EAAC,OAAO,KAAK,OAAO,GAAGA,CAAC;CAAC;AAAC,GCAnS,EAAC,GAAEC,MAAGpB,GAAEsB,KAAE,MAAGC,GAA8P,UAAM,SAAS,cAAc,EAAE,GAAEC,KAAG,GAAE,GAAE,MAAI;CAAC,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-
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-
|
|
2
|
-
import { i as u, n as d, r as f, t as p } from "./site-main-nav-
|
|
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-pGONDAwB.js";
|
|
2
|
+
import { i as u, n as d, r as f, t as p } from "./site-main-nav-DURrQMal.js";
|
|
3
3
|
import { a as m } from "./analytics-DTTihuBD.js";
|
|
4
4
|
import { t as h } from "./link-DbJSwj16.js";
|
|
5
|
-
import { t as g } from "./accessible-
|
|
5
|
+
import { t as g } from "./accessible-DJv7YOtS.js";
|
|
6
6
|
// src/styles/color-scheme.ts
|
|
7
7
|
var _ = s("\n --uva-color-border: #7a84a0;\n"), v = "color: var(--uva-color-pre-footer-text, #ffffff);", y = t`
|
|
8
8
|
@supports (color: light-dark(#000, #fff)) {
|
|
@@ -51,6 +51,11 @@ var _ = s("\n --uva-color-border: #7a84a0;\n"), v = "color: var(--uva-color-pre
|
|
|
51
51
|
status badges read: text (--uva-color-alert-text) is 7:1 or more in both schemes. */
|
|
52
52
|
--uva-color-status-success-bg: light-dark(var(--uva-green-200, #ddefdc), #173d1c);
|
|
53
53
|
--uva-color-status-success-border: light-dark(var(--uva-green-A, #4e9737), #62bb46);
|
|
54
|
+
/* Highlighted search terms (<mark> in base.css's .uvalib-result__snippet):
|
|
55
|
+
library.virginia.edu's orange-200 with dark text (9.5:1), and a dark orange with white
|
|
56
|
+
text (7.6:1). */
|
|
57
|
+
--uva-color-highlight: light-dark(var(--uva-brand-orange-200, #ffc999), #854200);
|
|
58
|
+
--uva-color-on-highlight: light-dark(var(--uva-grey-darkest, #2b2b2b), #ffffff);
|
|
54
59
|
}
|
|
55
60
|
:root[data-uva-color-scheme='system'] {
|
|
56
61
|
color-scheme: light dark;
|
|
@@ -923,4 +928,4 @@ var $ = customElements.get("site-main-nav");
|
|
|
923
928
|
$ && $ !== p && console.warn("site-header: <site-main-nav> is already defined by another copy of @uvalib/web-components; the header uses that one. Load the components from one source only.");
|
|
924
929
|
export { R as t };
|
|
925
930
|
|
|
926
|
-
//# sourceMappingURL=site-header-
|
|
931
|
+
//# sourceMappingURL=site-header-DYRMpdBj.js.map
|