@uvalib/web-components 1.1.1 → 1.3.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 +140 -0
- package/README.md +1310 -80
- 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/url-param.d.ts +23 -0
- package/dist/base/url-param.js +49 -0
- package/dist/base/url-param.js.map +1 -0
- package/dist/base.css +562 -2
- 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-card/UvalibCard.d.ts +19 -5
- package/dist/components/uvalib-card/UvalibCard.js +112 -9
- package/dist/components/uvalib-card/UvalibCard.js.map +1 -1
- package/dist/components/uvalib-chip-group/UvalibChipGroup.d.ts +178 -0
- package/dist/components/uvalib-chip-group/UvalibChipGroup.js +817 -0
- package/dist/components/uvalib-chip-group/UvalibChipGroup.js.map +1 -0
- package/dist/components/uvalib-chip-group/uvalib-chip-group.d.ts +1 -0
- package/dist/components/uvalib-chip-group/uvalib-chip-group.js +4 -0
- package/dist/components/uvalib-chip-group/uvalib-chip-group.js.map +1 -0
- 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 +187 -0
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js +1452 -0
- package/dist/components/uvalib-date-histogram/UvalibDateHistogram.js.map +1 -0
- package/dist/components/uvalib-date-histogram/uvalib-date-histogram.d.ts +1 -0
- package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js +4 -0
- package/dist/components/uvalib-date-histogram/uvalib-date-histogram.js.map +1 -0
- 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 +130 -0
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js +658 -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 +40 -0
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +152 -17
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
- package/dist/components/uvalib-lightbox/media.d.ts +1 -18
- package/dist/components/uvalib-lightbox/media.js +1 -42
- package/dist/components/uvalib-lightbox/media.js.map +1 -1
- package/dist/components/uvalib-map/UvalibMap.d.ts +182 -0
- package/dist/components/uvalib-map/UvalibMap.js +1001 -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 +77 -4
- package/dist/components/uvalib-pager/UvalibPager.js +270 -8
- package/dist/components/uvalib-pager/UvalibPager.js.map +1 -1
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.d.ts +27 -1
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js +192 -26
- package/dist/components/uvalib-photo-grid/UvalibPhotoGrid.js.map +1 -1
- package/dist/components/uvalib-results-count/UvalibResultsCount.d.ts +62 -0
- package/dist/components/uvalib-results-count/UvalibResultsCount.js +208 -0
- package/dist/components/uvalib-results-count/UvalibResultsCount.js.map +1 -0
- package/dist/components/uvalib-results-count/uvalib-results-count.d.ts +1 -0
- package/dist/components/uvalib-results-count/uvalib-results-count.js +4 -0
- package/dist/components/uvalib-results-count/uvalib-results-count.js.map +1 -0
- package/dist/components/uvalib-tabs/UvalibTabs.d.ts +127 -0
- package/dist/components/uvalib-tabs/UvalibTabs.js +821 -0
- package/dist/components/uvalib-tabs/UvalibTabs.js.map +1 -0
- package/dist/components/uvalib-tabs/uvalib-tabs.d.ts +1 -0
- package/dist/components/uvalib-tabs/uvalib-tabs.js +4 -0
- package/dist/components/uvalib-tabs/uvalib-tabs.js.map +1 -0
- package/dist/components/uvalib-tag-list/UvalibTagList.d.ts +89 -0
- package/dist/components/uvalib-tag-list/UvalibTagList.js +411 -0
- package/dist/components/uvalib-tag-list/UvalibTagList.js.map +1 -0
- package/dist/components/uvalib-tag-list/uvalib-tag-list.d.ts +1 -0
- package/dist/components/uvalib-tag-list/uvalib-tag-list.js +4 -0
- package/dist/components/uvalib-tag-list/uvalib-tag-list.js.map +1 -0
- package/dist/custom-elements.json +14007 -3497
- package/dist/index.d.ts +16 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/pagefind.css +4 -0
- package/dist/styles/base.js +154 -1
- package/dist/styles/base.js.map +1 -1
- package/dist/styles/color-scheme.js +9 -0
- package/dist/styles/color-scheme.js.map +1 -1
- package/dist/styles/controls.js +8 -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.d.ts +1 -0
- package/dist/styles/results.js +242 -0
- package/dist/styles/results.js.map +1 -0
- 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 +9 -0
- package/dist-cdn/analytics.js +32 -0
- package/dist-cdn/analytics.js.map +1 -0
- package/dist-cdn/base.css +562 -2
- 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-BI8h0Gf3.js +281 -0
- package/dist-cdn/chunks/base-BI8h0Gf3.js.map +1 -0
- package/dist-cdn/chunks/inline-copy-BANQSMIR.js +69 -0
- package/dist-cdn/chunks/inline-copy-BANQSMIR.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-C9V7Wuw2.js → site-header-DYRMpdBj.js} +13 -4
- package/dist-cdn/chunks/site-header-DYRMpdBj.js.map +1 -0
- 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/source-children-BHsDwCvL.js +53 -0
- package/dist-cdn/chunks/source-children-BHsDwCvL.js.map +1 -0
- 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/chunks/url-param-C1sk_F1d.js +28 -0
- package/dist-cdn/chunks/url-param-C1sk_F1d.js.map +1 -0
- package/dist-cdn/custom-elements.json +14007 -3497
- 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 +15 -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 +269 -24
- package/dist-cdn/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +514 -13
- package/dist-cdn/skills/uvalib-web-components/reference/snippets.md +1 -1
- package/dist-cdn/tokens.css +9 -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 +97 -23
- package/dist-cdn/uvalib-card.js.map +1 -1
- package/dist-cdn/uvalib-chip-group.js +535 -0
- package/dist-cdn/uvalib-chip-group.js.map +1 -0
- package/dist-cdn/uvalib-combobox.js +667 -0
- package/dist-cdn/uvalib-combobox.js.map +1 -0
- package/dist-cdn/uvalib-contents.js +102 -23
- package/dist-cdn/uvalib-contents.js.map +1 -1
- package/dist-cdn/uvalib-date-histogram.js +960 -0
- package/dist-cdn/uvalib-date-histogram.js.map +1 -0
- 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 +447 -0
- package/dist-cdn/uvalib-image-regions.js.map +1 -0
- package/dist-cdn/uvalib-lightbox.js +145 -78
- package/dist-cdn/uvalib-lightbox.js.map +1 -1
- package/dist-cdn/uvalib-map.js +471 -0
- package/dist-cdn/uvalib-map.js.map +1 -0
- package/dist-cdn/uvalib-metadata.js +152 -25
- package/dist-cdn/uvalib-metadata.js.map +1 -1
- package/dist-cdn/uvalib-pager.js +164 -18
- package/dist-cdn/uvalib-pager.js.map +1 -1
- package/dist-cdn/uvalib-photo-grid.js +123 -21
- package/dist-cdn/uvalib-photo-grid.js.map +1 -1
- package/dist-cdn/uvalib-results-count.js +101 -0
- package/dist-cdn/uvalib-results-count.js.map +1 -0
- package/dist-cdn/uvalib-tabs.js +436 -0
- package/dist-cdn/uvalib-tabs.js.map +1 -0
- package/dist-cdn/uvalib-tag-list.js +267 -0
- package/dist-cdn/uvalib-tag-list.js.map +1 -0
- package/package.json +66 -3
- package/skills/uvalib-web-components/SKILL.md +269 -24
- package/skills/uvalib-web-components/reference/accessibility-testing.md +34 -2
- package/skills/uvalib-web-components/reference/components.md +514 -13
- 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-CAFQWnZG.js +0 -128
- package/dist-cdn/chunks/base-CAFQWnZG.js.map +0 -1
- package/dist-cdn/chunks/site-header-C9V7Wuw2.js.map +0 -1
- package/dist-cdn/chunks/source-children-RuAec527.js +0 -119
- package/dist-cdn/chunks/source-children-RuAec527.js.map +0 -1
|
@@ -99,7 +99,7 @@ Vendor or third-party site:
|
|
|
99
99
|
</html>
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
Analytics. `<site-analytics>` listens for `site-analytics-event`, `site-analytics-search` and `site-analytics-pageview` on `document` (and the original `uvalib-analytics-*` names). Events go through Matomo's `_paq` queue, so one fired before Matomo has loaded is kept; dispatch them normally from a user action such as a search submit. The Matomo property id is found from the page URL for registered library sites; otherwise add `matomoid="N"`, or use `<site-page matomo-id="N">` instead of the element. The snippet tests answer matomo.js with a stub, so nothing reaches real Matomo.
|
|
102
|
+
Analytics. `<site-analytics>` listens for `site-analytics-event`, `site-analytics-search` and `site-analytics-pageview` on `document` (and the original `uvalib-analytics-*` names). Events go through Matomo's `_paq` queue, so one fired before Matomo has loaded is kept; dispatch them normally from a user action such as a search submit. The Matomo property id is found from the page URL for registered library sites; otherwise add `matomoid="N"`, or use `<site-page matomo-id="N">` instead of the element. To count downloads without recording their URLs (file URLs that carry ids), add `downloads="event"` (`<site-page matomo-downloads="event">`): each download is then the event `['download', '<extension>']`, and links to other sites are still counted. For a search box of your own, report searches with `createSearchTracker()` from `analytics.js` rather than firing `site-analytics-search` by hand (see the README's "Analytics"). The snippet tests answer matomo.js with a stub, so nothing reaches real Matomo.
|
|
103
103
|
|
|
104
104
|
```html snippet
|
|
105
105
|
<!doctype html>
|
package/dist-cdn/tokens.css
CHANGED
|
@@ -123,6 +123,15 @@
|
|
|
123
123
|
--uva-color-alert-regional-border: light-dark(var(--uva-yellow, #ecc602), #ecc602);
|
|
124
124
|
--uva-color-alert-regional-info-bg: light-dark(var(--uva-teal-200, #c8f2f4), #0f3a3d);
|
|
125
125
|
--uva-color-alert-regional-info-border: light-dark(var(--uva-teal, #25cad3), #25cad3);
|
|
126
|
+
/* base.css's success badge (.uvalib-badge--success), beside the alert colours the other
|
|
127
|
+
status badges read: text (--uva-color-alert-text) is 7:1 or more in both schemes. */
|
|
128
|
+
--uva-color-status-success-bg: light-dark(var(--uva-green-200, #ddefdc), #173d1c);
|
|
129
|
+
--uva-color-status-success-border: light-dark(var(--uva-green-A, #4e9737), #62bb46);
|
|
130
|
+
/* Highlighted search terms (<mark> in base.css's .uvalib-result__snippet):
|
|
131
|
+
library.virginia.edu's orange-200 with dark text (9.5:1), and a dark orange with white
|
|
132
|
+
text (7.6:1). */
|
|
133
|
+
--uva-color-highlight: light-dark(var(--uva-brand-orange-200, #ffc999), #854200);
|
|
134
|
+
--uva-color-on-highlight: light-dark(var(--uva-grey-darkest, #2b2b2b), #ffffff);
|
|
126
135
|
}
|
|
127
136
|
:root[data-uva-color-scheme='system'] {
|
|
128
137
|
color-scheme: light dark;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as e } from "./chunks/UvalibElement-
|
|
2
|
-
import { t } from "./chunks/SiteAnalytics-
|
|
1
|
+
import { m as e } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
|
+
import { t } from "./chunks/SiteAnalytics-B9gu5aGO.js";
|
|
3
3
|
// src/components/uvalib-analytics/uvalib-analytics.ts
|
|
4
4
|
e("uvalib-analytics", class extends t {});
|
|
5
5
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { a as e, d as t, f as n, i as r, l as i, m as a, n as o, t as s } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
|
+
import { a as c } from "./chunks/analytics-DTTihuBD.js";
|
|
3
|
+
// src/components/uvalib-back-to-top/UvalibBackToTop.ts
|
|
4
|
+
var l = "uvalib-back-to-top", u = "Back to top", d = 400, f = "a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]", p = (e) => (e ?? "").replace(/\s+/g, " ").trim(), m = t`<svg class="btt-icon" viewBox="0 0 16 16" width="16" height="16" aria-hidden="true" focusable="false"><path d="M8 2.5 2.5 8l1.4 1.4L7 6.3V14h2V6.3l3.1 3.1L13.5 8z" fill="currentColor"/></svg>`, h = class extends s {
|
|
5
|
+
constructor(...e) {
|
|
6
|
+
super(...e), this.label = u, this.offset = d, this.target = "", this.shown = !1, this.docked = !1, this.onClick = () => {
|
|
7
|
+
let e = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
8
|
+
window.scrollTo({
|
|
9
|
+
top: 0,
|
|
10
|
+
behavior: e ? "auto" : "smooth"
|
|
11
|
+
}), this.focusTarget(), c(this, [l, "click"]);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
static {
|
|
15
|
+
this.styles = n`
|
|
16
|
+
:host {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: flex-end;
|
|
19
|
+
align-items: center;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
block-size: var(--uvalib-back-to-top-space, 4.75rem);
|
|
22
|
+
padding-block: 1rem;
|
|
23
|
+
}
|
|
24
|
+
:host([hidden]) {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
.btt-button {
|
|
28
|
+
position: fixed;
|
|
29
|
+
inset-inline-end: max(1rem, env(safe-area-inset-right));
|
|
30
|
+
inset-block-end: max(1rem, env(safe-area-inset-bottom));
|
|
31
|
+
z-index: 20;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: 0.4rem;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
min-block-size: 44px;
|
|
37
|
+
min-inline-size: 44px;
|
|
38
|
+
margin: 0;
|
|
39
|
+
padding: 0.5rem 1rem;
|
|
40
|
+
border: 2px solid var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));
|
|
41
|
+
border-radius: 5px;
|
|
42
|
+
background: var(--uva-color-surface-raised, #fff);
|
|
43
|
+
color: var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));
|
|
44
|
+
box-shadow: 0 2px 6px var(--uva-color-shadow, rgb(0 0 0 / 0.2));
|
|
45
|
+
font: inherit;
|
|
46
|
+
font-size: 1rem;
|
|
47
|
+
line-height: 1.2;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
visibility: hidden;
|
|
51
|
+
opacity: 0;
|
|
52
|
+
}
|
|
53
|
+
.btt-button:dir(rtl) {
|
|
54
|
+
inset-inline-end: max(1rem, env(safe-area-inset-left));
|
|
55
|
+
}
|
|
56
|
+
.btt-button.shown {
|
|
57
|
+
visibility: visible;
|
|
58
|
+
opacity: 1;
|
|
59
|
+
}
|
|
60
|
+
.btt-button.docked {
|
|
61
|
+
position: static;
|
|
62
|
+
box-shadow: none;
|
|
63
|
+
}
|
|
64
|
+
.btt-button:hover {
|
|
65
|
+
border-color: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));
|
|
66
|
+
color: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));
|
|
67
|
+
}
|
|
68
|
+
.btt-button:focus-visible {
|
|
69
|
+
outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));
|
|
70
|
+
outline-offset: 2px;
|
|
71
|
+
}
|
|
72
|
+
.btt-icon {
|
|
73
|
+
flex: none;
|
|
74
|
+
}
|
|
75
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
76
|
+
.btt-button {
|
|
77
|
+
transition:
|
|
78
|
+
opacity 0.2s,
|
|
79
|
+
visibility 0.2s;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
@media (forced-colors: active) {
|
|
83
|
+
.btt-button {
|
|
84
|
+
border-color: ButtonText;
|
|
85
|
+
background: ButtonFace;
|
|
86
|
+
color: ButtonText;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
@media print {
|
|
90
|
+
:host {
|
|
91
|
+
display: none;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
get button() {
|
|
97
|
+
return this.renderRoot.querySelector("button.btt-button");
|
|
98
|
+
}
|
|
99
|
+
get px() {
|
|
100
|
+
let e = Number(this.offset);
|
|
101
|
+
return Number.isFinite(e) && e > 0 ? e : d;
|
|
102
|
+
}
|
|
103
|
+
connectedCallback() {
|
|
104
|
+
super.connectedCallback();
|
|
105
|
+
let e = this.ownerDocument, t = this.sentinel ??= e.createElement("div");
|
|
106
|
+
t.setAttribute("aria-hidden", "true"), t.dataset.uvalibBackToTop = "", t.style.cssText = `position:absolute;top:0;left:0;width:1px;height:${this.px}px;margin:0;padding:0;border:0;pointer-events:none;visibility:hidden`, e.body.append(t), this.topObserver = new IntersectionObserver((e) => {
|
|
107
|
+
let t = e[e.length - 1];
|
|
108
|
+
t && this.setShown(!t.isIntersecting);
|
|
109
|
+
}), this.topObserver.observe(t), this.dockObserver = new IntersectionObserver((e) => {
|
|
110
|
+
let t = e[e.length - 1];
|
|
111
|
+
t && (this.docked = t.intersectionRatio >= .99);
|
|
112
|
+
}, { threshold: [
|
|
113
|
+
0,
|
|
114
|
+
.99,
|
|
115
|
+
1
|
|
116
|
+
] }), this.dockObserver.observe(this);
|
|
117
|
+
}
|
|
118
|
+
disconnectedCallback() {
|
|
119
|
+
super.disconnectedCallback(), this.topObserver?.disconnect(), this.dockObserver?.disconnect(), this.sentinel?.remove();
|
|
120
|
+
}
|
|
121
|
+
willUpdate(e) {
|
|
122
|
+
e.has("offset") && this.sentinel && (this.sentinel.style.height = `${this.px}px`);
|
|
123
|
+
}
|
|
124
|
+
setShown(e) {
|
|
125
|
+
if (e === this.shown) return;
|
|
126
|
+
let t = this.button, n = !!t && (this.renderRoot instanceof ShadowRoot ? this.renderRoot.activeElement === t : document.activeElement === t);
|
|
127
|
+
this.shown = e, !e && n && this.focusTarget();
|
|
128
|
+
}
|
|
129
|
+
findTarget() {
|
|
130
|
+
let e = this.ownerDocument, t = p(this.target);
|
|
131
|
+
if (t) try {
|
|
132
|
+
let n = e.querySelector(t);
|
|
133
|
+
if (n) return n;
|
|
134
|
+
} catch {}
|
|
135
|
+
return e.querySelector("main h1") ?? e.querySelector("h1") ?? e.getElementById("top");
|
|
136
|
+
}
|
|
137
|
+
focusTarget() {
|
|
138
|
+
let e = this.findTarget();
|
|
139
|
+
e && (e.matches(f) || e.setAttribute("tabindex", "-1"), e.focus({ preventScroll: !0 }));
|
|
140
|
+
}
|
|
141
|
+
render() {
|
|
142
|
+
let e = p(this.label) || u;
|
|
143
|
+
return i`<button
|
|
144
|
+
type="button"
|
|
145
|
+
class="btt-button ${this.shown ? "shown" : ""} ${this.docked ? "docked" : ""}"
|
|
146
|
+
part="button"
|
|
147
|
+
@click=${this.onClick}
|
|
148
|
+
>
|
|
149
|
+
${m}<span>${e}</span>
|
|
150
|
+
</button>`;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
// src/components/uvalib-back-to-top/uvalib-back-to-top.ts
|
|
154
|
+
o([e({ type: String })], h.prototype, "label", void 0), o([e({ type: Number })], h.prototype, "offset", void 0), o([e({ type: String })], h.prototype, "target", void 0), o([r()], h.prototype, "shown", void 0), o([r()], h.prototype, "docked", void 0), a("uvalib-back-to-top", h);
|
|
155
|
+
|
|
156
|
+
//# sourceMappingURL=uvalib-back-to-top.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uvalib-back-to-top.js","names":["_decorate","property","state","n","w","i","b","define","__decorate","UvalibElement","trackEvent","TAG","DEFAULT_LABEL","DEFAULT_OFFSET","FOCUSABLE","squash","s","arrow","UvalibBackToTop","_args","reduce","doc","sentinel","last","entries","changed","shown","button","focused","sel","el","label"],"sources":["../src/components/uvalib-back-to-top/UvalibBackToTop.ts","../src/components/uvalib-back-to-top/uvalib-back-to-top.ts"],"sourcesContent":["import { css, html, svg, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\n\nconst TAG = 'uvalib-back-to-top';\nconst DEFAULT_LABEL = 'Back to top';\nconst DEFAULT_OFFSET = 400;\n/** Natively focusable: no tabindex needed to take focus. */\nconst FOCUSABLE =\n 'a[href], button, input, select, textarea, summary, [tabindex], [contenteditable]';\n\nconst squash = (s: string | null | undefined) => (s ?? '').replace(/\\s+/g, ' ').trim();\n\nconst arrow = svg`<svg class=\"btt-icon\" viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M8 2.5 2.5 8l1.4 1.4L7 6.3V14h2V6.3l3.1 3.1L13.5 8z\" fill=\"currentColor\"/></svg>`;\n\n/**\n * A “Back to top” button for long pages: minutes, finding aids, transcriptions, long result\n * lists.\n *\n * It stays hidden (`visibility: hidden`, so it is neither a tab stop nor in the accessibility\n * tree) until the top `offset` pixels of the page (default 400) have scrolled out of view,\n * watched with an IntersectionObserver on a small sentinel at the top of the page, never a\n * scroll listener. If it has focus as it hides, focus moves to the target. Activating it\n * scrolls to the top (smoothly unless the visitor prefers reduced motion) and moves focus to\n * the page's `<h1>` (the first in `<main>`, else the first anywhere, else `#top`), or to\n * `target` (a selector), adding `tabindex=\"-1\"` when it is not focusable, so keyboard and\n * screen reader users land at the top too.\n *\n * The button is fixed in the bottom corner (end side), inside the safe-area insets. The\n * element itself is an empty block 4.75rem tall: put it last in the page's main content and\n * that is the space the button needs, so the last lines can always scroll clear of it. When\n * that space comes into view the button sits in it instead of floating, so it never covers\n * the footer either. It is hidden in print.\n *\n * @tagname uvalib-back-to-top\n * @fires uvalib-analytics-event - For `<site-analytics>`: `['uvalib-back-to-top', 'click']` when activated. Bubbles and is composed.\n * @csspart button - The button.\n * @cssprop [--uvalib-back-to-top-space=4.75rem] - The height the element keeps for the button at the end of the content.\n * @cssprop --uva-color-surface-raised - Dark-mode role token: button background (else #fff).\n * @cssprop --uva-color-button-bg - Dark-mode role token: button border and text (else `--uva-blue-alt`, #007bac).\n * @cssprop --uva-color-button-hover-bg - Dark-mode role token: hovered button (else `--uva-blue-alt-A`, #005679).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n * @cssprop --uva-color-shadow - Dark-mode role token: the floating button's shadow.\n */\nexport class UvalibBackToTop extends UvalibElement {\n static styles = css`\n :host {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n box-sizing: border-box;\n block-size: var(--uvalib-back-to-top-space, 4.75rem);\n padding-block: 1rem;\n }\n :host([hidden]) {\n display: none;\n }\n .btt-button {\n position: fixed;\n inset-inline-end: max(1rem, env(safe-area-inset-right));\n inset-block-end: max(1rem, env(safe-area-inset-bottom));\n z-index: 20;\n display: inline-flex;\n align-items: center;\n gap: 0.4rem;\n box-sizing: border-box;\n min-block-size: 44px;\n min-inline-size: 44px;\n margin: 0;\n padding: 0.5rem 1rem;\n border: 2px solid var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));\n border-radius: 5px;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-button-bg, var(--uva-blue-alt, #007bac));\n box-shadow: 0 2px 6px var(--uva-color-shadow, rgb(0 0 0 / 0.2));\n font: inherit;\n font-size: 1rem;\n line-height: 1.2;\n white-space: nowrap;\n cursor: pointer;\n visibility: hidden;\n opacity: 0;\n }\n .btt-button:dir(rtl) {\n inset-inline-end: max(1rem, env(safe-area-inset-left));\n }\n .btt-button.shown {\n visibility: visible;\n opacity: 1;\n }\n .btt-button.docked {\n position: static;\n box-shadow: none;\n }\n .btt-button:hover {\n border-color: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));\n color: var(--uva-color-button-hover-bg, var(--uva-blue-alt-A, #005679));\n }\n .btt-button:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n .btt-icon {\n flex: none;\n }\n @media (prefers-reduced-motion: no-preference) {\n .btt-button {\n transition:\n opacity 0.2s,\n visibility 0.2s;\n }\n }\n @media (forced-colors: active) {\n .btt-button {\n border-color: ButtonText;\n background: ButtonFace;\n color: ButtonText;\n }\n }\n @media print {\n :host {\n display: none;\n }\n }\n `;\n\n /** The button's text. */\n @property({ type: String }) label = DEFAULT_LABEL;\n\n /** How many pixels at the top of the page must scroll out of view before the button shows. */\n @property({ type: Number }) offset = DEFAULT_OFFSET;\n\n /** A selector for where focus goes (default: the page's `<h1>`, else `#top`). */\n @property({ type: String }) target = '';\n\n /** Whether the top of the page has scrolled out of view. */\n @state() private shown = false;\n\n /** Whether the element's own space is fully in view (the button sits in it). */\n @state() private docked = false;\n\n private sentinel?: HTMLDivElement;\n private topObserver?: IntersectionObserver;\n private dockObserver?: IntersectionObserver;\n\n private get button(): HTMLButtonElement | null {\n return (this.renderRoot as ParentNode).querySelector<HTMLButtonElement>('button.btt-button');\n }\n\n private get px(): number {\n const n = Number(this.offset);\n return Number.isFinite(n) && n > 0 ? n : DEFAULT_OFFSET;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n const doc = this.ownerDocument;\n const sentinel = (this.sentinel ??= doc.createElement('div'));\n sentinel.setAttribute('aria-hidden', 'true');\n sentinel.dataset.uvalibBackToTop = '';\n sentinel.style.cssText = `position:absolute;top:0;left:0;width:1px;height:${this.px}px;margin:0;padding:0;border:0;pointer-events:none;visibility:hidden`;\n doc.body.append(sentinel);\n this.topObserver = new IntersectionObserver((entries) => {\n const last = entries[entries.length - 1];\n if (last) this.setShown(!last.isIntersecting);\n });\n this.topObserver.observe(sentinel);\n this.dockObserver = new IntersectionObserver(\n (entries) => {\n const last = entries[entries.length - 1];\n if (last) this.docked = last.intersectionRatio >= 0.99;\n },\n { threshold: [0, 0.99, 1] },\n );\n this.dockObserver.observe(this);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.topObserver?.disconnect();\n this.dockObserver?.disconnect();\n this.sentinel?.remove();\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('offset') && this.sentinel) this.sentinel.style.height = `${this.px}px`;\n }\n\n private setShown(shown: boolean): void {\n if (shown === this.shown) return;\n const button = this.button;\n const focused =\n !!button &&\n (this.renderRoot instanceof ShadowRoot\n ? this.renderRoot.activeElement === button\n : document.activeElement === button);\n this.shown = shown;\n if (!shown && focused) this.focusTarget();\n }\n\n /** Where focus goes: `target`, else the page's `<h1>`, else `#top`. */\n private findTarget(): HTMLElement | null {\n const doc = this.ownerDocument;\n const sel = squash(this.target);\n if (sel) {\n try {\n const el = doc.querySelector<HTMLElement>(sel);\n if (el) return el;\n } catch {\n // Not a valid selector: fall back to the heading.\n }\n }\n return (\n doc.querySelector<HTMLElement>('main h1') ??\n doc.querySelector<HTMLElement>('h1') ??\n doc.getElementById('top')\n );\n }\n\n private focusTarget(): void {\n const el = this.findTarget();\n if (!el) return;\n if (!el.matches(FOCUSABLE)) el.setAttribute('tabindex', '-1');\n el.focus({ preventScroll: true });\n }\n\n private readonly onClick = (): void => {\n const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n window.scrollTo({ top: 0, behavior: reduce ? 'auto' : 'smooth' });\n this.focusTarget();\n trackEvent(this, [TAG, 'click']);\n };\n\n protected override render() {\n const label = squash(this.label) || DEFAULT_LABEL;\n return html`<button\n type=\"button\"\n class=\"btt-button ${this.shown ? 'shown' : ''} ${this.docked ? 'docked' : ''}\"\n part=\"button\"\n @click=${this.onClick}\n >\n ${arrow}<span>${label}</span>\n </button>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibBackToTop } from './UvalibBackToTop.js';\n\ndefine('uvalib-back-to-top', UvalibBackToTop);\n"],"mappings":";;;AAKA,IAAMW,IAAM,sBACNC,IAAgB,eAChBC,IAAiB,KAEjBC,IACJ,oFAEIC,KAAU,OAAkCC,KAAK,GAAA,CAAI,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK,GAE/EC,IAAQ,CAAG,mMA+BJC,IAAb,cAAqCT,EAAc;;EAsLV,A,aAnGH,KAAA,QAAAG,GAGC,KAAA,SAAAC,GAGA,KAAA,SAAA,IAGZ,KAAA,QAAA,IAGC,KAAA,SAAA,IAuFa,KAAA,gBAAA;GACrC,IAAMO,IAAS,OAAO,WAAW,kCAAkC,CAAC,CAAC;GAGrE,AAFA,OAAO,SAAS;IAAE,KAAK;IAAG,UAAUA,IAAS,SAAS;GAAS,CAAC,GAChE,KAAK,YAAY,GACjBV,EAAW,MAAM,CAACC,GAAK,OAAO,CAAC;EACjC;;;EA1LgB,KAAA,SAAA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoGnB,IAAY,SAAmC;EAC7C,OAAQ,KAAK,WAA0B,cAAiC,mBAAmB;CAC7F;CAEA,IAAY,KAAa;EACvB,IAAMR,IAAI,OAAO,KAAK,MAAM;EAC5B,OAAO,OAAO,SAASA,CAAC,KAAKA,IAAI,IAAIA,IAAIU;CAC3C;CAEA,oBAAmC;EACjC,MAAM,kBAAkB;EACxB,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AIC,GAAI,OAAOA;EACjB,QAAQ,CAER;EAEF,OACET,EAAI,cAA2B,SAAS,KACxCA,EAAI,cAA2B,IAAI,KACnCA,EAAI,eAAe,KAAK;CAE5B;CAEA,cAA4B;EAC1B,IAAMS,IAAK,KAAK,WAAW;EAC3B,AAAKA,MACAA,EAAG,QAAQhB,CAAS,KAAGgB,EAAG,aAAa,YAAY,IAAI,GAC5DA,EAAG,MAAM,EAAE,eAAe,GAAK,CAAC;CAClC;CASA,SAA4B;EAC1B,IAAMC,IAAQhB,EAAO,KAAK,KAAK,KAAKH;EACpC,OAAO,CAAI;;0BAEW,KAAK,QAAQ,UAAU,GAAG,GAAG,KAAK,SAAS,WAAW,GAAG;;eAEpE,KAAK,QAAQ;;QAEpBK,EAAM,QAAQc,EAAM;;CAE1B;AACF;;AArHG/B,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAiB,EAAA,WAAA,SAAA,KAAA,CAAA,GAGzBlB,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAiB,EAAA,WAAA,UAAA,KAAA,CAAA,GAGzBlB,EAAA,CAAAC,EAAS,EAAE,MAAM,OAAO,CAAC,CAAA,GAAAiB,EAAA,WAAA,UAAA,KAAA,CAAA,GAGzBlB,EAAA,CAAAE,EAAM,CAAA,GAAAgB,EAAA,WAAA,SAAA,KAAA,CAAA,GAGNlB,EAAA,CAAAE,EAAM,CAAA,GAAAgB,EAAA,WAAA,UAAA,KAAA,CAAA,GCzITX,EAAO,sBAAsBW,CAAe"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./chunks/UvalibElement-
|
|
1
|
+
import { a as e, f as t, i as n, l as r, m as i, n as a, o, p as s, r as c, t as l } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
2
|
import { a as u } from "./chunks/analytics-DTTihuBD.js";
|
|
3
|
-
import { t as d } from "./chunks/accessible-
|
|
3
|
+
import { t as d } from "./chunks/accessible-DJv7YOtS.js";
|
|
4
4
|
// src/components/uvalib-breadcrumbs/UvalibBreadcrumbs.ts
|
|
5
5
|
var f = "Breadcrumb", p = (e) => `
|
|
6
6
|
${e} { display: block; }
|
|
@@ -10,7 +10,7 @@ var f = "Breadcrumb", p = (e) => `
|
|
|
10
10
|
${e}[hidden], ${e} [hidden] { display: none !important; }
|
|
11
11
|
`, m = s(p(":host")), h = {
|
|
12
12
|
attributes: !0,
|
|
13
|
-
attributeFilter: ["href"],
|
|
13
|
+
attributeFilter: ["href", "data-return-from"],
|
|
14
14
|
characterData: !0,
|
|
15
15
|
childList: !0,
|
|
16
16
|
subtree: !0
|
|
@@ -19,7 +19,22 @@ var f = "Breadcrumb", p = (e) => `
|
|
|
19
19
|
"https:",
|
|
20
20
|
"mailto:",
|
|
21
21
|
"tel:"
|
|
22
|
-
]), _ = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), v =
|
|
22
|
+
]), _ = (e) => String(e ?? "").replace(/\s+/g, " ").trim(), v = (e) => e.replace(/\/index\.html?$/i, "/").replace(/(.)\/$/, "$1") || "/";
|
|
23
|
+
function y(e, t, n, r = new URL(n).origin) {
|
|
24
|
+
let i = _(e).split(" ").filter(Boolean);
|
|
25
|
+
if (i.length && t) try {
|
|
26
|
+
let e = new URL(t);
|
|
27
|
+
if (e.origin !== r || e.search.length < 2) return;
|
|
28
|
+
let a = v(e.pathname);
|
|
29
|
+
return i.some((e) => {
|
|
30
|
+
let t = new URL(e, n);
|
|
31
|
+
return t.origin === r && v(t.pathname) === a;
|
|
32
|
+
}) ? e.pathname + e.search + e.hash : void 0;
|
|
33
|
+
} catch {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
var b = class extends l {
|
|
23
38
|
constructor(...e) {
|
|
24
39
|
super(...e), this.label = "Breadcrumb", this.childItems = [], this.warned = !1, this.warnedHref = !1, this.own = /* @__PURE__ */ new WeakSet();
|
|
25
40
|
}
|
|
@@ -98,11 +113,11 @@ var f = "Breadcrumb", p = (e) => `
|
|
|
98
113
|
n = !0;
|
|
99
114
|
continue;
|
|
100
115
|
}
|
|
101
|
-
let i = r instanceof HTMLAnchorElement ? r.getAttribute("href") : null
|
|
102
|
-
t.push(i === null ? { label: e } : {
|
|
116
|
+
let i = r instanceof HTMLAnchorElement ? r.getAttribute("href") : null, a = i === null ? { label: e } : {
|
|
103
117
|
label: e,
|
|
104
118
|
href: i
|
|
105
|
-
});
|
|
119
|
+
}, o = r.getAttribute("data-return-from");
|
|
120
|
+
o !== null && i !== null && (a.returnFrom = o), t.push(a);
|
|
106
121
|
}
|
|
107
122
|
n && this.warn(), JSON.stringify(t) !== JSON.stringify(this.childItems) && (this.childItems = t);
|
|
108
123
|
}
|
|
@@ -110,10 +125,15 @@ var f = "Breadcrumb", p = (e) => `
|
|
|
110
125
|
this.observer ??= new MutationObserver(() => this.sync()), this.observer.disconnect(), this.lightDom ? (this.observer.observe(this, { childList: !0 }), this.holder && this.observer.observe(this.holder, h)) : this.observer.observe(this, h);
|
|
111
126
|
}
|
|
112
127
|
get trail() {
|
|
113
|
-
|
|
128
|
+
let e = this.items ? this.items.filter((e) => _(e?.label)).map((e) => ({
|
|
114
129
|
label: _(e.label),
|
|
115
|
-
href: e.href ?? void 0
|
|
116
|
-
|
|
130
|
+
href: e.href ?? void 0,
|
|
131
|
+
returnFrom: e.href == null ? void 0 : e.returnFrom ?? void 0
|
|
132
|
+
})) : this.childItems, t = this.ownerDocument, n = t.defaultView?.location.origin;
|
|
133
|
+
return e.map(({ label: e, href: r, returnFrom: i }) => r === void 0 || !this.safe(r) ? { label: e } : {
|
|
134
|
+
label: e,
|
|
135
|
+
href: (i && n ? y(i, t.referrer, t.baseURI, n) : void 0) ?? r
|
|
136
|
+
});
|
|
117
137
|
}
|
|
118
138
|
safe(e) {
|
|
119
139
|
let t = !1;
|
|
@@ -171,6 +191,6 @@ var f = "Breadcrumb", p = (e) => `
|
|
|
171
191
|
}
|
|
172
192
|
};
|
|
173
193
|
// src/components/uvalib-breadcrumbs/uvalib-breadcrumbs.ts
|
|
174
|
-
a([e({ type: String })],
|
|
194
|
+
a([e({ type: String })], b.prototype, "label", void 0), a([e({ attribute: !1 })], b.prototype, "items", void 0), a([n()], b.prototype, "childItems", void 0), i("uvalib-breadcrumbs", b);
|
|
175
195
|
|
|
176
196
|
//# sourceMappingURL=uvalib-breadcrumbs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uvalib-breadcrumbs.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","accessible","DEFAULT_LABEL","structuralRules","host","shadowStructure","CONTENT","SAFE_SCHEMES","normalize","s","UvalibBreadcrumbs","_args","root","sheet","node","changed","items","incoming","sources","invalid","label","href","ok","step","level","a","links","go","trail","last","current","item","A"],"sources":["../src/components/uvalib-breadcrumbs/UvalibBreadcrumbs.ts","../src/components/uvalib-breadcrumbs/uvalib-breadcrumbs.ts"],"sourcesContent":["import { css, html, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\n\n/** One step of the trail: its visible text and, except perhaps for the current page, a link. */\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n}\n\nconst DEFAULT_LABEL = 'Breadcrumb';\n\n/**\n * The rules kept with `no-style`: the list is a plain inline run (no bullets, no indent) that\n * wraps like text, the separators keep their spacing, and `[hidden]` hides. `host` is `:host`\n * (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} ol { list-style: none; margin: 0; padding: 0; }\n ${host} li { display: inline; }\n ${host} .separator { margin-inline-end: 0.3em; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/** What the observer watches in the author's trail: the links, their hrefs and text. */\nconst CONTENT: MutationObserverInit = {\n attributes: true,\n attributeFilter: ['href'],\n characterData: true,\n childList: true,\n subtree: true,\n};\n\n/** Schemes a breadcrumb may link to; anything else (javascript:, data:, …) is shown as text. */\nconst SAFE_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nconst normalize = (s: unknown) =>\n String(s ?? '')\n .replace(/\\s+/g, ' ')\n .trim();\n\n/**\n * A breadcrumb trail, as on library.virginia.edu: links separated by slashes, ending with the\n * current page, at body size. A `<nav aria-label=\"Breadcrumb\">` holding an `<ol>`; the\n * separators are hidden from assistive technology and the last item has\n * `aria-current=\"page\"` (a `<span>`, or a link when it has an href).\n *\n * Give the trail as children: `<a href>` elements, ending with the current page as a\n * text-only element (`<span>Hours</span>`) or a link (`<a href aria-current=\"page\">`).\n * The last child is always the current page. An earlier child without an href is shown as\n * plain text. Children with no text are skipped with one console warning. Hrefs are used as\n * written, and the trail follows changes to the children (attributes and text too).\n *\n * Apps that build the trail in JavaScript set the `items` property instead (it then wins\n * over any children); assigning a new array re-renders.\n *\n * Inside `<site-page>`, give it `slot=\"breadcrumbs\"`: it is placed between the header (and\n * alerts band) and `<main>`, with the page's gutters. It works anywhere else too.\n *\n * Single-page apps: the trail is drawn from copies of the children, so a router's own click\n * handlers on them do not run. Listen for `uvalib-breadcrumbs-navigate` and cancel it to route\n * in place; hash links need nothing.\n *\n * @tagname uvalib-breadcrumbs\n * @fires uvalib-analytics-event - For `<site-analytics>`: a click on a trail link, `['uvalib-breadcrumbs', 'link-click', 'level <N>', <N>]` (N from 1, the first step); never the label or URL. Bubbles and is composed.\n * @fires uvalib-breadcrumbs-navigate - A plain click on a trail link: `detail` is `{ href, index }` (href as written). Cancel it (`preventDefault()`) to navigate in the app; the click's default is then prevented. Bubbles and is composed.\n * @cssprop [--uva-blue-alt-dark=#005679] - Link colour.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Current page colour.\n * @cssprop [--uva-grey-dark=#4f4f4f] - Separator colour.\n * @cssprop --uva-color-utility-link - Dark-mode role token: link colour, #005679 in light as on library.virginia.edu (else `--uva-blue-alt-dark`).\n * @cssprop --uva-color-text - Dark-mode role token: current page colour (else `--uva-grey-darkest`).\n * @cssprop --uva-color-text-muted - Dark-mode role token: separator colour (else `--uva-grey-dark`).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibBreadcrumbs extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n font-size: 1rem;\n line-height: 1.5;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n overflow-wrap: anywhere;\n }\n a {\n color: var(--uva-color-utility-link, var(--uva-blue-alt-dark, #005679));\n text-decoration: underline;\n }\n a[aria-current='page'] {\n color: inherit;\n }\n .separator {\n color: var(--uva-color-text-muted, var(--uva-grey-dark, #4f4f4f));\n }\n `,\n ];\n\n /** Accessible name of the navigation landmark. */\n @property({ type: String }) label = 'Breadcrumb';\n\n /**\n * The trail as data, for apps that build it in JavaScript: `{ label, href? }` objects, the\n * last one the current page. Wins over the children while set; `undefined` goes back to\n * them. Entries without a label are skipped with one console warning.\n */\n @property({ attribute: false }) items?: BreadcrumbItem[];\n\n /** The trail read from the children. */\n @state() private childItems: BreadcrumbItem[] = [];\n private warned = false;\n private warnedHref = false;\n private observer?: MutationObserver;\n /** Light mode: the hidden container this element owns for the author's children. */\n private holder?: HTMLDivElement;\n /** Light mode: nodes this element rendered itself (incl. Lit markers), never adopted. */\n private own = new WeakSet<Node>();\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\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 // Read before the first render, so it costs no second update.\n this.sync();\n if (this.hasUpdated) this.watch();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n protected override firstUpdated(): void {\n if (this.lightDom) for (const n of this.childNodes) if (n !== this.holder) this.own.add(n);\n this.sync();\n this.watch();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('items') && this.items) this.check(this.items);\n }\n\n private warn(): void {\n if (this.warned) return;\n this.warned = true;\n console.warn(\n `${this.localName}: ignoring breadcrumbs with no text (each needs a label; give the trail as <a href> children ending with the current page, or set items).`,\n );\n }\n\n /** Warn about `items` entries that cannot be shown. */\n private check(items: readonly BreadcrumbItem[]): void {\n if (items.some((i) => !normalize(i?.label))) this.warn();\n }\n\n /** Light mode has no slots: move the author's children into the hidden holder. */\n private adopt(): Node[] {\n const incoming = [...this.childNodes].filter((n) => n !== this.holder && !this.own.has(n));\n if (incoming.length && !this.holder) {\n this.holder = this.ownerDocument.createElement('div');\n this.holder.hidden = true;\n this.holder.className = 'breadcrumbs-source';\n // Created after watch() ran (children added later): watch it too.\n if (this.observer && this.hasUpdated) this.observer.observe(this.holder, CONTENT);\n }\n if (this.holder) {\n this.holder.append(...incoming);\n if (this.holder.parentNode !== this) this.prepend(this.holder);\n }\n return this.holder ? [...this.holder.childNodes] : [];\n }\n\n /** Read the trail from the children. */\n private sync(): void {\n const sources = this.lightDom ? this.adopt() : [...this.childNodes];\n const items: BreadcrumbItem[] = [];\n let invalid = false;\n for (const n of sources) {\n if (n.nodeType === Node.TEXT_NODE) {\n if (normalize(n.textContent)) invalid = true;\n continue;\n }\n if (!(n instanceof Element)) continue;\n const label = normalize(n.textContent);\n if (!label) {\n invalid = true;\n continue;\n }\n const href = n instanceof HTMLAnchorElement ? n.getAttribute('href') : null;\n items.push(href === null ? { label } : { label, href });\n }\n if (invalid) this.warn();\n // Only a real change re-renders.\n if (JSON.stringify(items) !== JSON.stringify(this.childItems)) this.childItems = items;\n }\n\n /**\n * Shadow mode: the observer watches the children, their attributes and text. Light mode:\n * the host for new children and the holder for everything inside it.\n */\n private watch(): void {\n this.observer ??= new MutationObserver(() => this.sync());\n this.observer.disconnect();\n if (this.lightDom) {\n this.observer.observe(this, { childList: true });\n if (this.holder) this.observer.observe(this.holder, CONTENT);\n } else {\n this.observer.observe(this, CONTENT);\n }\n }\n\n /** What is shown: `items` while set, else the children; entries without a label left out. */\n private get trail(): BreadcrumbItem[] {\n const items = this.items\n ? this.items\n .filter((i) => normalize(i?.label))\n .map((i) => ({ label: normalize(i.label), href: i.href ?? undefined }))\n : this.childItems;\n return items.map((i) => (i.href === undefined || this.safe(i.href) ? i : { label: i.label }));\n }\n\n /**\n * Whether `href` may be a link: relative, hash and http(s), mailto and tel URLs are kept as\n * written; any other scheme (javascript:, data:, …) makes the step plain text, with a warning.\n */\n private safe(href: string): boolean {\n let ok = false;\n try {\n ok = SAFE_SCHEMES.has(new URL(href, this.ownerDocument.baseURI).protocol);\n } catch {\n ok = false;\n }\n if (!ok && !this.warnedHref) {\n this.warnedHref = true;\n console.warn(\n `${this.localName}: showing a breadcrumb as text: its href is not http(s), mailto, tel or relative.`,\n );\n }\n return ok;\n }\n\n /**\n * A plain click on a trail link fires a cancelable `uvalib-breadcrumbs-navigate`; a router\n * that cancels it navigates itself (the click's default is prevented too).\n */\n private onClick(e: MouseEvent): void {\n // Analytics: the link's level in the trail (1 is the first), never its label or URL.\n const step = (e.target as Element | null)?.closest?.('a[href]')?.closest('li');\n if (step && this.renderRoot.contains(step)) {\n const level = [...step.parentNode!.children].indexOf(step) + 1;\n trackEvent(this, ['uvalib-breadcrumbs', 'link-click', `level ${level}`, level]);\n }\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey)\n return;\n const a = (e.target as Element | null)?.closest?.('a[href]');\n if (!a || !this.renderRoot.contains(a)) return;\n const links = [...this.renderRoot.querySelectorAll('nav a[href]')];\n const go = new CustomEvent('uvalib-breadcrumbs-navigate', {\n detail: { href: a.getAttribute('href'), index: links.indexOf(a) },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(go)) e.preventDefault();\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n // Lets <site-page> drop the trail's gutter while it shows nothing.\n this.toggleAttribute('data-empty', !this.trail.length);\n }\n\n protected override render() {\n const trail = this.trail;\n const last = trail.length - 1;\n // role=\"list\": Safari drops the list semantics of a list styled without markers.\n return html`<nav\n aria-label=${this.label || DEFAULT_LABEL}\n ?hidden=${!trail.length}\n @click=${this.onClick}\n >\n <ol role=\"list\">\n ${trail.map((item, i) => {\n const current = i === last ? 'page' : undefined;\n const step =\n item.href !== undefined\n ? html`<a href=${item.href} aria-current=${current ?? nothing}>${item.label}</a>`\n : html`<span aria-current=${current ?? nothing}>${item.label}</span>`;\n // The space before a separator is where a long trail wraps; the separator stays\n // with the item it introduces.\n return html`<li role=\"listitem\">\n ${i ? html` <span class=\"separator\" aria-hidden=\"true\">/</span>` : nothing}${step}\n </li>`;\n })}\n </ol>\n </nav>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibBreadcrumbs } from './UvalibBreadcrumbs.js';\n\ndefine('uvalib-breadcrumbs', UvalibBreadcrumbs);\n"],"mappings":";;;;AAaA,IAAMgB,IAAgB,cAOhBC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK,YAAYA,EAAK;GAEpBC,IAAkBnB,EAAUiB,EAAgB,OAAO,CAAC,GAGpDG,IAAgC;CACpC,YAAY;CACZ,iBAAiB,CAAC,MAAM;CACxB,eAAe;CACf,WAAW;CACX,SAAS;AACX,GA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AA,GAOzBtB,EAAA,CAAAC,EAAS,EAAE,WAAW,GAAM,CAAC,CAAA,GAAAqB,EAAA,WAAA,SAAA,KAAA,CAAA,GAG7BtB,EAAA,CAAAE,EAAM,CAAA,GAAAoB,EAAA,WAAA,cAAA,KAAA,CAAA,GC/GTf,EAAO,sBAAsBe,CAAiB"}
|
|
1
|
+
{"version":3,"file":"uvalib-breadcrumbs.js","names":["unsafeCSS","nothing","_decorate","property","state","n","i","r$1","b","define","__decorate","r","installLightDomStyles","UvalibElement","trackEvent","accessible","DEFAULT_LABEL","structuralRules","host","shadowStructure","CONTENT","SAFE_SCHEMES","normalize","s","pathKey","p","returnHref","base","paths","returnFrom","referrer","from","origin","key","u","UvalibBreadcrumbs","_args","root","sheet","node","changed","items","incoming","sources","invalid","label","href","item","doc","ok","step","level","a","links","go","trail","last","current","A"],"sources":["../src/components/uvalib-breadcrumbs/UvalibBreadcrumbs.ts","../src/components/uvalib-breadcrumbs/uvalib-breadcrumbs.ts"],"sourcesContent":["import { css, html, nothing, unsafeCSS, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { trackEvent } from '../../base/analytics.js';\nimport { UvalibElement } from '../../base/UvalibElement.js';\nimport { installLightDomStyles } from '../../base/light-dom-styles.js';\nimport { accessible } from '../../styles/accessible.js';\n\n/** One step of the trail: its visible text and, except perhaps for the current page, a link. */\nexport interface BreadcrumbItem {\n label: string;\n href?: string;\n /**\n * The search page(s) this step returns to: a path, or several separated by spaces\n * (`data-return-from` on a child link). When the visitor came from one of them with a query\n * string, the step links back to that search.\n */\n returnFrom?: string;\n}\n\nconst DEFAULT_LABEL = 'Breadcrumb';\n\n/**\n * The rules kept with `no-style`: the list is a plain inline run (no bullets, no indent) that\n * wraps like text, the separators keep their spacing, and `[hidden]` hides. `host` is `:host`\n * (shadow) or the tag name (light DOM, so they stay scoped).\n */\nconst structuralRules = (host: string) => `\n ${host} { display: block; }\n ${host} ol { list-style: none; margin: 0; padding: 0; }\n ${host} li { display: inline; }\n ${host} .separator { margin-inline-end: 0.3em; }\n ${host}[hidden], ${host} [hidden] { display: none !important; }\n`;\nconst shadowStructure = unsafeCSS(structuralRules(':host'));\n\n/** What the observer watches in the author's trail: the links, their hrefs and text. */\nconst CONTENT: MutationObserverInit = {\n attributes: true,\n attributeFilter: ['href', 'data-return-from'],\n characterData: true,\n childList: true,\n subtree: true,\n};\n\n/** Schemes a breadcrumb may link to; anything else (javascript:, data:, …) is shown as text. */\nconst SAFE_SCHEMES = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\nconst normalize = (s: unknown) =>\n String(s ?? '')\n .replace(/\\s+/g, ' ')\n .trim();\n\n/** A comparable path: without `index.html` and a trailing slash (`/search/` is `/search`). */\nconst pathKey = (p: string) => p.replace(/\\/index\\.html?$/i, '/').replace(/(.)\\/$/, '$1') || '/';\n\n/**\n * The search the visitor came from, for a step with `returnFrom`: the referrer's path, query\n * and hash when it is on this site, at one of the given paths (resolved against `base`) and\n * has a query string; else undefined (`origin` is the page's). Nothing is stored or sent.\n */\nfunction returnHref(\n returnFrom: string | undefined,\n referrer: string,\n base: string,\n origin = new URL(base).origin,\n): string | undefined {\n const paths = normalize(returnFrom).split(' ').filter(Boolean);\n if (!paths.length || !referrer) return undefined;\n try {\n const from = new URL(referrer);\n if (from.origin !== origin || from.search.length < 2) return undefined;\n const key = pathKey(from.pathname);\n const match = paths.some((p) => {\n const u = new URL(p, base);\n return u.origin === origin && pathKey(u.pathname) === key;\n });\n return match ? from.pathname + from.search + from.hash : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * A breadcrumb trail, as on library.virginia.edu: links separated by slashes, ending with the\n * current page, at body size. A `<nav aria-label=\"Breadcrumb\">` holding an `<ol>`; the\n * separators are hidden from assistive technology and the last item has\n * `aria-current=\"page\"` (a `<span>`, or a link when it has an href).\n *\n * Give the trail as children: `<a href>` elements, ending with the current page as a\n * text-only element (`<span>Hours</span>`) or a link (`<a href aria-current=\"page\">`).\n * The last child is always the current page. An earlier child without an href is shown as\n * plain text. Children with no text are skipped with one console warning. Hrefs are used as\n * written, and the trail follows changes to the children (attributes and text too).\n *\n * Apps that build the trail in JavaScript set the `items` property instead (it then wins\n * over any children); assigning a new array re-renders.\n *\n * A step back to a search: give its link `data-return-from` with the search page's path (or\n * several, separated by spaces), as in `<a href=\"/\" data-return-from=\"/\">Search</a>`. When the\n * visitor came from that page on this site with a query string (`document.referrer`; a\n * trailing slash or `index.html` does not matter), the step links back to that search\n * (path and query) instead; its text stays the same. Otherwise, as when the result\n * was opened in a new tab or the site sends no referrer, it keeps its href. Nothing is\n * stored or sent. In `items`, the same is `returnFrom`.\n *\n * Inside `<site-page>`, give it `slot=\"breadcrumbs\"`: it is placed between the header (and\n * alerts band) and `<main>`, with the page's gutters. It works anywhere else too.\n *\n * Single-page apps: the trail is drawn from copies of the children, so a router's own click\n * handlers on them do not run. Listen for `uvalib-breadcrumbs-navigate` and cancel it to route\n * in place; hash links need nothing.\n *\n * @tagname uvalib-breadcrumbs\n * @fires uvalib-analytics-event - For `<site-analytics>`: a click on a trail link, `['uvalib-breadcrumbs', 'link-click', 'level <N>', <N>]` (N from 1, the first step); never the label or URL. Bubbles and is composed.\n * @fires uvalib-breadcrumbs-navigate - A plain click on a trail link: `detail` is `{ href, index }` (href as written). Cancel it (`preventDefault()`) to navigate in the app; the click's default is then prevented. Bubbles and is composed.\n * @cssprop [--uva-blue-alt-dark=#005679] - Link colour.\n * @cssprop [--uva-grey-darkest=#2b2b2b] - Current page colour.\n * @cssprop [--uva-grey-dark=#4f4f4f] - Separator colour.\n * @cssprop --uva-color-utility-link - Dark-mode role token: link colour, #005679 in light as on library.virginia.edu (else `--uva-blue-alt-dark`).\n * @cssprop --uva-color-text - Dark-mode role token: current page colour (else `--uva-grey-darkest`).\n * @cssprop --uva-color-text-muted - Dark-mode role token: separator colour (else `--uva-grey-dark`).\n * @cssprop --uva-color-focus - Dark-mode role token: focus ring (else `--uva-brand-orange`).\n */\nexport class UvalibBreadcrumbs extends UvalibElement {\n static styles = [\n accessible,\n shadowStructure,\n css`\n :host {\n font-size: 1rem;\n line-height: 1.5;\n color: var(--uva-color-text, var(--uva-grey-darkest, #2b2b2b));\n overflow-wrap: anywhere;\n }\n a {\n color: var(--uva-color-utility-link, var(--uva-blue-alt-dark, #005679));\n text-decoration: underline;\n }\n a[aria-current='page'] {\n color: inherit;\n }\n .separator {\n color: var(--uva-color-text-muted, var(--uva-grey-dark, #4f4f4f));\n }\n `,\n ];\n\n /** Accessible name of the navigation landmark. */\n @property({ type: String }) label = 'Breadcrumb';\n\n /**\n * The trail as data, for apps that build it in JavaScript: `{ label, href? }` objects, the\n * last one the current page. Wins over the children while set; `undefined` goes back to\n * them. Entries without a label are skipped with one console warning.\n */\n @property({ attribute: false }) items?: BreadcrumbItem[];\n\n /** The trail read from the children. */\n @state() private childItems: BreadcrumbItem[] = [];\n private warned = false;\n private warnedHref = false;\n private observer?: MutationObserver;\n /** Light mode: the hidden container this element owns for the author's children. */\n private holder?: HTMLDivElement;\n /** Light mode: nodes this element rendered itself (incl. Lit markers), never adopted. */\n private own = new WeakSet<Node>();\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n if (root instanceof ShadowRoot && this.noStyle) {\n const sheet = shadowStructure.styleSheet;\n if (sheet) root.adoptedStyleSheets = [sheet];\n }\n return root;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (this.lightDom && this.noStyle) {\n const node = this.getRootNode();\n installLightDomStyles(\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 // Read before the first render, so it costs no second update.\n this.sync();\n if (this.hasUpdated) this.watch();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n }\n\n protected override firstUpdated(): void {\n if (this.lightDom) for (const n of this.childNodes) if (n !== this.holder) this.own.add(n);\n this.sync();\n this.watch();\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (changed.has('items') && this.items) this.check(this.items);\n }\n\n private warn(): void {\n if (this.warned) return;\n this.warned = true;\n console.warn(\n `${this.localName}: ignoring breadcrumbs with no text (each needs a label; give the trail as <a href> children ending with the current page, or set items).`,\n );\n }\n\n /** Warn about `items` entries that cannot be shown. */\n private check(items: readonly BreadcrumbItem[]): void {\n if (items.some((i) => !normalize(i?.label))) this.warn();\n }\n\n /** Light mode has no slots: move the author's children into the hidden holder. */\n private adopt(): Node[] {\n const incoming = [...this.childNodes].filter((n) => n !== this.holder && !this.own.has(n));\n if (incoming.length && !this.holder) {\n this.holder = this.ownerDocument.createElement('div');\n this.holder.hidden = true;\n this.holder.className = 'breadcrumbs-source';\n // Created after watch() ran (children added later): watch it too.\n if (this.observer && this.hasUpdated) this.observer.observe(this.holder, CONTENT);\n }\n if (this.holder) {\n this.holder.append(...incoming);\n if (this.holder.parentNode !== this) this.prepend(this.holder);\n }\n return this.holder ? [...this.holder.childNodes] : [];\n }\n\n /** Read the trail from the children. */\n private sync(): void {\n const sources = this.lightDom ? this.adopt() : [...this.childNodes];\n const items: BreadcrumbItem[] = [];\n let invalid = false;\n for (const n of sources) {\n if (n.nodeType === Node.TEXT_NODE) {\n if (normalize(n.textContent)) invalid = true;\n continue;\n }\n if (!(n instanceof Element)) continue;\n const label = normalize(n.textContent);\n if (!label) {\n invalid = true;\n continue;\n }\n const href = n instanceof HTMLAnchorElement ? n.getAttribute('href') : null;\n const item: BreadcrumbItem = href === null ? { label } : { label, href };\n const from = n.getAttribute('data-return-from');\n if (from !== null && href !== null) item.returnFrom = from;\n items.push(item);\n }\n if (invalid) this.warn();\n // Only a real change re-renders.\n if (JSON.stringify(items) !== JSON.stringify(this.childItems)) this.childItems = items;\n }\n\n /**\n * Shadow mode: the observer watches the children, their attributes and text. Light mode:\n * the host for new children and the holder for everything inside it.\n */\n private watch(): void {\n this.observer ??= new MutationObserver(() => this.sync());\n this.observer.disconnect();\n if (this.lightDom) {\n this.observer.observe(this, { childList: true });\n if (this.holder) this.observer.observe(this.holder, CONTENT);\n } else {\n this.observer.observe(this, CONTENT);\n }\n }\n\n /** What is shown: `items` while set, else the children; entries without a label left out. */\n private get trail(): BreadcrumbItem[] {\n const items = this.items\n ? this.items\n .filter((i) => normalize(i?.label))\n .map((i) => ({\n label: normalize(i.label),\n href: i.href ?? undefined,\n returnFrom: i.href == null ? undefined : (i.returnFrom ?? undefined),\n }))\n : this.childItems;\n const doc = this.ownerDocument;\n const origin = doc.defaultView?.location.origin;\n return items.map(({ label, href, returnFrom }) => {\n if (href === undefined || !this.safe(href)) return { label };\n // A step back to the search: the same-origin search the visitor came from, if any.\n const back =\n returnFrom && origin\n ? returnHref(returnFrom, doc.referrer, doc.baseURI, origin)\n : undefined;\n return { label, href: back ?? href };\n });\n }\n\n /**\n * Whether `href` may be a link: relative, hash and http(s), mailto and tel URLs are kept as\n * written; any other scheme (javascript:, data:, …) makes the step plain text, with a warning.\n */\n private safe(href: string): boolean {\n let ok = false;\n try {\n ok = SAFE_SCHEMES.has(new URL(href, this.ownerDocument.baseURI).protocol);\n } catch {\n ok = false;\n }\n if (!ok && !this.warnedHref) {\n this.warnedHref = true;\n console.warn(\n `${this.localName}: showing a breadcrumb as text: its href is not http(s), mailto, tel or relative.`,\n );\n }\n return ok;\n }\n\n /**\n * A plain click on a trail link fires a cancelable `uvalib-breadcrumbs-navigate`; a router\n * that cancels it navigates itself (the click's default is prevented too).\n */\n private onClick(e: MouseEvent): void {\n // Analytics: the link's level in the trail (1 is the first), never its label or URL.\n const step = (e.target as Element | null)?.closest?.('a[href]')?.closest('li');\n if (step && this.renderRoot.contains(step)) {\n const level = [...step.parentNode!.children].indexOf(step) + 1;\n trackEvent(this, ['uvalib-breadcrumbs', 'link-click', `level ${level}`, level]);\n }\n if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey)\n return;\n const a = (e.target as Element | null)?.closest?.('a[href]');\n if (!a || !this.renderRoot.contains(a)) return;\n const links = [...this.renderRoot.querySelectorAll('nav a[href]')];\n const go = new CustomEvent('uvalib-breadcrumbs-navigate', {\n detail: { href: a.getAttribute('href'), index: links.indexOf(a) },\n bubbles: true,\n composed: true,\n cancelable: true,\n });\n if (!this.dispatchEvent(go)) e.preventDefault();\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n // Lets <site-page> drop the trail's gutter while it shows nothing.\n this.toggleAttribute('data-empty', !this.trail.length);\n }\n\n protected override render() {\n const trail = this.trail;\n const last = trail.length - 1;\n // role=\"list\": Safari drops the list semantics of a list styled without markers.\n return html`<nav\n aria-label=${this.label || DEFAULT_LABEL}\n ?hidden=${!trail.length}\n @click=${this.onClick}\n >\n <ol role=\"list\">\n ${trail.map((item, i) => {\n const current = i === last ? 'page' : undefined;\n const step =\n item.href !== undefined\n ? html`<a href=${item.href} aria-current=${current ?? nothing}>${item.label}</a>`\n : html`<span aria-current=${current ?? nothing}>${item.label}</span>`;\n // The space before a separator is where a long trail wraps; the separator stays\n // with the item it introduces.\n return html`<li role=\"listitem\">\n ${i ? html` <span class=\"separator\" aria-hidden=\"true\">/</span>` : nothing}${step}\n </li>`;\n })}\n </ol>\n </nav>`;\n }\n}\n","import { define } from '../../base/define.js';\nimport { UvalibBreadcrumbs } from './UvalibBreadcrumbs.js';\n\ndefine('uvalib-breadcrumbs', UvalibBreadcrumbs);\n"],"mappings":";;;;AAmBA,IAAMgB,IAAgB,cAOhBC,KAAmB,MAAiB;IACtCC,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK;IACLA,EAAK,YAAYA,EAAK;GAEpBC,IAAkBnB,EAAUiB,EAAgB,OAAO,CAAC,GAGpDG,IAAgC;CACpC,YAAY;CACZ,iBAAiB,CAAC,QAAQ,kBAAkB;CAC5C,eAAe;CACf,WAAW;CACX,SAAS;AACX,GAGMC,oBAAe,IAAI,IAAI;CAAC;CAAS;CAAU;CAAW;AAAM,CAA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"./chunks/UvalibElement-
|
|
1
|
+
import { a as e, l as t, m as n, n as r, p as i, r as a, t as o } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
2
|
// src/components/uvalib-card-grid/UvalibCardGrid.ts
|
|
3
3
|
var s = /^\d+(\.\d+)?(px|rem|em|ch|%)$/, c = (e, t) => e === ":host" ? `:host(${t})` : `${e}${t}`, l = (e) => `
|
|
4
4
|
${e} {
|