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.
@@ -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.5.0";
52224
+ var version = "3.6.0";
52221
52225
 
52222
52226
  /**
52223
52227
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -52822,10 +52826,9 @@ uniform ${precision} ${type} u_${name};
52822
52826
  * language is explicitly specified when using those parts of the API.
52823
52827
  * If a Map is initialized with the language explicitly defined and
52824
52828
  * setLanguage hasn't previously been called it will automatically be called by the Map constructor.
52825
- * @param language The new default language.
52829
+ * @param language The new default language. If set to "auto", the browser's configured language will be used.
52826
52830
  */
52827
52831
  function setLanguage(language) {
52828
- // Find the best fit supported language.
52829
52832
  defaultLanguage = Localizer.getCode(language);
52830
52833
  hasSetLanguage = true;
52831
52834
  }
@@ -53585,12 +53588,10 @@ uniform ${precision} ${type} u_${name};
53585
53588
  var expandGrid = function (expanded) {
53586
53589
  if (expanded) {
53587
53590
  container.classList.add("in-use");
53588
- grid.setAttribute("aria-hidden", "false");
53589
53591
  grid.classList.remove("hidden-accessible-element");
53590
53592
  }
53591
53593
  else {
53592
53594
  container.classList.remove("in-use");
53593
- grid.setAttribute("aria-hidden", "true");
53594
53595
  grid.classList.add("hidden-accessible-element");
53595
53596
  }
53596
53597
  };
@@ -53657,7 +53658,6 @@ uniform ${precision} ${type} u_${name};
53657
53658
  var grid = document.createElement("div");
53658
53659
  grid.classList.add("sub-container");
53659
53660
  grid.classList.add("hidden-accessible-element");
53660
- grid.setAttribute("aria-hidden", "true");
53661
53661
  var rotationRightButton = this.constructRightRotationButton(map);
53662
53662
  var rotationLeftButton = this.constructLeftRotationButton(map);
53663
53663
  var tooltipLeft = buildAccessibleTooltip("Rotate Left");
@@ -53863,12 +53863,10 @@ uniform ${precision} ${type} u_${name};
53863
53863
  var expandGrid = function (expanded) {
53864
53864
  if (expanded) {
53865
53865
  container.classList.add("in-use");
53866
- grid.setAttribute("aria-hidden", "false");
53867
53866
  grid.classList.remove("hidden-accessible-element");
53868
53867
  }
53869
53868
  else {
53870
53869
  container.classList.remove("in-use");
53871
- grid.setAttribute("aria-hidden", "true");
53872
53870
  grid.classList.add("hidden-accessible-element");
53873
53871
  }
53874
53872
  };
@@ -53953,7 +53951,6 @@ uniform ${precision} ${type} u_${name};
53953
53951
  var grid = document.createElement("div");
53954
53952
  grid.classList.add("sub-container");
53955
53953
  grid.classList.add("hidden-accessible-element");
53956
- grid.setAttribute("aria-hidden", "true");
53957
53954
  this.pitchIncrementButton = this.constructPitchIncrementButton(map);
53958
53955
  this.pitchDecrementButton = this.constructPitchDecrementButton(map);
53959
53956
  var tooltipIncrement = buildAccessibleTooltip("Increase Pitch");
@@ -57770,12 +57767,10 @@ uniform ${precision} ${type} u_${name};
57770
57767
  var expandGrid = function (expanded) {
57771
57768
  if (expanded) {
57772
57769
  container.classList.add(StyleControl.Css.inUse);
57773
- styleOpsGrid.setAttribute("aria-hidden", "false");
57774
57770
  styleOpsGrid.classList.remove("hidden-accessible-element");
57775
57771
  }
57776
57772
  else {
57777
57773
  container.classList.remove(StyleControl.Css.inUse);
57778
- styleOpsGrid.setAttribute("aria-hidden", "true");
57779
57774
  styleOpsGrid.classList.add("hidden-accessible-element");
57780
57775
  }
57781
57776
  };
@@ -58001,7 +57996,6 @@ uniform ${precision} ${type} u_${name};
58001
57996
  }
58002
57997
  styleOpsGrid.setAttribute("aria-label", "Style Options");
58003
57998
  styleOpsGrid.classList.add("hidden-accessible-element");
