@sjvair/monitor-map 4.3.0 → 5.0.0-beta.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/LICENSE +21 -0
- package/README.md +59 -138
- package/dist/lib/MonitorDetailPanel.svelte +23 -20
- package/dist/lib/MonitorMapLayout.svelte +147 -77
- package/dist/lib/components/DataBox.svelte +4 -1
- package/dist/lib/components/ui/range-calendar/range-calendar.svelte.d.ts +1 -1
- package/dist/lib/config.svelte.d.ts +7 -0
- package/dist/lib/config.svelte.js +10 -0
- package/dist/lib/core.d.ts +2 -2
- package/dist/lib/core.js +2 -1
- package/dist/lib/data-chart/DataChart.svelte +40 -25
- package/dist/lib/data-chart/DateRange.d.ts +13 -4
- package/dist/lib/data-chart/DateRange.js +50 -14
- package/dist/lib/data-chart/chart-utils.js +5 -7
- package/dist/lib/data-chart/level-colors.d.ts +3 -4
- package/dist/lib/data-chart/level-colors.js +7 -4
- package/dist/lib/data-chart/pacific-time.d.ts +9 -0
- package/dist/lib/data-chart/pacific-time.js +25 -0
- package/dist/lib/data-chart/tooltip.js +2 -2
- package/{src/lib/ev-stations/components/EvStationTooltip.svelte → dist/lib/ev-stations/EvPopup.svelte} +6 -5
- package/dist/lib/ev-stations/EvPopup.svelte.d.ts +7 -0
- package/dist/lib/ev-stations/ev-plugin.svelte.d.ts +14 -0
- package/dist/lib/ev-stations/ev-plugin.svelte.js +71 -0
- package/dist/lib/ev-stations/ev-station-icons.d.ts +1 -4
- package/dist/lib/ev-stations/ev-station-icons.js +1 -13
- package/dist/lib/ev-stations/ev-stations.d.ts +7 -0
- package/dist/lib/ev-stations/ev-stations.js +53 -0
- package/dist/lib/ev-stations/ev-store.svelte.d.ts +21 -0
- package/dist/lib/ev-stations/ev-store.svelte.js +83 -0
- package/dist/lib/ev-stations/station-popup.svelte.d.ts +14 -0
- package/dist/lib/ev-stations/station-popup.svelte.js +54 -0
- package/dist/lib/ev-stations/types.d.ts +0 -29
- package/dist/lib/ev-stations/zip-codes.d.ts +11 -0
- package/dist/lib/ev-stations/zip-codes.js +28 -16
- package/dist/lib/index.d.ts +8 -56
- package/dist/lib/index.js +7 -46
- package/dist/lib/legend/Legend.svelte +18 -19
- package/dist/lib/legend/Legend.svelte.d.ts +2 -2
- package/dist/lib/levels.d.ts +7 -0
- package/dist/lib/levels.js +19 -0
- package/dist/lib/map/MapShell.svelte +17 -24
- package/dist/lib/map/MapShell.svelte.d.ts +4 -4
- package/dist/lib/map/basemaps.d.ts +25 -0
- package/dist/lib/map/basemaps.js +66 -0
- package/dist/lib/map/live-map.svelte.d.ts +3 -0
- package/dist/lib/map/live-map.svelte.js +22 -0
- package/dist/lib/map/sync-plugins.svelte.d.ts +19 -0
- package/dist/lib/map/sync-plugins.svelte.js +52 -0
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte +66 -61
- package/dist/lib/monitors/filtered-source.svelte.d.ts +9 -0
- package/dist/lib/monitors/filtered-source.svelte.js +28 -0
- package/dist/lib/monitors/monitors.svelte.d.ts +25 -35
- package/dist/lib/monitors/monitors.svelte.js +35 -218
- package/dist/lib/monitors/retry-load.d.ts +8 -0
- package/dist/lib/monitors/retry-load.js +11 -0
- package/dist/lib/monitors/types.d.ts +1 -41
- package/dist/lib/options/map-option-defaults.d.ts +25 -36
- package/dist/lib/options/map-option-defaults.js +12 -30
- package/dist/lib/options/map-options.svelte.d.ts +13 -0
- package/dist/lib/options/map-options.svelte.js +26 -0
- package/dist/lib/options/menus/LayersMenu.svelte +8 -20
- package/dist/lib/options/menus/LayersMenu.svelte.d.ts +17 -2
- package/dist/lib/options/menus/MonitorsMenu.svelte +34 -18
- package/dist/lib/options/menus/OverlaysMenu.svelte +2 -2
- package/dist/lib/options/menus/PollutantMenu.svelte +4 -9
- package/dist/lib/options/menus/SettingsMenu.svelte +32 -25
- package/dist/lib/options/menus/SettingsMenu.svelte.d.ts +5 -16
- package/dist/lib/options/plugin-order.d.ts +8 -0
- package/dist/lib/options/plugin-order.js +36 -0
- package/dist/lib/options/pollutant-param.d.ts +7 -5
- package/dist/lib/options/pollutant-param.js +9 -5
- package/dist/lib/options/row-icons.d.ts +8 -0
- package/dist/lib/options/row-icons.js +15 -0
- package/dist/lib/options/rows/MarkerIcon.svelte +5 -5
- package/dist/lib/options/rows/MarkerIcon.svelte.d.ts +1 -2
- package/dist/lib/search/Search.svelte +20 -33
- package/dist/lib/search/Search.svelte.d.ts +5 -1
- package/dist/lib/search/search-pin.svelte.d.ts +11 -0
- package/dist/lib/search/search-pin.svelte.js +28 -0
- package/dist/lib/search/service.d.ts +7 -2
- package/dist/lib/search/service.js +17 -10
- package/dist/lib/stores.svelte.d.ts +8 -0
- package/dist/lib/stores.svelte.js +9 -0
- package/dist/lib/wind/wind-plugin.d.ts +11 -0
- package/dist/lib/wind/wind-plugin.js +25 -0
- package/package.json +12 -10
- package/src/lib/MonitorDetailPanel.svelte +23 -20
- package/src/lib/MonitorMapLayout.svelte +147 -77
- package/src/lib/components/DataBox.svelte +4 -1
- package/src/lib/config.svelte.ts +16 -0
- package/src/lib/core.ts +2 -2
- package/src/lib/data-chart/DataChart.svelte +40 -25
- package/src/lib/data-chart/DateRange.ts +58 -15
- package/src/lib/data-chart/chart-utils.ts +6 -7
- package/src/lib/data-chart/level-colors.ts +8 -9
- package/src/lib/data-chart/pacific-time.ts +31 -0
- package/src/lib/data-chart/tooltip.ts +2 -2
- package/{dist/lib/ev-stations/components/EvStationTooltip.svelte → src/lib/ev-stations/EvPopup.svelte} +6 -5
- package/src/lib/ev-stations/ev-plugin.svelte.ts +86 -0
- package/src/lib/ev-stations/ev-station-icons.ts +1 -17
- package/src/lib/ev-stations/ev-stations.ts +72 -0
- package/src/lib/ev-stations/ev-store.svelte.ts +117 -0
- package/src/lib/ev-stations/station-popup.svelte.ts +64 -0
- package/src/lib/ev-stations/types.ts +0 -34
- package/src/lib/ev-stations/zip-codes.ts +29 -16
- package/src/lib/index.ts +8 -99
- package/src/lib/legend/Legend.svelte +18 -19
- package/src/lib/levels.ts +24 -0
- package/src/lib/map/MapShell.svelte +17 -24
- package/src/lib/map/basemaps.ts +76 -0
- package/src/lib/map/live-map.svelte.ts +24 -0
- package/src/lib/map/sync-plugins.svelte.ts +69 -0
- package/src/lib/monitors/components/MonitorSubscriptionManager.svelte +66 -61
- package/src/lib/monitors/filtered-source.svelte.ts +38 -0
- package/src/lib/monitors/monitors.svelte.ts +58 -261
- package/src/lib/monitors/retry-load.ts +14 -0
- package/src/lib/monitors/types.ts +1 -47
- package/src/lib/options/map-option-defaults.ts +30 -53
- package/src/lib/options/map-options.svelte.ts +30 -0
- package/src/lib/options/menus/LayersMenu.svelte +8 -20
- package/src/lib/options/menus/MonitorsMenu.svelte +34 -18
- package/src/lib/options/menus/OverlaysMenu.svelte +2 -2
- package/src/lib/options/menus/PollutantMenu.svelte +4 -9
- package/src/lib/options/menus/SettingsMenu.svelte +32 -25
- package/src/lib/options/plugin-order.ts +38 -0
- package/src/lib/options/pollutant-param.ts +14 -9
- package/src/lib/options/row-icons.ts +17 -0
- package/src/lib/options/rows/MarkerIcon.svelte +5 -5
- package/src/lib/search/Search.svelte +20 -33
- package/src/lib/search/search-pin.svelte.ts +35 -0
- package/src/lib/search/service.ts +34 -15
- package/src/lib/stores.svelte.ts +15 -0
- package/src/lib/wind/wind-plugin.ts +33 -0
- package/dist/lib/collocation-sites/CollocationTooltip.svelte +0 -98
- package/dist/lib/collocation-sites/CollocationTooltip.svelte.d.ts +0 -7
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.d.ts +0 -7
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.js +0 -18
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.d.ts +0 -21
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.js +0 -113
- package/dist/lib/collocation-sites/collocations.svelte.d.ts +0 -10
- package/dist/lib/collocation-sites/collocations.svelte.js +0 -21
- package/dist/lib/collocation-sites/types.d.ts +0 -8
- package/dist/lib/collocation-sites/types.js +0 -1
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte +0 -16
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte.d.ts +0 -7
- package/dist/lib/ev-stations/components/EvStationTooltip.svelte.d.ts +0 -7
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.d.ts +0 -19
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.js +0 -131
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.d.ts +0 -31
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.js +0 -226
- package/dist/lib/ev-stations/ev-stations.svelte.d.ts +0 -10
- package/dist/lib/ev-stations/ev-stations.svelte.js +0 -57
- package/dist/lib/hms/hms-fire-icon-manager.d.ts +0 -13
- package/dist/lib/hms/hms-fire-icon-manager.js +0 -39
- package/dist/lib/hms/hms-fire-map-integration.svelte.d.ts +0 -23
- package/dist/lib/hms/hms-fire-map-integration.svelte.js +0 -94
- package/dist/lib/hms/hms-smoke-map-integration.svelte.d.ts +0 -39
- package/dist/lib/hms/hms-smoke-map-integration.svelte.js +0 -87
- package/dist/lib/hms/hms.svelte.d.ts +0 -20
- package/dist/lib/hms/hms.svelte.js +0 -237
- package/dist/lib/legend/LegendBar.svelte +0 -45
- package/dist/lib/legend/LegendBar.svelte.d.ts +0 -7
- package/dist/lib/legend/legend-data.d.ts +0 -40
- package/dist/lib/legend/legend-data.js +0 -65
- package/dist/lib/map/Map.svelte +0 -13
- package/dist/lib/map/Map.svelte.d.ts +0 -8
- package/dist/lib/map/basemap.d.ts +0 -14
- package/dist/lib/map/basemap.js +0 -10
- package/dist/lib/map/icons.d.ts +0 -7
- package/dist/lib/map/icons.js +0 -33
- package/dist/lib/map/integrations/base-layer-seperator.d.ts +0 -9
- package/dist/lib/map/integrations/base-layer-seperator.js +0 -11
- package/dist/lib/map/integrations/click-manager.d.ts +0 -14
- package/dist/lib/map/integrations/click-manager.js +0 -52
- package/dist/lib/map/integrations/integrations-manager.d.ts +0 -8
- package/dist/lib/map/integrations/integrations-manager.js +0 -20
- package/dist/lib/map/integrations/map-display-option.svelte.d.ts +0 -7
- package/dist/lib/map/integrations/map-display-option.svelte.js +0 -10
- package/dist/lib/map/integrations/map-geojson-integration.svelte.d.ts +0 -32
- package/dist/lib/map/integrations/map-geojson-integration.svelte.js +0 -60
- package/dist/lib/map/integrations/map-icon-manager.d.ts +0 -15
- package/dist/lib/map/integrations/map-icon-manager.js +0 -52
- package/dist/lib/map/integrations/map-integration.svelte.d.ts +0 -6
- package/dist/lib/map/integrations/map-integration.svelte.js +0 -2
- package/dist/lib/map/integrations/map-layer-integration.svelte.d.ts +0 -11
- package/dist/lib/map/integrations/map-layer-integration.svelte.js +0 -40
- package/dist/lib/map/integrations/tooltip.svelte.d.ts +0 -36
- package/dist/lib/map/integrations/tooltip.svelte.js +0 -131
- package/dist/lib/map/integrations/types.d.ts +0 -14
- package/dist/lib/map/integrations/types.js +0 -1
- package/dist/lib/map/map-manager.svelte.d.ts +0 -20
- package/dist/lib/map/map-manager.svelte.js +0 -63
- package/dist/lib/map/map-style-state.svelte.d.ts +0 -23
- package/dist/lib/map/map-style-state.svelte.js +0 -86
- package/dist/lib/map/utils.d.ts +0 -7
- package/dist/lib/map/utils.js +0 -36
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte +0 -112
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte.d.ts +0 -7
- package/dist/lib/monitors/components/MonitorTooltip.svelte +0 -61
- package/dist/lib/monitors/components/MonitorTooltip.svelte.d.ts +0 -7
- package/dist/lib/monitors/monitor-utils.d.ts +0 -4
- package/dist/lib/monitors/monitor-utils.js +0 -41
- package/dist/lib/monitors/monitors-cluster-renderer.d.ts +0 -33
- package/dist/lib/monitors/monitors-cluster-renderer.js +0 -221
- package/dist/lib/monitors/monitors-icon-manager.svelte.d.ts +0 -15
- package/dist/lib/monitors/monitors-icon-manager.svelte.js +0 -78
- package/dist/lib/monitors/monitors-map-integration.svelte.d.ts +0 -43
- package/dist/lib/monitors/monitors-map-integration.svelte.js +0 -301
- package/dist/lib/options/reset-map-options.d.ts +0 -2
- package/dist/lib/options/reset-map-options.js +0 -24
- package/dist/lib/reactivity.svelte.d.ts +0 -0
- package/dist/lib/reactivity.svelte.js +0 -83
- package/dist/lib/wind/wind.svelte.d.ts +0 -10
- package/dist/lib/wind/wind.svelte.js +0 -13
- package/src/lib/collocation-sites/CollocationTooltip.svelte +0 -98
- package/src/lib/collocation-sites/collocations-icon-manager.svelte.ts +0 -21
- package/src/lib/collocation-sites/collocations-map-integration.svelte.ts +0 -136
- package/src/lib/collocation-sites/collocations.svelte.ts +0 -27
- package/src/lib/collocation-sites/types.ts +0 -10
- package/src/lib/ev-stations/components/EvStationClusterTooltip.svelte +0 -16
- package/src/lib/ev-stations/ev-stations-cluster-renderer.ts +0 -162
- package/src/lib/ev-stations/ev-stations-map-integration.svelte.ts +0 -248
- package/src/lib/ev-stations/ev-stations.svelte.ts +0 -84
- package/src/lib/hms/hms-fire-icon-manager.ts +0 -48
- package/src/lib/hms/hms-fire-map-integration.svelte.ts +0 -109
- package/src/lib/hms/hms-smoke-map-integration.svelte.ts +0 -105
- package/src/lib/hms/hms.svelte.ts +0 -270
- package/src/lib/legend/LegendBar.svelte +0 -45
- package/src/lib/legend/legend-data.ts +0 -101
- package/src/lib/map/Map.svelte +0 -13
- package/src/lib/map/basemap.ts +0 -24
- package/src/lib/map/icons.ts +0 -42
- package/src/lib/map/integrations/base-layer-seperator.ts +0 -17
- package/src/lib/map/integrations/click-manager.ts +0 -64
- package/src/lib/map/integrations/integrations-manager.ts +0 -25
- package/src/lib/map/integrations/map-display-option.svelte.ts +0 -13
- package/src/lib/map/integrations/map-geojson-integration.svelte.ts +0 -77
- package/src/lib/map/integrations/map-icon-manager.ts +0 -67
- package/src/lib/map/integrations/map-integration.svelte.ts +0 -8
- package/src/lib/map/integrations/map-layer-integration.svelte.ts +0 -49
- package/src/lib/map/integrations/tooltip.svelte.ts +0 -153
- package/src/lib/map/integrations/types.ts +0 -24
- package/src/lib/map/map-manager.svelte.ts +0 -83
- package/src/lib/map/map-style-state.svelte.ts +0 -94
- package/src/lib/map/utils.ts +0 -53
- package/src/lib/monitors/components/MonitorClusterTooltip.svelte +0 -112
- package/src/lib/monitors/components/MonitorTooltip.svelte +0 -61
- package/src/lib/monitors/monitor-utils.ts +0 -57
- package/src/lib/monitors/monitors-cluster-renderer.ts +0 -285
- package/src/lib/monitors/monitors-icon-manager.svelte.ts +0 -98
- package/src/lib/monitors/monitors-map-integration.svelte.ts +0 -318
- package/src/lib/options/reset-map-options.ts +0 -28
- package/src/lib/reactivity.svelte.ts +0 -82
- package/src/lib/wind/wind.svelte.ts +0 -20
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { getHMSFire, getHMSSmoke } from "@sjvair/sdk/hms";
|
|
2
|
-
import clustersDbscan from "@turf/clusters-dbscan";
|
|
3
|
-
import { featureCollection, point } from "@turf/helpers";
|
|
4
|
-
const HMS_FIRE_DBSCAN_EPSILON = 2;
|
|
5
|
-
const HMS_FIRE_DBSCAN_MIN_POINTS = 1;
|
|
6
|
-
class HmsManager {
|
|
7
|
-
smoke = $state();
|
|
8
|
-
fire = $state();
|
|
9
|
-
fireGroups = $state();
|
|
10
|
-
async init({ signal } = {}) {
|
|
11
|
-
if (signal?.aborted)
|
|
12
|
-
throw signal.reason;
|
|
13
|
-
await Promise.allSettled([this.loadSmoke({ signal }), this.loadFire({ signal })]);
|
|
14
|
-
if (signal?.aborted)
|
|
15
|
-
throw signal.reason;
|
|
16
|
-
}
|
|
17
|
-
async loadSmoke({ signal } = {}) {
|
|
18
|
-
if (signal?.aborted)
|
|
19
|
-
throw signal.reason;
|
|
20
|
-
this.smoke = await getHMSSmoke({ signal });
|
|
21
|
-
}
|
|
22
|
-
async loadFire({ signal } = {}) {
|
|
23
|
-
try {
|
|
24
|
-
if (signal?.aborted)
|
|
25
|
-
throw signal.reason;
|
|
26
|
-
const raw = await getHMSFire({ signal });
|
|
27
|
-
const filtered = raw.filter((d) => d.frp !== null);
|
|
28
|
-
const deduped = deduplicateByCoordinates(filtered);
|
|
29
|
-
this.fire = deduped;
|
|
30
|
-
this.fireGroups = computeFireGroups(deduped);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
if (signal?.aborted)
|
|
34
|
-
throw err;
|
|
35
|
-
console.error("HMS fire load failed:", err);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function deduplicateByCoordinates(fires) {
|
|
40
|
-
const latest = {};
|
|
41
|
-
for (const fire of fires) {
|
|
42
|
-
const [lng, lat] = fire.geometry.coordinates;
|
|
43
|
-
const key = `${lng},${lat}`;
|
|
44
|
-
const existing = latest[key];
|
|
45
|
-
if (!existing || fire.timestamp > existing.timestamp) {
|
|
46
|
-
latest[key] = fire;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return Object.values(latest);
|
|
50
|
-
}
|
|
51
|
-
function computeFireGroups(fires) {
|
|
52
|
-
if (!fires.length)
|
|
53
|
-
return [];
|
|
54
|
-
const fc = featureCollection(fires.map((d) => point(d.geometry.coordinates, { fireId: d.id, frp: d.frp })));
|
|
55
|
-
const clustered = clustersDbscan(fc, HMS_FIRE_DBSCAN_EPSILON, {
|
|
56
|
-
minPoints: HMS_FIRE_DBSCAN_MIN_POINTS,
|
|
57
|
-
units: "kilometers"
|
|
58
|
-
});
|
|
59
|
-
const groups = {};
|
|
60
|
-
for (const feature of clustered.features) {
|
|
61
|
-
const props = feature.properties;
|
|
62
|
-
// With minPoints=1 every point self-qualifies as core, so "noise" never occurs.
|
|
63
|
-
// This branch activates correctly if minPoints is raised above 1 in future.
|
|
64
|
-
const key = props.dbscan === "noise" ? `noise-${props.fireId}` : `cluster-${props.cluster}`;
|
|
65
|
-
const [lng, lat] = feature.geometry.coordinates;
|
|
66
|
-
const entry = groups[key] ?? { frps: [], lngs: [], lats: [] };
|
|
67
|
-
entry.frps.push(props.frp);
|
|
68
|
-
entry.lngs.push(lng);
|
|
69
|
-
entry.lats.push(lat);
|
|
70
|
-
groups[key] = entry;
|
|
71
|
-
}
|
|
72
|
-
return Object.entries(groups).map(([key, { frps, lngs, lats }]) => ({
|
|
73
|
-
id: `hms-fire-group-${key}`,
|
|
74
|
-
coordinates: [
|
|
75
|
-
lngs.reduce((s, v) => s + v, 0) / lngs.length,
|
|
76
|
-
lats.reduce((s, v) => s + v, 0) / lats.length
|
|
77
|
-
],
|
|
78
|
-
avgFrp: frps.reduce((s, v) => s + v, 0) / frps.length,
|
|
79
|
-
count: frps.length
|
|
80
|
-
}));
|
|
81
|
-
}
|
|
82
|
-
//async function fakeFireData(): Promise<Array<HMSFireGeoJSON>> {
|
|
83
|
-
// const response: FetchHMSFireResponse["body"] = {
|
|
84
|
-
// data: [
|
|
85
|
-
// {
|
|
86
|
-
// id: "4Kx7mNpQrQ",
|
|
87
|
-
// date: "2026-04-13",
|
|
88
|
-
// satellite: "GOES-16",
|
|
89
|
-
// timestamp: "2026-04-13T18:30:00Z",
|
|
90
|
-
// frp: 360,
|
|
91
|
-
// ecosystem: 4,
|
|
92
|
-
// method: "AF",
|
|
93
|
-
// geometry: {
|
|
94
|
-
// type: "Point",
|
|
95
|
-
// coordinates: [-118.532, 36.591],
|
|
96
|
-
// },
|
|
97
|
-
// },
|
|
98
|
-
// {
|
|
99
|
-
// id: "4Kx7mNpQrD",
|
|
100
|
-
// date: "2026-04-13",
|
|
101
|
-
// satellite: "GOES-16",
|
|
102
|
-
// timestamp: "2026-04-13T18:30:00Z",
|
|
103
|
-
// frp: 20,
|
|
104
|
-
// ecosystem: 4,
|
|
105
|
-
// method: "AF",
|
|
106
|
-
// geometry: {
|
|
107
|
-
// type: "Point",
|
|
108
|
-
// coordinates: [-118.632, 36.691],
|
|
109
|
-
// },
|
|
110
|
-
// },
|
|
111
|
-
// {
|
|
112
|
-
// id: "4Kx7mNpQrT",
|
|
113
|
-
// date: "2026-04-13",
|
|
114
|
-
// satellite: "GOES-16",
|
|
115
|
-
// timestamp: "2026-04-13T18:30:00Z",
|
|
116
|
-
// frp: 152.7,
|
|
117
|
-
// ecosystem: 4,
|
|
118
|
-
// method: "AF",
|
|
119
|
-
// geometry: {
|
|
120
|
-
// type: "Point",
|
|
121
|
-
// coordinates: [-118.832, 36.491],
|
|
122
|
-
// },
|
|
123
|
-
// },
|
|
124
|
-
// {
|
|
125
|
-
// id: "9vBjLsWqYm",
|
|
126
|
-
// date: "2026-04-13",
|
|
127
|
-
// satellite: "GOES-17",
|
|
128
|
-
// timestamp: "2026-04-13T17:45:00Z",
|
|
129
|
-
// frp: 58.2,
|
|
130
|
-
// ecosystem: 2,
|
|
131
|
-
// method: "AF",
|
|
132
|
-
// geometry: {
|
|
133
|
-
// type: "Point",
|
|
134
|
-
// coordinates: [-119.204, 37.112],
|
|
135
|
-
// },
|
|
136
|
-
// },
|
|
137
|
-
// {
|
|
138
|
-
// id: "2HcFnRkVxZ",
|
|
139
|
-
// date: "2026-04-13",
|
|
140
|
-
// satellite: "GOES-16",
|
|
141
|
-
// timestamp: "2026-04-13T16:00:00Z",
|
|
142
|
-
// frp: null,
|
|
143
|
-
// ecosystem: 7,
|
|
144
|
-
// method: "FDC",
|
|
145
|
-
// geometry: {
|
|
146
|
-
// type: "Point",
|
|
147
|
-
// coordinates: [-120.571, 35.883],
|
|
148
|
-
// },
|
|
149
|
-
// },
|
|
150
|
-
// ],
|
|
151
|
-
// page: 1,
|
|
152
|
-
// count: 3,
|
|
153
|
-
// pages: 1,
|
|
154
|
-
// has_next_page: false,
|
|
155
|
-
// has_previous_page: false,
|
|
156
|
-
// };
|
|
157
|
-
// return Promise.resolve(response.data);
|
|
158
|
-
//}
|
|
159
|
-
//async function fakeSmokeData(): Promise<Array<HMSSmokeGeoJSON>> {
|
|
160
|
-
// const response: FetchHMSSmokeResponse["body"] = {
|
|
161
|
-
// data: [
|
|
162
|
-
// {
|
|
163
|
-
// id: "sM3kNpQrL1",
|
|
164
|
-
// date: "2026-04-13",
|
|
165
|
-
// satellite: "GOES-16",
|
|
166
|
-
// start: "2026-04-13T12:00:00Z",
|
|
167
|
-
// end: "2026-04-13T18:00:00Z",
|
|
168
|
-
// density: "light",
|
|
169
|
-
// geometry: {
|
|
170
|
-
// type: "MultiPolygon",
|
|
171
|
-
// coordinates: [
|
|
172
|
-
// [
|
|
173
|
-
// [
|
|
174
|
-
// [-122.5, 39.5],
|
|
175
|
-
// [-120.5, 39.5],
|
|
176
|
-
// [-120.5, 41.0],
|
|
177
|
-
// [-122.5, 41.0],
|
|
178
|
-
// [-122.5, 39.5]
|
|
179
|
-
// ]
|
|
180
|
-
// ]
|
|
181
|
-
// ]
|
|
182
|
-
// }
|
|
183
|
-
// },
|
|
184
|
-
// {
|
|
185
|
-
// id: "sM3kNpQrL2",
|
|
186
|
-
// date: "2026-04-13",
|
|
187
|
-
// satellite: "GOES-16",
|
|
188
|
-
// start: "2026-04-13T12:00:00Z",
|
|
189
|
-
// end: "2026-04-13T18:00:00Z",
|
|
190
|
-
// density: "medium",
|
|
191
|
-
// geometry: {
|
|
192
|
-
// type: "MultiPolygon",
|
|
193
|
-
// coordinates: [
|
|
194
|
-
// [
|
|
195
|
-
// [
|
|
196
|
-
// [-121.0, 36.5],
|
|
197
|
-
// [-119.0, 36.5],
|
|
198
|
-
// [-119.0, 38.0],
|
|
199
|
-
// [-121.0, 38.0],
|
|
200
|
-
// [-121.0, 36.5]
|
|
201
|
-
// ]
|
|
202
|
-
// ]
|
|
203
|
-
// ]
|
|
204
|
-
// }
|
|
205
|
-
// },
|
|
206
|
-
// {
|
|
207
|
-
// id: "sM3kNpQrL3",
|
|
208
|
-
// date: "2026-04-13",
|
|
209
|
-
// satellite: "GOES-16",
|
|
210
|
-
// start: "2026-04-13T12:00:00Z",
|
|
211
|
-
// end: "2026-04-13T18:00:00Z",
|
|
212
|
-
// density: "heavy",
|
|
213
|
-
// geometry: {
|
|
214
|
-
// type: "MultiPolygon",
|
|
215
|
-
// coordinates: [
|
|
216
|
-
// [
|
|
217
|
-
// [
|
|
218
|
-
// [-119.0, 33.5],
|
|
219
|
-
// [-116.5, 33.5],
|
|
220
|
-
// [-116.5, 35.0],
|
|
221
|
-
// [-119.0, 35.0],
|
|
222
|
-
// [-119.0, 33.5]
|
|
223
|
-
// ]
|
|
224
|
-
// ]
|
|
225
|
-
// ]
|
|
226
|
-
// }
|
|
227
|
-
// }
|
|
228
|
-
// ],
|
|
229
|
-
// page: 1,
|
|
230
|
-
// count: 3,
|
|
231
|
-
// pages: 1,
|
|
232
|
-
// has_next_page: false,
|
|
233
|
-
// has_previous_page: false
|
|
234
|
-
// };
|
|
235
|
-
// return Promise.resolve(response.data);
|
|
236
|
-
//}
|
|
237
|
-
export const hmsManager = new HmsManager();
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
blocksBackground,
|
|
4
|
-
gradientBackground,
|
|
5
|
-
tickPosition,
|
|
6
|
-
type LegendBarData
|
|
7
|
-
} from "./legend-data";
|
|
8
|
-
|
|
9
|
-
let { bar }: { bar: LegendBarData } = $props();
|
|
10
|
-
|
|
11
|
-
const background = $derived(
|
|
12
|
-
bar.kind === "gradient"
|
|
13
|
-
? gradientBackground(bar.colors)
|
|
14
|
-
: blocksBackground(bar.categories.map((category) => category.color))
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
// Labels placed on exact stop positions: gradient ticks, or block breakpoints.
|
|
18
|
-
const positioned = $derived(bar.kind === "gradient" ? bar.ticks : (bar.breakpoints ?? null));
|
|
19
|
-
</script>
|
|
20
|
-
|
|
21
|
-
<div class="h-3 rounded" style:background></div>
|
|
22
|
-
{#if positioned}
|
|
23
|
-
<div class="relative mt-1 h-4 text-xs">
|
|
24
|
-
{#each positioned as label, i (i)}
|
|
25
|
-
{@const isFirst = i === 0}
|
|
26
|
-
{@const isLast = i === positioned.length - 1}
|
|
27
|
-
<span
|
|
28
|
-
class={[
|
|
29
|
-
"absolute top-0 whitespace-nowrap",
|
|
30
|
-
isFirst && "left-0",
|
|
31
|
-
isLast && "right-0",
|
|
32
|
-
!isFirst && !isLast && "-translate-x-1/2"
|
|
33
|
-
]}
|
|
34
|
-
style:left={!isFirst && !isLast ? `${tickPosition(i, positioned.length)}%` : undefined}
|
|
35
|
-
>{label}</span
|
|
36
|
-
>
|
|
37
|
-
{/each}
|
|
38
|
-
</div>
|
|
39
|
-
{:else if bar.kind === "blocks"}
|
|
40
|
-
<div class="mt-1 flex text-xs">
|
|
41
|
-
{#each bar.categories as category, i (i)}
|
|
42
|
-
<span class="min-w-0 flex-1 text-center break-words">{category.label ?? ""}</span>
|
|
43
|
-
{/each}
|
|
44
|
-
</div>
|
|
45
|
-
{/if}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { SJVAirEntryLevel } from "@sjvair/sdk";
|
|
2
|
-
import type { MonitorsPollutant } from "../monitors/types";
|
|
3
|
-
export interface LegendCategory {
|
|
4
|
-
color: string;
|
|
5
|
-
label?: string;
|
|
6
|
-
}
|
|
7
|
-
export type LegendBarData = {
|
|
8
|
-
kind: "gradient";
|
|
9
|
-
colors: Array<string>;
|
|
10
|
-
ticks: Array<string>;
|
|
11
|
-
} | {
|
|
12
|
-
kind: "blocks";
|
|
13
|
-
categories: Array<LegendCategory>;
|
|
14
|
-
breakpoints?: Array<string>;
|
|
15
|
-
};
|
|
16
|
-
export interface LegendSection {
|
|
17
|
-
id: string;
|
|
18
|
-
title: string;
|
|
19
|
-
unit?: string;
|
|
20
|
-
bar: LegendBarData;
|
|
21
|
-
}
|
|
22
|
-
export interface SmokeDensityStyle {
|
|
23
|
-
label: string;
|
|
24
|
-
color: string;
|
|
25
|
-
opacity: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Pollutant legend built from the monitors meta levels — the same levels the map markers are
|
|
29
|
-
* colored by, so the two can never disagree. One tick per level, at that level's color stop.
|
|
30
|
-
*/
|
|
31
|
-
export declare function pollutantLegendSection(pollutant: MonitorsPollutant, levels: ReadonlyArray<Pick<SJVAirEntryLevel, "color" | "range">>): LegendSection | null;
|
|
32
|
-
/** Fire & Smoke share one toggle, so they render as two independent bars. */
|
|
33
|
-
export declare function fireSmokeLegendSections(fireTiers: ReadonlyArray<LegendCategory>, smoke: ReadonlyArray<SmokeDensityStyle>): Array<LegendSection>;
|
|
34
|
-
/** Approximates how a translucent fill layer looks over a light basemap. */
|
|
35
|
-
export declare function swatchOverWhite(color: string, opacity: number): string;
|
|
36
|
-
export declare function gradientBackground(colors: ReadonlyArray<string>): string;
|
|
37
|
-
/** Hard-edged equal-width blocks: each color repeated at both edges of its own share. */
|
|
38
|
-
export declare function blocksBackground(colors: ReadonlyArray<string>): string;
|
|
39
|
-
/** Percent position of the index-th of `count` evenly spaced labels. */
|
|
40
|
-
export declare function tickPosition(index: number, count: number): number;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { mix } from "color2k";
|
|
2
|
-
const POLLUTANT_TITLES = {
|
|
3
|
-
pm25: { title: "PM2.5", unit: "µg/m³" },
|
|
4
|
-
o3: { title: "Ozone", unit: "ppb" }
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Pollutant legend built from the monitors meta levels — the same levels the map markers are
|
|
8
|
-
* colored by, so the two can never disagree. One tick per level, at that level's color stop.
|
|
9
|
-
*/
|
|
10
|
-
export function pollutantLegendSection(pollutant, levels) {
|
|
11
|
-
if (levels.length === 0)
|
|
12
|
-
return null;
|
|
13
|
-
return {
|
|
14
|
-
id: "pollutant",
|
|
15
|
-
...POLLUTANT_TITLES[pollutant],
|
|
16
|
-
bar: {
|
|
17
|
-
kind: "gradient",
|
|
18
|
-
colors: levels.map((level) => level.color),
|
|
19
|
-
ticks: levels.map((level) => String(Math.floor(level.range[0])))
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/** Fire & Smoke share one toggle, so they render as two independent bars. */
|
|
24
|
-
export function fireSmokeLegendSections(fireTiers, smoke) {
|
|
25
|
-
return [
|
|
26
|
-
{ id: "fire", title: "Fire", unit: "MW", bar: { kind: "blocks", categories: [...fireTiers] } },
|
|
27
|
-
{
|
|
28
|
-
id: "smoke",
|
|
29
|
-
title: "Smoke Density",
|
|
30
|
-
bar: {
|
|
31
|
-
kind: "blocks",
|
|
32
|
-
categories: smoke.map(({ label, color, opacity }) => ({
|
|
33
|
-
label,
|
|
34
|
-
color: swatchOverWhite(color, opacity)
|
|
35
|
-
}))
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
/** Approximates how a translucent fill layer looks over a light basemap. */
|
|
41
|
-
export function swatchOverWhite(color, opacity) {
|
|
42
|
-
return mix("#ffffff", color, opacity);
|
|
43
|
-
}
|
|
44
|
-
export function gradientBackground(colors) {
|
|
45
|
-
if (colors.length === 0)
|
|
46
|
-
return "none";
|
|
47
|
-
if (colors.length === 1)
|
|
48
|
-
return colors[0];
|
|
49
|
-
return `linear-gradient(to right, ${colors.join(", ")})`;
|
|
50
|
-
}
|
|
51
|
-
/** Hard-edged equal-width blocks: each color repeated at both edges of its own share. */
|
|
52
|
-
export function blocksBackground(colors) {
|
|
53
|
-
const count = colors.length;
|
|
54
|
-
if (count === 0)
|
|
55
|
-
return "none";
|
|
56
|
-
const stops = colors.map((color, i) => `${color} ${percent(i / count)}, ${color} ${percent((i + 1) / count)}`);
|
|
57
|
-
return `linear-gradient(to right, ${stops.join(", ")})`;
|
|
58
|
-
}
|
|
59
|
-
/** Percent position of the index-th of `count` evenly spaced labels. */
|
|
60
|
-
export function tickPosition(index, count) {
|
|
61
|
-
return count <= 1 ? 0 : (index / (count - 1)) * 100;
|
|
62
|
-
}
|
|
63
|
-
function percent(fraction) {
|
|
64
|
-
return `${(fraction * 100).toFixed(2)}%`;
|
|
65
|
-
}
|
package/dist/lib/map/Map.svelte
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import "@maptiler/sdk/dist/maptiler-sdk.css";
|
|
3
|
-
import { initializeMap } from "./map-manager.svelte.js";
|
|
4
|
-
import { integrationsManager } from "./integrations/integrations-manager";
|
|
5
|
-
import type { SomeMapIntegration } from "./integrations/types";
|
|
6
|
-
|
|
7
|
-
const { integrations }: { integrations: Array<SomeMapIntegration> } = $props();
|
|
8
|
-
|
|
9
|
-
// svelte-ignore state_referenced_locally (we only need the initial reference)
|
|
10
|
-
integrationsManager.register(...integrations);
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<div {@attach initializeMap} style="width: 100%; height: 100%;"></div>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "@maptiler/sdk/dist/maptiler-sdk.css";
|
|
2
|
-
import type { SomeMapIntegration } from "./integrations/types";
|
|
3
|
-
type $$ComponentProps = {
|
|
4
|
-
integrations: Array<SomeMapIntegration>;
|
|
5
|
-
};
|
|
6
|
-
declare const Map: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
-
type Map = ReturnType<typeof Map>;
|
|
8
|
-
export default Map;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** The slices of MapTiler's MapStyleVariant / ReferenceMapStyle this module needs. */
|
|
2
|
-
export interface StyleVariantLike {
|
|
3
|
-
getType(): string;
|
|
4
|
-
}
|
|
5
|
-
export interface ReferenceStyleLike<V extends StyleVariantLike> {
|
|
6
|
-
hasVariant(type: string): boolean;
|
|
7
|
-
getVariant(type: string): V;
|
|
8
|
-
getDefaultVariant(): V;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Variant to show after switching basemaps: the same variant type (e.g. "DARK") when the new
|
|
12
|
-
* basemap offers it, otherwise the new basemap's default.
|
|
13
|
-
*/
|
|
14
|
-
export declare function variantForStyle<V extends StyleVariantLike>(style: ReferenceStyleLike<V>, previous: StyleVariantLike | null): V;
|
package/dist/lib/map/basemap.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Variant to show after switching basemaps: the same variant type (e.g. "DARK") when the new
|
|
3
|
-
* basemap offers it, otherwise the new basemap's default.
|
|
4
|
-
*/
|
|
5
|
-
export function variantForStyle(style, previous) {
|
|
6
|
-
if (previous && style.hasVariant(previous.getType())) {
|
|
7
|
-
return style.getVariant(previous.getType());
|
|
8
|
-
}
|
|
9
|
-
return style.getDefaultVariant();
|
|
10
|
-
}
|
package/dist/lib/map/icons.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare function square(color: string, borderWidth: number, borderColor?: string): string;
|
|
2
|
-
export declare function circle(color: string, borderWidth: number, borderColor?: string): string;
|
|
3
|
-
export declare function triangle(color: string, borderWidth: number, borderColor?: string): string;
|
|
4
|
-
export declare const CROSSHAIR_ICON_SIZE: number;
|
|
5
|
-
export declare function withCrosshair(baseSvg: string, color?: string): string;
|
|
6
|
-
export declare function asDataURI(svg: string): string;
|
|
7
|
-
export declare function fireIcon(color: string, size: number): string;
|
package/dist/lib/map/icons.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { darken } from "color2k";
|
|
2
|
-
export function square(color, borderWidth, borderColor) {
|
|
3
|
-
return `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
-
<rect x="${borderWidth / 2}" y="${borderWidth / 2}" width="${24 - borderWidth}" height="${24 - borderWidth}"
|
|
5
|
-
fill="${color}" stroke="${darken(borderColor ?? color, 0.1)}" stroke-width="${borderWidth}"/>
|
|
6
|
-
</svg>`;
|
|
7
|
-
}
|
|
8
|
-
export function circle(color, borderWidth, borderColor) {
|
|
9
|
-
return `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
10
|
-
<circle cx="12" cy="12" r="${12 - borderWidth}" fill="${color}" stroke="${darken(borderColor ?? color, 0.1)}" stroke-width="${borderWidth}"/>
|
|
11
|
-
</svg>`;
|
|
12
|
-
}
|
|
13
|
-
export function triangle(color, borderWidth, borderColor) {
|
|
14
|
-
const points = `${12},${borderWidth} ${24 - borderWidth},${24 - borderWidth} ${borderWidth},${24 - borderWidth}`;
|
|
15
|
-
return `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
16
|
-
<polygon points="${points}"
|
|
17
|
-
fill="${color}" stroke="${darken(borderColor ?? color, 0.1)}" stroke-width="${borderWidth}"/>
|
|
18
|
-
</svg>`;
|
|
19
|
-
}
|
|
20
|
-
const CROSSHAIR_PATH = "M495.9 248H392c-4.4 0-8 3.6-8 8s3.6 8 8 8H495.9C491.7 390.2 390.2 491.7 264 495.9V392c0-4.4-3.6-8-8-8s-8 3.6-8 8V495.9C121.8 491.7 20.3 390.2 16.1 264H120c4.4 0 8-3.6 8-8s-3.6-8-8-8H16.1C20.3 121.8 121.8 20.3 248 16.1V120c0 4.4 3.6 8 8 8s8-3.6 8-8V16.1C390.2 20.3 491.7 121.8 495.9 248zM0 256a256 256 0 1 0 512 0A256 256 0 1 0 0 256z";
|
|
21
|
-
const CROSSHAIR_PADDING = 16;
|
|
22
|
-
export const CROSSHAIR_ICON_SIZE = 24 + CROSSHAIR_PADDING * 2;
|
|
23
|
-
export function withCrosshair(baseSvg, color = "#ffffff") {
|
|
24
|
-
const size = CROSSHAIR_ICON_SIZE;
|
|
25
|
-
const inner = baseSvg.replace("<svg ", `<svg x="${CROSSHAIR_PADDING}" y="${CROSSHAIR_PADDING}" `);
|
|
26
|
-
return `<svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}" xmlns="http://www.w3.org/2000/svg">${inner}<svg x="0" y="0" width="${size}" height="${size}" viewBox="-8 -8 528 528"><path d="${CROSSHAIR_PATH}" fill="${color}" stroke="${color}" stroke-width="5"/></svg></svg>`;
|
|
27
|
-
}
|
|
28
|
-
export function asDataURI(svg) {
|
|
29
|
-
return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
|
|
30
|
-
}
|
|
31
|
-
export function fireIcon(color, size) {
|
|
32
|
-
return `<svg width="${size}" height="${size}" viewBox="0 -960 960 960" xmlns="http://www.w3.org/2000/svg" fill="${color}"><path d="M200-400q0 52 21 98.5t60 81.5q-1-5-1-9v-9q0-32 12-60t35-51l113-111 113 111q23 23 35 51t12 60v9q0 4-1 9 39-35 60-81.5t21-98.5q0-50-18.5-94.5T608-574q-20 13-42 19.5t-45 6.5q-62 0-107.5-41T361-690q-39 33-69 68.5t-50.5 72Q221-513 210.5-475T200-400Zm240 52-57 56q-11 11-17 25t-6 29q0 32 23.5 55t56.5 23q33 0 56.5-23t23.5-55q0-16-6-29.5T497-292l-57-56Zm0-492v132q0 34 23.5 57t57.5 23q18 0 33.5-7.5T582-658l18-22q74 42 117 117t43 163q0 134-93 227T440-80q-134 0-227-93t-93-227q0-129 86.5-245T440-840Zm400 320q-17 0-28.5-11.5T800-560q0-17 11.5-28.5T840-600q17 0 28.5 11.5T880-560q0 17-11.5 28.5T840-520Zm-40-120v-200h80v200h-80Z"/></svg>`;
|
|
33
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Map as MaptilerMap } from "@maptiler/sdk";
|
|
2
|
-
import { MapLayerIntegration } from "./map-layer-integration.svelte";
|
|
3
|
-
declare class BaseLayerSeperator extends MapLayerIntegration {
|
|
4
|
-
referenceId: string;
|
|
5
|
-
enabled: boolean;
|
|
6
|
-
mapLayer: Parameters<MaptilerMap["addLayer"]>[0];
|
|
7
|
-
}
|
|
8
|
-
export declare const baseLayerSeperator: BaseLayerSeperator;
|
|
9
|
-
export type { BaseLayerSeperator };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MapLayerIntegration } from "./map-layer-integration.svelte";
|
|
2
|
-
class BaseLayerSeperator extends MapLayerIntegration {
|
|
3
|
-
referenceId = "Base Layer Seperator";
|
|
4
|
-
enabled = true;
|
|
5
|
-
mapLayer = {
|
|
6
|
-
id: this.referenceId,
|
|
7
|
-
type: "custom",
|
|
8
|
-
render: function () { }
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
export const baseLayerSeperator = new BaseLayerSeperator();
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { MapGeoJSONFeature, MapMouseEvent } from "@maptiler/sdk";
|
|
2
|
-
export type ClickHandler = (features: MapGeoJSONFeature[], evt: MapMouseEvent & object) => void;
|
|
3
|
-
declare class ClickManager {
|
|
4
|
-
private registrations;
|
|
5
|
-
private isListening;
|
|
6
|
-
/** Must be called after `mapManager.map` is initialized (i.e. from within `apply()`). */
|
|
7
|
-
register(layerIds: string[], handler: ClickHandler): void;
|
|
8
|
-
unregister(layerIds: string[]): void;
|
|
9
|
-
private ensureListener;
|
|
10
|
-
private removeListener;
|
|
11
|
-
private handleClick;
|
|
12
|
-
}
|
|
13
|
-
export declare const clickManager: ClickManager;
|
|
14
|
-
export type { ClickManager };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { mapManager } from "../map-manager.svelte.js";
|
|
2
|
-
class ClickManager {
|
|
3
|
-
registrations = [];
|
|
4
|
-
isListening = false;
|
|
5
|
-
/** Must be called after `mapManager.map` is initialized (i.e. from within `apply()`). */
|
|
6
|
-
register(layerIds, handler) {
|
|
7
|
-
const incomingSet = new Set(layerIds);
|
|
8
|
-
const existing = this.registrations.find((r) => r.layerIds.some((id) => incomingSet.has(id)));
|
|
9
|
-
if (existing) {
|
|
10
|
-
existing.layerIds = layerIds;
|
|
11
|
-
existing.handler = handler;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
this.registrations.push({ layerIds, handler });
|
|
15
|
-
}
|
|
16
|
-
this.ensureListener();
|
|
17
|
-
}
|
|
18
|
-
unregister(layerIds) {
|
|
19
|
-
const set = new Set(layerIds);
|
|
20
|
-
this.registrations = this.registrations.filter((r) => !r.layerIds.some((id) => set.has(id)));
|
|
21
|
-
if (this.registrations.length === 0) {
|
|
22
|
-
this.removeListener();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
ensureListener() {
|
|
26
|
-
if (this.isListening || !mapManager.map)
|
|
27
|
-
return;
|
|
28
|
-
mapManager.map.on("click", this.handleClick);
|
|
29
|
-
this.isListening = true;
|
|
30
|
-
}
|
|
31
|
-
removeListener() {
|
|
32
|
-
if (!this.isListening)
|
|
33
|
-
return;
|
|
34
|
-
mapManager.map?.off("click", this.handleClick);
|
|
35
|
-
this.isListening = false;
|
|
36
|
-
}
|
|
37
|
-
handleClick = (evt) => {
|
|
38
|
-
if (!mapManager.map)
|
|
39
|
-
return;
|
|
40
|
-
const allLayerIds = this.registrations.flatMap((r) => r.layerIds);
|
|
41
|
-
const features = mapManager.map.queryRenderedFeatures(evt.point, { layers: allLayerIds });
|
|
42
|
-
if (!features.length)
|
|
43
|
-
return;
|
|
44
|
-
const winningLayerId = features[0].layer.id;
|
|
45
|
-
const registration = this.registrations.find((r) => r.layerIds.includes(winningLayerId));
|
|
46
|
-
if (!registration)
|
|
47
|
-
return;
|
|
48
|
-
const ownFeatures = features.filter((f) => registration.layerIds.includes(f.layer.id));
|
|
49
|
-
registration.handler(ownFeatures, evt);
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export const clickManager = new ClickManager();
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { SomeMapIntegration } from "./types";
|
|
2
|
-
declare class IntegrationsManager {
|
|
3
|
-
private integrations;
|
|
4
|
-
register(...integrations: Array<SomeMapIntegration>): void;
|
|
5
|
-
refresh(): void;
|
|
6
|
-
}
|
|
7
|
-
export declare const integrationsManager: IntegrationsManager;
|
|
8
|
-
export type { IntegrationsManager };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { XMap } from "@tstk/builtin-extensions";
|
|
2
|
-
class IntegrationsManager {
|
|
3
|
-
integrations = new XMap();
|
|
4
|
-
register(...integrations) {
|
|
5
|
-
for (const integration of integrations) {
|
|
6
|
-
this.integrations.set(integration.referenceId, integration);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
refresh() {
|
|
10
|
-
for (const integration of this.integrations.values()) {
|
|
11
|
-
if (integration.enabled) {
|
|
12
|
-
integration.apply();
|
|
13
|
-
}
|
|
14
|
-
else if (integration.remove) {
|
|
15
|
-
integration.remove();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export const integrationsManager = new IntegrationsManager();
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Map as MaptilerMap } from "@maptiler/sdk";
|
|
2
|
-
import type { Feature, Geometry } from "geojson";
|
|
3
|
-
import type { MapIconManager } from "./map-icon-manager";
|
|
4
|
-
import { MapLayerIntegration } from "./map-layer-integration.svelte";
|
|
5
|
-
export declare abstract class MapGeoJSONIntegration<T = Record<string, unknown>> extends MapLayerIntegration {
|
|
6
|
-
abstract features: Array<Feature<Geometry, T>>;
|
|
7
|
-
abstract mapSource: Parameters<MaptilerMap["addSource"]>[1];
|
|
8
|
-
remove(): void;
|
|
9
|
-
/**
|
|
10
|
-
* Removes only this integration's own layer and source. Non-virtual on purpose: `apply()`
|
|
11
|
-
* paths call it to clear stale map state before re-adding, without triggering a subclass's
|
|
12
|
-
* `remove()` override (which also tears down tooltips/click handlers that apply just set up).
|
|
13
|
-
*/
|
|
14
|
-
protected removeLayerAndSource(): void;
|
|
15
|
-
}
|
|
16
|
-
export declare abstract class MapIconLayerIntegration<T = Record<string, unknown>> extends MapGeoJSONIntegration<T> {
|
|
17
|
-
abstract icons: MapIconManager;
|
|
18
|
-
private generation;
|
|
19
|
-
/**
|
|
20
|
-
* Drops every callback still waiting on icons. `apply()` and `remove()` call it, so a
|
|
21
|
-
* subclass overriding `apply()` without calling `super.apply()` first must call it itself.
|
|
22
|
-
*/
|
|
23
|
-
protected supersedePending(): void;
|
|
24
|
-
/**
|
|
25
|
-
* Runs `run` once the icons have loaded, unless an `apply()` or `remove()` has happened
|
|
26
|
-
* since (the state it was scheduled for is gone) or a basemap change is in flight (the
|
|
27
|
-
* refresh on "style.load" re-applies).
|
|
28
|
-
*/
|
|
29
|
-
protected whenIconsLoad(run: () => void): void;
|
|
30
|
-
apply(): void;
|
|
31
|
-
remove(): void;
|
|
32
|
-
}
|