azure-maps-control 3.0.0 → 3.0.2

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.
@@ -263,7 +263,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
263
263
  return Url;
264
264
  }());
265
265
 
266
- var version = "3.0.0";
266
+ var version = "3.0.2";
267
267
 
268
268
  /**
269
269
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -359,9 +359,18 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
359
359
  top = top - parentRect.y;
360
360
  }
361
361
  tooltip.style.transform = "translate(".concat(left, "px, ").concat(top, "px)");
362
+ tooltip.style.display = "block";
363
+ };
364
+ // Accessibility: tooltip should be dismissible with the escape key
365
+ var dismissTooltip = function (event) {
366
+ if ((event.key === "Escape" || event.key === "Esc") && tooltip.style.display === "block") {
367
+ event.stopPropagation();
368
+ tooltip.style.display = "none";
369
+ }
362
370
  };
363
371
  eventTarget.addEventListener("mouseover", positionTooltip);
364
372
  eventTarget.addEventListener("focusin", positionTooltip);
373
+ eventTarget.addEventListener("keydown", dismissTooltip);
365
374
  };
366
375
 
367
376
  var __extends$1e = (window && window.__extends) || (function () {
@@ -5380,9 +5389,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
5380
5389
  if (this.trafficButton) {
5381
5390
  if (this.isActive) {
5382
5391
  this.container.classList.add("in-use");
5392
+ this.trafficButton.setAttribute("aria-description", "Traffic is displayed");
5383
5393
  }
5384
5394
  else {
5385
5395
  this.container.classList.remove("in-use");
5396
+ this.trafficButton.removeAttribute("aria-description");
5386
5397
  }
5387
5398
  this.trafficButton.setAttribute("aria-pressed", this.isActive ? "true" : "false");
5388
5399
  }
@@ -19510,7 +19521,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
19510
19521
  return undefined;
19511
19522
  };
19512
19523
  /**
19513
- * Removes all user added layers from the map.
19524
+ * Removes all layers from the map.
19514
19525
  */
