diff --git a/docs/upgrading/0.14.0-0.15.0.md b/docs/upgrading/0.14.0-0.15.0.md index e6e9d1f..f57a0ce 100644 --- a/docs/upgrading/0.14.0-0.15.0.md +++ b/docs/upgrading/0.14.0-0.15.0.md @@ -10,3 +10,7 @@ Dynamic animation can be achieved by binding the `animation` input to `undefined - + ``` + +## Remove usage of the `styles` and `classes` inputs + +Previously deprecated `styles` and `classes` inputs in all components were removed. These inputs don't work the way one would expect and cause a lot of confusion. For the majority of the cases, one should use regular [class and style bindings](https://angular.io/guide/class-binding) provided by Angular. For those rare cases, when it is not enough, there is a guide on how one can style component's internal elements at their own risk - [Styling icon internals](https://github.com/FortAwesome/angular-fontawesome/blob/master/docs/guide/styling-icon-internals.md). diff --git a/src/lib/icon/icon.component.ts b/src/lib/icon/icon.component.ts index 950a6fa..0178aab 100644 --- a/src/lib/icon/icon.component.ts +++ b/src/lib/icon/icon.component.ts @@ -11,7 +11,6 @@ import { PullProp, RotateProp, SizeProp, - Styles, Transform, } from '@fortawesome/fontawesome-svg-core'; import { FaConfig } from '../config'; @@ -53,16 +52,6 @@ export class FaIconComponent implements OnChanges { @Input() animation?: AnimationProp; @Input() mask?: IconProp; - - /** - * Set `style` attribute on the SVG element rendered by the component. - * - * @deprecated This input breaks view encapsulation and is not recommended. - * For simple cases (like colors), use `style` on the component itself, for - * more complex usages, explicitly opt-in to break the view encapsulation. - * This input is deprecated since 0.12.0 and will be removed in 0.13.0. - */ - @Input() styles?: Styles; @Input() flip?: FlipProp; @Input() size?: SizeProp; @Input() pull?: PullProp; @@ -71,16 +60,6 @@ export class FaIconComponent implements OnChanges { @Input() symbol?: FaSymbol; @Input() rotate?: RotateProp; @Input() fixedWidth?: boolean; - - /** - * Set `class` attribute on the SVG element rendered by the component. - * - * @deprecated This input breaks view encapsulation and is not recommended. - * For simple cases (like colors), use `class` on the component itself, for - * more complex usages, explicitly opt-in to break the view encapsulation. - * This input is deprecated since 0.12.0 and will be removed in 0.13.0. - */ - @Input() classes?: string[] = []; @Input() transform?: string | Transform; /** @@ -167,9 +146,8 @@ export class FaIconComponent implements OnChanges { return { title: this.title, transform: parsedTransform, - classes: [...faClassList(classOpts), ...this.classes], + classes: faClassList(classOpts), mask: this.mask != null ? this.findIconDefinition(this.mask) : null, - styles: this.styles != null ? this.styles : {}, symbol: this.symbol, attributes: { role: this.a11yRole, diff --git a/src/lib/layers/layers-counter.component.ts b/src/lib/layers/layers-counter.component.ts index 4b74cca..4a56fcd 100644 --- a/src/lib/layers/layers-counter.component.ts +++ b/src/lib/layers/layers-counter.component.ts @@ -1,6 +1,6 @@ import { Component, HostBinding, Input, OnChanges, Optional, SimpleChanges } from '@angular/core'; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; -import { counter, CounterParams, Styles } from '@fortawesome/fontawesome-svg-core'; +import { counter, CounterParams } from '@fortawesome/fontawesome-svg-core'; import { faWarnIfParentNotExist } from '../shared/errors/warn-if-parent-not-exist'; import { FaLayersComponent } from './layers.component'; @@ -15,26 +15,6 @@ import { FaLayersComponent } from './layers.component'; export class FaLayersCounterComponent implements OnChanges { @Input() content: string; @Input() title?: string; - - /** - * Set `style` attribute on the SVG element rendered by the component. - * - * @deprecated This input breaks view encapsulation and is not recommended. - * For simple cases (like colors), use `style` on the component itself, for - * more complex usages, explicitly opt-in to break the view encapsulation. - * This input is deprecated since 0.12.0 and will be removed in 0.13.0. - */ - @Input() styles?: Styles; - - /** - * Set `class` attribute on the SVG element rendered by the component. - * - * @deprecated This input breaks view encapsulation and is not recommended. - * For simple cases (like colors), use `class` on the component itself, for - * more complex usages, explicitly opt-in to break the view encapsulation. - * This input is deprecated since 0.12.0 and will be removed in 0.13.0. - */ - @Input() classes?: string[] = []; @Input() position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'; @HostBinding('innerHTML') renderedHTML: SafeHtml; @@ -54,17 +34,9 @@ export class FaLayersCounterComponent implements OnChanges { } protected buildParams(): CounterParams { - const classes = []; - if (this.classes != null) { - classes.push(...this.classes); - } - if (this.position != null) { - classes.push(`fa-layers-${this.position}`); - } return { title: this.title, - classes, - styles: this.styles, + classes: this.position != null ? [`fa-layers-${this.position}`] : undefined, }; } diff --git a/src/lib/layers/layers-text.component.ts b/src/lib/layers/layers-text.component.ts index 8b91de7..293ce8e 100644 --- a/src/lib/layers/layers-text.component.ts +++ b/src/lib/layers/layers-text.component.ts @@ -6,7 +6,6 @@ import { PullProp, RotateProp, SizeProp, - Styles, text, TextParams, Transform, @@ -27,27 +26,6 @@ import { FaLayersComponent } from './layers.component'; export class FaLayersTextComponent implements OnChanges { @Input() content: string; @Input() title?: string; - - /** - * Set `style` attribute on the SVG element rendered by the component. - * - * @deprecated This input breaks view encapsulation and is not recommended. - * For simple cases (like colors), use `style` on the component itself, for - * more complex usages, explicitly opt-in to break the view encapsulation. - * This input is deprecated since 0.12.0 and will be removed in 0.13.0. - */ - @Input() styles?: Styles; - - /** - * Set `class` attribute on the SVG element rendered by the component. - * - * @deprecated This input breaks view encapsulation and is not recommended. - * For simple cases (like colors), use `class` on the component itself, for - * more complex usages, explicitly opt-in to break the view encapsulation. - * This input is deprecated since 0.12.0 and will be removed in 0.13.0. - */ - @Input() classes?: string[] = []; - @Input() flip?: FlipProp; @Input() size?: SizeProp; @Input() pull?: PullProp; @@ -94,9 +72,8 @@ export class FaLayersTextComponent implements OnChanges { return { transform: parsedTransform, - classes: [...faClassList(classOpts), ...this.classes], + classes: faClassList(classOpts), title: this.title, - styles: this.styles, }; }