You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

presentation-maps

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

presentation-maps - npm Package Compare versions

Comparing version

to
2.8.1

2

dist/presentation-maps.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("presentation-decorator"),require("load-google-maps-api")):"function"==typeof define&&define.amd?define("presentation-maps",["presentation-decorator","load-google-maps-api"],t):"object"==typeof exports?exports["presentation-maps"]=t(require("presentation-decorator"),require("load-google-maps-api")):e["presentation-maps"]=t(e["presentation-decorator"],e["load-google-maps-api"])}(this,function(e,t){return function(e){var t={};function o(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,o),s.l=!0,s.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)o.d(r,s,function(t){return e[t]}.bind(null,s));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/dist/",o(o.s=3)}([function(t,o){t.exports=e},function(e,o){e.exports=t},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,s=o(0),i=o(1);(r=i)&&r.__esModule;const a="map";t.default=class extends s.DirectiveView{constructor(e){e||(e={}),super(e),this.template||(this.template=""),e.data?this._data=e.data:this._data=[],e.apikey?this._apikey=e.apikey:this._apikey="",e.lat?this._lat=e.lat:this._lat=37.775,e.long?this._long=e.long:this._long=-122.434,e.zoom?this._zoom=e.zoom:this._zoom=13,e.geocode?this._supportGeocoder=!0:this._supportGeocoder=!1,e.type?this._type=e.type:this._type="satellite",this._map_el=`${this.name}_${a}`,this.template+=`\n <div id="${this._map_el}" class="map"></div>\n `,this._markers=[]}_loadGeocoder(){return this._supportGeocoder&&(this._geocoder=new this._google.Geocoder),this._geocoder}_produceMap(){const e=document.getElementById(this._map_el);if(!e)throw new Error("No map el");return this.map=new this._google.Map(e,{zoom:this._zoom,center:{lat:this._lat,lng:this._long},mapTypeId:this._type}),this.map}setMarker(e,t,o){if(t&&o){const r={position:{lat:t,lng:o},map:this.map};e&&(r.icon=e),this._markers.push(new this._google.Marker(r))}}clearMarkers(){if(this._marker&&(this._marker.setMap(null),this._marker=null),this._markers){let e=0;const t=this._markers.length;for(;e<t;e++)this._markers[e].setMap(null)}return!0}async geocode(e,t){return await this._geocodeAddress(this._geocoder,this.map,e,t)}async _geocodeAddress(e,t,o,r){return await e.geocode({address:o},async(e,o)=>{"OK"===o?(console.debug("geocode",e[0].geometry.location),await t.setCenter(e[0].geometry.location),this._marker&&(await this._marker.setMap(null),this._marker=null),this._marker=new this._google.Marker({map:t,position:e[0].geometry.location}),r&&r(e)):console.error(`Geocode was not successful for the following reason: ${o}`)})}addMarkerPopup(e){if(this._google){const t=new this._google.InfoWindow({content:e});this._marker&&(this._removePopup(),this._marker.addListener("click",()=>{t.open(this.map,this._marker)}))}else console.warn("Could not get the maps api instance to add marker details.");return!0}get marker(){return this._marker}get google(){return this._google}get geocoder(){return this._geocoder}_removePopup(){return this._marker&&this._google.event.clearListeners(this._marker,"click"),!0}async remove(){return await this._removePopup(),super.remove()}}},function(e,t,o){"use strict";var r=i(o(4)),s=i(o(6));function i(e){return e&&e.__esModule?e:{default:e}}e.exports.HeatMapView=r.default,e.exports.MapView=s.default},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});o(0);var r=a(o(1)),s=a(o(2)),i=a(o(5));function a(e){return e&&e.__esModule?e:{default:e}}t.default=class extends s.default{constructor(e){e||(e={}),super(e),e.dissipating?this._dissipating=e.dissipating:this._dissipating=!1,e.radius?this._radius=e.radius:this._radius=20}async render(){return await super.render(),await(0,r.default)({key:this._apikey,libraries:["visualization"]}).then(e=>{if(!e)throw new Error("Could not load Google Maps API!");return this._google=e,this._loadGeocoder(),Promise.resolve(e)}).then(e=>(this._produceMap(),Promise.resolve(e))).then(e=>(this.produceHeatmap(),Promise.resolve(e))).catch(e=>{console.error(e)}),this}produceHeatmap(e){if(!this._google.visualization)return console.warn("Google Visualization could not load!"),!1;if(!this._google.visualization||!e&&!this._data)return!1;{this.heatmap&&this.heatmap.setMap(null);const t=(0,i.default)(google,e||this._data);t?(this.heatmap=new this._google.visualization.HeatmapLayer({data:t,map:this.map,dissipating:this._dissipating,radius:this._radius}),!this._data&&e&&(this._data=e)):console.warn("Could not produce points for heatmap.")}return!0}}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=(e,t)=>{const o=[];if(e){if(t&&Array.isArray(t)&&t.length>0){let r=0;const s=t.length;for(;r<s;r++)if(t[r].lat&&t[r].long){const s=new e.maps.LatLng(t[r].lat,t[r].long);t[r].weight?o.push({location:s,weight:t[r].weight}):o.push(s)}}}else console.error("No Google API.");return o}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});o(0);var r=i(o(2)),s=i(o(1));function i(e){return e&&e.__esModule?e:{default:e}}t.default=class extends r.default{constructor(e){super(e)}async render(){return await super.render(),await(0,s.default)({key:this._apikey}).then(e=>{if(!e)throw new Error("Could not load Google Maps API!");return this._google=e,this._loadGeocoder(),Promise.resolve(e)}).then(e=>(this._produceMap(),Promise.resolve(e))).catch(e=>{console.error(e)}),this}}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("presentation-decorator"),require("load-google-maps-api")):"function"==typeof define&&define.amd?define("presentation-maps",["presentation-decorator","load-google-maps-api"],t):"object"==typeof exports?exports["presentation-maps"]=t(require("presentation-decorator"),require("load-google-maps-api")):e["presentation-maps"]=t(e["presentation-decorator"],e["load-google-maps-api"])}(this,function(e,t){return function(e){var t={};function o(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,o),s.l=!0,s.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)o.d(r,s,function(t){return e[t]}.bind(null,s));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/dist/",o(o.s=3)}([function(t,o){t.exports=e},function(e,o){e.exports=t},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,s=o(0),i=o(1);(r=i)&&r.__esModule;const a="map";t.default=class extends s.DirectiveView{constructor(e){e||(e={}),super(e),this.template||(this.template=""),e.data?this._data=e.data:this._data=[],e.apikey?this._apikey=e.apikey:this._apikey="",e.lat?this._lat=e.lat:this._lat=37.775,e.long?this._long=e.long:this._long=-122.434,e.zoom?this._zoom=e.zoom:this._zoom=13,e.geocode?this._supportGeocoder=!0:this._supportGeocoder=!1,e.type?this._type=e.type:this._type="satellite",this._map_el=`${this.name}_${a}`,this.template+=`\n <div id="${this._map_el}" class="map"></div>\n `,this._markers=[]}_loadGeocoder(){return this._supportGeocoder&&(this._geocoder=new this._google.Geocoder),this._geocoder}_produceMap(){const e=document.getElementById(this._map_el);if(!e)throw new Error("No map el");return this.map=new this._google.Map(e,{zoom:this._zoom,center:{lat:this._lat,lng:this._long},mapTypeId:this._type}),this.map}setMarker(e,t,o){if(t&&o){const r={position:{lat:t,lng:o},map:this.map};e&&(r.icon=e),this._markers.push(new this._google.Marker(r))}}clearMarkers(){if(this._marker&&(this._marker.setMap(null),this._marker=null),this._markers){let e=0;const t=this._markers.length;for(;e<t;e++)this._markers[e].setMap(null)}return!0}async geocode(e,t){return await this._geocodeAddress(this._geocoder,this.map,e,t)}async _geocodeAddress(e,t,o,r){return await e.geocode({address:o},async(e,o)=>{"OK"===o?(await t.setCenter(e[0].geometry.location),this._marker&&(await this._marker.setMap(null),this._marker=null),this._marker=new this._google.Marker({map:t,position:e[0].geometry.location}),r&&r(e)):console.error(`Geocode was not successful for the following reason: ${o}`)})}addMarkerPopup(e){if(this._google){const t=new this._google.InfoWindow({content:e});this._marker&&(this._removePopup(),this._marker.addListener("click",()=>{t.open(this.map,this._marker)}))}else console.warn("Could not get the maps api instance to add marker details.");return!0}get marker(){return this._marker}get google(){return this._google}get geocoder(){return this._geocoder}_removePopup(){return this._marker&&this._google.event.clearListeners(this._marker,"click"),!0}async remove(){return await this._removePopup(),super.remove()}}},function(e,t,o){"use strict";var r=i(o(4)),s=i(o(6));function i(e){return e&&e.__esModule?e:{default:e}}e.exports.HeatMapView=r.default,e.exports.MapView=s.default},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});o(0);var r=a(o(1)),s=a(o(2)),i=a(o(5));function a(e){return e&&e.__esModule?e:{default:e}}t.default=class extends s.default{constructor(e){e||(e={}),super(e),e.dissipating?this._dissipating=e.dissipating:this._dissipating=!1,e.radius?this._radius=e.radius:this._radius=20}async render(){return await super.render(),await(0,r.default)({key:this._apikey,libraries:["visualization"]}).then(e=>{if(!e)throw new Error("Could not load Google Maps API!");return this._google=e,this._loadGeocoder(),Promise.resolve(e)}).then(e=>(this._produceMap(),Promise.resolve(e))).then(e=>(this.produceHeatmap(),Promise.resolve(e))).catch(e=>{console.error(e)}),this}produceHeatmap(e){if(!this._google.visualization)return console.warn("Google Visualization could not load!"),!1;if(!this._google.visualization||!e&&!this._data)return!1;{this.heatmap&&this.heatmap.setMap(null);const t=(0,i.default)(google,e||this._data);t?(this.heatmap=new this._google.visualization.HeatmapLayer({data:t,map:this.map,dissipating:this._dissipating,radius:this._radius}),!this._data&&e&&(this._data=e)):console.warn("Could not produce points for heatmap.")}return!0}}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=(e,t)=>{const o=[];if(e){if(t&&Array.isArray(t)&&t.length>0){let r=0;const s=t.length;for(;r<s;r++)if(t[r].lat&&t[r].long){const s=new e.maps.LatLng(t[r].lat,t[r].long);t[r].weight?o.push({location:s,weight:t[r].weight}):o.push(s)}}}else console.error("No Google API.");return o}},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});o(0);var r=i(o(2)),s=i(o(1));function i(e){return e&&e.__esModule?e:{default:e}}t.default=class extends r.default{constructor(e){super(e)}async render(){return await super.render(),await(0,s.default)({key:this._apikey}).then(e=>{if(!e)throw new Error("Could not load Google Maps API!");return this._google=e,this._loadGeocoder(),Promise.resolve(e)}).then(e=>(this._produceMap(),Promise.resolve(e))).catch(e=>{console.error(e)}),this}}}])});
//# sourceMappingURL=presentation-maps.js.map
{
"name": "presentation-maps",
"version": "2.8.0",
"version": "2.8.1",
"description": "The Augmented.js Next - Presentation Maps Module.",

@@ -5,0 +5,0 @@ "main": "dist/presentation-maps.js",

@@ -146,5 +146,2 @@ import { DirectiveView } from "presentation-decorator";

if (status === "OK") {
console.debug("geocode", results[0].geometry.location);
await resultsMap.setCenter(results[0].geometry.location);

@@ -151,0 +148,0 @@ if (this._marker) {

Sorry, the diff of this file is not supported yet