@k2b/ui 0.30.0 → 0.32.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/README.md +1 -1
- package/dist/base.css +2 -0
- package/dist/browser/actions/Toolbar.js +2 -0
- package/dist/browser/actions/Toolbar.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +8 -0
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/chat/ChatDecision.js +28 -2
- package/dist/browser/chat/ChatDecision.js.map +1 -1
- package/dist/browser/content/Chart.js +104 -55
- package/dist/browser/content/Chart.js.map +1 -1
- package/dist/browser/content/ChartExplorer.js +5 -3
- package/dist/browser/content/ChartExplorer.js.map +1 -1
- package/dist/browser/content/MapAttribution.js +27 -0
- package/dist/browser/content/MapAttribution.js.map +1 -0
- package/dist/browser/content/MapView.js +553 -0
- package/dist/browser/content/MapView.js.map +1 -0
- package/dist/browser/content/MapViewFrame.js +395 -0
- package/dist/browser/content/MapViewFrame.js.map +1 -0
- package/dist/browser/content/chart-inspection-core.js +4 -1
- package/dist/browser/content/chart-inspection-core.js.map +1 -1
- package/dist/browser/content/code-highlight.js +66 -0
- package/dist/browser/content/code-highlight.js.map +1 -1
- package/dist/browser/content/index.js +6 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/map-palette.js +39 -0
- package/dist/browser/content/map-palette.js.map +1 -0
- package/dist/browser/content/map-style.js +276 -0
- package/dist/browser/content/map-style.js.map +1 -0
- package/dist/browser/content/map-view-geometry.js +269 -0
- package/dist/browser/content/map-view-geometry.js.map +1 -0
- package/dist/browser/content/map-view-live.js +65 -0
- package/dist/browser/content/map-view-live.js.map +1 -0
- package/dist/browser/content/map-view-messages.js +53 -0
- package/dist/browser/content/map-view-messages.js.map +1 -0
- package/dist/browser/content/map-view-types.js +2 -0
- package/dist/browser/content/map-view-types.js.map +1 -0
- package/dist/browser/content/map-view-worker.js +10 -0
- package/dist/browser/feedback/dialog-core.js +19 -0
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/inputs/AutocompleteEditor.js +167 -104
- package/dist/browser/inputs/AutocompleteEditor.js.map +1 -1
- package/dist/browser/inputs/RichSelect.js +1474 -0
- package/dist/browser/inputs/RichSelect.js.map +1 -0
- package/dist/browser/inputs/TextInput.js +95 -60
- package/dist/browser/inputs/TextInput.js.map +1 -1
- package/dist/browser/inputs/choice.js +19 -8
- package/dist/browser/inputs/choice.js.map +1 -1
- package/dist/browser/inputs/index.js +1 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/inputs/rich-select-messages.js +46 -0
- package/dist/browser/inputs/rich-select-messages.js.map +1 -0
- package/dist/browser/layout/AppWorkspace.js +194 -144
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +10 -1
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/Navigation.js +14 -5
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/PageTitle.js +9 -3
- package/dist/browser/layout/PageTitle.js.map +1 -1
- package/dist/browser/layout/ResizeSeparator.js +8 -2
- package/dist/browser/layout/ResizeSeparator.js.map +1 -1
- package/dist/browser/layout/app-workspace-controller.js +301 -34
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/app-workspace-width.js +26 -0
- package/dist/browser/layout/app-workspace-width.js.map +1 -0
- package/dist/browser/layout/index.js +1 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/navigation-model.js.map +1 -1
- package/dist/browser/layout/resize-separator.js +25 -1
- package/dist/browser/layout/resize-separator.js.map +1 -1
- package/dist/browser/surfaces/Skeleton.js +14 -0
- package/dist/browser/surfaces/Skeleton.js.map +1 -0
- package/dist/browser/surfaces/index.js +1 -0
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/licenses/maplibre-gl.txt +116 -0
- package/dist/ssr/actions/Toolbar.js +2 -0
- package/dist/ssr/actions/Toolbar.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +8 -0
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/chat/ChatDecision.js +11 -0
- package/dist/ssr/chat/ChatDecision.js.map +1 -1
- package/dist/ssr/content/Chart.js +27 -7
- package/dist/ssr/content/Chart.js.map +1 -1
- package/dist/ssr/content/ChartExplorer.js +5 -3
- package/dist/ssr/content/ChartExplorer.js.map +1 -1
- package/dist/ssr/content/MapAttribution.js +19 -0
- package/dist/ssr/content/MapAttribution.js.map +1 -0
- package/dist/ssr/content/MapView.js +474 -0
- package/dist/ssr/content/MapView.js.map +1 -0
- package/dist/ssr/content/MapViewFrame.js +193 -0
- package/dist/ssr/content/MapViewFrame.js.map +1 -0
- package/dist/ssr/content/chart-inspection-core.js +4 -1
- package/dist/ssr/content/chart-inspection-core.js.map +1 -1
- package/dist/ssr/content/code-highlight.js +66 -0
- package/dist/ssr/content/code-highlight.js.map +1 -1
- package/dist/ssr/content/index.js +6 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/map-palette.js +39 -0
- package/dist/ssr/content/map-palette.js.map +1 -0
- package/dist/ssr/content/map-style.js +276 -0
- package/dist/ssr/content/map-style.js.map +1 -0
- package/dist/ssr/content/map-view-geometry.js +269 -0
- package/dist/ssr/content/map-view-geometry.js.map +1 -0
- package/dist/ssr/content/map-view-live.js +1 -0
- package/dist/ssr/content/map-view-messages.js +53 -0
- package/dist/ssr/content/map-view-messages.js.map +1 -0
- package/dist/ssr/content/map-view-types.js +2 -0
- package/dist/ssr/content/map-view-types.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +19 -0
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/inputs/AutocompleteEditor.js +64 -24
- package/dist/ssr/inputs/AutocompleteEditor.js.map +1 -1
- package/dist/ssr/inputs/RichSelect.js +950 -0
- package/dist/ssr/inputs/RichSelect.js.map +1 -0
- package/dist/ssr/inputs/TextInput.js +40 -16
- package/dist/ssr/inputs/TextInput.js.map +1 -1
- package/dist/ssr/inputs/choice.js +19 -8
- package/dist/ssr/inputs/choice.js.map +1 -1
- package/dist/ssr/inputs/index.js +1 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/inputs/rich-select-messages.js +46 -0
- package/dist/ssr/inputs/rich-select-messages.js.map +1 -0
- package/dist/ssr/layout/AppWorkspace.js +53 -16
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +1 -1
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +1 -1
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/PageTitle.js +9 -3
- package/dist/ssr/layout/PageTitle.js.map +1 -1
- package/dist/ssr/layout/ResizeSeparator.js +4 -1
- package/dist/ssr/layout/ResizeSeparator.js.map +1 -1
- package/dist/ssr/layout/app-workspace-controller.js +301 -34
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/app-workspace-width.js +26 -0
- package/dist/ssr/layout/app-workspace-width.js.map +1 -0
- package/dist/ssr/layout/index.js +1 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/navigation-model.js.map +1 -1
- package/dist/ssr/layout/resize-separator.js +25 -1
- package/dist/ssr/layout/resize-separator.js.map +1 -1
- package/dist/ssr/surfaces/Skeleton.js +8 -0
- package/dist/ssr/surfaces/Skeleton.js.map +1 -0
- package/dist/ssr/surfaces/index.js +1 -0
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/content/Chart.d.ts +4 -2
- package/dist/types/content/ChartExplorer.d.ts +0 -1
- package/dist/types/content/MapAttribution.d.ts +6 -0
- package/dist/types/content/MapView.d.ts +5 -0
- package/dist/types/content/MapViewFrame.d.ts +31 -0
- package/dist/types/content/code-highlight.d.ts +3 -1
- package/dist/types/content/index.d.ts +7 -0
- package/dist/types/content/map-palette.d.ts +58 -0
- package/dist/types/content/map-style.d.ts +29 -0
- package/dist/types/content/map-view-geometry.d.ts +55 -0
- package/dist/types/content/map-view-live.d.ts +2 -0
- package/dist/types/content/map-view-messages.d.ts +21 -0
- package/dist/types/content/map-view-types.d.ts +63 -0
- package/dist/types/feedback/dialog-core.d.ts +1 -0
- package/dist/types/inputs/AutocompleteEditor.d.ts +6 -1
- package/dist/types/inputs/RichSelect.d.ts +93 -0
- package/dist/types/inputs/TextInput.d.ts +5 -2
- package/dist/types/inputs/choice.d.ts +24 -4
- package/dist/types/inputs/index.d.ts +2 -0
- package/dist/types/inputs/rich-select-messages.d.ts +21 -0
- package/dist/types/layout/AppWorkspace.d.ts +14 -3
- package/dist/types/layout/DetailPanel.d.ts +2 -0
- package/dist/types/layout/app-workspace-controller.d.ts +2 -0
- package/dist/types/layout/app-workspace-width.d.ts +13 -0
- package/dist/types/layout/index.d.ts +2 -2
- package/dist/types/layout/navigation-model.d.ts +2 -0
- package/dist/types/layout/resize-separator.d.ts +1 -0
- package/dist/types/surfaces/Skeleton.d.ts +6 -0
- package/dist/types/surfaces/index.d.ts +1 -0
- package/map-glyphs/IBM Plex Sans Medium/0-255.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/1024-1279.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/256-511.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/512-767.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/768-1023.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/7680-7935.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/8192-8447.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/8448-8703.pbf +0 -0
- package/map-glyphs/IBM Plex Sans Medium/8704-8959.pbf +0 -0
- package/map-glyphs/OFL.txt +93 -0
- package/package.json +11 -6
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { template as _$template } from "solid-js/web";
|
|
2
|
+
import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
3
|
+
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
4
|
+
import { className as _$className } from "solid-js/web";
|
|
5
|
+
import { setStyleProperty as _$setStyleProperty } from "solid-js/web";
|
|
6
|
+
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
7
|
+
import { memo as _$memo } from "solid-js/web";
|
|
8
|
+
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
9
|
+
import { style as _$style } from "solid-js/web";
|
|
10
|
+
import { effect as _$effect } from "solid-js/web";
|
|
11
|
+
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
12
|
+
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
13
|
+
import { insert as _$insert } from "solid-js/web";
|
|
14
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
15
|
+
var _tmpl$ = /*#__PURE__*/_$template(`<div class=k2b-map-view__fit><svg class=k2b-map-view__geometry preserveAspectRatio=none overflow=visible aria-hidden=true><!$><!/><!$><!/><!$><!/></svg><!$><!/><div class=k2b-map-view__pins role=group>`),
|
|
16
|
+
_tmpl$2 = /*#__PURE__*/_$template(`<svg><path class=k2b-map-view__area vector-effect=non-scaling-stroke></svg>`, false, true, false),
|
|
17
|
+
_tmpl$3 = /*#__PURE__*/_$template(`<svg><path class=k2b-map-view__casing vector-effect=non-scaling-stroke></svg>`, false, true, false),
|
|
18
|
+
_tmpl$4 = /*#__PURE__*/_$template(`<svg><g class=k2b-map-view__line><!$><!/><path class=k2b-map-view__stroke vector-effect=non-scaling-stroke></svg>`, false, true, false),
|
|
19
|
+
_tmpl$5 = /*#__PURE__*/_$template(`<svg><circle class=k2b-map-view__accuracy vector-effect=non-scaling-stroke></svg>`, false, true, false),
|
|
20
|
+
_tmpl$6 = /*#__PURE__*/_$template(`<span class=k2b-map-view__me role=img>`),
|
|
21
|
+
_tmpl$7 = /*#__PURE__*/_$template(`<span class=k2b-map-view__pin role=img><span aria-hidden=true>`),
|
|
22
|
+
_tmpl$8 = /*#__PURE__*/_$template(`<button type=button class=k2b-map-view__pin><span aria-hidden=true>`),
|
|
23
|
+
_tmpl$9 = /*#__PURE__*/_$template(`<div class=k2b-map-view__scale><span></span><div>`),
|
|
24
|
+
_tmpl$0 = /*#__PURE__*/_$template(`<div class=k2b-map-view__foot-row><!$><!/><div class=k2b-map-view__attribution>`),
|
|
25
|
+
_tmpl$1 = /*#__PURE__*/_$template(`<div data-state=static role=region><span class=k2b-sr-only></span><!$><!/><div class=k2b-map-view__foot>`);
|
|
26
|
+
import { createMemo, For, Show } from "solid-js";
|
|
27
|
+
import { DEFAULT_PADDING, EARTH_CIRCUMFERENCE, isStop, linePoints, mapFrame, pinHitRadii, pinOffsets, projectPoint, scaleBar, sortMarkers, unprojectPoint } from "./map-view-geometry";
|
|
28
|
+
import { useMapViewMessages } from "./map-view-messages";
|
|
29
|
+
const S = 1e6;
|
|
30
|
+
export const mapNumber = value => String(Number(value.toFixed(6)));
|
|
31
|
+
export const selectedMarker = (markers, selectedId) => selectedId !== undefined ? markers.find(marker => marker.id === selectedId) : markers.find(marker => marker.selected);
|
|
32
|
+
|
|
33
|
+
/** The CSS form of fitCamera's width rule, so the server lays out exactly what MapLibre shows. */
|
|
34
|
+
const fittedWidth = (frame, padding) => `max(min(100% - ${2 * padding}px, ${frame.referenceWidth}px), ${frame.minWidth}px)`;
|
|
35
|
+
export function frameStyle(frame, padding) {
|
|
36
|
+
return {
|
|
37
|
+
left: "50%",
|
|
38
|
+
top: "50%",
|
|
39
|
+
width: fittedWidth(frame, padding),
|
|
40
|
+
"aspect-ratio": `${frame.spanX} / ${frame.spanY}`,
|
|
41
|
+
transform: "translate(-50%, -50%)"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const pointInFrame = (point, frame) => {
|
|
45
|
+
const p = projectPoint(point);
|
|
46
|
+
return {
|
|
47
|
+
x: (p.x - frame.minX) / frame.spanX,
|
|
48
|
+
y: (p.y - frame.minY) / frame.spanY
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
const positionStyle = (point, frame) => {
|
|
52
|
+
const p = pointInFrame(point, frame);
|
|
53
|
+
return {
|
|
54
|
+
left: `${mapNumber(p.x * 100)}%`,
|
|
55
|
+
top: `${mapNumber(p.y * 100)}%`
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const path = (points, frame, closed = false) => points.map((point, index) => {
|
|
59
|
+
const p = projectPoint(point);
|
|
60
|
+
return `${index ? "L" : "M"}${mapNumber((p.x - frame.minX) * S)} ${mapNumber((p.y - frame.minY) * S)}`;
|
|
61
|
+
}).join(" ") + (closed && points.length ? " Z" : "");
|
|
62
|
+
export function MapGeometry(props) {
|
|
63
|
+
const messages = useMapViewMessages();
|
|
64
|
+
const markers = createMemo(() => sortMarkers(props.markers ?? []));
|
|
65
|
+
const markerIds = createMemo(() => markers().map(marker => marker.id));
|
|
66
|
+
const markersById = createMemo(() => new Map(markers().map(marker => [marker.id, marker])));
|
|
67
|
+
const offsets = createMemo(() => pinOffsets(markers(), props.frame, props.zoomFactor, props.ownLocation?.point));
|
|
68
|
+
const hitRadii = createMemo(() => pinHitRadii(markers(), props.frame, offsets(), props.zoomFactor));
|
|
69
|
+
// Input order decides the fallback selection, as in MapView; sorting is only for drawing and keys.
|
|
70
|
+
const selected = createMemo(() => selectedMarker(props.markers ?? [], props.selectedId));
|
|
71
|
+
const keydown = (event, id) => {
|
|
72
|
+
const index = markerIds().indexOf(id);
|
|
73
|
+
let next;
|
|
74
|
+
switch (event.key) {
|
|
75
|
+
case "ArrowRight":
|
|
76
|
+
case "ArrowDown":
|
|
77
|
+
next = (index + 1) % markers().length;
|
|
78
|
+
break;
|
|
79
|
+
case "ArrowLeft":
|
|
80
|
+
case "ArrowUp":
|
|
81
|
+
next = (index + markers().length - 1) % markers().length;
|
|
82
|
+
break;
|
|
83
|
+
case "Home":
|
|
84
|
+
next = 0;
|
|
85
|
+
break;
|
|
86
|
+
case "End":
|
|
87
|
+
next = markers().length - 1;
|
|
88
|
+
break;
|
|
89
|
+
default:
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
const target = markers()[next];
|
|
95
|
+
if (target) {
|
|
96
|
+
event.currentTarget.parentElement?.querySelectorAll(".k2b-map-view__pin")[next]?.focus({
|
|
97
|
+
preventScroll: true
|
|
98
|
+
});
|
|
99
|
+
props.onSelect?.(target.id);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return (() => {
|
|
103
|
+
var _el$ = _$getNextElement(_tmpl$),
|
|
104
|
+
_el$2 = _el$.firstChild,
|
|
105
|
+
_el$3 = _el$2.firstChild,
|
|
106
|
+
[_el$4, _co$] = _$getNextMarker(_el$3.nextSibling),
|
|
107
|
+
_el$5 = _el$4.nextSibling,
|
|
108
|
+
[_el$6, _co$2] = _$getNextMarker(_el$5.nextSibling),
|
|
109
|
+
_el$7 = _el$6.nextSibling,
|
|
110
|
+
[_el$8, _co$3] = _$getNextMarker(_el$7.nextSibling),
|
|
111
|
+
_el$0 = _el$2.nextSibling,
|
|
112
|
+
[_el$1, _co$4] = _$getNextMarker(_el$0.nextSibling),
|
|
113
|
+
_el$9 = _el$1.nextSibling;
|
|
114
|
+
_$insert(_el$2, _$createComponent(For, {
|
|
115
|
+
get each() {
|
|
116
|
+
return props.areas;
|
|
117
|
+
},
|
|
118
|
+
children: area => (() => {
|
|
119
|
+
var _el$10 = _$getNextElement(_tmpl$2);
|
|
120
|
+
_$effect(_p$ => {
|
|
121
|
+
var _v$4 = area.tone ?? "accent",
|
|
122
|
+
_v$5 = path(area.polygon, props.frame, true);
|
|
123
|
+
_v$4 !== _p$.e && _$setAttribute(_el$10, "data-tone", _p$.e = _v$4);
|
|
124
|
+
_v$5 !== _p$.t && _$setAttribute(_el$10, "d", _p$.t = _v$5);
|
|
125
|
+
return _p$;
|
|
126
|
+
}, {
|
|
127
|
+
e: undefined,
|
|
128
|
+
t: undefined
|
|
129
|
+
});
|
|
130
|
+
return _el$10;
|
|
131
|
+
})()
|
|
132
|
+
}), _el$4, _co$);
|
|
133
|
+
_$insert(_el$2, _$createComponent(For, {
|
|
134
|
+
get each() {
|
|
135
|
+
return props.lines;
|
|
136
|
+
},
|
|
137
|
+
children: line => (() => {
|
|
138
|
+
var _el$11 = _$getNextElement(_tmpl$4),
|
|
139
|
+
_el$14 = _el$11.firstChild,
|
|
140
|
+
[_el$15, _co$5] = _$getNextMarker(_el$14.nextSibling),
|
|
141
|
+
_el$13 = _el$15.nextSibling;
|
|
142
|
+
_$insert(_el$11, _$createComponent(Show, {
|
|
143
|
+
get when() {
|
|
144
|
+
return !line.tone || line.tone === "accent" || line.tone === "preview";
|
|
145
|
+
},
|
|
146
|
+
get children() {
|
|
147
|
+
var _el$12 = _$getNextElement(_tmpl$3);
|
|
148
|
+
_$effect(() => _$setAttribute(_el$12, "d", path(linePoints(line), props.frame)));
|
|
149
|
+
return _el$12;
|
|
150
|
+
}
|
|
151
|
+
}), _el$15, _co$5);
|
|
152
|
+
_$effect(_p$ => {
|
|
153
|
+
var _v$6 = line.tone ?? "accent",
|
|
154
|
+
_v$7 = path(linePoints(line), props.frame);
|
|
155
|
+
_v$6 !== _p$.e && _$setAttribute(_el$11, "data-tone", _p$.e = _v$6);
|
|
156
|
+
_v$7 !== _p$.t && _$setAttribute(_el$13, "d", _p$.t = _v$7);
|
|
157
|
+
return _p$;
|
|
158
|
+
}, {
|
|
159
|
+
e: undefined,
|
|
160
|
+
t: undefined
|
|
161
|
+
});
|
|
162
|
+
return _el$11;
|
|
163
|
+
})()
|
|
164
|
+
}), _el$6, _co$2);
|
|
165
|
+
_$insert(_el$2, _$createComponent(Show, {
|
|
166
|
+
get when() {
|
|
167
|
+
return props.ownLocation;
|
|
168
|
+
},
|
|
169
|
+
children: location => {
|
|
170
|
+
const p = () => projectPoint(location().point);
|
|
171
|
+
return (() => {
|
|
172
|
+
var _el$16 = _$getNextElement(_tmpl$5);
|
|
173
|
+
_$effect(_p$ => {
|
|
174
|
+
var _v$8 = mapNumber((p().x - props.frame.minX) * S),
|
|
175
|
+
_v$9 = mapNumber((p().y - props.frame.minY) * S),
|
|
176
|
+
_v$0 = mapNumber((location().accuracyMeters ?? 0) / (EARTH_CIRCUMFERENCE * Math.cos(location().point.lat * Math.PI / 180)) * S);
|
|
177
|
+
_v$8 !== _p$.e && _$setAttribute(_el$16, "cx", _p$.e = _v$8);
|
|
178
|
+
_v$9 !== _p$.t && _$setAttribute(_el$16, "cy", _p$.t = _v$9);
|
|
179
|
+
_v$0 !== _p$.a && _$setAttribute(_el$16, "r", _p$.a = _v$0);
|
|
180
|
+
return _p$;
|
|
181
|
+
}, {
|
|
182
|
+
e: undefined,
|
|
183
|
+
t: undefined,
|
|
184
|
+
a: undefined
|
|
185
|
+
});
|
|
186
|
+
return _el$16;
|
|
187
|
+
})();
|
|
188
|
+
}
|
|
189
|
+
}), _el$8, _co$3);
|
|
190
|
+
_$insert(_el$, _$createComponent(Show, {
|
|
191
|
+
get when() {
|
|
192
|
+
return props.ownLocation;
|
|
193
|
+
},
|
|
194
|
+
children: location => (() => {
|
|
195
|
+
var _el$17 = _$getNextElement(_tmpl$6);
|
|
196
|
+
_$effect(_p$ => {
|
|
197
|
+
var _v$1 = messages().ownLocation,
|
|
198
|
+
_v$10 = positionStyle(location().point, props.frame);
|
|
199
|
+
_v$1 !== _p$.e && _$setAttribute(_el$17, "aria-label", _p$.e = _v$1);
|
|
200
|
+
_p$.t = _$style(_el$17, _v$10, _p$.t);
|
|
201
|
+
return _p$;
|
|
202
|
+
}, {
|
|
203
|
+
e: undefined,
|
|
204
|
+
t: undefined
|
|
205
|
+
});
|
|
206
|
+
return _el$17;
|
|
207
|
+
})()
|
|
208
|
+
}), _el$1, _co$4);
|
|
209
|
+
_$insert(_el$9, _$createComponent(For, {
|
|
210
|
+
get each() {
|
|
211
|
+
return markerIds();
|
|
212
|
+
},
|
|
213
|
+
children: id => {
|
|
214
|
+
const marker = () => markersById().get(id);
|
|
215
|
+
const name = () => marker().mark === undefined ? marker().label : `${marker().mark} ${marker().label}`;
|
|
216
|
+
const style = () => ({
|
|
217
|
+
...positionStyle(marker().point, props.frame),
|
|
218
|
+
"--k2b-map-pin-dx": `${mapNumber(offsets().get(marker().id)?.dx ?? 0)}px`,
|
|
219
|
+
"--k2b-map-pin-dy": `${mapNumber(offsets().get(marker().id)?.dy ?? 0)}px`,
|
|
220
|
+
"--k2b-map-pin-hit": `${mapNumber(hitRadii().get(marker().id) ?? 22)}px`
|
|
221
|
+
});
|
|
222
|
+
if (!props.interactive) return (() => {
|
|
223
|
+
var _el$18 = _$getNextElement(_tmpl$7),
|
|
224
|
+
_el$19 = _el$18.firstChild;
|
|
225
|
+
_$insert(_el$19, () => marker().mark);
|
|
226
|
+
_$effect(_p$ => {
|
|
227
|
+
var _v$11 = marker().id,
|
|
228
|
+
_v$12 = marker().tone ?? "accent",
|
|
229
|
+
_v$13 = isStop(marker()) || undefined,
|
|
230
|
+
_v$14 = marker().mark === undefined || undefined,
|
|
231
|
+
_v$15 = selected()?.id === marker().id || undefined,
|
|
232
|
+
_v$16 = style(),
|
|
233
|
+
_v$17 = name();
|
|
234
|
+
_v$11 !== _p$.e && _$setAttribute(_el$18, "data-id", _p$.e = _v$11);
|
|
235
|
+
_v$12 !== _p$.t && _$setAttribute(_el$18, "data-tone", _p$.t = _v$12);
|
|
236
|
+
_v$13 !== _p$.a && _$setAttribute(_el$18, "data-stop", _p$.a = _v$13);
|
|
237
|
+
_v$14 !== _p$.o && _$setAttribute(_el$18, "data-drop", _p$.o = _v$14);
|
|
238
|
+
_v$15 !== _p$.i && _$setAttribute(_el$18, "data-selected", _p$.i = _v$15);
|
|
239
|
+
_p$.n = _$style(_el$18, _v$16, _p$.n);
|
|
240
|
+
_v$17 !== _p$.s && _$setAttribute(_el$18, "aria-label", _p$.s = _v$17);
|
|
241
|
+
return _p$;
|
|
242
|
+
}, {
|
|
243
|
+
e: undefined,
|
|
244
|
+
t: undefined,
|
|
245
|
+
a: undefined,
|
|
246
|
+
o: undefined,
|
|
247
|
+
i: undefined,
|
|
248
|
+
n: undefined,
|
|
249
|
+
s: undefined
|
|
250
|
+
});
|
|
251
|
+
return _el$18;
|
|
252
|
+
})();
|
|
253
|
+
return (() => {
|
|
254
|
+
var _el$20 = _$getNextElement(_tmpl$8),
|
|
255
|
+
_el$21 = _el$20.firstChild;
|
|
256
|
+
_el$20.$$click = () => props.onSelect?.(marker().id);
|
|
257
|
+
_el$20.$$keydown = event => keydown(event, id);
|
|
258
|
+
_$insert(_el$21, () => marker().mark);
|
|
259
|
+
_$effect(_p$ => {
|
|
260
|
+
var _v$18 = marker().id,
|
|
261
|
+
_v$19 = marker().tone ?? "accent",
|
|
262
|
+
_v$20 = isStop(marker()) || undefined,
|
|
263
|
+
_v$21 = marker().mark === undefined || undefined,
|
|
264
|
+
_v$22 = style(),
|
|
265
|
+
_v$23 = name(),
|
|
266
|
+
_v$24 = selected()?.id === marker().id,
|
|
267
|
+
_v$25 = (selected() ?? markers()[0])?.id === marker().id ? 0 : -1;
|
|
268
|
+
_v$18 !== _p$.e && _$setAttribute(_el$20, "data-id", _p$.e = _v$18);
|
|
269
|
+
_v$19 !== _p$.t && _$setAttribute(_el$20, "data-tone", _p$.t = _v$19);
|
|
270
|
+
_v$20 !== _p$.a && _$setAttribute(_el$20, "data-stop", _p$.a = _v$20);
|
|
271
|
+
_v$21 !== _p$.o && _$setAttribute(_el$20, "data-drop", _p$.o = _v$21);
|
|
272
|
+
_p$.i = _$style(_el$20, _v$22, _p$.i);
|
|
273
|
+
_v$23 !== _p$.n && _$setAttribute(_el$20, "aria-label", _p$.n = _v$23);
|
|
274
|
+
_v$24 !== _p$.s && _$setAttribute(_el$20, "aria-pressed", _p$.s = _v$24);
|
|
275
|
+
_v$25 !== _p$.h && _$setAttribute(_el$20, "tabindex", _p$.h = _v$25);
|
|
276
|
+
return _p$;
|
|
277
|
+
}, {
|
|
278
|
+
e: undefined,
|
|
279
|
+
t: undefined,
|
|
280
|
+
a: undefined,
|
|
281
|
+
o: undefined,
|
|
282
|
+
i: undefined,
|
|
283
|
+
n: undefined,
|
|
284
|
+
s: undefined,
|
|
285
|
+
h: undefined
|
|
286
|
+
});
|
|
287
|
+
_$runHydrationEvents();
|
|
288
|
+
return _el$20;
|
|
289
|
+
})();
|
|
290
|
+
}
|
|
291
|
+
}));
|
|
292
|
+
_$effect(_p$ => {
|
|
293
|
+
var _v$ = props.boxStyle ?? frameStyle(props.frame, props.padding ?? DEFAULT_PADDING),
|
|
294
|
+
_v$2 = `0 0 ${mapNumber(props.frame.spanX * S)} ${mapNumber(props.frame.spanY * S)}`,
|
|
295
|
+
_v$3 = messages().pins;
|
|
296
|
+
_p$.e = _$style(_el$, _v$, _p$.e);
|
|
297
|
+
_v$2 !== _p$.t && _$setAttribute(_el$2, "viewBox", _p$.t = _v$2);
|
|
298
|
+
_v$3 !== _p$.a && _$setAttribute(_el$9, "aria-label", _p$.a = _v$3);
|
|
299
|
+
return _p$;
|
|
300
|
+
}, {
|
|
301
|
+
e: undefined,
|
|
302
|
+
t: undefined,
|
|
303
|
+
a: undefined
|
|
304
|
+
});
|
|
305
|
+
return _el$;
|
|
306
|
+
})();
|
|
307
|
+
}
|
|
308
|
+
export function referenceScale(frame, padding) {
|
|
309
|
+
const center = unprojectPoint(frame.minX + frame.spanX / 2, frame.minY + frame.spanY / 2);
|
|
310
|
+
const spanMeters = frame.spanX * EARTH_CIRCUMFERENCE * Math.cos(center.lat * Math.PI / 180);
|
|
311
|
+
const bar = scaleBar(spanMeters / frame.referenceWidth);
|
|
312
|
+
return {
|
|
313
|
+
label: bar.label,
|
|
314
|
+
width: `calc(${fittedWidth(frame, padding)} * ${bar.meters / spanMeters})`
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
export function MapScaleBar(props) {
|
|
318
|
+
return (() => {
|
|
319
|
+
var _el$22 = _$getNextElement(_tmpl$9),
|
|
320
|
+
_el$23 = _el$22.firstChild;
|
|
321
|
+
_$insert(_el$23, () => props.scale.label);
|
|
322
|
+
_$effect(_$p => _$setStyleProperty(_el$22, "width", props.scale.width));
|
|
323
|
+
return _el$22;
|
|
324
|
+
})();
|
|
325
|
+
}
|
|
326
|
+
/** The scale bar and the attribution share the bottom row, so a long attribution wraps before it covers the scale. */
|
|
327
|
+
export function MapFootRow(props) {
|
|
328
|
+
return (() => {
|
|
329
|
+
var _el$24 = _$getNextElement(_tmpl$0),
|
|
330
|
+
_el$26 = _el$24.firstChild,
|
|
331
|
+
[_el$27, _co$6] = _$getNextMarker(_el$26.nextSibling),
|
|
332
|
+
_el$25 = _el$27.nextSibling;
|
|
333
|
+
_$insert(_el$24, _$createComponent(Show, {
|
|
334
|
+
get when() {
|
|
335
|
+
return props.scale;
|
|
336
|
+
},
|
|
337
|
+
children: scale => _$createComponent(MapScaleBar, {
|
|
338
|
+
get scale() {
|
|
339
|
+
return scale();
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
}), _el$27, _co$6);
|
|
343
|
+
_$insert(_el$25, () => props.children);
|
|
344
|
+
return _el$24;
|
|
345
|
+
})();
|
|
346
|
+
}
|
|
347
|
+
/** Geometry without a browser, a canvas, or a network dependency; suitable for server rendering and PDF output. */
|
|
348
|
+
export function MapViewFrame(props) {
|
|
349
|
+
const messages = useMapViewMessages();
|
|
350
|
+
const frame = createMemo(() => mapFrame(props, props.height, props.padding ?? DEFAULT_PADDING));
|
|
351
|
+
return (() => {
|
|
352
|
+
var _el$28 = _$getNextElement(_tmpl$1),
|
|
353
|
+
_el$29 = _el$28.firstChild,
|
|
354
|
+
_el$31 = _el$29.nextSibling,
|
|
355
|
+
[_el$32, _co$7] = _$getNextMarker(_el$31.nextSibling),
|
|
356
|
+
_el$30 = _el$32.nextSibling;
|
|
357
|
+
_$insert(_el$29, () => messages().summary({
|
|
358
|
+
count: props.markers?.length ?? 0
|
|
359
|
+
}));
|
|
360
|
+
_$insert(_el$28, _$createComponent(Show, {
|
|
361
|
+
get when() {
|
|
362
|
+
return frame();
|
|
363
|
+
},
|
|
364
|
+
children: value => _$createComponent(MapGeometry, _$mergeProps(props, {
|
|
365
|
+
get frame() {
|
|
366
|
+
return value();
|
|
367
|
+
}
|
|
368
|
+
}))
|
|
369
|
+
}), _el$32, _co$7);
|
|
370
|
+
_$insert(_el$30, _$createComponent(MapFootRow, {
|
|
371
|
+
get scale() {
|
|
372
|
+
return _$memo(() => !!frame())() ? referenceScale(frame(), props.padding ?? DEFAULT_PADDING) : undefined;
|
|
373
|
+
},
|
|
374
|
+
get children() {
|
|
375
|
+
return props.attribution;
|
|
376
|
+
}
|
|
377
|
+
}));
|
|
378
|
+
_$effect(_p$ => {
|
|
379
|
+
var _v$26 = `k2b-map-view${props.class ? ` ${props.class}` : ""}`,
|
|
380
|
+
_v$27 = `${props.height}px`,
|
|
381
|
+
_v$28 = messages().mapLabel;
|
|
382
|
+
_v$26 !== _p$.e && _$className(_el$28, _p$.e = _v$26);
|
|
383
|
+
_v$27 !== _p$.t && _$setStyleProperty(_el$28, "height", _p$.t = _v$27);
|
|
384
|
+
_v$28 !== _p$.a && _$setAttribute(_el$28, "aria-label", _p$.a = _v$28);
|
|
385
|
+
return _p$;
|
|
386
|
+
}, {
|
|
387
|
+
e: undefined,
|
|
388
|
+
t: undefined,
|
|
389
|
+
a: undefined
|
|
390
|
+
});
|
|
391
|
+
return _el$28;
|
|
392
|
+
})();
|
|
393
|
+
}
|
|
394
|
+
_$delegateEvents(["keydown", "click"]);
|
|
395
|
+
//# sourceMappingURL=MapViewFrame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["content/MapViewFrame.tsx"],"sourcesContent":["import { createMemo, For, type JSX, Show } from \"solid-js\";\nimport {\n DEFAULT_PADDING,\n EARTH_CIRCUMFERENCE,\n isStop,\n linePoints,\n type MapFrame,\n mapFrame,\n pinHitRadii,\n pinOffsets,\n projectPoint,\n scaleBar,\n sortMarkers,\n unprojectPoint,\n} from \"./map-view-geometry\";\nimport { useMapViewMessages } from \"./map-view-messages\";\nimport type { MapViewFrameProps, MapViewMarker, MapViewPoint } from \"./map-view-types\";\n\nexport type { MapViewFrameProps } from \"./map-view-types\";\n\nconst S = 1e6;\nexport const mapNumber = (value: number): string => String(Number(value.toFixed(6)));\nexport const selectedMarker = (markers: MapViewMarker[], selectedId?: string): MapViewMarker | undefined =>\n selectedId !== undefined ? markers.find((marker) => marker.id === selectedId) : markers.find((marker) => marker.selected);\n\n/** The CSS form of fitCamera's width rule, so the server lays out exactly what MapLibre shows. */\nconst fittedWidth = (frame: MapFrame, padding: number): string =>\n `max(min(100% - ${2 * padding}px, ${frame.referenceWidth}px), ${frame.minWidth}px)`;\n\nexport function frameStyle(frame: MapFrame, padding: number): JSX.CSSProperties {\n return {\n left: \"50%\",\n top: \"50%\",\n width: fittedWidth(frame, padding),\n \"aspect-ratio\": `${frame.spanX} / ${frame.spanY}`,\n transform: \"translate(-50%, -50%)\",\n };\n}\nconst pointInFrame = (point: MapViewPoint, frame: MapFrame) => {\n const p = projectPoint(point);\n return { x: (p.x - frame.minX) / frame.spanX, y: (p.y - frame.minY) / frame.spanY };\n};\nconst positionStyle = (point: MapViewPoint, frame: MapFrame): JSX.CSSProperties => {\n const p = pointInFrame(point, frame);\n return { left: `${mapNumber(p.x * 100)}%`, top: `${mapNumber(p.y * 100)}%` };\n};\nconst path = (points: MapViewPoint[], frame: MapFrame, closed = false): string =>\n points\n .map((point, index) => {\n const p = projectPoint(point);\n return `${index ? \"L\" : \"M\"}${mapNumber((p.x - frame.minX) * S)} ${mapNumber((p.y - frame.minY) * S)}`;\n })\n .join(\" \") + (closed && points.length ? \" Z\" : \"\");\n\nexport function MapGeometry(\n props: MapViewFrameProps & {\n frame: MapFrame;\n boxStyle?: JSX.CSSProperties;\n onSelect?: (id: string) => void;\n /** Pins are buttons in MapView; the standalone frame draws them as labelled images, never focusable. */\n interactive?: boolean;\n /** 2^(live zoom - fitted zoom), so pin separation follows the person's zoom; 1 until then. */\n zoomFactor?: number;\n },\n): JSX.Element {\n const messages = useMapViewMessages();\n const markers = createMemo(() => sortMarkers(props.markers ?? []));\n const markerIds = createMemo(() => markers().map((marker) => marker.id));\n const markersById = createMemo(() => new Map(markers().map((marker) => [marker.id, marker])));\n const offsets = createMemo(() => pinOffsets(markers(), props.frame, props.zoomFactor, props.ownLocation?.point));\n const hitRadii = createMemo(() => pinHitRadii(markers(), props.frame, offsets(), props.zoomFactor));\n // Input order decides the fallback selection, as in MapView; sorting is only for drawing and keys.\n const selected = createMemo(() => selectedMarker(props.markers ?? [], props.selectedId));\n const keydown = (event: KeyboardEvent & { currentTarget: HTMLButtonElement }, id: string) => {\n const index = markerIds().indexOf(id);\n let next: number;\n switch (event.key) {\n case \"ArrowRight\":\n case \"ArrowDown\":\n next = (index + 1) % markers().length;\n break;\n case \"ArrowLeft\":\n case \"ArrowUp\":\n next = (index + markers().length - 1) % markers().length;\n break;\n case \"Home\":\n next = 0;\n break;\n case \"End\":\n next = markers().length - 1;\n break;\n default:\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const target = markers()[next];\n if (target) {\n event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>(\".k2b-map-view__pin\")[next]?.focus({ preventScroll: true });\n props.onSelect?.(target.id);\n }\n };\n return (\n <div class=\"k2b-map-view__fit\" style={props.boxStyle ?? frameStyle(props.frame, props.padding ?? DEFAULT_PADDING)}>\n <svg\n class=\"k2b-map-view__geometry\"\n viewBox={`0 0 ${mapNumber(props.frame.spanX * S)} ${mapNumber(props.frame.spanY * S)}`}\n preserveAspectRatio=\"none\"\n overflow=\"visible\"\n aria-hidden=\"true\"\n >\n <For each={props.areas}>\n {(area) => (\n <path\n class=\"k2b-map-view__area\"\n data-tone={area.tone ?? \"accent\"}\n d={path(area.polygon, props.frame, true)}\n vector-effect=\"non-scaling-stroke\"\n />\n )}\n </For>\n <For each={props.lines}>\n {(line) => (\n <g class=\"k2b-map-view__line\" data-tone={line.tone ?? \"accent\"}>\n <Show when={!line.tone || line.tone === \"accent\" || line.tone === \"preview\"}>\n <path class=\"k2b-map-view__casing\" d={path(linePoints(line), props.frame)} vector-effect=\"non-scaling-stroke\" />\n </Show>\n <path class=\"k2b-map-view__stroke\" d={path(linePoints(line), props.frame)} vector-effect=\"non-scaling-stroke\" />\n </g>\n )}\n </For>\n <Show when={props.ownLocation}>\n {(location) => {\n const p = () => projectPoint(location().point);\n return (\n <circle\n class=\"k2b-map-view__accuracy\"\n cx={mapNumber((p().x - props.frame.minX) * S)}\n cy={mapNumber((p().y - props.frame.minY) * S)}\n r={mapNumber(\n ((location().accuracyMeters ?? 0) / (EARTH_CIRCUMFERENCE * Math.cos((location().point.lat * Math.PI) / 180))) * S,\n )}\n vector-effect=\"non-scaling-stroke\"\n />\n );\n }}\n </Show>\n </svg>\n <Show when={props.ownLocation}>\n {(location) => (\n <span\n class=\"k2b-map-view__me\"\n role=\"img\"\n aria-label={messages().ownLocation}\n style={positionStyle(location().point, props.frame)}\n />\n )}\n </Show>\n <div class=\"k2b-map-view__pins\" role=\"group\" aria-label={messages().pins}>\n <For each={markerIds()}>\n {(id) => {\n const marker = () => markersById().get(id)!;\n const name = () => (marker().mark === undefined ? marker().label : `${marker().mark} ${marker().label}`);\n const style = () => ({\n ...positionStyle(marker().point, props.frame),\n \"--k2b-map-pin-dx\": `${mapNumber(offsets().get(marker().id)?.dx ?? 0)}px`,\n \"--k2b-map-pin-dy\": `${mapNumber(offsets().get(marker().id)?.dy ?? 0)}px`,\n \"--k2b-map-pin-hit\": `${mapNumber(hitRadii().get(marker().id) ?? 22)}px`,\n });\n if (!props.interactive)\n return (\n <span\n class=\"k2b-map-view__pin\"\n data-id={marker().id}\n data-tone={marker().tone ?? \"accent\"}\n data-stop={isStop(marker()) || undefined}\n data-drop={marker().mark === undefined || undefined}\n data-selected={selected()?.id === marker().id || undefined}\n style={style()}\n role=\"img\"\n aria-label={name()}\n >\n <span aria-hidden=\"true\">{marker().mark}</span>\n </span>\n );\n return (\n <button\n type=\"button\"\n class=\"k2b-map-view__pin\"\n data-id={marker().id}\n data-tone={marker().tone ?? \"accent\"}\n data-stop={isStop(marker()) || undefined}\n data-drop={marker().mark === undefined || undefined}\n style={style()}\n aria-label={name()}\n aria-pressed={selected()?.id === marker().id}\n tabIndex={(selected() ?? markers()[0])?.id === marker().id ? 0 : -1}\n onKeyDown={(event) => keydown(event, id)}\n onClick={() => props.onSelect?.(marker().id)}\n >\n <span aria-hidden=\"true\">{marker().mark}</span>\n </button>\n );\n }}\n </For>\n </div>\n </div>\n );\n}\nexport type MapScale = { label: string; width: string };\nexport function referenceScale(frame: MapFrame, padding: number): MapScale {\n const center = unprojectPoint(frame.minX + frame.spanX / 2, frame.minY + frame.spanY / 2);\n const spanMeters = frame.spanX * EARTH_CIRCUMFERENCE * Math.cos((center.lat * Math.PI) / 180);\n const bar = scaleBar(spanMeters / frame.referenceWidth);\n return { label: bar.label, width: `calc(${fittedWidth(frame, padding)} * ${bar.meters / spanMeters})` };\n}\nexport function MapScaleBar(props: { scale: MapScale }): JSX.Element {\n return (\n <div class=\"k2b-map-view__scale\" style={{ width: props.scale.width }}>\n <span>{props.scale.label}</span>\n <div />\n </div>\n );\n}\n/** The scale bar and the attribution share the bottom row, so a long attribution wraps before it covers the scale. */\nexport function MapFootRow(props: { scale?: MapScale; children?: JSX.Element }): JSX.Element {\n return (\n <div class=\"k2b-map-view__foot-row\">\n <Show when={props.scale}>{(scale) => <MapScaleBar scale={scale()} />}</Show>\n <div class=\"k2b-map-view__attribution\">{props.children}</div>\n </div>\n );\n}\n/** Geometry without a browser, a canvas, or a network dependency; suitable for server rendering and PDF output. */\nexport function MapViewFrame(props: MapViewFrameProps): JSX.Element {\n const messages = useMapViewMessages();\n const frame = createMemo(() => mapFrame(props, props.height, props.padding ?? DEFAULT_PADDING));\n return (\n <div\n class={`k2b-map-view${props.class ? ` ${props.class}` : \"\"}`}\n style={{ height: `${props.height}px` }}\n data-state=\"static\"\n role=\"region\"\n aria-label={messages().mapLabel}\n >\n <span class=\"k2b-sr-only\">{messages().summary({ count: props.markers?.length ?? 0 })}</span>\n <Show when={frame()}>{(value) => <MapGeometry {...props} frame={value()} />}</Show>\n <div class=\"k2b-map-view__foot\">\n <MapFootRow scale={frame() ? referenceScale(frame()!, props.padding ?? DEFAULT_PADDING) : undefined}>\n {props.attribution}\n </MapFootRow>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,UAAU,EAAE,GAAG,EAAY,IAAI,QAAQ,UAAU;AAC1D,SACE,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,UAAU,EAEV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,cAAc,QACT,qBAAqB;AAC5B,SAAS,kBAAkB,QAAQ,qBAAqB;AAKxD,MAAM,CAAC,GAAG,GAAG;AACb,OAAO,MAAM,SAAS,GAAI,KAAa,IAAa,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACpF,OAAO,MAAM,cAAc,GAAG,CAAC,OAAwB,EAAE,UAAmB,KAC1E,UAAU,KAAK,SAAS,GAAG,OAAO,CAAC,IAAI,CAAE,MAAM,IAAK,MAAM,CAAC,EAAE,KAAK,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAE,MAAM,IAAK,MAAM,CAAC,QAAQ,CAAC;;AAE3H;AACA,MAAM,WAAW,GAAG,CAAC,KAAe,EAAE,OAAe,KACnD,kBAAkB,CAAC,GAAG,OAAO,OAAO,KAAK,CAAC,cAAc,QAAQ,KAAK,CAAC,QAAQ,KAAK;AAErF,OAAO,SAAS,UAAU,CAAC,KAAe,EAAE,OAAe,EAAqB;EAC9E,OAAO;IACL,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,KAAK,EAAE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AE;QAAA,QAC3C,GAAG,KAAK,CAAC,MAAM,IAAI;QAAA,QAGxB,QAAQ,CAAC,CAAC,CAAC,QAAQ;MAAA;MAAA;MAAA;MAAA;IAAA;MAAA;MAAA;MAAA;IAAA;IAAA;EAAA;AAWrC;AAAC","ignoreList":[]}
|
|
@@ -295,7 +295,10 @@ export function createChartInspector(options) {
|
|
|
295
295
|
if (hit && nodes.includes(hit)) return hit;
|
|
296
296
|
if (seriesChart()) {
|
|
297
297
|
const plot = updatePlotBounds();
|
|
298
|
-
|
|
298
|
+
// SVG transforms and DOM rectangles can round the same painted edge
|
|
299
|
+
// differently. Keep its half-pixel raster fringe inspectable.
|
|
300
|
+
const edgeTolerance = 0.5;
|
|
301
|
+
if (plot && (x < plot.left - edgeTolerance || x > plot.right + edgeTolerance || y < plot.top - edgeTolerance || y > plot.bottom + edgeTolerance)) return;
|
|
299
302
|
}
|
|
300
303
|
// Exact shapes win. A small physical hit radius also reaches tiny or
|
|
301
304
|
// zero-sized marks; distant whitespace leaves the chart unselected.
|