@nivaro/react 0.3.45 → 0.3.46
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/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +42 -7
- package/dist/shared/components/BaseMap.js +149 -103
- package/dist/shared/components/command-center/CommandCenterView.js +313 -69
- package/dist/shared/components/command-center/Customize.js +353 -0
- package/dist/shared/components/command-center/Header.js +279 -53
- package/dist/shared/components/command-center/KioskLinks.js +198 -0
- package/dist/shared/components/command-center/PeekPanel.js +143 -3
- package/dist/shared/components/command-center/announce.js +13 -0
- package/dist/shared/components/command-center/board-prefs.js +99 -0
- package/dist/shared/components/command-center/freshness.js +29 -0
- package/dist/shared/components/command-center/layout.js +56 -0
- package/dist/shared/components/command-center/panels/AttentionPanel.js +132 -3
- package/dist/shared/components/command-center/panels/Banner.js +75 -0
- package/dist/shared/components/command-center/panels/BoardSettings.js +223 -0
- package/dist/shared/components/command-center/panels/FeedPanel.js +145 -29
- package/dist/shared/components/command-center/panels/FlowPanel.js +154 -56
- package/dist/shared/components/command-center/panels/ForecastPanel.js +244 -3
- package/dist/shared/components/command-center/panels/MapLegend.js +266 -0
- package/dist/shared/components/command-center/panels/MapPanel.js +216 -66
- package/dist/shared/components/command-center/panels/PartnersPanel.js +49 -3
- package/dist/shared/components/command-center/panels/PeoplePanel.js +257 -40
- package/dist/shared/components/command-center/panels/RegionPicker.js +88 -3
- package/dist/shared/components/command-center/panels/SystemPanel.js +158 -38
- package/dist/shared/components/command-center/panels/ThroughputPanel.js +307 -3
- package/dist/shared/components/command-center/panels/TimeBar.js +227 -6
- package/dist/shared/components/command-center/panels/TrafficPanel.js +12 -8
- package/dist/shared/components/command-center/panels/WorkloadPanel.js +82 -3
- package/dist/shared/components/command-center/panels/attention-actions.js +267 -0
- package/dist/shared/components/command-center/panels/map-shared.js +95 -0
- package/dist/shared/components/command-center/panels/registry.js +87 -19
- package/dist/shared/components/command-center/shell-hooks.js +118 -0
- package/dist/shared/components/command-center/shortcuts.js +37 -0
- package/dist/shared/components/command-center/theme.js +39 -21
- package/dist/shared/components/command-center/time.js +52 -0
- package/dist/shared/components/command-center/url-state.js +54 -0
- package/dist/shared/components/command-center/work-links.js +32 -0
- package/dist/shared/components/monitoring/TrafficMiniMap.js +111 -70
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import { noteReplayEvent as _e, createReplayCheckoutState as De } from "../share
|
|
|
9
9
|
import { emitReplayTap as Te, setReplayRecorderMode as N, registerReplayCapture as qe, clipEndOffset as Le, withClipKind as Pe } from "../shared/lib/replay-capture.js";
|
|
10
10
|
import { instrumentConsole as Ne, instrumentRequests as Fe, redactSecrets as Me } from "../shared/lib/replay-context.js";
|
|
11
11
|
import { instrumentSocket as Oe } from "../shared/lib/replay-socket.js";
|
|
12
|
-
const Ue = "nivaro-react@0.3.
|
|
12
|
+
const Ue = "nivaro-react@0.3.46", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
|
|
13
13
|
function Be(n) {
|
|
14
14
|
return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
|
|
15
15
|
const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
|
package/dist/index.d.ts
CHANGED
|
@@ -1002,7 +1002,7 @@ export declare interface BannerLine {
|
|
|
1002
1002
|
* banner AND anywhere else that ends up wanting the same sentence. */
|
|
1003
1003
|
export declare function bannerLines(rows: Row[], now?: Date): BannerLine[];
|
|
1004
1004
|
|
|
1005
|
-
export declare function BaseMap({ pins, bubbles, statusLine, onPinClick, onBubbleClick, minHeight, focus }: {
|
|
1005
|
+
export declare function BaseMap({ pins, bubbles, statusLine, onPinClick, onBubbleClick, minHeight, focus, clusterColor, dots, onDotClick }: {
|
|
1006
1006
|
pins: BaseMapPin[];
|
|
1007
1007
|
bubbles?: BaseMapBubble[];
|
|
1008
1008
|
/** Bottom-left caption ("214 pinned · © OpenStreetMap"). */
|
|
@@ -1018,6 +1018,12 @@ export declare function BaseMap({ pins, bubbles, statusLine, onPinClick, onBubbl
|
|
|
1018
1018
|
zoom?: number;
|
|
1019
1019
|
nonce: number;
|
|
1020
1020
|
} | null;
|
|
1021
|
+
/** Colour of a cluster disc from its pins (e.g. the worst child's); default: red when any
|
|
1022
|
+
* pin pulses, else the first pin's colour. */
|
|
1023
|
+
clusterColor?: (pins: BaseMapPin[]) => string;
|
|
1024
|
+
/** Extra point layer (see BaseMapDot). */
|
|
1025
|
+
dots?: BaseMapDot[];
|
|
1026
|
+
onDotClick?: (id: string) => void;
|
|
1021
1027
|
}): JSX.Element;
|
|
1022
1028
|
|
|
1023
1029
|
export declare interface BaseMapBubble {
|
|
@@ -1029,6 +1035,17 @@ export declare interface BaseMapBubble {
|
|
|
1029
1035
|
color?: string;
|
|
1030
1036
|
}
|
|
1031
1037
|
|
|
1038
|
+
/** A light point layer (heat / activity / people out) — never clustered, drawn under pins. */
|
|
1039
|
+
declare interface BaseMapDot {
|
|
1040
|
+
id: string;
|
|
1041
|
+
lat: number;
|
|
1042
|
+
lng: number;
|
|
1043
|
+
label: string;
|
|
1044
|
+
color: string;
|
|
1045
|
+
/** 0..1 — size and opacity. */
|
|
1046
|
+
weight?: number;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1032
1049
|
export declare interface BaseMapPin {
|
|
1033
1050
|
id: string;
|
|
1034
1051
|
lat: number;
|
|
@@ -1065,6 +1082,12 @@ declare interface Blur {
|
|
|
1065
1082
|
strength: number;
|
|
1066
1083
|
}
|
|
1067
1084
|
|
|
1085
|
+
/** How the board reads and replaces the URL's query string. */
|
|
1086
|
+
declare interface BoardUrlAdapter {
|
|
1087
|
+
read: () => string;
|
|
1088
|
+
replace: (search: string) => void;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1068
1091
|
export declare function BooleanField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
|
|
1069
1092
|
|
|
1070
1093
|
export declare function BroadcastView({ className }: {
|
|
@@ -2173,21 +2196,30 @@ declare interface ColumnPreset {
|
|
|
2173
2196
|
* someone (attention), who's on (people) and a one-line system status that hands off to the
|
|
2174
2197
|
* Traffic Map (the machine's own board). Every number clicks through to its real surface.
|
|
2175
2198
|
*
|
|
2176
|
-
* Structure: this shell owns the board state (state.tsx)
|
|
2177
|
-
* (
|
|
2178
|
-
*
|
|
2199
|
+
* Structure: this shell owns the board state (state.tsx), the lenses in the URL (url-state.ts),
|
|
2200
|
+
* the person's prefs (board-prefs.ts), keyboard shortcuts, TV / full screen and the layout
|
|
2201
|
+
* (layout.ts arrangeBoard places the panel registry for the screen size); each panel is its own
|
|
2202
|
+
* module reading useCc() + useCcQuery(). The contract with the API is types.ts.
|
|
2203
|
+
*
|
|
2204
|
+
* Layout — "what needs someone right now" leads at every size:
|
|
2205
|
+
* ≥1800px three columns: Needs attention + Workload | map (+ live feed under it) | rail
|
|
2206
|
+
* ≥1280px map (+ feed) | rail opening with Needs attention, beside the map's top edge
|
|
2207
|
+
* <1280px one column: attention first, then the map (on a phone behind "Show map"), the rest
|
|
2179
2208
|
*
|
|
2180
|
-
* Hosts: NivaroProvider + NavigationContext required.
|
|
2209
|
+
* Hosts: NivaroProvider + NavigationContext required. A wallboard link (`kiosk`) shows the
|
|
2210
|
+
* board read-only, always dark and in TV mode, with no prefs, no URL writes and no navigation.
|
|
2181
2211
|
*/
|
|
2182
2212
|
export declare function CommandCenterView({
|
|
2183
2213
|
/** Fallback map collections when the instance has no Command Center config yet. */
|
|
2184
|
-
geoCollections, recordUrl, isAdmin, kiosk }: {
|
|
2214
|
+
geoCollections, recordUrl, isAdmin, kiosk, urlAdapter }: {
|
|
2185
2215
|
geoCollections?: string[];
|
|
2186
2216
|
/** Host route for a record — defaults to the admin shape. */
|
|
2187
2217
|
recordUrl?: (collection: string, id: string) => string;
|
|
2188
2218
|
isAdmin?: boolean;
|
|
2189
2219
|
/** Wallboard link token (read-only board). */
|
|
2190
2220
|
kiosk?: string | null;
|
|
2221
|
+
/** How the board reads/replaces the query string; default history.replaceState. */
|
|
2222
|
+
urlAdapter?: BoardUrlAdapter;
|
|
2191
2223
|
}): JSX.Element;
|
|
2192
2224
|
|
|
2193
2225
|
export declare function CommentPanel({ collection, item, title, defaultExpanded, queuedComments, onQueueComment }: {
|
|
@@ -10761,7 +10793,7 @@ declare interface TopicPresence {
|
|
|
10761
10793
|
/** Install the listeners. Safe to call more than once. */
|
|
10762
10794
|
export declare function trackActivity(): void;
|
|
10763
10795
|
|
|
10764
|
-
export declare function TrafficMiniMap({ window: win, tone, href, refreshMs, className }: {
|
|
10796
|
+
export declare function TrafficMiniMap({ window: win, tone, href, refreshMs, className, onPickTime }: {
|
|
10765
10797
|
window?: 60 | 300 | 900;
|
|
10766
10798
|
tone?: 'auto' | 'dark';
|
|
10767
10799
|
/** Where "Open" goes. An absolute URL (another app's admin) opens in a new tab; default
|
|
@@ -10769,6 +10801,9 @@ export declare function TrafficMiniMap({ window: win, tone, href, refreshMs, cla
|
|
|
10769
10801
|
href?: string;
|
|
10770
10802
|
refreshMs?: number;
|
|
10771
10803
|
className?: string;
|
|
10804
|
+
/** When set, each lane's sparkline is a button: clicking a point (or Enter = the lane's
|
|
10805
|
+
* spike) hands back that minute — the Command Center rewinds to it. */
|
|
10806
|
+
onPickTime?: (ms: number) => void;
|
|
10772
10807
|
}): JSX.Element | null;
|
|
10773
10808
|
|
|
10774
10809
|
/**
|
|
@@ -1,168 +1,185 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
return (
|
|
1
|
+
import { jsxs as b, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { Plus as G, Minus as J } from "lucide-react";
|
|
3
|
+
import { useRef as E, useState as C, useEffect as R, useMemo as K } from "react";
|
|
4
|
+
const s = 256, Q = (c, d, p) => `https://tile.openstreetmap.org/${c}/${d}/${p}.png`;
|
|
5
|
+
function w(c, d) {
|
|
6
|
+
return (c + 180) / 360 * 2 ** d;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const p =
|
|
10
|
-
return (1 - Math.log(Math.tan(p) + 1 / Math.cos(p)) / Math.PI) / 2 * 2 **
|
|
8
|
+
function y(c, d) {
|
|
9
|
+
const p = c * Math.PI / 180;
|
|
10
|
+
return (1 - Math.log(Math.tan(p) + 1 / Math.cos(p)) / Math.PI) / 2 * 2 ** d;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
12
|
+
function T(c, d) {
|
|
13
|
+
return c / 2 ** d * 360 - 180;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
const p = Math.PI - 2 * Math.PI *
|
|
15
|
+
function D(c, d) {
|
|
16
|
+
const p = Math.PI - 2 * Math.PI * c / 2 ** d;
|
|
17
17
|
return 180 / Math.PI * Math.atan(0.5 * (Math.exp(p) - Math.exp(-p)));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
pins:
|
|
21
|
-
bubbles:
|
|
19
|
+
function nt({
|
|
20
|
+
pins: c,
|
|
21
|
+
bubbles: d = [],
|
|
22
22
|
statusLine: p,
|
|
23
|
-
onPinClick:
|
|
24
|
-
onBubbleClick:
|
|
25
|
-
minHeight:
|
|
26
|
-
focus:
|
|
23
|
+
onPinClick: P,
|
|
24
|
+
onBubbleClick: N,
|
|
25
|
+
minHeight: U = 420,
|
|
26
|
+
focus: m = null,
|
|
27
|
+
clusterColor: Y,
|
|
28
|
+
dots: Z = [],
|
|
29
|
+
onDotClick: k
|
|
27
30
|
}) {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
const t =
|
|
31
|
+
const L = E(null), [a, q] = C({ w: 800, h: 520 }), [B, z] = C(null), S = E(null);
|
|
32
|
+
R(() => {
|
|
33
|
+
const t = L.current;
|
|
31
34
|
if (!t) return;
|
|
32
|
-
const e = new ResizeObserver(() =>
|
|
35
|
+
const e = new ResizeObserver(() => q({ w: t.clientWidth, h: t.clientHeight }));
|
|
33
36
|
return e.observe(t), () => e.disconnect();
|
|
34
37
|
}, []);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const t = [...
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
const e = t.map((M) => M.lat), o = t.map((M) => M.lng), n = Math.min(...e),
|
|
38
|
+
const W = E(!1);
|
|
39
|
+
R(() => {
|
|
40
|
+
const t = [...c, ...d];
|
|
41
|
+
if (W.current || t.length === 0) return;
|
|
42
|
+
W.current = !0;
|
|
43
|
+
const e = t.map((M) => M.lat), o = t.map((M) => M.lng), n = Math.min(...e), r = Math.max(...e), i = Math.min(...o), u = Math.max(...o), $ = { lat: (n + r) / 2, lng: (i + u) / 2 };
|
|
41
44
|
let x = 15;
|
|
42
45
|
for (; x > 3; ) {
|
|
43
|
-
const M = Math.abs(
|
|
44
|
-
if (M < a.w * 0.85 &&
|
|
46
|
+
const M = Math.abs(w(u, x) - w(i, x)) * s, F = Math.abs(y(n, x) - y(r, x)) * s;
|
|
47
|
+
if (M < a.w * 0.85 && F < a.h * 0.85) break;
|
|
45
48
|
x--;
|
|
46
49
|
}
|
|
47
|
-
z({
|
|
48
|
-
}, [
|
|
49
|
-
|
|
50
|
-
}, [
|
|
51
|
-
const
|
|
52
|
-
for (let t =
|
|
53
|
-
for (let e =
|
|
50
|
+
z({ ...$, zoom: x });
|
|
51
|
+
}, [c, d, a]), R(() => {
|
|
52
|
+
m && z({ lat: m.lat, lng: m.lng, zoom: m.zoom ?? 8 });
|
|
53
|
+
}, [m == null ? void 0 : m.nonce]);
|
|
54
|
+
const l = B ?? { lat: 39.5, lng: -98.35, zoom: 4 }, g = w(l.lng, l.zoom), f = y(l.lat, l.zoom), X = [], v = 2 ** l.zoom, H = Math.floor(g - a.w / 2 / s), O = Math.ceil(g + a.w / 2 / s), V = Math.max(0, Math.floor(f - a.h / 2 / s)), _ = Math.min(v - 1, Math.ceil(f + a.h / 2 / s));
|
|
55
|
+
for (let t = H; t <= O; t++)
|
|
56
|
+
for (let e = V; e <= _; e++) {
|
|
54
57
|
const o = (t % v + v) % v;
|
|
55
|
-
|
|
56
|
-
z:
|
|
58
|
+
X.push({
|
|
59
|
+
z: l.zoom,
|
|
57
60
|
x: o,
|
|
58
61
|
y: e,
|
|
59
|
-
left: a.w / 2 + (t -
|
|
60
|
-
top: a.h / 2 + (e -
|
|
62
|
+
left: a.w / 2 + (t - g) * s,
|
|
63
|
+
top: a.h / 2 + (e - f) * s
|
|
61
64
|
});
|
|
62
65
|
}
|
|
63
|
-
const
|
|
64
|
-
x: a.w / 2 + (
|
|
65
|
-
y: a.h / 2 + (
|
|
66
|
-
}),
|
|
66
|
+
const I = (t, e) => ({
|
|
67
|
+
x: a.w / 2 + (w(e, l.zoom) - g) * s,
|
|
68
|
+
y: a.h / 2 + (y(t, l.zoom) - f) * s
|
|
69
|
+
}), A = K(() => {
|
|
67
70
|
const e = /* @__PURE__ */ new Map();
|
|
68
|
-
for (const o of
|
|
69
|
-
const { x: n, y:
|
|
70
|
-
if (n < -60 || n > a.w + 60 ||
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
for (const o of c) {
|
|
72
|
+
const { x: n, y: r } = I(o.lat, o.lng);
|
|
73
|
+
if (n < -60 || n > a.w + 60 || r < -60 || r > a.h + 60) continue;
|
|
74
|
+
const i = `${Math.round(n / 44)}:${Math.round(r / 44)}`, u = e.get(i) ?? { pins: [], sx: 0, sy: 0 };
|
|
75
|
+
u.pins.push(o), u.sx += n, u.sy += r, e.set(i, u);
|
|
73
76
|
}
|
|
74
77
|
return [...e.values()].map((o) => ({
|
|
75
78
|
pins: o.pins,
|
|
76
79
|
x: o.sx / o.pins.length,
|
|
77
80
|
y: o.sy / o.pins.length
|
|
78
81
|
}));
|
|
79
|
-
}, [
|
|
82
|
+
}, [c, l, g, f, a]), j = (t, e) => {
|
|
80
83
|
z((o) => {
|
|
81
|
-
const n = o ??
|
|
82
|
-
if (
|
|
84
|
+
const n = o ?? l, r = Math.max(2, Math.min(18, n.zoom + t));
|
|
85
|
+
if (r === n.zoom) return n;
|
|
83
86
|
if (e) {
|
|
84
|
-
const
|
|
87
|
+
const i = w(n.lng, n.zoom) + (e.x - a.w / 2) / s, u = y(n.lat, n.zoom) + (e.y - a.h / 2) / s, $ = 2 ** (r - n.zoom);
|
|
85
88
|
return {
|
|
86
|
-
lng:
|
|
87
|
-
lat:
|
|
88
|
-
zoom:
|
|
89
|
+
lng: T(i * $ - (e.x - a.w / 2) / s, r),
|
|
90
|
+
lat: D(u * $ - (e.y - a.h / 2) / s, r),
|
|
91
|
+
zoom: r
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
|
-
return { ...n, zoom:
|
|
94
|
+
return { ...n, zoom: r };
|
|
92
95
|
});
|
|
93
96
|
};
|
|
94
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ b(
|
|
95
98
|
"div",
|
|
96
99
|
{
|
|
97
|
-
ref:
|
|
100
|
+
ref: L,
|
|
98
101
|
className: "relative h-full w-full cursor-grab overflow-hidden rounded-lg border border-slate-200 bg-slate-100 active:cursor-grabbing dark:border-border dark:bg-muted",
|
|
99
|
-
style: { minHeight:
|
|
102
|
+
style: { minHeight: U },
|
|
100
103
|
"data-base-map": !0,
|
|
101
104
|
onPointerDown: (t) => {
|
|
102
|
-
|
|
105
|
+
S.current = { x: t.clientX, y: t.clientY, lat: l.lat, lng: l.lng }, t.currentTarget.setPointerCapture(t.pointerId);
|
|
103
106
|
},
|
|
104
107
|
onPointerMove: (t) => {
|
|
105
|
-
const e =
|
|
108
|
+
const e = S.current;
|
|
106
109
|
if (!e) return;
|
|
107
|
-
const o = (t.clientX - e.x) /
|
|
110
|
+
const o = (t.clientX - e.x) / s, n = (t.clientY - e.y) / s;
|
|
108
111
|
z({
|
|
109
|
-
zoom:
|
|
110
|
-
lng:
|
|
111
|
-
lat:
|
|
112
|
+
zoom: l.zoom,
|
|
113
|
+
lng: T(w(e.lng, l.zoom) - o, l.zoom),
|
|
114
|
+
lat: D(y(e.lat, l.zoom) - n, l.zoom)
|
|
112
115
|
});
|
|
113
116
|
},
|
|
114
117
|
onPointerUp: () => {
|
|
115
|
-
|
|
118
|
+
S.current = null;
|
|
116
119
|
},
|
|
117
120
|
onWheel: (t) => {
|
|
118
121
|
var o;
|
|
119
122
|
t.preventDefault();
|
|
120
|
-
const e = (o =
|
|
121
|
-
|
|
123
|
+
const e = (o = L.current) == null ? void 0 : o.getBoundingClientRect();
|
|
124
|
+
j(
|
|
125
|
+
t.deltaY < 0 ? 1 : -1,
|
|
126
|
+
e ? { x: t.clientX - e.left, y: t.clientY - e.top } : void 0
|
|
127
|
+
);
|
|
122
128
|
},
|
|
123
129
|
children: [
|
|
124
|
-
|
|
130
|
+
X.map((t) => /* @__PURE__ */ h(
|
|
125
131
|
"img",
|
|
126
132
|
{
|
|
127
|
-
src:
|
|
133
|
+
src: Q(t.z, t.x, t.y),
|
|
128
134
|
alt: "",
|
|
129
135
|
draggable: !1,
|
|
130
136
|
className: "pointer-events-none absolute select-none",
|
|
131
|
-
style: { left: t.left, top: t.top, width:
|
|
137
|
+
style: { left: t.left, top: t.top, width: s, height: s }
|
|
132
138
|
},
|
|
133
139
|
`${t.z}/${t.x}/${t.y}`
|
|
134
140
|
)),
|
|
135
|
-
|
|
136
|
-
const { x: e, y: o } =
|
|
141
|
+
d.map((t) => {
|
|
142
|
+
const { x: e, y: o } = I(t.lat, t.lng);
|
|
137
143
|
if (e < -120 || e > a.w + 120 || o < -120 || o > a.h + 120) return null;
|
|
138
|
-
const n = Math.min(56, 18 + Math.sqrt(t.count) * 7),
|
|
139
|
-
return /* @__PURE__ */
|
|
144
|
+
const n = Math.min(56, 18 + Math.sqrt(t.count) * 7), r = t.color ?? "#00a5cc";
|
|
145
|
+
return /* @__PURE__ */ b(
|
|
140
146
|
"button",
|
|
141
147
|
{
|
|
142
148
|
type: "button",
|
|
143
|
-
onClick: (
|
|
144
|
-
|
|
149
|
+
onClick: (i) => {
|
|
150
|
+
i.stopPropagation(), N == null || N(t.id);
|
|
145
151
|
},
|
|
146
|
-
onPointerDown: (
|
|
152
|
+
onPointerDown: (i) => i.stopPropagation(),
|
|
147
153
|
className: "absolute z-[1] -translate-x-1/2 -translate-y-1/2",
|
|
148
154
|
style: { left: e, top: o },
|
|
149
155
|
"data-tip": `${t.label} — ${t.count} online`,
|
|
156
|
+
"aria-label": `${t.label}: ${t.count} online`,
|
|
150
157
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ b(
|
|
152
159
|
"span",
|
|
153
160
|
{
|
|
154
161
|
className: "flex items-center justify-center gap-0.5 rounded-full font-bold text-white",
|
|
155
162
|
style: {
|
|
156
163
|
width: n * 2,
|
|
157
164
|
height: n * 2,
|
|
158
|
-
background: `${
|
|
159
|
-
border: `2.5px dashed ${
|
|
160
|
-
boxShadow: `0 0 0 3px ${
|
|
165
|
+
background: `${r}45`,
|
|
166
|
+
border: `2.5px dashed ${r}`,
|
|
167
|
+
boxShadow: `0 0 0 3px ${r}22`,
|
|
161
168
|
fontSize: Math.max(12, Math.min(18, n / 2)),
|
|
162
169
|
textShadow: "0 1px 2px rgba(0,0,0,0.55)"
|
|
163
170
|
},
|
|
164
171
|
children: [
|
|
165
|
-
/* @__PURE__ */ h(
|
|
172
|
+
/* @__PURE__ */ h(
|
|
173
|
+
"svg",
|
|
174
|
+
{
|
|
175
|
+
width: "12",
|
|
176
|
+
height: "12",
|
|
177
|
+
viewBox: "0 0 24 24",
|
|
178
|
+
fill: "currentColor",
|
|
179
|
+
"aria-hidden": "true",
|
|
180
|
+
children: /* @__PURE__ */ h("path", { d: "M12 12c2.7 0 4.8-2.1 4.8-4.8S14.7 2.4 12 2.4 7.2 4.5 7.2 7.2 9.3 12 12 12zm0 2.4c-3.2 0-9.6 1.6-9.6 4.8v2.4h19.2v-2.4c0-3.2-6.4-4.8-9.6-4.8z" })
|
|
181
|
+
}
|
|
182
|
+
),
|
|
166
183
|
t.count
|
|
167
184
|
]
|
|
168
185
|
}
|
|
@@ -171,7 +188,7 @@ function tt({
|
|
|
171
188
|
"span",
|
|
172
189
|
{
|
|
173
190
|
className: "mt-0.5 block whitespace-nowrap text-center text-[10.5px] font-semibold",
|
|
174
|
-
style: { color:
|
|
191
|
+
style: { color: r, textShadow: "0 0 3px #fff, 0 0 3px #fff" },
|
|
175
192
|
children: t.label
|
|
176
193
|
}
|
|
177
194
|
)
|
|
@@ -180,27 +197,55 @@ function tt({
|
|
|
180
197
|
`bubble-${t.id}`
|
|
181
198
|
);
|
|
182
199
|
}),
|
|
183
|
-
|
|
184
|
-
|
|
200
|
+
Z.map((t) => {
|
|
201
|
+
const { x: e, y: o } = I(t.lat, t.lng);
|
|
202
|
+
if (e < -40 || e > a.w + 40 || o < -40 || o > a.h + 40) return null;
|
|
203
|
+
const n = Math.max(0.15, Math.min(1, t.weight ?? 0.6)), r = 6 + n * 10;
|
|
204
|
+
return /* @__PURE__ */ h(
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
type: "button",
|
|
208
|
+
onClick: (i) => {
|
|
209
|
+
i.stopPropagation(), k == null || k(t.id);
|
|
210
|
+
},
|
|
211
|
+
onPointerDown: (i) => i.stopPropagation(),
|
|
212
|
+
className: "absolute z-[1] -translate-x-1/2 -translate-y-1/2 rounded-full",
|
|
213
|
+
style: {
|
|
214
|
+
left: e,
|
|
215
|
+
top: o,
|
|
216
|
+
width: r * 2,
|
|
217
|
+
height: r * 2,
|
|
218
|
+
background: `${t.color}${Math.round(40 + n * 100).toString(16).padStart(2, "0")}`,
|
|
219
|
+
border: `1.5px solid ${t.color}`
|
|
220
|
+
},
|
|
221
|
+
"data-tip": t.label,
|
|
222
|
+
"aria-label": t.label
|
|
223
|
+
},
|
|
224
|
+
`dot-${t.id}`
|
|
225
|
+
);
|
|
226
|
+
}),
|
|
227
|
+
A.map(
|
|
228
|
+
(t) => t.pins.length === 1 ? /* @__PURE__ */ b(
|
|
185
229
|
"button",
|
|
186
230
|
{
|
|
187
231
|
type: "button",
|
|
188
232
|
onClick: (e) => {
|
|
189
|
-
e.stopPropagation(),
|
|
233
|
+
e.stopPropagation(), P == null || P(t.pins[0].id);
|
|
190
234
|
},
|
|
191
235
|
onPointerDown: (e) => e.stopPropagation(),
|
|
192
236
|
className: "group absolute z-[2] -translate-x-1/2 -translate-y-full",
|
|
193
237
|
style: { left: t.x, top: t.y },
|
|
194
238
|
"data-tip": t.pins[0].label,
|
|
239
|
+
"aria-label": t.pins[0].label,
|
|
195
240
|
children: [
|
|
196
241
|
t.pins[0].pulse && /* @__PURE__ */ h(
|
|
197
242
|
"span",
|
|
198
243
|
{
|
|
199
|
-
className: "absolute left-1/2 top-[10px] h-6 w-6 -translate-x-1/2 -translate-y-1/2 animate-ping rounded-full",
|
|
244
|
+
className: "absolute left-1/2 top-[10px] h-6 w-6 -translate-x-1/2 -translate-y-1/2 motion-safe:animate-ping rounded-full",
|
|
200
245
|
style: { background: `${t.pins[0].color ?? "#ef4444"}66` }
|
|
201
246
|
}
|
|
202
247
|
),
|
|
203
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ b("svg", { width: "24", height: "30", viewBox: "0 0 24 30", "aria-hidden": "true", className: "relative", children: [
|
|
204
249
|
/* @__PURE__ */ h(
|
|
205
250
|
"path",
|
|
206
251
|
{
|
|
@@ -221,9 +266,9 @@ function tt({
|
|
|
221
266
|
type: "button",
|
|
222
267
|
onClick: (e) => {
|
|
223
268
|
e.stopPropagation(), z({
|
|
224
|
-
lat:
|
|
225
|
-
lng:
|
|
226
|
-
zoom: Math.min(18,
|
|
269
|
+
lat: D(f + (t.y - a.h / 2) / s, l.zoom),
|
|
270
|
+
lng: T(g + (t.x - a.w / 2) / s, l.zoom),
|
|
271
|
+
zoom: Math.min(18, l.zoom + 2)
|
|
227
272
|
});
|
|
228
273
|
},
|
|
229
274
|
onPointerDown: (e) => e.stopPropagation(),
|
|
@@ -231,35 +276,36 @@ function tt({
|
|
|
231
276
|
style: {
|
|
232
277
|
left: t.x,
|
|
233
278
|
top: t.y,
|
|
234
|
-
background: t.pins.some((e) => e.pulse) ? "#ef4444" : t.pins[0].color ?? "#00a5cc"
|
|
279
|
+
background: Y ? Y(t.pins) : t.pins.some((e) => e.pulse) ? "#ef4444" : t.pins[0].color ?? "#00a5cc"
|
|
235
280
|
},
|
|
236
281
|
"data-tip": `${t.pins.length} records — click to zoom`,
|
|
282
|
+
"aria-label": `${t.pins.length} records here — zoom in`,
|
|
237
283
|
children: t.pins.length
|
|
238
284
|
},
|
|
239
285
|
`c-${t.pins[0].id}`
|
|
240
286
|
)
|
|
241
287
|
),
|
|
242
|
-
/* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ b("div", { className: "absolute right-3 top-3 z-[3] flex flex-col overflow-hidden rounded-md border border-slate-200 bg-white shadow dark:border-border dark:bg-card", children: [
|
|
243
289
|
/* @__PURE__ */ h(
|
|
244
290
|
"button",
|
|
245
291
|
{
|
|
246
292
|
type: "button",
|
|
247
|
-
onClick: () =>
|
|
293
|
+
onClick: () => j(1),
|
|
248
294
|
onPointerDown: (t) => t.stopPropagation(),
|
|
249
295
|
className: "flex h-8 w-8 items-center justify-center text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-muted",
|
|
250
296
|
"aria-label": "Zoom in",
|
|
251
|
-
children: /* @__PURE__ */ h(
|
|
297
|
+
children: /* @__PURE__ */ h(G, { className: "h-4 w-4" })
|
|
252
298
|
}
|
|
253
299
|
),
|
|
254
300
|
/* @__PURE__ */ h(
|
|
255
301
|
"button",
|
|
256
302
|
{
|
|
257
303
|
type: "button",
|
|
258
|
-
onClick: () =>
|
|
304
|
+
onClick: () => j(-1),
|
|
259
305
|
onPointerDown: (t) => t.stopPropagation(),
|
|
260
306
|
className: "flex h-8 w-8 items-center justify-center border-t border-slate-100 text-slate-600 hover:bg-slate-50 dark:border-border dark:text-slate-300 dark:hover:bg-muted",
|
|
261
307
|
"aria-label": "Zoom out",
|
|
262
|
-
children: /* @__PURE__ */ h(
|
|
308
|
+
children: /* @__PURE__ */ h(J, { className: "h-4 w-4" })
|
|
263
309
|
}
|
|
264
310
|
)
|
|
265
311
|
] }),
|
|
@@ -269,5 +315,5 @@ function tt({
|
|
|
269
315
|
);
|
|
270
316
|
}
|
|
271
317
|
export {
|
|
272
|
-
|
|
318
|
+
nt as BaseMap
|
|
273
319
|
};
|