@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
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
import { a as e, i as t, l as n, m as r, n as i, o as a, p as o, r as s, t as c } from "./chunks/UvalibElement-pGONDAwB.js";
|
|
2
|
+
import { a as l } from "./chunks/analytics-DTTihuBD.js";
|
|
3
|
+
import { n as u, r as d, t as f } from "./chunks/source-children-BHsDwCvL.js";
|
|
4
|
+
import { t as p } from "./chunks/accessible-DJv7YOtS.js";
|
|
5
|
+
// src/components/uvalib-map/UvalibMap.ts
|
|
6
|
+
var m = (e) => e && Number.isFinite(e.count) && e.count > 0 ? e.count : 0, h = "uvalib-map", g = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", _ = "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors", v = [38.0336, -78.5048], y = 24, b = 56, x = 44, S = 4, C = 24, w = 32, T = 64, E = "var(--uvalib-map-height, min(24rem, 75vw))", D = "Tab or arrow keys move between places; Enter opens one. With the map focused, arrow keys pan and + and − zoom.", O = 0, k = (e) => e.toLocaleString("en-US"), A = (e, t) => t === 1 && /s$/.test(e) ? e.slice(0, -1) : e, j = (e) => Number.isFinite(e.lat) && Number.isFinite(e.lng) && Math.abs(e.lat) <= 90 && Math.abs(e.lng) <= 180;
|
|
7
|
+
function M(e) {
|
|
8
|
+
let t = /^\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*$/.exec(e);
|
|
9
|
+
if (!t) return null;
|
|
10
|
+
let [n, r] = [Number(t[1]), Number(t[2])];
|
|
11
|
+
return Math.abs(n) <= 90 && Math.abs(r) <= 180 ? [n, r] : null;
|
|
12
|
+
}
|
|
13
|
+
function N(e) {
|
|
14
|
+
let t = e.documentElement.getAttribute("data-uva-color-scheme");
|
|
15
|
+
if (t === null) return !1;
|
|
16
|
+
try {
|
|
17
|
+
if (!e.defaultView?.CSS?.supports?.("color", "light-dark(#000, #fff)")) return !1;
|
|
18
|
+
} catch {
|
|
19
|
+
return !1;
|
|
20
|
+
}
|
|
21
|
+
return t === "dark" || t !== "light" && !!e.defaultView?.matchMedia?.("(prefers-color-scheme: dark)").matches;
|
|
22
|
+
}
|
|
23
|
+
var P = (e) => `
|
|
24
|
+
${e} { display: block; position: relative; max-width: 100%; min-width: 0; box-sizing: border-box; }
|
|
25
|
+
${e}[hidden], ${e} [hidden] { display: none !important; }
|
|
26
|
+
${e} .visually-hidden {
|
|
27
|
+
position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px; padding: 0;
|
|
28
|
+
overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
|
|
29
|
+
}
|
|
30
|
+
${e} .skip-link { position: absolute; inset-inline-start: 0; inset-block-start: 0; z-index: 1100; transform: translateY(-120%); }
|
|
31
|
+
${e} .skip-link:focus-visible { transform: translateY(0); }
|
|
32
|
+
${e} .map { position: relative; block-size: ${E}; min-block-size: 12rem; box-sizing: border-box; }
|
|
33
|
+
${e} .leaflet-pane, ${e} .leaflet-tile, ${e} .leaflet-marker-icon, ${e} .leaflet-marker-shadow,
|
|
34
|
+
${e} .leaflet-tile-container, ${e} .leaflet-pane > svg, ${e} .leaflet-pane > canvas,
|
|
35
|
+
${e} .leaflet-zoom-box, ${e} .leaflet-image-layer, ${e} .leaflet-layer {
|
|
36
|
+
position: absolute; left: 0; top: 0;
|
|
37
|
+
}
|
|
38
|
+
${e} .leaflet-container { overflow: hidden; -webkit-tap-highlight-color: transparent; }
|
|
39
|
+
${e} .leaflet-tile, ${e} .leaflet-marker-icon { user-select: none; -webkit-user-drag: none; }
|
|
40
|
+
${e} .leaflet-marker-icon { display: block; }
|
|
41
|
+
${e} .leaflet-container .leaflet-tile-pane img, ${e} .leaflet-container .leaflet-tile {
|
|
42
|
+
max-width: none !important; max-height: none !important; width: auto; padding: 0;
|
|
43
|
+
}
|
|
44
|
+
${e} .leaflet-container.leaflet-touch-zoom { touch-action: pan-x pan-y; }
|
|
45
|
+
${e} .leaflet-container.leaflet-touch-drag { touch-action: pinch-zoom; }
|
|
46
|
+
${e} .leaflet-container.leaflet-touch-drag.leaflet-touch-zoom { touch-action: none; }
|
|
47
|
+
${e} .leaflet-tile { filter: inherit; visibility: hidden; }
|
|
48
|
+
${e} .leaflet-tile-loaded { visibility: inherit; }
|
|
49
|
+
${e} .leaflet-zoom-box { width: 0; height: 0; box-sizing: border-box; z-index: 800; }
|
|
50
|
+
${e} .leaflet-pane { z-index: 400; }
|
|
51
|
+
${e} .leaflet-tile-pane { z-index: 200; }
|
|
52
|
+
${e} .leaflet-overlay-pane { z-index: 400; }
|
|
53
|
+
${e} .leaflet-shadow-pane { z-index: 500; }
|
|
54
|
+
${e} .leaflet-marker-pane { z-index: 600; }
|
|
55
|
+
${e} .leaflet-tooltip-pane { z-index: 650; }
|
|
56
|
+
${e} .leaflet-popup-pane { z-index: 700; }
|
|
57
|
+
${e} .leaflet-control { position: relative; z-index: 800; pointer-events: auto; float: left; clear: both; }
|
|
58
|
+
${e} .leaflet-top, ${e} .leaflet-bottom { position: absolute; z-index: 1000; pointer-events: none; }
|
|
59
|
+
${e} .leaflet-top { top: 0; }
|
|
60
|
+
${e} .leaflet-right { right: 0; }
|
|
61
|
+
${e} .leaflet-bottom { bottom: 0; }
|
|
62
|
+
${e} .leaflet-left { left: 0; }
|
|
63
|
+
${e} .leaflet-right .leaflet-control { float: right; }
|
|
64
|
+
${e} .leaflet-top .leaflet-control { margin-top: 10px; }
|
|
65
|
+
${e} .leaflet-bottom .leaflet-control { margin-bottom: 10px; }
|
|
66
|
+
${e} .leaflet-left .leaflet-control { margin-left: 10px; }
|
|
67
|
+
${e} .leaflet-right .leaflet-control { margin-right: 10px; }
|
|
68
|
+
${e} .leaflet-control-attribution { margin: 0 !important; }
|
|
69
|
+
${e} .leaflet-zoom-animated { transform-origin: 0 0; }
|
|
70
|
+
${e} .leaflet-zoom-anim .leaflet-zoom-animated { transition: transform 0.25s cubic-bezier(0, 0, 0.25, 1); }
|
|
71
|
+
${e} .leaflet-zoom-anim .leaflet-tile, ${e} .leaflet-pan-anim .leaflet-tile { transition: none; }
|
|
72
|
+
${e} .leaflet-zoom-anim .leaflet-zoom-hide { visibility: hidden; }
|
|
73
|
+
${e} .leaflet-interactive { cursor: pointer; }
|
|
74
|
+
${e} .leaflet-grab { cursor: grab; }
|
|
75
|
+
${e} .leaflet-dragging .leaflet-grab, ${e} .leaflet-dragging .leaflet-grab .leaflet-interactive { cursor: grabbing; }
|
|
76
|
+
${e} .leaflet-marker-icon, ${e} .leaflet-tile-container { pointer-events: none; }
|
|
77
|
+
${e} .leaflet-marker-icon.leaflet-interactive { pointer-events: auto; }
|
|
78
|
+
${e} .leaflet-tooltip { position: absolute; pointer-events: none; white-space: nowrap; user-select: none; }
|
|
79
|
+
${e} .uvalib-map-marker .marker {
|
|
80
|
+
box-sizing: border-box; display: flex; align-items: center; justify-content: center;
|
|
81
|
+
inline-size: 100%; block-size: 100%; margin: 0; padding: 0; border: 0; background: none;
|
|
82
|
+
cursor: pointer; font: inherit; color: inherit;
|
|
83
|
+
}
|
|
84
|
+
${e} .uvalib-map-marker .dot { box-sizing: border-box; display: block; flex: none; inline-size: var(--d); block-size: var(--d); border-radius: 50%; }
|
|
85
|
+
${e} .uvalib-map-marker.is-group .dot { display: flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; }
|
|
86
|
+
${e} .leaflet-bar a {
|
|
87
|
+
box-sizing: border-box; display: flex !important; align-items: center; justify-content: center;
|
|
88
|
+
inline-size: 44px !important; block-size: 44px !important; line-height: 1 !important;
|
|
89
|
+
}
|
|
90
|
+
@media (prefers-reduced-motion: reduce) {
|
|
91
|
+
${e} .leaflet-zoom-anim .leaflet-zoom-animated { transition: none; }
|
|
92
|
+
}
|
|
93
|
+
@media (forced-colors: active) {
|
|
94
|
+
${e} .uvalib-map-marker .dot {
|
|
95
|
+
forced-color-adjust: none; background: Canvas !important; color: CanvasText !important; border: 3px solid CanvasText !important; box-shadow: none !important;
|
|
96
|
+
}
|
|
97
|
+
${e} .uvalib-map-marker.is-group .dot { border-style: double !important; border-width: 6px !important; }
|
|
98
|
+
${e} .uvalib-map-marker.is-active .dot { outline: 3px solid Highlight; outline-offset: 3px; }
|
|
99
|
+
${e} .uvalib-map-marker .marker:focus-visible .dot { outline: 3px solid Highlight; outline-offset: 6px; }
|
|
100
|
+
${e} .map, ${e} .map .leaflet-bar, ${e} .map .leaflet-bar a, ${e} .map .leaflet-tooltip,
|
|
101
|
+
${e} .map .leaflet-control-attribution, ${e} .place {
|
|
102
|
+
border: 1px solid CanvasText !important;
|
|
103
|
+
}
|
|
104
|
+
${e} .place.is-active { outline: 3px solid Highlight; outline-offset: 1px; }
|
|
105
|
+
${e} :is(.map, .leaflet-bar a, a, .skip-link):focus-visible { outline: 3px solid Highlight; outline-offset: 2px; }
|
|
106
|
+
}
|
|
107
|
+
`, F = o(P(":host")), I = class extends c {
|
|
108
|
+
static {
|
|
109
|
+
this.styles = [
|
|
110
|
+
p,
|
|
111
|
+
F,
|
|
112
|
+
o("\n :host { font-family: var(--uva-font-family, inherit); color: var(--uva-color-text, #2b2b2b); }\n .instructions {\n margin: 0 0 0.5rem;\n font-size: 0.875rem;\n line-height: 1.5;\n color: var(--uva-color-text-muted, #4b5563);\n }\n .map {\n border: 1px solid var(--uva-color-control-border, #808080);\n border-radius: 4px;\n background: var(--uva-color-track, #e5e7eb) !important;\n font-family: inherit !important;\n font-size: 1rem !important;\n line-height: 1.5 !important;\n }\n .map:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n .dark-tiles .leaflet-tile-pane {\n filter: var(--uvalib-map-dark-filter, invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9));\n }\n .uvalib-map-marker .dot {\n background: var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n border: 2px solid var(--uva-color-on-accent, #fff);\n box-shadow: 0 0 0 1px var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n transition: transform 0.15s ease, box-shadow 0.15s ease;\n }\n /* A group: its number of places, and a second ring (not colour alone). */\n .uvalib-map-marker.is-group .dot {\n color: var(--uva-color-on-accent, #fff);\n font-family: var(--uva-font-family, system-ui, sans-serif);\n font-size: 0.875rem;\n box-shadow:\n 0 0 0 1px var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b)),\n 0 0 0 3px var(--uva-color-on-accent, #fff),\n 0 0 0 5px var(--uva-color-accent-bg, var(--uva-brand-blue, #232d4b));\n }\n .uvalib-map-marker.is-active .dot {\n transform: scale(1.25);\n box-shadow:\n 0 0 0 3px var(--uva-color-surface, #fff),\n 0 0 0 6px var(--uva-color-text, #2b2b2b);\n }\n .uvalib-map-marker .marker:focus-visible { outline: none; }\n .uvalib-map-marker .marker:focus-visible .dot {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 6px;\n }\n .leaflet-bar {\n border: 1px solid var(--uva-color-control-border, #808080) !important;\n border-radius: 4px !important;\n background: var(--uva-color-surface-raised, #fff) !important;\n box-shadow: 0 1px 4px var(--uva-color-shadow, rgba(0, 0, 0, 0.2)) !important;\n }\n .leaflet-bar a {\n border: 0 !important;\n border-radius: 0 !important;\n background: var(--uva-color-surface-raised, #fff) !important;\n color: var(--uva-color-text, #2b2b2b) !important;\n font: 600 1.5rem/1 var(--uva-font-family, system-ui, sans-serif) !important;\n text-decoration: none !important;\n }\n .leaflet-bar a:first-child { border-radius: 3px 3px 0 0 !important; }\n .leaflet-bar a:last-child { border-radius: 0 0 3px 3px !important; }\n .leaflet-bar a + a { border-block-start: 1px solid var(--uva-color-control-border, #808080) !important; }\n .leaflet-bar a:hover { background: var(--uva-color-surface-hover, #dadada) !important; }\n .leaflet-bar a.leaflet-disabled {\n background: var(--uva-color-track, #e5e7eb) !important;\n color: var(--uva-color-text-muted, #4b5563) !important;\n cursor: not-allowed;\n }\n .leaflet-bar a:focus-visible { position: relative; z-index: 1; }\n .leaflet-control-attribution {\n padding: 0.125rem 0.375rem !important;\n background: var(--uva-color-surface, #fff) !important;\n color: var(--uva-color-text, #2b2b2b) !important;\n font-size: 0.8125rem !important;\n line-height: 1.5 !important;\n }\n .leaflet-control-attribution a {\n color: var(--uva-color-link, var(--uva-brand-blue, #232d4b)) !important;\n text-decoration: underline !important;\n }\n .leaflet-tooltip {\n padding: 0.25rem 0.5rem !important;\n border: 1px solid var(--uva-color-control-border, #808080) !important;\n border-radius: 4px !important;\n background: var(--uva-color-surface-raised, #fff) !important;\n color: var(--uva-color-text, #2b2b2b) !important;\n box-shadow: 0 1px 4px var(--uva-color-shadow, rgba(0, 0, 0, 0.2)) !important;\n font-size: 0.875rem !important;\n line-height: 1.4 !important;\n }\n .leaflet-tooltip::before { display: none !important; }\n .tip-name { display: block; font-weight: 600; }\n .tip-note { display: block; }\n .places {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));\n gap: 0.5rem;\n margin: 1rem 0 0;\n padding: 0;\n list-style: none;\n }\n .places:focus { outline: none; }\n .places:focus-visible {\n outline: 3px solid var(--uva-color-focus, var(--uva-brand-orange, #e57200));\n outline-offset: 2px;\n }\n .place {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n gap: 0.25rem 0.5rem;\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--uva-color-control-border, #808080);\n border-radius: 4px;\n background: var(--uva-color-surface-raised, #fff);\n color: var(--uva-color-text, #2b2b2b);\n }\n .place.is-active {\n outline: 3px solid var(--uva-color-text, #2b2b2b);\n outline-offset: 1px;\n }\n .place a, .place .name {\n display: inline-block;\n min-block-size: 24px;\n font-weight: 600;\n line-height: 1.5;\n }\n .place a { color: var(--uva-color-link, var(--uva-brand-blue, #232d4b)); text-decoration: underline; }\n .count {\n padding: 0 0.5rem;\n border: 1px solid var(--uva-color-control-border, #808080);\n border-radius: 999px;\n background: var(--uva-color-track, #e5e7eb);\n color: var(--uva-color-text, #2b2b2b);\n font-size: 0.875rem;\n white-space: nowrap;\n }\n .description {\n flex-basis: 100%;\n font-size: 0.875rem;\n color: var(--uva-color-text-muted, #4b5563);\n }\n @media (prefers-reduced-motion: reduce) {\n .uvalib-map-marker .dot { transition: none; }\n }\n ")
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
constructor() {
|
|
116
|
+
super(), this.items = [], this.label = "", this.countLabel = "items", this.placeLabel = "places", this.tileUrl = g, this.darkTileUrl = "", this.attribution = _, this.center = "", this.sourceItems = [], this.hasLeaflet = !1, this.active = "", this.dark = !1, this.uid = `uvalib-map-${++O}`, this.sourceKey = "[]", this.markers = [], this.dots = [], this.maxCount = 0, this.groups = /* @__PURE__ */ new Map(), this.groupOf = /* @__PURE__ */ new Map(), this.ring = "", this.order = [], this.drawn = [], this.reduceMotion = !1, this.userMoved = !1, this.fitting = !1, this.hoverKey = "", this.focusKey = "", this.dismissed = !1, this.warnedLabel = !1, this.warnedLeaflet = !1, this.onPageLoad = () => this.requestUpdate(), this.readScheme = () => {
|
|
117
|
+
this.dark = N(this.ownerDocument);
|
|
118
|
+
}, this.onMapClick = (e) => {
|
|
119
|
+
if (e.target.closest?.(".leaflet-control-zoom a")) {
|
|
120
|
+
this.queueZoomReport();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
let t = this.targetOf(e);
|
|
124
|
+
if (!t) return;
|
|
125
|
+
let n = this.map?.dragging;
|
|
126
|
+
if (e.detail !== 0 && n?.moved?.()) {
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (t.startsWith("g:")) {
|
|
131
|
+
this.expand(t.slice(2));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
let r = Number(t), i = this.places[r];
|
|
135
|
+
i && (l(this, [
|
|
136
|
+
h,
|
|
137
|
+
"select",
|
|
138
|
+
this.label,
|
|
139
|
+
r + 1
|
|
140
|
+
]), this.dispatchEvent(new CustomEvent("select", {
|
|
141
|
+
detail: { item: i },
|
|
142
|
+
bubbles: !0,
|
|
143
|
+
composed: !0,
|
|
144
|
+
cancelable: !0
|
|
145
|
+
})) || e.preventDefault());
|
|
146
|
+
}, this.onMapKeydown = (e) => {
|
|
147
|
+
let t = e.target;
|
|
148
|
+
if (e.key === " " && t.closest?.(".leaflet-control-zoom a")) {
|
|
149
|
+
e.preventDefault(), t.closest("a").click();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
let n = t.closest?.(".marker");
|
|
153
|
+
if (!n) return;
|
|
154
|
+
if (e.key === "Escape" && this.ring) {
|
|
155
|
+
let t = this.keyOf(n), r = this.groups.get(this.ring);
|
|
156
|
+
if (r && (t === `g:${r.key}` || r.members.includes(Number(t)))) {
|
|
157
|
+
e.preventDefault(), e.stopPropagation(), this.unring(), this.regroup();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
let r = this.order, i = r.indexOf(n), a;
|
|
162
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") a = r[i + 1];
|
|
163
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp") a = i > 0 ? r[i - 1] : void 0;
|
|
164
|
+
else if (e.key === "Home") a = r[0];
|
|
165
|
+
else if (e.key === "End") a = r[r.length - 1];
|
|
166
|
+
else if (e.key === " " && t.localName === "a") {
|
|
167
|
+
e.preventDefault(), t.click();
|
|
168
|
+
return;
|
|
169
|
+
} else return;
|
|
170
|
+
e.preventDefault(), e.stopPropagation(), a && (this.reveal(this.keyOf(a)), a.focus());
|
|
171
|
+
}, this.onMapFocusIn = (e) => {
|
|
172
|
+
let t = this.targetOf(e);
|
|
173
|
+
t && (this.focusKey = t, this.dismissed = !1, this.reveal(t), this.syncActive());
|
|
174
|
+
}, this.onMapFocusOut = (e) => {
|
|
175
|
+
this.targetOf(e) && (e.relatedTarget?.closest?.(".marker") || (this.focusKey = "", this.syncActive()));
|
|
176
|
+
}, this.onMapLeave = () => {
|
|
177
|
+
this.hoverKey = "", this.syncActive();
|
|
178
|
+
}, this.skipToList = (e) => {
|
|
179
|
+
e.preventDefault(), this.renderRoot.querySelector(`#${this.uid}-list`)?.focus();
|
|
180
|
+
}, new f(this, () => this.lightDom, (e) => this.readList(e)), this.addEventListener("keydown", (e) => {
|
|
181
|
+
e.key === "Escape" && this.active && (this.dismissed = !0, this.syncActive());
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
createRenderRoot() {
|
|
185
|
+
let e = super.createRenderRoot();
|
|
186
|
+
if (e instanceof ShadowRoot && this.noStyle) {
|
|
187
|
+
let t = F.styleSheet;
|
|
188
|
+
t && (e.adoptedStyleSheets = [t]);
|
|
189
|
+
}
|
|
190
|
+
return e;
|
|
191
|
+
}
|
|
192
|
+
connectedCallback() {
|
|
193
|
+
if (super.connectedCallback(), this.lightDom && this.noStyle) {
|
|
194
|
+
let e = this.getRootNode();
|
|
195
|
+
s(`${this.localName}::structure`, o(P(this.localName)), {
|
|
196
|
+
root: e instanceof ShadowRoot || e instanceof Document ? e : void 0,
|
|
197
|
+
scope: !1
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
let e = this.ownerDocument;
|
|
201
|
+
this.schemeObserver = new MutationObserver(() => this.readScheme()), this.schemeObserver.observe(e.documentElement, {
|
|
202
|
+
attributes: !0,
|
|
203
|
+
attributeFilter: ["data-uva-color-scheme"]
|
|
204
|
+
}), this.darkQuery = e.defaultView?.matchMedia?.("(prefers-color-scheme: dark)"), this.darkQuery?.addEventListener("change", this.readScheme), this.readScheme(), e.readyState !== "complete" && e.defaultView?.addEventListener("load", this.onPageLoad, { once: !0 }), this.hasUpdated && this.requestUpdate();
|
|
205
|
+
}
|
|
206
|
+
disconnectedCallback() {
|
|
207
|
+
super.disconnectedCallback(), this.ownerDocument.defaultView?.removeEventListener("load", this.onPageLoad), this.schemeObserver?.disconnect(), this.darkQuery?.removeEventListener("change", this.readScheme), this.teardown();
|
|
208
|
+
}
|
|
209
|
+
get places() {
|
|
210
|
+
return this.items?.length ? this.items : this.sourceItems;
|
|
211
|
+
}
|
|
212
|
+
readList(e) {
|
|
213
|
+
let t = e.find((e) => e instanceof Element && (e.localName === "ul" || e.localName === "ol")), n = [];
|
|
214
|
+
for (let e of t ? [...t.children] : []) {
|
|
215
|
+
if (e.localName !== "li") continue;
|
|
216
|
+
let t = e.matches("[data-lat]") ? e : e.querySelector("[data-lat]");
|
|
217
|
+
if (!t) continue;
|
|
218
|
+
let r = e.querySelector("a[href]"), i = t.dataset, a = {
|
|
219
|
+
name: u((r ?? t).textContent),
|
|
220
|
+
lat: Number(i.lat),
|
|
221
|
+
lng: Number(i.lng)
|
|
222
|
+
}, o = i.id ?? (e.id || void 0);
|
|
223
|
+
o && (a.id = o), i.count !== void 0 && i.count.trim() !== "" && Number.isFinite(Number(i.count)) && (a.count = Number(i.count));
|
|
224
|
+
let s = r?.getAttribute("href");
|
|
225
|
+
s && (a.href = s);
|
|
226
|
+
let c = i.description ?? e.dataset.description;
|
|
227
|
+
c && (a.description = u(c)), n.push(a);
|
|
228
|
+
}
|
|
229
|
+
let r = JSON.stringify(n);
|
|
230
|
+
r !== this.sourceKey && (this.sourceKey = r, this.sourceItems = n);
|
|
231
|
+
}
|
|
232
|
+
findLeaflet() {
|
|
233
|
+
let e = (e) => !!e && typeof e.map == "function" && typeof e.divIcon == "function" && typeof e.tileLayer == "function", t = this.leaflet, n = this.ownerDocument.defaultView;
|
|
234
|
+
for (let r of [
|
|
235
|
+
t,
|
|
236
|
+
t?.default,
|
|
237
|
+
n?.L
|
|
238
|
+
]) if (e(r)) return r;
|
|
239
|
+
}
|
|
240
|
+
willUpdate(e) {
|
|
241
|
+
let t = this.findLeaflet();
|
|
242
|
+
t !== this.L && (this.map && this.teardown(), this.L = t), this.hasLeaflet = !!t, e.has("label") && !this.label.trim() && !this.warnedLabel && (this.warnedLabel = !0, console.warn(`<${h}>: label is required; it names the map region and the list.`));
|
|
243
|
+
}
|
|
244
|
+
updated(e) {
|
|
245
|
+
if (super.updated(e), !this.L) {
|
|
246
|
+
!this.warnedLeaflet && this.ownerDocument.readyState === "complete" && (this.warnedLeaflet = !0, setTimeout(() => {
|
|
247
|
+
this.isConnected && !this.findLeaflet() && console.warn(`<${h}>: Leaflet was not found (set the leaflet property, or load leaflet.js for window.L); showing the list only.`);
|
|
248
|
+
}, 1e3));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
let t = this.setUpMap();
|
|
252
|
+
this.map && (!t && (e.has("tileUrl") || e.has("darkTileUrl") || e.has("attribution") || e.has("dark")) && this.drawTiles(), t || this.places !== this.drawn || e.has("countLabel") || e.has("placeLabel") ? (this.drawMarkers(), (t || !this.userMoved) && this.fit(), this.regroup()) : (e.has("center") || e.has("zoom")) && this.fit(), e.has("active") && this.showActive());
|
|
253
|
+
}
|
|
254
|
+
get container() {
|
|
255
|
+
return this.renderRoot.querySelector(`#${this.uid}-map`);
|
|
256
|
+
}
|
|
257
|
+
setUpMap() {
|
|
258
|
+
let e = this.L, t = this.container;
|
|
259
|
+
if (!e || !t || this.map) return !1;
|
|
260
|
+
let n = this.ownerDocument.defaultView;
|
|
261
|
+
this.reduceMotion = !!n?.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
262
|
+
let r = !this.reduceMotion, i = e.map(t, {
|
|
263
|
+
zoomControl: !1,
|
|
264
|
+
attributionControl: !1,
|
|
265
|
+
scrollWheelZoom: !1,
|
|
266
|
+
zoomAnimation: r,
|
|
267
|
+
fadeAnimation: r,
|
|
268
|
+
markerZoomAnimation: r,
|
|
269
|
+
inertia: r,
|
|
270
|
+
keyboard: !0,
|
|
271
|
+
zoomSnap: .5
|
|
272
|
+
});
|
|
273
|
+
return this.map = i, e.control.zoom({ position: "topleft" }).addTo(i), e.control.attribution({
|
|
274
|
+
position: "bottomright",
|
|
275
|
+
prefix: "<a href=\"https://leafletjs.com\">Leaflet</a>"
|
|
276
|
+
}).addTo(i), this.tooltip = e.tooltip({
|
|
277
|
+
direction: "top",
|
|
278
|
+
opacity: 1,
|
|
279
|
+
className: "uvalib-map-tooltip"
|
|
280
|
+
}), i.on("movestart", () => {
|
|
281
|
+
this.fitting || (this.userMoved = !0);
|
|
282
|
+
}), i.on("zoomstart", () => {
|
|
283
|
+
this.ring && (this.unring(), this.regroup());
|
|
284
|
+
}), i.on("zoomend", () => this.regroup()), this.drawTiles(), this.ro = new ResizeObserver(() => {
|
|
285
|
+
this.map && (this.map.invalidateSize({ animate: !1 }), this.userMoved || this.fit(), this.regroup());
|
|
286
|
+
}), this.ro.observe(t), !0;
|
|
287
|
+
}
|
|
288
|
+
teardown() {
|
|
289
|
+
clearTimeout(this.zoomTimer), this.ro?.disconnect(), this.ro = void 0, this.map?.remove(), this.map = void 0, this.tiles = void 0, this.tooltip = void 0, this.markers = [], this.groups.clear(), this.groupOf.clear(), this.ring = "", this.order = [], this.activeIcon = void 0, this.drawn = [], this.userMoved = !1;
|
|
290
|
+
}
|
|
291
|
+
drawTiles() {
|
|
292
|
+
let { L: e, map: t } = this;
|
|
293
|
+
if (!e || !t) return;
|
|
294
|
+
let n = this.dark && this.darkTileUrl ? this.darkTileUrl : this.tileUrl || "https://tile.openstreetmap.org/{z}/{x}/{y}.png";
|
|
295
|
+
this.tiles?.remove(), this.tiles = e.tileLayer(n, {
|
|
296
|
+
attribution: this.attribution,
|
|
297
|
+
maxZoom: 19
|
|
298
|
+
}).addTo(t);
|
|
299
|
+
}
|
|
300
|
+
dotSize(e, t) {
|
|
301
|
+
return !(t > 0) || e === void 0 || !(e > 0) ? y : Math.round(y + 32 * Math.sqrt(e / t));
|
|
302
|
+
}
|
|
303
|
+
placeName(e) {
|
|
304
|
+
return e.count === void 0 ? e.name : `${e.name}, ${this.countText(e.count)}`;
|
|
305
|
+
}
|
|
306
|
+
countText(e) {
|
|
307
|
+
return `${k(e)} ${A(this.countLabel || "items", e)}`;
|
|
308
|
+
}
|
|
309
|
+
href(e) {
|
|
310
|
+
return e.href && d(e.href, this.ownerDocument.baseURI) ? e.href : null;
|
|
311
|
+
}
|
|
312
|
+
groupDot(e) {
|
|
313
|
+
let t = this.maxCount;
|
|
314
|
+
if (!(t > 0) || !(e > 0)) return w;
|
|
315
|
+
let n = Math.round(y + 32 * Math.sqrt(e / t));
|
|
316
|
+
return Math.min(T, Math.max(w, n));
|
|
317
|
+
}
|
|
318
|
+
groupName(e) {
|
|
319
|
+
let t = e.length - 1;
|
|
320
|
+
return `${this.places[e[0]].name} and ${k(t)} more ${A(this.placeLabel || "places", t)}`;
|
|
321
|
+
}
|
|
322
|
+
hitOf(e) {
|
|
323
|
+
return e.length === 1 ? Math.max(x, this.dots[e[0]] ?? y) : Math.max(x, this.groupDot(e.reduce((e, t) => e + m(this.places[t]), 0)));
|
|
324
|
+
}
|
|
325
|
+
makeMarker(e, t, n, r) {
|
|
326
|
+
let i = this.L, a = Math.max(x, n);
|
|
327
|
+
return i.marker(e, {
|
|
328
|
+
icon: i.divIcon({
|
|
329
|
+
className: r,
|
|
330
|
+
html: t,
|
|
331
|
+
iconSize: [a, a],
|
|
332
|
+
iconAnchor: [a / 2, a / 2]
|
|
333
|
+
}),
|
|
334
|
+
keyboard: !1,
|
|
335
|
+
zIndexOffset: (b - n) * 10
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
makeControl(e, t, n, r = "") {
|
|
339
|
+
let i = this.ownerDocument, a = i.createElement(e);
|
|
340
|
+
a instanceof HTMLButtonElement && (a.type = "button"), a.className = "marker", a.style.setProperty("--d", `${t}px`);
|
|
341
|
+
let o = i.createElement("span");
|
|
342
|
+
o.className = "dot", o.setAttribute("aria-hidden", "true"), o.textContent = r;
|
|
343
|
+
let s = i.createElement("span");
|
|
344
|
+
return s.className = "visually-hidden", s.textContent = n, a.append(o, s), a;
|
|
345
|
+
}
|
|
346
|
+
drawMarkers() {
|
|
347
|
+
let { L: e, map: t } = this;
|
|
348
|
+
if (!e || !t) return;
|
|
349
|
+
for (let e of this.markers) e?.remove();
|
|
350
|
+
for (let e of this.groups.values()) e.marker.remove();
|
|
351
|
+
this.groups.clear(), this.groupOf.clear(), this.ring = "", this.order = [], this.activeIcon = void 0;
|
|
352
|
+
let n = this.places;
|
|
353
|
+
this.drawn = n, this.maxCount = Math.max(0, ...n.map(m)), this.dots = n.map((e) => this.dotSize(e.count, this.maxCount)), this.markers = n.map((e, t) => {
|
|
354
|
+
if (!j(e)) return;
|
|
355
|
+
let n = this.dots[t], r = this.href(e), i = this.makeControl(r ? "a" : "button", n, this.placeName(e));
|
|
356
|
+
i instanceof HTMLAnchorElement && (i.href = r), i.dataset.index = String(t);
|
|
357
|
+
let a = this.makeMarker([e.lat, e.lng], i, n, "uvalib-map-marker");
|
|
358
|
+
return a.on("mouseover", () => this.hover(String(t))), a;
|
|
359
|
+
}), this.hoverKey = "", this.focusKey = "", this.active &&= "";
|
|
360
|
+
}
|
|
361
|
+
cluster(e, t) {
|
|
362
|
+
let n = this.map, r = this.places, i = (e, t) => m(r[t]) - m(r[e]) || e - t, a = new Map(e.map((e) => [e, n.project([r[e].lat, r[e].lng], t)])), o = (e, t) => {
|
|
363
|
+
let n = a.get(e[0]), r = a.get(t[0]), i = (this.hitOf(e) + this.hitOf(t)) / 2 + S;
|
|
364
|
+
return Math.abs(n.x - r.x) < i && Math.abs(n.y - r.y) < i;
|
|
365
|
+
}, s = [...e].sort(i), c = [], l = /* @__PURE__ */ new Set();
|
|
366
|
+
for (let e of s) {
|
|
367
|
+
if (l.has(e)) continue;
|
|
368
|
+
let t = [e];
|
|
369
|
+
l.add(e);
|
|
370
|
+
for (let n of s) !l.has(n) && o([e], [n]) && (t.push(n), l.add(n));
|
|
371
|
+
c.push(t);
|
|
372
|
+
}
|
|
373
|
+
for (let e = !0; e;) {
|
|
374
|
+
e = !1;
|
|
375
|
+
for (let t = 0; t < c.length && !e; t++) for (let n = t + 1; n < c.length && !e; n++) o(c[t], c[n]) && (c[t] = [...c[t], ...c[n]].sort(i), c.splice(n, 1), e = !0);
|
|
376
|
+
}
|
|
377
|
+
return c;
|
|
378
|
+
}
|
|
379
|
+
makeGroup(e, t) {
|
|
380
|
+
let n = this.places, r = n[t[0]], i = t.reduce((e, t) => e + m(n[t]), 0), a = t.some((e) => Number.isFinite(n[e].count)), o = this.groupDot(i), s = this.groupName(t), c = this.makeControl("button", o, a ? `${s}, ${this.countText(i)}` : s, String(t.length));
|
|
381
|
+
c.dataset.group = e;
|
|
382
|
+
let l = this.makeMarker([r.lat, r.lng], c, o, "uvalib-map-marker is-group");
|
|
383
|
+
return l.on("mouseover", () => this.hover(`g:${e}`)), {
|
|
384
|
+
key: e,
|
|
385
|
+
members: t,
|
|
386
|
+
marker: l,
|
|
387
|
+
ctl: c,
|
|
388
|
+
d: o,
|
|
389
|
+
sum: i,
|
|
390
|
+
counted: a
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
focusedControl() {
|
|
394
|
+
let e = this.renderRoot, t = (e instanceof ShadowRoot ? e.activeElement : this.ownerDocument.activeElement)?.closest?.(".marker");
|
|
395
|
+
return t && this.container?.contains(t) ? t : null;
|
|
396
|
+
}
|
|
397
|
+
regroup() {
|
|
398
|
+
let { map: e } = this;
|
|
399
|
+
if (!e || !e._loaded) return;
|
|
400
|
+
let t = this.focusedControl(), n = t ? this.keyOf(t) : "", r = n.startsWith("g:") ? this.groups.get(n.slice(2))?.members[0] ?? -1 : n ? Number(n) : -1, i = this.markers.flatMap((e, t) => e ? [t] : []), a = /* @__PURE__ */ new Map();
|
|
401
|
+
this.groupOf.clear();
|
|
402
|
+
for (let t of this.cluster(i, e.getZoom())) {
|
|
403
|
+
if (t.length < 2) continue;
|
|
404
|
+
let e = [...t].sort((e, t) => e - t).join(",");
|
|
405
|
+
a.set(e, this.groups.get(e) ?? this.makeGroup(e, t));
|
|
406
|
+
for (let n of t) this.groupOf.set(n, e);
|
|
407
|
+
}
|
|
408
|
+
for (let [e, t] of this.groups) a.has(e) || t.marker.remove();
|
|
409
|
+
this.ring && !a.has(this.ring) && this.unring(), this.groups = a;
|
|
410
|
+
let o = [], s = /* @__PURE__ */ new Set();
|
|
411
|
+
for (let e of i) this.groupOf.has(e) || (s.add(e), o.push({
|
|
412
|
+
first: e,
|
|
413
|
+
list: [this.spot(e)]
|
|
414
|
+
}));
|
|
415
|
+
for (let e of a.values()) {
|
|
416
|
+
let t = [{
|
|
417
|
+
marker: e.marker,
|
|
418
|
+
ctl: e.ctl
|
|
419
|
+
}];
|
|
420
|
+
if (this.ring === e.key) for (let n of e.members) s.add(n), t.push(this.spot(n));
|
|
421
|
+
o.push({
|
|
422
|
+
first: Number(e.key.split(",")[0]),
|
|
423
|
+
list: t
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
o.sort((e, t) => e.first - t.first);
|
|
427
|
+
let c = /* @__PURE__ */ new Set();
|
|
428
|
+
for (let t of i) {
|
|
429
|
+
let n = this.markers[t];
|
|
430
|
+
s.has(t) && !e.hasLayer(n) ? (n.addTo(e), c.add(n.getElement())) : !s.has(t) && e.hasLayer(n) && n.remove();
|
|
431
|
+
}
|
|
432
|
+
for (let t of a.values()) e.hasLayer(t.marker) || (t.marker.addTo(e), c.add(t.marker.getElement()));
|
|
433
|
+
let l = o.flatMap((e) => e.list), u = l.map((e) => e.marker.getElement());
|
|
434
|
+
for (let e = u.length - 2; e >= 0; e--) c.has(u[e]) && u[e + 1].before(u[e]);
|
|
435
|
+
this.order = l.map((e) => e.ctl);
|
|
436
|
+
for (let e of a.values()) this.ring === e.key ? e.ctl.setAttribute("aria-expanded", "true") : e.ctl.removeAttribute("aria-expanded");
|
|
437
|
+
t && !t.isConnected && r >= 0 && (s.has(r) ? this.spot(r).ctl : a.get(this.groupOf.get(r) ?? "")?.ctl)?.focus({ preventScroll: !0 });
|
|
438
|
+
let d = (e) => e.startsWith("g:") && !a.has(e.slice(2));
|
|
439
|
+
d(this.hoverKey) && (this.hoverKey = ""), d(this.focusKey) && (this.focusKey = ""), this.syncActive(), this.showActive();
|
|
440
|
+
}
|
|
441
|
+
spot(e) {
|
|
442
|
+
let t = this.markers[e];
|
|
443
|
+
return {
|
|
444
|
+
marker: t,
|
|
445
|
+
ctl: t.options.icon.options.html
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
splitZoom(e) {
|
|
449
|
+
let t = this.map, n = t.options.zoomSnap || 1, r = t.getMaxZoom();
|
|
450
|
+
for (let i = t.getZoom() + n; i <= r + 1e-9; i += n) if (this.cluster(e, i).length > 1) return i;
|
|
451
|
+
}
|
|
452
|
+
expand(e) {
|
|
453
|
+
let { L: t, map: n } = this, r = this.groups.get(e);
|
|
454
|
+
if (!t || !n || !r) return;
|
|
455
|
+
if (this.ring === e) {
|
|
456
|
+
this.unring(), this.regroup();
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
l(this, [
|
|
460
|
+
h,
|
|
461
|
+
"expand",
|
|
462
|
+
this.label,
|
|
463
|
+
r.members.length
|
|
464
|
+
]);
|
|
465
|
+
let i = this.splitZoom(r.members);
|
|
466
|
+
if (i === void 0) {
|
|
467
|
+
this.spread(r);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
let a = t.latLngBounds(r.members.map((e) => [this.places[e].lat, this.places[e].lng]));
|
|
471
|
+
n.setView(a.getCenter(), i, { animate: !this.reduceMotion });
|
|
472
|
+
}
|
|
473
|
+
spread(e) {
|
|
474
|
+
let t = this.map;
|
|
475
|
+
this.ring && this.unring();
|
|
476
|
+
let n = t.getZoom(), r = t.project(e.marker.getLatLng(), n), i = Math.max(...e.members.map((e) => Math.max(x, this.dots[e] ?? y))), a = e.members.length, o = Math.ceil(Math.max((i + C) * Math.SQRT2 / (2 * Math.sin(Math.PI / a)), ((Math.max(x, e.d) + i) / 2 + C) * Math.SQRT2));
|
|
477
|
+
e.members.forEach((e, i) => {
|
|
478
|
+
let s = -Math.PI / 2 + 2 * Math.PI * i / a;
|
|
479
|
+
this.markers[e].setLatLng(t.unproject(r.add([o * Math.cos(s), o * Math.sin(s)]), n));
|
|
480
|
+
}), this.ring = e.key, this.regroup();
|
|
481
|
+
let s = t.getSize(), c = o + i / 2 + 8, l = t.latLngToContainerPoint(e.marker.getLatLng());
|
|
482
|
+
(l.x < c || l.y < c || l.x > s.x - c || l.y > s.y - c) && t.panTo(e.marker.getLatLng(), { animate: !this.reduceMotion }), this.spot(e.members[0]).ctl.focus();
|
|
483
|
+
}
|
|
484
|
+
unring() {
|
|
485
|
+
let e = this.groups.get(this.ring);
|
|
486
|
+
for (let t of e?.members ?? []) {
|
|
487
|
+
let e = this.places[t];
|
|
488
|
+
e && this.markers[t]?.setLatLng([e.lat, e.lng]);
|
|
489
|
+
}
|
|
490
|
+
this.ring = "";
|
|
491
|
+
}
|
|
492
|
+
fit() {
|
|
493
|
+
let { L: e, map: t } = this;
|
|
494
|
+
if (!e || !t) return;
|
|
495
|
+
let n = this.places.filter(j).map((t) => e.latLng(t.lat, t.lng)), r = M(this.center), i = Number.isFinite(this.zoom) ? this.zoom : void 0;
|
|
496
|
+
this.fitting = !0;
|
|
497
|
+
try {
|
|
498
|
+
if (r) t.setView(r, i ?? 16, { animate: !1 });
|
|
499
|
+
else if (n.length === 1) t.setView(n[0], i ?? 16, { animate: !1 });
|
|
500
|
+
else if (n.length && i !== void 0) t.setView(e.latLngBounds(n).getCenter(), i, { animate: !1 });
|
|
501
|
+
else if (n.length) {
|
|
502
|
+
let r = e.latLngBounds(n);
|
|
503
|
+
t.fitBounds(r, {
|
|
504
|
+
padding: [32, 32],
|
|
505
|
+
maxZoom: 17,
|
|
506
|
+
animate: !1
|
|
507
|
+
}), this.underControls(n) && t.fitBounds(r, {
|
|
508
|
+
paddingTopLeft: [80, 40],
|
|
509
|
+
paddingBottomRight: [40, 40],
|
|
510
|
+
maxZoom: 17,
|
|
511
|
+
animate: !1
|
|
512
|
+
});
|
|
513
|
+
} else t.setView(v, 15, { animate: !1 });
|
|
514
|
+
} finally {
|
|
515
|
+
this.fitting = !1;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
underControls(e) {
|
|
519
|
+
let t = this.map, n = t.getContainer().getBoundingClientRect(), r = [...t.getContainer().querySelectorAll(".leaflet-control-zoom, .leaflet-control-attribution")].map((e) => e.getBoundingClientRect());
|
|
520
|
+
return e.some((e) => {
|
|
521
|
+
let i = t.latLngToContainerPoint(e), [a, o] = [i.x + n.left, i.y + n.top];
|
|
522
|
+
return r.some((e) => e.width > 0 && a >= e.left - 12 && a <= e.right + 12 && o >= e.top - 12 && o <= e.bottom + 12);
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
markerFor(e) {
|
|
526
|
+
if (e.startsWith("g:")) {
|
|
527
|
+
let t = this.groups.get(e.slice(2));
|
|
528
|
+
return t && {
|
|
529
|
+
marker: t.marker,
|
|
530
|
+
group: t
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
let t = Number(e), n = this.markers[t];
|
|
534
|
+
if (!n || !this.map) return;
|
|
535
|
+
if (this.map.hasLayer(n)) return { marker: n };
|
|
536
|
+
let r = this.groups.get(this.groupOf.get(t) ?? "");
|
|
537
|
+
return r && {
|
|
538
|
+
marker: r.marker,
|
|
539
|
+
group: r
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
hover(e) {
|
|
543
|
+
this.hoverKey = e, this.dismissed = !1, this.syncActive();
|
|
544
|
+
}
|
|
545
|
+
syncActive() {
|
|
546
|
+
this.active = this.dismissed ? "" : this.hoverKey || this.focusKey;
|
|
547
|
+
}
|
|
548
|
+
showActive() {
|
|
549
|
+
let { map: e, tooltip: t } = this;
|
|
550
|
+
if (!e || !t) return;
|
|
551
|
+
let n = this.activeIcon;
|
|
552
|
+
n && (n.marker.getElement()?.classList.remove("is-active"), n.marker.setZIndexOffset(n.z), this.activeIcon = void 0);
|
|
553
|
+
let r = this.active, i = r ? this.markerFor(r) : void 0, a = i?.marker.getElement();
|
|
554
|
+
if (!i || !a) {
|
|
555
|
+
t.remove();
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
let o = i.group, s = i.marker === this.markers[Number(r)] ? this.dots[Number(r)] ?? y : o?.d ?? y;
|
|
559
|
+
a.classList.add("is-active"), this.activeIcon = {
|
|
560
|
+
marker: i.marker,
|
|
561
|
+
z: (b - s) * 10
|
|
562
|
+
}, i.marker.setZIndexOffset(1e4);
|
|
563
|
+
let c = this.ownerDocument, l = c.createElement("span"), u = c.createElement("span");
|
|
564
|
+
if (u.className = "tip-name", l.append(u), r.startsWith("g:") && o) u.textContent = this.groupName(o.members), o.counted && l.append(this.countText(o.sum));
|
|
565
|
+
else {
|
|
566
|
+
let e = this.places[Number(r)];
|
|
567
|
+
if (u.textContent = e.name, e.count !== void 0 && l.append(this.countText(e.count)), o) {
|
|
568
|
+
let e = c.createElement("span");
|
|
569
|
+
e.className = "tip-note", e.textContent = `One of ${k(o.members.length)} ${this.placeLabel || "places"} here`, l.append(e);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
let d = Math.max(x, s);
|
|
573
|
+
t.options.offset = [0, -Math.round(d * .6)], t.setLatLng(i.marker.getLatLng()).setContent(l), e.hasLayer(t) ? t.update() : t.addTo(e);
|
|
574
|
+
}
|
|
575
|
+
reveal(e) {
|
|
576
|
+
let { map: t } = this, n = this.markerFor(e);
|
|
577
|
+
if (!t || !n) return;
|
|
578
|
+
let r = n.marker.getLatLng();
|
|
579
|
+
t.getBounds().pad(-.15).contains(r) || t.panTo(r, { animate: !this.reduceMotion });
|
|
580
|
+
}
|
|
581
|
+
keyOf(e) {
|
|
582
|
+
return e.dataset.group === void 0 ? e.dataset.index ?? "" : `g:${e.dataset.group}`;
|
|
583
|
+
}
|
|
584
|
+
targetOf(e) {
|
|
585
|
+
let t = e.target?.closest?.(".marker");
|
|
586
|
+
return t ? this.keyOf(t) : "";
|
|
587
|
+
}
|
|
588
|
+
queueZoomReport() {
|
|
589
|
+
clearTimeout(this.zoomTimer), this.zoomTimer = setTimeout(() => {
|
|
590
|
+
this.map && l(this, [
|
|
591
|
+
h,
|
|
592
|
+
"zoom",
|
|
593
|
+
this.label,
|
|
594
|
+
this.map.getZoom()
|
|
595
|
+
]);
|
|
596
|
+
}, 1e3);
|
|
597
|
+
}
|
|
598
|
+
onPlaceEnter(e) {
|
|
599
|
+
this.hover(String(e));
|
|
600
|
+
}
|
|
601
|
+
onPlaceLeave() {
|
|
602
|
+
this.hoverKey = "", this.syncActive();
|
|
603
|
+
}
|
|
604
|
+
onPlaceFocusIn(e) {
|
|
605
|
+
this.focusKey = String(e), this.dismissed = !1, this.reveal(String(e)), this.syncActive();
|
|
606
|
+
}
|
|
607
|
+
onPlaceFocusOut(e) {
|
|
608
|
+
e.relatedTarget?.closest?.(".place") || (this.focusKey = "", this.syncActive());
|
|
609
|
+
}
|
|
610
|
+
render() {
|
|
611
|
+
let e = this.places, t = this.label.trim() || "Places", r = this.active, i = new Set(r.startsWith("g:") ? r.slice(2).split(",").map(Number) : r ? [Number(r)] : []), o = `${this.uid}-list`, s = this.hasLeaflet ? n`<a class="skip-link" href="#${o}" @click=${this.skipToList}
|
|
612
|
+
>Skip map, go to the list</a
|
|
613
|
+
>
|
|
614
|
+
<p class="instructions" part="instructions">${D}</p>
|
|
615
|
+
<div class=${this.dark && !this.darkTileUrl ? "frame dark-tiles" : "frame"}>
|
|
616
|
+
<div
|
|
617
|
+
id="${this.uid}-map"
|
|
618
|
+
class="map"
|
|
619
|
+
part="map"
|
|
620
|
+
role="region"
|
|
621
|
+
aria-label=${`${t}, map`}
|
|
622
|
+
@click=${{
|
|
623
|
+
handleEvent: this.onMapClick,
|
|
624
|
+
capture: !0
|
|
625
|
+
}}
|
|
626
|
+
@keydown=${this.onMapKeydown}
|
|
627
|
+
@focusin=${this.onMapFocusIn}
|
|
628
|
+
@focusout=${this.onMapFocusOut}
|
|
629
|
+
@mouseleave=${this.onMapLeave}
|
|
630
|
+
></div>
|
|
631
|
+
</div>` : a;
|
|
632
|
+
return n`${s}
|
|
633
|
+
<ul class="places" part="list" id=${o} tabindex="-1" aria-label=${`${t}, list`}>
|
|
634
|
+
${e.map((e, t) => {
|
|
635
|
+
let r = this.href(e);
|
|
636
|
+
return n`<li
|
|
637
|
+
class=${i.has(t) ? "place is-active" : "place"}
|
|
638
|
+
part="place"
|
|
639
|
+
@mouseenter=${() => this.onPlaceEnter(t)}
|
|
640
|
+
@mouseleave=${() => this.onPlaceLeave()}
|
|
641
|
+
@focusin=${() => this.onPlaceFocusIn(t)}
|
|
642
|
+
@focusout=${(e) => this.onPlaceFocusOut(e)}
|
|
643
|
+
>
|
|
644
|
+
${r ? n`<a href=${r}>${e.name}</a>` : n`<span class="name">${e.name}</span>`}
|
|
645
|
+
${e.count !== void 0 && Number.isFinite(e.count) ? n`<span class="count">${this.countText(e.count)}</span>` : a}
|
|
646
|
+
${e.description ? n`<span class="description">${e.description}</span>` : a}
|
|
647
|
+
</li>`;
|
|
648
|
+
})}
|
|
649
|
+
</ul>`;
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
// src/components/uvalib-map/uvalib-map.ts
|
|
653
|
+
i([e({ type: Array })], I.prototype, "items", void 0), i([e({ type: String })], I.prototype, "label", void 0), i([e({
|
|
654
|
+
type: String,
|
|
655
|
+
attribute: "count-label"
|
|
656
|
+
})], I.prototype, "countLabel", void 0), i([e({
|
|
657
|
+
type: String,
|
|
658
|
+
attribute: "place-label"
|
|
659
|
+
})], I.prototype, "placeLabel", void 0), i([e({
|
|
660
|
+
type: String,
|
|
661
|
+
attribute: "tile-url"
|
|
662
|
+
})], I.prototype, "tileUrl", void 0), i([e({
|
|
663
|
+
type: String,
|
|
664
|
+
attribute: "dark-tile-url"
|
|
665
|
+
})], I.prototype, "darkTileUrl", void 0), i([e({ type: String })], I.prototype, "attribution", void 0), i([e({ type: String })], I.prototype, "center", void 0), i([e({ type: Number })], I.prototype, "zoom", void 0), i([e({ attribute: !1 })], I.prototype, "leaflet", void 0), i([t()], I.prototype, "sourceItems", void 0), i([t()], I.prototype, "hasLeaflet", void 0), i([t()], I.prototype, "active", void 0), i([t()], I.prototype, "dark", void 0), r("uvalib-map", I);
|
|
666
|
+
|
|
667
|
+
//# sourceMappingURL=uvalib-map.js.map
|