UNPKG

ngxi

Version:

Icon set for Angular applications

41 lines (40 loc) 2.2 kB
import * as i0 from "@angular/core"; import { inject, input, computed, Directive } from "@angular/core"; import { DomSanitizer } from "@angular/platform-browser"; class Ngxi { constructor() { this.sanitizer = inject(DomSanitizer); this.icon = input(null); this.width = input(); this.height = input(); this.viewBox = input(); this.resolvedWidth = computed(() => this.width() ?? this.icon()?.width); this.resolvedHeight = computed(() => this.height() ?? this.icon()?.height); this.resolvedViewBox = computed(() => this.viewBox() ?? this.icon()?.viewBox); this.resolvedBody = computed(() => this.sanitizer.bypassSecurityTrustHtml(this.icon()?.body ?? "")); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, deps: [], target: i0.ɵɵFactoryTarget.Directive }); } static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.0.4", type: Ngxi, isStandalone: true, selector: "svg[ngxi]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, viewBox: { classPropertyName: "viewBox", publicName: "viewBox", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.width": "resolvedWidth()", "attr.height": "resolvedHeight()", "attr.viewBox": "resolvedViewBox()", "innerHTML": "resolvedBody()" } }, ngImport: i0 }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: Ngxi, decorators: [{ type: Directive, args: [{ standalone: true, selector: "svg[ngxi]", host: { "role": "img", "[attr.width]": "resolvedWidth()", "[attr.height]": "resolvedHeight()", "[attr.viewBox]": "resolvedViewBox()", "[innerHTML]": "resolvedBody()" } }] }] }); export { Ngxi }; //# sourceMappingURL=index.js.map