import { Component, HostBinding, Input, Optional } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import { parse, text, } from '@fortawesome/fontawesome-svg-core'; import { faWarnIfParentNotExist } from '../shared/errors/warn-if-parent-not-exist'; import { faClassList } from '../shared/utils/classlist.util'; import { FaLayersComponent } from './layers.component'; export class FaLayersTextComponent { constructor(parent, sanitizer) { this.parent = parent; this.sanitizer = sanitizer; this.classes = []; faWarnIfParentNotExist(this.parent, 'FaLayersComponent', this.constructor.name); } ngOnChanges(changes) { if (changes) { const params = this.buildParams(); this.updateContent(params); } } /** * Updating params by component props. */ buildParams() { const classOpts = { flip: this.flip, spin: this.spin, pulse: this.pulse, border: this.border, inverse: this.inverse, size: this.size || null, pull: this.pull || null, rotate: this.rotate || null, fixedWidth: this.fixedWidth, }; const parsedTransform = typeof this.transform === 'string' ? parse.transform(this.transform) : this.transform; return { transform: parsedTransform, classes: [...faClassList(classOpts), ...this.classes], title: this.title, styles: this.styles, }; } updateContent(params) { this.renderedHTML = this.sanitizer.bypassSecurityTrustHtml(text(this.content || '', params).html.join('\n')); } } FaLayersTextComponent.decorators = [ { type: Component, args: [{ selector: 'fa-layers-text', template: '', host: { class: 'ng-fa-layers-text', } },] } ]; FaLayersTextComponent.ctorParameters = () => [ { type: FaLayersComponent, decorators: [{ type: Optional }] }, { type: DomSanitizer } ]; FaLayersTextComponent.propDecorators = { content: [{ type: Input }], title: [{ type: Input }], styles: [{ type: Input }], classes: [{ type: Input }], spin: [{ type: Input }], pulse: [{ type: Input }], flip: [{ type: Input }], size: [{ type: Input }], pull: [{ type: Input }], border: [{ type: Input }], inverse: [{ type: Input }], rotate: [{ type: Input }], fixedWidth: [{ type: Input }], transform: [{ type: Input }], renderedHTML: [{ type: HostBinding, args: ['innerHTML',] }] }; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF5ZXJzLXRleHQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMi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