ngx-gravatar
Advanced tools
Comparing version 9.0.1 to 9.1.0
@@ -8,14 +8,14 @@ (function (global, factory) { | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -113,4 +113,9 @@ /* global Reflect, Promise */ | ||
function __createBinding(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
} | ||
function __exportStar(m, exports) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
@@ -310,3 +315,3 @@ | ||
]; }; | ||
NgxGravatarService.ɵprov = core["ɵɵdefineInjectable"]({ factory: function NgxGravatarService_Factory() { return new NgxGravatarService(core["ɵɵinject"](GRAVATAR_CONFIG_TOKEN, 8)); }, token: NgxGravatarService, providedIn: "root" }); | ||
NgxGravatarService.ɵprov = core.ɵɵdefineInjectable({ factory: function NgxGravatarService_Factory() { return new NgxGravatarService(core.ɵɵinject(GRAVATAR_CONFIG_TOKEN, 8)); }, token: NgxGravatarService, providedIn: "root" }); | ||
NgxGravatarService = __decorate([ | ||
@@ -313,0 +318,0 @@ core.Injectable({ |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("ts-md5/dist/md5")):"function"==typeof define&&define.amd?define("ngx-gravatar",["exports","@angular/core","ts-md5/dist/md5"],e):e((t=t||self)["ngx-gravatar"]={},t.ng.core,t.md5)}(this,(function(t,e,r){"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */var i=function(){return(i=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function o(t,e,r,i){var o,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(n=(a<3?o(n):a>3?o(e,r,n):o(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function a(t,e){return function(r,i){e(r,i,t)}}function n(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var s,d,u=new e.InjectionToken("gravatarCustom.config");(s=t.FALLBACK||(t.FALLBACK={})).blank="blank",s.identicon="identicon",s.mm="mm",s.mp="mp",s.monsterid="monsterid",s.retro="retro",s.robohash="robohash",s.wavatar="wavatar",(d=t.RATING||(t.RATING={})).g="g",d.pg="pg",d.r="r",d.x="x";var p={fallback:t.FALLBACK.retro,size:40,cornerRadius:0,preferGravatar:!1,hasBorder:!1,borderColor:"#000000",borderRadius:"50%",borderStyle:"solid",borderWidth:1,round:!0,backgroundColor:"transparent",rating:t.RATING.g,ratio:2},f=function(){function t(t){this.gravatarConfig=t,this.defaultConfig=i({},p),this.gravatarConfig&&(this.defaultConfig=i(i({},this.defaultConfig),this.gravatarConfig))}return t.prototype.getDefaultConfig=function(){return this.defaultConfig},t.prototype.generateGravatarUrl=function(t,e,i,o,a){var n;if(void 0===i&&(i=this.defaultConfig.size),void 0===o&&(o=this.defaultConfig.rating),void 0===a&&(a=this.defaultConfig.fallback),e)n=e;else{try{t=t.trim().toLowerCase()}catch(e){console.error("[ngx-gravatar] - Email ("+t+") is not a string. Empty string is used as a default email."),t=""}n=r.Md5.hashStr(t)}return"https://www.gravatar.com/avatar/"+n+"?s="+i+"&r="+o+"&d="+a},t.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[u]}]}]},t.ɵprov=e["ɵɵdefineInjectable"]({factory:function(){return new t(e["ɵɵinject"](u,8))},token:t,providedIn:"root"}),t=o([e.Injectable({providedIn:"root"}),a(0,e.Optional()),a(0,e.Inject(u)),n("design:paramtypes",[Object])],t)}(),h=function(){function t(t,e,r){var i=this;this.elementRef=t,this.renderer=e,this.gravatarService=r,this.style={},this.initialized=!1,this.defaultConfig=this.gravatarService.getDefaultConfig(),this.renderer.listen(this.elementRef.nativeElement,"error",(function(t){i.isGravatarUsed||i.initializeAvatar(!0)}))}return t.prototype.ngOnInit=function(){this.initializeAvatar(),this.initialized=!0,this.isGravatarUsed=!1},t.prototype.ngOnChanges=function(){this.initialized&&this.initializeAvatar()},t.prototype.setDefaultValues=function(){this.size=this.computeSize(),this.ratio=void 0===this.ratio?this.defaultConfig.ratio:this.ratio,this.requestedSize=this.size*this.ratio,this.round=void 0===this.round?this.defaultConfig.round:this.round,this.cornerRadius=void 0===this.cornerRadius?this.defaultConfig.cornerRadius:this.cornerRadius,this.preferGravatar=void 0===this.preferGravatar?this.defaultConfig.preferGravatar:this.preferGravatar},t.prototype.initializeAvatar=function(t){this.setDefaultValues();var e="";this.preferGravatar||t?(e=this.gravatarService.generateGravatarUrl(this.email,this.md5Hash,this.requestedSize,this.rating,this.fallback),this.isGravatarUsed=!0):this.src?e=this.src:(e=this.gravatarService.generateGravatarUrl(this.email,this.md5Hash,this.requestedSize,this.rating,this.fallback),this.isGravatarUsed=!0),this.renderer.setProperty(this.elementRef.nativeElement,"src",e),this.setStyle(this.avatarStyle())},t.prototype.computeSize=function(){var t=void 0===this.size?this.defaultConfig.size:this.size;if(this.style&&this.style.width)try{var e=this.style.width.trim();e.match(/^\d+px$/)&&(t=e.replace("px",""))}catch(e){return t}return t},t.prototype.avatarStyle=function(){var t={width:this.size+"px",height:this.size+"px",borderRadius:this.round?this.defaultConfig.borderRadius:this.cornerRadius+"px",borderStyle:this.defaultConfig.hasBorder||this.borderColor||this.borderWidth?this.defaultConfig.borderStyle:"none",borderColor:this.borderColor?this.borderColor:this.defaultConfig.borderColor,borderWidth:this.borderWidth?this.borderWidth+"px":this.defaultConfig.borderWidth+"px",backgroundColor:this.backgroundColor?this.backgroundColor:this.defaultConfig.backgroundColor};return i(i({},t),this.style)},t.prototype.setStyle=function(t){var e=this;Object.keys(t).forEach((function(r){e.renderer.setStyle(e.elementRef.nativeElement,r,t[r])}))},t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:f}]},o([e.Input(),n("design:type",String)],t.prototype,"src",void 0),o([e.Input(),n("design:type",String)],t.prototype,"email",void 0),o([e.Input(),n("design:type",String)],t.prototype,"md5Hash",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"size",void 0),o([e.Input(),n("design:type",String)],t.prototype,"fallback",void 0),o([e.Input(),n("design:type",String)],t.prototype,"rating",void 0),o([e.Input(),n("design:type",Boolean)],t.prototype,"round",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"cornerRadius",void 0),o([e.Input(),n("design:type",String)],t.prototype,"borderColor",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"borderWidth",void 0),o([e.Input(),n("design:type",Object)],t.prototype,"style",void 0),o([e.Input(),n("design:type",Boolean)],t.prototype,"preferGravatar",void 0),o([e.Input(),n("design:type",Boolean)],t.prototype,"backgroundColor",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"ratio",void 0),t=o([e.Directive({selector:"[ngx-gravatar], [ngxGravatar]"}),n("design:paramtypes",[e.ElementRef,e.Renderer2,f])],t)}(),l=function(){function t(){}var r;return r=t,t.forRoot=function(t){return{ngModule:r,providers:[{provide:u,useValue:t}]}},t=r=o([e.NgModule({declarations:[h],exports:[h]})],t)}();t.GravatarModule=l,t.NgxGravatarService=f,t.ɵa=h,t.ɵb=u,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var i=function(){return(i=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function o(t,e,r,i){var o,a=arguments.length,n=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(n=(a<3?o(n):a>3?o(e,r,n):o(e,r))||n);return a>3&&n&&Object.defineProperty(e,r,n),n}function a(t,e){return function(r,i){e(r,i,t)}}function n(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var s,d,u=new e.InjectionToken("gravatarCustom.config");(s=t.FALLBACK||(t.FALLBACK={})).blank="blank",s.identicon="identicon",s.mm="mm",s.mp="mp",s.monsterid="monsterid",s.retro="retro",s.robohash="robohash",s.wavatar="wavatar",(d=t.RATING||(t.RATING={})).g="g",d.pg="pg",d.r="r",d.x="x";var p={fallback:t.FALLBACK.retro,size:40,cornerRadius:0,preferGravatar:!1,hasBorder:!1,borderColor:"#000000",borderRadius:"50%",borderStyle:"solid",borderWidth:1,round:!0,backgroundColor:"transparent",rating:t.RATING.g,ratio:2},f=function(){function t(t){this.gravatarConfig=t,this.defaultConfig=i({},p),this.gravatarConfig&&(this.defaultConfig=i(i({},this.defaultConfig),this.gravatarConfig))}return t.prototype.getDefaultConfig=function(){return this.defaultConfig},t.prototype.generateGravatarUrl=function(t,e,i,o,a){var n;if(void 0===i&&(i=this.defaultConfig.size),void 0===o&&(o=this.defaultConfig.rating),void 0===a&&(a=this.defaultConfig.fallback),e)n=e;else{try{t=t.trim().toLowerCase()}catch(e){console.error("[ngx-gravatar] - Email ("+t+") is not a string. Empty string is used as a default email."),t=""}n=r.Md5.hashStr(t)}return"https://www.gravatar.com/avatar/"+n+"?s="+i+"&r="+o+"&d="+a},t.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Optional},{type:e.Inject,args:[u]}]}]},t.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(u,8))},token:t,providedIn:"root"}),t=o([e.Injectable({providedIn:"root"}),a(0,e.Optional()),a(0,e.Inject(u)),n("design:paramtypes",[Object])],t)}(),h=function(){function t(t,e,r){var i=this;this.elementRef=t,this.renderer=e,this.gravatarService=r,this.style={},this.initialized=!1,this.defaultConfig=this.gravatarService.getDefaultConfig(),this.renderer.listen(this.elementRef.nativeElement,"error",(function(t){i.isGravatarUsed||i.initializeAvatar(!0)}))}return t.prototype.ngOnInit=function(){this.initializeAvatar(),this.initialized=!0,this.isGravatarUsed=!1},t.prototype.ngOnChanges=function(){this.initialized&&this.initializeAvatar()},t.prototype.setDefaultValues=function(){this.size=this.computeSize(),this.ratio=void 0===this.ratio?this.defaultConfig.ratio:this.ratio,this.requestedSize=this.size*this.ratio,this.round=void 0===this.round?this.defaultConfig.round:this.round,this.cornerRadius=void 0===this.cornerRadius?this.defaultConfig.cornerRadius:this.cornerRadius,this.preferGravatar=void 0===this.preferGravatar?this.defaultConfig.preferGravatar:this.preferGravatar},t.prototype.initializeAvatar=function(t){this.setDefaultValues();var e="";this.preferGravatar||t?(e=this.gravatarService.generateGravatarUrl(this.email,this.md5Hash,this.requestedSize,this.rating,this.fallback),this.isGravatarUsed=!0):this.src?e=this.src:(e=this.gravatarService.generateGravatarUrl(this.email,this.md5Hash,this.requestedSize,this.rating,this.fallback),this.isGravatarUsed=!0),this.renderer.setProperty(this.elementRef.nativeElement,"src",e),this.setStyle(this.avatarStyle())},t.prototype.computeSize=function(){var t=void 0===this.size?this.defaultConfig.size:this.size;if(this.style&&this.style.width)try{var e=this.style.width.trim();e.match(/^\d+px$/)&&(t=e.replace("px",""))}catch(e){return t}return t},t.prototype.avatarStyle=function(){var t={width:this.size+"px",height:this.size+"px",borderRadius:this.round?this.defaultConfig.borderRadius:this.cornerRadius+"px",borderStyle:this.defaultConfig.hasBorder||this.borderColor||this.borderWidth?this.defaultConfig.borderStyle:"none",borderColor:this.borderColor?this.borderColor:this.defaultConfig.borderColor,borderWidth:this.borderWidth?this.borderWidth+"px":this.defaultConfig.borderWidth+"px",backgroundColor:this.backgroundColor?this.backgroundColor:this.defaultConfig.backgroundColor};return i(i({},t),this.style)},t.prototype.setStyle=function(t){var e=this;Object.keys(t).forEach((function(r){e.renderer.setStyle(e.elementRef.nativeElement,r,t[r])}))},t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2},{type:f}]},o([e.Input(),n("design:type",String)],t.prototype,"src",void 0),o([e.Input(),n("design:type",String)],t.prototype,"email",void 0),o([e.Input(),n("design:type",String)],t.prototype,"md5Hash",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"size",void 0),o([e.Input(),n("design:type",String)],t.prototype,"fallback",void 0),o([e.Input(),n("design:type",String)],t.prototype,"rating",void 0),o([e.Input(),n("design:type",Boolean)],t.prototype,"round",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"cornerRadius",void 0),o([e.Input(),n("design:type",String)],t.prototype,"borderColor",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"borderWidth",void 0),o([e.Input(),n("design:type",Object)],t.prototype,"style",void 0),o([e.Input(),n("design:type",Boolean)],t.prototype,"preferGravatar",void 0),o([e.Input(),n("design:type",Boolean)],t.prototype,"backgroundColor",void 0),o([e.Input(),n("design:type",Number)],t.prototype,"ratio",void 0),t=o([e.Directive({selector:"[ngx-gravatar], [ngxGravatar]"}),n("design:paramtypes",[e.ElementRef,e.Renderer2,f])],t)}(),l=function(){function t(){}var r;return r=t,t.forRoot=function(t){return{ngModule:r,providers:[{provide:u,useValue:t}]}},t=r=o([e.NgModule({declarations:[h],exports:[h]})],t)}();t.GravatarModule=l,t.NgxGravatarService=f,t.ɵa=h,t.ɵb=u,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngx-gravatar.umd.min.js.map |
{ | ||
"name": "ngx-gravatar", | ||
"description": "A customizable Gravatar for Angular applications.", | ||
"version": "9.0.1", | ||
"version": "9.1.0", | ||
"repository": { | ||
@@ -9,3 +9,3 @@ "type": "git", | ||
}, | ||
"author": "t-ho <toan.hmt@protonmail.com>", | ||
"author": "t-ho <t.ho@tdev.app>", | ||
"homepage": "https://tdev.app/ngx-gravatar/demo", | ||
@@ -16,7 +16,7 @@ "license": "MIT", | ||
"@angular/core": ">=9.0.0", | ||
"@angular/common": ">=9.0.0", | ||
"tslib": "^1.10.0" | ||
"@angular/common": ">=9.0.0" | ||
}, | ||
"dependencies": { | ||
"ts-md5": "^1.2.7" | ||
"ts-md5": "^1.2.7", | ||
"tslib": "^1.10.0" | ||
}, | ||
@@ -23,0 +23,0 @@ "keywords": [ |
[![npm version](https://img.shields.io/npm/v/ngx-gravatar)](https://www.npmjs.com/package/ngx-gravatar) | ||
[![GitHub stars](https://img.shields.io/github/stars/t-ho/ngx-gravatar?color=00bcd4)](https://github.com/t-ho/ngx-gravatar/stargazers) | ||
[![Build Status](https://travis-ci.org/t-ho/ngx-gravatar.svg?branch=master)](https://travis-ci.org/t-ho/ngx-gravatar) | ||
![CI Testing](https://github.com/t-ho/ngx-gravatar/workflows/CI%20Testing/badge.svg) | ||
[![codecov](https://codecov.io/gh/t-ho/ngx-gravatar/branch/master/graph/badge.svg)](https://codecov.io/gh/t-ho/ngx-gravatar) | ||
@@ -43,3 +43,3 @@ [![npm](https://img.shields.io/npm/dw/ngx-gravatar.svg)](https://www.npmjs.com/package/ngx-gravatar) | ||
| ------------- | --------------------------------- | | ||
| Angular 9 | `npm i --save ngx-gravatar` | | ||
| Angular 9 | `npm i --save ngx-gravatar@9.1.0` | | ||
| Angular 8 | `npm i --save ngx-gravatar@8.1.0` | | ||
@@ -46,0 +46,0 @@ | Angular 6 & 7 | `npm i --save ngx-gravatar@7.2.2` | |
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
240463
41
0
1915
+ Addedtslib@^1.10.0