19515
19526
  LayerManager.prototype.clear = function () {
19516
19527
  for (var layerIndexIndex = this.layerIndex.length - 1; layerIndexIndex >= 0; layerIndexIndex--) {
@@ -21241,10 +21252,10 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21241
21252
  /**
21242
21253
  * Disable telemetry collection
21243
21254
  * This option may only be set when initializing the map.
21244
- * default: false
21255
+ * default: false (true for the Azure Government cloud)
21245
21256
  * @default false
21246
21257
  */
21247
- _this.disableTelemetry = false;
21258
+ _this.disableTelemetry = getDomain() === "atlas.azure.us";
21248
21259
  /**
21249
21260
  * Disable telemetry collection
21250
21261
  * This option may only be set when initializing the map.
@@ -21830,6 +21841,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21830
21841
  });
21831
21842
  // Make the deferred layers visible once the map instance is fully loaded.
21832
21843
  _this._progressiveLoadingState.pendingVisibilityChange = function () {
21844
+ var _a;
21833
21845
  // Release the callback.
21834
21846
  _this._progressiveLoadingState.pendingVisibilityChange = null;
21835
21847
  // Bail out the callback once map style has changed.
@@ -21843,6 +21855,8 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
21843
21855
  layer.layout.visibility = 'visible';
21844
21856
  map.setLayoutProperty(layer.id, 'visibility', 'visible');
21845
21857
  });
21858
+ // Reload attribution after the deferred layers are visible.
21859
+ (_a = _this.map.copyrightDelegate) === null || _a === void 0 ? void 0 : _a.reloadAttribution();
21846
21860
  };
21847
21861
  _this.map.events.addOnce('load', _this._progressiveLoadingState.pendingVisibilityChange);
21848
21862
  };
@@ -22341,36 +22355,37 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22341
22355
  params.url = targetUrl.href;
22342
22356
  }
22343
22357
  (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(params);
22358
+ // Delete auth token for static assets to allow AFD caching
22359
+ this._deleteAuthTokenForStaticAssets(params);
22344
22360
  }
22345
22361
  };
22346
22362
  /**
22347
22363
  * Fetches a json resource at the specified domain and path.
22348
22364
  */
22349
22365
  StyleManager.prototype._request = function (domain, path, resourceType, customQueryParams) {
22350
- var _a, _b;
22366
+ var _a;
22351
22367
  if (customQueryParams === void 0) { customQueryParams = {}; }
22352
22368
  return __awaiter$1(this, void 0, void 0, function () {
22353
22369
  var requestParams, fetchOptions;
22354
- var _c;
22355
- return __generator$1(this, function (_d) {
22356
- switch (_d.label) {
22370
+ var _b;
22371
+ return __generator$1(this, function (_c) {
22372
+ switch (_c.label) {
22357
22373
  case 0:
22358
22374
  requestParams = {
22359
22375
  url: new Url({
22360
22376
  protocol: "https",
22361
22377
  domain: domain,
22362
22378
  path: path,
22363
- queryParams: __assign$1((_c = {}, _c[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion,
22364
- // Generate a hash code to avoid cache conflict
22365
- // TODO: Remove this once style version 2023-01-01 is publicly available
22366
- _c.hash = StyleManager._hashCode((_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.getToken()), _c), customQueryParams)
22379
+ queryParams: __assign$1((_b = {}, _b[constants.apiVersionQueryParameter] = this.serviceOptions.styleAPIVersion, _b), customQueryParams)
22367
22380
  }).toString()
22368
22381
  };
22369
22382
  if (typeof this.serviceOptions.transformRequest === "function" && resourceType) {
22370
22383
  // If a transformRequest(...) was specified use it.
22371
22384
  requestParams = this.serviceOptions.transformRequest(requestParams.url, resourceType);
22372
22385
  }
22373
- (_b = this.map.authentication) === null || _b === void 0 ? void 0 : _b.signRequest(requestParams);
22386
+ (_a = this.map.authentication) === null || _a === void 0 ? void 0 : _a.signRequest(requestParams);
22387
+ // Delete auth token for static assets to allow AFD caching
22388
+ this._deleteAuthTokenForStaticAssets(requestParams);
22374
22389
  fetchOptions = {
22375
22390
  method: "GET",
22376
22391
  mode: "cors",
@@ -22387,25 +22402,26 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
22387
22402
  throw new Error("HTTP ".concat(response.status, ": ").concat(response.statusText, " "));
22388
22403
  }
22389
22404
  })];
22390
- case 1: return [2 /*return*/, _d.sent()];
22405
+ case 1: return [2 /*return*/, _c.sent()];
22391
22406
  }
22392
22407
  });
22393
22408
  });
22394
22409
  };
22395
22410
  /**
22396
- * A basic helper function to generate a hash from an input string.
22411
+ * Delete auth token for static assets to allow AFD caching.
22397
22412
  */
22398
- StyleManager._hashCode = function (str) {
22399
- if (str === void 0) { str = ""; }
22400
- var chr, hash = 0;
22401
- if (!str)
22402
- return hash;
22403
- for (var i = 0; i < str.length; i++) {
22404
- chr = str.charCodeAt(i);
22405
- hash = (hash << 5) - hash + chr;
22406
- hash |= 0; // Convert to 32bit integer
22413
+ StyleManager.prototype._deleteAuthTokenForStaticAssets = function (params) {
22414
+ // The following resources are considered as static assets.
22415
+ // StyleSet /styling/styles
22416
+ // Style /styling/styles/*
22417
+ // Thumbnail /styling/styles/*/thumbnail.png
22418
+ // Sprite PNG /styling/sprites/*/sprite@2x.png
22419
+ // Sprite JSON /styling/sprites/*/sprite@2x.json
22420
+ // Glyph /styling/glyphs/*/0-255.pbf
22421
+ if (params.url.startsWith("https://".concat(this.serviceOptions.staticAssetsDomain, "/").concat(constants.stylePath))) {
22422
+ delete params.headers[constants.msClientIdHeaderName];
22423
+ delete params.headers[constants.authorizationHeaderName];
22407
22424
  }
22408
- return hash;
22409
22425
  };
22410
22426
  return StyleManager;
22411
22427
  }());
@@ -23607,7 +23623,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
23607
23623
  this.dispose();
23608
23624
  };
23609
23625
  /**
23610
- * Removes all user added sources, layers, markers, and popups from the map.
23626
+ * Removes all sources, layers, markers, and popups from the map.
23611
23627
  * User added images are preserved.
23612
23628
  */
23613
23629
  Map.prototype.clear = function () {