azure-maps-control 3.0.0-preview.2 → 3.0.0-preview.3

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.
@@ -87,7 +87,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
87
87
  msClientIdHeaderName: "x-ms-client-id",
88
88
  msOriginHeaderName: "Ms-Am-Request-Origin",
89
89
  msOriginHeaderValue: "MapControl",
90
- resourceId: "https://atlas.microsoft.com/",
90
+ aadResourceId: "https://atlas.microsoft.com/.default",
91
91
  sessionIdHeaderName: "Session-Id"
92
92
  };
93
93
 
@@ -265,7 +265,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
265
265
  return Url;
266
266
  }());
267
267
 
268
- var version = "3.0.0-preview.2";
268
+ var version = "3.0.0-preview.3";
269
269
 
270
270
  /**
271
271
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -14674,6 +14674,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14674
14674
  defaultRegion: {
14675
14675
  code: "NGT",
14676
14676
  strings: "en/resource.json"
14677
+ },
14678
+ latn: {
14679
+ code: "NGT-Latn",
14680
+ strings: "en/resource.json"
14677
14681
  }
14678
14682
  },
14679
14683
  ar: {
@@ -14720,6 +14724,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14720
14724
  us: {
14721
14725
  code: "en-US",
14722
14726
  strings: "en/resource.json"
14727
+ },
14728
+ au: {
14729
+ code: "en-AU",
14730
+ strings: "en/resource.json"
14731
+ },
14732
+ gb: {
14733
+ code: "en-GB",
14734
+ strings: "en/resource.json"
14735
+ },
14736
+ nz: {
14737
+ code: "en-NZ",
14738
+ strings: "en/resource.json"
14723
14739
  }
14724
14740
  },
14725
14741
  es: {
@@ -14845,14 +14861,31 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14845
14861
  }
14846
14862
  },
14847
14863
  zh: {
14864
+ // per https://microsoft.sharepoint.com/sites/globalreadiness/SitePages/Language-fallback.aspx
14865
+ // Chinese - Neutral (zh) fallbacks to en-US
14848
14866
  defaultRegion: {
14849
- code: "zh-Hant",
14850
- strings: "zh-tw/resource.json"
14867
+ code: "zh",
14868
+ strings: "en/resource.json"
14869
+ }
14870
+ },
14871
+ "zh-hans": {
14872
+ defaultRegion: {
14873
+ code: "zh-Hans",
14874
+ strings: "zh-cn/resource.json"
14875
+ },
14876
+ cn: {
14877
+ code: "zh-Hans-CN",
14878
+ strings: "zh-cn/resource.json"
14851
14879
  }
14852
14880
  },
14853
14881
  "zh-hant": {
14882
+ // per discussion with global readiness team, we were explicitly asked to not fallback zh-hant to zh-tw
14854
14883
  defaultRegion: {
14855
14884
  code: "zh-Hant",
14885
+ strings: "en/resource.json"
14886
+ },
14887
+ tw: {
14888
+ code: "zh-Hant-TW",
14856
14889
  strings: "zh-tw/resource.json"
14857
14890
  }
14858
14891
  }
@@ -15099,7 +15132,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15099
15132
  /**
15100
15133
  * The AAD implicit grant mechanism. Recommended for pages protected by a sign-in.
15101
15134
  * By default the page will be redirected to the AAD login when the map control initializes.
15102
- * Specify a logged-in `AuthenticationContext` in the `AuthenticationOptions`
15135
+ * Specify a logged-in `PublicClientApplication` in the `AuthenticationOptions`
15103
15136
  * for greater control over when/how the users signs in.
15104
15137
  * Literal value `"aad"`
15105
15138
  */
@@ -15164,7 +15197,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15164
15197
  */
15165
15198
  _this.sasToken = undefined;
15166
15199
  /**
15167
- * Optionally provide an existing `AuthenticationContext` from the ADAL.js library.
15200
+ * Optionally provide an existing `PublicClientApplication` from the MSAL.js library.
15168
15201
  * This authentication context will be used to acquire the AAD token.
15169
15202
  * Only used with the AAD authentication type.
15170
15203
  * This auth context must be configured to use the same AAD app ID as `this.aadAppId`.
@@ -15187,7 +15220,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15187
15220
  * @param aadAppId Azure AD App ID
15188
15221
  * @param aadTenant Azure AD Tenant Name
15189
15222
  * @param aadInstance An optional Azure AD Instance
15190
- * @param authContext An optional `AuthenticationContext` from the ADAL.js library
15223
+ * @param authContext An optional `PublicClientApplication` from the MSAL.js library
15191
15224
  */
