File tree Expand file tree Collapse file tree
1st-gen/packages/icon/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010 * governing permissions and limitations under the License.
1111 */
1212
13- import { html , TemplateResult } from '@spectrum-web-components/base' ;
13+ import {
14+ html ,
15+ PropertyValues ,
16+ TemplateResult ,
17+ } from '@spectrum-web-components/base' ;
1418import {
1519 property ,
1620 query ,
@@ -49,6 +53,28 @@ export class Icon extends IconBase {
4953 this . updateIconPromise = this . updateIcon ( ) ;
5054 }
5155
56+ protected override updated ( changes : PropertyValues ) : void {
57+ super . updated ( changes ) ;
58+ if ( window . __swc ?. DEBUG ) {
59+ if ( changes . has ( 'name' ) && this . name !== undefined ) {
60+ window . __swc . warn (
61+ this ,
62+ `<${ this . localName } > the "name" attribute is deprecated and will be removed in Spectrum 2. Slot an SVG directly or use an icon factory function instead.` ,
63+ 'https://opensource.adobe.com/spectrum-web-components/second-gen/?path=/docs/icon-consumer-migration-guide--docs' ,
64+ { level : 'deprecation' }
65+ ) ;
66+ }
67+ if ( changes . has ( 'src' ) && this . src !== undefined ) {
68+ window . __swc . warn (
69+ this ,
70+ `<${ this . localName } > the "src" attribute is deprecated and will be removed in Spectrum 2. Slot an <svg> or <img> element directly instead.` ,
71+ 'https://opensource.adobe.com/spectrum-web-components/second-gen/?path=/docs/icon-consumer-migration-guide--docs' ,
72+ { level : 'deprecation' }
73+ ) ;
74+ }
75+ }
76+ }
77+
5278 public override attributeChangedCallback (
5379 name : string ,
5480 old : string ,
Original file line number Diff line number Diff line change @@ -72,6 +72,17 @@ export class IconBase extends SpectrumElement {
7272 this . systemResolver . system === 'spectrum-two' ? 2 : 1 ;
7373 }
7474
75+ if ( window . __swc ?. DEBUG ) {
76+ if ( changes . has ( 'size' ) && ( this . size === 'xxs' || this . size === 'xxl' ) ) {
77+ window . __swc . warn (
78+ this ,
79+ `<${ this . localName } > the "${ this . size } " size value is deprecated and will be removed in Spectrum 2. Use "${ this . size === 'xxs' ? 'xs' : 'xl' } " instead.` ,
80+ 'https://opensource.adobe.com/spectrum-web-components/second-gen/?path=/docs/icon-consumer-migration-guide--docs' ,
81+ { level : 'deprecation' }
82+ ) ;
83+ }
84+ }
85+
7586 super . update ( changes ) ;
7687 }
7788
You can’t perform that action at this time.
0 commit comments