@uvalib/web-components 1.3.0 → 1.5.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 +28 -0
- package/README.md +62 -10
- package/dist/components/uvalib-image-regions/UvalibImageRegions.d.ts +16 -3
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js +60 -15
- package/dist/components/uvalib-image-regions/UvalibImageRegions.js.map +1 -1
- package/dist/components/uvalib-lightbox/UvalibLightbox.d.ts +41 -2
- package/dist/components/uvalib-lightbox/UvalibLightbox.js +161 -10
- package/dist/components/uvalib-lightbox/UvalibLightbox.js.map +1 -1
- package/dist/components/uvalib-map/UvalibMap.d.ts +79 -10
- package/dist/components/uvalib-map/UvalibMap.js +502 -108
- package/dist/components/uvalib-map/UvalibMap.js.map +1 -1
- package/dist/custom-elements.json +563 -46
- package/dist-cdn/custom-elements.json +563 -46
- package/dist-cdn/manifest.json +1 -1
- package/dist-cdn/skills/uvalib-web-components/SKILL.md +3 -3
- package/dist-cdn/skills/uvalib-web-components/reference/components.md +7 -5
- package/dist-cdn/uvalib-image-regions.js +43 -19
- package/dist-cdn/uvalib-image-regions.js.map +1 -1
- package/dist-cdn/uvalib-lightbox.js +100 -34
- package/dist-cdn/uvalib-lightbox.js.map +1 -1
- package/dist-cdn/uvalib-map.js +302 -106
- package/dist-cdn/uvalib-map.js.map +1 -1
- package/package.json +1 -1
- package/skills/uvalib-web-components/SKILL.md +3 -3
- package/skills/uvalib-web-components/reference/components.md +7 -5
package/dist-cdn/uvalib-map.js
CHANGED
|
@@ -3,14 +3,14 @@ import { a as l } from "./chunks/analytics-DTTihuBD.js";
|
|
|
3
3
|
import { n as u, r as d, t as f } from "./chunks/source-children-BHsDwCvL.js";
|
|
4
4
|
import { t as p } from "./chunks/accessible-DJv7YOtS.js";
|
|
5
5
|
// src/components/uvalib-map/UvalibMap.ts
|
|
6
|
-
var m = "uvalib-map",
|
|
7
|
-
function
|
|
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
8
|
let t = /^\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*$/.exec(e);
|
|
9
9
|
if (!t) return null;
|
|
10
10
|
let [n, r] = [Number(t[1]), Number(t[2])];
|
|
11
11
|
return Math.abs(n) <= 90 && Math.abs(r) <= 180 ? [n, r] : null;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function N(e) {
|
|
14
14
|
let t = e.documentElement.getAttribute("data-uva-color-scheme");
|
|
15
15
|
if (t === null) return !1;
|
|
16
16
|
try {
|
|
@@ -20,7 +20,7 @@ function O(e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t === "dark" || t !== "light" && !!e.defaultView?.matchMedia?.("(prefers-color-scheme: dark)").matches;
|
|
22
22
|
}
|
|
23
|
-
var
|
|
23
|
+
var P = (e) => `
|
|
24
24
|
${e} { display: block; position: relative; max-width: 100%; min-width: 0; box-sizing: border-box; }
|
|
25
25
|
${e}[hidden], ${e} [hidden] { display: none !important; }
|
|
26
26
|
${e} .visually-hidden {
|
|
@@ -29,7 +29,7 @@ var k = (e) => `
|
|
|
29
29
|
}
|
|
30
30
|
${e} .skip-link { position: absolute; inset-inline-start: 0; inset-block-start: 0; z-index: 1100; transform: translateY(-120%); }
|
|
31
31
|
${e} .skip-link:focus-visible { transform: translateY(0); }
|
|
32
|
-
${e} .map { position: relative; block-size: ${
|
|
32
|
+
${e} .map { position: relative; block-size: ${E}; min-block-size: 12rem; box-sizing: border-box; }
|
|
33
33
|
${e} .leaflet-pane, ${e} .leaflet-tile, ${e} .leaflet-marker-icon, ${e} .leaflet-marker-shadow,
|
|
34
34
|
${e} .leaflet-tile-container, ${e} .leaflet-pane > svg, ${e} .leaflet-pane > canvas,
|
|
35
35
|
${e} .leaflet-zoom-box, ${e} .leaflet-image-layer, ${e} .leaflet-layer {
|
|
@@ -82,6 +82,7 @@ var k = (e) => `
|
|
|
82
82
|
cursor: pointer; font: inherit; color: inherit;
|
|
83
83
|
}
|
|
84
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; }
|
|
85
86
|
${e} .leaflet-bar a {
|
|
86
87
|
box-sizing: border-box; display: flex !important; align-items: center; justify-content: center;
|
|
87
88
|
inline-size: 44px !important; block-size: 44px !important; line-height: 1 !important;
|
|
@@ -91,8 +92,9 @@ var k = (e) => `
|
|
|
91
92
|
}
|
|
92
93
|
@media (forced-colors: active) {
|
|
93
94
|
${e} .uvalib-map-marker .dot {
|
|
94
|
-
forced-color-adjust: none; background: Canvas !important; border: 3px solid CanvasText !important; box-shadow: none !important;
|
|
95
|
+
forced-color-adjust: none; background: Canvas !important; color: CanvasText !important; border: 3px solid CanvasText !important; box-shadow: none !important;
|
|
95
96
|
}
|
|
97
|
+
${e} .uvalib-map-marker.is-group .dot { border-style: double !important; border-width: 6px !important; }
|
|
96
98
|
${e} .uvalib-map-marker.is-active .dot { outline: 3px solid Highlight; outline-offset: 3px; }
|
|
97
99
|
${e} .uvalib-map-marker .marker:focus-visible .dot { outline: 3px solid Highlight; outline-offset: 6px; }
|
|
98
100
|
${e} .map, ${e} .map .leaflet-bar, ${e} .map .leaflet-bar a, ${e} .map .leaflet-tooltip,
|
|
@@ -102,32 +104,41 @@ var k = (e) => `
|
|
|
102
104
|
${e} .place.is-active { outline: 3px solid Highlight; outline-offset: 1px; }
|
|
103
105
|
${e} :is(.map, .leaflet-bar a, a, .skip-link):focus-visible { outline: 3px solid Highlight; outline-offset: 2px; }
|
|
104
106
|
}
|
|
105
|
-
`,
|
|
107
|
+
`, F = o(P(":host")), I = class extends c {
|
|
106
108
|
static {
|
|
107
109
|
this.styles = [
|
|
108
110
|
p,
|
|
109
|
-
|
|
110
|
-
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 .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 .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 ")
|
|
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 ")
|
|
111
113
|
];
|
|
112
114
|
}
|
|
113
115
|
constructor() {
|
|
114
|
-
super(), this.items = [], this.label = "", this.countLabel = "items", this.tileUrl =
|
|
115
|
-
this.dark =
|
|
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);
|
|
116
118
|
}, this.onMapClick = (e) => {
|
|
117
119
|
if (e.target.closest?.(".leaflet-control-zoom a")) {
|
|
118
120
|
this.queueZoomReport();
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
|
-
let t = this.
|
|
122
|
-
if (t
|
|
123
|
-
let
|
|
124
|
-
e.detail !== 0 &&
|
|
125
|
-
|
|
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,
|
|
126
137
|
"select",
|
|
127
138
|
this.label,
|
|
128
|
-
|
|
139
|
+
r + 1
|
|
129
140
|
]), this.dispatchEvent(new CustomEvent("select", {
|
|
130
|
-
detail: { item:
|
|
141
|
+
detail: { item: i },
|
|
131
142
|
bubbles: !0,
|
|
132
143
|
composed: !0,
|
|
133
144
|
cancelable: !0
|
|
@@ -138,35 +149,42 @@ var k = (e) => `
|
|
|
138
149
|
e.preventDefault(), t.closest("a").click();
|
|
139
150
|
return;
|
|
140
151
|
}
|
|
141
|
-
let n =
|
|
142
|
-
if (n
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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];
|
|
148
166
|
else if (e.key === " " && t.localName === "a") {
|
|
149
167
|
e.preventDefault(), t.click();
|
|
150
168
|
return;
|
|
151
169
|
} else return;
|
|
152
|
-
e.preventDefault(), e.stopPropagation(), a
|
|
170
|
+
e.preventDefault(), e.stopPropagation(), a && (this.reveal(this.keyOf(a)), a.focus());
|
|
153
171
|
}, this.onMapFocusIn = (e) => {
|
|
154
|
-
let t = this.
|
|
155
|
-
t
|
|
172
|
+
let t = this.targetOf(e);
|
|
173
|
+
t && (this.focusKey = t, this.dismissed = !1, this.reveal(t), this.syncActive());
|
|
156
174
|
}, this.onMapFocusOut = (e) => {
|
|
157
|
-
this.
|
|
175
|
+
this.targetOf(e) && (e.relatedTarget?.closest?.(".marker") || (this.focusKey = "", this.syncActive()));
|
|
158
176
|
}, this.onMapLeave = () => {
|
|
159
|
-
this.
|
|
177
|
+
this.hoverKey = "", this.syncActive();
|
|
160
178
|
}, this.skipToList = (e) => {
|
|
161
179
|
e.preventDefault(), this.renderRoot.querySelector(`#${this.uid}-list`)?.focus();
|
|
162
180
|
}, new f(this, () => this.lightDom, (e) => this.readList(e)), this.addEventListener("keydown", (e) => {
|
|
163
|
-
e.key === "Escape" && this.active
|
|
181
|
+
e.key === "Escape" && this.active && (this.dismissed = !0, this.syncActive());
|
|
164
182
|
});
|
|
165
183
|
}
|
|
166
184
|
createRenderRoot() {
|
|
167
185
|
let e = super.createRenderRoot();
|
|
168
186
|
if (e instanceof ShadowRoot && this.noStyle) {
|
|
169
|
-
let t =
|
|
187
|
+
let t = F.styleSheet;
|
|
170
188
|
t && (e.adoptedStyleSheets = [t]);
|
|
171
189
|
}
|
|
172
190
|
return e;
|
|
@@ -174,7 +192,7 @@ var k = (e) => `
|
|
|
174
192
|
connectedCallback() {
|
|
175
193
|
if (super.connectedCallback(), this.lightDom && this.noStyle) {
|
|
176
194
|
let e = this.getRootNode();
|
|
177
|
-
s(`${this.localName}::structure`, o(
|
|
195
|
+
s(`${this.localName}::structure`, o(P(this.localName)), {
|
|
178
196
|
root: e instanceof ShadowRoot || e instanceof Document ? e : void 0,
|
|
179
197
|
scope: !1
|
|
180
198
|
});
|
|
@@ -221,17 +239,17 @@ var k = (e) => `
|
|
|
221
239
|
}
|
|
222
240
|
willUpdate(e) {
|
|
223
241
|
let t = this.findLeaflet();
|
|
224
|
-
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(`<${
|
|
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.`));
|
|
225
243
|
}
|
|
226
244
|
updated(e) {
|
|
227
245
|
if (super.updated(e), !this.L) {
|
|
228
246
|
!this.warnedLeaflet && this.ownerDocument.readyState === "complete" && (this.warnedLeaflet = !0, setTimeout(() => {
|
|
229
|
-
this.isConnected && !this.findLeaflet() && console.warn(`<${
|
|
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.`);
|
|
230
248
|
}, 1e3));
|
|
231
249
|
return;
|
|
232
250
|
}
|
|
233
251
|
let t = this.setUpMap();
|
|
234
|
-
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") ? (this.drawMarkers(), (t || !this.userMoved) && this.fit()) : (e.has("center") || e.has("zoom")) && this.fit(), e.has("active") && this.showActive(
|
|
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());
|
|
235
253
|
}
|
|
236
254
|
get container() {
|
|
237
255
|
return this.renderRoot.querySelector(`#${this.uid}-map`);
|
|
@@ -261,12 +279,14 @@ var k = (e) => `
|
|
|
261
279
|
className: "uvalib-map-tooltip"
|
|
262
280
|
}), i.on("movestart", () => {
|
|
263
281
|
this.fitting || (this.userMoved = !0);
|
|
264
|
-
}),
|
|
265
|
-
this.
|
|
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());
|
|
266
286
|
}), this.ro.observe(t), !0;
|
|
267
287
|
}
|
|
268
288
|
teardown() {
|
|
269
|
-
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.drawn = [], this.userMoved = !1;
|
|
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;
|
|
270
290
|
}
|
|
271
291
|
drawTiles() {
|
|
272
292
|
let { L: e, map: t } = this;
|
|
@@ -278,49 +298,201 @@ var k = (e) => `
|
|
|
278
298
|
}).addTo(t);
|
|
279
299
|
}
|
|
280
300
|
dotSize(e, t) {
|
|
281
|
-
return !(t > 0) || e === void 0 || !(e > 0) ?
|
|
301
|
+
return !(t > 0) || e === void 0 || !(e > 0) ? y : Math.round(y + 32 * Math.sqrt(e / t));
|
|
282
302
|
}
|
|
283
303
|
placeName(e) {
|
|
284
304
|
return e.count === void 0 ? e.name : `${e.name}, ${this.countText(e.count)}`;
|
|
285
305
|
}
|
|
286
306
|
countText(e) {
|
|
287
|
-
return `${
|
|
307
|
+
return `${k(e)} ${A(this.countLabel || "items", e)}`;
|
|
288
308
|
}
|
|
289
309
|
href(e) {
|
|
290
310
|
return e.href && d(e.href, this.ownerDocument.baseURI) ? e.href : null;
|
|
291
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
|
+
}
|
|
292
346
|
drawMarkers() {
|
|
293
347
|
let { L: e, map: t } = this;
|
|
294
348
|
if (!e || !t) return;
|
|
295
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;
|
|
296
352
|
let n = this.places;
|
|
297
|
-
this.drawn = n
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
let
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
let
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
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
|
|
316
424
|
});
|
|
317
|
-
|
|
318
|
-
|
|
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 = "";
|
|
319
491
|
}
|
|
320
492
|
fit() {
|
|
321
493
|
let { L: e, map: t } = this;
|
|
322
494
|
if (!e || !t) return;
|
|
323
|
-
let n = this.places.filter(
|
|
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;
|
|
324
496
|
this.fitting = !0;
|
|
325
497
|
try {
|
|
326
498
|
if (r) t.setView(r, i ?? 16, { animate: !1 });
|
|
@@ -338,7 +510,7 @@ var k = (e) => `
|
|
|
338
510
|
maxZoom: 17,
|
|
339
511
|
animate: !1
|
|
340
512
|
});
|
|
341
|
-
} else t.setView(
|
|
513
|
+
} else t.setView(v, 15, { animate: !1 });
|
|
342
514
|
} finally {
|
|
343
515
|
this.fitting = !1;
|
|
344
516
|
}
|
|
@@ -350,52 +522,73 @@ var k = (e) => `
|
|
|
350
522
|
return r.some((e) => e.width > 0 && a >= e.left - 12 && a <= e.right + 12 && o >= e.top - 12 && o <= e.bottom + 12);
|
|
351
523
|
});
|
|
352
524
|
}
|
|
353
|
-
|
|
354
|
-
|
|
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
|
+
};
|
|
355
541
|
}
|
|
356
542
|
hover(e) {
|
|
357
|
-
this.
|
|
543
|
+
this.hoverKey = e, this.dismissed = !1, this.syncActive();
|
|
358
544
|
}
|
|
359
545
|
syncActive() {
|
|
360
|
-
this.active = this.dismissed ?
|
|
546
|
+
this.active = this.dismissed ? "" : this.hoverKey || this.focusKey;
|
|
361
547
|
}
|
|
362
|
-
showActive(
|
|
363
|
-
let { map:
|
|
364
|
-
if (!
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
let r = this.active, i = this.markers[r], a = this.places[r];
|
|
371
|
-
if (r < 0 || !i || !a) {
|
|
372
|
-
n.remove();
|
|
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();
|
|
373
556
|
return;
|
|
374
557
|
}
|
|
375
|
-
this.
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
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);
|
|
384
574
|
}
|
|
385
575
|
reveal(e) {
|
|
386
|
-
let { map: t } = this, n = this.
|
|
576
|
+
let { map: t } = this, n = this.markerFor(e);
|
|
387
577
|
if (!t || !n) return;
|
|
388
|
-
let r = n.getLatLng();
|
|
578
|
+
let r = n.marker.getLatLng();
|
|
389
579
|
t.getBounds().pad(-.15).contains(r) || t.panTo(r, { animate: !this.reduceMotion });
|
|
390
580
|
}
|
|
391
|
-
|
|
581
|
+
keyOf(e) {
|
|
582
|
+
return e.dataset.group === void 0 ? e.dataset.index ?? "" : `g:${e.dataset.group}`;
|
|
583
|
+
}
|
|
584
|
+
targetOf(e) {
|
|
392
585
|
let t = e.target?.closest?.(".marker");
|
|
393
|
-
return t ?
|
|
586
|
+
return t ? this.keyOf(t) : "";
|
|
394
587
|
}
|
|
395
588
|
queueZoomReport() {
|
|
396
589
|
clearTimeout(this.zoomTimer), this.zoomTimer = setTimeout(() => {
|
|
397
590
|
this.map && l(this, [
|
|
398
|
-
|
|
591
|
+
h,
|
|
399
592
|
"zoom",
|
|
400
593
|
this.label,
|
|
401
594
|
this.map.getZoom()
|
|
@@ -403,22 +596,22 @@ var k = (e) => `
|
|
|
403
596
|
}, 1e3);
|
|
404
597
|
}
|
|
405
598
|
onPlaceEnter(e) {
|
|
406
|
-
this.hover(e);
|
|
599
|
+
this.hover(String(e));
|
|
407
600
|
}
|
|
408
601
|
onPlaceLeave() {
|
|
409
|
-
this.
|
|
602
|
+
this.hoverKey = "", this.syncActive();
|
|
410
603
|
}
|
|
411
604
|
onPlaceFocusIn(e) {
|
|
412
|
-
this.
|
|
605
|
+
this.focusKey = String(e), this.dismissed = !1, this.reveal(String(e)), this.syncActive();
|
|
413
606
|
}
|
|
414
607
|
onPlaceFocusOut(e) {
|
|
415
|
-
e.relatedTarget?.closest?.(".place") || (this.
|
|
608
|
+
e.relatedTarget?.closest?.(".place") || (this.focusKey = "", this.syncActive());
|
|
416
609
|
}
|
|
417
610
|
render() {
|
|
418
|
-
let e = this.places, t = this.label.trim() || "Places", r = `${this.uid}-list`,
|
|
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}
|
|
419
612
|
>Skip map, go to the list</a
|
|
420
613
|
>
|
|
421
|
-
<p class="instructions" part="instructions">${
|
|
614
|
+
<p class="instructions" part="instructions">${D}</p>
|
|
422
615
|
<div class=${this.dark && !this.darkTileUrl ? "frame dark-tiles" : "frame"}>
|
|
423
616
|
<div
|
|
424
617
|
id="${this.uid}-map"
|
|
@@ -436,12 +629,12 @@ var k = (e) => `
|
|
|
436
629
|
@mouseleave=${this.onMapLeave}
|
|
437
630
|
></div>
|
|
438
631
|
</div>` : a;
|
|
439
|
-
return n`${
|
|
440
|
-
<ul class="places" part="list" id=${
|
|
632
|
+
return n`${s}
|
|
633
|
+
<ul class="places" part="list" id=${o} tabindex="-1" aria-label=${`${t}, list`}>
|
|
441
634
|
${e.map((e, t) => {
|
|
442
635
|
let r = this.href(e);
|
|
443
636
|
return n`<li
|
|
444
|
-
class=${t
|
|
637
|
+
class=${i.has(t) ? "place is-active" : "place"}
|
|
445
638
|
part="place"
|
|
446
639
|
@mouseenter=${() => this.onPlaceEnter(t)}
|
|
447
640
|
@mouseleave=${() => this.onPlaceLeave()}
|
|
@@ -457,15 +650,18 @@ var k = (e) => `
|
|
|
457
650
|
}
|
|
458
651
|
};
|
|
459
652
|
// src/components/uvalib-map/uvalib-map.ts
|
|
460
|
-
i([e({ type: Array })],
|
|
653
|
+
i([e({ type: Array })], I.prototype, "items", void 0), i([e({ type: String })], I.prototype, "label", void 0), i([e({
|
|
461
654
|
type: String,
|
|
462
655
|
attribute: "count-label"
|
|
463
|
-
})],
|
|
656
|
+
})], I.prototype, "countLabel", void 0), i([e({
|
|
657
|
+
type: String,
|
|
658
|
+
attribute: "place-label"
|
|
659
|
+
})], I.prototype, "placeLabel", void 0), i([e({
|
|
464
660
|
type: String,
|
|
465
661
|
attribute: "tile-url"
|
|
466
|
-
})],
|
|
662
|
+
})], I.prototype, "tileUrl", void 0), i([e({
|
|
467
663
|
type: String,
|
|
468
664
|
attribute: "dark-tile-url"
|
|
469
|
-
})],
|
|
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);
|
|
470
666
|
|
|
471
667
|
//# sourceMappingURL=uvalib-map.js.map
|