ngx-fluent-ui-icons
Version:
Fluent UI icons library for angular
94 lines (86 loc) • 4.89 kB
JavaScript
import * as i0 from '@angular/core';
import { Injectable, Component, Inject, Input, NgModule, Optional } from '@angular/core';
class FluentUiIconsService {
constructor() { }
}
FluentUiIconsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
FluentUiIconsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsService, providedIn: 'root' });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root'
}]
}], ctorParameters: function () { return []; } });
class Icons {
constructor(icons) {
this.icons = icons;
}
}
class FluentUiIconsComponent {
constructor(element, changeDetector, icons) {
this.element = element;
this.changeDetector = changeDetector;
this.icons = icons;
}
ngOnChanges(changes) {
// icons are provided as an array of objects because of "multi: true"
const icons = Object.assign({}, ...this.icons);
const svg = icons[changes.name.currentValue] || '';
if (!svg) {
console.warn(`Icon not found: ${changes.name.currentValue}\n`);
}
this.element.nativeElement.innerHTML = svg;
this.changeDetector.markForCheck();
}
}
FluentUiIconsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: Icons }], target: i0.ɵɵFactoryTarget.Component });
FluentUiIconsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FluentUiIconsComponent, selector: "fluent-ui-icon, fui", inputs: { name: "name" }, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":host{display:inline-block;width:24px;height:24px;fill:none;stroke-linecap:round;stroke-linejoin:round;svg {width: 100% !important; height: 100% !important;}}\n"] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsComponent, decorators: [{
type: Component,
args: [{ selector: 'fluent-ui-icon, fui', template: `<ng-content></ng-content>`, styles: [":host{display:inline-block;width:24px;height:24px;fill:none;stroke-linecap:round;stroke-linejoin:round;svg {width: 100% !important; height: 100% !important;}}\n"] }]
}], ctorParameters: function () {
return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: Icons, decorators: [{
type: Inject,
args: [Icons]
}] }];
}, propDecorators: { name: [{
type: Input
}] } });
class FluentUiIconsModule {
constructor(icons) {
this.icons = icons;
if (!this.icons) {
throw new Error(`No icon provided. Make sure to use 'FluentUiIconsModule.pick({ ... })' when importing the module\n`);
}
}
static pick(icons) {
return {
ngModule: FluentUiIconsModule,
providers: [{ provide: Icons, multi: true, useValue: icons }],
};
}
}
FluentUiIconsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsModule, deps: [{ token: Icons, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
FluentUiIconsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsModule, declarations: [FluentUiIconsComponent], exports: [FluentUiIconsComponent] });
FluentUiIconsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsModule });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FluentUiIconsModule, decorators: [{
type: NgModule,
args: [{
declarations: [FluentUiIconsComponent],
imports: [],
exports: [FluentUiIconsComponent],
}]
}], ctorParameters: function () {
return [{ type: Icons, decorators: [{
type: Optional
}] }];
} });
/*
* Public API Surface of fluent-ui-icons
*/
// export * from './lib/fluent-ui-icons.library';
/**
* Generated bundle index. Do not edit.
*/
export { FluentUiIconsComponent, FluentUiIconsModule, FluentUiIconsService };
//# sourceMappingURL=ngx-fluent-ui-icons.mjs.map