@milemaker/milemaker-js 2.0.0-alpha.3 → 2.0.0-alpha.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/actions/layer/trafficLayerActions.factory.d.ts +4 -1
- package/dist/actions/marker/createClusterMarkersAction.factory.d.ts +2 -0
- package/dist/actions/marker/types/markerActions.types.d.ts +133 -3
- package/dist/actions/popup/types/popupActions.types.d.ts +1 -1
- package/dist/actions/types/actions.types.d.ts +2 -1
- package/dist/actions/types/index.d.ts +1 -0
- package/dist/actions/weather/index.d.ts +46 -0
- package/dist/actions/weather/types/index.d.ts +1 -0
- package/dist/actions/weather/types/weather.types.d.ts +115 -0
- package/dist/actions/weather/weatherAlertsActions.factory.d.ts +6 -0
- package/dist/apis/aerisWeather/aerisWeather.api.d.ts +75 -0
- package/dist/apis/aerisWeather/aerisWeather.schemas.d.ts +454 -0
- package/dist/apis/aerisWeather/aerisWeather.selectors.d.ts +68 -0
- package/dist/apis/aerisWeather/aerisWeather.slice.d.ts +18 -0
- package/dist/apis/aerisWeather/aerisWeather.thunks.d.ts +12 -0
- package/dist/apis/aerisWeather/aerisWeather.types.d.ts +142 -0
- package/dist/apis/types.d.ts +1 -0
- package/dist/components/WeatherAlertIcon/WeatherAlertIcon.d.ts +3 -0
- package/dist/components/WeatherAlertIcon/WeatherAlertIcon.types.d.ts +17 -0
- package/dist/components/WeatherAlertIcon/WeatherAlertIconPopup.d.ts +24 -0
- package/dist/components/WeatherAlertIcon/index.d.ts +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/controls/createOverlayLayerControl.factory.d.ts +2 -2
- package/dist/controls/createWeatherLayerControl.factory.d.ts +2 -2
- package/dist/controls/types/controls.types.d.ts +50 -5
- package/dist/controls/utils/index.d.ts +0 -1
- package/dist/controls/utils/weatherLayers.constants.d.ts +1 -2
- package/dist/controls/utils/weatherLayers.helpers.d.ts +1 -1
- package/dist/controls/utils/weatherLayers.rendering.d.ts +1 -1
- package/dist/helpers/parseLonLatLikeToCoordinates.helper.d.ts +2 -1
- package/dist/helpers/runAsyncThread.d.ts +30 -0
- package/dist/index.cjs +343 -262
- package/dist/index.esm-8a133e09.js +3080 -0
- package/dist/index.esm-e8122a0a.cjs +5 -0
- package/dist/index.js +37004 -28019
- package/dist/types/common.types.d.ts +7 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/common.schemas.d.ts +9 -0
- package/dist/utils/constants.d.ts +12 -1
- package/dist/utils/helpers/compareLonLatLikesByDistanceKm.helper.d.ts +2 -0
- package/dist/utils/helpers/filterLonLatLikesByDistanceKm.helper.d.ts +6 -0
- package/dist/utils/helpers/getConvertedLength.helper.d.ts +12 -0
- package/dist/utils/helpers/getKmDistanceBetweenLonLatLike.helper.d.ts +8 -0
- package/dist/utils/helpers/indexDBFactory.helper.d.ts +14 -0
- package/dist/utils/helpers/normalizeColor.helper.d.ts +17 -0
- package/dist/utils/helpers/roundToDecimals.helper.d.ts +4 -0
- package/dist/utils/helpers/setUrlParameter.helper.d.ts +5 -0
- package/dist/utils/helpers.d.ts +4 -0
- package/dist/utils/singletons/wasmFloat.polyfill.d.ts +9 -0
- package/dist/utils/singletons/wasmMath.singleton.d.ts +8 -0
- package/dist/utils/types.d.ts +22 -0
- package/dist/utils/version.d.ts +1 -1
- package/package.json +5 -2
- package/dist/controls/utils/weatherLayers.types.d.ts +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare enum WeatherAlertIconType {
|
|
2
|
+
CLOUD = "cloud",
|
|
3
|
+
CYCLONE = "cyclone",
|
|
4
|
+
FLOOD = "flood",
|
|
5
|
+
LANDSLIDE = "landslide",
|
|
6
|
+
SNOW = "snow",
|
|
7
|
+
STORM = "storm",
|
|
8
|
+
THUNDER = "thunder",
|
|
9
|
+
TORNADO = "tornado",
|
|
10
|
+
TSUNAMI = "tsunami",
|
|
11
|
+
WIND = "wind"
|
|
12
|
+
}
|
|
13
|
+
export type WeatherAlertIconOptions = {
|
|
14
|
+
category?: string;
|
|
15
|
+
strokeColor?: string;
|
|
16
|
+
iconColor?: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AerisWeatherAlert } from "../../apis/aerisWeather/aerisWeather.types";
|
|
2
|
+
import "./WeatherAlertIconPopup.scss";
|
|
3
|
+
export type WeatherAlertIconPopupOptions = {
|
|
4
|
+
alerts: AerisWeatherAlert[];
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Creates a popup element for displaying weather alerts
|
|
8
|
+
*
|
|
9
|
+
* @param options - Options for creating the popup
|
|
10
|
+
* @returns HTMLElement containing the formatted alert names
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const popup = createWeatherAlertIconPopup({
|
|
15
|
+
* alerts: [
|
|
16
|
+
* { details: { name: "WINTER STORM WARNING" } },
|
|
17
|
+
* { details: { name: "WINTER STORM WARNING" } },
|
|
18
|
+
* { details: { name: "SNOW ADVISORY" } }
|
|
19
|
+
* ]
|
|
20
|
+
* });
|
|
21
|
+
* // Returns popup showing: "Winter Storm Warning" and "Snow Advisory"
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const createWeatherAlertIconPopup: (options: WeatherAlertIconPopupOptions) => HTMLElement;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./styles/overlayLayerControl.scss";
|
|
2
|
-
import { ControlCreatorFactory, OverlayLayerControl } from "./types";
|
|
3
|
-
export declare const createOverlayLayerControlFactory: ControlCreatorFactory<OverlayLayerControl>;
|
|
2
|
+
import { ControlCreatorFactory, OverlayLayerControl, OverlayLayerControlCreatorOptions } from "./types";
|
|
3
|
+
export declare const createOverlayLayerControlFactory: ControlCreatorFactory<OverlayLayerControl, OverlayLayerControlCreatorOptions>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./styles/weatherLayerControl.scss";
|
|
2
|
-
import { ControlCreatorFactory, WeatherLayerControl } from "./types";
|
|
3
|
-
export declare const createWeatherLayerControlFactory: ControlCreatorFactory<WeatherLayerControl>;
|
|
2
|
+
import { ControlCreatorFactory, WeatherLayerControl, WeatherLayerControlCreatorOptions } from "./types";
|
|
3
|
+
export declare const createWeatherLayerControlFactory: ControlCreatorFactory<WeatherLayerControl, WeatherLayerControlCreatorOptions>;
|
|
@@ -43,13 +43,54 @@ export type ControlCreatorFactory<Control extends BaseMapControl, AdditionalOpti
|
|
|
43
43
|
* @group Map Controls
|
|
44
44
|
* @interface
|
|
45
45
|
*/
|
|
46
|
-
type BaseControlCreatorOptions = {
|
|
46
|
+
export type BaseControlCreatorOptions = {
|
|
47
47
|
/**
|
|
48
48
|
* Control position on a screen
|
|
49
49
|
* @default "bottom-right"
|
|
50
50
|
*/
|
|
51
51
|
position?: ControlPosition;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Weather layer type
|
|
55
|
+
*
|
|
56
|
+
* @group Map Controls
|
|
57
|
+
* @type
|
|
58
|
+
*/
|
|
59
|
+
export type WeatherLayerType = "radar" | "alerts" | "satellite" | "roadConditions" | "temperatures" | "windSpeeds";
|
|
60
|
+
/**
|
|
61
|
+
* Weather layer control creator options
|
|
62
|
+
* @group Map Controls
|
|
63
|
+
* @interface
|
|
64
|
+
*/
|
|
65
|
+
export type WeatherLayerControlCreatorOptions = BaseControlCreatorOptions & {
|
|
66
|
+
/**
|
|
67
|
+
* Callback triggered when a weather layer is shown
|
|
68
|
+
* @param layerName - The name of the weather layer that was shown
|
|
69
|
+
*/
|
|
70
|
+
onShow?: (layerName: WeatherLayerType) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Callback triggered when a weather layer is hidden
|
|
73
|
+
* @param layerName - The name of the weather layer that was hidden
|
|
74
|
+
*/
|
|
75
|
+
onHide?: (layerName: WeatherLayerType) => void;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Overlay layer control creator options
|
|
79
|
+
* @group Map Controls
|
|
80
|
+
* @interface
|
|
81
|
+
*/
|
|
82
|
+
export type OverlayLayerControlCreatorOptions = BaseControlCreatorOptions & {
|
|
83
|
+
/**
|
|
84
|
+
* Callback triggered when an overlay layer is shown
|
|
85
|
+
* @param layerName - The name of the overlay layer that was shown
|
|
86
|
+
*/
|
|
87
|
+
onShow?: (layerName: OverlayLayerType) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Callback triggered when an overlay layer is hidden
|
|
90
|
+
* @param layerName - The name of the overlay layer that was hidden
|
|
91
|
+
*/
|
|
92
|
+
onHide?: (layerName: OverlayLayerType) => void;
|
|
93
|
+
};
|
|
53
94
|
/**
|
|
54
95
|
* Attribution control
|
|
55
96
|
* @group Map Controls
|
|
@@ -134,14 +175,12 @@ export type MapControlCreators = {
|
|
|
134
175
|
* Creates and returns an overlay layer control instance.
|
|
135
176
|
* @function
|
|
136
177
|
*/
|
|
137
|
-
createOverlayLayerControl: (options?:
|
|
138
|
-
accessToken: string;
|
|
139
|
-
}) => OverlayLayerControl;
|
|
178
|
+
createOverlayLayerControl: (options?: OverlayLayerControlCreatorOptions) => OverlayLayerControl;
|
|
140
179
|
/**
|
|
141
180
|
* Creates and returns a weather layer control instance.
|
|
142
181
|
* @function
|
|
143
182
|
*/
|
|
144
|
-
createWeatherLayerControl: (options?:
|
|
183
|
+
createWeatherLayerControl: (options?: WeatherLayerControlCreatorOptions) => WeatherLayerControl;
|
|
145
184
|
/**
|
|
146
185
|
* Creates and returns a zoom control instance.
|
|
147
186
|
* @function
|
|
@@ -153,4 +192,10 @@ export type MapControlCreators = {
|
|
|
153
192
|
*/
|
|
154
193
|
createCurrentPositionControl: (options?: BaseControlCreatorOptions) => CurrentPositionControl;
|
|
155
194
|
};
|
|
195
|
+
/**
|
|
196
|
+
* Overlay layer type
|
|
197
|
+
* @group Map Controls
|
|
198
|
+
* @typeParam {WeatherLayerType} WeatherLayerType - Weather layer type
|
|
199
|
+
*/
|
|
200
|
+
export type OverlayLayerType = WeatherLayerType | "traffic" | "truck" | null;
|
|
156
201
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { WeatherLayer } from "../../types";
|
|
2
|
-
import { WeatherLayerType } from "./weatherLayers.types";
|
|
1
|
+
import { WeatherLayer, WeatherLayerType } from "../../types";
|
|
3
2
|
export declare const WEATHER_LAYER_MAP: Record<WeatherLayerType, WeatherLayer | WeatherLayer[]>;
|
|
4
3
|
export declare const WEATHER_LAYER_LABELS: Record<WeatherLayerType, string>;
|
|
5
4
|
export declare const WEATHER_LAYER_OPTIONS: WeatherLayerType[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WeatherLayerActions } from "../../actions/layer/types";
|
|
2
|
-
import { WeatherLayerType } from "
|
|
2
|
+
import { WeatherLayerType } from "../../types";
|
|
3
3
|
export declare const getSelectedWeatherLayer: (weatherLayerActions: WeatherLayerActions) => WeatherLayerType | null;
|
|
4
4
|
export declare const showWeatherLayer: (weatherLayerActions: WeatherLayerActions, layerType: WeatherLayerType) => void;
|
|
5
5
|
export declare const hideWeatherLayer: (weatherLayerActions: WeatherLayerActions, layerType: WeatherLayerType) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WeatherLayerType } from "
|
|
1
|
+
import { WeatherLayerType } from "../types";
|
|
2
2
|
export declare const renderWeatherLayerMenuItems: (selectedLayer: WeatherLayerType | null, radioGroupName: string) => string;
|
|
@@ -3,5 +3,6 @@ import { Coordinates, LonLatLike } from "../types";
|
|
|
3
3
|
* Parse a {@link LonLatLike} to {@link Coordinates}
|
|
4
4
|
* @group Helpers
|
|
5
5
|
* @param lonLatLike - {@link LonLatLike} object to be parsed
|
|
6
|
+
* @param precision - Optional number of decimal places to round the coordinates to
|
|
6
7
|
*/
|
|
7
|
-
export declare const parseLonLatLikeToCoordinates: (lonLatLike: LonLatLike) => Coordinates;
|
|
8
|
+
export declare const parseLonLatLikeToCoordinates: (lonLatLike: LonLatLike, precision?: number) => Coordinates;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FunctionType, MaybePromise } from "../utils/types";
|
|
2
|
+
/**
|
|
3
|
+
* Runs an asynchronous callback in a separate thread using the EasyWebWorker class.
|
|
4
|
+
*
|
|
5
|
+
* Executes an asynchronous callback function in a separate thread using a web worker.
|
|
6
|
+
* Basically, it is JS multithreading handled with Promise and WebWorker for heavy calculations.
|
|
7
|
+
* Run given callback and arguments in separate thread.
|
|
8
|
+
* To pass primitive data, use the first argument which will be passed as callback arguments
|
|
9
|
+
* Worker automatically closes and removes itself on finally
|
|
10
|
+
*
|
|
11
|
+
* @IMPORTANT Callback does not have access to outer scope, because will be running in separate process
|
|
12
|
+
*
|
|
13
|
+
* @async
|
|
14
|
+
* @template DataType - The type of the input data for the asyncCallback.
|
|
15
|
+
* @template ReturnType - The type of the output data from the asyncCallback.
|
|
16
|
+
*
|
|
17
|
+
* @param {DataType} asyncCallbackData - The input data for the asyncCallback.
|
|
18
|
+
* @param {function(data: DataType): MaybePromise<ReturnType>} asyncCallback - The asynchronous callback function that takes the input data as a parameter and returns a value of the specified ReturnType.
|
|
19
|
+
* @param {Record<string, FunctionType>} declareHelpers Helper functions which will be declared in web worker callback scope
|
|
20
|
+
*
|
|
21
|
+
* !NOTE!
|
|
22
|
+
* When passing helpers using declareHelpers be sure to pass the correct name of helper like this
|
|
23
|
+
* {
|
|
24
|
+
* [someHelper.name]: someHelper
|
|
25
|
+
* }
|
|
26
|
+
* Because the naming will be changed in production build
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise<ReturnType>} A promise that resolves with the value returned by the asyncCallback function.
|
|
29
|
+
*/
|
|
30
|
+
export declare const runAsyncThread: <Return, Data extends Record<string, unknown>, Helpers extends { [key in keyof Helpers]: FunctionType<Parameters<Helpers[key]>, ReturnType<Helpers[key]>>; }>(asyncCallbackData: Data, asyncCallback: (data: Data) => MaybePromise<Return>, declareHelpers?: Helpers | undefined) => Promise<Return>;
|