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.
@@ -77,8 +77,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
77
77
  }
78
78
 
79
79
  var azuremapsMaplibreGlDev = createCommonjsModule(function (module, exports) {
80
- /* The Azure Maps fork of MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.0.0-pre.5/LICENSE.txt */
81
- /* Built timestamp: Tue, 13 Dec 2022 16:04:08 GMT */
80
+ /* Build timestamp: Mon, 16 Jan 2023 10:42:24 GMT */
81
+ /* The Azure Maps fork of MapLibre GL JS is licensed under the 3-Clause BSD License. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v3.0.0-pre.6/LICENSE.txt */
82
82
  (function (global, factory) {
83
83
  module.exports = factory() ;
84
84
  })(commonjsGlobal, (function () {
@@ -21405,6 +21405,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21405
21405
  }
21406
21406
  workerTile.vectorTile = response.vectorTile;
21407
21407
  workerTile.parse(response.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {
21408
+ const reloadCallback = workerTile.reloadCallback;
21409
+ if (workerTile.reloadCallback) {
21410
+ delete workerTile.reloadCallback;
21411
+ workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, reloadCallback);
21412
+ }
21408
21413
  if (err || !result)
21409
21414
  return callback(err);
21410
21415
  // Transferring a copy of rawTileData because the worker needs to retain its copy.
@@ -23878,7 +23883,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
23878
23883
  var packageJSON = {
23879
23884
  "name": "azuremaps-maplibre-gl",
23880
23885
  "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
23881
- "version": "3.0.0-pre.5",
23886
+ "version": "3.0.0-pre.6",
23882
23887
  "main": "dist/azuremaps-maplibre-gl.js",
23883
23888
  "style": "dist/azuremaps-maplibre-gl.css",
23884
23889
  "license": "BSD-3-Clause",
@@ -23968,7 +23973,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
23968
23973
  "eslint-plugin-jest": "^27.1.6",
23969
23974
  "eslint-plugin-jsdoc": "^39.6.4",
23970
23975
  "eslint-plugin-react": "^7.31.11",
23971
- "gl": "^6.0.1",
23976
+ "gl": "^6.0.2",
23972
23977
  "glob": "^8.0.3",
23973
23978
  "is-builtin-module": "^3.2.0",
23974
23979
  "jest": "^28.1.3",
@@ -46380,7 +46385,7 @@ uniform ${precision} ${type} u_${name};
46380
46385
  msClientIdHeaderName: "x-ms-client-id",
46381
46386
  msOriginHeaderName: "Ms-Am-Request-Origin",
46382
46387
  msOriginHeaderValue: "MapControl",
46383
- resourceId: "https://atlas.microsoft.com/",
46388
+ aadResourceId: "https://atlas.microsoft.com/.default",
46384
46389
  sessionIdHeaderName: "Session-Id"
46385
46390
  };
46386
46391
 
@@ -46558,7 +46563,7 @@ uniform ${precision} ${type} u_${name};
46558
46563
  return Url;
46559
46564
  }());
46560
46565
 
46561
- var version = "3.0.0-preview.2";
46566
+ var version = "3.0.0-preview.3";
46562
46567
 
46563
46568
  /**
46564
46569
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -60949,6 +60954,10 @@ uniform ${precision} ${type} u_${name};
60949
60954
  defaultRegion: {
60950
60955
  code: "NGT",
60951
60956
  strings: "en/resource.json"
60957
+ },
60958
+ latn: {
60959
+ code: "NGT-Latn",
60960
+ strings: "en/resource.json"
60952
60961
  }
60953
60962
  },
60954
60963
  ar: {
@@ -60995,6 +61004,18 @@ uniform ${precision} ${type} u_${name};
60995
61004
  us: {
60996
61005
  code: "en-US",
60997
61006
  strings: "en/resource.json"
61007
+ },
61008
+ au: {
61009
+ code: "en-AU",
61010
+ strings: "en/resource.json"
61011
+ },
61012
+ gb: {
61013
+ code: "en-GB",
61014
+ strings: "en/resource.json"
61015
+ },
61016
+ nz: {
61017
+ code: "en-NZ",
61018
+ strings: "en/resource.json"
60998
61019
  }
60999
61020
  },
61000
61021
  es: {
@@ -61120,14 +61141,31 @@ uniform ${precision} ${type} u_${name};
61120
61141
  }
61121
61142
  },
61122
61143
  zh: {
61144
+ // per https://microsoft.sharepoint.com/sites/globalreadiness/SitePages/Language-fallback.aspx
61145
+ // Chinese - Neutral (zh) fallbacks to en-US
61123
61146
  defaultRegion: {
61124
- code: "zh-Hant",
61125
- strings: "zh-tw/resource.json"
61147
+ code: "zh",
61148
+ strings: "en/resource.json"
61149
+ }
61150
+ },
61151
+ "zh-hans": {
61152
+ defaultRegion: {
61153
+ code: "zh-Hans",
61154
+ strings: "zh-cn/resource.json"
61155
+ },
61156
+ cn: {
61157
+ code: "zh-Hans-CN",
61158
+ strings: "zh-cn/resource.json"
61126
61159
  }
61127
61160
  },
61128
61161
  "zh-hant": {
61162
+ // per discussion with global readiness team, we were explicitly asked to not fallback zh-hant to zh-tw
61129
61163
  defaultRegion: {
61130
61164
  code: "zh-Hant",
61165
+ strings: "en/resource.json"
61166
+ },
61167
+ tw: {
61168
+ code: "zh-Hant-TW",
61131
61169
  strings: "zh-tw/resource.json"
61132
61170
  }
61133
61171
  }
@@ -61374,7 +61412,7 @@ uniform ${precision} ${type} u_${name};
61374
61412
  /**
61375
61413
  * The AAD implicit grant mechanism. Recommended for pages protected by a sign-in.
61376
61414
  * By default the page will be redirected to the AAD login when the map control initializes.
61377
- * Specify a logged-in `AuthenticationContext` in the `AuthenticationOptions`
61415
+ * Specify a logged-in `PublicClientApplication` in the `AuthenticationOptions`
61378
61416
  * for greater control over when/how the users signs in.
61379
61417
  * Literal value `"aad"`
61380
61418
  */
@@ -61439,7 +61477,7 @@ uniform ${precision} ${type} u_${name};
61439
61477
  */
61440
61478
  _this.sasToken = undefined;
61441
61479
  /**
61442
- * Optionally provide an existing `AuthenticationContext` from the ADAL.js library.
61480
+ * Optionally provide an existing `PublicClientApplication` from the MSAL.js library.
61443
61481
  * This authentication context will be used to acquire the AAD token.
61444
61482
  * Only used with the AAD authentication type.
61445
61483
  * This auth context must be configured to use the same AAD app ID as `this.aadAppId`.
@@ -61462,7 +61500,7 @@ uniform ${precision} ${type} u_${name};
61462
61500
  * @param aadAppId Azure AD App ID
61463
61501
  * @param aadTenant Azure AD Tenant Name
61464
61502
  * @param aadInstance An optional Azure AD Instance
61465
- * @param authContext An optional `AuthenticationContext` from the ADAL.js library
61503
+ * @param authContext An optional `PublicClientApplication` from the MSAL.js library
61466
61504
  */
61467
61505
  AuthenticationOptions.prototype.setAadProperties = function (clientId, aadAppId, aadTenant, aadInstance, authContext) {
61468
61506
  this.authType = exports.AuthenticationType.aad;
@@ -61756,7 +61794,7 @@ uniform ${precision} ${type} u_${name};
61756
61794
  /**
61757
61795
  * 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.
61758
61796
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews }.
61759
- * 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.
61797
+ * 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.
61760
61798
  * @param view The new default view
61761
61799
  */
61762
61800
  function setView(view) {
@@ -65750,7 +65788,7 @@ uniform ${precision} ${type} u_${name};
65750
65788
  /**
65751
65789
  * 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.
65752
65790
  * Please see the supported [Views]{@link https://aka.ms/AzureMapsLocalizationViews}
65753
- * 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.
65791
+ * 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.
65754
65792
  * default: `undefined`
65755
65793
  * @default undefined
65756
65794
  */
@@ -66382,6 +66420,13 @@ uniform ${precision} ${type} u_${name};
66382
66420
  * Preserve the map configuration that was used before the indoor map configuration was set
66383
66421
  */
66384
66422
  this.preservedPreindoorMapConfiguration = undefined;
66423
+ /**
66424
+ * The state of the progressive loading
66425
+ */
66426
+ this._progressiveLoadingState = {
66427
+ mapStyle: undefined,
66428
+ pendingVisibilityChange: undefined,
66429
+ };
66385
66430
  this._deferLayerGroupVisibilities = function (layerGroupLayers, initLayerGroups) {
66386
66431
  var validInitLayerGroups = initLayerGroups.filter(function (groupName) { return groupName in layerGroupLayers; });
66387
66432
  // If the initial layer groups are invalid, skip the progressive loading.
@@ -66389,7 +66434,15 @@ uniform ${precision} ${type} u_${name};
66389
66434
  return;
66390
66435
  var map = _this.map._getMap();
66391
66436
  var currentZoomLevel = map.getZoom();
66392
- // Select the layers to be deferred
66437
+ var currentMapStyle = _this.map.getStyle().style;
66438
+ // Cancel and release previous pending callback, if any.
66439
+ if (_this._progressiveLoadingState.pendingVisibilityChange) {
66440
+ _this.map.events.remove('load', _this._progressiveLoadingState.pendingVisibilityChange);
66441
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
66442
+ }
66443
+ // Keep the current map style for future comparison.
66444
+ _this._progressiveLoadingState.mapStyle = currentMapStyle;
66445
+ // Select deferrable layers
66393
66446
  var deferredLayers = Object.entries(layerGroupLayers).reduce(function (deferred, _a) {
66394
66447
  var _b = __read$c(_a, 2), groupName = _b[0], layers = _b[1];
66395
66448
  var isInInitialLayerGroup = validInitLayerGroups.includes(groupName);
@@ -66416,22 +66469,34 @@ uniform ${precision} ${type} u_${name};
66416
66469
  return false;
66417
66470
  }
66418
66471
  }
66419
- // Defer visible layers only.
66472
+ // Select visible layers only.
66420
66473
  return ((_a = layer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
66421
66474
  })));
66422
66475
  }, []);
66423
- // Hide the deferred layers at initial load, therefore we can save the render time.
66476
+ // Hide the deferrable layers at initial load, therefore we can save the render time.
66424
66477
  deferredLayers.forEach(function (layer) {
66478
+ // Since this happens before sending style object into the map rendering,
66479
+ // we only need to update the style object, but not necessary to update maplibre's layout properties.
66425
66480
  layer.layout = layer.layout || {};
66426
66481
  layer.layout.visibility = 'none';
66427
66482
  });
66428
- // Make the deferred layers visible once the map instance is fully loaded
66429
- _this.map.events.addOnce('load', function () {
66483
+ // Make the deferred layers visible once the map instance is fully loaded.
66484
+ _this._progressiveLoadingState.pendingVisibilityChange = function () {
66485
+ // Release the callback.
66486
+ _this._progressiveLoadingState.pendingVisibilityChange = null;
66487
+ // Bail out the callback once map style has changed.
66488
+ var nextMapStyle = _this.map.getStyle().style;
66489
+ if (currentMapStyle !== nextMapStyle)
66490
+ return;
66491
+ // Make deferred layers visible
66430
66492
  deferredLayers.forEach(function (layer) {
66493
+ // This happens after the map rendering; Therefore, we need to update
66494
+ // both the style object and the maplibre's layout properties.
66431
66495
  layer.layout.visibility = 'visible';
66432
66496
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
66433
66497
  });
66434
- });
66498
+ };
66499
+ _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
66435
66500
  };
66436
66501
  this._onStyleData = function () {
66437
66502
  _this._lookUpAsync(_this.map.getStyle()).then(function (style) {
@@ -66623,19 +66688,7 @@ uniform ${precision} ${type} u_${name};
66623
66688
  // should be modified before they are applied to the map.
66624
66689
  var styleOptions = this.map.getStyle();
66625
66690
  var trafficOptions = this.map.getTraffic();
66626
- return __assign$8(__assign$8({}, nextStyle), {
66627
- // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
66628
- sources: Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
66629
- var _b = __read$c(_a, 2), sourceKey = _b[0], source = _b[1];
66630
- var newSource = __assign$8({}, source);
66631
- if ('url' in newSource && typeof newSource.url === 'string') {
66632
- if (newSource.url.includes(constants.languagePlaceHolder)) {
66633
- newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
66634
- }
66635
- }
66636
- newSources[sourceKey] = newSource;
66637
- return newSources;
66638
- }, {}), layers: nextStyle.layers.map(function (layer) {
66691
+ return __assign$8(__assign$8({}, nextStyle), { layers: nextStyle.layers.map(function (layer) {
66639
66692
  var _a, _b, _c, _d, _e, _f;
66640
66693
  var nextLayer = __assign$8({}, layer);
66641
66694
  var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
@@ -66721,7 +66774,9 @@ uniform ${precision} ${type} u_${name};
66721
66774
  this.map._getMap().setStyle(this.getStyle(styleOptions), {
66722
66775
  diff: diff,
66723
66776
  validate: this.serviceOptions.validateStyle,
66724
- transformStyle: function (previousStyle, nextStyle) {
66777
+ transformStyle: function (previousStyle, style) {
66778
+ // Deep clone a style object to avoid side-effects from object mutation.
66779
+ var nextStyle = cloneDeep_1(style);
66725
66780
  // 1. derive the base new style (without user layers)
66726
66781
  var targetStyle = _this.deriveNewStyle(previousStyle, nextStyle);
66727
66782
  // 2. derive layer groups for the new style
@@ -67301,6 +67356,12 @@ uniform ${precision} ${type} u_${name};
67301
67356
  };
67302
67357
  throw new Error(JSON.stringify(errorDetails));
67303
67358
  }
67359
+ if ('pitch' in options) {
67360
+ mapboxCameraOptions.pitch = options.pitch;
67361
+ }
67362
+ if ('bearing' in options) {
67363
+ mapboxCameraOptions.bearing = options.bearing;
67364
+ }
67304
67365
  this.map.setMaxZoom(cameraBoundsOptions.maxZoom);
67305
67366
  this._invokeEvent("maxzoomchanged", this.map.getMaxZoom());
67306
67367
  maxBounds = this._generateSafeBounds(cameraBoundsOptions.maxBounds);
@@ -67423,8 +67484,9 @@ uniform ${precision} ${type} u_${name};
67423
67484
  // If this function is restructured such that a styledata event won't always trigger
67424
67485
  // if the language is changed, then either those delegates need changed
67425
67486
  // or the styledata event manually invoked.
67487
+ var noDiffOnLanguageViewChange = diff && (this.styleOptions.language === newOptions.language && this.styleOptions.view === newOptions.view);
67426
67488
  this.styleOptions = newOptions;
67427
- this._setStyleComponents(newOptions, diff);
67489
+ this._setStyleComponents(newOptions, noDiffOnLanguageViewChange);
67428
67490
  };
67429
67491
  /**
67430
67492
  * Returns the map control's current style settings.