azure-maps-control 3.5.0 → 3.6.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/dist/atlas-esm.js CHANGED
@@ -52088,6 +52088,10 @@ var Localizer = /** @class */ (function () {
52088
52088
  * @param locale The requested culture code.
52089
52089
  */
52090
52090
  Localizer.getCode = function (locale) {
52091
+ // If locale is set to 'auto', use the browser's configured language.
52092
+ if (locale.localeCompare("auto", undefined, { sensitivity: "base" }) === 0) {
52093
+ locale = navigator.language;
52094
+ }
52091
52095
  var code = CultureCode.parse(locale);
52092
52096
  // If the requested culture code includes a sensitive region simply return the original code.
52093
52097
  // This is to hopefully reduce the risk or providing bad content to users in a sensitive region.
@@ -52211,7 +52215,7 @@ var UserAgent = /** @class */ (function () {
52211
52215
  return UserAgent;
52212
52216
  }());
52213
52217
 
52214
- var version$3 = "3.5.0";
52218
+ var version$3 = "3.6.0";
52215
52219
 
52216
52220
  /**
52217
52221
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -52825,10 +52829,9 @@ function setMaxParallelImageRequests(maxParallelImageRequests) {
52825
52829
  * language is explicitly specified when using those parts of the API.
52826
52830
  * If a Map is initialized with the language explicitly defined and
52827
52831
  * setLanguage hasn't previously been called it will automatically be called by the Map constructor.
52828
- * @param language The new default language.
52832
+ * @param language The new default language. If set to "auto", the browser's configured language will be used.
52829
52833
  */
52830
52834
  function setLanguage(language) {
52831
- // Find the best fit supported language.
52832
52835
  defaultLanguage = Localizer.getCode(language);
52833
52836
  hasSetLanguage = true;
52834
52837
  }
@@ -53588,12 +53591,10 @@ var CompassControl = /** @class */ (function (_super) {
53588
53591
  var expandGrid = function (expanded) {
53589
53592
  if (expanded) {
53590
53593
  container.classList.add("in-use");
53591
- grid.setAttribute("aria-hidden", "false");
53592
53594
  grid.classList.remove("hidden-accessible-element");
53593
53595
  }
53594
53596
  else {
53595
53597
  container.classList.remove("in-use");
53596
- grid.setAttribute("aria-hidden", "true");
53597
53598
  grid.classList.add("hidden-accessible-element");
53598
53599
  }
53599
53600
  };
@@ -53660,7 +53661,6 @@ var CompassControl = /** @class */ (function (_super) {
53660
53661
  var grid = document.createElement("div");
53661
53662
  grid.classList.add("sub-container");
53662
53663
  grid.classList.add("hidden-accessible-element");
53663
- grid.setAttribute("aria-hidden", "true");
53664
53664
  var rotationRightButton = this.constructRightRotationButton(map);
53665
53665
  var rotationLeftButton = this.constructLeftRotationButton(map);
53666
53666
  var tooltipLeft = buildAccessibleTooltip("Rotate Left");
@@ -53866,12 +53866,10 @@ var PitchControl = /** @class */ (function (_super) {
53866
53866
  var expandGrid = function (expanded) {
53867
53867
  if (expanded) {
53868
53868
  container.classList.add("in-use");
53869
- grid.setAttribute("aria-hidden", "false");
53870
53869
  grid.classList.remove("hidden-accessible-element");
53871
53870
  }
53872
53871
  else {
53873
53872
  container.classList.remove("in-use");
53874
- grid.setAttribute("aria-hidden", "true");
53875
53873
  grid.classList.add("hidden-accessible-element");
53876
53874
  }
53877
53875
  };
@@ -53956,7 +53954,6 @@ var PitchControl = /** @class */ (function (_super) {
53956
53954
  var grid = document.createElement("div");
53957
53955
  grid.classList.add("sub-container");
53958
53956
  grid.classList.add("hidden-accessible-element");
53959
- grid.setAttribute("aria-hidden", "true");
53960
53957
  this.pitchIncrementButton = this.constructPitchIncrementButton(map);
53961
53958
  this.pitchDecrementButton = this.constructPitchDecrementButton(map);
53962
53959
  var tooltipIncrement = buildAccessibleTooltip("Increase Pitch");
@@ -57773,12 +57770,10 @@ var StyleControl = /** @class */ (function (_super) {
57773
57770
  var expandGrid = function (expanded) {
57774
57771
  if (expanded) {
57775
57772
  container.classList.add(StyleControl.Css.inUse);
57776
- styleOpsGrid.setAttribute("aria-hidden", "false");
57777
57773
  styleOpsGrid.classList.remove("hidden-accessible-element");
57778
57774
  }
57779
57775
  else {
57780
57776
  container.classList.remove(StyleControl.Css.inUse);
57781
- styleOpsGrid.setAttribute("aria-hidden", "true");
57782
57777
  styleOpsGrid.classList.add("hidden-accessible-element");
57783
57778
  }
57784
57779
  };
@@ -58004,7 +57999,6 @@ var StyleControl = /** @class */ (function (_super) {
58004
57999
  }
58005
58000
  styleOpsGrid.setAttribute("aria-label", "Style Options");
58006
58001
  styleOpsGrid.classList.add("hidden-accessible-element");
58007
- styleOpsGrid.setAttribute("aria-hidden", "true");
58008
58002
  // Once the map's style definition is initialized create a map between style names and icons.
58009
58003
  // If a style is one of those to be shown by the style picker also create it's element.
58010
58004
  this.map.styles.definitions().then(function (definitions) { return __awaiter$7(_this, void 0, void 0, function () {
@@ -65811,7 +65805,7 @@ var ImageLayer = /** @class */ (function (_super) {
65811
65805
  */
65812
65806
  ImageLayer.prototype.setOptions = function (options) {
65813
65807
  var newOptions = new ImageLayerOptions().merge(this.options, cloneDeepWith$1(options, ImageLayerOptions._cloneCustomizer));
65814
- var reloadImageTransform = (typeof options.url === "string" && options.url !== this.getOptions().url);
65808
+ var reloadImage = (typeof options.url === "string" && options.url !== this.getOptions().url);
65815
65809
  var coordChanged = (typeof options.coordinates !== "undefined" && options.coordinates !== this.getOptions().coordinates);
65816
65810
  if (this.map) {
65817
65811
  this._updateBaseProperties(newOptions, this.options);
@@ -65821,16 +65815,17 @@ var ImageLayer = /** @class */ (function (_super) {
65821
65815
  this._updatePaintProperty("raster-brightness-max", newOptions.maxBrightness, this.options.maxBrightness);
65822
65816
  this._updatePaintProperty("raster-opacity", newOptions.opacity, this.options.opacity);
65823
65817
  this._updatePaintProperty("raster-saturation", newOptions.saturation, this.options.saturation);
65824
- // TODO: the mapbox typing file doesn't support maplibregl.ImageSource.updateImage()
65825
- // update "as any" to "as maplibregl.ImageSource" after the typing file is updated
65818
+ // Get the image source
65826
65819
  var source = this.map._getMap().getSource(this._getSourceId());
65827
- if (source) {
65820
+ // Check if the source exists and if we need to reload the image or if coordinates have changed
65821
+ if (source && (reloadImage || coordChanged)) {
65822
+ // Update the image with the new options
65828
65823
  source.updateImage(newOptions);
65829
65824
  }
65830
65825
  }
65831
65826
  this.options = newOptions;
65832
65827
  // Modified to update transform if image url or coordinates change
65833
- if (reloadImageTransform) {
65828
+ if (reloadImage) {
65834
65829
  this.reloadImage();
65835
65830
  }
65836
65831
  else if (coordChanged) {
@@ -68362,6 +68357,7 @@ var Popup = /** @class */ (function (_super) {
68362
68357
  ele.addEventListener("click", this.close);
68363
68358
  ele.classList.add(Popup.Css.close);
68364
68359
  ele.setAttribute("aria-label", "close");
68360
+ ele.setAttribute("type", "button");
68365
68361
  ele.setAttribute("tabindex", "0");
68366
68362
  ele.innerHTML = "×";
68367
68363
  return ele;
@@ -114015,6 +114011,12 @@ var StyleOptions = /** @class */ (function (_super) {
114015
114011
  * @deprecated use `view` instead.
114016
114012
  */
114017
114013
  _this.userRegion = _this.view;
114014
+ /**
114015
+ * Override the default styles for the map elements.​
114016
+ * Default `undefined`
114017
+ * @default undefined
114018
+ */
114019
+ _this.styleOverrides = undefined;
114018
114020
  /**
114019
114021
  * allows substituting a default MapControl's style transformer with custom one
114020
114022
  * Default style transformer is meant to update the incoming fetched style to desired state, as well as to synchronize the SDK state with style state
@@ -114152,10 +114154,10 @@ var ServiceOptions = /** @class */ (function (_super) {
114152
114154
  /**
114153
114155
  * Disable telemetry collection
114154
114156
  * This option may only be set when initializing the map.
114155
- * default: false (true for the Azure Government cloud)
114156
- * @default false
114157
+ * default: true
114158
+ * @default true
114157
114159
  */
114158
- _this.disableTelemetry = getDomain() === "atlas.azure.us";
114160
+ _this.disableTelemetry = true;
114159
114161
  /**
114160
114162
  * Disable telemetry collection
114161
114163
  * This option may only be set when initializing the map.
@@ -114648,6 +114650,16 @@ var __values$2 = (window && window.__values) || function(o) {
114648
114650
  };
114649
114651
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
114650
114652
  };
114653
+ /**
114654
+ * Mapping of styleOverrides options to style parameter values.
114655
+ */
114656
+ var styleOverridesMapping = {
114657
+ countryRegion: "cr|bv:0",
114658
+ adminDistrict: "ad|bv:0",
114659
+ adminDistrict2: "ds|bv:0",
114660
+ buildingFootprint: "bld|v:0_adr|lv:0",
114661
+ roadDetails: "g|rasterDetailsVisible:0"
114662
+ };
114651
114663
  /**
114652
114664
  * @private
114653
114665
  */
@@ -115158,7 +115170,31 @@ var StyleManager = /** @class */ (function () {
115158
115170
  return targetStyleWithUserLayers;
115159
115171
  };
115160
115172
  }
115161
- this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
115173
+ var styleUrl = targetDefinition.url;
115174
+ if (styleUrl && (styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)) {
115175
+ // Append the st parameter in the url with the mapped value.
115176
+ // We loop through the styleOverrides and join the corresponding st parameter with "_".
115177
+ var url = new URL(styleUrl);
115178
+ var params = new URLSearchParams(url.search);
115179
+ var stParams = Object.entries(styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)
115180
+ .filter(function (_a) {
115181
+ var _b = __read$2(_a, 2), key = _b[0], value = _b[1];
115182
+ return key in styleOverridesMapping &&
115183
+ ( // bv stands for borderVisible
115184
+ (styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.borderVisible) === false) ||
115185
+ (!styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.visible) === false));
115186
+ })
115187
+ .map(function (_a) {
115188
+ var _b = __read$2(_a, 2), key = _b[0]; _b[1];
115189
+ return styleOverridesMapping[key];
115190
+ });
115191
+ if (stParams.length > 0) {
115192
+ params.set("st", stParams.join("_"));
115193
+ url.search = params.toString();
115194
+ styleUrl = url.toString();
115195
+ }
115196
+ }
115197
+ this.map._getMap().setStyle(styleUrl || targetDefinition.style, {
115162
115198
  diff: diff,
115163
115199
  validate: this.serviceOptions.validateStyle,
115164
115200
  transformStyle: transformStyleFunc