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.
package/dist/atlas.css CHANGED
@@ -987,6 +987,81 @@ a.azure-map-copyright[href]:hover {
987
987
  overflow: hidden;
988
988
  z-index: 100;
989
989
  }
990
+ .azure-maps-control-dropdown {
991
+ display: flex;
992
+ flex-direction: column;
993
+ border-radius: 4px;
994
+ box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.14);
995
+ overflow: hidden;
996
+ padding-block: 8px;
997
+ background-color: white;
998
+ transform: scale(0.1, 0.1);
999
+ transition-timing-function: ease-out;
1000
+ transition-duration: 250ms;
1001
+ position: absolute;
1002
+ z-index: 1001;
1003
+ outline: 0;
1004
+ }
1005
+ .azure-maps-control-dropdown.top-left {
1006
+ transform-origin: top left;
1007
+ left: 0;
1008
+ }
1009
+ .azure-maps-control-dropdown.top-right {
1010
+ transform-origin: top right;
1011
+ right: 0;
1012
+ }
1013
+ .azure-maps-control-dropdown.bottom-left {
1014
+ transform-origin: bottom left;
1015
+ left: 0;
1016
+ bottom: 0;
1017
+ }
1018
+ .azure-maps-control-dropdown.bottom-right {
1019
+ transform-origin: bottom right;
1020
+ right: 0;
1021
+ bottom: 0;
1022
+ }
1023
+ .azure-maps-control-container.in-use .azure-maps-control-dropdown {
1024
+ transform: scale(1, 1);
1025
+ transition-timing-function: ease-out;
1026
+ transition-duration: 250ms;
1027
+ opacity: 1;
1028
+ visibility: visible;
1029
+ }
1030
+ .azure-maps-control-list-button {
1031
+ display: flex;
1032
+ align-items: center;
1033
+ background-color: white;
1034
+ box-shadow: 0 2px 4px 1px rgba(0, 0, 0, 0.14);
1035
+ border-radius: 0px;
1036
+ border: none;
1037
+ line-height: 32px;
1038
+ padding-inline-end: 16px;
1039
+ white-space: nowrap;
1040
+ }
1041
+ .azure-maps-control-list-button.curr-style {
1042
+ border-radius: 4px;
1043
+ }
1044
+ .azure-maps-control-list-button:hover,
1045
+ .azure-maps-control-list-button[aria-current="true"] {
1046
+ background-color: #f0f0f0;
1047
+ }
1048
+ .azure-maps-control-list-button:disabled {
1049
+ pointer-events: none;
1050
+ }
1051
+ .azure-maps-control-list-button img {
1052
+ margin: 8px;
1053
+ width: 16px;
1054
+ height: 16px;
1055
+ border: 1px solid lightgrey;
1056
+ border-radius: 2px;
1057
+ }
1058
+ .azure-maps-control-list-button.expanded {
1059
+ padding-inline-end: 64px;
1060
+ box-shadow: none;
1061
+ }
1062
+ .azure-maps-control-list-button.expanded img {
1063
+ margin-inline-end: 16px;
1064
+ }
990
1065
  .tooltiptext.dark {
991
1066
  background-color: #555;
992
1067
  color: #fff;
@@ -1408,14 +1483,65 @@ a.azure-map-copyright[href]:hover {
1408
1483
  color: #000;
1409
1484
  }
1410
1485
  .atlas-map.high-contrast-dark .azure-maps-control-container > .style-options.list button,
1486
+ .atlas-map.high-contrast-dark .azure-maps-control-container > .azure-maps-control-dropdown,
1411
1487
  .azure-maps-control-container.dark > .style-options.list button {
1412
1488
  background-color: #011C2C;
1413
1489
  color: #CCC;
1414
1490
  }
1415
1491
  .atlas-map.high-contrast-dark .azure-maps-control-container > .style-options.list button :disabled,
1492
+ .atlas-map.high-contrast-dark .azure-maps-control-container > .azure-maps-control-dropdown :disabled,
1416
1493
  .azure-maps-control-container.dark > .style-options.list button :disabled {
1417
1494
  color: rgba(255, 255, 255, 0.3);
1418
1495
  }
1496
+ .azure-maps-control-container.dark > .azure-maps-control-dropdown,
1497
+ .azure-maps-control-container.dark .azure-maps-control-list-button {
1498
+ background-color: #011c2c;
1499
+ }
1500
+ .atlas-map.high-contrast-dark .azure-maps-control-container > .azure-maps-control-dropdown {
1501
+ border-radius: 0;
1502
+ border: 3px solid #ffffff;
1503
+ }
1504
+ .atlas-map.high-contrast-light .azure-maps-control-container > .azure-maps-control-dropdown {
1505
+ border-radius: 0;
1506
+ border: 3px solid #000000;
1507
+ }
1508
+ .azure-maps-control-container.dark .azure-maps-control-list-button {
1509
+ box-shadow: rgba(0, 0, 0, 0.16) 0px 0px 4px;
1510
+ color: white;
1511
+ }
1512
+ .atlas-map.high-contrast-dark .azure-maps-control-container .azure-maps-control-list-button {
1513
+ background-color: #011C2C;
1514
+ color: #fff;
1515
+ }
1516
+ .atlas-map.high-contrast-dark .azure-maps-control-container .azure-maps-control-list-button :disabled {
1517
+ color: rgba(255, 255, 255, 0.3);
1518
+ }
1519
+ .atlas-map.high-contrast-light .azure-maps-control-container .azure-maps-control-list-button {
1520
+ background-color: #FFF;
1521
+ color: #000;
1522
+ }
1523
+ .atlas-map.high-contrast-dark .azure-maps-control-container .azure-maps-control-list-button.curr-style {
1524
+ border-radius: 0;
1525
+ border: 3px solid #ffffff;
1526
+ }
1527
+ .atlas-map.high-contrast-light .azure-maps-control-container .azure-maps-control-list-button.curr-style {
1528
+ border-radius: 0;
1529
+ border: 3px solid #000000;
1530
+ }
1531
+ .azure-maps-control-container.dark .azure-maps-control-list-button:hover,
1532
+ .azure-maps-control-container.dark .azure-maps-control-list-button[aria-current="true"] {
1533
+ background-color: #31acce;
1534
+ }
1535
+ .atlas-map.high-contrast-dark .azure-maps-control-container .azure-maps-control-list-button:hover,
1536
+ .atlas-map.high-contrast-dark .azure-maps-control-container .azure-maps-control-list-button[aria-current="true"] {
1537
+ background-color: #FFF;
1538
+ color: #000;
1539
+ }
1540
+ .atlas-map.high-contrast-light .azure-maps-control-container .azure-maps-control-list-button:hover,
1541
+ .atlas-map.high-contrast-light .azure-maps-control-container .azure-maps-control-list-button[aria-current="true"] {
1542
+ background-color: #011C2C;
1543
+ color: #fff;
1544
+ }
1419
1545
  .azure-maps-control-container > .style-options.list button:hover,
1420
1546
  .azure-maps-control-container > .style-options.list button:focus {
1421
1547
  color: #31ACCE;
package/dist/atlas.js CHANGED
@@ -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",
@@ -78212,6 +78246,14 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78212
78246
  * @default 'sans-serif'
78213
78247
  */
78214
78248
  _this.localIdeographFontFamily = 'sans-serif';
78249
+ /**
78250
+ * True to validate styles before it's getting applied.
78251
+ * Validation takes significant(few hundred ms) time to process styles during initial load.
78252
+ * Can be set to false for production environment to improve performance.
78253
+ * @internal
78254
+ * @default 'true'
78255
+ */
78256
+ _this.validateStyle = true;
78215
78257
  return _this;
78216
78258
  }
78217
78259
  /**
@@ -78411,7 +78453,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
78411
78453
  StyleManager.prototype.setStyleUrl = function (styleOptions) {
78412
78454
  var styleUrl = this.getStyleUrl(styleOptions);
78413
78455
  try {
78414
- this.map._getMap().setStyle(styleUrl, { diff: true, stylePatch: this._stylePatch.bind(this) });
78456
+ this.map._getMap().setStyle(styleUrl, {
78457
+ diff: true,
78458
+ stylePatch: this._stylePatch.bind(this),
78459
+ validate: this.serviceOptions.validateStyle
78460
+ });
78415
78461
  }
78416
78462
  catch (e) {
78417
78463
  throw e;