@nextgis/leaflet-map-adapter 4.0.0 → 4.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Leaflet Map Adapter
2
2
 
3
- ![size](https://img.shields.io/bundlephobia/minzip/@nextgis/leaflet-map-adapter) ![version](https://img.shields.io/npm/v/@nextgis/leaflet-map-adapter)
3
+ ![version](https://img.shields.io/npm/v/@nextgis/leaflet-map-adapter)
4
4
 
5
5
  WebMap adapter to use [Leaflet](https://leafletjs.com/) GIS framework.
6
6
 
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.0; author: NextGIS */
1
+ /** Bundle of @nextgis/leaflet-map-adapter; version: 4.0.2; author: NextGIS */
2
2
  function getElement(el) {
3
3
  if (typeof el === "string") {
4
4
  let el_ = document.getElementById(el);
@@ -15368,8 +15368,14 @@ function isObject(val) {
15368
15368
  }
15369
15369
 
15370
15370
  function updateUrlParams(urlStr, params) {
15371
- const url = new URL(urlStr);
15372
- const searchParams = new URLSearchParams(url.search);
15371
+ const hashIndex = urlStr.indexOf("#");
15372
+ const hash = hashIndex === -1 ? "" : urlStr.slice(hashIndex);
15373
+ const url = hashIndex === -1 ? urlStr : urlStr.slice(0, hashIndex);
15374
+ const queryIndex = url.indexOf("?");
15375
+ const baseUrl = queryIndex === -1 ? url : url.slice(0, queryIndex);
15376
+ const searchParams = new URLSearchParams(
15377
+ queryIndex === -1 ? "" : url.slice(queryIndex + 1)
15378
+ );
15373
15379
  Object.entries(params).forEach(([key, value]) => {
15374
15380
  if (value === void 0) {
15375
15381
  searchParams.delete(key);
@@ -15379,7 +15385,7 @@ function updateUrlParams(urlStr, params) {
15379
15385
  });
15380
15386
  searchParams.set("timestamp", String((/* @__PURE__ */ new Date()).getTime()));
15381
15387
  const newSearch = [...searchParams.entries()].map(([key, value]) => `${key}=${value}`).join("&");
15382
- return `${url.origin}${url.pathname}?${newSearch}`;
15388
+ return `${baseUrl}?${newSearch}${hash}`;
15383
15389
  }
15384
15390
 
15385
15391
  function boundsToArray(bounds) {