@rio-cloud/rio-uikit 0.16.2-beta.8 → 0.16.2

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 (270) hide show
  1. package/.DS_Store +0 -0
  2. package/AspectRatioPlaceholder.js +2 -0
  3. package/AspectRatioPlaceholder.ts +5 -0
  4. package/Map.d.ts +2 -1
  5. package/ResponsiveColumnStripe.d.ts +5 -0
  6. package/ResponsiveColumnStripe.js +2 -0
  7. package/RuleConnector.d.ts +2 -1
  8. package/RuleContainer.d.ts +3 -2
  9. package/RulesWrapper.d.ts +2 -1
  10. package/components/activity/Activity.js +6 -4
  11. package/components/animatedNumber/AnimatedNumber.js +6 -4
  12. package/components/applicationHeader/AppMenu.js +6 -3
  13. package/components/applicationHeader/AppMenuDropdown.js +6 -2
  14. package/components/applicationHeader/ApplicationHeader.js +16 -8
  15. package/components/applicationHeader/MobileAppMenu.js +8 -4
  16. package/components/applicationLayout/ApplicationLayout.js +8 -8
  17. package/components/applicationLayout/ApplicationLayoutBody.js +6 -3
  18. package/components/applicationLayout/ApplicationLayoutBodyBanner.js +4 -3
  19. package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +6 -4
  20. package/components/applicationLayout/ApplicationLayoutBodyNavigation.js +6 -4
  21. package/components/applicationLayout/ApplicationLayoutHeader.js +9 -7
  22. package/components/aspectRatioPlaceholder/AspectRatioPlaceholder.js +25 -0
  23. package/components/assetTree/AssetTree.js +6 -3
  24. package/components/assetTree/TypeCounter.js +6 -4
  25. package/components/clearableInput/ClearableInput.js +2 -1
  26. package/components/datepicker/DatePicker.js +8 -4
  27. package/components/dialog/MediaDialog.js +5 -1
  28. package/components/dialog/SaveDialog.js +5 -2
  29. package/components/fade/Fade.js +5 -0
  30. package/components/filepicker/FilePicker.js +1 -1
  31. package/components/map/assets/icon_map_settings_bounding_box_active.svg +1 -1
  32. package/components/map/assets/icon_map_settings_bounding_box_inactive.svg +1 -1
  33. package/components/map/assets/icon_map_settings_construction_active.svg +1 -1
  34. package/components/map/assets/icon_map_settings_construction_inactive.svg +1 -1
  35. package/components/map/assets/icon_map_settings_layer_active.svg +1 -1
  36. package/components/map/assets/icon_map_settings_layer_inactive.svg +1 -1
  37. package/components/map/assets/icon_map_settings_maptype_flat_active.svg +1 -1
  38. package/components/map/assets/icon_map_settings_maptype_flat_inactive.svg +1 -1
  39. package/components/map/assets/icon_map_settings_maptype_flat_truck_active.svg +1 -1
  40. package/components/map/assets/icon_map_settings_maptype_flat_truck_inactive.svg +1 -1
  41. package/components/map/assets/icon_map_settings_maptype_night_active.svg +1 -12
  42. package/components/map/assets/icon_map_settings_maptype_night_inactive.svg +1 -12
  43. package/components/map/assets/icon_map_settings_maptype_satelite_active.svg +1 -1
  44. package/components/map/assets/icon_map_settings_maptype_satelite_inactive.svg +1 -1
  45. package/components/map/assets/icon_map_settings_maptype_terrain_active.svg +1 -1
  46. package/components/map/assets/icon_map_settings_maptype_terrain_inactive.svg +1 -1
  47. package/components/map/assets/icon_map_settings_road_restrictions_active.svg +1 -1
  48. package/components/map/assets/icon_map_settings_road_restrictions_inactive.svg +1 -1
  49. package/components/map/assets/icon_map_settings_system_pois_active.svg +1 -1
  50. package/components/map/assets/icon_map_settings_system_pois_inactive.svg +1 -1
  51. package/components/map/assets/icon_map_settings_workshop_pois_active.svg +1 -1
  52. package/components/map/assets/icon_map_settings_workshop_pois_inactive.svg +1 -1
  53. package/components/map/components/Map.js +47 -36
  54. package/components/map/components/features/ContextMenu.js +1 -1
  55. package/components/map/components/features/Route.js +1 -10
  56. package/components/map/components/features/basics/Circle.js +11 -6
  57. package/components/map/components/features/basics/MapLayerGroup.js +8 -5
  58. package/components/map/components/features/basics/Polygon.js +6 -5
  59. package/components/map/components/features/basics/Polyline.js +42 -40
  60. package/components/map/components/features/basics/marker/DomMarker.js +9 -3
  61. package/components/map/components/features/basics/marker/Marker.js +101 -121
  62. package/components/map/components/features/basics/marker/TextMarker.js +15 -43
  63. package/components/map/components/features/layers/Layer.js +1 -1
  64. package/components/map/components/features/layers/MarkerLayer.js +7 -4
  65. package/components/map/components/features/layers/RoadRestrictionLayer.js +1 -2
  66. package/components/map/components/features/layers/TrafficLayer.js +2 -2
  67. package/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +2 -1
  68. package/components/map/components/features/layers/baselayers/useBaseLayer.js +4 -1
  69. package/components/map/components/features/layers/clustering/ClusterLayer.js +25 -9
  70. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +18 -3
  71. package/components/map/icons/MapIcon.js +46 -66
  72. package/components/map/utils/hooks.js +3 -3
  73. package/components/mapMarker/ClusterMapMarker.js +16 -20
  74. package/components/mapMarker/SingleMapMarker.js +16 -30
  75. package/components/numberControl/NumberControl.js +13 -7
  76. package/components/numberInput/NumberInput.js +30 -12
  77. package/components/responsiveColumnStripe/ResponsiveColumnStripe.js +255 -0
  78. package/components/rules/RuleContainer.js +4 -0
  79. package/components/rules/RulesWrapper.js +3 -3
  80. package/hooks/useDarkMode.js +3 -2
  81. package/hooks/useMutationObserver.js +13 -4
  82. package/hooks/useScrollPosition.js +6 -7
  83. package/index.d.ts +29 -29
  84. package/index.js +4 -0
  85. package/lib/es/AspectRatioPlaceholder.js +13 -0
  86. package/lib/es/AspectRatioPlaceholder.ts +5 -0
  87. package/lib/es/Map.d.ts +2 -1
  88. package/lib/es/ResponsiveColumnStripe.d.ts +5 -0
  89. package/lib/es/ResponsiveColumnStripe.js +13 -0
  90. package/lib/es/RuleConnector.d.ts +2 -1
  91. package/lib/es/RuleContainer.d.ts +3 -2
  92. package/lib/es/RulesWrapper.d.ts +2 -1
  93. package/lib/es/components/activity/Activity.js +9 -4
  94. package/lib/es/components/animatedNumber/AnimatedNumber.js +5 -3
  95. package/lib/es/components/applicationHeader/AppMenu.js +6 -3
  96. package/lib/es/components/applicationHeader/AppMenuDropdown.js +6 -2
  97. package/lib/es/components/applicationHeader/ApplicationHeader.js +15 -7
  98. package/lib/es/components/applicationHeader/MobileAppMenu.js +8 -4
  99. package/lib/es/components/applicationLayout/ApplicationLayout.js +11 -8
  100. package/lib/es/components/applicationLayout/ApplicationLayoutBody.js +5 -2
  101. package/lib/es/components/applicationLayout/ApplicationLayoutBodyBanner.js +7 -3
  102. package/lib/es/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +9 -4
  103. package/lib/es/components/applicationLayout/ApplicationLayoutBodyNavigation.js +9 -4
  104. package/lib/es/components/applicationLayout/ApplicationLayoutHeader.js +12 -7
  105. package/lib/es/components/aspectRatioPlaceholder/AspectRatioPlaceholder.js +33 -0
  106. package/lib/es/components/assetTree/AssetTree.js +5 -2
  107. package/lib/es/components/assetTree/TypeCounter.js +9 -4
  108. package/lib/es/components/clearableInput/ClearableInput.js +2 -1
  109. package/lib/es/components/datepicker/DatePicker.js +7 -3
  110. package/lib/es/components/dialog/MediaDialog.js +5 -1
  111. package/lib/es/components/dialog/SaveDialog.js +5 -2
  112. package/lib/es/components/fade/Fade.js +5 -0
  113. package/lib/es/components/filepicker/FilePicker.js +1 -1
  114. package/lib/es/components/map/assets/icon_map_settings_bounding_box_active.svg +1 -1
  115. package/lib/es/components/map/assets/icon_map_settings_bounding_box_inactive.svg +1 -1
  116. package/lib/es/components/map/assets/icon_map_settings_construction_active.svg +1 -1
  117. package/lib/es/components/map/assets/icon_map_settings_construction_inactive.svg +1 -1
  118. package/lib/es/components/map/assets/icon_map_settings_layer_active.svg +1 -1
  119. package/lib/es/components/map/assets/icon_map_settings_layer_inactive.svg +1 -1
  120. package/lib/es/components/map/assets/icon_map_settings_maptype_flat_active.svg +1 -1
  121. package/lib/es/components/map/assets/icon_map_settings_maptype_flat_inactive.svg +1 -1
  122. package/lib/es/components/map/assets/icon_map_settings_maptype_flat_truck_active.svg +1 -1
  123. package/lib/es/components/map/assets/icon_map_settings_maptype_flat_truck_inactive.svg +1 -1
  124. package/lib/es/components/map/assets/icon_map_settings_maptype_night_active.svg +1 -12
  125. package/lib/es/components/map/assets/icon_map_settings_maptype_night_inactive.svg +1 -12
  126. package/lib/es/components/map/assets/icon_map_settings_maptype_satelite_active.svg +1 -1
  127. package/lib/es/components/map/assets/icon_map_settings_maptype_satelite_inactive.svg +1 -1
  128. package/lib/es/components/map/assets/icon_map_settings_maptype_terrain_active.svg +1 -1
  129. package/lib/es/components/map/assets/icon_map_settings_maptype_terrain_inactive.svg +1 -1
  130. package/lib/es/components/map/assets/icon_map_settings_road_restrictions_active.svg +1 -1
  131. package/lib/es/components/map/assets/icon_map_settings_road_restrictions_inactive.svg +1 -1
  132. package/lib/es/components/map/assets/icon_map_settings_system_pois_active.svg +1 -1
  133. package/lib/es/components/map/assets/icon_map_settings_system_pois_inactive.svg +1 -1
  134. package/lib/es/components/map/assets/icon_map_settings_workshop_pois_active.svg +1 -1
  135. package/lib/es/components/map/assets/icon_map_settings_workshop_pois_inactive.svg +1 -1
  136. package/lib/es/components/map/components/Map.js +47 -36
  137. package/lib/es/components/map/components/features/ContextMenu.js +1 -1
  138. package/lib/es/components/map/components/features/Route.js +1 -10
  139. package/lib/es/components/map/components/features/basics/Circle.js +10 -5
  140. package/lib/es/components/map/components/features/basics/MapLayerGroup.js +8 -5
  141. package/lib/es/components/map/components/features/basics/Polygon.js +6 -5
  142. package/lib/es/components/map/components/features/basics/Polyline.js +42 -42
  143. package/lib/es/components/map/components/features/basics/marker/DomMarker.js +8 -3
  144. package/lib/es/components/map/components/features/basics/marker/Marker.js +105 -120
  145. package/lib/es/components/map/components/features/basics/marker/TextMarker.js +15 -42
  146. package/lib/es/components/map/components/features/layers/Layer.js +1 -1
  147. package/lib/es/components/map/components/features/layers/MarkerLayer.js +7 -4
  148. package/lib/es/components/map/components/features/layers/RoadRestrictionLayer.js +1 -2
  149. package/lib/es/components/map/components/features/layers/TrafficLayer.js +2 -2
  150. package/lib/es/components/map/components/features/layers/baselayers/DefaultRasterLayer.js +2 -1
  151. package/lib/es/components/map/components/features/layers/baselayers/useBaseLayer.js +4 -1
  152. package/lib/es/components/map/components/features/layers/clustering/ClusterLayer.js +25 -9
  153. package/lib/es/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +18 -3
  154. package/lib/es/components/map/icons/MapIcon.js +46 -66
  155. package/lib/es/components/map/utils/hooks.js +3 -3
  156. package/lib/es/components/mapMarker/ClusterMapMarker.js +16 -20
  157. package/lib/es/components/mapMarker/SingleMapMarker.js +16 -30
  158. package/lib/es/components/numberControl/NumberControl.js +13 -7
  159. package/lib/es/components/numberInput/NumberInput.js +31 -12
  160. package/lib/es/components/responsiveColumnStripe/ResponsiveColumnStripe.js +266 -0
  161. package/lib/es/components/rules/RuleContainer.js +4 -0
  162. package/lib/es/components/rules/RulesWrapper.js +3 -3
  163. package/lib/es/hooks/useDarkMode.js +4 -3
  164. package/lib/es/hooks/useMutationObserver.js +15 -4
  165. package/lib/es/hooks/useScrollPosition.js +6 -7
  166. package/lib/es/index.d.ts +29 -29
  167. package/lib/es/index.js +24 -0
  168. package/lib/es/styles/components/Dialog.less +13 -10
  169. package/lib/es/styles/components/MapMarker.less +224 -14
  170. package/lib/es/styles/components/MapSettings.less +45 -29
  171. package/lib/es/styles/components/Notification.less +1 -1
  172. package/lib/es/styles/design/alerts.less +7 -9
  173. package/lib/es/styles/design/aspect-ratio.less +1 -0
  174. package/lib/es/styles/design/blur.less +7 -0
  175. package/lib/es/styles/design/border.less +51 -14
  176. package/lib/es/styles/design/callouts.less +12 -11
  177. package/lib/es/styles/design/colors.less +15 -6
  178. package/lib/es/styles/design/cols.less +19 -18
  179. package/lib/es/styles/design/divide.less +165 -0
  180. package/lib/es/styles/design/divider.less +90 -0
  181. package/lib/es/styles/design/responsive/_imports.less +1 -0
  182. package/lib/es/styles/design/responsive/gap.less +0 -8
  183. package/lib/es/styles/design/responsive/spacing.less +25 -0
  184. package/lib/es/styles/design/text.less +16 -2
  185. package/lib/es/styles/mapping/color-map.less +10 -0
  186. package/lib/es/styles/mapping/spacings-map.less +5 -0
  187. package/lib/es/styles/rio-uikit-core.less +2 -0
  188. package/lib/es/styles/variables/colors.json +6 -0
  189. package/lib/es/styles/variables/concated_css_variables.less +6 -0
  190. package/lib/es/styles/variables/dark_colors.less +7 -0
  191. package/lib/es/styles/variables/dark_css_variables_map.less +7 -0
  192. package/lib/es/styles/variables/light_colors.less +7 -0
  193. package/lib/es/styles/variables/light_css_variables_map.less +7 -0
  194. package/lib/es/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +14 -5
  195. package/lib/es/types.ts +69 -23
  196. package/lib/es/useDarkMode.d.ts +4 -0
  197. package/lib/es/useDarkMode.js +13 -0
  198. package/lib/es/useMutationObserver.d.ts +4 -0
  199. package/lib/es/useMutationObserver.js +13 -0
  200. package/lib/es/version.json +1 -1
  201. package/package.json +2 -2
  202. package/styles/components/Dialog.less +13 -10
  203. package/styles/components/MapMarker.less +224 -14
  204. package/styles/components/MapSettings.less +45 -29
  205. package/styles/components/Notification.less +1 -1
  206. package/styles/design/alerts.less +7 -9
  207. package/styles/design/aspect-ratio.less +1 -0
  208. package/styles/design/blur.less +7 -0
  209. package/styles/design/border.less +51 -14
  210. package/styles/design/callouts.less +12 -11
  211. package/styles/design/colors.less +15 -6
  212. package/styles/design/cols.less +19 -18
  213. package/styles/design/divide.less +165 -0
  214. package/styles/design/divider.less +90 -0
  215. package/styles/design/responsive/_imports.less +1 -0
  216. package/styles/design/responsive/gap.less +0 -8
  217. package/styles/design/responsive/spacing.less +25 -0
  218. package/styles/design/text.less +16 -2
  219. package/styles/mapping/color-map.less +10 -0
  220. package/styles/mapping/spacings-map.less +5 -0
  221. package/styles/rio-uikit-core.less +2 -0
  222. package/styles/variables/colors.json +6 -0
  223. package/styles/variables/concated_css_variables.less +6 -0
  224. package/styles/variables/dark_colors.less +7 -0
  225. package/styles/variables/dark_css_variables_map.less +7 -0
  226. package/styles/variables/light_colors.less +7 -0
  227. package/styles/variables/light_css_variables_map.less +7 -0
  228. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +15 -6
  229. package/types.ts +69 -23
  230. package/useDarkMode.d.ts +4 -0
  231. package/useDarkMode.js +2 -0
  232. package/useMutationObserver.d.ts +4 -0
  233. package/useMutationObserver.js +2 -0
  234. package/version.json +1 -1
  235. package/components/.DS_Store +0 -0
  236. package/components/map/.DS_Store +0 -0
  237. package/components/map/components/.DS_Store +0 -0
  238. package/components/map/components/features/layers/TruckLayer.js +0 -20
  239. package/components/map/components/features/layers/baselayers/BaseLayer.js +0 -33
  240. package/components/map/components/features/layers/baselayers/DefaultLayer.js +0 -23
  241. package/hooks/useHereMap.ts +0 -23
  242. package/hooks/useScripts.ts +0 -52
  243. package/lib/.DS_Store +0 -0
  244. package/lib/es/.DS_Store +0 -0
  245. package/lib/es/components/.DS_Store +0 -0
  246. package/lib/es/components/map/components/features/layers/TruckLayer.js +0 -28
  247. package/lib/es/components/map/components/features/layers/baselayers/BaseLayer.js +0 -41
  248. package/lib/es/components/map/components/features/layers/baselayers/DefaultLayer.js +0 -30
  249. package/lib/es/hooks/useHereMap.ts +0 -23
  250. package/lib/es/hooks/useScripts.ts +0 -52
  251. package/lib/es/styles/.DS_Store +0 -0
  252. package/lib/es/styles/mixins/_mixins.less +0 -13
  253. package/lib/es/styles/mixins/alerts.less +0 -13
  254. package/lib/es/styles/shared/colors.json +0 -56
  255. package/lib/es/styles/shared/colors.less +0 -73
  256. package/lib/es/styles/shared/screens.less +0 -7
  257. package/lib/es/styles/shared/text.less +0 -23
  258. package/lib/es/styles/variables.less +0 -186
  259. package/lib/es/themes/.DS_Store +0 -0
  260. package/styles/.DS_Store +0 -0
  261. package/styles/mixins/_mixins.less +0 -13
  262. package/styles/mixins/alerts.less +0 -13
  263. package/styles/shared/colors.json +0 -56
  264. package/styles/shared/colors.less +0 -73
  265. package/styles/shared/screens.less +0 -7
  266. package/styles/shared/text.less +0 -23
  267. package/styles/variables.less +0 -186
  268. package/themes/.DS_Store +0 -0
  269. package/themes/Volkswagen/.DS_Store +0 -0
  270. package/themes/Website/.DS_Store +0 -0