15192
15225
  AuthenticationOptions.prototype.setAadProperties = function (clientId, aadAppId, aadTenant, aadInstance, authContext) {
15193
15226
  this.authType = exports.AuthenticationType.aad;
@@ -15481,7 +15514,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15481
15514
  /**
15482
15515
  * Specifies which set of geopolitically disputed borders and labels are displayed on the map. The View parameter (also referred to as “user region parameter”) is a 2-letter ISO-3166 Country Code that will show the correct maps for that country/region. Country/Regions that are not on the View list or if unspecified will default to the “Unified” View.
15483
15516
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews }.
15484
- * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
15517
+ * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country/region where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
15485
15518
  * @param view The new default view
15486
15519
  */
15487
15520
  function setView(view) {
@@ -19475,7 +19508,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19475
19508
  /**
19476
19509
  * Specifies which set of geopolitically disputed borders and labels are displayed on the map. The View parameter (also referred to as “user region parameter”) is a 2-letter ISO-3166 Country Code that will show the correct maps for that country/region. Country/Regions that are not on the View list or if unspecified will default to the “Unified” View.
19477
19510
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews}
19478
- * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
19511
+ * It is your responsibility to determine the location of your users, and then set the View parameter correctly for that location. The View parameter in Azure Maps must be used in compliance with applicable laws, including those regarding mapping, of the country/region where maps, images and other data and third party content that You are authorized to access via Azure Maps is made available.
19479
19512
  * default: `undefined`
19480
19513
  * @default undefined
19481
19514
  */
@@ -20107,6 +20140,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20107
20140
  * Preserve the map configuration that was used before the indoor map configuration was set
20108
20141
  */
20109
20142
  this.preservedPreindoorMapConfiguration = undefined;
20143
+ /**
20144
+ * The state of the progressive loading
20145
+ */
20146
+ this._progressiveLoadingState = {
20147
+ mapStyle: undefined,
20148
+ pendingVisibilityChange: undefined,
20149
+ };
20110
20150
  this._deferLayerGroupVisibilities = function (layerGroupLayers, initLayerGroups) {
20111
20151
  var validInitLayerGroups = initLayerGroups.filter(function (groupName) { return groupName in layerGroupLayers; });
20112
20152
  // If the initial layer groups are invalid, skip the progressive loading.
@@ -20114,7 +20154,15 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20114
20154
  return;
20115
20155
  var map = _this.map._getMap();
20116
20156
  var currentZoomLevel = map.getZoom();
20117
- // Select the layers to be deferred
20157
+ var currentMapStyle = _this.map.getStyle().style;
20158
+ // Cancel and release previous pending callback, if any.
20159
+ if (_this._progressiveLoadingState.pendingVisibilityChange) {
20160
+ _this.map.events.remove('load', _this._progressiveLoadingState.pendingVisibilityChange);
20161
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
20162
+ }
20163
+ // Keep the current map style for future comparison.
20164
+ _this._progressiveLoadingState.mapStyle = currentMapStyle;
20165
+ // Select deferrable layers
20118
20166
  var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
20119
20167
  var _b = __read$c(_a, 2), groupName = _b[0], layers = _b[1];
20120
20168
  var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
@@ -20141,22 +20189,34 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20141
20189
  return false;
20142
20190
  }
20143
20191
  }
20144
- // Defer visible layers only.
20192
+ // Select visible layers only.
20145
20193
  return ((_a = layer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
20146
20194
  })));
20147
20195
  }, []);
20148
- // Hide the deferred layers at initial load, therefore we can save the render time.
20196
+ // Hide the deferrable layers at initial load, therefore we can save the render time.
20149
20197
  deferredLayers.forEach(function (layer) {
20198
+ // Since this happens before sending style object into the map rendering,
20199
+ // we only need to update the style object, but not necessary to update maplibre's layout properties.
20150
20200
  layer.layout = layer.layout || {};
20151
20201
  layer.layout.visibility = 'none';
20152
20202
  });
