Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asymmetrik/angular2-leaflet

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asymmetrik/angular2-leaflet - npm Package Compare versions

Comparing version 1.0.15 to 1.1.1

tslint.json

5

config/webpack.config.js

@@ -43,3 +43,3 @@ 'use strict';

wpConfig.output.path = path.resolve('./public');
wpConfig.output.publicPath = 'http://localhost:9000/';
wpConfig.output.publicPath = '/';
wpConfig.output.filename = '[name].js';

@@ -121,3 +121,4 @@ wpConfig.output.chunkFilename = '[name].js';

new webpack.optimize.CommonsChunkPlugin({
name: [ 'vendor' ]
name: 'vendor',
minChunks: Infinity
}),

@@ -124,0 +125,0 @@ new webpack.ContextReplacementPlugin(

615

dist/bundles/angular2-leaflet.js

@@ -1,22 +0,603 @@

/*! @asymmetrik/angular2-leaflet-1.0.15 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved.*/
/*! @asymmetrik/angular2-leaflet-1.1.1 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved.*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
typeof define === 'function' && define.amd ? define(factory) :
(factory());
}(this, (function () { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('leaflet')) :
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'leaflet'], factory) :
(factory((global.angular2Sentio = global.angular2Sentio || {}),global.ng.core,global.L));
}(this, (function (exports,_angular_core,L$1) { 'use strict';
var leaflet_module_1 = require("./leaflet/leaflet.module");
exports.LeafletModule = leaflet_module_1.LeafletModule;
var leaflet_directive_1 = require("./leaflet/core/leaflet.directive");
exports.LeafletDirective = leaflet_directive_1.LeafletDirective;
var leaflet_directive_wrapper_1 = require("./leaflet/core/leaflet.directive.wrapper");
exports.LeafletDirectiveWrapper = leaflet_directive_wrapper_1.LeafletDirectiveWrapper;
var leaflet_control_layers_util_1 = require("./leaflet/layers/control/leaflet-control-layers.util");
exports.LeafletControlLayersUtil = leaflet_control_layers_util_1.LeafletControlLayersUtil;
var leaflet_layers_util_1 = require("./leaflet/layers/leaflet-layers.util");
exports.LeafletLayersUtil = leaflet_layers_util_1.LeafletLayersUtil;
var leaflet_tile_layer_definition_model_1 = require("./leaflet/layers/leaflet-tile-layer-definition.model");
exports.LeafletTileLayerDefinition = leaflet_tile_layer_definition_model_1.LeafletTileLayerDefinition;
exports.LeafletDirective = (function () {
function LeafletDirective(el) {
this.DEFAULT_ZOOM = 1;
this.DEFAULT_CENTER = L$1.latLng([38.907192, -77.036871]);
this.DEFAULT_FPZ_OPTIONS = {};
this.fitBoundsOptions = this.DEFAULT_FPZ_OPTIONS;
this.panOptions = this.DEFAULT_FPZ_OPTIONS;
this.zoomOptions = this.DEFAULT_FPZ_OPTIONS;
this.zoomPanOptions = this.DEFAULT_FPZ_OPTIONS;
// Default configuration
this.options = {};
// Configure callback function for the map
this.mapReady = new _angular_core.EventEmitter();
this.element = el;
}
LeafletDirective.prototype.ngOnInit = function () {
// Create the map with some reasonable defaults
this.map = L$1.map(this.element.nativeElement, this.options);
// Only setView if there is a center/zoom
if (null != this.center && null != this.zoom) {
this.setView(this.center, this.zoom);
}
// Set up all the initial settings
if (null != this.fitBounds) {
this.setFitBounds(this.fitBounds);
}
this.doResize();
// Fire map ready event
this.mapReady.emit(this.map);
};
LeafletDirective.prototype.ngOnChanges = function (changes) {
/*
* The following code is to address an issue with our (basic) implementation of
* zooming and panning. From our testing, it seems that a pan operation followed
* by a zoom operation in the same thread will interfere with eachother. The zoom
* operation interrupts/cancels the pan, resulting in a final center point that is
* inaccurate. The solution seems to be to either separate them with a timeout or
* to collapse them into a setView call.
*/
// Zooming and Panning
if (changes['zoom'] && changes['center'] && null != this.zoom && null != this.center) {
this.setView(changes['center'].currentValue, changes['zoom'].currentValue);
}
else if (changes['zoom']) {
this.setZoom(changes['zoom'].currentValue);
}
else if (changes['center']) {
this.setCenter(changes['center'].currentValue);
}
// Fit bounds
if (changes['fitBounds']) {
this.setFitBounds(changes['fitBounds'].currentValue);
}
};
LeafletDirective.prototype.getMap = function () {
return this.map;
};
LeafletDirective.prototype.onResize = function () {
this.delayResize();
};
/**
* Resize the map to fit it's parent container
*/
LeafletDirective.prototype.doResize = function () {
// Invalidate the map size to trigger it to update itself
this.map.invalidateSize({});
};
/**
* Manage a delayed resize of the component
*/
LeafletDirective.prototype.delayResize = function () {
if (null != this.resizeTimer) {
clearTimeout(this.resizeTimer);
}
this.resizeTimer = setTimeout(this.doResize.bind(this), 200);
};
/**
* Set the view (center/zoom) all at once
* @param center The new center
* @param zoom The new zoom level
*/
LeafletDirective.prototype.setView = function (center, zoom) {
if (this.map && null != center && null != zoom) {
this.map.setView(center, zoom, this.zoomPanOptions);
}
};
/**
* Set the map zoom level
* @param zoom the new zoom level for the map
*/
LeafletDirective.prototype.setZoom = function (zoom) {
if (this.map && null != zoom) {
this.map.setZoom(zoom, this.zoomOptions);
}
};
/**
* Set the center of the map
* @param center the center point
*/
LeafletDirective.prototype.setCenter = function (center) {
if (this.map && null != center) {
this.map.panTo(center, this.panOptions);
}
};
/**
* Fit the map to the bounds
* @param center the center point
*/
LeafletDirective.prototype.setFitBounds = function (latLngBounds) {
if (this.map && null != latLngBounds) {
this.map.fitBounds(latLngBounds, this.fitBoundsOptions);
}
};
return LeafletDirective;
}());
__decorate([
_angular_core.Input('leafletFitBoundsOptions'),
__metadata("design:type", Object)
], exports.LeafletDirective.prototype, "fitBoundsOptions", void 0);
__decorate([
_angular_core.Input('leafletPanOptions'),
__metadata("design:type", Object)
], exports.LeafletDirective.prototype, "panOptions", void 0);
__decorate([
_angular_core.Input('leafletZoomOptions'),
__metadata("design:type", Object)
], exports.LeafletDirective.prototype, "zoomOptions", void 0);
__decorate([
_angular_core.Input('leafletZoomPanOptions'),
__metadata("design:type", Object)
], exports.LeafletDirective.prototype, "zoomPanOptions", void 0);
__decorate([
_angular_core.Input('leafletOptions'),
__metadata("design:type", Object)
], exports.LeafletDirective.prototype, "options", void 0);
__decorate([
_angular_core.Output('leafletMapReady'),
__metadata("design:type", Object)
], exports.LeafletDirective.prototype, "mapReady", void 0);
__decorate([
_angular_core.Input('leafletZoom'),
__metadata("design:type", Number)
], exports.LeafletDirective.prototype, "zoom", void 0);
__decorate([
_angular_core.Input('leafletCenter'),
__metadata("design:type", L$1.LatLng)
], exports.LeafletDirective.prototype, "center", void 0);
__decorate([
_angular_core.Input('leafletFitBounds'),
__metadata("design:type", L$1.LatLngBounds)
], exports.LeafletDirective.prototype, "fitBounds", void 0);
__decorate([
_angular_core.HostListener('window:resize', ['$event']),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], exports.LeafletDirective.prototype, "onResize", null);
exports.LeafletDirective = __decorate([
_angular_core.Directive({
selector: '[leaflet]'
}),
__metadata("design:paramtypes", [_angular_core.ElementRef])
], exports.LeafletDirective);
var LeafletDirectiveWrapper = (function () {
function LeafletDirectiveWrapper(leafletDirective) {
this.leafletDirective = leafletDirective;
}
LeafletDirectiveWrapper.prototype.init = function () {
// Nothing for now
};
LeafletDirectiveWrapper.prototype.getMap = function () {
return this.leafletDirective.getMap();
};
return LeafletDirectiveWrapper;
}());
var LeafletLayerDiff = (function () {
function LeafletLayerDiff(remove, add) {
this.remove = remove;
this.add = add;
}
return LeafletLayerDiff;
}());
var LeafletLayersUtil = (function () {
function LeafletLayersUtil() {
}
LeafletLayersUtil.diffLayers = function (newLayers, prevLayers) {
var toRemove;
var toAdd;
if (null == newLayers) {
newLayers = [];
}
if (null == prevLayers) {
prevLayers = [];
}
// Figure out which layers need to be removed (prev - new)
toRemove = prevLayers
.filter(function (pl) {
return !(newLayers.find(function (nl) { return (pl === nl); }));
});
// Figure out which layers need to be added (new - prev)
toAdd = newLayers
.filter(function (pl) {
return !(prevLayers.find(function (nl) { return (pl === nl); }));
});
return new LeafletLayerDiff(toRemove, toAdd);
};
return LeafletLayersUtil;
}());
var LeafletLayersDirective = (function () {
function LeafletLayersDirective(leafletDirective) {
this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
}
LeafletLayersDirective.prototype.ngOnInit = function () {
// Init the map
this.leafletDirective.init();
// The way we've set this up, map isn't set until after the first round of changes has gone through
this.setLayers(this.layers, []);
};
LeafletLayersDirective.prototype.ngOnChanges = function (changes) {
// Set the layers
if (changes['layers']) {
var c = changes['layers'].currentValue;
var p = (changes['layers'].isFirstChange()) ? [] : changes['layers'].previousValue;
this.setLayers(c, p);
}
};
/**
* Replace the current layers in the map with the provided array
* @param layers The new complete array of layers for the map
*/
LeafletLayersDirective.prototype.setLayers = function (newLayers, prevLayers) {
var map$$1 = this.leafletDirective.getMap();
if (null != map$$1) {
var diff = LeafletLayersUtil.diffLayers(newLayers, prevLayers);
// Remove the layers
diff.remove.forEach(function (l) { map$$1.removeLayer(l); });
// Add the new layers
diff.add.forEach(function (l) { map$$1.addLayer(l); });
}
};
return LeafletLayersDirective;
}());
__decorate([
_angular_core.Input('leafletLayers'),
__metadata("design:type", Array)
], LeafletLayersDirective.prototype, "layers", void 0);
LeafletLayersDirective = __decorate([
_angular_core.Directive({
selector: '[leafletLayers]'
}),
__metadata("design:paramtypes", [exports.LeafletDirective])
], LeafletLayersDirective);
var LeafletUtil = (function () {
function LeafletUtil() {
}
/**
* Combine two associative arrays in a shallow manner. Where there are duplicate properties,
* the value in the second object will overwrite the value of the first object
*
* @param aMap The first object
* @param bMap The second object
* @returns {{}} The aggregate of both objects
*/
LeafletUtil.mergeMaps = function (aMap, bMap) {
var toReturn = {};
if (null != aMap) {
for (var k in aMap) {
if (aMap.hasOwnProperty(k)) {
toReturn[k] = aMap[k];
}
}
}
if (null != bMap) {
for (var k in bMap) {
if (bMap.hasOwnProperty(k)) {
toReturn[k] = bMap[k];
}
}
}
return toReturn;
};
/**
* Subtracts the properties of an associative array in a shallow manner.
* Where there are duplicate properties, the properties will be removed
* from the first object.
*
* @param aMap The object from which to subtract properties
* @param bMap The object containing properties to subtract
* @returns {{}}
*/
LeafletUtil.mapSubtract = function (aMap, bMap) {
var toReturn = {};
if (null != aMap) {
// Copy all of aMap into toReturn
for (var k in aMap) {
if (aMap.hasOwnProperty(k)) {
toReturn[k] = aMap[k];
}
}
// If there's a bMap, delete all bMap keys from aMap
if (null != bMap) {
for (var k in bMap) {
if (bMap.hasOwnProperty(k)) {
delete toReturn[k];
}
}
}
}
return toReturn;
};
LeafletUtil.mapToArray = function (map$$1) {
var toReturn = [];
for (var k in map$$1) {
if (map$$1.hasOwnProperty(k)) {
toReturn.push(map$$1[k]);
}
}
return toReturn;
};
return LeafletUtil;
}());
var LeafletLayersObjectDiff = (function () {
function LeafletLayersObjectDiff(remove, add) {
this.remove = remove;
this.add = add;
}
return LeafletLayersObjectDiff;
}());
var LeafletControlLayersWrapper = (function () {
function LeafletControlLayersWrapper() {
}
LeafletControlLayersWrapper.prototype.getLayersControl = function () {
return this.layersControl;
};
LeafletControlLayersWrapper.prototype.init = function (controlConfig, controlOptions) {
var baseLayers = controlConfig.baseLayers || {};
var overlays = controlConfig.overlays || {};
this.layersControl = L$1.control.layers(baseLayers, overlays, controlOptions);
return this.layersControl;
};
LeafletControlLayersWrapper.prototype.setLayersControlConfig = function (newConfig, prevConfig) {
if (null == this.layersControl) {
return new LeafletLayersObjectDiff({}, {});
}
var toRemove;
var baseLayers;
var overlays;
// Figure out which layers need to be removed (prev - new)
toRemove = LeafletUtil.mergeMaps(LeafletUtil.mapSubtract(prevConfig.baseLayers, newConfig.baseLayers), LeafletUtil.mapSubtract(prevConfig.overlays, newConfig.overlays));
// Figure out which layers need to be added (new - prev)
baseLayers = LeafletUtil.mapSubtract(newConfig.baseLayers, prevConfig.baseLayers);
overlays = LeafletUtil.mapSubtract(newConfig.overlays, prevConfig.overlays);
// Do the actual removal and addition
for (var k in toRemove) {
if (toRemove.hasOwnProperty(k)) {
var l = toRemove[k];
this.layersControl.removeLayer(l);
}
}
for (var k in baseLayers) {
if (baseLayers.hasOwnProperty(k)) {
var l = baseLayers[k];
this.layersControl.addBaseLayer(l, k);
}
}
for (var k in overlays) {
if (overlays.hasOwnProperty(k)) {
var l = overlays[k];
this.layersControl.addOverlay(l, k);
}
}
return new LeafletLayersObjectDiff(toRemove, LeafletUtil.mergeMaps(baseLayers, overlays));
};
return LeafletControlLayersWrapper;
}());
var LeafletLayersControlDirective = (function () {
function LeafletLayersControlDirective(leafletDirective) {
this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
this.controlLayers = new LeafletControlLayersWrapper();
}
LeafletLayersControlDirective.prototype.ngOnInit = function () {
// Init the map
this.leafletDirective.init();
// Set up all the initial settings
this.controlLayers
.init(this.layersControlConfig, this.layersControlOptions)
.addTo(this.leafletDirective.getMap());
};
LeafletLayersControlDirective.prototype.ngOnChanges = function (changes) {
// Set the layers
if (changes['layersControlCfg']) {
this.controlLayers.setLayersControlConfig(changes['layersControlCfg'].currentValue, changes['layersControlCfg'].previousValue);
}
};
return LeafletLayersControlDirective;
}());
__decorate([
_angular_core.Input('leafletLayersControl'),
__metadata("design:type", Object)
], LeafletLayersControlDirective.prototype, "layersControlConfig", void 0);
__decorate([
_angular_core.Input('leafletLayersControlOptions'),
__metadata("design:type", Object)
], LeafletLayersControlDirective.prototype, "layersControlOptions", void 0);
LeafletLayersControlDirective = __decorate([
_angular_core.Directive({
selector: '[leafletLayersControl]'
}),
__metadata("design:paramtypes", [exports.LeafletDirective])
], LeafletLayersControlDirective);
var LeafletControlLayersConfig = (function () {
function LeafletControlLayersConfig(baseLayers, overlays) {
this.baseLayers = baseLayers;
this.overlays = overlays;
}
return LeafletControlLayersConfig;
}());
var LeafletBaseLayersDirective = (function () {
function LeafletBaseLayersDirective(leafletDirective) {
this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
this.controlLayers = new LeafletControlLayersWrapper();
}
LeafletBaseLayersDirective.prototype.ngOnInit = function () {
// Init the map
this.leafletDirective.init();
// Initially configure the controlLayers
this.controlLayers
.init({ baseLayers: this.baseLayers }, this.layersControlOptions)
.addTo(this.leafletDirective.getMap());
// Sync the baselayer (will default to the first layer in the map)
this.syncBaseLayer();
};
LeafletBaseLayersDirective.prototype.ngOnChanges = function (changes) {
// Set the new baseLayers
if (changes['baseLayers']) {
this.setBaseLayers(changes['baseLayers'].currentValue, changes['baseLayers'].previousValue);
}
};
LeafletBaseLayersDirective.prototype.setBaseLayers = function (newBaseLayers, prevBaseLayers) {
// Update the layers control
this.controlLayers.setLayersControlConfig(new LeafletControlLayersConfig(newBaseLayers), new LeafletControlLayersConfig(prevBaseLayers));
// Sync the new baseLayer
this.syncBaseLayer();
};
/**
* Check the current base layer and change it to the new one if necessary
*/
LeafletBaseLayersDirective.prototype.syncBaseLayer = function () {
var map$$1 = this.leafletDirective.getMap();
var layers = LeafletUtil.mapToArray(this.baseLayers);
var foundLayer;
// Search all the layers in the map to see if we can find them in the baselayer array
map$$1.eachLayer(function (l) {
foundLayer = layers.find(function (bl) { return l === bl; });
});
// Did we find the layer?
if (null != foundLayer) {
// Yes - set the baselayer to the one we found
this.baseLayer = foundLayer;
}
else {
// No - set the baselayer to the first in the array and add it to the map
if (layers.length > 0) {
this.baseLayer = layers[0];
this.baseLayer.addTo(map$$1);
}
}
};
return LeafletBaseLayersDirective;
}());
__decorate([
_angular_core.Input('leafletBaseLayers'),
__metadata("design:type", Object)
], LeafletBaseLayersDirective.prototype, "baseLayers", void 0);
__decorate([
_angular_core.Input('leafletLayersControlOptions'),
__metadata("design:type", Object)
], LeafletBaseLayersDirective.prototype, "layersControlOptions", void 0);
LeafletBaseLayersDirective = __decorate([
_angular_core.Directive({
selector: '[leafletBaseLayers]'
}),
__metadata("design:paramtypes", [exports.LeafletDirective])
], LeafletBaseLayersDirective);
exports.LeafletModule = (function () {
function LeafletModule() {
}
return LeafletModule;
}());
exports.LeafletModule = __decorate([
_angular_core.NgModule({
imports: [],
exports: [
exports.LeafletDirective,
LeafletLayersDirective,
LeafletLayersControlDirective,
LeafletBaseLayersDirective
],
declarations: [
exports.LeafletDirective,
LeafletLayersDirective,
LeafletLayersControlDirective,
LeafletBaseLayersDirective
],
providers: []
})
], exports.LeafletModule);
var LeafletControlLayersUtil = (function () {
function LeafletControlLayersUtil() {
}
LeafletControlLayersUtil.prototype.diffLayers = function (newLayers, prevLayers) {
var toRemove;
var toAdd;
// Figure out which layers need to be removed (prev - new)
toRemove = LeafletUtil.mapSubtract(prevLayers, newLayers);
// Figure out which layers need to be added (new - prev)
toAdd = LeafletUtil.mapSubtract(newLayers, prevLayers);
return new LeafletLayersObjectDiff(toRemove, toAdd);
};
return LeafletControlLayersUtil;
}());
var LeafletTileLayerDefinition = (function () {
function LeafletTileLayerDefinition(type, url, options) {
this.type = type;
this.url = url;
this.options = options;
}
/**
* Creates a TileLayer from the provided definition. This is a convenience function
* to help with generating layers from objects.
*
* @param layerDef The layer to create
* @returns {L.TileLayer} The TileLayer that has been created
*/
LeafletTileLayerDefinition.createTileLayer = function (layerDef) {
var layer;
switch (layerDef.type) {
case 'xyz':
layer = L.tileLayer(layerDef.url, layerDef.options);
break;
case 'wms':
default:
layer = L.tileLayer.wms(layerDef.url, layerDef.options);
break;
}
return layer;
};
/**
* Creates a TileLayer for each key in the incoming map. This is a convenience function
* for generating an associative array of layers from an associative array of objects
*
* @param layerDefs A map of key to tile layer definition
* @returns {{[p: string]: L.TileLayer}} A new map of key to TileLayer
*/
LeafletTileLayerDefinition.createTileLayers = function (layerDefs) {
var layers = {};
for (var k in layerDefs) {
if (layerDefs.hasOwnProperty(k)) {
layers[k] = (LeafletTileLayerDefinition.createTileLayer(layerDefs[k]));
}
}
return layers;
};
/**
* Create a Tile Layer from the current state of this object
*
* @returns {L.TileLayer} A new TileLayer
*/
LeafletTileLayerDefinition.prototype.createTileLayer = function () {
return LeafletTileLayerDefinition.createTileLayer(this);
};
return LeafletTileLayerDefinition;
}());
exports.LeafletDirectiveWrapper = LeafletDirectiveWrapper;
exports.LeafletControlLayersUtil = LeafletControlLayersUtil;
exports.LeafletLayersUtil = LeafletLayersUtil;
exports.LeafletTileLayerDefinition = LeafletTileLayerDefinition;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=angular2-leaflet.js.map

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

