UNPKG

angular-glass

Version:

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.3.

127 lines (117 loc) 5.92 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common')) : typeof define === 'function' && define.amd ? define('angular-glass', ['exports', '@angular/core', '@angular/common'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['angular-glass'] = {}, global.ng.core, global.ng.common)); }(this, (function (exports, i0, common) { 'use strict'; function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n['default'] = e; return Object.freeze(n); } var i0__namespace = /*#__PURE__*/_interopNamespace(i0); var AsGlassDirective = /** @class */ (function () { function AsGlassDirective(el) { this.el = el; this.blur = 4; this.opacity = 0.25; this.borderRadius = 10; this.showOutline = true; this.outlineWidth = 1; this.r = 255; this.g = 255; this.b = 255; } AsGlassDirective.prototype.ngOnInit = function () { if (this.opacity < 0) { this.opacity = 0; } if (this.opacity > 1) { this.opacity = 1; } if (this.borderRadius < 0) { this.borderRadius = 0; } this.el.nativeElement.style.backgroundColor = "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.opacity + ")"; this.el.nativeElement.style.borderRadius = this.borderRadius + "px"; this.el.nativeElement.style.boxShadow = '0 8px 32px 0 rgba( 31, 38, 135, 0.37 )'; this.el.nativeElement.style.backdropFilter = "blur(" + this.blur + "px)"; this.el.nativeElement.style['-webkit-backdrop-filter'] = "blur(" + this.blur + "px)"; if (this.showOutline) { this.el.nativeElement.style.border = this.outlineWidth + "px solid rgba( 255, 255, 255, 0.18 )"; } }; return AsGlassDirective; }()); AsGlassDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0__namespace, type: AsGlassDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive }); AsGlassDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.0.3", type: AsGlassDirective, selector: "[asGlass]", inputs: { blur: "blur", opacity: "opacity", borderRadius: "borderRadius", showOutline: "showOutline", outlineWidth: "outlineWidth", r: "r", g: "g", b: "b" }, ngImport: i0__namespace }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0__namespace, type: AsGlassDirective, decorators: [{ type: i0.Directive, args: [{ selector: '[asGlass]', }] }], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { blur: [{ type: i0.Input }], opacity: [{ type: i0.Input }], borderRadius: [{ type: i0.Input }], showOutline: [{ type: i0.Input }], outlineWidth: [{ type: i0.Input }], r: [{ type: i0.Input }], g: [{ type: i0.Input }], b: [{ type: i0.Input }] } }); var GlassModule = /** @class */ (function () { function GlassModule() { } return GlassModule; }()); GlassModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0__namespace, type: GlassModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule }); GlassModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0__namespace, type: GlassModule, declarations: [AsGlassDirective], imports: [common.CommonModule], exports: [AsGlassDirective] }); GlassModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0__namespace, type: GlassModule, imports: [[ common.CommonModule ]] }); i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0__namespace, type: GlassModule, decorators: [{ type: i0.NgModule, args: [{ declarations: [AsGlassDirective], imports: [ common.CommonModule ], exports: [ AsGlassDirective ] }] }] }); /* * Public API Surface of angular-glass */ /** * Generated bundle index. Do not edit. */ exports.AsGlassDirective = AsGlassDirective; exports.GlassModule = GlassModule; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=angular-glass.umd.js.map