UNPKG

29.8 kBJavaScriptView Raw
1import * as i0 from '@angular/core';
2import { Injectable, Directive, Input, Component, Optional, HostBinding, NgModule } from '@angular/core';
3import { parse, icon, counter, text } from '@fortawesome/fontawesome-svg-core';
4import * as i2 from '@angular/platform-browser';
5
6const faWarnIfIconDefinitionMissing = (iconSpec) => {
7 throw new Error(`Could not find icon with iconName=${iconSpec.iconName} and prefix=${iconSpec.prefix} in the icon library.`);
8};
9
10const faWarnIfIconSpecMissing = () => {
11 throw new Error('Property `icon` is required for `fa-icon`/`fa-duotone-icon` components.');
12};
13
14/**
15 * Fontawesome class list.
16 * Returns classes array by props.
17 */
18const faClassList = (props) => {
19 const classes = {
20 [`fa-${props.animation}`]: props.animation != null && !props.animation.startsWith('spin'),
21 'fa-spin': props.animation === 'spin' || props.animation === 'spin-reverse',
22 'fa-spin-pulse': props.animation === 'spin-pulse' || props.animation === 'spin-pulse-reverse',
23 'fa-spin-reverse': props.animation === 'spin-reverse' || props.animation === 'spin-pulse-reverse',
24 // According to https://fontawesome.com/docs/web/style/animate#spin fa-pulse
25 // class is deprecated, remove the below line when Font Awesome 5 support
26 // is dropped.
27 'fa-pulse': props.animation === 'spin-pulse' || props.animation === 'spin-pulse-reverse',
28 'fa-fw': props.fixedWidth,
29 'fa-border': props.border,
30 'fa-inverse': props.inverse,
31 'fa-layers-counter': props.counter,
32 'fa-flip-horizontal': props.flip === 'horizontal' || props.flip === 'both',
33 'fa-flip-vertical': props.flip === 'vertical' || props.flip === 'both',
34 [`fa-${props.size}`]: props.size !== null,
35 [`fa-rotate-${props.rotate}`]: props.rotate !== null,
36 [`fa-pull-${props.pull}`]: props.pull !== null,
37 [`fa-stack-${props.stackItemSize}`]: props.stackItemSize != null,
38 };
39 return Object.keys(classes)
40 .map((key) => (classes[key] ? key : null))
41 .filter((key) => key);
42};
43
44/**
45 * Returns if is IconLookup or not.
46 */
47const isIconLookup = (i) => i.prefix !== undefined && i.iconName !== undefined;
48
49/**
50 * Normalizing icon spec.
51 */
52const faNormalizeIconSpec = (iconSpec, defaultPrefix) => {
53 if (isIconLookup(iconSpec)) {
54 return iconSpec;
55 }
56 if (typeof iconSpec === 'string') {
57 return { prefix: defaultPrefix, iconName: iconSpec };
58 }
59 return { prefix: iconSpec[0], iconName: iconSpec[1] };
60};
61
62class FaConfig {
63 constructor() {
64 /**
65 * Default prefix to use, when one is not provided with the icon name.
66 *
67 * @default 'fas'
68 */
69 this.defaultPrefix = 'fas';
70 /**
71 * Provides a fallback icon to use whilst main icon is being loaded asynchronously.
72 * When value is null, then fa-icon component will throw an error if icon input is missing.
73 * When value is not null, then the provided icon will be used as a fallback icon if icon input is missing.
74 *
75 * @default null
76 */
77 this.fallbackIcon = null;
78 }
79}
80FaConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
81FaConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaConfig, providedIn: 'root' });
82i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaConfig, decorators: [{
83 type: Injectable,
84 args: [{ providedIn: 'root' }]
85 }] });
86
87class FaIconLibrary {
88 constructor() {
89 this.definitions = {};
90 }
91 addIcons(...icons) {
92 for (const icon of icons) {
93 if (!(icon.prefix in this.definitions)) {
94 this.definitions[icon.prefix] = {};
95 }
96 this.definitions[icon.prefix][icon.iconName] = icon;
97 for (const alias of icon.icon[2]) {
98 if (typeof alias === 'string') {
99 this.definitions[icon.prefix][alias] = icon;
100 }
101 }
102 }
103 }
104 addIconPacks(...packs) {
105 for (const pack of packs) {
106 const icons = Object.keys(pack).map((key) => pack[key]);
107 this.addIcons(...icons);
108 }
109 }
110 getIconDefinition(prefix, name) {
111 if (prefix in this.definitions && name in this.definitions[prefix]) {
112 return this.definitions[prefix][name];
113 }
114 return null;
115 }
116}
117FaIconLibrary.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaIconLibrary, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
118FaIconLibrary.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaIconLibrary, providedIn: 'root' });
119i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaIconLibrary, decorators: [{
120 type: Injectable,
121 args: [{ providedIn: 'root' }]
122 }] });
123
124class FaStackItemSizeDirective {
125 constructor() {
126 /**
127 * Specify whether icon inside {@link FaStackComponent} should be rendered in
128 * regular size (1x) or as a larger icon (2x).
129 */
130 this.stackItemSize = '1x';
131 }
132 ngOnChanges(changes) {
133 if ('size' in changes) {
134 throw new Error('fa-icon is not allowed to customize size when used inside fa-stack. ' +
135 'Set size on the enclosing fa-stack instead: <fa-stack size="4x">...</fa-stack>.');
136 }
137 }
138}
139FaStackItemSizeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaStackItemSizeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
140FaStackItemSizeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: FaStackItemSizeDirective, selector: "fa-icon[stackItemSize],fa-duotone-icon[stackItemSize]", inputs: { stackItemSize: "stackItemSize", size: "size" }, usesOnChanges: true, ngImport: i0 });
141i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaStackItemSizeDirective, decorators: [{
142 type: Directive,
143 args: [{
144 // eslint-disable-next-line @angular-eslint/directive-selector
145 selector: 'fa-icon[stackItemSize],fa-duotone-icon[stackItemSize]',
146 }]
147 }], propDecorators: { stackItemSize: [{
148 type: Input
149 }], size: [{
150 type: Input
151 }] } });
152
153class FaStackComponent {
154 constructor(renderer, elementRef) {
155 this.renderer = renderer;
156 this.elementRef = elementRef;
157 }
158 ngOnInit() {
159 this.renderer.addClass(this.elementRef.nativeElement, 'fa-stack');
160 }
161 ngOnChanges(changes) {
162 if ('size' in changes) {
163 if (changes.size.currentValue != null) {
164 this.renderer.addClass(this.elementRef.nativeElement, `fa-${changes.size.currentValue}`);
165 }
166 if (changes.size.previousValue != null) {
167 this.renderer.removeClass(this.elementRef.nativeElement, `fa-${changes.size.previousValue}`);
168 }
169 }
170 }
171}
172FaStackComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaStackComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
173FaStackComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: FaStackComponent, selector: "fa-stack", inputs: { size: "size" }, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
174i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaStackComponent, decorators: [{
175 type: Component,
176 args: [{
177 selector: 'fa-stack',
178 template: `<ng-content></ng-content>`,
179 }]
180 }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; }, propDecorators: { size: [{
181 type: Input
182 }] } });
183
184class FaIconComponent {
185 constructor(sanitizer, config, iconLibrary, stackItem, stack) {
186 this.sanitizer = sanitizer;
187 this.config = config;
188 this.iconLibrary = iconLibrary;
189 this.stackItem = stackItem;
190 /**
191 * Set `class` attribute on the SVG element rendered by the component.
192 *
193 * @deprecated This input breaks view encapsulation and is not recommended.
194 * For simple cases (like colors), use `class` on the component itself, for
195 * more complex usages, explicitly opt-in to break the view encapsulation.
196 * This input is deprecated since 0.12.0 and will be removed in 0.13.0.
197 */
198 this.classes = [];
199 if (stack != null && stackItem == null) {
200 console.error('FontAwesome: fa-icon and fa-duotone-icon elements must specify stackItemSize attribute when wrapped into ' +
201 'fa-stack. Example: <fa-icon stackItemSize="2x"></fa-icon>.');
202 }
203 }
204 /**
205 * @deprecated Use animation="spin" instead. To be removed in 0.14.0.
206 */
207 set spin(value) {
208 this.animation = value ? 'spin' : undefined;
209 }
210 /**
211 * @deprecated Use animation="spin-pulse" instead. To be removed in 0.14.0.
212 */
213 set pulse(value) {
214 this.animation = value ? 'spin-pulse' : undefined;
215 }
216 ngOnChanges(changes) {
217 if (this.icon == null && this.config.fallbackIcon == null) {
218 faWarnIfIconSpecMissing();
219 return;
220 }
221 if (changes) {
222 const iconToBeRendered = this.icon != null ? this.icon : this.config.fallbackIcon;
223 const iconDefinition = this.findIconDefinition(iconToBeRendered);
224 if (iconDefinition != null) {
225 const params = this.buildParams();
226 this.renderIcon(iconDefinition, params);
227 }
228 }
229 }
230 /**
231 * Programmatically trigger rendering of the icon.
232 *
233 * This method is useful, when creating {@link FaIconComponent} dynamically or
234 * changing its inputs programmatically as in these cases icon won't be
235 * re-rendered automatically.
236 */
237 render() {
238 this.ngOnChanges({});
239 }
240 findIconDefinition(i) {
241 const lookup = faNormalizeIconSpec(i, this.config.defaultPrefix);
242 if ('icon' in lookup) {
243 return lookup;
244 }
245 const definition = this.iconLibrary.getIconDefinition(lookup.prefix, lookup.iconName);
246 if (definition != null) {
247 return definition;
248 }
249 faWarnIfIconDefinitionMissing(lookup);
250 return null;
251 }
252 buildParams() {
253 const classOpts = {
254 flip: this.flip,
255 animation: this.animation,
256 border: this.border,
257 inverse: this.inverse,
258 size: this.size || null,
259 pull: this.pull || null,
260 rotate: this.rotate || null,
261 fixedWidth: typeof this.fixedWidth === 'boolean' ? this.fixedWidth : this.config.fixedWidth,
262 stackItemSize: this.stackItem != null ? this.stackItem.stackItemSize : null,
263 };
264 const parsedTransform = typeof this.transform === 'string' ? parse.transform(this.transform) : this.transform;
265 return {
266 title: this.title,
267 transform: parsedTransform,
268 classes: [...faClassList(classOpts), ...this.classes],
269 mask: this.mask != null ? this.findIconDefinition(this.mask) : null,
270 styles: this.styles != null ? this.styles : {},
271 symbol: this.symbol,
272 attributes: {
273 role: this.a11yRole,
274 },
275 };
276 }
277 renderIcon(definition, params) {
278 const renderedIcon = icon(definition, params);
279 this.renderedIconHTML = this.sanitizer.bypassSecurityTrustHtml(renderedIcon.html.join('\n'));
280 }
281}
282FaIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaIconComponent, deps: [{ token: i2.DomSanitizer }, { token: FaConfig }, { token: FaIconLibrary }, { token: FaStackItemSizeDirective, optional: true }, { token: FaStackComponent, optional: true }], target: i0.ɵɵFactoryTarget.Component });
283FaIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: FaIconComponent, selector: "fa-icon", inputs: { icon: "icon", title: "title", animation: "animation", spin: "spin", pulse: "pulse", mask: "mask", styles: "styles", flip: "flip", size: "size", pull: "pull", border: "border", inverse: "inverse", symbol: "symbol", rotate: "rotate", fixedWidth: "fixedWidth", classes: "classes", transform: "transform", a11yRole: "a11yRole" }, host: { properties: { "attr.title": "title", "innerHTML": "this.renderedIconHTML" }, classAttribute: "ng-fa-icon" }, usesOnChanges: true, ngImport: i0, template: ``, isInline: true });
284i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaIconComponent, decorators: [{
285 type: Component,
286 args: [{
287 selector: 'fa-icon',
288 template: ``,
289 host: {
290 class: 'ng-fa-icon',
291 '[attr.title]': 'title',
292 },
293 }]
294 }], ctorParameters: function () { return [{ type: i2.DomSanitizer }, { type: FaConfig }, { type: FaIconLibrary }, { type: FaStackItemSizeDirective, decorators: [{
295 type: Optional
296 }] }, { type: FaStackComponent, decorators: [{
297 type: Optional
298 }] }]; }, propDecorators: { icon: [{
299 type: Input
300 }], title: [{
301 type: Input
302 }], animation: [{
303 type: Input
304 }], spin: [{
305 type: Input
306 }], pulse: [{
307 type: Input
308 }], mask: [{
309 type: Input
310 }], styles: [{
311 type: Input
312 }], flip: [{
313 type: Input
314 }], size: [{
315 type: Input
316 }], pull: [{
317 type: Input
318 }], border: [{
319 type: Input
320 }], inverse: [{
321 type: Input
322 }], symbol: [{
323 type: Input
324 }], rotate: [{
325 type: Input
326 }], fixedWidth: [{
327 type: Input
328 }], classes: [{
329 type: Input
330 }], transform: [{
331 type: Input
332 }], a11yRole: [{
333 type: Input
334 }], renderedIconHTML: [{
335 type: HostBinding,
336 args: ['innerHTML']
337 }] } });
338
339class FaDuotoneIconComponent extends FaIconComponent {
340 findIconDefinition(i) {
341 const definition = super.findIconDefinition(i);
342 if (definition != null && !Array.isArray(definition.icon[4])) {
343 throw new Error('The specified icon does not appear to be a Duotone icon. ' +
344 'Check that you specified the correct style: ' +
345 `<fa-duotone-icon [icon]="['fad', '${definition.iconName}']"></fa-duotone-icon> ` +
346 `or use: <fa-icon icon="${definition.iconName}"></fa-icon> instead.`);
347 }
348 return definition;
349 }
350 buildParams() {
351 const params = super.buildParams();
352 if (this.swapOpacity === true || this.swapOpacity === 'true') {
353 params.classes.push('fa-swap-opacity');
354 }
355 if (this.primaryOpacity != null) {
356 params.styles['--fa-primary-opacity'] = this.primaryOpacity.toString();
357 }
358 if (this.secondaryOpacity != null) {
359 params.styles['--fa-secondary-opacity'] = this.secondaryOpacity.toString();
360 }
361 if (this.primaryColor != null) {
362 params.styles['--fa-primary-color'] = this.primaryColor;
363 }
364 if (this.secondaryColor != null) {
365 params.styles['--fa-secondary-color'] = this.secondaryColor;
366 }
367 return params;
368 }
369}
370FaDuotoneIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaDuotoneIconComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
371FaDuotoneIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: FaDuotoneIconComponent, selector: "fa-duotone-icon", inputs: { swapOpacity: "swapOpacity", primaryOpacity: "primaryOpacity", secondaryOpacity: "secondaryOpacity", primaryColor: "primaryColor", secondaryColor: "secondaryColor" }, usesInheritance: true, ngImport: i0, template: ``, isInline: true });
372i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaDuotoneIconComponent, decorators: [{
373 type: Component,
374 args: [{
375 selector: 'fa-duotone-icon',
376 template: ``,
377 }]
378 }], propDecorators: { swapOpacity: [{
379 type: Input
380 }], primaryOpacity: [{
381 type: Input
382 }], secondaryOpacity: [{
383 type: Input
384 }], primaryColor: [{
385 type: Input
386 }], secondaryColor: [{
387 type: Input
388 }] } });
389
390/**
391 * Warns if parent component not existing.
392 */
393const faWarnIfParentNotExist = (parent, parentName, childName) => {
394 if (!parent) {
395 throw new Error(`${childName} should be used as child of ${parentName} only.`);
396 }
397};
398
399/**
400 * Fontawesome layers.
401 */
402class FaLayersComponent {
403 constructor(renderer, elementRef, config) {
404 this.renderer = renderer;
405 this.elementRef = elementRef;
406 this.config = config;
407 }
408 ngOnInit() {
409 this.renderer.addClass(this.elementRef.nativeElement, 'fa-layers');
410 this.fixedWidth = typeof this.fixedWidth === 'boolean' ? this.fixedWidth : this.config.fixedWidth;
411 }
412 ngOnChanges(changes) {
413 if ('size' in changes) {
414 if (changes.size.currentValue != null) {
415 this.renderer.addClass(this.elementRef.nativeElement, `fa-${changes.size.currentValue}`);
416 }
417 if (changes.size.previousValue != null) {
418 this.renderer.removeClass(this.elementRef.nativeElement, `fa-${changes.size.previousValue}`);
419 }
420 }
421 }
422}
423FaLayersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaLayersComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: FaConfig }], target: i0.ɵɵFactoryTarget.Component });
424FaLayersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: FaLayersComponent, selector: "fa-layers", inputs: { size: "size", fixedWidth: "fixedWidth" }, host: { properties: { "class.fa-fw": "this.fixedWidth" } }, usesOnChanges: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
425i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaLayersComponent, decorators: [{
426 type: Component,
427 args: [{
428 selector: 'fa-layers',
429 template: `<ng-content></ng-content>`,
430 }]
431 }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: FaConfig }]; }, propDecorators: { size: [{
432 type: Input
433 }], fixedWidth: [{
434 type: Input
435 }, {
436 type: HostBinding,
437 args: ['class.fa-fw']
438 }] } });
439
440class FaLayersCounterComponent {
441 constructor(parent, sanitizer) {
442 this.parent = parent;
443 this.sanitizer = sanitizer;
444 /**
445 * Set `class` attribute on the SVG element rendered by the component.
446 *
447 * @deprecated This input breaks view encapsulation and is not recommended.
448 * For simple cases (like colors), use `class` on the component itself, for
449 * more complex usages, explicitly opt-in to break the view encapsulation.
450 * This input is deprecated since 0.12.0 and will be removed in 0.13.0.
451 */
452 this.classes = [];
453 faWarnIfParentNotExist(this.parent, 'FaLayersComponent', this.constructor.name);
454 }
455 ngOnChanges(changes) {
456 if (changes) {
457 const params = this.buildParams();
458 this.updateContent(params);
459 }
460 }
461 buildParams() {
462 const classes = [];
463 if (this.classes != null) {
464 classes.push(...this.classes);
465 }
466 if (this.position != null) {
467 classes.push(`fa-layers-${this.position}`);
468 }
469 return {
470 title: this.title,
471 classes,
472 styles: this.styles,
473 };
474 }
475 updateContent(params) {
476 this.renderedHTML = this.sanitizer.bypassSecurityTrustHtml(counter(this.content || '', params).html.join(''));
477 }
478}
479FaLayersCounterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaLayersCounterComponent, deps: [{ token: FaLayersComponent, optional: true }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
480FaLayersCounterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: FaLayersCounterComponent, selector: "fa-layers-counter", inputs: { content: "content", title: "title", styles: "styles", classes: "classes", position: "position" }, host: { properties: { "innerHTML": "this.renderedHTML" }, classAttribute: "ng-fa-layers-counter" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
481i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaLayersCounterComponent, decorators: [{
482 type: Component,
483 args: [{
484 selector: 'fa-layers-counter',
485 template: '',
486 host: {
487 class: 'ng-fa-layers-counter',
488 },
489 }]
490 }], ctorParameters: function () { return [{ type: FaLayersComponent, decorators: [{
491 type: Optional
492 }] }, { type: i2.DomSanitizer }]; }, propDecorators: { content: [{
493 type: Input
494 }], title: [{
495 type: Input
496 }], styles: [{
497 type: Input
498 }], classes: [{
499 type: Input
500 }], position: [{
501 type: Input
502 }], renderedHTML: [{
503 type: HostBinding,
504 args: ['innerHTML']
505 }] } });
506
507class FaLayersTextComponent {
508 constructor(parent, sanitizer) {
509 this.parent = parent;
510 this.sanitizer = sanitizer;
511 /**
512 * Set `class` attribute on the SVG element rendered by the component.
513 *
514 * @deprecated This input breaks view encapsulation and is not recommended.
515 * For simple cases (like colors), use `class` on the component itself, for
516 * more complex usages, explicitly opt-in to break the view encapsulation.
517 * This input is deprecated since 0.12.0 and will be removed in 0.13.0.
518 */
519 this.classes = [];
520 faWarnIfParentNotExist(this.parent, 'FaLayersComponent', this.constructor.name);
521 }
522 /**
523 * @deprecated This input was incorrectly exposed and never worked correctly. To be removed in 0.14.0.
524 */
525 set spin(value) {
526 this.animation = value ? 'spin' : undefined;
527 }
528 /**
529 * @deprecated This input was incorrectly exposed and never worked correctly. To be removed in 0.14.0.
530 */
531 set pulse(value) {
532 this.animation = value ? 'spin-pulse' : undefined;
533 }
534 ngOnChanges(changes) {
535 if (changes) {
536 const params = this.buildParams();
537 this.updateContent(params);
538 }
539 }
540 /**
541 * Updating params by component props.
542 */
543 buildParams() {
544 const classOpts = {
545 flip: this.flip,
546 animation: this.animation,
547 border: this.border,
548 inverse: this.inverse,
549 size: this.size || null,
550 pull: this.pull || null,
551 rotate: this.rotate || null,
552 fixedWidth: this.fixedWidth,
553 };
554 const parsedTransform = typeof this.transform === 'string' ? parse.transform(this.transform) : this.transform;
555 return {
556 transform: parsedTransform,
557 classes: [...faClassList(classOpts), ...this.classes],
558 title: this.title,
559 styles: this.styles,
560 };
561 }
562 updateContent(params) {
563 this.renderedHTML = this.sanitizer.bypassSecurityTrustHtml(text(this.content || '', params).html.join('\n'));
564 }
565}
566FaLayersTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaLayersTextComponent, deps: [{ token: FaLayersComponent, optional: true }, { token: i2.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
567FaLayersTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: FaLayersTextComponent, selector: "fa-layers-text", inputs: { content: "content", title: "title", styles: "styles", classes: "classes", spin: "spin", pulse: "pulse", flip: "flip", size: "size", pull: "pull", border: "border", inverse: "inverse", rotate: "rotate", fixedWidth: "fixedWidth", transform: "transform" }, host: { properties: { "innerHTML": "this.renderedHTML" }, classAttribute: "ng-fa-layers-text" }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
568i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FaLayersTextComponent, decorators: [{
569 type: Component,
570 args: [{
571 selector: 'fa-layers-text',
572 template: '',
573 host: {
574 class: 'ng-fa-layers-text',
575 },
576 }]
577 }], ctorParameters: function () { return [{ type: FaLayersComponent, decorators: [{
578 type: Optional
579 }] }, { type: i2.DomSanitizer }]; }, propDecorators: { content: [{
580 type: Input
581 }], title: [{
582 type: Input
583 }], styles: [{
584 type: Input
585 }], classes: [{
586 type: Input
587 }], spin: [{
588 type: Input
589 }], pulse: [{
590 type: Input
591 }], flip: [{
592 type: Input
593 }], size: [{
594 type: Input
595 }], pull: [{
596 type: Input
597 }], border: [{
598 type: Input
599 }], inverse: [{
600 type: Input
601 }], rotate: [{
602 type: Input
603 }], fixedWidth: [{
604 type: Input
605 }], transform: [{
606 type: Input
607 }], renderedHTML: [{
608 type: HostBinding,
609 args: ['innerHTML']
610 }] } });
611
612class FontAwesomeModule {
613}
614FontAwesomeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FontAwesomeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
615FontAwesomeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0", ngImport: i0, type: FontAwesomeModule, declarations: [FaIconComponent,
616 FaDuotoneIconComponent,
617 FaLayersComponent,
618 FaLayersTextComponent,
619 FaLayersCounterComponent,
620 FaStackComponent,
621 FaStackItemSizeDirective], exports: [FaIconComponent,
622 FaDuotoneIconComponent,
623 FaLayersComponent,
624 FaLayersTextComponent,
625 FaLayersCounterComponent,
626 FaStackComponent,
627 FaStackItemSizeDirective] });
628FontAwesomeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FontAwesomeModule });
629i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: FontAwesomeModule, decorators: [{
630 type: NgModule,
631 args: [{
632 declarations: [
633 FaIconComponent,
634 FaDuotoneIconComponent,
635 FaLayersComponent,
636 FaLayersTextComponent,
637 FaLayersCounterComponent,
638 FaStackComponent,
639 FaStackItemSizeDirective,
640 ],
641 exports: [
642 FaIconComponent,
643 FaDuotoneIconComponent,
644 FaLayersComponent,
645 FaLayersTextComponent,
646 FaLayersCounterComponent,
647 FaStackComponent,
648 FaStackItemSizeDirective,
649 ],
650 }]
651 }] });
652
653/**
654 * Generated bundle index. Do not edit.
655 */
656
657export { FaConfig, FaDuotoneIconComponent, FaIconComponent, FaIconLibrary, FaLayersComponent, FaLayersCounterComponent, FaLayersTextComponent, FaStackComponent, FaStackItemSizeDirective, FontAwesomeModule };
658//# sourceMappingURL=angular-fontawesome.mjs.map
659//# sourceMappingURL=angular-fontawesome.mjs.map