azure-maps-control 2.2.2 → 3.0.0-preview.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.
@@ -56,9 +56,9 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
56
56
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('azuremaps-maplibre-gl')) :
57
57
  typeof define === 'function' && define.amd ? define(['exports', 'azuremaps-maplibre-gl'], factory) :
58
58
  (global = global || self, factory(global.atlas = global.atlas || {}, global.maplibregl));
59
- }(this, (function (exports, mapboxgl) { 'use strict';
59
+ }(this, (function (exports, maplibregl) { 'use strict';
60
60
 
61
- var mapboxgl__default = 'default' in mapboxgl ? mapboxgl['default'] : mapboxgl;
61
+ maplibregl = maplibregl && Object.prototype.hasOwnProperty.call(maplibregl, 'default') ? maplibregl['default'] : maplibregl;
62
62
 
63
63
  var env = {
64
64
  domain: "atlas.microsoft.com",
@@ -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 = "2.2.2";
268
+ var version = "3.0.0-preview.2";
269
269
 
270
270
  /**
271
271
  * A helper class that provides methods for getting various forms of the map controls current version.
@@ -2881,11 +2881,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
2881
2881
  * _.keysIn(new Foo);
2882
2882
  * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
2883
2883
  */
2884
- function keysIn$1(object) {
2884
+ function keysIn(object) {
2885
2885
  return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
2886
2886
  }
2887
2887
 
2888
- var keysIn_1 = keysIn$1;
2888
+ var keysIn_1 = keysIn;
2889
2889
 
2890
2890
  /**
2891
2891
  * The base implementation of `_.assignIn` without support for multiple sources
@@ -3664,7 +3664,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
3664
3664
 
3665
3665
  var keysFunc = isFull
3666
3666
  ? (isFlat ? _getAllKeysIn : _getAllKeys)
3667
- : (isFlat ? keysIn : keys_1);
3667
+ : (isFlat ? keysIn_1 : keys_1);
3668
3668
 
3669
3669
  var props = isArr ? undefined : keysFunc(value);
3670
3670
  _arrayEach(props || value, function(subValue, key) {
@@ -5263,10 +5263,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
5263
5263
  if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
5264
5264
  return false;
5265
5265
  }
5266
- // Assume cyclic values are equal.
5267
- var stacked = stack.get(array);
5268
- if (stacked && stack.get(other)) {
5269
- return stacked == other;
5266
+ // Check that cyclic values are equal.
5267
+ var arrStacked = stack.get(array);
5268
+ var othStacked = stack.get(other);
5269
+ if (arrStacked && othStacked) {
5270
+ return arrStacked == other && othStacked == array;
5270
5271
  }
5271
5272
  var index = -1,
5272
5273
  result = true,
@@ -5501,10 +5502,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
5501
5502
  return false;
5502
5503
  }
5503
5504
  }
5504
- // Assume cyclic values are equal.
5505
- var stacked = stack.get(object);
5506
- if (stacked && stack.get(other)) {
5507
- return stacked == other;
5505
+ // Check that cyclic values are equal.
5506
+ var objStacked = stack.get(object);
5507
+ var othStacked = stack.get(other);
5508
+ if (objStacked && othStacked) {
5509
+ return objStacked == other && othStacked == object;
5508
5510
  }
5509
5511
  var result = true;
5510
5512
  stack.set(object, other);
@@ -14153,7 +14155,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14153
14155
  if (options.anchor === "none") {
14154
14156
  this.autoAnchor = autoAnchor || "bottom";
14155
14157
  this.containerDiv.classList.add(this.autoAnchor);
14156
- marker = new mapboxgl.Marker({
14158
+ marker = new maplibregl.Marker({
14157
14159
  anchor: this.autoAnchor,
14158
14160
  element: this.containerDiv,
14159
14161
  offset: options.pixelOffset,
@@ -14161,7 +14163,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14161
14163
  }
14162
14164
  else {
14163
14165
  this.containerDiv.classList.add(options.anchor);
14164
- marker = new mapboxgl.Marker({
14166
+ marker = new maplibregl.Marker({
14165
14167
  anchor: options.anchor,
14166
14168
  element: this.containerDiv,
14167
14169
  offset: options.pixelOffset,
@@ -14557,7 +14559,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
14557
14559
  if (!options.visible) {
14558
14560
  this.element.classList.add(HtmlMarker.hiddenClass);
14559
14561
  }
14560
- this.marker = new mapboxgl.Marker({
14562
+ this.marker = new maplibregl.Marker({
14561
14563
  element: this.element,
14562
14564
  offset: options.pixelOffset,
14563
14565
  draggable: options.draggable,
@@ -15302,13 +15304,13 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15302
15304
  * Gets the worker count that will get created.
15303
15305
  */
15304
15306
  function getWorkerCount() {
15305
- return mapboxgl__default.workerCount;
15307
+ return maplibregl.workerCount;
15306
15308
  }
15307
15309
  /**
15308
15310
  * Gets the Maximum number of images (raster tiles, sprites, icons) to load in parallel
15309
15311
  */
15310
15312
  function getMaxParallelImageRequests() {
15311
- return mapboxgl__default.maxParallelImageRequests;
15313
+ return maplibregl.maxParallelImageRequests;
15312
15314
  }
15313
15315
  /**
15314
15316
  * Gets the default language that was provided.
@@ -15361,7 +15363,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15361
15363
  if (UserAgent.isIE()) {
15362
15364
  return false;
15363
15365
  }
15364
- return mapboxgl__default.supported({
15366
+ return maplibregl.supported({
15365
15367
  failIfMajorPerformanceCaveat: failIfMajorPerformanceCaveat
15366
15368
  });
15367
15369
  }
@@ -15420,7 +15422,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15420
15422
  */
15421
15423
  function setWorkerCount(workerCount) {
15422
15424
  if (workerCount > 0) {
15423
- mapboxgl__default.workerCount = workerCount;
15425
+ maplibregl.workerCount = workerCount;
15424
15426
  hasWorkerCount = true;
15425
15427
  }
15426
15428
  }
@@ -15431,7 +15433,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15431
15433
  */
15432
15434
  function setMaxParallelImageRequests(maxParallelImageRequests) {
15433
15435
  if (maxParallelImageRequests > 0) {
15434
- mapboxgl__default.maxParallelImageRequests = maxParallelImageRequests;
15436
+ maplibregl.maxParallelImageRequests = maxParallelImageRequests;
15435
15437
  hasMaxParallelImageRequests = true;
15436
15438
  }
15437
15439
  }
@@ -15546,7 +15548,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15546
15548
  * created and destroyed.
15547
15549
  */
15548
15550
  function prewarm() {
15549
- mapboxgl__default.prewarm();
15551
+ maplibregl.prewarm();
15550
15552
  }
15551
15553
  /**
15552
15554
  * Clears up resources that have previously been created by `atlas.prewarm()`.
@@ -15555,7 +15557,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
15555
15557
  * in your application.
15556
15558
  */
15557
15559
  function clearPrewarmedResources() {
15558
- mapboxgl__default.clearPrewarmedResources();
15560
+ maplibregl.clearPrewarmedResources();
15559
15561
  }
15560
15562
  /**
15561
15563
  * Returns if authentication options are set.
@@ -17326,6 +17328,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
17326
17328
  40
17327
17329
  ];
17328
17330
  // accessibility recommendation: After using any of the map shortcut keys, NVDA should not read all the shortcut keys again.
17331
+ // // TODO: this should be this.map._getMap().getCanvas
17329
17332
  var mapCanvas = _this.map._getMap()._canvas;
17330
17333
  mapCanvas === null || mapCanvas === void 0 ? void 0 : mapCanvas.addEventListener('keyup', function (event) {
17331
17334
  if (baseShortcutKeyCodes.find(function (code) { return event.keyCode === code; })) {
@@ -27471,10 +27474,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
27471
27474
  */
27472
27475
  LayerGroupComparator.getLayerGroup = function (layer) {
27473
27476
  var _a;
27474
- if ((layer === null || layer === void 0 ? void 0 : layer.metadata) && layer.metadata['microsoft.maps:layerGroup']) {
27475
- return layer.metadata['microsoft.maps:layerGroup'];
27477
+ var layerObject = layer;
27478
+ if ((layerObject === null || layerObject === void 0 ? void 0 : layerObject.metadata) && layerObject.metadata['microsoft.maps:layerGroup']) {
27479
+ return layerObject.metadata['microsoft.maps:layerGroup'];
27476
27480
  }
27477
- var layerId = (_a = layer === null || layer === void 0 ? void 0 : layer.id) !== null && _a !== void 0 ? _a : layer;
27481
+ var layerId = (_a = layerObject === null || layerObject === void 0 ? void 0 : layerObject.id) !== null && _a !== void 0 ? _a : layer;
27478
27482
  if (!layerId.startsWith("microsoft.")) {
27479
27483
  return undefined;
27480
27484
  }
@@ -27928,16 +27932,163 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
27928
27932
  }
27929
27933
  throw Error("Style definition does not contain neither URL nor style object.");
27930
27934
  };
27935
+ StyleManager.prototype.deriveNewStyle = function (previousStyle, nextStyle) {
27936
+ // Layers in the next style with default properties that do not align with current StyleOptions
27937
+ // should be modified before they are applied to the map.
27938
+ var styleOptions = this.map.getStyle();
27939
+ var trafficOptions = this.map.getTraffic();
27940
+ return __assign$8(__assign$8({}, nextStyle), {
27941
+ // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
27942
+ sources: Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
27943
+ var _b = __read$e(_a, 2), sourceKey = _b[0], source = _b[1];
27944
+ var newSource = __assign$8({}, source);
27945
+ if ('url' in newSource && typeof newSource.url === 'string') {
27946
+ if (newSource.url.includes(constants.languagePlaceHolder)) {
27947
+ newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
27948
+ }
27949
+ }
27950
+ newSources[sourceKey] = newSource;
27951
+ return newSources;
27952
+ }, {}), layers: nextStyle.layers.map(function (layer) {
27953
+ var _a, _b, _c, _d, _e, _f;
27954
+ var nextLayer = __assign$8({}, layer);
27955
+ var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
27956
+ if (!layerGroup) {
27957
+ return nextLayer;
27958
+ }
27959
+ // 1. Set visiblity of fill-extrusion layers according to StyleOptions.showBuildingModels
27960
+ if (!styleOptions.showBuildingModels && nextLayer.type === "fill-extrusion") {
27961
+ nextLayer.layout = (_a = nextLayer.layout) !== null && _a !== void 0 ? _a : {};
27962
+ nextLayer.layout.visibility = "none";
27963
+ }
27964
+ else if (nextLayer.type === "fill-extrusion") {
27965
+ nextLayer.layout = (_b = nextLayer.layout) !== null && _b !== void 0 ? _b : {};
27966
+ nextLayer.layout.visibility = "visible";
27967
+ }
27968
+ // 2. Set visibility of traffic layers depending on traffic settings.
27969
+ if (trafficOptions.flow !== "none" && layerGroup) {
27970
+ if (layerGroup === "traffic_" + trafficOptions.flow && nextLayer.type == "line") {
27971
+ nextLayer.layout = (_c = nextLayer.layout) !== null && _c !== void 0 ? _c : {};
27972
+ nextLayer.layout.visibility = "visible";
27973
+ }
27974
+ }
27975
+ // 3. Set visibility of labels
27976
+ var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
27977
+ if (isLabelLayerGroup && nextLayer.type === 'symbol') {
27978
+ if (styleOptions.showLabels && ((_d = nextLayer.layout) === null || _d === void 0 ? void 0 : _d.visibility) !== "none") {
27979
+ nextLayer.layout = (_e = nextLayer.layout) !== null && _e !== void 0 ? _e : {};
27980
+ nextLayer.layout.visibility = "visible";
27981
+ }
27982
+ else {
27983
+ nextLayer.layout = (_f = nextLayer.layout) !== null && _f !== void 0 ? _f : {};
27984
+ nextLayer.layout.visibility = "none";
27985
+ }
27986
+ }
27987
+ return nextLayer;
27988
+ }) });
27989
+ };
27990
+ StyleManager.prototype.injectUserLayersIntoStyle = function (previousStyle, nextStyle, layerGroupLayers) {
27991
+ // Custom layers added to mapbox through this SDK should be carried over to the next style.
27992
+ return !previousStyle
27993
+ ? nextStyle
27994
+ : this.map.layers._getUserLayers().reduce(function (style, userLayer) {
27995
+ if (userLayer.layer instanceof WebGLLayer) {
27996
+ // mapbox custom layers cannot be serialized and preserved,
27997
+ // return to continue to the next user layer.
27998
+ return style;
27999
+ }
28000
+ var before = layerGroupLayers[userLayer.before] && layerGroupLayers[userLayer.before].length > 0
28001
+ ? layerGroupLayers[userLayer.before][0]
28002
+ : undefined;
28003
+ var layer = previousStyle.layers.find(function (layer) { return layer.id === userLayer.layer.getId(); });
28004
+ // when setStyle diff attempt is unsuccesful, _load will be called on the style that may have already injected user layers -> clean it up
28005
+ var existingLayerIdx = nextStyle.layers.findIndex(function (layer) { return layer.id === userLayer.layer.getId(); });
28006
+ if (existingLayerIdx > -1) {
28007
+ nextStyle.layers.splice(existingLayerIdx, 1);
28008
+ }
28009
+ if (layer) {
28010
+ var sourcesToCopy = new Set(Array.from(userLayer.layer._getSourceIds())
28011
+ .map(function (sourceId) { return previousStyle.sources[sourceId] ? { source: previousStyle.sources[sourceId], id: sourceId } : undefined; })
28012
+ .filter(function (source) { return source !== undefined; }));
28013
+ var insertIdx = before ? style.layers.findIndex(function (layer) { return layer.id === before.id; }) : -1;
28014
+ if (insertIdx > -1) {
28015
+ style.layers.splice(insertIdx, 0, layer);
28016
+ }
28017
+ else {
28018
+ style.layers.push(layer);
28019
+ }
28020
+ sourcesToCopy.forEach(function (_a) {
28021
+ var source = _a.source, id = _a.id;
28022
+ style.sources[id] = source;
28023
+ });
28024
+ }
28025
+ return style;
28026
+ }, __assign$8({}, nextStyle));
28027
+ };
27931
28028
  /**
27932
28029
  * @internal
27933
28030
  */
27934
28031
  StyleManager.prototype.setStyle = function (styleOptions, diff) {
28032
+ var _this = this;
27935
28033
  if (diff === void 0) { diff = true; }
27936
28034
  try {
27937
28035
  this.map._getMap().setStyle(this.getStyle(styleOptions), {
27938
28036
  diff: diff,
27939
- stylePatch: this._stylePatch.bind(this),
27940
- validate: this.serviceOptions.validateStyle
28037
+ validate: this.serviceOptions.validateStyle,
28038
+ transformStyle: function (previousStyle, nextStyle) {
28039
+ // 1. derive the base new style (without user layers)
28040
+ var targetStyle = _this.deriveNewStyle(previousStyle, nextStyle);
28041
+ // 2. derive layer groups for the new style
28042
+ var layerGroupLayers = targetStyle.layers
28043
+ .map(function (nextLayer) { return ({ nextLayer: nextLayer, layerGroup: LayerGroupComparator.getLayerGroup(nextLayer) }); })
28044
+ .filter(function (_a) {
28045
+ var nextLayer = _a.nextLayer, layerGroup = _a.layerGroup;
28046
+ return layerGroup !== undefined;
28047
+ })
28048
+ .reduce(function (layerGroupLayers, _a) {
28049
+ var _b;
28050
+ var nextLayer = _a.nextLayer, layerGroup = _a.layerGroup;
28051
+ return (__assign$8(__assign$8({}, layerGroupLayers), (_b = {}, _b[layerGroup] = layerGroup in layerGroupLayers ? __spreadArray$8(__spreadArray$8([], __read$e(layerGroupLayers[layerGroup])), [nextLayer]) : [nextLayer], _b)));
28052
+ }, {});
28053
+ // 3. side effect: progressively render map layers to the canvas to shorten the time to the first meaningful render.
28054
+ var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
28055
+ // The feature only effective at the initial load.
28056
+ !_this.map._isLoaded());
28057
+ if (shouldProgressiveLoading) {
28058
+ var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
28059
+ if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
28060
+ _this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
28061
+ }
28062
+ }
28063
+ // 4. copy user layers and sources from previous style into new one
28064
+ var targetStyleWithUserLayers = _this.injectUserLayersIntoStyle(previousStyle, nextStyle, layerGroupLayers);
28065
+ // 5. side effects: sync our control's LayerManager and SourceManager
28066
+ var nextFundamentalLayers = Object.entries(layerGroupLayers).map(function (_a) {
28067
+ var _b = __read$e(_a, 2), layerGroupId = _b[0], layers = _b[1];
28068
+ return _this._buildFundamentalLayerFrom(layers, layerGroupId);
28069
+ });
28070
+ var layerIndex = _this.map.layers._getUserLayers().reduce(function (layerIndex, userLayer) {
28071
+ var layerInsertIndex = userLayer.before ? layerIndex.findIndex(function (layer) { return layer.getId() === userLayer.before; }) : -1;
28072
+ if (layerInsertIndex > -1) {
28073
+ layerIndex.splice(layerInsertIndex, 0, userLayer.layer);
28074
+ }
28075
+ else {
28076
+ layerIndex.push(userLayer.layer);
28077
+ }
28078
+ return layerIndex;
28079
+ }, nextFundamentalLayers);
28080
+ _this.map.layers['layerIndex'] = layerIndex;
28081
+ _this.map.sources._syncSources(targetStyleWithUserLayers.sources);
28082
+ // 5. temporarily patch style data event
28083
+ // FIXME: below diffing will be soon fixed on the maplibre side
28084
+ // If there was a previous styledata change event attached, remove it.
28085
+ // When the sprite url changes between style changes then maplibre can't perform the diff
28086
+ // In such cases it recalculate the style again. Removing previous attached
28087
+ // event listener makes sure that style changed event is not fired twice in these cases.
28088
+ _this.map.events.remove("styledata", _this._onStyleData);
28089
+ _this.map.events.addOnce("styledata", _this._onStyleData);
28090
+ return targetStyleWithUserLayers;
28091
+ }
27941
28092
  });
27942
28093
  }
27943
28094
  catch (e) {
@@ -28007,145 +28158,6 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28007
28158
  StyleManager.prototype.clearStyleSet = function () {
28008
28159
  this.unsetIndoorState();
28009
28160
  };
28010
- /**
28011
- * Function invoked by mapbox after a style is fetched but before it is committed to the map state.
28012
- *
28013
- * @param previousStyle The current style.
28014
- * @param nextStyle The next style which is to be applied.
28015
- * @param preserveLayer Preserve a layer from the previous style in the next style.
28016
- * @param updatePaintProperty Modify paint properties of a layer in the next style before the style is applied.
28017
- * @param updateLayoutProperty Modify layout properties of a layer in the next style before the style is applied.
28018
- * @param updateFilter Modify filter property of a layer in the next style before the style is applied.
28019
- */
28020
- StyleManager.prototype._stylePatch = function (previousStyle, nextStyle, preserveLayer, updatePaintProperty, updateLayoutProperty, updateFilter) {
28021
- var _this = this;
28022
- // Layers in the next style with default properties that do not align with current StyleOptions
28023
- // should be modified before they are applied to the map.
28024
- var styleOptions = this.map.getStyle();
28025
- var trafficOptions = this.map.getTraffic();
28026
- // force a replacement of language placeholder in the tileset url to avoid resolution to a same cache with placeholders on language change
28027
- nextStyle.sources = Object.entries(nextStyle.sources).reduce(function (newSources, _a) {
28028
- var _b = __read$e(_a, 2), sourceKey = _b[0], source = _b[1];
28029
- var newSource = __assign$8({}, source);
28030
- if ('url' in newSource && typeof newSource.url === 'string') {
28031
- if (newSource.url.includes(constants.languagePlaceHolder)) {
28032
- newSource.url = newSource.url.replace(constants.languagePlaceHolder, styleOptions.language);
28033
- }
28034
- }
28035
- newSources[sourceKey] = newSource;
28036
- return newSources;
28037
- }, {});
28038
- var shouldProgressiveLoading = (styleOptions.progressiveLoading &&
28039
- // The feature only effective at the initial load.
28040
- !this.map._isLoaded());
28041
- var setLayerVisibility = function (layer, visibility) {
28042
- var _a;
28043
- if (!shouldProgressiveLoading) {
28044
- // No need to apply the visibility change to maplibre while progressive loading is enabled.
28045
- // This can save a lot of CPU time.
28046
- updateLayoutProperty(layer.id, 'visibility', visibility);
28047
- }
28048
- layer.layout = (_a = layer.layout) !== null && _a !== void 0 ? _a : {};
28049
- layer.layout.visibility = visibility;
28050
- };
28051
- var layerGroupLayers = {};
28052
- nextStyle.layers.forEach(function (nextLayer) {
28053
- var _a;
28054
- var layerGroup = LayerGroupComparator.getLayerGroup(nextLayer);
28055
- if (layerGroup) {
28056
- // Set visibility of fill-extrusion layers according to StyleOptions.showBuildingModels
28057
- if (nextLayer.type === 'fill-extrusion') {
28058
- setLayerVisibility(nextLayer, styleOptions.showBuildingModels ? 'visible' : 'none');
28059
- }
28060
- // Set visibility of traffic layers depending on traffic settings.
28061
- if (trafficOptions.flow !== 'none' &&
28062
- layerGroup === "traffic_" + trafficOptions.flow &&
28063
- nextLayer.type == 'line') {
28064
- setLayerVisibility(nextLayer, 'visible');
28065
- }
28066
- // Set visibility of labels
28067
- var isLabelLayerGroup = layerGroup === 'labels' || layerGroup === 'labels_places' || layerGroup === 'labels_indoor';
28068
- if (isLabelLayerGroup && nextLayer.type === 'symbol') {
28069
- var isLayerVisible = ((_a = nextLayer.layout) === null || _a === void 0 ? void 0 : _a.visibility) !== 'none';
28070
- setLayerVisibility(nextLayer, isLayerVisible && styleOptions.showLabels ? 'visible' : 'none');
28071
- }
28072
- // Once this _stylePatch returns control to maplibre the next style will be applied immediately in the same context.
28073
- // To avoid potential data races update LayerManager with new a new set of FundamentalMapLayers from here instead of
28074
- // waiting for a styledata.load event to trigger a sync in a different context.
28075
- if (layerGroupLayers[layerGroup]) {
28076
- layerGroupLayers[layerGroup].push(nextLayer);
28077
- }
28078
- else {
28079
- layerGroupLayers[layerGroup] = [nextLayer];
28080
- }
28081
- }
28082
- });
28083
- if (shouldProgressiveLoading) {
28084
- var initLayerGroups = styleOptions.progressiveLoadingInitialLayerGroups;
28085
- if (Array.isArray(initLayerGroups) && initLayerGroups.length > 0) {
28086
- this._deferLayerGroupVisibilities(layerGroupLayers, initLayerGroups);
28087
- }
28088
- }
28089
- // A FundamentalMapLayer (grouped layer) representation of the next style must be built.
28090
- var previousLayers = this.map.layers.getLayers();
28091
- var nextLayers = Object.entries(layerGroupLayers).map(function (_a) {
28092
- var _b = __read$e(_a, 2), layerGroupName = _b[0], layerGroupMapboxLayers = _b[1];
28093
- return _this._buildFundamentalLayerFrom(layerGroupMapboxLayers, layerGroupName);
28094
- });
28095
- // Update FundamentalMapLayers in LayerManager
28096
- var userLayers = this.map.layers._getUserLayers();
28097
- var layersToRemove = previousLayers.filter(function (c) {
28098
- return (nextLayers.findIndex(function (n) { return c.getId() === n.getId(); }) < 0 &&
28099
- userLayers.findIndex(function (n) { return c.getId() === n.layer.getId(); }) < 0);
28100
- });
28101
- var prevNextIntersection = nextLayers.filter(function (n) { return previousLayers.find(function (c) { return c.getId() === n.getId(); }); });
28102
- var ePrevNextIntersection = prevNextIntersection.entries();
28103
- var replace = ePrevNextIntersection.next();
28104
- nextLayers.forEach(function (newFundamentalLayer) {
28105
- if (replace.value && replace.value[1].getId() === newFundamentalLayer.getId()) {
28106
- // Replace the existing layer with this ID with the new one.
28107
- var insertBefore = previousLayers.findIndex(function (l) { return l.getId() === newFundamentalLayer.getId(); });
28108
- _this.map.layers.remove(newFundamentalLayer.getId());
28109
- _this.map.layers.add(newFundamentalLayer, previousLayers[insertBefore].getId());
28110
- replace = ePrevNextIntersection.next();
28111
- }
28112
- else {
28113
- if (replace.value) {
28114
- // Insert new layer before the next common layer.
28115
- _this.map.layers.add(newFundamentalLayer, replace.value[1]);
28116
- }
28117
- else {
28118
- _this.map.layers.add(newFundamentalLayer);
28119
- }
28120
- }
28121
- });
28122
- layersToRemove.forEach(function (layer) {
28123
- _this.map.layers.remove(layer);
28124
- });
28125
- // Layers added to mapbox through this SDK since loading the last style should be
28126
- // carried over to the next style.
28127
- userLayers.forEach(function (userLayer) {
28128
- if (userLayer.layer instanceof WebGLLayer) {
28129
- // mapbox custom layers cannot be serialized and preserved,
28130
- // return to continue to the next user layer.
28131
- return;
28132
- }
28133
- var before = undefined;
28134
- if (_this.map.layers.getLayerById(userLayer.before)) {
28135
- var beforeCandidates = _this.map.layers.getLayerById(userLayer.before)._buildLayers();
28136
- before = (beforeCandidates.length > 0) ? beforeCandidates[0] : undefined;
28137
- }
28138
- preserveLayer(userLayer.layer.getId(), before === null || before === void 0 ? void 0 : before.id);
28139
- _this.map.layers.move(userLayer.layer, userLayer.before);
28140
- });
28141
- this.map.sources._syncSources(nextStyle.sources);
28142
- // If there was a previous styledata change event attached, remove it.
28143
- // When the sprite url changes between style changes then mapbox can't perform the diff
28144
- // In such cases it recalculate the style again. Removing previous attached
28145
- // event listener makes sure that style changed event is not fired twice in these cases.
28146
- this.map.events.remove("styledata", this._onStyleData);
28147
- this.map.events.addOnce("styledata", this._onStyleData);
28148
- };
28149
28161
  StyleManager.prototype._buildFundamentalLayerFrom = function (layers, id) {
28150
28162
  if (layers && layers.length > 0) {
28151
28163
  var newLayer = new FundamentalMapLayer(layers, id);
@@ -28411,10 +28423,11 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28411
28423
  if (_this.serviceOptions.transformRequest) {
28412
28424
  merge_1(requestParams, _this.serviceOptions.transformRequest(requestParams.url, resourceType));
28413
28425
  }
28426
+ // TODO: fix type variation
28414
28427
  return requestParams;
28415
28428
  }
28416
28429
  };
28417
- mapboxMap = new mapboxgl__default.Map(mapboxMapOptions);
28430
+ mapboxMap = new maplibregl.Map(mapboxMapOptions);
28418
28431
  }
28419
28432
  try {
28420
28433
  _this.map = mapboxMap;
@@ -28582,6 +28595,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28582
28595
  */
28583
28596
  Map.prototype.removeRequestTransformer = function (transformer) { this.serviceOptions.removeTransformer(transformer); };
28584
28597
  Map.prototype.setCamera = function (options, fromControl) {
28598
+ var _a;
28585
28599
  if (fromControl === void 0) { fromControl = false; }
28586
28600
  var mapboxCameraOptions;
28587
28601
  var maxBounds;
@@ -28590,13 +28604,22 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
28590
28604
  var cameraBoundsOptions = new CameraBoundsOptions()
28591
28605
  .merge({ maxZoom: this.getCamera().maxZoom }, options);
28592
28606
  var bounds = this._generateSafeBounds(cameraBoundsOptions.bounds);
28593
- mapboxCameraOptions = this.map.cameraForBounds(bounds, {
28607
+ var cameraForBoundsOptions = {
28594
28608
  padding: cameraBoundsOptions.padding,
28595
28609
  offset: cameraBoundsOptions.offset,
28596
28610
  maxZoom: cameraBoundsOptions.maxZoom
28597
- });
28611
+ };
28612
+ mapboxCameraOptions = this.map.cameraForBounds(bounds, cameraForBoundsOptions);
28598
28613
  if (!mapboxCameraOptions) {
28599
- throw new Error("The map cannot be fit to the current canvas with the given CameraBoundsOptions.");
28614
+ var currentContainer = (_a = this.map) === null || _a === void 0 ? void 0 : _a.getContainer();
28615
+ var errorDetails = {
28616
+ message: "The map cannot be fit to the current canvas with the given CameraBoundsOptions.",
28617
+ containerWidth: currentContainer === null || currentContainer === void 0 ? void 0 : currentContainer.clientWidth,
28618
+ containerHeight: currentContainer === null || currentContainer === void 0 ? void 0 : currentContainer.clientHeight,
28619
+ safeBounds: bounds,
28620
+ cameraForBoundsOptions: cameraForBoundsOptions
28621
+ };
28622
+ throw new Error(JSON.stringify(errorDetails));
28600
28623
  }
28601
28624
  this.map.setMaxZoom(cameraBoundsOptions.maxZoom);
28602
28625
  this._invokeEvent("maxzoomchanged", this.map.getMaxZoom());
@@ -30180,7 +30203,7 @@ EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous po
30180
30203
  domain: env.staticAssetsDomain,
30181
30204
  path: "sdk/javascript/mapcontrol/" + Version.getEndpointVersion() + "/mapbox-gl-rtl-text.min.js"
30182
30205
  });
30183
- mapboxgl.setRTLTextPlugin(rtlPluginUrl.toString(), function (error) {
30206
+ maplibregl.setRTLTextPlugin(rtlPluginUrl.toString(), function (error) {
30184
30207
  if (error) {
30185
30208
  console.warn(error);
30186
30209
  }