angular-weather-any-degree
Version:
this package is used to show a simple weather, which we can change the type of degree
1 lines • 14.9 kB
Source Map (JSON)
{"version":3,"file":"angular-weather-any-degree.mjs","sources":["../../../projects/angular-weather-any-degree/src/lib/config.ts","../../../projects/angular-weather-any-degree/src/lib/angular-weather-any-degree.service.ts","../../../projects/angular-weather-any-degree/src/lib/angular-weather-any-degree.component.ts","../../../projects/angular-weather-any-degree/src/lib/angular-weather-any-degree.component.html","../../../projects/angular-weather-any-degree/src/lib/angular-weather-any-degree.module.ts","../../../projects/angular-weather-any-degree/src/public-api.ts","../../../projects/angular-weather-any-degree/src/angular-weather-any-degree.ts"],"sourcesContent":["export const API = 'https://api.openweathermap.org/data/2.5/weather?';\r\n","import { Injectable } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { Observable } from 'rxjs';\r\nimport { API } from './config';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AngularWeatherAnyDegreeService {\r\n\r\n constructor(public http: HttpClient) { }\r\n\r\n getWeatherDetails(isGeoLocation: any, location: any, APIKEY: any,Units: any) : Observable <any> {\r\n if(isGeoLocation){\r\n return this.http.get(`${API}${location}&units=${Units}&appid=${APIKEY}`);\r\n }else{\r\n return this.http.get(`${API}q=${location}&units=imperial&appid=${APIKEY}`);\r\n }\r\n }\r\n}\r\n","import { Component, Input } from '@angular/core';\r\nimport { AngularWeatherAnyDegreeService } from './angular-weather-any-degree.service';\r\n\r\n@Component({\r\n selector: 'mal-angular-weather-any-degree',\r\n // template: `\r\n // <p>\r\n // angular-weather-any-degree works!\r\n // </p>\r\n // `,\r\n templateUrl: './angular-weather-any-degree.component.html',\r\n styleUrls: ['./angular-weather-any-degree.component.scss']\r\n})\r\nexport class AngularWeatherAnyDegreeComponent {\r\n @Input() Units: string | undefined;\r\n @Input() unitSymbol: string | undefined;\r\n @Input() APIKEY: any;\r\n @Input() height: string = 'auto';\r\n @Input() width: string = '425px';\r\n @Input() backgroundColor: string = 'rgb(10 10 111)';\r\n @Input() isBoxShadow: boolean = true;\r\n @Input() borderRadius: string = '5px';\r\n @Input() locationFontSize: string = '40px';\r\n @Input() locationFontColor: string = '#fff';\r\n @Input() status: boolean = true;\r\n @Input() statusFontColor: string = '#fff';\r\n @Input() statusFontSize: String = '18px';\r\n @Input() temperature: Boolean = true;\r\n @Input() tempratureFontColor: string = '#fff';\r\n @Input() tempratureFontSize: string = '80px';\r\n @Input() weatherImages: boolean = true;\r\n @Input() weatherImageWidth: string = '100px';\r\n @Input() weatherImageHeight: string = '100px';\r\n @Input() geoLocation: boolean = false;\r\n @Input() location: any = '';\r\n @Input() isWind: boolean = true;\r\n @Input() isHumidity: boolean = true;\r\n @Input() windFontColor: string = '#fff';\r\n @Input() windFontSize: string = '20px';\r\n @Input() humidityFontColor: string = '#fff';\r\n @Input() humidityFontSize: string = '20px';\r\n isLoading: boolean = true;\r\n weatherDetails = {\r\n location : '',\r\n weather_descriptions: '',\r\n temperature: '',\r\n icon: '',\r\n wind_speed: '',\r\n humidity: ''\r\n };\r\n constructor(public ws: AngularWeatherAnyDegreeService) { }\r\n\r\n ngOnInit() {\r\n this.checkLocation();\r\n }\r\n\r\n /**\r\n *@description Check whether geolocation or manually added location.\r\n */\r\n\r\n checkLocation() {\r\n if (this.geoLocation) {\r\n if (navigator.geolocation) {\r\n navigator.geolocation.getCurrentPosition((position) => {\r\n var lat = position.coords.latitude;\r\n var long = position.coords.longitude;\r\n this.location = `lat=${lat}&lon=${long}`;\r\n this.getWeather(true);\r\n }, (error) => {\r\n console.warn(error.message);\r\n });\r\n } else {\r\n console.warn(`It seems like Geolocation, which is required for this page, is not enabled in your browser.\r\n Please use a browser which supports it.`);\r\n }\r\n } else if (!this.geoLocation && this.location.length < 1) {\r\n console.warn('Provide a valid location');\r\n } else {\r\n this.getWeather(false);\r\n }\r\n }\r\n\r\n getWeather(isGeoLocation: boolean) {\r\n if (this.APIKEY) {\r\n this.ws.getWeatherDetails(isGeoLocation,this.location, this.APIKEY,this.Units).subscribe(response => {\r\n this.weatherDetails = {\r\n location : response.name,\r\n weather_descriptions: response.weather[0].description,\r\n temperature: response.main.temp,\r\n icon: `http://openweathermap.org/img/wn/${response.weather[0].icon}@2x.png`,\r\n wind_speed: response.wind.speed,\r\n humidity: response.main.humidity\r\n };\r\n this.isLoading = false;\r\n }, err => {\r\n console.warn(err.error.error.message);\r\n })\r\n } else {\r\n console.warn('Invalid APIKEY');\r\n }\r\n }\r\n\r\n}\r\n","<div class=\"container\"\r\n [ngStyle]=\"{ 'width': width , 'height': height, 'background-color': backgroundColor, 'box-shadow': isBoxShadow ? '0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)' : 'none', 'border-radius': borderRadius }\">\r\n <div class=\"weather-images\" *ngIf=\"weatherImages\">\r\n <img [ngStyle]=\"{'width': weatherImageWidth, 'height': weatherImageHeight }\" alt=\"weather-icon\"\r\n src=\"{{weatherDetails?.icon}}\" />\r\n </div>\r\n <span *ngIf=\"!isLoading\">\r\n <div class=\"location\">\r\n <p [ngStyle]=\"{'font-size': locationFontSize, 'color': locationFontColor}\">{{weatherDetails?.location}}</p>\r\n </div>\r\n <div class=\"status\" *ngIf=\"status\">\r\n <p [ngStyle]=\"{'color': statusFontColor, 'font-size': statusFontSize}\">{{weatherDetails?.weather_descriptions}}\r\n </p>\r\n </div>\r\n <div class=\"temp\" *ngIf=\"temperature\">\r\n <p [ngStyle]=\"{'color': tempratureFontColor, 'font-size': tempratureFontSize}\">{{weatherDetails?.temperature}}°{{unitSymbol}}\r\n </p>\r\n\r\n </div>\r\n <div class=\"details\" *ngIf=\"isWind\">\r\n <p [ngStyle]=\"{'color': windFontColor, 'font-size': windFontSize}\">Wind</p>\r\n <p class=\"wind\" [ngStyle]=\"{'color': windFontColor, 'font-size': windFontSize}\">{{weatherDetails?.wind_speed}} MPH\r\n </p>\r\n </div>\r\n <div class=\"details\" *ngIf=\"isHumidity\">\r\n <p [ngStyle]=\"{'color': humidityFontColor, 'font-size': humidityFontSize}\">Humidity</p>\r\n <p class=\"wind\" [ngStyle]=\"{'color': humidityFontColor, 'font-size': humidityFontSize}\">\r\n {{weatherDetails?.humidity}} %</p>\r\n </div>\r\n </span>\r\n <span *ngIf=\"isLoading\">\r\n <div class=\"loading\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"\r\n style=\"margin: auto; background: none; display: block; shape-rendering: auto;\" width=\"50px\" height=\"50px\"\r\n viewBox=\"0 0 100 100\" preserveAspectRatio=\"xMidYMid\">\r\n <circle cx=\"50\" cy=\"50\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"10\" r=\"35\"\r\n stroke-dasharray=\"164.93361431346415 56.97787143782138\">\r\n <animateTransform attributeName=\"transform\" type=\"rotate\" repeatCount=\"indefinite\" dur=\"1s\"\r\n values=\"0 50 50;360 50 50\" keyTimes=\"0;1\"></animateTransform>\r\n </circle>\r\n <!-- [ldio] generated by https://loading.io/ -->\r\n </svg>\r\n </div>\r\n </span>\r\n</div>\r\n","import { NgModule } from '@angular/core';\r\nimport { AngularWeatherAnyDegreeComponent } from './angular-weather-any-degree.component';\r\nimport { CommonModule } from '@angular/common';\r\nimport { HttpClientModule } from '@angular/common/http';\r\nimport { AngularWeatherAnyDegreeService } from './angular-weather-any-degree.service';\r\n\r\n\r\n\r\n@NgModule({\r\n declarations: [\r\n AngularWeatherAnyDegreeComponent\r\n ],\r\n imports: [\r\n CommonModule,\r\n HttpClientModule\r\n ],\r\n exports: [\r\n AngularWeatherAnyDegreeComponent\r\n ],\r\n providers: [AngularWeatherAnyDegreeService]\r\n})\r\nexport class AngularWeatherAnyDegreeModule { }\r\n","/*\r\n * Public API Surface of angular-weather-any-degree\r\n */\r\n\r\nexport * from './lib/angular-weather-any-degree.service';\r\nexport * from './lib/angular-weather-any-degree.component';\r\nexport * from './lib/angular-weather-any-degree.module';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"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