/*! @asymmetrik/angular2-leaflet-1.0.15 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved.*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(this,function(){"use strict";var e=require("./leaflet/leaflet.module");exports.LeafletModule=e.LeafletModule;var t=require("./leaflet/core/leaflet.directive");exports.LeafletDirective=t.LeafletDirective;var l=require("./leaflet/core/leaflet.directive.wrapper");exports.LeafletDirectiveWrapper=l.LeafletDirectiveWrapper;var r=require("./leaflet/layers/control/leaflet-control-layers.util");exports.LeafletControlLayersUtil=r.LeafletControlLayersUtil;var a=require("./leaflet/layers/leaflet-layers.util");exports.LeafletLayersUtil=a.LeafletLayersUtil;var i=require("./leaflet/layers/leaflet-tile-layer-definition.model");exports.LeafletTileLayerDefinition=i.LeafletTileLayerDefinition});
/*! @asymmetrik/angular2-leaflet-1.1.1 - Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved.*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("leaflet")):"function"==typeof define&&define.amd?define(["exports","@angular/core","leaflet"],t):t(e.angular2Sentio=e.angular2Sentio||{},e.ng.core,e.L)}(this,function(e,t,r){"use strict";e.LeafletDirective=function(){function e(e){this.DEFAULT_ZOOM=1,this.DEFAULT_CENTER=r.latLng([38.907192,-77.036871]),this.DEFAULT_FPZ_OPTIONS={},this.fitBoundsOptions=this.DEFAULT_FPZ_OPTIONS,this.panOptions=this.DEFAULT_FPZ_OPTIONS,this.zoomOptions=this.DEFAULT_FPZ_OPTIONS,this.zoomPanOptions=this.DEFAULT_FPZ_OPTIONS,this.options={},this.mapReady=new t.EventEmitter,this.element=e}return e.prototype.ngOnInit=function(){this.map=r.map(this.element.nativeElement,this.options),null!=this.center&&null!=this.zoom&&this.setView(this.center,this.zoom),null!=this.fitBounds&&this.setFitBounds(this.fitBounds),this.doResize(),this.mapReady.emit(this.map)},e.prototype.ngOnChanges=function(e){e.zoom&&e.center&&null!=this.zoom&&null!=this.center?this.setView(e.center.currentValue,e.zoom.currentValue):e.zoom?this.setZoom(e.zoom.currentValue):e.center&&this.setCenter(e.center.currentValue),e.fitBounds&&this.setFitBounds(e.fitBounds.currentValue)},e.prototype.getMap=function(){return this.map},e.prototype.onResize=function(){this.delayResize()},e.prototype.doResize=function(){this.map.invalidateSize({})},e.prototype.delayResize=function(){null!=this.resizeTimer&&clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(this.doResize.bind(this),200)},e.prototype.setView=function(e,t){this.map&&null!=e&&null!=t&&this.map.setView(e,t,this.zoomPanOptions)},e.prototype.setZoom=function(e){this.map&&null!=e&&this.map.setZoom(e,this.zoomOptions)},e.prototype.setCenter=function(e){this.map&&null!=e&&this.map.panTo(e,this.panOptions)},e.prototype.setFitBounds=function(e){this.map&&null!=e&&this.map.fitBounds(e,this.fitBoundsOptions)},e}(),__decorate([t.Input("leafletFitBoundsOptions"),__metadata("design:type",Object)],e.LeafletDirective.prototype,"fitBoundsOptions",void 0),__decorate([t.Input("leafletPanOptions"),__metadata("design:type",Object)],e.LeafletDirective.prototype,"panOptions",void 0),__decorate([t.Input("leafletZoomOptions"),__metadata("design:type",Object)],e.LeafletDirective.prototype,"zoomOptions",void 0),__decorate([t.Input("leafletZoomPanOptions"),__metadata("design:type",Object)],e.LeafletDirective.prototype,"zoomPanOptions",void 0),__decorate([t.Input("leafletOptions"),__metadata("design:type",Object)],e.LeafletDirective.prototype,"options",void 0),__decorate([t.Output("leafletMapReady"),__metadata("design:type",Object)],e.LeafletDirective.prototype,"mapReady",void 0),__decorate([t.Input("leafletZoom"),__metadata("design:type",Number)],e.LeafletDirective.prototype,"zoom",void 0),__decorate([t.Input("leafletCenter"),__metadata("design:type",r.LatLng)],e.LeafletDirective.prototype,"center",void 0),__decorate([t.Input("leafletFitBounds"),__metadata("design:type",r.LatLngBounds)],e.LeafletDirective.prototype,"fitBounds",void 0),__decorate([t.HostListener("window:resize",["$event"]),__metadata("design:type",Function),__metadata("design:paramtypes",[]),__metadata("design:returntype",void 0)],e.LeafletDirective.prototype,"onResize",null),e.LeafletDirective=__decorate([t.Directive({selector:"[leaflet]"}),__metadata("design:paramtypes",[t.ElementRef])],e.LeafletDirective);var n=function(){function e(e){this.leafletDirective=e}return e.prototype.init=function(){},e.prototype.getMap=function(){return this.leafletDirective.getMap()},e}(),i=function(){function e(e,t){this.remove=e,this.add=t}return e}(),o=function(){function e(){}return e.diffLayers=function(e,t){var r,n;return null==e&&(e=[]),null==t&&(t=[]),r=t.filter(function(t){return!e.find(function(e){return t===e})}),n=e.filter(function(e){return!t.find(function(t){return e===t})}),new i(r,n)},e}(),a=function(){function e(e){this.leafletDirective=new n(e)}return e.prototype.ngOnInit=function(){this.leafletDirective.init(),this.setLayers(this.layers,[])},e.prototype.ngOnChanges=function(e){if(e.layers){var t=e.layers.currentValue,r=e.layers.isFirstChange()?[]:e.layers.previousValue;this.setLayers(t,r)}},e.prototype.setLayers=function(e,t){var r=this.leafletDirective.getMap();if(null!=r){var n=o.diffLayers(e,t);n.remove.forEach(function(e){r.removeLayer(e)}),n.add.forEach(function(e){r.addLayer(e)})}},e}();__decorate([t.Input("leafletLayers"),__metadata("design:type",Array)],a.prototype,"layers",void 0),a=__decorate([t.Directive({selector:"[leafletLayers]"}),__metadata("design:paramtypes",[e.LeafletDirective])],a);var s=function(){function e(){}return e.mergeMaps=function(e,t){var r={};if(null!=e)for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);if(null!=t)for(var n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r},e.mapSubtract=function(e,t){var r={};if(null!=e){for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);if(null!=t)for(var n in t)t.hasOwnProperty(n)&&delete r[n]}return r},e.mapToArray=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(e[r]);return t},e}(),l=function(){function e(e,t){this.remove=e,this.add=t}return e}(),p=function(){function e(){}return e.prototype.getLayersControl=function(){return this.layersControl},e.prototype.init=function(e,t){var n=e.baseLayers||{},i=e.overlays||{};return this.layersControl=r.control.layers(n,i,t),this.layersControl},e.prototype.setLayersControlConfig=function(e,t){if(null==this.layersControl)return new l({},{});var r,n,i;r=s.mergeMaps(s.mapSubtract(t.baseLayers,e.baseLayers),s.mapSubtract(t.overlays,e.overlays)),n=s.mapSubtract(e.baseLayers,t.baseLayers),i=s.mapSubtract(e.overlays,t.overlays);for(var o in r)if(r.hasOwnProperty(o)){var a=r[o];this.layersControl.removeLayer(a)}for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];this.layersControl.addBaseLayer(a,o)}for(var o in i)if(i.hasOwnProperty(o)){var a=i[o];this.layersControl.addOverlay(a,o)}return new l(r,s.mergeMaps(n,i))},e}(),u=function(){function e(e){this.leafletDirective=new n(e),this.controlLayers=new p}return e.prototype.ngOnInit=function(){this.leafletDirective.init(),this.controlLayers.init(this.layersControlConfig,this.layersControlOptions).addTo(this.leafletDirective.getMap())},e.prototype.ngOnChanges=function(e){e.layersControlCfg&&this.controlLayers.setLayersControlConfig(e.layersControlCfg.currentValue,e.layersControlCfg.previousValue)},e}();__decorate([t.Input("leafletLayersControl"),__metadata("design:type",Object)],u.prototype,"layersControlConfig",void 0),__decorate([t.Input("leafletLayersControlOptions"),__metadata("design:type",Object)],u.prototype,"layersControlOptions",void 0),u=__decorate([t.Directive({selector:"[leafletLayersControl]"}),__metadata("design:paramtypes",[e.LeafletDirective])],u);var c=function(){function e(e,t){this.baseLayers=e,this.overlays=t}return e}(),f=function(){function e(e){this.leafletDirective=new n(e),this.controlLayers=new p}return e.prototype.ngOnInit=function(){this.leafletDirective.init(),this.controlLayers.init({baseLayers:this.baseLayers},this.layersControlOptions).addTo(this.leafletDirective.getMap()),this.syncBaseLayer()},e.prototype.ngOnChanges=function(e){e.baseLayers&&this.setBaseLayers(e.baseLayers.currentValue,e.baseLayers.previousValue)},e.prototype.setBaseLayers=function(e,t){this.controlLayers.setLayersControlConfig(new c(e),new c(t)),this.syncBaseLayer()},e.prototype.syncBaseLayer=function(){var e,t=this.leafletDirective.getMap(),r=s.mapToArray(this.baseLayers);t.eachLayer(function(t){e=r.find(function(e){return t===e})}),null!=e?this.baseLayer=e:r.length>0&&(this.baseLayer=r[0],this.baseLayer.addTo(t))},e}();__decorate([t.Input("leafletBaseLayers"),__metadata("design:type",Object)],f.prototype,"baseLayers",void 0),__decorate([t.Input("leafletLayersControlOptions"),__metadata("design:type",Object)],f.prototype,"layersControlOptions",void 0),f=__decorate([t.Directive({selector:"[leafletBaseLayers]"}),__metadata("design:paramtypes",[e.LeafletDirective])],f),e.LeafletModule=function(){function e(){}return e}(),e.LeafletModule=__decorate([t.NgModule({imports:[],exports:[e.LeafletDirective,a,u,f],declarations:[e.LeafletDirective,a,u,f],providers:[]})],e.LeafletModule);var y=function(){function e(){}return e.prototype.diffLayers=function(e,t){var r,n;return r=s.mapSubtract(t,e),n=s.mapSubtract(e,t),new l(r,n)},e}(),d=function(){function e(e,t,r){this.type=e,this.url=t,this.options=r}return e.createTileLayer=function(e){var t;switch(e.type){case"xyz":t=L.tileLayer(e.url,e.options);break;case"wms":default:t=L.tileLayer.wms(e.url,e.options)}return t},e.createTileLayers=function(t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e.createTileLayer(t[n]));return r},e.prototype.createTileLayer=function(){return e.createTileLayer(this)},e}();e.LeafletDirectiveWrapper=n,e.LeafletControlLayersUtil=y,e.LeafletLayersUtil=o,e.LeafletTileLayerDefinition=d,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -1,15 +0,8 @@

"use strict";
var leaflet_module_1 = require("./leaflet/leaflet.module");
exports.LeafletModule = leaflet_module_1.LeafletModule;
var leaflet_directive_1 = require("./leaflet/core/leaflet.directive");
exports.LeafletDirective = leaflet_directive_1.LeafletDirective;
var leaflet_directive_wrapper_1 = require("./leaflet/core/leaflet.directive.wrapper");
exports.LeafletDirectiveWrapper = leaflet_directive_wrapper_1.LeafletDirectiveWrapper;
var leaflet_control_layers_util_1 = require("./leaflet/layers/control/leaflet-control-layers.util");
exports.LeafletControlLayersUtil = leaflet_control_layers_util_1.LeafletControlLayersUtil;
var leaflet_layers_util_1 = require("./leaflet/layers/leaflet-layers.util");
exports.LeafletLayersUtil = leaflet_layers_util_1.LeafletLayersUtil;
var leaflet_tile_layer_definition_model_1 = require("./leaflet/layers/leaflet-tile-layer-definition.model");
exports.LeafletTileLayerDefinition = leaflet_tile_layer_definition_model_1.LeafletTileLayerDefinition;
export { LeafletModule } from './leaflet/leaflet.module';
export { LeafletDirective } from './leaflet/core/leaflet.directive';
export { LeafletDirectiveWrapper } from './leaflet/core/leaflet.directive.wrapper';
export { LeafletControlLayersUtil } from './leaflet/layers/control/leaflet-control-layers.util';
export { LeafletLayersUtil } from './leaflet/layers/leaflet-layers.util';
export { LeafletTileLayerDefinition } from './leaflet/layers/leaflet-tile-layer-definition.model';
//# sourceMappingURL=index.js.map

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

"use strict";
var core_1 = require("@angular/core");
var L = require("leaflet");
import { Directive, ElementRef, EventEmitter, HostListener, Input, Output } from '@angular/core';
import * as L from 'leaflet';
var LeafletDirective = (function () {

@@ -16,3 +15,3 @@ function LeafletDirective(el) {

// Configure callback function for the map
this.mapReady = new core_1.EventEmitter();
this.mapReady = new EventEmitter();
this.element = el;

@@ -121,39 +120,39 @@ }

__decorate([
core_1.Input('leafletFitBoundsOptions'),
Input('leafletFitBoundsOptions'),
__metadata("design:type", Object)
], LeafletDirective.prototype, "fitBoundsOptions", void 0);
__decorate([
core_1.Input('leafletPanOptions'),
Input('leafletPanOptions'),
__metadata("design:type", Object)
], LeafletDirective.prototype, "panOptions", void 0);
__decorate([
core_1.Input('leafletZoomOptions'),
Input('leafletZoomOptions'),
__metadata("design:type", Object)
], LeafletDirective.prototype, "zoomOptions", void 0);
__decorate([
core_1.Input('leafletZoomPanOptions'),
Input('leafletZoomPanOptions'),
__metadata("design:type", Object)
], LeafletDirective.prototype, "zoomPanOptions", void 0);
__decorate([
core_1.Input('leafletOptions'),
Input('leafletOptions'),
__metadata("design:type", Object)
], LeafletDirective.prototype, "options", void 0);
__decorate([
core_1.Output('leafletMapReady'),
Output('leafletMapReady'),
__metadata("design:type", Object)
], LeafletDirective.prototype, "mapReady", void 0);
__decorate([
core_1.Input('leafletZoom'),
Input('leafletZoom'),
__metadata("design:type", Number)
], LeafletDirective.prototype, "zoom", void 0);
__decorate([
core_1.Input('leafletCenter'),
__metadata("design:type", Object)
Input('leafletCenter'),
__metadata("design:type", L.LatLng)
], LeafletDirective.prototype, "center", void 0);
__decorate([
core_1.Input('leafletFitBounds'),
__metadata("design:type", Object)
Input('leafletFitBounds'),
__metadata("design:type", L.LatLngBounds)
], LeafletDirective.prototype, "fitBounds", void 0);
__decorate([
core_1.HostListener('window:resize', ['$event']),
HostListener('window:resize', ['$event']),
__metadata("design:type", Function),

@@ -164,9 +163,9 @@ __metadata("design:paramtypes", []),

LeafletDirective = __decorate([
core_1.Directive({
Directive({
selector: '[leaflet]'
}),
__metadata("design:paramtypes", [core_1.ElementRef])
__metadata("design:paramtypes", [ElementRef])
], LeafletDirective);
exports.LeafletDirective = LeafletDirective;
export { LeafletDirective };
//# sourceMappingURL=leaflet.directive.js.map

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

"use strict";
var LeafletDirectiveWrapper = (function () {

@@ -6,3 +5,5 @@ function LeafletDirectiveWrapper(leafletDirective) {

}
LeafletDirectiveWrapper.prototype.init = function () { };
LeafletDirectiveWrapper.prototype.init = function () {
// Nothing for now
};
LeafletDirectiveWrapper.prototype.getMap = function () {

@@ -13,4 +14,4 @@ return this.leafletDirective.getMap();

}());
exports.LeafletDirectiveWrapper = LeafletDirectiveWrapper;
export { LeafletDirectiveWrapper };
//# sourceMappingURL=leaflet.directive.wrapper.js.map

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

"use strict";
var LeafletUtil = (function () {

@@ -71,4 +70,4 @@ function LeafletUtil() {

}());
exports.LeafletUtil = LeafletUtil;
export { LeafletUtil };
//# sourceMappingURL=leaflet.util.js.map

@@ -6,3 +6,3 @@ /// <reference types="leaflet" />

export declare class LeafletBaseLayersDirective implements OnChanges, OnInit {
baseLayers: L.control.LayersObject;
baseLayers: L.Control.LayersObject;
layersControlOptions: L.Control.LayersOptions;

@@ -17,3 +17,3 @@ baseLayer: L.Layer;

}): void;
protected setBaseLayers(newBaseLayers: L.control.LayersObject, prevBaseLayers: L.control.LayersObject): void;
protected setBaseLayers(newBaseLayers: L.Control.LayersObject, prevBaseLayers: L.Control.LayersObject): void;
/**

@@ -20,0 +20,0 @@ * Check the current base layer and change it to the new one if necessary

@@ -1,13 +0,12 @@

"use strict";
var core_1 = require("@angular/core");
var L = require("leaflet");
var leaflet_util_1 = require("../../core/leaflet.util");
var leaflet_directive_1 = require("../../core/leaflet.directive");
var leaflet_directive_wrapper_1 = require("../../core/leaflet.directive.wrapper");
var leaflet_control_layers_wrapper_1 = require("../control/leaflet-control-layers.wrapper");
var leaflet_control_layers_config_model_1 = require("../control/leaflet-control-layers-config.model");
import { Directive, Input } from '@angular/core';
import * as L from 'leaflet';
import { LeafletUtil } from '../../core/leaflet.util';
import { LeafletDirective } from '../../core/leaflet.directive';
import { LeafletDirectiveWrapper } from '../../core/leaflet.directive.wrapper';
import { LeafletControlLayersWrapper } from '../control/leaflet-control-layers.wrapper';
import { LeafletControlLayersConfig } from '../control/leaflet-control-layers-config.model';
var LeafletBaseLayersDirective = (function () {
function LeafletBaseLayersDirective(leafletDirective) {
this.leafletDirective = new leaflet_directive_wrapper_1.LeafletDirectiveWrapper(leafletDirective);
this.controlLayers = new leaflet_control_layers_wrapper_1.LeafletControlLayersWrapper();
this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
this.controlLayers = new LeafletControlLayersWrapper();
}

@@ -32,3 +31,3 @@ LeafletBaseLayersDirective.prototype.ngOnInit = function () {

// Update the layers control
this.controlLayers.setLayersControlConfig(new leaflet_control_layers_config_model_1.LeafletControlLayersConfig(newBaseLayers), new leaflet_control_layers_config_model_1.LeafletControlLayersConfig(prevBaseLayers));
this.controlLayers.setLayersControlConfig(new LeafletControlLayersConfig(newBaseLayers), new LeafletControlLayersConfig(prevBaseLayers));
// Sync the new baseLayer

@@ -42,3 +41,3 @@ this.syncBaseLayer();

var map = this.leafletDirective.getMap();
var layers = leaflet_util_1.LeafletUtil.mapToArray(this.baseLayers);
var layers = LeafletUtil.mapToArray(this.baseLayers);
var foundLayer;

@@ -65,17 +64,17 @@ // Search all the layers in the map to see if we can find them in the baselayer array

__decorate([
core_1.Input('leafletBaseLayers'),
Input('leafletBaseLayers'),
__metadata("design:type", Object)
], LeafletBaseLayersDirective.prototype, "baseLayers", void 0);
__decorate([
core_1.Input('leafletLayersControlOptions'),
Input('leafletLayersControlOptions'),
__metadata("design:type", Object)
], LeafletBaseLayersDirective.prototype, "layersControlOptions", void 0);
LeafletBaseLayersDirective = __decorate([
core_1.Directive({
Directive({
selector: '[leafletBaseLayers]'
}),
__metadata("design:paramtypes", [leaflet_directive_1.LeafletDirective])
__metadata("design:paramtypes", [LeafletDirective])
], LeafletBaseLayersDirective);
exports.LeafletBaseLayersDirective = LeafletBaseLayersDirective;
export { LeafletBaseLayersDirective };
//# sourceMappingURL=leaflet-baselayers.directive.js.map
/// <reference types="leaflet" />
import * as L from 'leaflet';
export declare class LeafletControlLayersConfig {
baseLayers: L.control.LayersObject;
overlays: L.control.LayersObject;
constructor(baseLayers?: L.control.LayersObject, overlays?: L.control.LayersObject);
baseLayers: L.Control.LayersObject;
overlays: L.Control.LayersObject;
constructor(baseLayers?: L.Control.LayersObject, overlays?: L.Control.LayersObject);
}

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

"use strict";
var LeafletControlLayersConfig = (function () {

@@ -9,4 +8,4 @@ function LeafletControlLayersConfig(baseLayers, overlays) {

}());
exports.LeafletControlLayersConfig = LeafletControlLayersConfig;
export { LeafletControlLayersConfig };
//# sourceMappingURL=leaflet-control-layers-config.model.js.map

@@ -1,10 +0,9 @@

"use strict";
var core_1 = require("@angular/core");
var leaflet_directive_1 = require("../../core/leaflet.directive");
var leaflet_directive_wrapper_1 = require("../../core/leaflet.directive.wrapper");
var leaflet_control_layers_wrapper_1 = require("./leaflet-control-layers.wrapper");
import { Directive, Input } from '@angular/core';
import { LeafletDirective } from '../../core/leaflet.directive';
import { LeafletDirectiveWrapper } from '../../core/leaflet.directive.wrapper';
import { LeafletControlLayersWrapper } from './leaflet-control-layers.wrapper';
var LeafletLayersControlDirective = (function () {
function LeafletLayersControlDirective(leafletDirective) {
this.leafletDirective = new leaflet_directive_wrapper_1.LeafletDirectiveWrapper(leafletDirective);
this.controlLayers = new leaflet_control_layers_wrapper_1.LeafletControlLayersWrapper();
this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
this.controlLayers = new LeafletControlLayersWrapper();
}

@@ -28,17 +27,17 @@ LeafletLayersControlDirective.prototype.ngOnInit = function () {

__decorate([
core_1.Input('leafletLayersControl'),
Input('leafletLayersControl'),
__metadata("design:type", Object)
], LeafletLayersControlDirective.prototype, "layersControlConfig", void 0);
__decorate([
core_1.Input('leafletLayersControlOptions'),
Input('leafletLayersControlOptions'),
__metadata("design:type", Object)
], LeafletLayersControlDirective.prototype, "layersControlOptions", void 0);
LeafletLayersControlDirective = __decorate([
core_1.Directive({
Directive({
selector: '[leafletLayersControl]'
}),
__metadata("design:paramtypes", [leaflet_directive_1.LeafletDirective])
__metadata("design:paramtypes", [LeafletDirective])
], LeafletLayersControlDirective);
exports.LeafletLayersControlDirective = LeafletLayersControlDirective;
export { LeafletLayersControlDirective };
//# sourceMappingURL=leaflet-control-layers.directive.js.map

@@ -5,3 +5,3 @@ /// <reference types="leaflet" />

export declare class LeafletControlLayersUtil {
diffLayers(newLayers: L.control.LayersObject, prevLayers: L.control.LayersObject): LeafletLayersObjectDiff;
diffLayers(newLayers: L.Control.LayersObject, prevLayers: L.Control.LayersObject): LeafletLayersObjectDiff;
}

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

"use strict";
var leaflet_util_1 = require("../../core/leaflet.util");
var leaflet_layers_object_diff_model_1 = require("../control/leaflet-layers-object-diff.model");
import { LeafletUtil } from '../../core/leaflet.util';
import { LeafletLayersObjectDiff } from '../control/leaflet-layers-object-diff.model';
var LeafletControlLayersUtil = (function () {

@@ -11,11 +10,11 @@ function LeafletControlLayersUtil() {

// Figure out which layers need to be removed (prev - new)
toRemove = leaflet_util_1.LeafletUtil.mapSubtract(prevLayers, newLayers);
toRemove = LeafletUtil.mapSubtract(prevLayers, newLayers);
// Figure out which layers need to be added (new - prev)
toAdd = leaflet_util_1.LeafletUtil.mapSubtract(newLayers, prevLayers);
return new leaflet_layers_object_diff_model_1.LeafletLayersObjectDiff(toRemove, toAdd);
toAdd = LeafletUtil.mapSubtract(newLayers, prevLayers);
return new LeafletLayersObjectDiff(toRemove, toAdd);
};
return LeafletControlLayersUtil;
}());
exports.LeafletControlLayersUtil = LeafletControlLayersUtil;
export { LeafletControlLayersUtil };
//# sourceMappingURL=leaflet-control-layers.util.js.map

@@ -1,5 +0,4 @@

"use strict";
var L = require("leaflet");
var leaflet_util_1 = require("../../core/leaflet.util");
var leaflet_layers_object_diff_model_1 = require("./leaflet-layers-object-diff.model");
import * as L from 'leaflet';
import { LeafletUtil } from '../../core/leaflet.util';
import { LeafletLayersObjectDiff } from './leaflet-layers-object-diff.model';
var LeafletControlLayersWrapper = (function () {

@@ -19,3 +18,3 @@ function LeafletControlLayersWrapper() {

if (null == this.layersControl) {
return new leaflet_layers_object_diff_model_1.LeafletLayersObjectDiff({}, {});
return new LeafletLayersObjectDiff({}, {});
}

@@ -26,6 +25,6 @@ var toRemove;

// Figure out which layers need to be removed (prev - new)
toRemove = leaflet_util_1.LeafletUtil.mergeMaps(leaflet_util_1.LeafletUtil.mapSubtract(prevConfig.baseLayers, newConfig.baseLayers), leaflet_util_1.LeafletUtil.mapSubtract(prevConfig.overlays, newConfig.overlays));
toRemove = LeafletUtil.mergeMaps(LeafletUtil.mapSubtract(prevConfig.baseLayers, newConfig.baseLayers), LeafletUtil.mapSubtract(prevConfig.overlays, newConfig.overlays));
// Figure out which layers need to be added (new - prev)
baseLayers = leaflet_util_1.LeafletUtil.mapSubtract(newConfig.baseLayers, prevConfig.baseLayers);
overlays = leaflet_util_1.LeafletUtil.mapSubtract(newConfig.overlays, prevConfig.overlays);
baseLayers = LeafletUtil.mapSubtract(newConfig.baseLayers, prevConfig.baseLayers);
overlays = LeafletUtil.mapSubtract(newConfig.overlays, prevConfig.overlays);
// Do the actual removal and addition

@@ -50,8 +49,8 @@ for (var k in toRemove) {

}
return new leaflet_layers_object_diff_model_1.LeafletLayersObjectDiff(toRemove, leaflet_util_1.LeafletUtil.mergeMaps(baseLayers, overlays));
return new LeafletLayersObjectDiff(toRemove, LeafletUtil.mergeMaps(baseLayers, overlays));
};
return LeafletControlLayersWrapper;
}());
exports.LeafletControlLayersWrapper = LeafletControlLayersWrapper;
export { LeafletControlLayersWrapper };
//# sourceMappingURL=leaflet-control-layers.wrapper.js.map
/// <reference types="leaflet" />
import * as L from 'leaflet';
export declare class LeafletLayersObjectDiff {
remove: L.control.LayersObject;
add: L.control.LayersObject;
constructor(remove: L.control.LayersObject, add: L.control.LayersObject);
remove: L.Control.LayersObject;
add: L.Control.LayersObject;
constructor(remove: L.Control.LayersObject, add: L.Control.LayersObject);
}

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

"use strict";
var LeafletLayersObjectDiff = (function () {

@@ -9,4 +8,4 @@ function LeafletLayersObjectDiff(remove, add) {

}());
exports.LeafletLayersObjectDiff = LeafletLayersObjectDiff;
export { LeafletLayersObjectDiff };
//# sourceMappingURL=leaflet-layers-object-diff.model.js.map

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

"use strict";
var LeafletLayerDiff = (function () {

@@ -9,4 +8,4 @@ function LeafletLayerDiff(remove, add) {

}());
exports.LeafletLayerDiff = LeafletLayerDiff;
export { LeafletLayerDiff };
//# sourceMappingURL=leaflet-layer-diff.model.js.map

@@ -1,9 +0,8 @@

"use strict";
var core_1 = require("@angular/core");
var leaflet_directive_1 = require("../core/leaflet.directive");
var leaflet_directive_wrapper_1 = require("../core/leaflet.directive.wrapper");
var leaflet_layers_util_1 = require("./leaflet-layers.util");
import { Directive, Input } from '@angular/core';
import { LeafletDirective } from '../core/leaflet.directive';
import { LeafletDirectiveWrapper } from '../core/leaflet.directive.wrapper';
import { LeafletLayersUtil } from './leaflet-layers.util';
var LeafletLayersDirective = (function () {
function LeafletLayersDirective(leafletDirective) {
this.leafletDirective = new leaflet_directive_wrapper_1.LeafletDirectiveWrapper(leafletDirective);
this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
}

@@ -31,3 +30,3 @@ LeafletLayersDirective.prototype.ngOnInit = function () {

if (null != map) {
var diff = leaflet_layers_util_1.LeafletLayersUtil.diffLayers(newLayers, prevLayers);
var diff = LeafletLayersUtil.diffLayers(newLayers, prevLayers);
// Remove the layers

@@ -42,13 +41,13 @@ diff.remove.forEach(function (l) { map.removeLayer(l); });

__decorate([
core_1.Input('leafletLayers'),
Input('leafletLayers'),
__metadata("design:type", Array)
], LeafletLayersDirective.prototype, "layers", void 0);
LeafletLayersDirective = __decorate([
core_1.Directive({
Directive({
selector: '[leafletLayers]'
}),
__metadata("design:paramtypes", [leaflet_directive_1.LeafletDirective])
__metadata("design:paramtypes", [LeafletDirective])
], LeafletLayersDirective);
exports.LeafletLayersDirective = LeafletLayersDirective;
export { LeafletLayersDirective };
//# sourceMappingURL=leaflet-layers.directive.js.map

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

"use strict";
var leaflet_layer_diff_model_1 = require("./leaflet-layer-diff.model");
import { LeafletLayerDiff } from './leaflet-layer-diff.model';
var LeafletLayersUtil = (function () {

@@ -25,8 +24,8 @@ function LeafletLayersUtil() {

});
return new leaflet_layer_diff_model_1.LeafletLayerDiff(toRemove, toAdd);
return new LeafletLayerDiff(toRemove, toAdd);
};
return LeafletLayersUtil;
}());
exports.LeafletLayersUtil = LeafletLayersUtil;
export { LeafletLayersUtil };
//# sourceMappingURL=leaflet-layers.util.js.map

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

"use strict";
var LeafletTileLayerDefinition = (function () {

@@ -54,4 +53,4 @@ function LeafletTileLayerDefinition(type, url, options) {

}());
exports.LeafletTileLayerDefinition = LeafletTileLayerDefinition;
export { LeafletTileLayerDefinition };
//# sourceMappingURL=leaflet-tile-layer-definition.model.js.map

@@ -1,7 +0,6 @@

"use strict";
var core_1 = require("@angular/core");
var leaflet_directive_1 = require("./core/leaflet.directive");
var leaflet_layers_directive_1 = require("./layers/leaflet-layers.directive");
var leaflet_control_layers_directive_1 = require("./layers/control/leaflet-control-layers.directive");
var leaflet_baselayers_directive_1 = require("./layers/base/leaflet-baselayers.directive");
import { NgModule } from '@angular/core';
import { LeafletDirective } from './core/leaflet.directive';
import { LeafletLayersDirective } from './layers/leaflet-layers.directive';
import { LeafletLayersControlDirective } from './layers/control/leaflet-control-layers.directive';
import { LeafletBaseLayersDirective } from './layers/base/leaflet-baselayers.directive';
var LeafletModule = (function () {

@@ -13,15 +12,15 @@ function LeafletModule() {

LeafletModule = __decorate([
core_1.NgModule({
NgModule({
imports: [],
exports: [
leaflet_directive_1.LeafletDirective,
leaflet_layers_directive_1.LeafletLayersDirective,
leaflet_control_layers_directive_1.LeafletLayersControlDirective,
leaflet_baselayers_directive_1.LeafletBaseLayersDirective
LeafletDirective,
LeafletLayersDirective,
LeafletLayersControlDirective,
LeafletBaseLayersDirective
],
declarations: [
leaflet_directive_1.LeafletDirective,
leaflet_layers_directive_1.LeafletLayersDirective,
leaflet_control_layers_directive_1.LeafletLayersControlDirective,
leaflet_baselayers_directive_1.LeafletBaseLayersDirective
LeafletDirective,
LeafletLayersDirective,
LeafletLayersControlDirective,
LeafletBaseLayersDirective
],

@@ -31,4 +30,4 @@ providers: []

], LeafletModule);
exports.LeafletModule = LeafletModule;
export { LeafletModule };
//# sourceMappingURL=leaflet.module.js.map

@@ -21,3 +21,3 @@ 'use strict';

// Banner to append to generated files
let bannerString = '/*! ' + pkg.name + '-' + pkg.version + ' - ' + pkg.copyright + '*/'
let bannerString = '/*! ' + pkg.name + '-' + pkg.version + ' - ' + pkg.copyright + '*/';

