@milemaker/milemaker-js 2.0.0-alpha.3 → 2.0.0-alpha.7

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.
Files changed (78) hide show
  1. package/dist/actions/layer/trafficLayerActions.factory.d.ts +4 -1
  2. package/dist/actions/marker/createClusterMarkersAction.factory.d.ts +5 -0
  3. package/dist/actions/marker/index.d.ts +4 -1
  4. package/dist/actions/marker/types/markerActions.types.d.ts +133 -3
  5. package/dist/actions/popup/types/popupActions.types.d.ts +1 -1
  6. package/dist/actions/types/actions.types.d.ts +2 -1
  7. package/dist/actions/types/index.d.ts +1 -0
  8. package/dist/actions/weather/index.d.ts +46 -0
  9. package/dist/actions/weather/types/index.d.ts +1 -0
  10. package/dist/actions/weather/types/weather.types.d.ts +115 -0
  11. package/dist/actions/weather/weatherAlertsActions.factory.d.ts +6 -0
  12. package/dist/apis/aerisWeather/aerisWeather.api.d.ts +75 -0
  13. package/dist/apis/aerisWeather/aerisWeather.schemas.d.ts +454 -0
  14. package/dist/apis/aerisWeather/aerisWeather.selectors.d.ts +68 -0
  15. package/dist/apis/aerisWeather/aerisWeather.slice.d.ts +11 -0
  16. package/dist/apis/aerisWeather/aerisWeather.thunks.d.ts +12 -0
  17. package/dist/apis/aerisWeather/aerisWeather.types.d.ts +142 -0
  18. package/dist/apis/types.d.ts +1 -0
  19. package/dist/components/WeatherAlertIcon/WeatherAlertIcon.d.ts +3 -0
  20. package/dist/components/WeatherAlertIcon/WeatherAlertIcon.types.d.ts +17 -0
  21. package/dist/components/WeatherAlertIcon/WeatherAlertIconPopup.d.ts +24 -0
  22. package/dist/components/WeatherAlertIcon/index.d.ts +3 -0
  23. package/dist/components/WeatherLegend/RainSnowIceLegend/RainSnowIceLegend.types.d.ts +1 -0
  24. package/dist/components/WeatherLegend/WeatherAlertsLegend/WeatherAlertsLegend.types.d.ts +1 -0
  25. package/dist/components/WeatherLegend/WeatherLegend.types.d.ts +1 -0
  26. package/dist/components/WeatherLegend/WeatherTemperaturesLegend/WeatherTemperaturesLegend.types.d.ts +1 -0
  27. package/dist/components/WeatherLegend/WeatherWindSpeedsLegend/WeatherWindSpeedsLegend.types.d.ts +1 -0
  28. package/dist/components/index.d.ts +1 -0
  29. package/dist/controls/createOverlayLayerControl.factory.d.ts +2 -2
  30. package/dist/controls/createWeatherLayerControl.factory.d.ts +2 -2
  31. package/dist/controls/types/controls.types.d.ts +50 -5
  32. package/dist/controls/utils/index.d.ts +0 -1
  33. package/dist/controls/utils/weatherLayers.constants.d.ts +1 -2
  34. package/dist/controls/utils/weatherLayers.helpers.d.ts +1 -1
  35. package/dist/controls/utils/weatherLayers.rendering.d.ts +1 -1
  36. package/dist/createMap/createMap.d.ts +1 -1
  37. package/dist/helpers/parseLonLatLikeToCoordinates.helper.d.ts +2 -1
  38. package/dist/helpers/runAsyncThread.d.ts +30 -0
  39. package/dist/index.cjs +341 -260
  40. package/dist/index.cjs.map +1 -0
  41. package/dist/index.esm-8a133e09.js +3081 -0
  42. package/dist/index.esm-8a133e09.js.map +1 -0
  43. package/dist/index.esm-e8122a0a.cjs +6 -0
  44. package/dist/index.esm-e8122a0a.cjs.map +1 -0
  45. package/dist/index.js +34452 -26452
  46. package/dist/index.js.map +1 -0
  47. package/dist/nmaps-gl-69f5266d.js +1 -0
  48. package/dist/nmaps-gl-69f5266d.js.map +1 -0
  49. package/dist/nmaps-gl-6afeae26.cjs +1 -0
  50. package/dist/nmaps-gl-6afeae26.cjs.map +1 -0
  51. package/dist/types/common.types.d.ts +7 -0
  52. package/dist/types/index.d.ts +1 -0
  53. package/dist/utils/apis/api.constants.d.ts +6 -0
  54. package/dist/utils/apis/api.types.d.ts +5 -0
  55. package/dist/utils/apis/logEvents.api.d.ts +37 -0
  56. package/dist/utils/apis/sdkEvents.api.d.ts +4 -0
  57. package/dist/utils/common.schemas.d.ts +9 -0
  58. package/dist/utils/constants.d.ts +15 -5
  59. package/dist/utils/helpers/compareLonLatLikesByDistanceKm.helper.d.ts +2 -0
  60. package/dist/utils/helpers/filterLonLatLikesByDistanceKm.helper.d.ts +6 -0
  61. package/dist/utils/helpers/getConvertedLength.helper.d.ts +12 -0
  62. package/dist/utils/helpers/getKmDistanceBetweenLonLatLike.helper.d.ts +8 -0
  63. package/dist/utils/helpers/httpHeader.helpers.d.ts +29 -0
  64. package/dist/utils/helpers/indexDBFactory.helper.d.ts +14 -0
  65. package/dist/utils/helpers/normalizeColor.helper.d.ts +17 -0
  66. package/dist/utils/helpers/prepareAppErrorMailToData.helper.d.ts +2 -2
  67. package/dist/utils/helpers/roundToDecimals.helper.d.ts +4 -0
  68. package/dist/utils/helpers/setUrlParameter.helper.d.ts +5 -0
  69. package/dist/utils/helpers/sourcemap.helpers.d.ts +14 -0
  70. package/dist/utils/helpers.d.ts +4 -0
  71. package/dist/utils/singletons/wasmFloat.polyfill.d.ts +9 -0
  72. package/dist/utils/singletons/wasmMath.singleton.d.ts +8 -0
  73. package/dist/utils/types.d.ts +22 -7
  74. package/dist/utils/version.d.ts +1 -1
  75. package/package.json +7 -2
  76. package/dist/controls/utils/weatherLayers.types.d.ts +0 -1
  77. package/dist/helpers/sdkEvents.helpers.d.ts +0 -4
  78. package/dist/utils/helpers/prepareContactSupportMandatoryFields.helper.d.ts +0 -4