58004
- styleOpsGrid.setAttribute("aria-hidden", "true");
58005
57999
  // Once the map's style definition is initialized create a map between style names and icons.
58006
58000
  // If a style is one of those to be shown by the style picker also create it's element.
58007
58001
  this.map.styles.definitions().then(function (definitions) { return __awaiter$3(_this, void 0, void 0, function () {
@@ -65808,7 +65802,7 @@ uniform ${precision} ${type} u_${name};
65808
65802
  */
65809
65803
  ImageLayer.prototype.setOptions = function (options) {
65810
65804
  var newOptions = new ImageLayerOptions().merge(this.options, cloneDeepWith$1(options, ImageLayerOptions._cloneCustomizer));
65811
- var reloadImageTransform = (typeof options.url === "string" && options.url !== this.getOptions().url);
65805
+ var reloadImage = (typeof options.url === "string" && options.url !== this.getOptions().url);
65812
65806
  var coordChanged = (typeof options.coordinates !== "undefined" && options.coordinates !== this.getOptions().coordinates);
65813
65807
  if (this.map) {
65814
65808
  this._updateBaseProperties(newOptions, this.options);
@@ -65818,16 +65812,17 @@ uniform ${precision} ${type} u_${name};
65818
65812
  this._updatePaintProperty("raster-brightness-max", newOptions.maxBrightness, this.options.maxBrightness);
65819
65813
  this._updatePaintProperty("raster-opacity", newOptions.opacity, this.options.opacity);
65820
65814
  this._updatePaintProperty("raster-saturation", newOptions.saturation, this.options.saturation);
65821
- // TODO: the mapbox typing file doesn't support maplibregl.ImageSource.updateImage()
65822
- // update "as any" to "as maplibregl.ImageSource" after the typing file is updated
65815
+ // Get the image source
65823
65816
  var source = this.map._getMap().getSource(this._getSourceId());
65824
- if (source) {
65817
+ // Check if the source exists and if we need to reload the image or if coordinates have changed
65818
+ if (source && (reloadImage || coordChanged)) {
65819
+ // Update the image with the new options
65825
65820
  source.updateImage(newOptions);
65826
65821
  }
65827
65822
  }
65828
65823
  this.options = newOptions;
65829
65824
  // Modified to update transform if image url or coordinates change
65830
- if (reloadImageTransform) {
65825
+ if (reloadImage) {
65831
65826
  this.reloadImage();
65832
65827
  }
65833
65828
  else if (coordChanged) {
@@ -68359,6 +68354,7 @@ uniform ${precision} ${type} u_${name};
68359
68354
  ele.addEventListener("click", this.close);
68360
68355
  ele.classList.add(Popup.Css.close);
68361
68356
  ele.setAttribute("aria-label", "close");
68357
+ ele.setAttribute("type", "button");
68362
68358
  ele.setAttribute("tabindex", "0");
68363
68359
  ele.innerHTML = "×";
68364
68360
  return ele;
@@ -72812,6 +72808,12 @@ uniform ${precision} ${type} u_${name};
72812
72808
  * @deprecated use `view` instead.
72813
72809
  */
72814
72810
  _this.userRegion = _this.view;
72811
+ /**
72812
+ * Override the default styles for the map elements.​
72813
+ * Default `undefined`
72814
+ * @default undefined
72815
+ */
72816
+ _this.styleOverrides = undefined;
72815
72817
  /**
72816
72818
  * allows substituting a default MapControl's style transformer with custom one
72817
72819
  * 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
@@ -72949,10 +72951,10 @@ uniform ${precision} ${type} u_${name};
72949
72951
  /**
72950
72952
  * Disable telemetry collection
72951
72953
  * This option may only be set when initializing the map.
72952
- * default: false (true for the Azure Government cloud)
72953
- * @default false
72954
+ * default: true
72955
+ * @default true
72954
72956
  */
72955
- _this.disableTelemetry = getDomain() === "atlas.azure.us";
72957
+ _this.disableTelemetry = true;
72956
72958
  /**
72957
72959
  * Disable telemetry collection
72958
72960
  * This option may only be set when initializing the map.
@@ -73445,6 +73447,16 @@ uniform ${precision} ${type} u_${name};
73445
73447
  };
73446
73448
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
73447
73449
  };
73450
+ /**
73451
+ * Mapping of styleOverrides options to style parameter values.
73452
+ */
73453
+ var styleOverridesMapping = {
73454
+ countryRegion: "cr|bv:0",
73455
+ adminDistrict: "ad|bv:0",
73456
+ adminDistrict2: "ds|bv:0",
73457
+ buildingFootprint: "bld|v:0_adr|lv:0",
73458
+ roadDetails: "g|rasterDetailsVisible:0"
73459
+ };
73448
73460
  /**
73449
73461
  * @private
73450
73462
  */
@@ -73955,7 +73967,31 @@ uniform ${precision} ${type} u_${name};
73955
73967
  return targetStyleWithUserLayers;
73956
73968
  };
73957
73969
  }
73958
- this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
73970
+ var styleUrl = targetDefinition.url;
73971
+ if (styleUrl && (styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)) {
73972
+ // Append the st parameter in the url with the mapped value.
73973
+ // We loop through the styleOverrides and join the corresponding st parameter with "_".
73974
+ var url = new URL(styleUrl);
73975
+ var params = new URLSearchParams(url.search);
73976
+ var stParams = Object.entries(styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)
73977
+ .filter(function (_a) {
73978
+ var _b = __read$2(_a, 2), key = _b[0], value = _b[1];
73979
+ return key in styleOverridesMapping &&
73980
+ ( // bv stands for borderVisible
73981
+ (styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.borderVisible) === false) ||
73982
+ (!styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.visible) === false));
73983
+ })
73984
+ .map(function (_a) {
73985
+ var _b = __read$2(_a, 2), key = _b[0]; _b[1];
73986
+ return styleOverridesMapping[key];
73987
+ });
73988
+ if (stParams.length > 0) {
73989
+ params.set("st", stParams.join("_"));
73990
+ url.search = params.toString();
73991
+ styleUrl = url.toString();
73992
+ }
73993
+ }
73994
+ this.map._getMap().setStyle(styleUrl || targetDefinition.style, {
73959
73995
  diff: diff,
73960
73996
  validate: this.serviceOptions.validateStyle,
73961
73997
  transformStyle: transformStyleFunc
@@ -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$2 = "3.5.0";
52224
+ var version$2 = "3.6.0";
52221
52225
 
52222
52226
  /**
52223
52227
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -52822,10 +52826,9 @@ uniform ${precision} ${type} u_${name};
52822
52826
  * language is explicitly specified when using those parts of the API.
52823
52827
  * If a Map is initialized with the language explicitly defined and
52824
52828
  * setLanguage hasn't previously been called it will automatically be called by the Map constructor.
52825
- * @param language The new default language.
52829
+ * @param language The new default language. If set to "auto", the browser's configured language will be used.
52826
52830
  */
52827
52831
  function setLanguage(language) {
52828
- // Find the best fit supported language.
52829
52832
  defaultLanguage = Localizer.getCode(language);
52830
52833
  hasSetLanguage = true;
52831
52834
  }
@@ -53585,12 +53588,10 @@ uniform ${precision} ${type} u_${name};
53585
53588
  var expandGrid = function (expanded) {
53586
53589
  if (expanded) {
53587
53590
  container.classList.add("in-use");
53588
- grid.setAttribute("aria-hidden", "false");
53589
53591
  grid.classList.remove("hidden-accessible-element");
53590
53592
  }
53591
53593
  else {
53592
53594
  container.classList.remove("in-use");
53593
- grid.setAttribute("aria-hidden", "true");
53594
53595
  grid.classList.add("hidden-accessible-element");
53595
53596
  }
53596
53597
  };
@@ -53657,7 +53658,6 @@ uniform ${precision} ${type} u_${name};
53657
53658
  var grid = document.createElement("div");
53658
53659
  grid.classList.add("sub-container");
53659
53660
  grid.classList.add("hidden-accessible-element");
53660
- grid.setAttribute("aria-hidden", "true");
53661
53661
  var rotationRightButton = this.constructRightRotationButton(map);
53662
53662
  var rotationLeftButton = this.constructLeftRotationButton(map);
53663
53663
  var tooltipLeft = buildAccessibleTooltip("Rotate Left");
@@ -53863,12 +53863,10 @@ uniform ${precision} ${type} u_${name};
53863
53863
  var expandGrid = function (expanded) {
53864
53864
  if (expanded) {
53865
53865
  container.classList.add("in-use");
53866
- grid.setAttribute("aria-hidden", "false");
53867
53866
  grid.classList.remove("hidden-accessible-element");
53868
53867
  }
53869
53868
  else {
53870
53869
  container.classList.remove("in-use");
53871
- grid.setAttribute("aria-hidden", "true");
53872
53870
  grid.classList.add("hidden-accessible-element");
53873
53871
  }
53874
53872
  };
@@ -53953,7 +53951,6 @@ uniform ${precision} ${type} u_${name};
53953
53951
  var grid = document.createElement("div");
53954
53952
  grid.classList.add("sub-container");
53955
53953
  grid.classList.add("hidden-accessible-element");
53956
- grid.setAttribute("aria-hidden", "true");
53957
53954
  this.pitchIncrementButton = this.constructPitchIncrementButton(map);
53958
53955
  this.pitchDecrementButton = this.constructPitchDecrementButton(map);
53959
53956
  var tooltipIncrement = buildAccessibleTooltip("Increase Pitch");
@@ -57770,12 +57767,10 @@ uniform ${precision} ${type} u_${name};
57770
57767
  var expandGrid = function (expanded) {
57771
57768
  if (expanded) {
57772
57769
  container.classList.add(StyleControl.Css.inUse);
57773
- styleOpsGrid.setAttribute("aria-hidden", "false");
57774
57770
  styleOpsGrid.classList.remove("hidden-accessible-element");
57775
57771
  }
57776
57772
  else {
57777
57773
  container.classList.remove(StyleControl.Css.inUse);
57778
- styleOpsGrid.setAttribute("aria-hidden", "true");
57779
57774
  styleOpsGrid.classList.add("hidden-accessible-element");
57780
57775
  }
57781
57776
  };
@@ -58001,7 +57996,6 @@ uniform ${precision} ${type} u_${name};
58001
57996
  }
58002
57997
  styleOpsGrid.setAttribute("aria-label", "Style Options");
58003
57998
  styleOpsGrid.classList.add("hidden-accessible-element");
58004
- styleOpsGrid.setAttribute("aria-hidden", "true");
58005
57999
  // Once the map's style definition is initialized create a map between style names and icons.
58006
58000
  // If a style is one of those to be shown by the style picker also create it's element.
58007
58001
  this.map.styles.definitions().then(function (definitions) { return __awaiter$7(_this, void 0, void 0, function () {
@@ -65808,7 +65802,7 @@ uniform ${precision} ${type} u_${name};
65808
65802
  */
65809
65803
  ImageLayer.prototype.setOptions = function (options) {
65810
65804
  var newOptions = new ImageLayerOptions().merge(this.options, cloneDeepWith$1(options, ImageLayerOptions._cloneCustomizer));
65811
- var reloadImageTransform = (typeof options.url === "string" && options.url !== this.getOptions().url);
65805
+ var reloadImage = (typeof options.url === "string" && options.url !== this.getOptions().url);
65812
65806
  var coordChanged = (typeof options.coordinates !== "undefined" && options.coordinates !== this.getOptions().coordinates);
65813
65807
  if (this.map) {
65814
65808
  this._updateBaseProperties(newOptions, this.options);
@@ -65818,16 +65812,17 @@ uniform ${precision} ${type} u_${name};
65818
65812
  this._updatePaintProperty("raster-brightness-max", newOptions.maxBrightness, this.options.maxBrightness);
65819
65813
  this._updatePaintProperty("raster-opacity", newOptions.opacity, this.options.opacity);
65820
65814
  this._updatePaintProperty("raster-saturation", newOptions.saturation, this.options.saturation);
65821
- // TODO: the mapbox typing file doesn't support maplibregl.ImageSource.updateImage()
65822
- // update "as any" to "as maplibregl.ImageSource" after the typing file is updated
65815
+ // Get the image source
65823
65816
  var source = this.map._getMap().getSource(this._getSourceId());
65824
- if (source) {
65817
+ // Check if the source exists and if we need to reload the image or if coordinates have changed
65818
+ if (source && (reloadImage || coordChanged)) {
65819
+ // Update the image with the new options
65825
65820
  source.updateImage(newOptions);
65826
65821
  }
65827
65822
  }
65828
65823
  this.options = newOptions;
65829
65824
  // Modified to update transform if image url or coordinates change
65830
- if (reloadImageTransform) {
65825
+ if (reloadImage) {
65831
65826
  this.reloadImage();
65832
65827
  }
65833
65828
  else if (coordChanged) {
@@ -68359,6 +68354,7 @@ uniform ${precision} ${type} u_${name};
68359
68354
  ele.addEventListener("click", this.close);
68360
68355
  ele.classList.add(Popup.Css.close);
68361
68356
  ele.setAttribute("aria-label", "close");
68357
+ ele.setAttribute("type", "button");
68362
68358
  ele.setAttribute("tabindex", "0");
68363
68359
  ele.innerHTML = "×";
68364
68360
  return ele;
@@ -96473,6 +96469,12 @@ uniform ${precision} ${type} u_${name};
96473
96469
  * @deprecated use `view` instead.
96474
96470
  */
96475
96471
  _this.userRegion = _this.view;
96472
+ /**
96473
+ * Override the default styles for the map elements.​
96474
+ * Default `undefined`
96475
+ * @default undefined
96476
+ */
96477
+ _this.styleOverrides = undefined;
96476
96478
  /**
96477
96479
  * allows substituting a default MapControl's style transformer with custom one
96478
96480
  * 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
@@ -96610,10 +96612,10 @@ uniform ${precision} ${type} u_${name};
96610
96612
  /**
96611
96613
  * Disable telemetry collection
96612
96614
  * This option may only be set when initializing the map.
96613
- * default: false (true for the Azure Government cloud)
96614
- * @default false
96615
+ * default: true
96616
+ * @default true
96615
96617
  */
96616
- _this.disableTelemetry = getDomain() === "atlas.azure.us";
96618
+ _this.disableTelemetry = true;
96617
96619
  /**
96618
96620
  * Disable telemetry collection
96619
96621
  * This option may only be set when initializing the map.
@@ -97106,6 +97108,16 @@ uniform ${precision} ${type} u_${name};
97106
97108
  };
97107
97109
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
97108
97110
  };
97111
+ /**
97112
+ * Mapping of styleOverrides options to style parameter values.
97113
+ */
97114
+ var styleOverridesMapping = {
97115
+ countryRegion: "cr|bv:0",
97116
+ adminDistrict: "ad|bv:0",
97117
+ adminDistrict2: "ds|bv:0",
97118
+ buildingFootprint: "bld|v:0_adr|lv:0",
97119
+ roadDetails: "g|rasterDetailsVisible:0"
97120
+ };
97109
97121
  /**
97110
97122
  * @private
97111
97123
  */
@@ -97616,7 +97628,31 @@ uniform ${precision} ${type} u_${name};
97616
97628
  return targetStyleWithUserLayers;
97617
97629
  };
97618
97630
  }
97619
- this.map._getMap().setStyle(targetDefinition.url || targetDefinition.style, {
97631
+ var styleUrl = targetDefinition.url;
97632
+ if (styleUrl && (styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)) {
97633
+ // Append the st parameter in the url with the mapped value.
97634
+ // We loop through the styleOverrides and join the corresponding st parameter with "_".
97635
+ var url = new URL(styleUrl);
97636
+ var params = new URLSearchParams(url.search);
97637
+ var stParams = Object.entries(styleOptions === null || styleOptions === void 0 ? void 0 : styleOptions.styleOverrides)
97638
+ .filter(function (_a) {
97639
+ var _b = __read$2(_a, 2), key = _b[0], value = _b[1];
97640
+ return key in styleOverridesMapping &&
97641
+ ( // bv stands for borderVisible
97642
+ (styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.borderVisible) === false) ||
97643
+ (!styleOverridesMapping[key].includes('bv') && (value === null || value === void 0 ? void 0 : value.visible) === false));
97644
+ })
97645
+ .map(function (_a) {
97646
+ var _b = __read$2(_a, 2), key = _b[0]; _b[1];
97647
+ return styleOverridesMapping[key];
97648
+ });
97649
+ if (stParams.length > 0) {
97650
+ params.set("st", stParams.join("_"));
97651
+ url.search = params.toString();
97652
+ styleUrl = url.toString();
97653
+ }
97654
+ }
97655
+ this.map._getMap().setStyle(styleUrl || targetDefinition.style, {
97620
97656
  diff: diff,
97621
97657
  validate: this.serviceOptions.validateStyle,
97622
97658
  transformStyle: transformStyleFunc