@@ -10,6 +10,7 @@ import isFunction from 'lodash/fp/isFunction';
10
10
  import map from 'lodash/fp/map';
11
11
  import isEmpty from 'lodash/fp/isEmpty';
12
12
  import throttle from 'lodash/fp/throttle';
13
+ import cloneDeep from 'lodash/fp/cloneDeep';
13
14
  import mapProps from '../utils/proptypes';
14
15
  import addEventListener from '../../../utils/addEventListener';
15
16
  import '../herePolyfill';
@@ -28,7 +29,7 @@ import { getDefaultBaseLayer } from './features/layers/baselayers/useBaseLayer';
28
29
  import { addEventListenerMap, removeEventListenerMap } from '../utils/eventHandling';
29
30
  import { MapContext, MapSettingsContext } from './context';
30
31
  import { createUtils, getPPI } from './mapUtils';
31
- import { useDarkMode } from '../../../hooks/useDarkMode';
32
+ import useDarkMode from '../../../hooks/useDarkMode';
32
33
  export var NO_CREDENTIALS_ERROR_MESSAGE = 'Cannot instantiate the Map. Missing credentials property.';
33
34
  var RESIZE_THROTTLE = 1100; // 100 more than the ApplicationLayout handler
34
35
 
@@ -59,14 +60,14 @@ var getBounds = function getBounds(boundingBox) {
59
60
  right = boundingBox.right;
60
61
  return new H.geo.Rect(top, left, bottom, right);
61
62
  };