@@ -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;
@@ -0,0 +1,3 @@
1
+ export * from "./WeatherAlertIcon";
2
+ export * from "./WeatherAlertIcon.types";
3
+ export * from "./WeatherAlertIconPopup";
@@ -9,6 +9,7 @@ export type RainSnowIceLegendOptions = {
9
9
  isVisible: boolean;
10
10
  parentElement: HTMLElement;
11
11
  accessToken: string;
12
+ baseApiUrl: string;
12
13
  };
13
14
  export type RainSnowIceLegendInstance = {
14
15
  show(): void;
@@ -3,6 +3,7 @@ export type WeatherAlertsLegendOptions = {
3
3
  isVisible: boolean;
4
4
  parentElement: HTMLElement;
5
5
  accessToken: string;
6
+ baseApiUrl: string;
6
7
  };
7
8
  export type WeatherAlertsLegendInstance = {
8
9
  show(): void;
@@ -4,6 +4,7 @@ export type WeatherLegendOptions = {
4
4
  fetchLegend: () => Promise<void>;
5
5
  renderData: () => string;
6
6
  accessToken: string;
7
+ baseApiUrl: string;
7
8
  };
8
9
  export type WeatherLegendInstance = {
9
10
  show(): void;
@@ -5,6 +5,7 @@ export type WeatherTemperaturesLegendOptions = {
5
5
  parentElement: HTMLElement;
6
6
  units: UnitsFormat;
7
7
  accessToken: string;
8
+ baseApiUrl: string;
8
9
  };
9
10
  export type WeatherTemperaturesLegendInstance = {
10
11
  show(): void;
@@ -5,6 +5,7 @@ export type WeatherWindSpeedsLegendOptions = {
5
5
  parentElement: HTMLElement;
6
6
  units: UnitsFormat;
7
7
  accessToken: string;
8
+ baseApiUrl: string;
8
9
  };
9
10
  export type WeatherWindSpeedsLegendInstance = {
10
11
  show(): void;
@@ -7,3 +7,4 @@ export * from "./Radio/RadioButton";
7
7
  export * from "./Radio/RadioButtonGroup";
8
8
  export * from "./Radio/Radio.types";
9
9
  export * from "./WeatherLegend";
10
+ export * from "./WeatherAlertIcon";
@@ -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?: BaseControlCreatorOptions & {
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?: BaseControlCreatorOptions) => WeatherLayerControl;
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,4 +1,3 @@
1
1
  export * from "./weatherLayers.constants";
2
2
  export * from "./weatherLayers.helpers";
3
3
  export * from "./weatherLayers.rendering";
4
- export * from "./weatherLayers.types";
@@ -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 "./weatherLayers.types";
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 "./weatherLayers.types";
1
+ import { WeatherLayerType } from "../types";
2
2
  export declare const renderWeatherLayerMenuItems: (selectedLayer: WeatherLayerType | null, radioGroupName: string) => string;
@@ -3,7 +3,7 @@ import { CreateMapProps, MapInstance } from "./types";
3
3
  /**
4
4
  * This is the main method that allows to mount the app and use all the features
5
5
  * @group Map Initialization
6
- * @param {CreateMapProps} options - Options to configure the map with
6
+ * @param {CreateMapProps} props - Options to configure the map with
7
7
  * @example
8
8
  * How to create map instance, with default streets map style
9
9
  * ```ts
@@ -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>;