angular-glass
Version:
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.0.3.
94 lines (88 loc) • 3.89 kB
JavaScript
import * as i0 from '@angular/core';
import { Directive, Input, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
class AsGlassDirective {
constructor(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;
}
ngOnInit() {
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 )`;
}
}
}
AsGlassDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0, type: AsGlassDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
AsGlassDirective.ɵdir = i0.ɵɵ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 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0, type: AsGlassDirective, decorators: [{
type: Directive,
args: [{
selector: '[asGlass]',
}]
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { blur: [{
type: Input
}], opacity: [{
type: Input
}], borderRadius: [{
type: Input
}], showOutline: [{
type: Input
}], outlineWidth: [{
type: Input
}], r: [{
type: Input
}], g: [{
type: Input
}], b: [{
type: Input
}] } });
class GlassModule {
}
GlassModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0, type: GlassModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
GlassModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0, type: GlassModule, declarations: [AsGlassDirective], imports: [CommonModule], exports: [AsGlassDirective] });
GlassModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0, type: GlassModule, imports: [[
CommonModule
]] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.0.3", ngImport: i0, type: GlassModule, decorators: [{
type: NgModule,
args: [{
declarations: [AsGlassDirective],
imports: [
CommonModule
],
exports: [
AsGlassDirective
]
}]
}] });
/*
* Public API Surface of angular-glass
*/
/**
* Generated bundle index. Do not edit.
*/
export { AsGlassDirective, GlassModule };
//# sourceMappingURL=angular-glass.js.map