New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

esri-leaflet-vector

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esri-leaflet-vector - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

175

dist/esri-leaflet-vector-debug.js

@@ -1,3 +0,3 @@

/* esri-leaflet-vector - v4.0.0 - Fri Sep 02 2022 13:58:17 GMT-0500 (Central Daylight Time)
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
/* esri-leaflet-vector - v4.0.1 - Thu Feb 23 2023 14:15:02 GMT-0600 (Central Standard Time)
* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
* Apache-2.0 */

@@ -14,3 +14,3 @@ (function (global, factory) {

var version = "4.0.0";
var version = "4.0.1";

@@ -22,3 +22,3 @@ /*

function getBasemapStyleUrl (key, apikey) {
var url =
let url =
'https://basemaps-api.arcgis.com/arcgis/rest/services/styles/' +

@@ -38,10 +38,10 @@ key +

function loadStyle (idOrUrl, options, callback) {
var httpRegex = /^https?:\/\//;
var serviceRegex = /\/VectorTileServer\/?$/;
const httpRegex = /^https?:\/\//;
const serviceRegex = /\/VectorTileServer\/?$/;
if (httpRegex.test(idOrUrl) && serviceRegex.test(idOrUrl)) {
var serviceUrl = idOrUrl;
const serviceUrl = idOrUrl;
loadStyleFromService(serviceUrl, options, callback);
} else {
var itemId = idOrUrl;
const itemId = idOrUrl;
loadStyleFromItem(itemId, options, callback);

@@ -52,3 +52,3 @@ }

function loadService (serviceUrl, options, callback) {
var params = options.token ? { token: options.token } : {};
const params = options.token ? { token: options.token } : {};
esriLeaflet.request(serviceUrl, params, callback);

@@ -58,4 +58,4 @@ }

function loadItem (itemId, options, callback) {
var params = options.token ? { token: options.token } : {};
var url = options.portalUrl +
const params = options.token ? { token: options.token } : {};
const url = options.portalUrl +
'/sharing/rest/content/items/' +

@@ -67,3 +67,3 @@ itemId;

function loadStyleFromItem (itemId, options, callback) {
var itemStyleUrl =
const itemStyleUrl =
options.portalUrl +

@@ -101,3 +101,3 @@ '/sharing/rest/content/items/' +

var sanitizedServiceUrl = serviceUrl;
let sanitizedServiceUrl = serviceUrl;
// a trailing "/" may create invalid paths

@@ -108,3 +108,3 @@ if (serviceUrl.charAt(serviceUrl.length - 1) === '/') {

var defaultStylesUrl;
let defaultStylesUrl;
// inadvertently inserting more than 1 adjacent "/" may create invalid paths

@@ -129,3 +129,3 @@ if (service.defaultStyles.charAt(0) === '/') {

function loadStyleFromUrl (styleUrl, options, callback) {
var params = options.token ? { token: options.token } : {};
const params = options.token ? { token: options.token } : {};
esriLeaflet.request(styleUrl, params, callback);

@@ -138,5 +138,5 @@ }

// modify each source in style.sources
var sourcesKeys = Object.keys(style.sources);
for (var sourceIndex = 0; sourceIndex < sourcesKeys.length; sourceIndex++) {
var source = style.sources[sourcesKeys[sourceIndex]];
const sourcesKeys = Object.keys(style.sources);
for (let sourceIndex = 0; sourceIndex < sourcesKeys.length; sourceIndex++) {
const source = style.sources[sourcesKeys[sourceIndex]];

@@ -179,3 +179,3 @@ // if a relative path is referenced, the default style can be found in a standard location

// add the attribution and copyrightText properties to the last source in style.sources based on the service metadata
var lastSource = style.sources[sourcesKeys[sourcesKeys.length - 1]];
const lastSource = style.sources[sourcesKeys[sourcesKeys.length - 1]];
lastSource.attribution = metadata.copyrightText || '';

@@ -185,4 +185,4 @@ lastSource.copyrightText = metadata.copyrightText || '';

// if any layer in style.layers has a layout.text-font property (it will be any array of strings) remove all items in the array after the first
for (var layerIndex = 0; layerIndex < style.layers.length; layerIndex++) {
var layer = style.layers[layerIndex];
for (let layerIndex = 0; layerIndex < style.layers.length; layerIndex++) {
const layer = style.layers[layerIndex];
if (

@@ -233,9 +233,9 @@ layer.layout &&

map._esriAttributions = map._esriAttributions || [];
for (var c = 0; c < attributions.contributors.length; c++) {
var contributor = attributions.contributors[c];
for (let c = 0; c < attributions.contributors.length; c++) {
const contributor = attributions.contributors[c];
for (var i = 0; i < contributor.coverageAreas.length; i++) {
var coverageArea = contributor.coverageAreas[i];
var southWest = leaflet.latLng(coverageArea.bbox[0], coverageArea.bbox[1]);
var northEast = leaflet.latLng(coverageArea.bbox[2], coverageArea.bbox[3]);
for (let i = 0; i < contributor.coverageAreas.length; i++) {
const coverageArea = contributor.coverageAreas[i];
const southWest = leaflet.latLng(coverageArea.bbox[0], coverageArea.bbox[1]);
const northEast = leaflet.latLng(coverageArea.bbox[2], coverageArea.bbox[3]);
map._esriAttributions.push({

@@ -256,3 +256,3 @@ attribution: contributor.attribution,

// pass the same argument as the map's 'moveend' event
var obj = { target: map };
const obj = { target: map };
esriLeaflet.Util._updateMapAttribution(obj);

@@ -302,3 +302,3 @@ });

var paneName = this.getPaneName();
const paneName = this.getPaneName();
map.getPane(paneName).appendChild(this._container);

@@ -331,4 +331,6 @@

var paneName = this.getPaneName();
const paneName = this.getPaneName();
map.getPane(paneName).removeChild(this._container);
this._container = null;

@@ -372,4 +374,4 @@ this._glMap.remove();

getBounds: function () {
var halfSize = this.getSize().multiplyBy(0.5);
var center = this._map.latLngToContainerPoint(this._map.getCenter());
const halfSize = this.getSize().multiplyBy(0.5);
const center = this._map.latLngToContainerPoint(this._map.getCenter());
return leaflet.latLngBounds(

@@ -387,25 +389,32 @@ this._map.containerPointToLatLng(center.subtract(halfSize)),

getPaneName: function () {
return this._map.getPane(this.options.pane) ? this.options.pane : 'tilePane';
return this._map.getPane(this.options.pane)
? this.options.pane
: 'tilePane';
},
_initContainer: function () {
var container = (this._container = leaflet.DomUtil.create(
'div',
'leaflet-gl-layer'
));
if (this._container) {
return;
}
var size = this.getSize();
var offset = this._map.getSize().multiplyBy(this.options.padding);
container.style.width = size.x + 'px';
container.style.height = size.y + 'px';
this._container = leaflet.DomUtil.create('div', 'leaflet-gl-layer');
var topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);
const size = this.getSize();
const offset = this._map.getSize().multiplyBy(this.options.padding);
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';
leaflet.DomUtil.setPosition(container, topLeft);
const topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);
leaflet.DomUtil.setPosition(this._container, topLeft);
},
_initGL: function () {
var center = this._map.getCenter();
if (this._glMap) {
return;
}
var options = leaflet.extend({}, this.options, {
const center = this._map.getCenter();
const options = leaflet.extend({}, this.options, {
container: this._container,

@@ -420,5 +429,8 @@ center: [center.lng, center.lat],

// Fire event for Maplibre "styledata" event.
this._glMap.once('styledata', function (res) {
this.fire('styleLoaded');
}.bind(this));
this._glMap.once(
'styledata',
function (res) {
this.fire('styleLoaded');
}.bind(this)
);

@@ -439,3 +451,3 @@ // allow GL base map to pan beyond min/max latitudes

// treat child <canvas> element like L.ImageOverlay
var canvas = this._glMap._actualCanvas;
const canvas = this._glMap._actualCanvas;
leaflet.DomUtil.addClass(canvas, 'leaflet-image-layer');

@@ -459,7 +471,7 @@ leaflet.DomUtil.addClass(canvas, 'leaflet-zoom-animated');

var size = this.getSize();
var container = this._container;
var gl = this._glMap;
var offset = this._map.getSize().multiplyBy(this.options.padding);
var topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);
const size = this.getSize();
const container = this._container;
const gl = this._glMap;
const offset = this._map.getSize().multiplyBy(this.options.padding);
const topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);

@@ -489,3 +501,3 @@ leaflet.DomUtil.setPosition(container, topLeft);

_transformGL: function (gl) {
var center = this._map.getCenter();
const center = this._map.getCenter();

@@ -495,3 +507,3 @@ // gl.setView([center.lat, center.lng], this._map.getZoom() - 1, 0);

var tr = gl.transform;
const tr = gl.transform;
tr.center = maplibregl__default["default"].LngLat.convert([center.lng, center.lat]);

@@ -512,8 +524,8 @@ tr.zoom = this._map.getZoom() - 1;

_animateZoom: function (e) {
var scale = this._map.getZoomScale(e.zoom);
var padding = this._map.getSize().multiplyBy(this.options.padding * scale);
var viewHalf = this.getSize()._divideBy(2);
const scale = this._map.getZoomScale(e.zoom);
const padding = this._map.getSize().multiplyBy(this.options.padding * scale);
const viewHalf = this.getSize()._divideBy(2);
// corrections for padding (scaled), adapted from
// https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L1490-L1508
var topLeft = this._map
const topLeft = this._map
.project(e.center, e.zoom)

@@ -523,3 +535,3 @@ ._subtract(viewHalf)

._round();
var offset = this._map
const offset = this._map
.project(this._map.getBounds().getNorthWest(), e.zoom)

@@ -540,9 +552,5 @@ ._subtract(topLeft);

_zoomEnd: function () {
var scale = this._map.getZoomScale(this._map.getZoom());
const scale = this._map.getZoomScale(this._map.getZoom());
leaflet.DomUtil.setTransform(
this._glMap._actualCanvas,
null,
scale
);
leaflet.DomUtil.setTransform(this._glMap._actualCanvas, null, scale);

@@ -556,5 +564,5 @@ this._zooming = false;

leaflet.Util.requestAnimFrame(function () {
var zoom = this._map.getZoom();
var center = this._map.getCenter();
var offset = this._map.latLngToContainerPoint(
const zoom = this._map.getZoom();
const center = this._map.getCenter();
const offset = this._map.latLngToContainerPoint(
this._map.getBounds().getNorthWest()

@@ -631,3 +639,3 @@ );

_createLayer: function () {
var styleUrl = getBasemapStyleUrl(this.options.key, this.options.apikey);
const styleUrl = getBasemapStyleUrl(this.options.key, this.options.apikey);

@@ -649,3 +657,3 @@ this._maplibreGL = maplibreGLJSLayer({

_setupAttribution: function () {
var map = this._map;
const map = this._map;
// Set attribution

@@ -656,4 +664,4 @@ esriLeaflet.Util.setEsriAttribution(map);

// this is an itemId
var sources = this._maplibreGL.getMaplibreMap().style.stylesheet.sources;
var allAttributions = [];
const sources = this._maplibreGL.getMaplibreMap().style.stylesheet.sources;
const allAttributions = [];
Object.keys(sources).forEach(function (key) {

@@ -740,3 +748,3 @@ allAttributions.push(sources[key].attribution);

if (!this._map.getPane(this.options.pane)) {
var pane = this._map.createPane(this.options.pane);
const pane = this._map.createPane(this.options.pane);
pane.style.pointerEvents = 'none';

@@ -752,6 +760,6 @@ pane.style.zIndex = this.options.pane === 'esri-labels' ? 550 : 500;

if (map.attributionControl) {
var element = document.getElementsByClassName('esri-dynamic-attribution');
const element = document.getElementsByClassName('esri-dynamic-attribution');
if (element && element.length > 0) {
var vectorAttribution = element[0].outerHTML;
const vectorAttribution = element[0].outerHTML;
// this doesn't work, not sure why.

@@ -764,3 +772,3 @@ map.attributionControl.removeAttribution(vectorAttribution);

_asyncAdd: function () {
var map = this._map;
const map = this._map;
map.on('moveend', esriLeaflet.Util._updateMapAttribution);

@@ -809,3 +817,5 @@ this._maplibreGL.addTo(map, this);

if (!key) {
throw new Error('An ITEM ID or SERVICE URL is required for vectorTileLayer.');
throw new Error(
'An ITEM ID or SERVICE URL is required for vectorTileLayer.'
);
}

@@ -850,4 +860,5 @@

if (!this.getAttribution()) {
var sourcesKeys = Object.keys(style.sources);
this.options.attribution = style.sources[sourcesKeys[sourcesKeys.length - 1]].attribution;
const sourcesKeys = Object.keys(style.sources);
this.options.attribution =
style.sources[sourcesKeys[sourcesKeys.length - 1]].attribution;
if (this._map && this._map.attributionControl) {

@@ -897,3 +908,3 @@ // NOTE: if attribution is an empty string (or otherwise falsy) at this point it would not appear in the attribution control

_asyncAdd: function () {
var map = this._map;
const map = this._map;
this._maplibreGL.addTo(map, this);

@@ -900,0 +911,0 @@ }

@@ -1,1 +0,1 @@

{"name": "esri-leaflet-vector","version": "","lib": {"path": "dist/esri-leaflet-vector.js","integrity": "sha512-EMt/tpooNkBOxxQy2SOE1HgzWbg9u1gI6mT23Wl0eBWTwN9nuaPtLAaX9irNocMrHf0XhRzT8B0vXQ/bzD0I0w=="}}
{"name": "esri-leaflet-vector","version": "4.0.1","lib": {"path": "dist/esri-leaflet-vector.js","integrity": "sha512-1rJumtWIar3IH4f12WTGted5uGWSc5d8TFH8JVlk3hnCpZCVc2SccJSSNRMUo0AUwzlLeUgNEXvYyivVmhWlZg=="}}
{
"name": "esri-leaflet-vector",
"description": "Esri vector basemap and vector tile layer plugin for Leaflet.",
"version": "4.0.0",
"version": "4.0.1",
"author": "John Gravois (https://johngravois.com)",

@@ -20,6 +20,7 @@ "contributors": [

"devDependencies": {
"@rollup/plugin-commonjs": "^20.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"chai": "4.3.6",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-terser": "^0.3.0",
"chai": "4.3.7",
"chokidar-cli": "^3.0.0",

@@ -35,19 +36,21 @@ "eslint": "^7.13.0",

"esri-leaflet": "^3.0.0",
"gh-release": "^6.0.4",
"gh-release": "^7.0.2",
"http-server": "^14.1.1",
"karma": "^6.3.16",
"karma-chai-sinon": "^0.1.5",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage": "^2.2.0",
"karma-edgium-launcher": "github:matracey/karma-edgium-launcher",
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "^2.2.5",
"karma-safari-launcher": "~1.0.0",
"karma-sinon-chai": "^2.0.2",
"karma-sourcemap-loader": "^0.3.8",
"leaflet": "^1.5.0",
"mkdirp": "^1.0.4",
"mocha": "^9.2.0",
"mkdirp": "^2.1.3",
"mocha": "^10.2.0",
"npm-run-all": "^4.1.5",
"rollup": "^2.67.2",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^2.79.1",
"semistandard": "^16.0.0",
"sinon": "^13.0.1",
"sinon": "^15.0.1",
"sinon-chai": "3.7.0",

@@ -101,3 +104,13 @@ "snazzy": "^9.0.0"

"release": "./scripts/release.sh"
},
"semistandard": {
"globals": [
"expect",
"L",
"XMLHttpRequest",
"sinon",
"xhr",
"proj4"
]
}
}

@@ -41,3 +41,3 @@ import {

var paneName = this.getPaneName();
const paneName = this.getPaneName();
map.getPane(paneName).appendChild(this._container);

@@ -70,4 +70,6 @@

var paneName = this.getPaneName();
const paneName = this.getPaneName();
map.getPane(paneName).removeChild(this._container);
this._container = null;

@@ -111,4 +113,4 @@ this._glMap.remove();

getBounds: function () {
var halfSize = this.getSize().multiplyBy(0.5);
var center = this._map.latLngToContainerPoint(this._map.getCenter());
const halfSize = this.getSize().multiplyBy(0.5);
const center = this._map.latLngToContainerPoint(this._map.getCenter());
return latLngBounds(

@@ -126,25 +128,32 @@ this._map.containerPointToLatLng(center.subtract(halfSize)),

getPaneName: function () {
return this._map.getPane(this.options.pane) ? this.options.pane : 'tilePane';
return this._map.getPane(this.options.pane)
? this.options.pane
: 'tilePane';
},
_initContainer: function () {
var container = (this._container = DomUtil.create(
'div',
'leaflet-gl-layer'
));
if (this._container) {
return;
}
var size = this.getSize();
var offset = this._map.getSize().multiplyBy(this.options.padding);
container.style.width = size.x + 'px';
container.style.height = size.y + 'px';
this._container = DomUtil.create('div', 'leaflet-gl-layer');
var topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);
const size = this.getSize();
const offset = this._map.getSize().multiplyBy(this.options.padding);
this._container.style.width = size.x + 'px';
this._container.style.height = size.y + 'px';
DomUtil.setPosition(container, topLeft);
const topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);
DomUtil.setPosition(this._container, topLeft);
},
_initGL: function () {
var center = this._map.getCenter();
if (this._glMap) {
return;
}
var options = extend({}, this.options, {
const center = this._map.getCenter();
const options = extend({}, this.options, {
container: this._container,

@@ -159,5 +168,8 @@ center: [center.lng, center.lat],

// Fire event for Maplibre "styledata" event.
this._glMap.once('styledata', function (res) {
this.fire('styleLoaded');
}.bind(this));
this._glMap.once(
'styledata',
function (res) {
this.fire('styleLoaded');
}.bind(this)
);

@@ -178,3 +190,3 @@ // allow GL base map to pan beyond min/max latitudes

// treat child <canvas> element like L.ImageOverlay
var canvas = this._glMap._actualCanvas;
const canvas = this._glMap._actualCanvas;
DomUtil.addClass(canvas, 'leaflet-image-layer');

@@ -198,7 +210,7 @@ DomUtil.addClass(canvas, 'leaflet-zoom-animated');

var size = this.getSize();
var container = this._container;
var gl = this._glMap;
var offset = this._map.getSize().multiplyBy(this.options.padding);
var topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);
const size = this.getSize();
const container = this._container;
const gl = this._glMap;
const offset = this._map.getSize().multiplyBy(this.options.padding);
const topLeft = this._map.containerPointToLayerPoint([0, 0]).subtract(offset);

@@ -228,3 +240,3 @@ DomUtil.setPosition(container, topLeft);

_transformGL: function (gl) {
var center = this._map.getCenter();
const center = this._map.getCenter();

@@ -234,3 +246,3 @@ // gl.setView([center.lat, center.lng], this._map.getZoom() - 1, 0);

var tr = gl.transform;
const tr = gl.transform;
tr.center = maplibregl.LngLat.convert([center.lng, center.lat]);

@@ -251,8 +263,8 @@ tr.zoom = this._map.getZoom() - 1;

_animateZoom: function (e) {
var scale = this._map.getZoomScale(e.zoom);
var padding = this._map.getSize().multiplyBy(this.options.padding * scale);
var viewHalf = this.getSize()._divideBy(2);
const scale = this._map.getZoomScale(e.zoom);
const padding = this._map.getSize().multiplyBy(this.options.padding * scale);
const viewHalf = this.getSize()._divideBy(2);
// corrections for padding (scaled), adapted from
// https://github.com/Leaflet/Leaflet/blob/master/src/map/Map.js#L1490-L1508
var topLeft = this._map
const topLeft = this._map
.project(e.center, e.zoom)

@@ -262,3 +274,3 @@ ._subtract(viewHalf)

._round();
var offset = this._map
const offset = this._map
.project(this._map.getBounds().getNorthWest(), e.zoom)

@@ -279,9 +291,5 @@ ._subtract(topLeft);

_zoomEnd: function () {
var scale = this._map.getZoomScale(this._map.getZoom());
const scale = this._map.getZoomScale(this._map.getZoom());
DomUtil.setTransform(
this._glMap._actualCanvas,
null,
scale
);
DomUtil.setTransform(this._glMap._actualCanvas, null, scale);

@@ -295,5 +303,5 @@ this._zooming = false;

Util.requestAnimFrame(function () {
var zoom = this._map.getZoom();
var center = this._map.getCenter();
var offset = this._map.latLngToContainerPoint(
const zoom = this._map.getZoom();
const center = this._map.getCenter();
const offset = this._map.latLngToContainerPoint(
this._map.getBounds().getNorthWest()

@@ -300,0 +308,0 @@ );

@@ -9,3 +9,3 @@ import { latLng, latLngBounds } from 'leaflet';

export function getBasemapStyleUrl (key, apikey) {
var url =
let url =
'https://basemaps-api.arcgis.com/arcgis/rest/services/styles/' +

@@ -25,10 +25,10 @@ key +

export function loadStyle (idOrUrl, options, callback) {
var httpRegex = /^https?:\/\//;
var serviceRegex = /\/VectorTileServer\/?$/;
const httpRegex = /^https?:\/\//;
const serviceRegex = /\/VectorTileServer\/?$/;
if (httpRegex.test(idOrUrl) && serviceRegex.test(idOrUrl)) {
var serviceUrl = idOrUrl;
const serviceUrl = idOrUrl;
loadStyleFromService(serviceUrl, options, callback);
} else {
var itemId = idOrUrl;
const itemId = idOrUrl;
loadStyleFromItem(itemId, options, callback);

@@ -39,3 +39,3 @@ }

export function loadService (serviceUrl, options, callback) {
var params = options.token ? { token: options.token } : {};
const params = options.token ? { token: options.token } : {};
request(serviceUrl, params, callback);

@@ -45,4 +45,4 @@ }

function loadItem (itemId, options, callback) {
var params = options.token ? { token: options.token } : {};
var url = options.portalUrl +
const params = options.token ? { token: options.token } : {};
const url = options.portalUrl +
'/sharing/rest/content/items/' +

@@ -54,3 +54,3 @@ itemId;

function loadStyleFromItem (itemId, options, callback) {
var itemStyleUrl =
const itemStyleUrl =
options.portalUrl +

@@ -88,3 +88,3 @@ '/sharing/rest/content/items/' +

var sanitizedServiceUrl = serviceUrl;
let sanitizedServiceUrl = serviceUrl;
// a trailing "/" may create invalid paths

@@ -95,3 +95,3 @@ if (serviceUrl.charAt(serviceUrl.length - 1) === '/') {

var defaultStylesUrl;
let defaultStylesUrl;
// inadvertently inserting more than 1 adjacent "/" may create invalid paths

@@ -116,3 +116,3 @@ if (service.defaultStyles.charAt(0) === '/') {

function loadStyleFromUrl (styleUrl, options, callback) {
var params = options.token ? { token: options.token } : {};
const params = options.token ? { token: options.token } : {};
request(styleUrl, params, callback);

@@ -125,5 +125,5 @@ }

// modify each source in style.sources
var sourcesKeys = Object.keys(style.sources);
for (var sourceIndex = 0; sourceIndex < sourcesKeys.length; sourceIndex++) {
var source = style.sources[sourcesKeys[sourceIndex]];
const sourcesKeys = Object.keys(style.sources);
for (let sourceIndex = 0; sourceIndex < sourcesKeys.length; sourceIndex++) {
const source = style.sources[sourcesKeys[sourceIndex]];

@@ -166,3 +166,3 @@ // if a relative path is referenced, the default style can be found in a standard location

// add the attribution and copyrightText properties to the last source in style.sources based on the service metadata
var lastSource = style.sources[sourcesKeys[sourcesKeys.length - 1]];
const lastSource = style.sources[sourcesKeys[sourcesKeys.length - 1]];
lastSource.attribution = metadata.copyrightText || '';

@@ -172,4 +172,4 @@ lastSource.copyrightText = metadata.copyrightText || '';

// if any layer in style.layers has a layout.text-font property (it will be any array of strings) remove all items in the array after the first
for (var layerIndex = 0; layerIndex < style.layers.length; layerIndex++) {
var layer = style.layers[layerIndex];
for (let layerIndex = 0; layerIndex < style.layers.length; layerIndex++) {
const layer = style.layers[layerIndex];
if (

@@ -220,9 +220,9 @@ layer.layout &&

map._esriAttributions = map._esriAttributions || [];
for (var c = 0; c < attributions.contributors.length; c++) {
var contributor = attributions.contributors[c];
for (let c = 0; c < attributions.contributors.length; c++) {
const contributor = attributions.contributors[c];
for (var i = 0; i < contributor.coverageAreas.length; i++) {
var coverageArea = contributor.coverageAreas[i];
var southWest = latLng(coverageArea.bbox[0], coverageArea.bbox[1]);
var northEast = latLng(coverageArea.bbox[2], coverageArea.bbox[3]);
for (let i = 0; i < contributor.coverageAreas.length; i++) {
const coverageArea = contributor.coverageAreas[i];
const southWest = latLng(coverageArea.bbox[0], coverageArea.bbox[1]);
const northEast = latLng(coverageArea.bbox[2], coverageArea.bbox[3]);
map._esriAttributions.push({

@@ -243,3 +243,3 @@ attribution: contributor.attribution,

// pass the same argument as the map's 'moveend' event
var obj = { target: map };
const obj = { target: map };
Util._updateMapAttribution(obj);

@@ -246,0 +246,0 @@ });

@@ -50,3 +50,3 @@ import { Layer, setOptions } from 'leaflet';

_createLayer: function () {
var styleUrl = getBasemapStyleUrl(this.options.key, this.options.apikey);
const styleUrl = getBasemapStyleUrl(this.options.key, this.options.apikey);

@@ -68,3 +68,3 @@ this._maplibreGL = maplibreGLJSLayer({

_setupAttribution: function () {
var map = this._map;
const map = this._map;
// Set attribution

@@ -75,4 +75,4 @@ Util.setEsriAttribution(map);

// this is an itemId
var sources = this._maplibreGL.getMaplibreMap().style.stylesheet.sources;
var allAttributions = [];
const sources = this._maplibreGL.getMaplibreMap().style.stylesheet.sources;
const allAttributions = [];
Object.keys(sources).forEach(function (key) {

@@ -159,3 +159,3 @@ allAttributions.push(sources[key].attribution);

if (!this._map.getPane(this.options.pane)) {
var pane = this._map.createPane(this.options.pane);
const pane = this._map.createPane(this.options.pane);
pane.style.pointerEvents = 'none';

@@ -171,6 +171,6 @@ pane.style.zIndex = this.options.pane === 'esri-labels' ? 550 : 500;

if (map.attributionControl) {
var element = document.getElementsByClassName('esri-dynamic-attribution');
const element = document.getElementsByClassName('esri-dynamic-attribution');
if (element && element.length > 0) {
var vectorAttribution = element[0].outerHTML;
const vectorAttribution = element[0].outerHTML;
// this doesn't work, not sure why.

@@ -183,3 +183,3 @@ map.attributionControl.removeAttribution(vectorAttribution);

_asyncAdd: function () {
var map = this._map;
const map = this._map;
map.on('moveend', Util._updateMapAttribution);

@@ -186,0 +186,0 @@ this._maplibreGL.addTo(map, this);

@@ -39,3 +39,5 @@ import { Layer, setOptions } from 'leaflet';

if (!key) {
throw new Error('An ITEM ID or SERVICE URL is required for vectorTileLayer.');
throw new Error(
'An ITEM ID or SERVICE URL is required for vectorTileLayer.'
);
}

@@ -80,4 +82,5 @@

if (!this.getAttribution()) {
var sourcesKeys = Object.keys(style.sources);
this.options.attribution = style.sources[sourcesKeys[sourcesKeys.length - 1]].attribution;
const sourcesKeys = Object.keys(style.sources);
this.options.attribution =
style.sources[sourcesKeys[sourcesKeys.length - 1]].attribution;
if (this._map && this._map.attributionControl) {

@@ -127,3 +130,3 @@ // NOTE: if attribution is an empty string (or otherwise falsy) at this point it would not appear in the attribution control

_asyncAdd: function () {
var map = this._map;
const map = this._map;
this._maplibreGL.addTo(map, this);

@@ -130,0 +133,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc