azure-maps-control 2.1.6 → 2.1.8

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.
@@ -43487,7 +43487,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43487
43487
  return Url;
43488
43488
  }());
43489
43489
 
43490
- var version = "2.1.6";
43490
+ var version = "2.1.8";
43491
43491
 
43492
43492
  /**
43493
43493
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -43532,7 +43532,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43532
43532
  if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
43533
43533
  tooltipContent.classList.add('dark');
43534
43534
  }
43535
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function (e) {
43535
+ var themeQuery = window.matchMedia('(prefers-color-scheme: dark)');
43536
+ var onThemeChange = function (e) {
43536
43537
  var isDark = e.matches;
43537
43538
  if (isDark && !tooltipContent.classList.contains('dark')) {
43538
43539
  tooltipContent.classList.add('dark');
@@ -43540,7 +43541,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
43540
43541
  else if (!isDark && tooltipContent.classList.contains('dark')) {
43541
43542
  tooltipContent.classList.remove('dark');
43542
43543
  }
43543
- });
43544
+ };
43545
+ // compensate for browsers where MediaQueryList is not derived from EventTarget (pre iOS13 Safari)
43546
+ if (typeof themeQuery.addEventListener === 'function') {
43547
+ themeQuery.addEventListener('change', function (e) { return onThemeChange(e); });
43548
+ }
43549
+ else if (typeof themeQuery.addListener === 'function') {
43550
+ themeQuery.addListener(function (e) { return onThemeChange(e); });
43551
+ }
43544
43552
  return tooltipContent;
43545
43553
  };
43546
43554
  /**
@@ -46839,6 +46847,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46839
46847
  var styleOpsGrid = this.buildStyleOpsGrid(container);
46840
46848
  var currStyleButton = this.buildCurrStyleBtn(container, styleOpsGrid);
46841
46849
  var tooltip = buildAccessibleTooltip("Select Style");
46850
+ styleOpsGrid.classList.add(options ? options.position || 'top-right' : 'top-right');
46842
46851
  container.addEventListener("mouseover", function () {
46843
46852
  _this.hasMouse = true;
46844
46853
  container.classList.add(StyleControl.Css.inUse);
@@ -46904,6 +46913,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46904
46913
  if (image.alt !== newAlt) {
46905
46914
  image.alt = newAlt;
46906
46915
  }
46916
+ if (image.parentElement.lastChild instanceof Text) {
46917
+ image.parentElement.lastChild.textContent = newAlt;
46918
+ }
46907
46919
  }
46908
46920
  };
46909
46921
  /**
@@ -46934,12 +46946,16 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46934
46946
  styleOptionButton.setAttribute("type", "button");
46935
46947
  var styleIconImage = new Image();
46936
46948
  styleIconImage.src = icon;
46937
- styleIconImage.alt = friendlyName;
46949
+ if (this.options.layout === "icons") {
46950
+ styleIconImage.alt = friendlyName;
46951
+ }
46938
46952
  styleOptionButton.appendChild(styleIconImage);
46939
46953
  if (this.options.layout === "icons") {
46940
46954
  styleOptionButton.classList.add(StyleControl.Css.button);
46941
46955
  }
46942
46956
  else {
46957
+ styleOptionButton.classList.add(StyleControl.Css.listButton);
46958
+ styleOptionButton.classList.add(StyleControl.Css.expanded);
46943
46959
  styleOptionButton.appendChild(document.createTextNode(friendlyName));
46944
46960
  }
46945
46961
  styleOptionButton.addEventListener("click", function () {
@@ -46962,7 +46978,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46962
46978
  };
46963
46979
  StyleControl.prototype.buildCurrStyleBtn = function (container, opsGrid) {
46964
46980
  var selectCurrButton = document.createElement("button");
46965
- selectCurrButton.classList.add(StyleControl.Css.button);
46981
+ if (this.options.layout == 'icons') {
46982
+ selectCurrButton.classList.add(StyleControl.Css.button);
46983
+ }
46984
+ else {
46985
+ selectCurrButton.classList.add(StyleControl.Css.listButton);
46986
+ }
46966
46987
  selectCurrButton.classList.add(StyleControl.Css.currentStyle);
46967
46988
  selectCurrButton.setAttribute("aria-label", "Select Style");
46968
46989
  selectCurrButton.setAttribute("alt", "Select Style");
@@ -46978,7 +46999,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
46978
46999
  var _this = this;
46979
47000
  var styleOpsGrid = document.createElement("div");
46980
47001
  styleOpsGrid.classList.add(StyleControl.Css.styleOptions);
46981
- styleOpsGrid.classList.add(this.options.layout);
47002
+ if (this.options.layout === 'icons') {
47003
+ styleOpsGrid.classList.add(this.options.layout);
47004
+ }
47005
+ else {
47006
+ styleOpsGrid.classList.add(StyleControl.Css.dropdown);
47007
+ }
46982
47008
  styleOpsGrid.setAttribute("aria-label", "Style Options");
46983
47009
  styleOpsGrid.classList.add("hidden-accessible-element");
46984
47010
  // Once the map's style definition is initialized create a map between style names and icons.
@@ -47012,6 +47038,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47012
47038
  if (style.name === currStyle) {
47013
47039
  _this.currStyleImage.src = iconUrl;
47014
47040
  _this.currStyleImage.alt = _this.mapToFriendlyStyleName(style.name);
47041
+ _this.currStyleImage.parentElement.appendChild(document.createTextNode(_this.mapToFriendlyStyleName(style.name)));
47015
47042
  }
47016
47043
  }
47017
47044
  }
@@ -47027,9 +47054,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47027
47054
  var styleOptionButton = _this.buildSelectStyleBtn(styleName, iconUrl);
47028
47055
  styleOpsGrid.appendChild(styleOptionButton);
47029
47056
  _this.styleButtons[styleName] = styleOptionButton;
47030
- var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47031
- styleOpsGrid.appendChild(tooltip);
47032
- positionTooltip(tooltip, styleOptionButton);
47057
+ if (_this.options.layout === "icons") {
47058
+ var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47059
+ styleOpsGrid.appendChild(tooltip);
47060
+ positionTooltip(tooltip, styleOptionButton);
47061
+ }
47033
47062
  });
47034
47063
  }
47035
47064
  else {
@@ -47038,9 +47067,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47038
47067
  var styleOptionButton = _this.buildSelectStyleBtn(styleName, iconUrl);
47039
47068
  styleOpsGrid.appendChild(styleOptionButton);
47040
47069
  _this.styleButtons[styleName] = styleOptionButton;
47041
- var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47042
- styleOpsGrid.appendChild(tooltip);
47043
- positionTooltip(tooltip, styleOptionButton);
47070
+ if (_this.options.layout === "icons") {
47071
+ var tooltip = buildAccessibleTooltip(_this.mapToFriendlyStyleName(styleName));
47072
+ styleOpsGrid.appendChild(tooltip);
47073
+ positionTooltip(tooltip, styleOptionButton);
47074
+ }
47044
47075
  });
47045
47076
  }
47046
47077
  Object.entries(_this.styleButtons).forEach(function (_a) {
@@ -47062,9 +47093,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
47062
47093
  StyleControl.InvertOrderPositions = [exports.ControlPosition.TopRight, exports.ControlPosition.BottomRight];
47063
47094
  StyleControl.Css = {
47064
47095
  button: "azure-maps-control-button",
47096
+ listButton: "azure-maps-control-list-button",
47097
+ expanded: 'expanded',
47065
47098
  currentStyle: "curr-style",
47066
47099
  inUse: "in-use",
47067
- styleOptions: "style-options"
47100
+ styleOptions: "style-options",
47101
+ dropdown: "azure-maps-control-dropdown"
47068
47102
  };
47069
47103
  StyleControl.StyleNamesMap = {
47070
47104
  road: "Road",
@@ -68031,6 +68065,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68031
68065
  * @default 'sans-serif'
68032
68066
  */
68033
68067
  _this.localIdeographFontFamily = 'sans-serif';
68068
+ /**
68069
+ * True to validate styles before it's getting applied.
68070
+ * Validation takes significant(few hundred ms) time to process styles during initial load.
68071
+ * Can be set to false for production environment to improve performance.
68072
+ * @internal
68073
+ * @default 'true'
68074
+ */
68075
+ _this.validateStyle = true;
68034
68076
  return _this;
68035
68077
  }
68036
68078
  /**
@@ -68230,7 +68272,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
68230
68272
  StyleManager.prototype.setStyleUrl = function (styleOptions) {
68231
68273
  var styleUrl = this.getStyleUrl(styleOptions);
68232
68274
  try {
68233
- this.map._getMap().setStyle(styleUrl, { diff: true, stylePatch: this._stylePatch.bind(this) });
68275
+ this.map._getMap().setStyle(styleUrl, {
68276
+ diff: true,
68277
+ stylePatch: this._stylePatch.bind(this),
68278
+ validate: this.serviceOptions.validateStyle
68279
+ });
68234
68280
  }
68235
68281
  catch (e) {
68236
68282
  throw e;