62
- var getLayer = function getLayer(api, layer, language, useWebGL) {
63
+ var getLayer = function getLayer(api, layer, language, enableWebGL) {
63
64
  switch (layer) {
64
65
  case MAP_LAYER_TRAFFIC:
65
66
  return /*#__PURE__*/React.createElement(TrafficLayer, {
66
67
  api: api,
67
68
  language: language,
68
69
  key: layer,
69
- useWebGL: useWebGL
70
+ useWebGL: enableWebGL
70
71
  });
71
72
  case MAP_LAYER_INCIDENTS:
72
73
  return /*#__PURE__*/React.createElement(IncidentsLayer, {
@@ -79,17 +80,17 @@ var getLayer = function getLayer(api, layer, language, useWebGL) {
79
80
  api: api,
80
81
  language: language,
81
82
  key: layer,
82
- useWebGL: useWebGL
83
+ useWebGL: enableWebGL
83
84
  });
84
85
  default:
85
86
  null;
86
87
  }
87
88
  };
88
- var getBaseLayer = function getBaseLayer(api, baseLayer, language, useWebGL, darkMode) {
89
+ var getBaseLayer = function getBaseLayer(api, baseLayer, language, enableWebGL, darkMode) {
89
90
  switch (baseLayer) {
90
91
  case MAP_TYPE_DEFAULT:
91
92
  {
92
- return !darkMode && useWebGL ? /*#__PURE__*/React.createElement(DefaultVectorLayer, {
93
+ return !darkMode && enableWebGL ? /*#__PURE__*/React.createElement(DefaultVectorLayer, {
93
94
  api: api,
94
95
  language: language,
95
96
  key: baseLayer
@@ -173,7 +174,8 @@ var Map = function Map(props) {
173
174
  onZoomOut = props.onZoomOut,
174
175
  mapSettingsTooltip = props.mapSettingsTooltip,
175
176
  mapSettings = props.mapSettings,
176
- useWebGL = props.useWebGL,
177
+ enableWebGL = props.enableWebGL,
178
+ enableDevicePixelRatio = props.enableDevicePixelRatio,
177
179
  darkMode = props.darkMode;
178
180
  var mapRef = useRef(null);
179
181
  var _useState = useState(false),
@@ -196,33 +198,22 @@ var Map = function Map(props) {
196
198
  _useState10 = _slicedToArray(_useState9, 2),
197
199
  showCluster = _useState10[0],
198
200
  setShowCluster = _useState10[1];
199
- var isDarkMode = useDarkMode();
200
- useEffect(function () {
201
- // Toggle night map only if current map type is default
202
- if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {
203
- setBaseLayer(MAP_TYPE_NIGHT);
204
- onMapTypeChange(MAP_TYPE_NIGHT);
205
- }
206
- // Toggle back to default map only if current map type is night
207
- else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {
208
- setBaseLayer(MAP_TYPE_DEFAULT);
209
- onMapTypeChange(MAP_TYPE_DEFAULT);
210
- }
211
- }, [isDarkMode]);
212
- var devicePixelRatio = window.devicePixelRatio || 1;
201
+ var devicePixelRatio = enableDevicePixelRatio ? window.devicePixelRatio || 1 : 1;
213
202
  useEffect(function () {
214
203
  console.debug('initialize here map');
215
204
  var bounds = boundingBox && getBounds(boundingBox);
216
205
  var platform = getPlatform(credentials);
217
206
  var defaultLayers = platform.createDefaultLayers();
218
- var defaultLayer = getDefaultBaseLayer(defaultLayers, baseLayer, useWebGL);
207
+ var defaultLayer = getDefaultBaseLayer(defaultLayers, baseLayer, enableWebGL);
219
208
 
220
209
  // Instantiate (and display) a map object:
221
210
  var mapConfig = {
222
211
  zoom: zoom,
223
212
  center: center,
224
213
  bounds: bounds,
225
- pixelRatio: devicePixelRatio
214
+ pixelRatio: devicePixelRatio,
215
+ // need to be set for better performence of legacy map
216
+ engineType: enableWebGL ? undefined : H.map.render.RenderEngine.EngineType.P2D
226
217
  };
227
218
  var hereMap = new H.Map(mapRef.current, defaultLayer, mapConfig);
228
219
 
@@ -237,10 +228,12 @@ var Map = function Map(props) {
237
228
  var hereMapEvents = !disableMapEvents && new H.mapevents.MapEvents(hereMap);
238
229
  var hereBehavior = !(disableMapEvents || disableBehavior) && new H.mapevents.Behavior(hereMapEvents);
239
230
  addEventListenerMap(hereMap, eventListenerMap, hereMap);
231
+
232
+ // The api will be passed to services when using a render function.
233
+ // This allows the service to access the map internals
240
234
  setApi({
241
235
  credentials: credentials,
242
236
  defaultLayers: defaultLayers,
243
- group: hereMap,
244
237
  map: hereMap,
245
238
  mapEvents: hereMapEvents,
246
239
  behavior: hereBehavior,
@@ -248,6 +241,7 @@ var Map = function Map(props) {
248
241
  ui: getHereUi(hereMap, defaultLayers, showScaleBar),
249
242
  utils: createUtils(hereMap),
250
243
  settings: {
244
+ enableWebGL: enableWebGL,
251
245
  baseLayer: baseLayer,
252
246
  mapLayer: activeLayers,
253
247
  showCluster: showCluster
@@ -268,7 +262,18 @@ var Map = function Map(props) {
268
262
  hereMap.dispose();
269
263
  }
270
264
  };
271
- }, [useWebGL]);
265
+ }, [enableWebGL, enableDevicePixelRatio]);
266
+ var isDarkMode = useDarkMode();
267
+ useEffect(function () {
268
+ // Toggle night map only if current map type is default
269
+ if (isDarkMode && baseLayer === MAP_TYPE_DEFAULT) {
270
+ handleMapTypeChange(MAP_TYPE_NIGHT);
271
+ }
272
+ // Toggle back to default map only if current map type is night
273
+ else if (!isDarkMode && baseLayer === MAP_TYPE_NIGHT) {
274
+ handleMapTypeChange(MAP_TYPE_DEFAULT);
275
+ }
276
+ }, [isDarkMode]);
272
277
 
273
278
  // Update BoundingBox from outside
274
279
  useEffect(function () {
@@ -307,7 +312,7 @@ var Map = function Map(props) {
307
312
 
308
313
  // Update MapType from outside
309
314
  useEffect(function () {
310
- return setBaseLayer(mapType);
315
+ return handleMapTypeChange(mapType);
311
316
  }, [mapType]);
312
317
 
313
318
  // Update MapLayer from outside
@@ -322,11 +327,13 @@ var Map = function Map(props) {
322
327
  var handleMapTypeChange = function handleMapTypeChange(newMapType) {
323
328
  setBaseLayer(newMapType);
324
329
  onMapTypeChange(newMapType, mapType);
325
- setApi(_objectSpread(_objectSpread({}, api), {}, {
326
- settings: _objectSpread(_objectSpread({}, api.settings), {}, {
327
- baseLayer: newMapType
328
- })
329
- }));
330
+ if (api) {
331
+ setApi(_objectSpread(_objectSpread({}, api), {}, {
332
+ settings: _objectSpread(_objectSpread({}, api.settings), {}, {
333
+ baseLayer: newMapType
334
+ })
335
+ }));
336
+ }
330
337
  };
331
338
  var handleMapLayerChange = function handleMapLayerChange(layer) {
332
339
  var removeLayer = function removeLayer(layerToRemove) {
@@ -372,7 +379,9 @@ var Map = function Map(props) {
372
379
  style: style,
373
380
  ref: mapRef
374
381
  }, isMapInitialized && /*#__PURE__*/React.createElement(MapContext.Provider, {
375
- value: api
382
+ value: {
383
+ api: api
384
+ }
376
385
  }, !hideZoomButtons && /*#__PURE__*/React.createElement(ZoomButtons, {
377
386
  onZoomIn: handleZoomIn,
378
387
  onZoomOut: handleZoomOut
@@ -388,8 +397,8 @@ var Map = function Map(props) {
388
397
  onShowClusterChange: handleShowClusterChange,
389
398
  mapSettingsTooltip: mapSettingsTooltip
390
399
  }
391
- }, mapSettings), getBaseLayer(api, baseLayer, language, useWebGL, darkMode), map(function (layer) {
392
- return getLayer(api, layer, language, useWebGL);
400
+ }, mapSettings), getBaseLayer(api, baseLayer, language, enableWebGL, darkMode), map(function (layer) {
401
+ return getLayer(api, layer, language, enableWebGL);
393
402
  }, activeLayers), children && /*#__PURE__*/React.createElement("div", {
394
403
  className: 'MapElements'
395
404
  }, isFunction(children) ? children(api) : enrichChildrenWithApi(children, api))));
@@ -417,7 +426,8 @@ Map.defaultProps = {
417
426
  onShowClusterChange: function onShowClusterChange() {},
418
427
  onZoomIn: function onZoomIn() {},
419
428
  onZoomOut: function onZoomOut() {},
420
- useWebGL: false,
429
+ enableWebGL: true,
430
+ enableDevicePixelRatio: true,
421
431
  darkMode: false
422
432
  };
423
433
  Map.propTypes = {
@@ -446,7 +456,8 @@ Map.propTypes = {
446
456
  getApi: PropTypes.func,
447
457
  mapSettingsTooltip: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
448
458
  mapSettings: PropTypes.node,
449
- useWebGL: PropTypes.bool,
459
+ enableWebGL: PropTypes.bool,
460
+ enableDevicePixelRatio: PropTypes.bool,
450
461
  darkMode: PropTypes.bool
451
462
  };
452
463
  export default Map;
@@ -80,7 +80,7 @@ var ContextMenu = function ContextMenu(props) {
80
80
  contextMenuEvent = props.contextMenuEvent,
81
81
  targetPosition = props.targetPosition;
82
82
  var mapContext = useContext(MapContext);
83
- var _ref = api || mapContext,
83
+ var _ref = api || mapContext.api,
84
84
  hereMap = _ref.map;
85
85
 
86
86
  // Use a ref to store the target position used when a map object was clicked with a fixed
@@ -15,7 +15,6 @@ export var MISSING_POSITIONS_EXCEPTION_MSG = 'Route requires a minimum of 1 posi
15
15
  export var TO_LESS_LINE_WIDTH_EXCEPTION_MSG = 'If isBorderIncludedInWidth is set to true than width has to be greater than twice of borderWidth';
16
16
  var LINE_STROKE_COLOR = 'rgba(48, 194, 255, 1)';
17
17
  var LINE_STROKE_COLOR_REDUCED = 'rgba(48, 194, 255, 0.5)';
18
- var BORDER_STROKE_COLOR = 'rgba(255, 255, 255, 1)';
19
18
  var BORDER_STROKE_COLOR_REDUCED = 'rgba(255, 255, 255, 0)';
20
19
  var defaultStyle = {
21
20
  width: 5,
@@ -24,14 +23,6 @@ var defaultStyle = {
24
23
  borderColor: 'rgba(54, 144, 174, 1)',
25
24
  isBorderIncludedInWidth: false
26
25
  };
27
- var defaultArrowStyle = {
28
- lineWidth: 10,
29
- fillColor: 'rgba(42, 55, 64, 1)',
30
- strokeColor: BORDER_STROKE_COLOR,
31
- lineDash: [0, 6],
32
- lineTailCap: 'arrow-tail',
33
- lineHeadCap: 'arrow-head'
34
- };
35
26
  var alternativeRouteStyle = _objectSpread(_objectSpread({}, defaultStyle), {}, {
36
27
  color: 'rgb(218,253,255)'
37
28
  });
@@ -144,7 +135,7 @@ var Route = function Route(props) {
144
135
  };
145
136
  Route.defaultProps = {
146
137
  hasArrows: true,
147
- arrowStyle: defaultArrowStyle,
138
+ arrowStyle: {},
148
139
  isReduced: false,
149
140
  isRouteAlternative: false,
150
141
  markers: []
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  /* eslint-disable no-undef */
3
- import { useContext, useState, useEffect } from 'react';
3
+ import { useContext, useState, useEffect, useRef } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import mapProps from '../../../utils/proptypes';
6
6
  import { MapContext } from '../../context';
@@ -13,25 +13,30 @@ var Circle = function Circle(_ref) {
13
13
  precision = _ref$precision === void 0 ? 60 : _ref$precision,
14
14
  style = _ref.style,
15
15
  eventListenerMap = _ref.eventListenerMap;
16
- var context = useContext(MapContext);
16
+ var _useContext = useContext(MapContext),
17
+ api = _useContext.api;
17
18
  var _useState = useState(),
18
19
  _useState2 = _slicedToArray(_useState, 2),
19
20
  circle = _useState2[0],
20
21
  setCircle = _useState2[1];
22
+
23
+ // Create a new circle and check for changes on the map itself.
24
+ // The map instance may change due to rendering changes like webgl vs raster.
25
+ // In this case, add the circle to the new map instance otherwise it will be gone.
21
26
  useEffect(function () {
22
27
  var newCircle = new H.map.Circle(position, radius, {
23
28
  style: style,
24
29
  precision: parseFloat(precision)
25
30
  });
26
31
  setCircle(newCircle);
27
- context.group.addObject(newCircle);
32
+ api.map.addObject(newCircle);
28
33
  return function () {
29
- if (context.group.getObjects().includes(newCircle)) {
30
- context.group.removeObject(newCircle);
34
+ if (api.map.getObjects().includes(newCircle)) {
35
+ api.map.removeObject(newCircle);
31
36
  }
32
37
  newCircle.dispose();
33
38
  };
34
- }, []);
39
+ }, [api.map]);
35
40
  useUpdateProp(circle, 'setCenter', position);
36
41
  useUpdateProp(circle, 'setStyle', style);
37
42
  useUpdateProp(circle, 'setRadius', radius);
@@ -12,6 +12,7 @@ var MapLayerGroup = function MapLayerGroup(_ref) {
12
12
  maxZoom = _ref.maxZoom,
13
13
  isVisible = _ref.isVisible;
14
14
  var context = useContext(MapContext);
15
+ var api = context.api;
15
16
  var _useState = useState(),
16
17
  _useState2 = _slicedToArray(_useState, 2),
17
18
  group = _useState2[0],
@@ -26,19 +27,21 @@ var MapLayerGroup = function MapLayerGroup(_ref) {
26
27
  max: parseFloat(maxZoom)
27
28
  });
28
29
  newGroup.setVisibility(isVisible);
29
- context.group.addObject(newGroup);
30
+ api.map.addObject(newGroup);
30
31
  setGroup(newGroup);
31
32
  var newChildApi = _objectSpread(_objectSpread({}, context), {}, {
32
- group: newGroup
33
+ api: _objectSpread(_objectSpread({}, api), {}, {
34
+ group: newGroup
35
+ })
33
36
  });
34
37
  setChildApi(newChildApi);
35
38
  return function () {
36
- if (context.group.getObjects().includes(newGroup)) {
37
- context.group.removeObject(newGroup);
39
+ if (api.map.getObjects().includes(newGroup)) {
40
+ api.map.removeObject(newGroup);
38
41
  }
39
42
  newGroup.dispose();
40
43
  };
41
- }, []);
44
+ }, [api.map]);
42
45
  useEffect(function () {
43
46
  if (group) {
44
47
  group.setVisibility(isVisible);
@@ -21,7 +21,8 @@ var Polygon = function Polygon(_ref) {
21
21
  _ref$style = _ref.style,
22
22
  style = _ref$style === void 0 ? H.map.SpatialStyle.DEFAULT_STYLE : _ref$style,
23
23
  eventListenerMap = _ref.eventListenerMap;
24
- var context = useContext(MapContext);
24
+ var _useContext = useContext(MapContext),
25
+ api = _useContext.api;
25
26
  var _useState = useState(),
26
27
  _useState2 = _slicedToArray(_useState, 2),
27
28
  polygon = _useState2[0],
@@ -30,15 +31,15 @@ var Polygon = function Polygon(_ref) {
30
31
  var newPolygon = new H.map.Polygon(createGeometry(points), {
31
32
  style: style
32
33
  });
33
- context.group.addObject(newPolygon);
34
+ api.map.addObject(newPolygon);
34
35
  setPolygon(newPolygon);
35
36
  return function () {
36
- if (context.group.getObjects().includes(newPolygon)) {
37
- context.group.removeObject(newPolygon);
37
+ if (api.map.getObjects().includes(newPolygon)) {
38
+ api.map.removeObject(newPolygon);
38
39
  }
39
40
  newPolygon.dispose();
40
41
  };
41
- }, []);
42
+ }, [api.map]);
42
43
  useEffect(function () {
43
44
  if (polygon) {
44
45
  polygon.setGeometry(createGeometry(points));
@@ -1,4 +1,7 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
5
  /* eslint-disable no-undef */
3
6
  import { useState, useEffect, useContext } from 'react';
4
7
  import PropTypes from 'prop-types';
@@ -15,7 +18,8 @@ var Polyline = function Polyline(_ref) {
15
18
  _ref$style = _ref.style,
16
19
  style = _ref$style === void 0 ? H.map.SpatialStyle.DEFAULT_STYLE : _ref$style,
17
20
  eventListenerMap = _ref.eventListenerMap;
18
- var context = useContext(MapContext);
21
+ var _useContext = useContext(MapContext),
22
+ api = _useContext.api;
19
23
  var _useState = useState(),
20
24
  _useState2 = _slicedToArray(_useState, 2),
21
25
  polyline = _useState2[0],
@@ -32,18 +36,39 @@ var Polyline = function Polyline(_ref) {
32
36
  style: style
33
37
  });
34
38
  if (hasArrows) {
35
- // Create a patterned polyline:
36
-
37
- // Non-legacy version:
38
- var arrowLineStyle = new H.map.SpatialStyle({
39
- width: 5,
40
- lineWidth: 10,
41
- strokeColor: 'rgba(255, 255, 255, 0)'
42
- });
43
- var routeArrows = new H.map.Polyline(geometry, {
44
- style: arrowLineStyle
45
- });
46
- routeArrows.setArrows(arrowStyle);
39
+ var routeArrows;
40
+ if (api.settings.enableWebGL) {
41
+ // Create a patterned polyline
42
+ var arrowLineStyle = new H.map.SpatialStyle(_objectSpread(_objectSpread({}, arrowStyle), {}, {
43
+ lineWidth: 10,
44
+ strokeColor: 'rgba(0, 0, 0, 0.8)',
45
+ lineDash: [0, 3],
46
+ lineDashOffset: 1.6,
47
+ lineTailCap: 'arrow-tail',
48
+ lineHeadCap: 'arrow-head'
49
+ }));
50
+ routeArrows = new H.map.Polyline(geometry, {
51
+ style: arrowLineStyle
52
+ });
53
+ } else {
54
+ // Non WebGL way - Create a patterned polyline
55
+ var defaultArrowStyle = {
56
+ lineWidth: 2,
57
+ fillColor: 'rgba(42, 55, 64, 1)',
58
+ strokeColor: 'rgba(0, 0, 0, 0.8)',
59
+ lineDash: [0, 4],
60
+ lineTailCap: 'arrow-tail',
61
+ lineHeadCap: 'arrow-head'
62
+ };
63
+ var _arrowLineStyle = new H.map.SpatialStyle({
64
+ lineWidth: 10,
65
+ strokeColor: 'rgba(255, 255, 255, 0)'
66
+ });
67
+ routeArrows = new H.map.Polyline(geometry, {
68
+ style: _arrowLineStyle,
69
+ arrows: defaultArrowStyle
70
+ });
71
+ }
47
72
 
48
73
  // create a group that represents the route line and contains
49
74
  // outline and the pattern
@@ -51,43 +76,20 @@ var Polyline = function Polyline(_ref) {
51
76
  } else {
52
77
  lineGroup.addObjects([line]);
53
78
  }
54
- context.group.addObject(lineGroup);
79
+ api.map.addObject(lineGroup);
55
80
  setPolyline(lineGroup);
56
81
  return function () {
57
- // cleanup
58
- //console.log('cleanup polyline');
59
-
60
82
  removeEventListenerMap(lineGroup);
61
83
  lineGroup.forEach(function (singleLine) {
62
84
  lineGroup.removeObject(singleLine);
63
85
  singleLine.dispose();
64
86
  });
65
- if (context.group.getObjects().includes(lineGroup)) {
66
- context.group.removeObject(lineGroup);
87
+ if (api.map.getObjects().includes(lineGroup)) {
88
+ api.map.removeObject(lineGroup);
67
89
  }
68
90
  lineGroup.dispose();
69
91
  };
70
- }, [geometry, style, hasArrows, arrowStyle]);
71
-
72
- /*useEffect(() => {
73
- if (polyline) {
74
- polyline.forEach((line, index) => {
75
- if (index === 0) {
76
- line.setStyle(style);
77
- } else {
78
- line.setStyle(arrowStyle);
79
- }
80
- });
81
- }
82
- }, [style, arrowStyle]);*/
83
-
84
- /*useEffect(() => {
85
- if (polyline) {
86
- polyline.forEach(line => line.setGeometry(geometry));
87
- }
88
- }, [geometry]);*/
89
-
90
- //useUpdateProp(polyline, 'setStyle', style);
92
+ }, [api.map, geometry, style, hasArrows, arrowStyle]);
91
93
  useUpdateEventListenerMap(polyline, eventListenerMap);
92
94
  return null;
93
95
  };
@@ -10,6 +10,12 @@ import React from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import mapProps from '../../../../utils/proptypes';
12
12
  import { addEventListenerMap, removeEventListenerMap, checkAndUpdateEventListenerMap } from '../../../../utils/eventHandling';
13
+
14
+ // Should be deprecated...
15
+ // Here Documentation:
16
+ // It should be only used where small numbers of markers with dynamic style and/or scripted icons are to be displayed
17
+ // on the map (for example animated interactive SVG). Otherwise a H.map.Marker should be preferred for performance reasons.
18
+ //
13
19
  var DomMarker = /*#__PURE__*/function (_React$Component) {
14
20
  _inherits(DomMarker, _React$Component);
15
21
  var _super = _createSuper(DomMarker);
@@ -21,7 +27,7 @@ var DomMarker = /*#__PURE__*/function (_React$Component) {
21
27
  _this.marker = new H.map.DomMarker(_this.convertPosition(props.position), {
22
28
  icon: icon
23
29
  });
24
- context.api.group.addObject(_this.marker);
30
+ context.api.map.addObject(_this.marker);
25
31
  addEventListenerMap(_this.marker, props.eventListenerMap, _this.context.api.map);
26
32
  return _this;
27
33
  }
@@ -48,8 +54,8 @@ var DomMarker = /*#__PURE__*/function (_React$Component) {
48
54
  key: "componentWillUnmount",
49
55
  value: function componentWillUnmount() {
50
56
  removeEventListenerMap(this.marker);
51
- if (this.context.api.group.includes(this.marker)) {
52
- this.context.api.group.removeObject(this.marker);
57
+ if (this.context.api.map.includes(this.marker)) {
58
+ this.context.api.map.removeObject(this.marker);
53
59
  }
54
60
  this.marker.dispose();
55
61
  }