@@ -39,9 +39,7 @@ /**

// Grab the tslint config
var config = require(path.resolve('./config/tslint.config.js'));
config.formatter = 'prose';
return gulp.src(assets.src.allTs)
// Lint the Typescript
.pipe(plugins.tslint(config))
.pipe(plugins.tslint({
formatter: 'prose'
}))
.pipe(plugins.tslint.report({

@@ -60,3 +58,3 @@ summarizeFailureOutput: true,

// Build JS from the TS source
var tsProject = plugins.typescript.createProject(path.resolve('./tsconfig.json'));
let tsProject = plugins.typescript.createProject(path.resolve('./tsconfig.json'));
gulp.task('build-ts', () => {

@@ -92,3 +90,13 @@

return rollup.rollup({
entry: path.join(assets.dist.dir, '/index.js')
entry: path.join(assets.dist.dir, '/index.js'),
external: [
'@angular/core',
'leaflet'
],
onwarn: (warning) => {
if ('THIS_IS_UNDEFINED' === warning.code) {
return;
}
plugins.util.log(warning.message);
}
})

@@ -103,3 +111,4 @@ .then((bundle) => {

globals: {
'@angular/core': 'ng.core'
'@angular/core': 'ng.core',
'leaflet': 'L'
}

@@ -117,4 +126,4 @@ });

// Start a webpack-dev-server
var webpackConfig = require(path.resolve('./config/webpack.config.js'))();
var compiler = webpack(webpackConfig);
let webpackConfig = require(path.resolve('./config/webpack.config.js'))();
let compiler = webpack(webpackConfig);

@@ -121,0 +130,0 @@ new webpackDevServer(compiler, {

@@ -5,3 +5,4 @@ {

"description": "Angular 2 components for Leaflet",
"version": "1.0.15",
"version": "1.1.1",
"author": "Asymmetrik, Ltd.",

@@ -12,3 +13,3 @@ "copyright": "Copyright Asymmetrik, Ltd. 2007-2017 - All Rights Reserved.",

"main": "dist/bundles/angular2-leaflet.js",
"module": "src/index.ts",
"module": "dist/index.js",
"typings": "dist/index.d.ts",

@@ -42,7 +43,7 @@

"core-js": "2.4",
"reflect-metadata": "0.1",
"rxjs": "5.0",
"@types/core-js": "0.9",
"rxjs": "5.1",
"zone.js": "0.7",
"@types/core-js": "0.9",
"@types/node": "6.0",

@@ -56,12 +57,12 @@

"tslint": "4.4",
"tslint-stylish": "2.1.0-beta",
"tslint-stylish": "2.1",
"webpack": "2.2",
"webpack-dev-server": "1.16",
"webpack-dev-server": "2.3",
"angular2-template-loader": "0.6",
"css-loader": "0.26",
"file-loader": "0.9",
"file-loader": "0.10",
"html-loader": "0.4",
"resolve-url-loader": "1.6",
"sass-loader": "4.1",
"sass-loader": "5.0",
"style-loader": "0.13",

@@ -74,13 +75,13 @@ "ts-loader": "2.0",

"gulp-insert": "0.5",
"gulp-load-plugins": "1.4",
"gulp-load-plugins": "1.5",
"gulp-rename": "1.2",
"gulp-sourcemaps": "2.4",
"gulp-typescript": "3.1",
"gulp-tslint": "7.0",
"gulp-tslint": "7.1",
"gulp-uglify": "2.0",
"gulp-util": "3.0",
"run-sequence": "1.2",
"node-sass": "4.3"
"node-sass": "4.5"
}
}

@@ -7,2 +7,4 @@ import { Component } from '@angular/core';

})
export class AppComponent { }
export class AppComponent {
// Empty component
}

@@ -81,5 +81,2 @@ import { Component } from '@angular/core';

constructor() { }
onApply() {

@@ -86,0 +83,0 @@ this.zoom = this.model.zoom;

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

import * as L from 'leaflet';
export class LeafletCoreDemoModel {

@@ -4,0 +2,0 @@

@@ -5,4 +5,2 @@ import { Component } from '@angular/core';

import { LeafletLayersDemoModel } from './layers-demo.model';
@Component({

@@ -45,3 +43,2 @@ selector: 'leafletBaselayersDemo',

constructor() {}
}

@@ -21,5 +21,5 @@ /**

// Polyfills
import 'core-js/es6';
import 'core-js/es7/reflect';
import 'ts-helpers';
import 'reflect-metadata';
import 'zone.js';

@@ -39,6 +39,6 @@ // Global Imports

// Angular2 Imports
import '@angular/common';
import '@angular/core';
import '@angular/platform-browser';
import '@angular/platform-browser-dynamic';
import '@angular/core';
import '@angular/common';

@@ -50,2 +50,3 @@ // Angular2 Third-Party

import 'rxjs';
import 'zone.js';

@@ -10,3 +10,1 @@ export { LeafletModule } from './leaflet/leaflet.module';

export { LeafletTileLayerDefinition } from './leaflet/layers/leaflet-tile-layer-definition.model';

@@ -12,3 +12,5 @@ import { LeafletDirective } from './leaflet.directive';

public init() { }
public init() {
// Nothing for now
}

@@ -15,0 +17,0 @@ public getMap() {

@@ -19,3 +19,3 @@ import { Directive, Input, OnChanges, OnInit, SimpleChange } from '@angular/core';

// Base Layers
@Input('leafletBaseLayers') baseLayers: L.control.LayersObject;
@Input('leafletBaseLayers') baseLayers: L.Control.LayersObject;

@@ -61,3 +61,3 @@ // Control Options

protected setBaseLayers(newBaseLayers: L.control.LayersObject, prevBaseLayers: L.control.LayersObject) {
protected setBaseLayers(newBaseLayers: L.Control.LayersObject, prevBaseLayers: L.Control.LayersObject) {

@@ -83,3 +83,3 @@ // Update the layers control

// Search all the layers in the map to see if we can find them in the baselayer array
map.eachLayer((l) => {
map.eachLayer((l: L.Layer) => {
foundLayer = layers.find((bl) => { return l === bl; });

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

@@ -5,5 +5,5 @@ import * as L from 'leaflet';

constructor(
public baseLayers?: L.control.LayersObject,
public overlays?: L.control.LayersObject
public baseLayers?: L.Control.LayersObject,
public overlays?: L.Control.LayersObject
) { }
}

@@ -8,3 +8,3 @@ import * as L from 'leaflet';

public diffLayers(newLayers: L.control.LayersObject, prevLayers: L.control.LayersObject): LeafletLayersObjectDiff {
public diffLayers(newLayers: L.Control.LayersObject, prevLayers: L.Control.LayersObject): LeafletLayersObjectDiff {
let toRemove: {};

@@ -11,0 +11,0 @@ let toAdd: {};

@@ -32,5 +32,5 @@ import * as L from 'leaflet';

let toRemove: L.control.LayersObject;
let baseLayers: L.control.LayersObject;
let overlays: L.control.LayersObject;
let toRemove: L.Control.LayersObject;
let baseLayers: L.Control.LayersObject;
let overlays: L.Control.LayersObject;

@@ -37,0 +37,0 @@ // Figure out which layers need to be removed (prev - new)

@@ -6,6 +6,6 @@ import * as L from 'leaflet';

constructor(
public remove: L.control.LayersObject,
public add: L.control.LayersObject
public remove: L.Control.LayersObject,
public add: L.Control.LayersObject
) { }
}
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"module": "commonjs",
"moduleResolution": "node",
"declaration": false,
"noEmitHelpers": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noEmitHelpers": true,
"lib": [ "es5", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"allowUnreachableCode": false,
"noUnusedParameters": true,
"noUnusedLocals": true,
"suppressImplicitAnyIndexErrors": true,
"sourceMap": true
}
},
"exclude": [
"node_modules"
]
}
{
"compilerOptions": {
"target": "es5",
"module": "es6",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"noEmitHelpers": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noEmitHelpers": true,
"lib": [ "es5", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"allowUnreachableCode": false,
"noUnusedParameters": true,
"noUnusedLocals": true,
"suppressImplicitAnyIndexErrors": true,
"declaration": true,
"sourceMap": true

@@ -23,3 +27,7 @@ },

"src/**/*"
],
"exclude": [
"node_modules"
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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