@sjvair/monitor-map 3.0.3 → 3.0.5
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/lib/LoadScreen.svelte +68 -0
- package/dist/lib/LoadScreen.svelte.d.ts +25 -0
- package/dist/lib/MainMapView.svelte +1 -0
- package/dist/lib/MainMapView.svelte.d.ts +26 -0
- package/dist/lib/MapLegend.svelte +15 -0
- package/dist/lib/MapLegend.svelte.d.ts +18 -0
- package/dist/lib/MonitorDetailPanel.svelte +152 -0
- package/dist/lib/MonitorDetailPanel.svelte.d.ts +3 -0
- package/dist/lib/MonitorMapLayout.svelte +193 -0
- package/dist/lib/MonitorMapLayout.svelte.d.ts +7 -0
- package/dist/lib/actions.d.ts +3 -0
- package/dist/lib/actions.js +12 -8
- package/dist/lib/assets/icons/adjustment-horizontal.svg +3 -0
- package/dist/lib/assets/logos/airgradient-blue.svg +63 -0
- package/dist/lib/assets/logos/airnow-compact.jpg +0 -0
- package/dist/lib/assets/logos/carb-compact.jpg +0 -0
- package/dist/lib/assets/logos/purpleair-compact.png +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-air.webp +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-icon.webp +0 -0
- package/dist/lib/assets/logos/sjvair-parts/sjvair-sjv.webp +0 -0
- package/dist/lib/assets/logos/sjvair-white.svg +115 -0
- package/dist/lib/assets/logos/sjvair.svg +96 -0
- package/dist/lib/collocation-sites/CollocationTooltip.svelte +98 -0
- package/dist/lib/collocation-sites/CollocationTooltip.svelte.d.ts +7 -0
- package/dist/lib/collocation-sites/collocation-utils.d.ts +3 -0
- package/dist/lib/collocation-sites/collocation-utils.js +30 -0
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.d.ts +7 -0
- package/dist/lib/collocation-sites/collocations-icon-manager.svelte.js +17 -20
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.d.ts +18 -0
- package/dist/lib/collocation-sites/collocations-map-integration.svelte.js +98 -83
- package/dist/lib/collocation-sites/collocations.svelte.d.ts +9 -0
- package/dist/lib/collocation-sites/collocations.svelte.js +17 -26
- package/dist/lib/collocation-sites/types.d.ts +8 -0
- package/dist/lib/collocation-sites/types.js +1 -0
- package/dist/lib/colors.d.ts +17 -0
- package/dist/lib/colors.js +29 -23
- package/dist/lib/components/DataBox.svelte +29 -0
- package/dist/lib/components/DataBox.svelte.d.ts +9 -0
- package/dist/lib/components/DisplayOption.svelte +7 -0
- package/dist/lib/components/DisplayOption.svelte.d.ts +5 -0
- package/dist/lib/components/MapLayersDisplayOptions.svelte +42 -0
- package/dist/lib/components/MapLayersDisplayOptions.svelte.d.ts +18 -0
- package/dist/lib/components/SegmentedControl.svelte +61 -0
- package/dist/lib/components/SegmentedControl.svelte.d.ts +11 -0
- package/dist/lib/components/ToggleSwitch.svelte +93 -0
- package/dist/lib/components/ToggleSwitch.svelte.d.ts +9 -0
- package/dist/lib/components/ui/button/button.svelte +89 -0
- package/dist/lib/components/ui/button/button.svelte.d.ts +70 -0
- package/dist/lib/components/ui/button/index.d.ts +2 -0
- package/dist/lib/components/ui/button/index.js +4 -0
- package/dist/lib/components/ui/range-calendar/index.d.ts +19 -0
- package/dist/lib/components/ui/range-calendar/index.js +21 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.svelte +76 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.svelte.d.ts +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-day.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-day.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.svelte +7 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.svelte +7 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.svelte +12 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.svelte +16 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-header.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-header.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-heading.svelte +16 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-heading.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.svelte +44 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month.svelte +15 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-month.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-months.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-months.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.svelte +19 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.svelte.d.ts +5 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.svelte.d.ts +8 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.svelte +36 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.svelte.d.ts +8 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.svelte +43 -0
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.svelte.d.ts +4 -0
- package/dist/lib/components/ui/range-calendar/range-calendar.svelte +112 -0
- package/dist/lib/components/ui/range-calendar/range-calendar.svelte.d.ts +21 -0
- package/dist/lib/data-chart/DataChart.svelte +303 -0
- package/dist/lib/data-chart/DataChart.svelte.d.ts +7 -0
- package/dist/lib/data-chart/DateRange.d.ts +6 -0
- package/dist/lib/data-chart/DateRange.js +15 -14
- package/dist/lib/data-chart/chart-utils.d.ts +3 -0
- package/dist/lib/data-chart/chart-utils.js +157 -93
- package/dist/lib/data-chart/data-chart.svelte.d.ts +7 -0
- package/dist/lib/data-chart/data-chart.svelte.js +7 -28
- package/dist/lib/data-chart/requests.d.ts +3 -0
- package/dist/lib/data-chart/requests.js +36 -28
- package/dist/lib/data-chart/tooltip.d.ts +10 -0
- package/dist/lib/data-chart/tooltip.js +160 -98
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte +16 -0
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.svelte.d.ts +7 -0
- package/dist/lib/ev-stations/components/EvStationTooltip.svelte +127 -0
- package/dist/lib/ev-stations/components/EvStationTooltip.svelte.d.ts +7 -0
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte +46 -0
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.svelte.d.ts +18 -0
- package/dist/lib/ev-stations/data-maps.d.ts +5 -0
- package/dist/lib/ev-stations/data-maps.js +152 -4
- package/dist/lib/ev-stations/ev-station-icons.d.ts +16 -0
- package/dist/lib/ev-stations/ev-station-icons.js +21 -27
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.d.ts +19 -0
- package/dist/lib/ev-stations/ev-stations-cluster-renderer.js +130 -117
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.d.ts +31 -0
- package/dist/lib/ev-stations/ev-stations-map-integration.svelte.js +206 -180
- package/dist/lib/ev-stations/ev-stations.svelte.d.ts +9 -0
- package/dist/lib/ev-stations/ev-stations.svelte.js +54 -32
- package/dist/lib/ev-stations/types.d.ts +53 -0
- package/dist/lib/ev-stations/types.js +1 -0
- package/dist/lib/ev-stations/zip-codes.d.ts +13 -0
- package/dist/lib/ev-stations/zip-codes.js +457 -135
- package/dist/lib/hms/components/HMSFireLegend.svelte +21 -0
- package/dist/lib/hms/components/HMSFireLegend.svelte.d.ts +18 -0
- package/dist/lib/hms/hms-fire-icon-manager.d.ts +5 -0
- package/dist/lib/hms/hms-fire-icon-manager.js +28 -37
- package/dist/lib/hms/hms-fire-map-integration.svelte.d.ts +23 -0
- package/dist/lib/hms/hms-fire-map-integration.svelte.js +94 -97
- package/dist/lib/hms/hms-smoke-map-integration.svelte.d.ts +19 -0
- package/dist/lib/hms/hms-smoke-map-integration.svelte.js +68 -84
- package/dist/lib/hms/hms.svelte.d.ts +19 -0
- package/dist/lib/hms/hms.svelte.js +225 -76
- package/dist/lib/index.d.ts +68 -0
- package/dist/lib/index.js +56 -21
- package/dist/lib/map/Map.svelte +13 -0
- package/dist/lib/map/Map.svelte.d.ts +8 -0
- package/dist/lib/map/MapStyleDisplayOptions.svelte +61 -0
- package/dist/lib/map/MapStyleDisplayOptions.svelte.d.ts +3 -0
- package/dist/lib/map/Menu.svelte +64 -0
- package/dist/lib/map/Menu.svelte.d.ts +5 -0
- package/dist/lib/map/icons.d.ts +7 -0
- package/dist/lib/map/icons.js +24 -22
- package/dist/lib/map/integrations/base-layer-seperator.d.ts +9 -0
- package/dist/lib/map/integrations/base-layer-seperator.js +11 -12
- package/dist/lib/map/integrations/click-manager.d.ts +14 -0
- package/dist/lib/map/integrations/click-manager.js +52 -33
- package/dist/lib/map/integrations/integrations-manager.d.ts +8 -0
- package/dist/lib/map/integrations/integrations-manager.js +20 -12
- package/dist/lib/map/integrations/map-display-option.svelte.d.ts +7 -0
- package/dist/lib/map/integrations/map-display-option.svelte.js +10 -18
- package/dist/lib/map/integrations/map-geojson-integration.svelte.d.ts +13 -0
- package/dist/lib/map/integrations/map-geojson-integration.svelte.js +21 -17
- package/dist/lib/map/integrations/map-icon-manager.d.ts +15 -0
- package/dist/lib/map/integrations/map-icon-manager.js +52 -46
- package/dist/lib/map/integrations/map-integration.svelte.d.ts +6 -0
- package/dist/lib/map/integrations/map-integration.svelte.js +2 -5
- package/dist/lib/map/integrations/map-layer-integration.svelte.d.ts +11 -0
- package/dist/lib/map/integrations/map-layer-integration.svelte.js +36 -23
- package/dist/lib/map/integrations/tooltip.svelte.d.ts +28 -0
- package/dist/lib/map/integrations/tooltip.svelte.js +120 -78
- package/dist/lib/map/integrations/types.d.ts +14 -0
- package/dist/lib/map/integrations/types.js +1 -0
- package/dist/lib/map/map.svelte.d.ts +14 -0
- package/dist/lib/map/map.svelte.js +48 -50
- package/dist/lib/map/utils.d.ts +7 -0
- package/dist/lib/map/utils.js +32 -29
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte +112 -0
- package/dist/lib/monitors/components/MonitorClusterTooltip.svelte.d.ts +7 -0
- package/dist/lib/monitors/components/MonitorMarkersLegend.svelte +41 -0
- package/dist/lib/monitors/components/MonitorMarkersLegend.svelte.d.ts +3 -0
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte +128 -0
- package/dist/lib/monitors/components/MonitorSubscriptionManager.svelte.d.ts +6 -0
- package/dist/lib/monitors/components/MonitorTooltip.svelte +61 -0
- package/dist/lib/monitors/components/MonitorTooltip.svelte.d.ts +7 -0
- package/dist/lib/monitors/components/MonitorWidgetModal.svelte +100 -0
- package/dist/lib/monitors/components/MonitorWidgetModal.svelte.d.ts +6 -0
- package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte +79 -0
- package/dist/lib/monitors/components/MonitorsDisplayOptions.svelte.d.ts +3 -0
- package/dist/lib/monitors/monitor-utils.d.ts +4 -0
- package/dist/lib/monitors/monitor-utils.js +33 -23
- package/dist/lib/monitors/monitors-cluster-renderer.d.ts +33 -0
- package/dist/lib/monitors/monitors-cluster-renderer.js +218 -209
- package/dist/lib/monitors/monitors-icon-manager.svelte.d.ts +13 -0
- package/dist/lib/monitors/monitors-icon-manager.svelte.js +75 -70
- package/dist/lib/monitors/monitors-map-integration.svelte.d.ts +40 -0
- package/dist/lib/monitors/monitors-map-integration.svelte.js +278 -270
- package/dist/lib/monitors/monitors.svelte.d.ts +16 -0
- package/dist/lib/monitors/monitors.svelte.js +38 -63
- package/dist/lib/monitors/types.d.ts +26 -0
- package/dist/lib/monitors/types.js +1 -0
- package/dist/lib/reactivity.svelte.d.ts +0 -0
- package/dist/lib/reactivity.svelte.js +83 -0
- package/dist/lib/router-context.d.ts +27 -0
- package/dist/lib/router-context.js +11 -11
- package/dist/lib/routes.d.ts +2 -0
- package/dist/lib/routes.js +10 -9
- package/dist/lib/search/Search.svelte +189 -0
- package/dist/lib/search/Search.svelte.d.ts +3 -0
- package/dist/lib/search/service.d.ts +17 -0
- package/dist/lib/search/service.js +75 -85
- package/dist/lib/utils.d.ts +13 -0
- package/dist/lib/utils.js +10 -12
- package/dist/lib/weather.d.ts +1 -0
- package/dist/lib/weather.js +11 -7
- package/dist/lib/wind/wind.svelte.d.ts +10 -0
- package/dist/lib/wind/wind.svelte.js +13 -21
- package/package.json +9 -7
- package/src/lib/LoadScreen.svelte +3 -3
- package/src/lib/hms/components/HMSFireLegend.svelte +1 -1
- package/src/lib/hms/hms.svelte.ts +8 -9
- package/src/lib/index.ts +18 -0
- package/src/lib/routes.ts +6 -1
- package/src/lib/utils.ts +1 -1
- package/dist/lib/LoadScreen.js +0 -73
- package/dist/lib/MainMapView.js +0 -7
- package/dist/lib/MapLegend.js +0 -13
- package/dist/lib/MonitorDetailPanel.js +0 -169
- package/dist/lib/MonitorMapLayout.js +0 -91
- package/dist/lib/_virtual/_rolldown/runtime.js +0 -11
- package/dist/lib/assets/logos/airgradient-blue.js +0 -4
- package/dist/lib/assets/logos/airnow-compact.js +0 -4
- package/dist/lib/assets/logos/carb-compact.js +0 -4
- package/dist/lib/assets/logos/purpleair-compact.js +0 -4
- package/dist/lib/assets/logos/sjvair.js +0 -4
- package/dist/lib/collocation-sites/CollocationTooltip.js +0 -105
- package/dist/lib/components/DataBox.js +0 -30
- package/dist/lib/components/DisplayOption.js +0 -10
- package/dist/lib/components/MapLayersDisplayOptions.js +0 -87
- package/dist/lib/components/SegmentedControl.js +0 -37
- package/dist/lib/components/ToggleSwitch.js +0 -17
- package/dist/lib/components/ui/button/button.js +0 -34
- package/dist/lib/components/ui/range-calendar/range-calendar-caption.js +0 -82
- package/dist/lib/components/ui/range-calendar/range-calendar-cell.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-day.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-body.js +0 -27
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-head.js +0 -27
- package/dist/lib/components/ui/range-calendar/range-calendar-grid-row.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-grid.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-head-cell.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-header.js +0 -35
- package/dist/lib/components/ui/range-calendar/range-calendar-month-select.js +0 -61
- package/dist/lib/components/ui/range-calendar/range-calendar-month.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-months.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-nav.js +0 -25
- package/dist/lib/components/ui/range-calendar/range-calendar-next-button.js +0 -58
- package/dist/lib/components/ui/range-calendar/range-calendar-prev-button.js +0 -58
- package/dist/lib/components/ui/range-calendar/range-calendar-year-select.js +0 -59
- package/dist/lib/components/ui/range-calendar/range-calendar.js +0 -272
- package/dist/lib/data-chart/DataChart.js +0 -142
- package/dist/lib/ev-stations/components/EvStationClusterTooltip.js +0 -16
- package/dist/lib/ev-stations/components/EvStationTooltip.js +0 -120
- package/dist/lib/ev-stations/components/EvStationsDisplayOptions.js +0 -41
- package/dist/lib/hms/components/HMSFireLegend.js +0 -35
- package/dist/lib/map/Map.js +0 -14
- package/dist/lib/map/MapStyleDisplayOptions.js +0 -43
- package/dist/lib/map/Menu.js +0 -44
- package/dist/lib/monitors/components/MonitorClusterTooltip.js +0 -83
- package/dist/lib/monitors/components/MonitorMarkersLegend.js +0 -35
- package/dist/lib/monitors/components/MonitorSubscriptionManager.js +0 -104
- package/dist/lib/monitors/components/MonitorTooltip.js +0 -59
- package/dist/lib/monitors/components/MonitorWidgetModal.js +0 -40
- package/dist/lib/monitors/components/MonitorsDisplayOptions.js +0 -76
- package/dist/lib/search/Search.js +0 -124
- package/dist/lib/sjvair-air.avif +0 -0
- package/dist/lib/sjvair-air.png +0 -0
- package/dist/lib/sjvair-air.webp +0 -0
- package/dist/lib/sjvair-air2.avif +0 -0
- package/dist/lib/sjvair-air2.png +0 -0
- package/dist/lib/sjvair-air2.webp +0 -0
- package/dist/lib/sjvair-icon.avif +0 -0
- package/dist/lib/sjvair-icon.png +0 -0
- package/dist/lib/sjvair-icon.webp +0 -0
- package/dist/lib/sjvair-icon2.avif +0 -0
- package/dist/lib/sjvair-icon2.png +0 -0
- package/dist/lib/sjvair-icon2.webp +0 -0
- package/dist/lib/sjvair-sjv.avif +0 -0
- package/dist/lib/sjvair-sjv.png +0 -0
- package/dist/lib/sjvair-sjv.webp +0 -0
- package/dist/lib/sjvair-sjv2.avif +0 -0
- package/dist/lib/sjvair-sjv2.png +0 -0
- package/dist/lib/sjvair-sjv2.webp +0 -0
|
@@ -1,78 +1,227 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { featureCollection
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
async init() {
|
|
30
|
-
await Promise.allSettled([this.loadSmoke(), this.loadFire()]);
|
|
31
|
-
}
|
|
32
|
-
async loadSmoke() {
|
|
33
|
-
this.smoke = await a();
|
|
34
|
-
}
|
|
35
|
-
async loadFire() {
|
|
36
|
-
try {
|
|
37
|
-
let e = u((await i()).filter((e) => e.frp !== null));
|
|
38
|
-
this.fire = e, this.fireGroups = d(e);
|
|
39
|
-
} catch (e) {
|
|
40
|
-
console.error("HMS fire load failed:", e);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
function u(e) {
|
|
45
|
-
let t = /* @__PURE__ */ new Map();
|
|
46
|
-
for (let n of e) {
|
|
47
|
-
let [e, r] = n.geometry.coordinates, i = `${e},${r}`, a = t.get(i);
|
|
48
|
-
(!a || n.timestamp > a.timestamp) && t.set(i, n);
|
|
49
|
-
}
|
|
50
|
-
return Array.from(t.values());
|
|
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() {
|
|
11
|
+
await Promise.allSettled([this.loadSmoke(), this.loadFire()]);
|
|
12
|
+
}
|
|
13
|
+
async loadSmoke() {
|
|
14
|
+
this.smoke = await getHMSSmoke();
|
|
15
|
+
}
|
|
16
|
+
async loadFire() {
|
|
17
|
+
try {
|
|
18
|
+
const raw = await getHMSFire();
|
|
19
|
+
const filtered = raw.filter((d) => d.frp !== null);
|
|
20
|
+
const deduped = deduplicateByCoordinates(filtered);
|
|
21
|
+
this.fire = deduped;
|
|
22
|
+
this.fireGroups = computeFireGroups(deduped);
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
console.error("HMS fire load failed:", err);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
51
28
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
frps: [],
|
|
64
|
-
lngs: [],
|
|
65
|
-
lats: []
|
|
66
|
-
};
|
|
67
|
-
o.frps.push(t.frp), o.lngs.push(r), o.lats.push(i), a.set(n, o);
|
|
68
|
-
}
|
|
69
|
-
return Array.from(a.entries()).map(([e, { frps: t, lngs: n, lats: r }]) => ({
|
|
70
|
-
id: `hms-fire-group-${e}`,
|
|
71
|
-
coordinates: [n.reduce((e, t) => e + t, 0) / n.length, r.reduce((e, t) => e + t, 0) / r.length],
|
|
72
|
-
avgFrp: t.reduce((e, t) => e + t, 0) / t.length,
|
|
73
|
-
count: t.length
|
|
74
|
-
}));
|
|
29
|
+
function deduplicateByCoordinates(fires) {
|
|
30
|
+
const latest = {};
|
|
31
|
+
for (const fire of fires) {
|
|
32
|
+
const [lng, lat] = fire.geometry.coordinates;
|
|
33
|
+
const key = `${lng},${lat}`;
|
|
34
|
+
const existing = latest[key];
|
|
35
|
+
if (!existing || fire.timestamp > existing.timestamp) {
|
|
36
|
+
latest[key] = fire;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return Object.values(latest);
|
|
75
40
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
41
|
+
function computeFireGroups(fires) {
|
|
42
|
+
if (!fires.length)
|
|
43
|
+
return [];
|
|
44
|
+
const fc = featureCollection(fires.map((d) => point(d.geometry.coordinates, { fireId: d.id, frp: d.frp })));
|
|
45
|
+
const clustered = clustersDbscan(fc, HMS_FIRE_DBSCAN_EPSILON, {
|
|
46
|
+
minPoints: HMS_FIRE_DBSCAN_MIN_POINTS,
|
|
47
|
+
units: "kilometers"
|
|
48
|
+
});
|
|
49
|
+
const groups = {};
|
|
50
|
+
for (const feature of clustered.features) {
|
|
51
|
+
const props = feature.properties;
|
|
52
|
+
// With minPoints=1 every point self-qualifies as core, so "noise" never occurs.
|
|
53
|
+
// This branch activates correctly if minPoints is raised above 1 in future.
|
|
54
|
+
const key = props.dbscan === "noise" ? `noise-${props.fireId}` : `cluster-${props.cluster}`;
|
|
55
|
+
const [lng, lat] = feature.geometry.coordinates;
|
|
56
|
+
const entry = groups[key] ?? { frps: [], lngs: [], lats: [] };
|
|
57
|
+
entry.frps.push(props.frp);
|
|
58
|
+
entry.lngs.push(lng);
|
|
59
|
+
entry.lats.push(lat);
|
|
60
|
+
groups[key] = entry;
|
|
61
|
+
}
|
|
62
|
+
return Object.entries(groups).map(([key, { frps, lngs, lats }]) => ({
|
|
63
|
+
id: `hms-fire-group-${key}`,
|
|
64
|
+
coordinates: [
|
|
65
|
+
lngs.reduce((s, v) => s + v, 0) / lngs.length,
|
|
66
|
+
lats.reduce((s, v) => s + v, 0) / lats.length
|
|
67
|
+
],
|
|
68
|
+
avgFrp: frps.reduce((s, v) => s + v, 0) / frps.length,
|
|
69
|
+
count: frps.length
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
//async function fakeFireData(): Promise<Array<HMSFireGeoJSON>> {
|
|
73
|
+
// const response: FetchHMSFireResponse["body"] = {
|
|
74
|
+
// data: [
|
|
75
|
+
// {
|
|
76
|
+
// id: "4Kx7mNpQrQ",
|
|
77
|
+
// date: "2026-04-13",
|
|
78
|
+
// satellite: "GOES-16",
|
|
79
|
+
// timestamp: "2026-04-13T18:30:00Z",
|
|
80
|
+
// frp: 360,
|
|
81
|
+
// ecosystem: 4,
|
|
82
|
+
// method: "AF",
|
|
83
|
+
// geometry: {
|
|
84
|
+
// type: "Point",
|
|
85
|
+
// coordinates: [-118.532, 36.591],
|
|
86
|
+
// },
|
|
87
|
+
// },
|
|
88
|
+
// {
|
|
89
|
+
// id: "4Kx7mNpQrD",
|
|
90
|
+
// date: "2026-04-13",
|
|
91
|
+
// satellite: "GOES-16",
|
|
92
|
+
// timestamp: "2026-04-13T18:30:00Z",
|
|
93
|
+
// frp: 20,
|
|
94
|
+
// ecosystem: 4,
|
|
95
|
+
// method: "AF",
|
|
96
|
+
// geometry: {
|
|
97
|
+
// type: "Point",
|
|
98
|
+
// coordinates: [-118.632, 36.691],
|
|
99
|
+
// },
|
|
100
|
+
// },
|
|
101
|
+
// {
|
|
102
|
+
// id: "4Kx7mNpQrT",
|
|
103
|
+
// date: "2026-04-13",
|
|
104
|
+
// satellite: "GOES-16",
|
|
105
|
+
// timestamp: "2026-04-13T18:30:00Z",
|
|
106
|
+
// frp: 152.7,
|
|
107
|
+
// ecosystem: 4,
|
|
108
|
+
// method: "AF",
|
|
109
|
+
// geometry: {
|
|
110
|
+
// type: "Point",
|
|
111
|
+
// coordinates: [-118.832, 36.491],
|
|
112
|
+
// },
|
|
113
|
+
// },
|
|
114
|
+
// {
|
|
115
|
+
// id: "9vBjLsWqYm",
|
|
116
|
+
// date: "2026-04-13",
|
|
117
|
+
// satellite: "GOES-17",
|
|
118
|
+
// timestamp: "2026-04-13T17:45:00Z",
|
|
119
|
+
// frp: 58.2,
|
|
120
|
+
// ecosystem: 2,
|
|
121
|
+
// method: "AF",
|
|
122
|
+
// geometry: {
|
|
123
|
+
// type: "Point",
|
|
124
|
+
// coordinates: [-119.204, 37.112],
|
|
125
|
+
// },
|
|
126
|
+
// },
|
|
127
|
+
// {
|
|
128
|
+
// id: "2HcFnRkVxZ",
|
|
129
|
+
// date: "2026-04-13",
|
|
130
|
+
// satellite: "GOES-16",
|
|
131
|
+
// timestamp: "2026-04-13T16:00:00Z",
|
|
132
|
+
// frp: null,
|
|
133
|
+
// ecosystem: 7,
|
|
134
|
+
// method: "FDC",
|
|
135
|
+
// geometry: {
|
|
136
|
+
// type: "Point",
|
|
137
|
+
// coordinates: [-120.571, 35.883],
|
|
138
|
+
// },
|
|
139
|
+
// },
|
|
140
|
+
// ],
|
|
141
|
+
// page: 1,
|
|
142
|
+
// count: 3,
|
|
143
|
+
// pages: 1,
|
|
144
|
+
// has_next_page: false,
|
|
145
|
+
// has_previous_page: false,
|
|
146
|
+
// };
|
|
147
|
+
// return Promise.resolve(response.data);
|
|
148
|
+
//}
|
|
149
|
+
//async function fakeSmokeData(): Promise<Array<HMSSmokeGeoJSON>> {
|
|
150
|
+
// const response: FetchHMSSmokeResponse["body"] = {
|
|
151
|
+
// data: [
|
|
152
|
+
// {
|
|
153
|
+
// id: "sM3kNpQrL1",
|
|
154
|
+
// date: "2026-04-13",
|
|
155
|
+
// satellite: "GOES-16",
|
|
156
|
+
// start: "2026-04-13T12:00:00Z",
|
|
157
|
+
// end: "2026-04-13T18:00:00Z",
|
|
158
|
+
// density: "light",
|
|
159
|
+
// geometry: {
|
|
160
|
+
// type: "MultiPolygon",
|
|
161
|
+
// coordinates: [
|
|
162
|
+
// [
|
|
163
|
+
// [
|
|
164
|
+
// [-122.5, 39.5],
|
|
165
|
+
// [-120.5, 39.5],
|
|
166
|
+
// [-120.5, 41.0],
|
|
167
|
+
// [-122.5, 41.0],
|
|
168
|
+
// [-122.5, 39.5]
|
|
169
|
+
// ]
|
|
170
|
+
// ]
|
|
171
|
+
// ]
|
|
172
|
+
// }
|
|
173
|
+
// },
|
|
174
|
+
// {
|
|
175
|
+
// id: "sM3kNpQrL2",
|
|
176
|
+
// date: "2026-04-13",
|
|
177
|
+
// satellite: "GOES-16",
|
|
178
|
+
// start: "2026-04-13T12:00:00Z",
|
|
179
|
+
// end: "2026-04-13T18:00:00Z",
|
|
180
|
+
// density: "medium",
|
|
181
|
+
// geometry: {
|
|
182
|
+
// type: "MultiPolygon",
|
|
183
|
+
// coordinates: [
|
|
184
|
+
// [
|
|
185
|
+
// [
|
|
186
|
+
// [-121.0, 36.5],
|
|
187
|
+
// [-119.0, 36.5],
|
|
188
|
+
// [-119.0, 38.0],
|
|
189
|
+
// [-121.0, 38.0],
|
|
190
|
+
// [-121.0, 36.5]
|
|
191
|
+
// ]
|
|
192
|
+
// ]
|
|
193
|
+
// ]
|
|
194
|
+
// }
|
|
195
|
+
// },
|
|
196
|
+
// {
|
|
197
|
+
// id: "sM3kNpQrL3",
|
|
198
|
+
// date: "2026-04-13",
|
|
199
|
+
// satellite: "GOES-16",
|
|
200
|
+
// start: "2026-04-13T12:00:00Z",
|
|
201
|
+
// end: "2026-04-13T18:00:00Z",
|
|
202
|
+
// density: "heavy",
|
|
203
|
+
// geometry: {
|
|
204
|
+
// type: "MultiPolygon",
|
|
205
|
+
// coordinates: [
|
|
206
|
+
// [
|
|
207
|
+
// [
|
|
208
|
+
// [-119.0, 33.5],
|
|
209
|
+
// [-116.5, 33.5],
|
|
210
|
+
// [-116.5, 35.0],
|
|
211
|
+
// [-119.0, 35.0],
|
|
212
|
+
// [-119.0, 33.5]
|
|
213
|
+
// ]
|
|
214
|
+
// ]
|
|
215
|
+
// ]
|
|
216
|
+
// }
|
|
217
|
+
// }
|
|
218
|
+
// ],
|
|
219
|
+
// page: 1,
|
|
220
|
+
// count: 3,
|
|
221
|
+
// pages: 1,
|
|
222
|
+
// has_next_page: false,
|
|
223
|
+
// has_previous_page: false
|
|
224
|
+
// };
|
|
225
|
+
// return Promise.resolve(response.data);
|
|
226
|
+
//}
|
|
227
|
+
export const hmsManager = new HmsManager();
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Usage in a host app:
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* // router.ts
|
|
6
|
+
* import { createRouter } from "sv-router";
|
|
7
|
+
* import { monitorMapRoutes } from "@sjvair/monitor-map";
|
|
8
|
+
*
|
|
9
|
+
* export const { route, navigate, p, isActive, Router } = createRouter({
|
|
10
|
+
* "/my-map": monitorMapRoutes
|
|
11
|
+
* // ...the host app's own routes
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* ```svelte
|
|
16
|
+
* <!-- app root -->
|
|
17
|
+
* <script>
|
|
18
|
+
* import { provideMonitorMapRouter } from "@sjvair/monitor-map";
|
|
19
|
+
* import { route, navigate, p, isActive, Router } from "./router";
|
|
20
|
+
*
|
|
21
|
+
* provideMonitorMapRouter({ route, navigate, p, isActive, basePath: "/my-map" });
|
|
22
|
+
* </script>
|
|
23
|
+
*
|
|
24
|
+
* <Router />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export { monitorMapRoutes } from "./routes";
|
|
28
|
+
export { ROUTER_KEY, provideMonitorMapRouter, useMonitorMapRouter, type MonitorMapRouterApi } from "./router-context";
|
|
29
|
+
export { monitorsManager } from "./monitors/monitors.svelte";
|
|
30
|
+
export type { MonitorsManager } from "./monitors/monitors.svelte";
|
|
31
|
+
export { collocationSitesManager } from "./collocation-sites/collocations.svelte";
|
|
32
|
+
export type { CollocationSitesManager } from "./collocation-sites/collocations.svelte";
|
|
33
|
+
export { evStationsManager } from "./ev-stations/ev-stations.svelte";
|
|
34
|
+
export type { EvStationsManager } from "./ev-stations/ev-stations.svelte";
|
|
35
|
+
export { hmsManager } from "./hms/hms.svelte";
|
|
36
|
+
export type { HMSManager } from "./hms/hms.svelte";
|
|
37
|
+
export { mapManager, DefaultMapStyle, initializeMap } from "./map/map.svelte";
|
|
38
|
+
export type { MapManager } from "./map/map.svelte";
|
|
39
|
+
export { monitorsMapIntegration } from "./monitors/monitors-map-integration.svelte.ts";
|
|
40
|
+
export { collocationSitesMapIntegration } from "./collocation-sites/collocations-map-integration.svelte.ts";
|
|
41
|
+
export { evStationsMapIntegration } from "./ev-stations/ev-stations-map-integration.svelte.ts";
|
|
42
|
+
export { windMapIntegration } from "./wind/wind.svelte";
|
|
43
|
+
export { baseLayerSeperator } from "./map/integrations/base-layer-seperator";
|
|
44
|
+
export { hmsFireMapIntegration } from "./hms/hms-fire-map-integration.svelte.ts";
|
|
45
|
+
export { hmsSmokeMapIntegration } from "./hms/hms-smoke-map-integration.svelte.ts";
|
|
46
|
+
export { default as Map } from "./map/Map.svelte";
|
|
47
|
+
export { default as Menu } from "./map/Menu.svelte";
|
|
48
|
+
export { default as LoadScreen, loadScreenState, enable as enableLoadScreen, disable as disableLoadScreen } from "./LoadScreen.svelte";
|
|
49
|
+
export type { LoadScreenState } from "./LoadScreen.svelte";
|
|
50
|
+
export { default as MonitorsDisplayOptions } from "./monitors/components/MonitorsDisplayOptions.svelte";
|
|
51
|
+
export { default as EvStationsDisplayOptions } from "./ev-stations/components/EvStationsDisplayOptions.svelte";
|
|
52
|
+
export { default as MapLayersDisplayOptions } from "./components/MapLayersDisplayOptions.svelte";
|
|
53
|
+
export { default as MapStyleDisplayOptions } from "./map/MapStyleDisplayOptions.svelte";
|
|
54
|
+
export { default as ToggleSwitch } from "./components/ToggleSwitch.svelte";
|
|
55
|
+
export { default as SegmentedControl } from "./components/SegmentedControl.svelte";
|
|
56
|
+
export { MapIntegration } from "./map/integrations/map-integration.svelte.ts";
|
|
57
|
+
export { MapLayerIntegration } from "./map/integrations/map-layer-integration.svelte.ts";
|
|
58
|
+
export { MapIconLayerIntegration as MapGeoJSONIntegration } from "./map/integrations/map-geojson-integration.svelte.ts";
|
|
59
|
+
export type { SomeMapIntegration } from "./map/integrations/types";
|
|
60
|
+
export type { MonitorsMapIntegration } from "./monitors/monitors-map-integration.svelte.ts";
|
|
61
|
+
export type { WindMapIntegration } from "./wind/wind.svelte.ts";
|
|
62
|
+
export type { EvStationsMapIntegration } from "./ev-stations/ev-stations-map-integration.svelte.ts";
|
|
63
|
+
export type { HMSFireMapIntegration } from "./hms/hms-fire-map-integration.svelte.ts";
|
|
64
|
+
export type { HMSSmokeMapIntegration } from "./hms/hms-smoke-map-integration.svelte.ts";
|
|
65
|
+
export type { HMSFireGroup } from "./hms/hms.svelte.ts";
|
|
66
|
+
export type { MonitorMapFeature, MonitorMarkerProperties, MonitorClusterMapFeature, MonitorClusterMarkerProperties } from "./monitors/types";
|
|
67
|
+
export type { CollocationSiteMapFeature, CollocationSiteMarkerProperties } from "./collocation-sites/types";
|
|
68
|
+
export type { EvStation, EvStationMarkerProperties, EvStationMapFeature, EvStationClusterMapFeature } from "./ev-stations/types";
|
package/dist/lib/index.js
CHANGED
|
@@ -1,21 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Usage in a host app:
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* // router.ts
|
|
6
|
+
* import { createRouter } from "sv-router";
|
|
7
|
+
* import { monitorMapRoutes } from "@sjvair/monitor-map";
|
|
8
|
+
*
|
|
9
|
+
* export const { route, navigate, p, isActive, Router } = createRouter({
|
|
10
|
+
* "/my-map": monitorMapRoutes
|
|
11
|
+
* // ...the host app's own routes
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* ```svelte
|
|
16
|
+
* <!-- app root -->
|
|
17
|
+
* <script>
|
|
18
|
+
* import { provideMonitorMapRouter } from "@sjvair/monitor-map";
|
|
19
|
+
* import { route, navigate, p, isActive, Router } from "./router";
|
|
20
|
+
*
|
|
21
|
+
* provideMonitorMapRouter({ route, navigate, p, isActive, basePath: "/my-map" });
|
|
22
|
+
* </script>
|
|
23
|
+
*
|
|
24
|
+
* <Router />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export { monitorMapRoutes } from "./routes";
|
|
28
|
+
export { ROUTER_KEY, provideMonitorMapRouter, useMonitorMapRouter } from "./router-context";
|
|
29
|
+
// State managers
|
|
30
|
+
export { monitorsManager } from "./monitors/monitors.svelte";
|
|
31
|
+
export { collocationSitesManager } from "./collocation-sites/collocations.svelte";
|
|
32
|
+
export { evStationsManager } from "./ev-stations/ev-stations.svelte";
|
|
33
|
+
export { hmsManager } from "./hms/hms.svelte";
|
|
34
|
+
export { mapManager, DefaultMapStyle, initializeMap } from "./map/map.svelte";
|
|
35
|
+
// Map integrations
|
|
36
|
+
export { monitorsMapIntegration } from "./monitors/monitors-map-integration.svelte.ts";
|
|
37
|
+
export { collocationSitesMapIntegration } from "./collocation-sites/collocations-map-integration.svelte.ts";
|
|
38
|
+
export { evStationsMapIntegration } from "./ev-stations/ev-stations-map-integration.svelte.ts";
|
|
39
|
+
export { windMapIntegration } from "./wind/wind.svelte";
|
|
40
|
+
export { baseLayerSeperator } from "./map/integrations/base-layer-seperator";
|
|
41
|
+
export { hmsFireMapIntegration } from "./hms/hms-fire-map-integration.svelte.ts";
|
|
42
|
+
export { hmsSmokeMapIntegration } from "./hms/hms-smoke-map-integration.svelte.ts";
|
|
43
|
+
// Components
|
|
44
|
+
export { default as Map } from "./map/Map.svelte";
|
|
45
|
+
export { default as Menu } from "./map/Menu.svelte";
|
|
46
|
+
export { default as LoadScreen, loadScreenState, enable as enableLoadScreen, disable as disableLoadScreen } from "./LoadScreen.svelte";
|
|
47
|
+
export { default as MonitorsDisplayOptions } from "./monitors/components/MonitorsDisplayOptions.svelte";
|
|
48
|
+
export { default as EvStationsDisplayOptions } from "./ev-stations/components/EvStationsDisplayOptions.svelte";
|
|
49
|
+
export { default as MapLayersDisplayOptions } from "./components/MapLayersDisplayOptions.svelte";
|
|
50
|
+
export { default as MapStyleDisplayOptions } from "./map/MapStyleDisplayOptions.svelte";
|
|
51
|
+
export { default as ToggleSwitch } from "./components/ToggleSwitch.svelte";
|
|
52
|
+
export { default as SegmentedControl } from "./components/SegmentedControl.svelte";
|
|
53
|
+
// Integration base classes (extend these to add custom map features)
|
|
54
|
+
export { MapIntegration } from "./map/integrations/map-integration.svelte.ts";
|
|
55
|
+
export { MapLayerIntegration } from "./map/integrations/map-layer-integration.svelte.ts";
|
|
56
|
+
export { MapIconLayerIntegration as MapGeoJSONIntegration } from "./map/integrations/map-geojson-integration.svelte.ts";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import "@maptiler/sdk/dist/maptiler-sdk.css";
|
|
3
|
+
import { initializeMap } from "./map.svelte.ts";
|
|
4
|
+
import { integrationsManager } from "./integrations/integrations-manager";
|
|
5
|
+
import type { SomeMapIntegration } from "./integrations/types.ts";
|
|
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>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "@maptiler/sdk/dist/maptiler-sdk.css";
|
|
2
|
+
import type { SomeMapIntegration } from "./integrations/types.ts";
|
|
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;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MapStyleVariant, ReferenceMapStyle } from "@maptiler/sdk";
|
|
3
|
+
import { mapManager, DefaultMapStyle } from "./map.svelte";
|
|
4
|
+
import { MAP_STYLE_OPTIONS } from "./utils.ts";
|
|
5
|
+
import { integrationsManager } from "./integrations/integrations-manager";
|
|
6
|
+
import DisplayOption from "../components/DisplayOption.svelte";
|
|
7
|
+
|
|
8
|
+
let currentMapStyle: MapStyleVariant = DefaultMapStyle;
|
|
9
|
+
|
|
10
|
+
let selectedReferenceStyle: ReferenceMapStyle = $state(DefaultMapStyle.getReferenceStyle());
|
|
11
|
+
let selectedVariant: MapStyleVariant = $state(DefaultMapStyle);
|
|
12
|
+
|
|
13
|
+
const selectedStyleVariants: Array<MapStyleVariant> = $derived(
|
|
14
|
+
selectedReferenceStyle.getVariants()
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
$effect(() => {
|
|
18
|
+
const referenceStyleChanged: boolean =
|
|
19
|
+
selectedReferenceStyle !== currentMapStyle.getReferenceStyle();
|
|
20
|
+
const variantChanged: boolean = selectedVariant !== currentMapStyle;
|
|
21
|
+
|
|
22
|
+
if (mapManager.map !== null) {
|
|
23
|
+
if (referenceStyleChanged && !variantChanged) {
|
|
24
|
+
selectedVariant = selectedReferenceStyle.getDefaultVariant();
|
|
25
|
+
} else if (variantChanged) {
|
|
26
|
+
mapManager.map.once("style.load", async () => {
|
|
27
|
+
currentMapStyle = selectedVariant;
|
|
28
|
+
integrationsManager.refresh();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
mapManager.map.setStyle(selectedVariant);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<DisplayOption>
|
|
38
|
+
<p class="text-lg font-bold underline">Map Styles</p>
|
|
39
|
+
<label for="mapStyleType">Style</label>
|
|
40
|
+
<select
|
|
41
|
+
id="mapStyleType"
|
|
42
|
+
name="selectedOption"
|
|
43
|
+
bind:value={selectedReferenceStyle}
|
|
44
|
+
class="rounded border p-1"
|
|
45
|
+
>
|
|
46
|
+
{#each MAP_STYLE_OPTIONS as mapStyle, idx (idx)}
|
|
47
|
+
<option value={mapStyle}>{mapStyle.getName()}</option>
|
|
48
|
+
{/each}
|
|
49
|
+
</select>
|
|
50
|
+
<label for="mapStyleVariant">Variant</label>
|
|
51
|
+
<select
|
|
52
|
+
id="mapStyleType"
|
|
53
|
+
name="selectedOption"
|
|
54
|
+
bind:value={selectedVariant}
|
|
55
|
+
class="rounded border p-1"
|
|
56
|
+
>
|
|
57
|
+
{#each selectedStyleVariants as variant, idx (idx)}
|
|
58
|
+
<option value={variant}>{variant.getName()}</option>
|
|
59
|
+
{/each}
|
|
60
|
+
</select>
|
|
61
|
+
</DisplayOption>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Attachment } from "svelte/attachments";
|
|
3
|
+
import { SlidersHorizontalIcon } from "@lucide/svelte";
|
|
4
|
+
|
|
5
|
+
let { children } = $props();
|
|
6
|
+
let isOpen: boolean = $state(false);
|
|
7
|
+
|
|
8
|
+
function open() {
|
|
9
|
+
if (!isOpen) {
|
|
10
|
+
isOpen = true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function close() {
|
|
15
|
+
if (isOpen) {
|
|
16
|
+
isOpen = false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const hasTarget = (target: EventTarget | null): target is HTMLElement => target !== null;
|
|
21
|
+
|
|
22
|
+
const displayOptionsToggle: Attachment<HTMLDivElement> = (target: HTMLDivElement) => {
|
|
23
|
+
function toggle(e: PointerEvent) {
|
|
24
|
+
if (hasTarget(e.target) && target.contains(e.target)) {
|
|
25
|
+
return "trigger" in e.target.dataset ? close() : open();
|
|
26
|
+
} else {
|
|
27
|
+
close();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
document.body.addEventListener("click", toggle);
|
|
31
|
+
|
|
32
|
+
return () => document.body.removeEventListener("click", toggle);
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div
|
|
37
|
+
{@attach displayOptionsToggle}
|
|
38
|
+
data-trigger
|
|
39
|
+
class:rounded-full={!isOpen}
|
|
40
|
+
class:delay-100={!isOpen}
|
|
41
|
+
class="relative top-0 left-0 flex items-center justify-center overflow-hidden rounded bg-white p-1 shadow transition-all duration-0 select-none"
|
|
42
|
+
>
|
|
43
|
+
<button
|
|
44
|
+
class:w-0={isOpen}
|
|
45
|
+
class:h-0={isOpen}
|
|
46
|
+
class:opacity-0={isOpen}
|
|
47
|
+
class="relative size-10 transition-all flex justify-center items-center"
|
|
48
|
+
aria-label="Display Options"
|
|
49
|
+
>
|
|
50
|
+
<SlidersHorizontalIcon size="24" />
|
|
51
|
+
</button>
|
|
52
|
+
<div
|
|
53
|
+
class:h-55={isOpen}
|
|
54
|
+
class:w-135={isOpen}
|
|
55
|
+
class="relative flex h-0 w-0 items-center justify-center overflow-x-hidden overflow-y-scroll transition-all duration-250"
|
|
56
|
+
>
|
|
57
|
+
<div
|
|
58
|
+
data-trigger
|
|
59
|
+
class="absolute top-0 left-0 flex h-fit w-full items-start justify-between gap-4 p-2 flex-wrap"
|
|
60
|
+
>
|
|
61
|
+
{@render children?.()}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|