20153
- // Make the deferred layers visible once the map instance is fully loaded
20154
- _this.map.events.addOnce('load', function () {
20203
+ // Make the deferred layers visible once the map instance is fully loaded.
20204
+ _this._progressiveLoadingState.pendingVisibilityChange = function () {
20205
+ // Release the callback.
20206
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
20207
+ // Bail out the callback once map style has changed.
20208
+ var nextMapStyle = _this.map.getStyle().style;
20209
+ if (currentMapStyle !== nextMapStyle)
20210
+ return;
20211
+ // Make deferred layers visible
20155
20212
  deferredLayers.forEach(function (layer) {
20213
+ // This happens after the map rendering; Therefore, we need to update
20214
+ // both the style object and the maplibre's layout properties.
20156
20215
  layer.layout.visibility = 'visible';
20157
20216
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
20158
20217
  });
20159
- });
20218
+ };
20219
+ _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
20160
20220
  };
20161
20221
  this._onStyleData = function () {
20162
20222
  _this._lookUpAsync(_this.map.getStyle()).then(function (style) {
@@ -20348,19 +20408,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20348
20408
  // should be modified before they are applied to the map.
20349
20409
  var styleOptions = this.map.getStyle();
20350
20410
  var trafficOptions = this.map.getTraffic();
20351
- return __assign$8(__assign$8({}, nextStyle), {
20352
- // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
20353
- sources: Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
20354
- var _b = __read$c(_a, 2), sourceKey = _b[0], source = _b[1];
20355
- var newSource = __assign$8({}, source);
20356
- if ('url' in newSource && typeof newSource.url === 'string') {
20357
- if (newSource.url.includes(constants.languagePlaceHolder)) {
20358
- newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
20359
- }
20360
- }
20361
- newSources[sourceKey] = newSource;
20362
- return newSources;
20363
- }, {}), layers: nextStyle.layers.map(function (layer) {
20411
+ return __assign$8(__assign$8({}, nextStyle), { layers: nextStyle.layers.map(function (layer) {
20364
20412
  var _a, _b, _c, _d, _e, _f;
20365
20413
  var nextLayer = __assign$8({}, layer);
20366
20414
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
@@ -20446,7 +20494,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
20446
20494
  this.map._getMap().setStyle(this.getStyle(styleOptions), {
20447
20495
  diff: diff,
20448
20496
  validate: this.serviceOptions.validateStyle,
20449
- transformStyle: function (previousStyle, nextStyle) {
20497
+ transformStyle: function (previousStyle, style) {
20498
+ // Deep clone a style object to avoid side-effects from object mutation.
20499
+ var nextStyle = cloneDeep_1(style);
20450
20500
  // 1. derive the base new style (without user layers)
20451
20501
  var targetStyle = _this.deriveNewStyle(previousStyle, nextStyle);
20452
20502
  // 2. derive layer groups for the new style
@@ -21026,6 +21076,12 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21026
21076
  };
21027
21077
  throw new Error(JSON.stringify(errorDetails));
21028
21078
  }
21079
+ if ('pitch' in options) {
21080
+ mapboxCameraOptions.pitch = options.pitch;
21081
+ }
21082
+ if ('bearing' in options) {
21083
+ mapboxCameraOptions.bearing = options.bearing;
21084
+ }
21029
21085
  this.map.setMaxZoom(cameraBoundsOptions.maxZoom);
21030
21086
  this._invokeEvent("maxzoomchanged", this.map.getMaxZoom());
21031
21087
  maxBounds = this._generateSafeBounds(cameraBoundsOptions.maxBounds);
@@ -21148,8 +21204,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21148
21204
  // If this function is restructured such that a styledata event won't always trigger
21149
21205
  // if the language is changed, then either those delegates need changed
21150
21206
  // or the styledata event manually invoked.
21207
+ var noDiffOnLanguageViewChange = diff && (this.styleOptions.language === newOptions.language && this.styleOptions.view === newOptions.view);
21151
21208
  this.styleOptions = newOptions;
21152
- this._setStyleComponents(newOptions, diff);
21209
+ this._setStyleComponents(newOptions, noDiffOnLanguageViewChange);
21153
21210
  };
21154
21211
  /**
21155
21212
  * Returns the map control's current style settings.