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