azure-maps-control 3.5.0 → 3.6.1

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.css CHANGED
@@ -949,12 +949,10 @@
949
949
  .atlas-map .atlas-control-container .sub-container,
950
950
  .atlas-map .azure-maps-control-container > .style-options.icons {
951
951
  display: flex;
952
+ flex-wrap: wrap;
952
953
  flex-direction: row;
953
954
  position: relative;
954
955
  }
955
- .atlas-map .azure-maps-control-container > .style-options.icons {
956
- flex-wrap: wrap;
957
- }
958
956
  .atlas-map .top-left.subcontrol-container {
959
957
  position: absolute;
960
958
  top: 0;
package/dist/atlas.js CHANGED
@@ -52094,6 +52094,10 @@ uniform ${precision} ${type} u_${name};
52094
52094
  * @param locale The requested culture code.
52095
52095
  */
52096
52096
  Localizer.getCode = function (locale) {
52097
+ // If locale is set to 'auto', use the browser's configured language.
52098
+ if (locale.localeCompare("auto", undefined, { sensitivity: "base" }) === 0) {
52099
+ locale = navigator.language;
52100
+ }
52097
52101
  var code = CultureCode.parse(locale);
52098
52102
  // If the requested culture code includes a sensitive region simply return the original code.
52099
52103
  // This is to hopefully reduce the risk or providing bad content to users in a sensitive region.
@@ -52217,7 +52221,7 @@ uniform ${precision} ${type} u_${name};
52217
52221
  return UserAgent;
52218
52222
  }());
52219
52223
 
52220
- var version$3 = "3.5.0";
52224
+ var version$3 = "3.6.1";
52221
52225
 
52222
52226
  /**
52223
52227
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -52831,10 +52835,9 @@ uniform ${precision} ${type} u_${name};
52831
52835
  * language is explicitly specified when using those parts of the API.
52832
52836
  * If a Map is initialized with the language explicitly defined and
52833
52837
  * setLanguage hasn't previously been called it will automatically be called by the Map constructor.
52834
- * @param language The new default language.
52838
+ * @param language The new default language. If set to "auto", the browser's configured language will be used.
52835
52839
  */
52836
52840
  function setLanguage(language) {
52837
- // Find the best fit supported language.
52838
52841
  defaultLanguage = Localizer.getCode(language);
52839
52842
  hasSetLanguage = true;
52840
52843
  }
@@ -53594,12 +53597,10 @@ uniform ${precision} ${type} u_${name};
53594
53597
  var expandGrid = function (expanded) {
53595
53598
  if (expanded) {
53596
53599
  container.classList.add("in-use");
53597
- grid.setAttribute("aria-hidden", "false");
53598
53600
  grid.classList.remove("hidden-accessible-element");
53599
53601
  }
53600
53602
  else {
53601
53603
  container.classList.remove("in-use");
53602
- grid.setAttribute("aria-hidden", "true");
53603
53604
  grid.classList.add("hidden-accessible-element");
53604
53605
  }
53605
53606
  };
@@ -53666,7 +53667,6 @@ uniform ${precision} ${type} u_${name};
53666
53667
  var grid = document.createElement("div");
53667
53668
  grid.classList.add("sub-container");
53668
53669
  grid.classList.add("hidden-accessible-element");
53669
- grid.setAttribute("aria-hidden", "true");
53670
53670
  var rotationRightButton = this.constructRightRotationButton(map);
53671
53671
  var rotationLeftButton = this.constructLeftRotationButton(map);
53672
53672
  var tooltipLeft = buildAccessibleTooltip("Rotate Left");
@@ -53872,12 +53872,10 @@ uniform ${precision} ${type} u_${name};
53872
53872
  var expandGrid = function (expanded) {
53873
53873
  if (expanded) {
53874
53874
  container.classList.add("in-use");
53875
- grid.setAttribute("aria-hidden", "false");
53876
53875
  grid.classList.remove("hidden-accessible-element");
53877
53876
  }
53878
53877
  else {
53879
53878
  container.classList.remove("in-use");
53880
- grid.setAttribute("aria-hidden", "true");
53881
53879
  grid.classList.add("hidden-accessible-element");
53882
53880
  }
53883
53881
  };
@@ -53962,7 +53960,6 @@ uniform ${precision} ${type} u_${name};
53962
53960
  var grid = document.createElement("div");
53963
53961
  grid.classList.add("sub-container");
53964
53962
  grid.classList.add("hidden-accessible-element");
53965
- grid.setAttribute("aria-hidden", "true");
53966
53963
  this.pitchIncrementButton = this.constructPitchIncrementButton(map);
53967
53964
  this.pitchDecrementButton = this.constructPitchDecrementButton(map);
53968
53965
  var tooltipIncrement = buildAccessibleTooltip("Increase Pitch");
