@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,9 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/** The map options the toolbar edits; `mapOptions` holds the live copy. */
|
|
2
|
+
export interface MapOptions {
|
|
3
|
+
/** False for the Pollutant menu's "None": no monitors (or collocation sites) on the map. */
|
|
4
|
+
monitorsOn: boolean;
|
|
5
|
+
/** Which monitor types draw, keyed by server type; a type with no key never draws. */
|
|
6
|
+
monitorTypes: Record<string, boolean>;
|
|
7
|
+
inactive: boolean;
|
|
8
|
+
inside: boolean;
|
|
9
|
+
/** Monitors' and EV chargers' clustering. */
|
|
10
|
+
clustered: boolean;
|
|
11
|
+
collocationSites: boolean;
|
|
12
|
+
/** HMS smoke and fire together. */
|
|
13
|
+
fireAndSmoke: boolean;
|
|
14
|
+
evStations: boolean;
|
|
15
|
+
evLevels: {
|
|
16
|
+
lvl2: boolean;
|
|
17
|
+
lvl3: boolean;
|
|
18
|
+
};
|
|
19
|
+
wind: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Defaults restored by "Reset Map Options"; a fresh load starts at them too. */
|
|
7
22
|
export declare const MAP_OPTION_DEFAULTS: {
|
|
8
23
|
readonly monitorTypes: {
|
|
9
24
|
readonly airnow: true;
|
|
@@ -13,9 +28,9 @@ export declare const MAP_OPTION_DEFAULTS: {
|
|
|
13
28
|
readonly airgradient: true;
|
|
14
29
|
readonly purpleair: true;
|
|
15
30
|
readonly vozbox: true;
|
|
16
|
-
readonly inactive: false;
|
|
17
|
-
readonly inside: false;
|
|
18
31
|
};
|
|
32
|
+
readonly inactive: false;
|
|
33
|
+
readonly inside: false;
|
|
19
34
|
readonly clustered: true;
|
|
20
35
|
readonly collocationSites: false;
|
|
21
36
|
readonly fireAndSmoke: true;
|
|
@@ -26,31 +41,5 @@ export declare const MAP_OPTION_DEFAULTS: {
|
|
|
26
41
|
};
|
|
27
42
|
readonly wind: false;
|
|
28
43
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
type Option = {
|
|
33
|
-
value: boolean;
|
|
34
|
-
};
|
|
35
|
-
export interface MapOptionTargets extends PollutantTargets {
|
|
36
|
-
integration: PollutantTargets["integration"] & {
|
|
37
|
-
clustered: boolean;
|
|
38
|
-
displayOptions: Record<string, Option>;
|
|
39
|
-
};
|
|
40
|
-
collocationSites: Toggle;
|
|
41
|
-
hmsFire: Toggle;
|
|
42
|
-
hmsSmoke: Toggle;
|
|
43
|
-
evStations: Toggle & {
|
|
44
|
-
clustered: boolean;
|
|
45
|
-
displayOptions: {
|
|
46
|
-
lvl2: Option;
|
|
47
|
-
lvl3: Option;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
wind: Toggle;
|
|
51
|
-
mapStyle: {
|
|
52
|
-
reset(): void;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export declare function applyMapOptionDefaults(targets: MapOptionTargets, defaultPollutant: MonitorsPollutant | null): void;
|
|
56
|
-
export {};
|
|
44
|
+
/** A fresh copy of the defaults, with monitors on. */
|
|
45
|
+
export declare function defaultMapOptions(): MapOptions;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Defaults restored by "Reset Map Options". Keep in sync with the constructor defaults in each
|
|
4
|
-
* integration (monitors/EV display options, `enabled`, `clustered`) so a reset matches a fresh load.
|
|
5
|
-
*/
|
|
1
|
+
/** Defaults restored by "Reset Map Options"; a fresh load starts at them too. */
|
|
6
2
|
export const MAP_OPTION_DEFAULTS = {
|
|
7
3
|
monitorTypes: {
|
|
8
4
|
airnow: true,
|
|
@@ -11,10 +7,10 @@ export const MAP_OPTION_DEFAULTS = {
|
|
|
11
7
|
bam1022: true,
|
|
12
8
|
airgradient: true,
|
|
13
9
|
purpleair: true,
|
|
14
|
-
vozbox: true
|
|
15
|
-
inactive: false,
|
|
16
|
-
inside: false
|
|
10
|
+
vozbox: true
|
|
17
11
|
},
|
|
12
|
+
inactive: false,
|
|
13
|
+
inside: false,
|
|
18
14
|
clustered: true,
|
|
19
15
|
collocationSites: false,
|
|
20
16
|
fireAndSmoke: true,
|
|
@@ -22,26 +18,12 @@ export const MAP_OPTION_DEFAULTS = {
|
|
|
22
18
|
evLevels: { lvl2: true, lvl3: true },
|
|
23
19
|
wind: false
|
|
24
20
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const option = targets.integration.displayOptions[key];
|
|
34
|
-
if (option)
|
|
35
|
-
option.value = value;
|
|
36
|
-
}
|
|
37
|
-
targets.integration.clustered = MAP_OPTION_DEFAULTS.clustered;
|
|
38
|
-
targets.collocationSites.enabled = MAP_OPTION_DEFAULTS.collocationSites;
|
|
39
|
-
targets.hmsFire.enabled = MAP_OPTION_DEFAULTS.fireAndSmoke;
|
|
40
|
-
targets.hmsSmoke.enabled = MAP_OPTION_DEFAULTS.fireAndSmoke;
|
|
41
|
-
targets.evStations.enabled = MAP_OPTION_DEFAULTS.evStations;
|
|
42
|
-
targets.evStations.clustered = MAP_OPTION_DEFAULTS.clustered;
|
|
43
|
-
targets.evStations.displayOptions.lvl2.value = MAP_OPTION_DEFAULTS.evLevels.lvl2;
|
|
44
|
-
targets.evStations.displayOptions.lvl3.value = MAP_OPTION_DEFAULTS.evLevels.lvl3;
|
|
45
|
-
targets.wind.enabled = MAP_OPTION_DEFAULTS.wind;
|
|
46
|
-
targets.mapStyle.reset();
|
|
21
|
+
/** A fresh copy of the defaults, with monitors on. */
|
|
22
|
+
export function defaultMapOptions() {
|
|
23
|
+
return {
|
|
24
|
+
...MAP_OPTION_DEFAULTS,
|
|
25
|
+
monitorsOn: true,
|
|
26
|
+
monitorTypes: { ...MAP_OPTION_DEFAULTS.monitorTypes },
|
|
27
|
+
evLevels: { ...MAP_OPTION_DEFAULTS.evLevels }
|
|
28
|
+
};
|
|
47
29
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MonitorsPollutant } from "../monitors/types";
|
|
2
|
+
import { type MapOptions } from "./map-option-defaults";
|
|
3
|
+
export type { MapOptions } from "./map-option-defaults";
|
|
4
|
+
/**
|
|
5
|
+
* The toolbar's map options. Module-level, so they survive the layout remounting (as the 4.x
|
|
6
|
+
* integrations' state did); the layout turns them into map-sdk plugins.
|
|
7
|
+
*/
|
|
8
|
+
export declare const mapOptions: MapOptions;
|
|
9
|
+
/**
|
|
10
|
+
* "Reset Map Options": every option back to its default, monitors on, and the pollutant back to
|
|
11
|
+
* `defaultPollutant` (the server's default; null before the meta loads leaves it as it is).
|
|
12
|
+
*/
|
|
13
|
+
export declare function resetMapOptions(defaultPollutant: MonitorsPollutant | null): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { monitorsManager } from "../monitors/monitors.svelte.js";
|
|
2
|
+
import { defaultMapOptions, MAP_OPTION_DEFAULTS } from "./map-option-defaults";
|
|
3
|
+
/**
|
|
4
|
+
* The toolbar's map options. Module-level, so they survive the layout remounting (as the 4.x
|
|
5
|
+
* integrations' state did); the layout turns them into map-sdk plugins.
|
|
6
|
+
*/
|
|
7
|
+
export const mapOptions = $state(defaultMapOptions());
|
|
8
|
+
/**
|
|
9
|
+
* "Reset Map Options": every option back to its default, monitors on, and the pollutant back to
|
|
10
|
+
* `defaultPollutant` (the server's default; null before the meta loads leaves it as it is).
|
|
11
|
+
*/
|
|
12
|
+
export function resetMapOptions(defaultPollutant) {
|
|
13
|
+
if (defaultPollutant)
|
|
14
|
+
monitorsManager.setPollutant(defaultPollutant);
|
|
15
|
+
mapOptions.monitorsOn = true;
|
|
16
|
+
Object.assign(mapOptions.monitorTypes, MAP_OPTION_DEFAULTS.monitorTypes);
|
|
17
|
+
mapOptions.inactive = MAP_OPTION_DEFAULTS.inactive;
|
|
18
|
+
mapOptions.inside = MAP_OPTION_DEFAULTS.inside;
|
|
19
|
+
mapOptions.clustered = MAP_OPTION_DEFAULTS.clustered;
|
|
20
|
+
mapOptions.collocationSites = MAP_OPTION_DEFAULTS.collocationSites;
|
|
21
|
+
mapOptions.fireAndSmoke = MAP_OPTION_DEFAULTS.fireAndSmoke;
|
|
22
|
+
mapOptions.evStations = MAP_OPTION_DEFAULTS.evStations;
|
|
23
|
+
mapOptions.evLevels.lvl2 = MAP_OPTION_DEFAULTS.evLevels.lvl2;
|
|
24
|
+
mapOptions.evLevels.lvl3 = MAP_OPTION_DEFAULTS.evLevels.lvl3;
|
|
25
|
+
mapOptions.wind = MAP_OPTION_DEFAULTS.wind;
|
|
26
|
+
}
|
|
@@ -4,43 +4,31 @@
|
|
|
4
4
|
import CheckboxRow from "../rows/CheckboxRow.svelte";
|
|
5
5
|
import SubmenuRow from "../rows/SubmenuRow.svelte";
|
|
6
6
|
import MarkerIcon from "../rows/MarkerIcon.svelte";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { evStationsMapIntegration } from "../../ev-stations/ev-stations-map-integration.svelte";
|
|
10
|
-
|
|
11
|
-
const levels = $derived(evStationsMapIntegration.displayOptions);
|
|
7
|
+
import { mapOptions } from "../map-options.svelte.js";
|
|
8
|
+
import { ROW_ICONS } from "../row-icons";
|
|
12
9
|
</script>
|
|
13
10
|
|
|
14
11
|
<OptionsMenu id="layers" label="Layers">
|
|
15
12
|
{#snippet icon()}
|
|
16
13
|
<LayersIcon size={20} color="#708090" />
|
|
17
14
|
{/snippet}
|
|
18
|
-
<CheckboxRow
|
|
19
|
-
label="Fire & Smoke"
|
|
20
|
-
bind:checked={
|
|
21
|
-
() => hmsFireMapIntegration.enabled && hmsSmokeMapIntegration.enabled,
|
|
22
|
-
(value) => {
|
|
23
|
-
hmsFireMapIntegration.enabled = value;
|
|
24
|
-
hmsSmokeMapIntegration.enabled = value;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
>
|
|
15
|
+
<CheckboxRow label="Fire & Smoke" bind:checked={mapOptions.fireAndSmoke}>
|
|
28
16
|
{#snippet icon()}
|
|
29
17
|
<FlameIcon size={18} color="#ff4500" />
|
|
30
18
|
{/snippet}
|
|
31
19
|
</CheckboxRow>
|
|
32
|
-
<SubmenuRow label="EV Chargers" bind:checked={
|
|
20
|
+
<SubmenuRow label="EV Chargers" bind:checked={mapOptions.evStations}>
|
|
33
21
|
{#snippet icon()}
|
|
34
22
|
<EvChargerIcon size={18} color="#708090" />
|
|
35
23
|
{/snippet}
|
|
36
|
-
<CheckboxRow label="Level 2" bind:checked={
|
|
24
|
+
<CheckboxRow label="Level 2" bind:checked={mapOptions.evLevels.lvl2}>
|
|
37
25
|
{#snippet icon()}
|
|
38
|
-
<MarkerIcon
|
|
26
|
+
<MarkerIcon svg={ROW_ICONS.evLevel2} class="w-5" />
|
|
39
27
|
{/snippet}
|
|
40
28
|
</CheckboxRow>
|
|
41
|
-
<CheckboxRow label="Level 3" bind:checked={
|
|
29
|
+
<CheckboxRow label="Level 3" bind:checked={mapOptions.evLevels.lvl3}>
|
|
42
30
|
{#snippet icon()}
|
|
43
|
-
<MarkerIcon
|
|
31
|
+
<MarkerIcon svg={ROW_ICONS.evLevel3} class="w-5" />
|
|
44
32
|
{/snippet}
|
|
45
33
|
</CheckboxRow>
|
|
46
34
|
</SubmenuRow>
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const LayersMenu: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type LayersMenu = InstanceType<typeof LayersMenu>;
|
|
3
18
|
export default LayersMenu;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import CheckboxRow from "../rows/CheckboxRow.svelte";
|
|
5
5
|
import GroupRow from "../rows/GroupRow.svelte";
|
|
6
6
|
import MarkerIcon from "../rows/MarkerIcon.svelte";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { mapOptions } from "../map-options.svelte.js";
|
|
8
|
+
import { ROW_ICONS } from "../row-icons";
|
|
9
|
+
import { monitorsManager } from "../../monitors/monitors.svelte.js";
|
|
10
10
|
import {
|
|
11
11
|
LOW_COST_TYPES,
|
|
12
12
|
REFERENCE_GRADE_TYPES,
|
|
@@ -14,52 +14,68 @@
|
|
|
14
14
|
type MonitorGroupType
|
|
15
15
|
} from "../../monitors/monitor-groups";
|
|
16
16
|
|
|
17
|
+
const TYPE_LABELS: Record<MonitorGroupType, string> = {
|
|
18
|
+
airnow: "AirNow",
|
|
19
|
+
aqlite: "AQLite",
|
|
20
|
+
aqview: "AQview",
|
|
21
|
+
bam1022: "SJVAir",
|
|
22
|
+
airgradient: "AirGradient",
|
|
23
|
+
purpleair: "PurpleAir",
|
|
24
|
+
vozbox: "VOZbox"
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** A type's filter as the `{ value }` option GroupRow binds to. */
|
|
28
|
+
function typeOption(type: MonitorGroupType) {
|
|
29
|
+
return {
|
|
30
|
+
get value() {
|
|
31
|
+
return mapOptions.monitorTypes[type] ?? false;
|
|
32
|
+
},
|
|
33
|
+
set value(value: boolean) {
|
|
34
|
+
mapOptions.monitorTypes[type] = value;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
17
39
|
// Rows for types that don't report the current pollutant are hidden (meta-driven).
|
|
18
40
|
function visibleRows(types: ReadonlyArray<MonitorGroupType>) {
|
|
19
|
-
const displayOptions = monitorsMapIntegration.displayOptions;
|
|
20
41
|
return types
|
|
21
42
|
.filter((type) =>
|
|
22
43
|
typeSupportsPollutant(monitorsManager.meta, type, monitorsManager.pollutant)
|
|
23
44
|
)
|
|
24
|
-
.map((type) => ({
|
|
25
|
-
key: type,
|
|
26
|
-
label: displayOptions[type].label,
|
|
27
|
-
option: displayOptions[type]
|
|
28
|
-
}));
|
|
45
|
+
.map((type) => ({ key: type, label: TYPE_LABELS[type], option: typeOption(type) }));
|
|
29
46
|
}
|
|
30
47
|
|
|
31
48
|
const referenceGrade = $derived(visibleRows(REFERENCE_GRADE_TYPES));
|
|
32
49
|
const lowCost = $derived(visibleRows(LOW_COST_TYPES));
|
|
33
|
-
const icons = monitorsMapIntegration.icons;
|
|
34
50
|
</script>
|
|
35
51
|
|
|
36
|
-
<OptionsMenu id="monitors" label="Monitors" disabled={!
|
|
52
|
+
<OptionsMenu id="monitors" label="Monitors" disabled={!mapOptions.monitorsOn}>
|
|
37
53
|
{#snippet icon()}
|
|
38
54
|
<RadioTowerIcon size={20} color="#4682b4" />
|
|
39
55
|
{/snippet}
|
|
40
56
|
<GroupRow label="Reference-grade" options={referenceGrade}>
|
|
41
57
|
{#snippet icon()}
|
|
42
|
-
<MarkerIcon
|
|
58
|
+
<MarkerIcon svg={ROW_ICONS.referenceGrade} />
|
|
43
59
|
{/snippet}
|
|
44
60
|
</GroupRow>
|
|
45
61
|
<GroupRow label="Low-cost sensors" options={lowCost}>
|
|
46
62
|
{#snippet icon()}
|
|
47
|
-
<MarkerIcon
|
|
63
|
+
<MarkerIcon svg={ROW_ICONS.lowCost} />
|
|
48
64
|
{/snippet}
|
|
49
65
|
</GroupRow>
|
|
50
66
|
<hr class="my-1 border-gray-200" />
|
|
51
|
-
<CheckboxRow label="Inactive" bind:checked={
|
|
67
|
+
<CheckboxRow label="Inactive" bind:checked={mapOptions.inactive}>
|
|
52
68
|
{#snippet icon()}
|
|
53
|
-
<MarkerIcon
|
|
69
|
+
<MarkerIcon svg={ROW_ICONS.inactive} />
|
|
54
70
|
{/snippet}
|
|
55
71
|
</CheckboxRow>
|
|
56
|
-
<CheckboxRow label="Inside" bind:checked={
|
|
72
|
+
<CheckboxRow label="Inside" bind:checked={mapOptions.inside}>
|
|
57
73
|
{#snippet icon()}
|
|
58
|
-
<MarkerIcon
|
|
74
|
+
<MarkerIcon svg={ROW_ICONS.inside} />
|
|
59
75
|
{/snippet}
|
|
60
76
|
</CheckboxRow>
|
|
61
77
|
{#if monitorsManager.pollutant === "pm25"}
|
|
62
|
-
<CheckboxRow label="Collocation Sites" bind:checked={
|
|
78
|
+
<CheckboxRow label="Collocation Sites" bind:checked={mapOptions.collocationSites}>
|
|
63
79
|
{#snippet icon()}
|
|
64
80
|
<CrosshairIcon size={16} color="#4A5FC6" />
|
|
65
81
|
{/snippet}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { SquareStackIcon, WindIcon } from "@lucide/svelte";
|
|
3
3
|
import OptionsMenu from "../OptionsMenu.svelte";
|
|
4
4
|
import CheckboxRow from "../rows/CheckboxRow.svelte";
|
|
5
|
-
import {
|
|
5
|
+
import { mapOptions } from "../map-options.svelte.js";
|
|
6
6
|
</script>
|
|
7
7
|
|
|
8
8
|
<!-- Independent checkboxes: several overlays may be on at once. -->
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
{#snippet icon()}
|
|
11
11
|
<SquareStackIcon size={20} color="#708090" />
|
|
12
12
|
{/snippet}
|
|
13
|
-
<CheckboxRow label="Wind" bind:checked={
|
|
13
|
+
<CheckboxRow label="Wind" bind:checked={mapOptions.wind}>
|
|
14
14
|
{#snippet icon()}
|
|
15
15
|
<WindIcon size={18} color="#1e90ff" />
|
|
16
16
|
{/snippet}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
currentSelection,
|
|
10
10
|
type PollutantSelection
|
|
11
11
|
} from "../pollutant-param";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { mapOptions } from "../map-options.svelte.js";
|
|
13
|
+
import { monitorsManager } from "../../monitors/monitors.svelte.js";
|
|
14
14
|
import pm25Icon from "../../assets/icons/pm25/pm25-02-particle-field.svg";
|
|
15
15
|
import ozoneIcon from "../../assets/icons/ozone/ozone-08-sunrise-haze.svg";
|
|
16
16
|
|
|
@@ -44,16 +44,11 @@
|
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
const menus = useOptionsMenus();
|
|
47
|
-
const selection = $derived(
|
|
48
|
-
currentSelection(monitorsManager.pollutant, monitorsMapIntegration.enabled)
|
|
49
|
-
);
|
|
47
|
+
const selection = $derived(currentSelection(monitorsManager.pollutant, mapOptions.monitorsOn));
|
|
50
48
|
const selected = $derived(options.find((o) => o.value === selection) ?? options[0]);
|
|
51
49
|
|
|
52
50
|
function select(value: PollutantSelection) {
|
|
53
|
-
applyPollutantSelection(value, {
|
|
54
|
-
manager: monitorsManager,
|
|
55
|
-
integration: monitorsMapIntegration
|
|
56
|
-
});
|
|
51
|
+
applyPollutantSelection(value, { manager: monitorsManager, options: mapOptions });
|
|
57
52
|
// Toolbar dropdown closes on pick; the panel section stays open.
|
|
58
53
|
if (isWideLayout()) menus.close("pollutant");
|
|
59
54
|
}
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { MapContext } from "@sjvair/map-sdk";
|
|
2
3
|
import { ContrastIcon, MapIcon, NetworkIcon, RotateCcwIcon, SettingsIcon } from "@lucide/svelte";
|
|
3
4
|
import OptionsMenu from "../OptionsMenu.svelte";
|
|
4
5
|
import CheckboxRow from "../rows/CheckboxRow.svelte";
|
|
5
6
|
import RadioRow from "../rows/RadioRow.svelte";
|
|
6
|
-
import { resetMapOptions } from "../
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { mapOptions, resetMapOptions } from "../map-options.svelte.js";
|
|
8
|
+
import { asPollutant } from "../pollutant-param";
|
|
9
|
+
import { basemapChoices, choiceForId, defaultBasemapId, switchBasemap } from "../../map/basemaps";
|
|
10
|
+
import { monitorsManager } from "../../monitors/monitors.svelte.js";
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
map: MapContext;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { map }: Props = $props();
|
|
17
|
+
|
|
18
|
+
const choices = basemapChoices();
|
|
19
|
+
// Reads map-sdk's selection, so a basemap that fails to load shows as reverted.
|
|
20
|
+
const current = $derived(choiceForId(map.basemap.current));
|
|
21
|
+
|
|
22
|
+
function reset() {
|
|
23
|
+
resetMapOptions(asPollutant(monitorsManager.meta?.default_pollutant));
|
|
24
|
+
map.basemap.select(defaultBasemapId());
|
|
25
|
+
}
|
|
11
26
|
</script>
|
|
12
27
|
|
|
13
28
|
<OptionsMenu id="settings" label="Settings" iconOnly alignRight>
|
|
14
29
|
{#snippet icon()}
|
|
15
30
|
<SettingsIcon size={20} color="#696969" />
|
|
16
31
|
{/snippet}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
bind:checked={
|
|
20
|
-
() => monitorsMapIntegration.clustered && evStationsMapIntegration.clustered,
|
|
21
|
-
(value) => {
|
|
22
|
-
monitorsMapIntegration.clustered = value;
|
|
23
|
-
evStationsMapIntegration.clustered = value;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
>
|
|
32
|
+
<!-- Monitors' and EV chargers' clustering together. -->
|
|
33
|
+
<CheckboxRow label="Marker Clusters" bind:checked={mapOptions.clustered}>
|
|
27
34
|
{#snippet icon()}
|
|
28
35
|
<NetworkIcon size={18} color="#1e90ff" />
|
|
29
36
|
{/snippet}
|
|
@@ -37,12 +44,12 @@
|
|
|
37
44
|
<select
|
|
38
45
|
id="monitor-map-basemap"
|
|
39
46
|
class="w-full rounded-md border border-gray-300 bg-white p-1.5"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
47
|
+
value={current?.name}
|
|
48
|
+
onchange={(event) =>
|
|
49
|
+
map.basemap.select(switchBasemap(map.basemap.current, event.currentTarget.value))}
|
|
43
50
|
>
|
|
44
|
-
{#each
|
|
45
|
-
<option value={
|
|
51
|
+
{#each choices as choice (choice.name)}
|
|
52
|
+
<option value={choice.name}>{choice.name}</option>
|
|
46
53
|
{/each}
|
|
47
54
|
</select>
|
|
48
55
|
</div>
|
|
@@ -51,12 +58,12 @@
|
|
|
51
58
|
<ContrastIcon size={18} color="#708090" />
|
|
52
59
|
Theme
|
|
53
60
|
</p>
|
|
54
|
-
{#each
|
|
61
|
+
{#each current?.variants ?? [] as variant (variant.id)}
|
|
55
62
|
<RadioRow
|
|
56
63
|
name="monitor-map-theme"
|
|
57
|
-
label={variant.
|
|
58
|
-
checked={variant ===
|
|
59
|
-
onselect={() =>
|
|
64
|
+
label={variant.name}
|
|
65
|
+
checked={variant.id === map.basemap.current}
|
|
66
|
+
onselect={() => map.basemap.select(variant.id)}
|
|
60
67
|
/>
|
|
61
68
|
{/each}
|
|
62
69
|
<hr class="my-1 border-gray-200" />
|
|
@@ -64,7 +71,7 @@
|
|
|
64
71
|
<button
|
|
65
72
|
type="button"
|
|
66
73
|
class="flex w-full items-center justify-center gap-2 rounded-md border border-gray-300 px-3 py-1.5 text-sm hover:bg-gray-100"
|
|
67
|
-
onclick={
|
|
74
|
+
onclick={reset}
|
|
68
75
|
>
|
|
69
76
|
<RotateCcwIcon size={16} />
|
|
70
77
|
Reset Map Options
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
1
|
+
import type { MapContext } from "@sjvair/map-sdk";
|
|
2
|
+
interface Props {
|
|
3
|
+
map: MapContext;
|
|
13
4
|
}
|
|
14
|
-
declare const SettingsMenu:
|
|
15
|
-
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type SettingsMenu = InstanceType<typeof SettingsMenu>;
|
|
5
|
+
declare const SettingsMenu: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type SettingsMenu = ReturnType<typeof SettingsMenu>;
|
|
18
7
|
export default SettingsMenu;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { MapOptions } from "./map-option-defaults";
|
|
2
|
+
/** The map's plugins, bottom to top (4.x's layer order). */
|
|
3
|
+
export declare const DRAW_ORDER: readonly ["wind", "hms-smoke", "hms-fire", "collocation-sites", "monitors", "ev-l2", "ev-l3"];
|
|
4
|
+
export type PluginKey = (typeof DRAW_ORDER)[number];
|
|
5
|
+
/** The first of `present` that draws above `key`: the plugin to add `key` before. */
|
|
6
|
+
export declare function beforeId(key: PluginKey, present: ReadonlySet<string>): string | undefined;
|
|
7
|
+
/** The plugins `options` put on the map while the monitors show `pollutant`. */
|
|
8
|
+
export declare function wantedPlugins(options: MapOptions, pollutant: string | null): Set<PluginKey>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** The map's plugins, bottom to top (4.x's layer order). */
|
|
2
|
+
export const DRAW_ORDER = [
|
|
3
|
+
"wind",
|
|
4
|
+
"hms-smoke",
|
|
5
|
+
"hms-fire",
|
|
6
|
+
"collocation-sites",
|
|
7
|
+
"monitors",
|
|
8
|
+
"ev-l2",
|
|
9
|
+
"ev-l3"
|
|
10
|
+
];
|
|
11
|
+
/** The first of `present` that draws above `key`: the plugin to add `key` before. */
|
|
12
|
+
export function beforeId(key, present) {
|
|
13
|
+
return DRAW_ORDER.slice(DRAW_ORDER.indexOf(key) + 1).find((above) => present.has(above));
|
|
14
|
+
}
|
|
15
|
+
/** The plugins `options` put on the map while the monitors show `pollutant`. */
|
|
16
|
+
export function wantedPlugins(options, pollutant) {
|
|
17
|
+
const wanted = new Set();
|
|
18
|
+
if (options.wind)
|
|
19
|
+
wanted.add("wind");
|
|
20
|
+
if (options.fireAndSmoke) {
|
|
21
|
+
wanted.add("hms-smoke");
|
|
22
|
+
wanted.add("hms-fire");
|
|
23
|
+
}
|
|
24
|
+
if (options.monitorsOn) {
|
|
25
|
+
if (options.collocationSites && pollutant === "pm25")
|
|
26
|
+
wanted.add("collocation-sites");
|
|
27
|
+
wanted.add("monitors");
|
|
28
|
+
}
|
|
29
|
+
if (options.evStations) {
|
|
30
|
+
if (options.evLevels.lvl2)
|
|
31
|
+
wanted.add("ev-l2");
|
|
32
|
+
if (options.evLevels.lvl3)
|
|
33
|
+
wanted.add("ev-l3");
|
|
34
|
+
}
|
|
35
|
+
return wanted;
|
|
36
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { MonitorsPollutant } from "../monitors/types";
|
|
2
2
|
/**
|
|
3
3
|
* What the Pollutant menu shows. "none" is not a monitorsManager.pollutant value — it means
|
|
4
|
-
* the monitors
|
|
4
|
+
* the monitors plugin is off while the manager keeps its last real pollutant.
|
|
5
5
|
*/
|
|
6
6
|
export type PollutantSelection = MonitorsPollutant | "none";
|
|
7
7
|
export interface PollutantTargets {
|
|
8
8
|
manager: {
|
|
9
|
-
pollutant: MonitorsPollutant
|
|
9
|
+
setPollutant(pollutant: MonitorsPollutant): void;
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
options: {
|
|
12
|
+
monitorsOn: boolean;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
export declare function parsePollutantParam(value: unknown): PollutantSelection | null;
|
|
16
|
-
|
|
16
|
+
/** A pollutant the map can show, or null. */
|
|
17
|
+
export declare function asPollutant(value: unknown): MonitorsPollutant | null;
|
|
18
|
+
export declare function currentSelection(pollutant: string | null, monitorsOn: boolean): PollutantSelection | null;
|
|
17
19
|
export declare function applyPollutantSelection(selection: PollutantSelection, targets: PollutantTargets): void;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
export function parsePollutantParam(value) {
|
|
2
2
|
return value === "pm25" || value === "o3" || value === "none" ? value : null;
|
|
3
3
|
}
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/** A pollutant the map can show, or null. */
|
|
5
|
+
export function asPollutant(value) {
|
|
6
|
+
return value === "pm25" || value === "o3" ? value : null;
|
|
7
|
+
}
|
|
8
|
+
export function currentSelection(pollutant, monitorsOn) {
|
|
9
|
+
return monitorsOn ? asPollutant(pollutant) : "none";
|
|
6
10
|
}
|
|
7
11
|
export function applyPollutantSelection(selection, targets) {
|
|
8
12
|
if (selection === "none") {
|
|
9
|
-
targets.
|
|
13
|
+
targets.options.monitorsOn = false;
|
|
10
14
|
return;
|
|
11
15
|
}
|
|
12
|
-
targets.manager.
|
|
13
|
-
targets.
|
|
16
|
+
targets.manager.setPollutant(selection);
|
|
17
|
+
targets.options.monitorsOn = true;
|
|
14
18
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { circle, triangle } from "@sjvair/map-sdk";
|
|
2
|
+
import { EV_STATION_LEVELS, evStationIcon } from "../ev-stations/ev-station-icons";
|
|
3
|
+
// The menu rows' marker icons (SVG markup), drawn with the map's own shapes as in 4.x.
|
|
4
|
+
const DISPLAY_COLOR = "#48c78e";
|
|
5
|
+
const INACTIVE_COLOR = "#969696";
|
|
6
|
+
const INSIDE_OUTLINE = "#000000";
|
|
7
|
+
const BORDER_WIDTH = 2;
|
|
8
|
+
export const ROW_ICONS = {
|
|
9
|
+
referenceGrade: triangle(DISPLAY_COLOR, BORDER_WIDTH),
|
|
10
|
+
lowCost: circle(DISPLAY_COLOR, BORDER_WIDTH),
|
|
11
|
+
inactive: circle(INACTIVE_COLOR, BORDER_WIDTH),
|
|
12
|
+
inside: circle(DISPLAY_COLOR, BORDER_WIDTH, INSIDE_OUTLINE),
|
|
13
|
+
evLevel2: evStationIcon(EV_STATION_LEVELS.lvl2.bg, EV_STATION_LEVELS.lvl2.border),
|
|
14
|
+
evLevel3: evStationIcon(EV_STATION_LEVELS.lvl3.bg, EV_STATION_LEVELS.lvl3.border)
|
|
15
|
+
};
|