@@ -57779,12 +57776,10 @@ uniform ${precision} ${type} u_${name};
57779
57776
  var expandGrid = function (expanded) {
57780
57777
  if (expanded) {
57781
57778
  container.classList.add(StyleControl.Css.inUse);
57782
- styleOpsGrid.setAttribute("aria-hidden", "false");
57783
57779
  styleOpsGrid.classList.remove("hidden-accessible-element");
57784
57780
  }
57785
57781
  else {
57786
57782
  container.classList.remove(StyleControl.Css.inUse);
57787
- styleOpsGrid.setAttribute("aria-hidden", "true");
57788
57783
  styleOpsGrid.classList.add("hidden-accessible-element");
57789
57784
  }
57790
57785
  };
@@ -58010,7 +58005,6 @@ uniform ${precision} ${type} u_${name};
58010
58005
  }
58011
58006
  styleOpsGrid.setAttribute("aria-label", "Style Options");
58012
58007
  styleOpsGrid.classList.add("hidden-accessible-element");
58013
- styleOpsGrid.setAttribute("aria-hidden", "true");
58014
58008
  // Once the map's style definition is initialized create a map between style names and icons.
58015
58009
  // If a style is one of those to be shown by the style picker also create it's element.
58016
58010
  this.map.styles.definitions().then(function (definitions) { return __awaiter$7(_this, void 0, void 0, function () {
@@ -63259,9 +63253,7 @@ uniform ${precision} ${type} u_${name};
63259
63253
  zoomInButton.setAttribute("alt", "Zoom In");
63260
63254
  zoomInButton.setAttribute("type", "button");
63261
63255
  zoomInButton.addEventListener("click", function () {
63262
- var _a;
63263
63256
  map.setCamera({
63264
- maxBounds: (_a = map._getMap().getMaxBounds()) === null || _a === void 0 ? void 0 : _a.toArray().flat(),
63265
63257
  zoom: map.getCamera().zoom + _this.options.zoomDelta,
63266
63258
  duration: ZoomControl.ZOOM_DURATION_MS,
63267
63259
  type: "ease",
@@ -63278,9 +63270,7 @@ uniform ${precision} ${type} u_${name};
63278
63270
  zoomOutButton.setAttribute("alt", "Zoom Out");
63279
63271
  zoomOutButton.setAttribute("type", "button");
63280
63272
  zoomOutButton.addEventListener("click", function () {
63281
- var _a;
63282
63273
  map.setCamera({
63283
- maxBounds: (_a = map._getMap().getMaxBounds()) === null || _a === void 0 ? void 0 : _a.toArray().flat(),
63284
63274
  zoom: map.getCamera().zoom - _this.options.zoomDelta,
63285
63275
  duration: ZoomControl.ZOOM_DURATION_MS,
63286
63276
  type: "ease",
@@ -65817,7 +65807,7 @@ uniform ${precision} ${type} u_${name};
65817
65807
  */
65818
65808
  ImageLayer.prototype.setOptions = function (options) {
65819
65809
  var newOptions = new ImageLayerOptions().merge(this.options, cloneDeepWith$1(options, ImageLayerOptions._cloneCustomizer));
65820
- var reloadImageTransform = (typeof options.url === "string" && options.url !== this.getOptions().url);
65810
+ var reloadImage = (typeof options.url === "string" && options.url !== this.getOptions().url);
65821
65811
  var coordChanged = (typeof options.coordinates !== "undefined" && options.coordinates !== this.getOptions().coordinates);
65822
65812
  if (this.map) {
65823
65813
  this._updateBaseProperties(newOptions, this.options);
@@ -65827,16 +65817,17 @@ uniform ${precision} ${type} u_${name};
65827
65817
  this._updatePaintProperty("raster-brightness-max", newOptions.maxBrightness, this.options.maxBrightness);
65828
65818
  this._updatePaintProperty("raster-opacity", newOptions.opacity, this.options.opacity);
65829
65819
  this._updatePaintProperty("raster-saturation", newOptions.saturation, this.options.saturation);
65830
- // TODO: the mapbox typing file doesn't support maplibregl.ImageSource.updateImage()
65831
- // update "as any" to "as maplibregl.ImageSource" after the typing file is updated
65820
+ // Get the image source
65832
65821
  var source = this.map._getMap().getSource(this._getSourceId());
65833
- if (source) {
65822
+ // Check if the source exists and if we need to reload the image or if coordinates have changed
65823
+ if (source && (reloadImage || coordChanged)) {
65824
+ // Update the image with the new options
65834
65825
  source.updateImage(newOptions);
65835
65826
  }
65836
65827
  }
65837
65828
  this.options = newOptions;
65838
65829
  // Modified to update transform if image url or coordinates change
65839
- if (reloadImageTransform) {
65830
+ if (reloadImage) {
65840
65831
  this.reloadImage();
65841
65832
  }
65842
65833
  else if (coordChanged) {
@@ -68368,6 +68359,7 @@ uniform ${precision} ${type} u_${name};
68368
68359
  ele.addEventListener("click", this.close);
68369
68360
  ele.classList.add(Popup.Css.close);
68370
68361
  ele.setAttribute("aria-label", "close");
68362
+ ele.setAttribute("type", "button");
68371
68363
  ele.setAttribute("tabindex", "0");
68372
68364
  ele.innerHTML = "×";
68373
68365
  return ele;
@@ -114021,6 +114013,12 @@ uniform ${precision} ${type} u_${name};
114021
114013
  * @deprecated use `view` instead.
114022
114014
  */
114023
114015
  _this.userRegion = _this.view;
114016
+ /**
114017
+ * Override the default styles for the map elements.​
114018
+ * Default `undefined`
114019
+ * @default undefined
114020
+ */
114021
+ _this.styleOverrides = undefined;
114024
114022
  /**
114025
114023
  * allows substituting a default MapControl's style transformer with custom one
114026
114024
  * 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
@@ -114158,10 +114156,10 @@ uniform ${precision} ${type} u_${name};
114158
114156
  /**
114159
114157
  * Disable telemetry collection
114160
114158
  * This option may only be set when initializing the map.
114161
- * default: false (true for the Azure Government cloud)
114162
- * @default false
114159
+ * default: true
114160
+ * @default true
114163
114161
  */
114164
- _this.disableTelemetry = getDomain() === "atlas.azure.us";
114162
+ _this.disableTelemetry = true;
114165
114163
  /**
114166
114164
  * Disable telemetry collection
114167
114165
  * This option may only be set when initializing the map.
@@ -114654,6 +114652,16 @@ uniform ${precision} ${type} u_${name};
114654
114652
  };
114655
114653
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
114656
114654
  };
114655
+ /**
114656
+ * Mapping of styleOverrides options to style parameter values.
114657
+ */
114658
+ var styleOverridesMapping = {
114659
+ countryRegion: "cr|bv:0",
114660
+ adminDistrict: "ad|bv:0",
114661
+ adminDistrict2: "ds|bv:0",
114662
+ buildingFootprint: "bld|v:0_adr|lv:0",
114663
+ roadDetails: "g|rasterDetailsVisible:0"
114664
+ };
114657
114665
  /**
114658
114666
  * @private
114659
114667
  */
@@ -115164,7 +115172,31 @@ uniform ${precision} ${type} u_${name};
115164
115172
  return targetStyleWithUserLayers;
115165
115173
  };
115166
115174
  }
115167
- this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
115175
+ var styleUrl = targetDefinition.url;
115176
+ if (styleUrl && (styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)) {
115177
+ // Append the st parameter in the url with the mapped value.
115178
+ // We loop through the styleOverrides and join the corresponding st parameter with "_".
115179
+ var url = new URL(styleUrl);
115180
+ var params = new URLSearchParams(url.search);
115181
+ var stParams = Object.entries(styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)
115182
+ .filter(function (_a) {
115183
+ var _b = __read$2(_a, 2), key = _b[0], value = _b[1];
115184
+ return key in styleOverridesMapping &&
115185
+ ( // bv stands for borderVisible
115186
+ (styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.borderVisible) === false) ||
115187
+ (!styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.visible) === false));
115188
+ })
115189
+ .map(function (_a) {
115190
+ var _b = __read$2(_a, 2), key = _b[0]; _b[1];
115191
+ return styleOverridesMapping[key];
115192
+ });
115193
+ if (stParams.length > 0) {
115194
+ params.set("st", stParams.join("_"));
115195
+ url.search = params.toString();
115196
+ styleUrl = url.toString();
115197
+ }
115198
+ }
115199
+ this.map._getMap().setStyle(styleUrl || targetDefinition.style, {
115168
115200
  diff: diff,
115169
115201
  validate: this.serviceOptions.validateStyle,
115170
115202
  transformStyle: transformStyleFunc
@@ -115962,6 +115994,7 @@ uniform ${precision} ${type} u_${name};
115962
115994
  * Returns the camera's current properties.
115963
115995
  */
115964
115996
  Map.prototype.getCamera = function () {
115997
+ var _a;
115965
115998
  var southWest = this.map.getBounds().getSouthWest().toArray();
115966
115999
  var northEast = this.map.getBounds().getNorthEast().toArray();
115967
116000
  var cameraOptions = {
@@ -115971,7 +116004,8 @@ uniform ${precision} ${type} u_${name};
115971
116004
  pitch: this.map.getPitch(),
115972
116005
  bounds: new BoundingBox(southWest, northEast),
115973
116006
  minZoom: this.map.getMinZoom(),
115974
- maxZoom: this.map.getMaxZoom()
116007
+ maxZoom: this.map.getMaxZoom(),
116008
+ maxBounds: (_a = this.map.getMaxBounds()) === null || _a === void 0 ? void 0 : _a.toArray().flat(),
115975
116009
  };
115976
116010
  return cameraOptions;
115977
116011
  };