@spectrum-web-components/icon 0.30.0 → 0.30.1-overlay.30

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/icon",
3
- "version": "0.30.0",
3
+ "version": "0.30.1-overlay.30+1df211c75",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -71,8 +71,8 @@
71
71
  "lit-html"
72
72
  ],
73
73
  "dependencies": {
74
- "@spectrum-web-components/base": "^0.30.0",
75
- "@spectrum-web-components/iconset": "^0.30.0"
74
+ "@spectrum-web-components/base": "^0.30.1-overlay.30+1df211c75",
75
+ "@spectrum-web-components/iconset": "^0.30.1-overlay.30+1df211c75"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@spectrum-css/icon": "^3.0.41"
@@ -83,5 +83,5 @@
83
83
  "./sp-*.js",
84
84
  "./**/*.dev.js"
85
85
  ],
86
- "gitHead": "e34a26bf2bbea5f60a5e415e0f12c97654f0e20d"
86
+ "gitHead": "1df211c7581b6fd6ec624cf2b09bc81aeec29c26"
87
87
  }
package/src/Icon.d.ts CHANGED
@@ -13,6 +13,7 @@ export declare class Icon extends IconBase {
13
13
  firstUpdated(): void;
14
14
  attributeChangedCallback(name: string, old: string, value: string): void;
15
15
  private iconsetListener;
16
+ private announceIconImageSrcError;
16
17
  protected render(): TemplateResult;
17
18
  private updateIcon;
18
19
  private parseIcon;
package/src/Icon.dev.js CHANGED
@@ -46,6 +46,15 @@ export class Icon extends IconBase {
46
46
  super.attributeChangedCallback(name, old, value);
47
47
  this.updateIconPromise = this.updateIcon();
48
48
  }
49
+ announceIconImageSrcError() {
50
+ this.dispatchEvent(
51
+ new Event("error", {
52
+ cancelable: false,
53
+ bubbles: false,
54
+ composed: false
55
+ })
56
+ );
57
+ }
49
58
  render() {
50
59
  if (this.name) {
51
60
  return html`
@@ -53,7 +62,11 @@ export class Icon extends IconBase {
53
62
  `;
54
63
  } else if (this.src) {
55
64
  return html`
56
- <img src="${this.src}" alt=${ifDefined(this.label)} />
65
+ <img
66
+ src="${this.src}"
67
+ alt=${ifDefined(this.label)}
68
+ @error=${this.announceIconImageSrcError}
69
+ />
57
70
  `;
58
71
  }
59
72
  return super.render();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Icon.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport { IconsetRegistry } from '@spectrum-web-components/iconset/src/iconset-registry.js';\n\nimport { IconBase } from './IconBase.dev.js'\n\n/**\n * @element sp-icon\n */\nexport class Icon extends IconBase {\n @property()\n public src?: string;\n\n @property()\n public name?: string;\n\n @query('#container')\n private iconContainer?: HTMLElement;\n\n private updateIconPromise?: Promise<void>;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override firstUpdated(): void {\n this.updateIconPromise = this.updateIcon();\n }\n\n public override attributeChangedCallback(\n name: string,\n old: string,\n value: string\n ): void {\n super.attributeChangedCallback(name, old, value);\n this.updateIconPromise = this.updateIcon(); // any of our attributes change, update our icon\n }\n\n private iconsetListener = (event: CustomEvent): void => {\n if (!this.name) {\n return;\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n if (event.detail.name === icon.iconset) {\n this.updateIconPromise = this.updateIcon();\n }\n };\n\n protected override render(): TemplateResult {\n if (this.name) {\n return html`\n <div id=\"container\"></div>\n `;\n } else if (this.src) {\n return html`\n <img src=\"${this.src}\" alt=${ifDefined(this.label)} />\n `;\n }\n return super.render();\n }\n\n private async updateIcon(): Promise<void> {\n if (this.updateIconPromise) {\n await this.updateIconPromise;\n }\n if (!this.name) {\n return Promise.resolve();\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n // try to retrieve the iconset\n const iconset = IconsetRegistry.getInstance().getIconset(icon.iconset);\n if (!iconset) {\n // we can stop here as there's nothing to be done till we get the iconset\n return Promise.resolve();\n }\n if (!this.iconContainer) {\n return Promise.resolve();\n }\n this.iconContainer.innerHTML = '';\n return iconset.applyIconToElement(\n this.iconContainer,\n icon.icon,\n this.size || '',\n this.label ? this.label : ''\n );\n }\n\n private parseIcon(icon: string): { iconset: string; icon: string } {\n const iconParts = icon.split(':');\n let iconsetName = 'default';\n let iconName = icon;\n if (iconParts.length > 1) {\n iconsetName = iconParts[0];\n iconName = iconParts[1];\n }\n return { iconset: iconsetName, icon: iconName };\n }\n\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.updateIconPromise;\n return complete;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA,SAAS,YAA4B;AACrC;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,iBAAiB;AAE1B,SAAS,uBAAuB;AAEhC,SAAS,gBAAgB;AAKlB,aAAM,aAAa,SAAS;AAAA,EAA5B;AAAA;AAmCH,SAAQ,kBAAkB,CAAC,UAA6B;AACpD,UAAI,CAAC,KAAK,MAAM;AACZ;AAAA,MACJ;AAEA,YAAM,OAAO,KAAK,UAAU,KAAK,IAAI;AACrC,UAAI,MAAM,OAAO,SAAS,KAAK,SAAS;AACpC,aAAK,oBAAoB,KAAK,WAAW;AAAA,MAC7C;AA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AAI,WAAW;AACf,QAAI,UAAU,SAAS,GAAG;AACtB,oBAAc,UAAU,CAAC;AACzB,iBAAW,UAAU,CAAC;AAAA,IAC1B;AACA,WAAO,EAAE,SAAS,aAAa,MAAM,SAAS;AAAA,EAClD;AAAA,EAEA,MAAyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AApGW;AAAA,EADN,SAAS;AAAA,GADD,KAEF;AAGA;AAAA,EADN,SAAS;AAAA,GAJD,KAKF;AAGC;AAAA,EADP,MAAM,YAAY;AAAA,GAPV,KAQD;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport { IconsetRegistry } from '@spectrum-web-components/iconset/src/iconset-registry.js';\n\nimport { IconBase } from './IconBase.dev.js'\n\n/**\n * @element sp-icon\n */\nexport class Icon extends IconBase {\n @property()\n public src?: string;\n\n @property()\n public name?: string;\n\n @query('#container')\n private iconContainer?: HTMLElement;\n\n private updateIconPromise?: Promise<void>;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override firstUpdated(): void {\n this.updateIconPromise = this.updateIcon();\n }\n\n public override attributeChangedCallback(\n name: string,\n old: string,\n value: string\n ): void {\n super.attributeChangedCallback(name, old, value);\n this.updateIconPromise = this.updateIcon(); // any of our attributes change, update our icon\n }\n\n private iconsetListener = (event: CustomEvent): void => {\n if (!this.name) {\n return;\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n if (event.detail.name === icon.iconset) {\n this.updateIconPromise = this.updateIcon();\n }\n };\n\n private announceIconImageSrcError(): void {\n this.dispatchEvent(\n new Event('error', {\n cancelable: false,\n bubbles: false,\n composed: false,\n })\n );\n }\n\n protected override render(): TemplateResult {\n if (this.name) {\n return html`\n <div id=\"container\"></div>\n `;\n } else if (this.src) {\n return html`\n <img\n src=\"${this.src}\"\n alt=${ifDefined(this.label)}\n @error=${this.announceIconImageSrcError}\n />\n `;\n }\n return super.render();\n }\n\n private async updateIcon(): Promise<void> {\n if (this.updateIconPromise) {\n await this.updateIconPromise;\n }\n if (!this.name) {\n return Promise.resolve();\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n // try to retrieve the iconset\n const iconset = IconsetRegistry.getInstance().getIconset(icon.iconset);\n if (!iconset) {\n // we can stop here as there's nothing to be done till we get the iconset\n return Promise.resolve();\n }\n if (!this.iconContainer) {\n return Promise.resolve();\n }\n this.iconContainer.innerHTML = '';\n return iconset.applyIconToElement(\n this.iconContainer,\n icon.icon,\n this.size || '',\n this.label ? this.label : ''\n );\n }\n\n private parseIcon(icon: string): { iconset: string; icon: string } {\n const iconParts = icon.split(':');\n let iconsetName = 'default';\n let iconName = icon;\n if (iconParts.length > 1) {\n iconsetName = iconParts[0];\n iconName = iconParts[1];\n }\n return { iconset: iconsetName, icon: iconName };\n }\n\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.updateIconPromise;\n return complete;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA,SAAS,YAA4B;AACrC;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS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AQ,QAAQ;AAAA,IAC3B;AAEA,UAAM,OAAO,KAAK,UAAU,KAAK,IAAI;AAErC,UAAM,UAAU,gBAAgB,YAAY,EAAE,WAAW,KAAK,OAAO;AACrE,QAAI,CAAC,SAAS;AAEV,aAAO,QAAQ,QAAQ;AAAA,IAC3B;AACA,QAAI,CAAC,KAAK,eAAe;AACrB,aAAO,QAAQ,QAAQ;AAAA,IAC3B;AACA,SAAK,cAAc,YAAY;AAC/B,WAAO,QAAQ;AAAA,MACX,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK,QAAQ;AAAA,MACb,KAAK,QAAQ,KAAK,QAAQ;AAAA,IAC9B;AAAA,EACJ;AAAA,EAEQ,UAAU,MAAiD;AAC/D,UAAM,YAAY,KAAK,MAAM,GAAG;AAChC,QAAI,cAAc;AAClB,QAAI,WAAW;AACf,QAAI,UAAU,SAAS,GAAG;AACtB,oBAAc,UAAU,CAAC;AACzB,iBAAW,UAAU,CAAC;AAAA,IAC1B;AACA,WAAO,EAAE,SAAS,aAAa,MAAM,SAAS;AAAA,EAClD;AAAA,EAEA,MAAyB,oBAAsC;AAC3D,UAAM,WAAY,MAAM,MAAM,kBAAkB;AAChD,UAAM,KAAK;AACX,WAAO;AAAA,EACX;AACJ;AAlHW;AAAA,EADN,SAAS;AAAA,GADD,KAEF;AAGA;AAAA,EADN,SAAS;AAAA,GAJD,KAKF;AAGC;AAAA,EADP,MAAM,YAAY;AAAA,GAPV,KAQD;",
6
6
  "names": []
7
7
  }
package/src/Icon.js CHANGED
@@ -1,6 +1,10 @@
1
- "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var o=(s,r,e,t)=>{for(var i=t>1?void 0:t?l(r,e):r,n=s.length-1,a;n>=0;n--)(a=s[n])&&(i=(t?a(r,e,i):a(i))||i);return t&&i&&p(r,e,i),i};import{html as c}from"@spectrum-web-components/base";import{property as d,query as m}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as u}from"@spectrum-web-components/base/src/directives.js";import{IconsetRegistry as h}from"@spectrum-web-components/iconset/src/iconset-registry.js";import{IconBase as v}from"./IconBase.js";export class Icon extends v{constructor(){super(...arguments);this.iconsetListener=e=>{if(!this.name)return;const t=this.parseIcon(this.name);e.detail.name===t.iconset&&(this.updateIconPromise=this.updateIcon())}}connectedCallback(){super.connectedCallback(),window.addEventListener("sp-iconset-added",this.iconsetListener)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("sp-iconset-added",this.iconsetListener)}firstUpdated(){this.updateIconPromise=this.updateIcon()}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),this.updateIconPromise=this.updateIcon()}render(){return this.name?c`
1
+ "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var o=(s,r,e,t)=>{for(var i=t>1?void 0:t?l(r,e):r,n=s.length-1,a;n>=0;n--)(a=s[n])&&(i=(t?a(r,e,i):a(i))||i);return t&&i&&p(r,e,i),i};import{html as c}from"@spectrum-web-components/base";import{property as d,query as m}from"@spectrum-web-components/base/src/decorators.js";import{ifDefined as u}from"@spectrum-web-components/base/src/directives.js";import{IconsetRegistry as h}from"@spectrum-web-components/iconset/src/iconset-registry.js";import{IconBase as v}from"./IconBase.js";export class Icon extends v{constructor(){super(...arguments);this.iconsetListener=e=>{if(!this.name)return;const t=this.parseIcon(this.name);e.detail.name===t.iconset&&(this.updateIconPromise=this.updateIcon())}}connectedCallback(){super.connectedCallback(),window.addEventListener("sp-iconset-added",this.iconsetListener)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("sp-iconset-added",this.iconsetListener)}firstUpdated(){this.updateIconPromise=this.updateIcon()}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),this.updateIconPromise=this.updateIcon()}announceIconImageSrcError(){this.dispatchEvent(new Event("error",{cancelable:!1,bubbles:!1,composed:!1}))}render(){return this.name?c`
2
2
  <div id="container"></div>
3
3
  `:this.src?c`
4
- <img src="${this.src}" alt=${u(this.label)} />
4
+ <img
5
+ src="${this.src}"
6
+ alt=${u(this.label)}
7
+ @error=${this.announceIconImageSrcError}
8
+ />
5
9
  `:super.render()}async updateIcon(){if(this.updateIconPromise&&await this.updateIconPromise,!this.name)return Promise.resolve();const e=this.parseIcon(this.name),t=h.getInstance().getIconset(e.iconset);return!t||!this.iconContainer?Promise.resolve():(this.iconContainer.innerHTML="",t.applyIconToElement(this.iconContainer,e.icon,this.size||"",this.label?this.label:""))}parseIcon(e){const t=e.split(":");let i="default",n=e;return t.length>1&&(i=t[0],n=t[1]),{iconset:i,icon:n}}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this.updateIconPromise,e}}o([d()],Icon.prototype,"src",2),o([d()],Icon.prototype,"name",2),o([m("#container")],Icon.prototype,"iconContainer",2);
6
10
  //# sourceMappingURL=Icon.js.map
package/src/Icon.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Icon.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport { IconsetRegistry } from '@spectrum-web-components/iconset/src/iconset-registry.js';\n\nimport { IconBase } from './IconBase.js';\n\n/**\n * @element sp-icon\n */\nexport class Icon extends IconBase {\n @property()\n public src?: string;\n\n @property()\n public name?: string;\n\n @query('#container')\n private iconContainer?: HTMLElement;\n\n private updateIconPromise?: Promise<void>;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override firstUpdated(): void {\n this.updateIconPromise = this.updateIcon();\n }\n\n public override attributeChangedCallback(\n name: string,\n old: string,\n value: string\n ): void {\n super.attributeChangedCallback(name, old, value);\n this.updateIconPromise = this.updateIcon(); // any of our attributes change, update our icon\n }\n\n private iconsetListener = (event: CustomEvent): void => {\n if (!this.name) {\n return;\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n if (event.detail.name === icon.iconset) {\n this.updateIconPromise = this.updateIcon();\n }\n };\n\n protected override render(): TemplateResult {\n if (this.name) {\n return html`\n <div id=\"container\"></div>\n `;\n } else if (this.src) {\n return html`\n <img src=\"${this.src}\" alt=${ifDefined(this.label)} />\n `;\n }\n return super.render();\n }\n\n private async updateIcon(): Promise<void> {\n if (this.updateIconPromise) {\n await this.updateIconPromise;\n }\n if (!this.name) {\n return Promise.resolve();\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n // try to retrieve the iconset\n const iconset = IconsetRegistry.getInstance().getIconset(icon.iconset);\n if (!iconset) {\n // we can stop here as there's nothing to be done till we get the iconset\n return Promise.resolve();\n }\n if (!this.iconContainer) {\n return Promise.resolve();\n }\n this.iconContainer.innerHTML = '';\n return iconset.applyIconToElement(\n this.iconContainer,\n icon.icon,\n this.size || '',\n this.label ? this.label : ''\n );\n }\n\n private parseIcon(icon: string): { iconset: string; icon: string } {\n const iconParts = icon.split(':');\n let iconsetName = 'default';\n let iconName = icon;\n if (iconParts.length > 1) {\n iconsetName = iconParts[0];\n iconName = iconParts[1];\n }\n return { iconset: iconsetName, icon: iconName };\n }\n\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.updateIconPromise;\n return complete;\n }\n}\n"],
5
- "mappings": "qNAYA,OAAS,QAAAA,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AAMK,EAAYL,EAAK,MAAM,GAAG,EAChC,IAAIM,EAAc,UACdC,EAAWP,EACf,OAAIK,EAAU,OAAS,IACnBC,EAAcD,EAAU,CAAC,EACzBE,EAAWF,EAAU,CAAC,GAEnB,CAAE,QAASC,EAAa,KAAMC,CAAS,CAClD,CAEA,MAAyB,mBAAsC,CAC3D,MAAMC,EAAY,MAAM,MAAM,kBAAkB,EAChD,aAAM,KAAK,kBACJA,CACX,CACJ,CApGWC,EAAA,CADNf,EAAS,GADD,KAEF,mBAGAe,EAAA,CADNf,EAAS,GAJD,KAKF,oBAGCe,EAAA,CADPd,EAAM,YAAY,GAPV,KAQD",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport { IconsetRegistry } from '@spectrum-web-components/iconset/src/iconset-registry.js';\n\nimport { IconBase } from './IconBase.js';\n\n/**\n * @element sp-icon\n */\nexport class Icon extends IconBase {\n @property()\n public src?: string;\n\n @property()\n public name?: string;\n\n @query('#container')\n private iconContainer?: HTMLElement;\n\n private updateIconPromise?: Promise<void>;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('sp-iconset-added', this.iconsetListener);\n }\n\n public override firstUpdated(): void {\n this.updateIconPromise = this.updateIcon();\n }\n\n public override attributeChangedCallback(\n name: string,\n old: string,\n value: string\n ): void {\n super.attributeChangedCallback(name, old, value);\n this.updateIconPromise = this.updateIcon(); // any of our attributes change, update our icon\n }\n\n private iconsetListener = (event: CustomEvent): void => {\n if (!this.name) {\n return;\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n if (event.detail.name === icon.iconset) {\n this.updateIconPromise = this.updateIcon();\n }\n };\n\n private announceIconImageSrcError(): void {\n this.dispatchEvent(\n new Event('error', {\n cancelable: false,\n bubbles: false,\n composed: false,\n })\n );\n }\n\n protected override render(): TemplateResult {\n if (this.name) {\n return html`\n <div id=\"container\"></div>\n `;\n } else if (this.src) {\n return html`\n <img\n src=\"${this.src}\"\n alt=${ifDefined(this.label)}\n @error=${this.announceIconImageSrcError}\n />\n `;\n }\n return super.render();\n }\n\n private async updateIcon(): Promise<void> {\n if (this.updateIconPromise) {\n await this.updateIconPromise;\n }\n if (!this.name) {\n return Promise.resolve();\n }\n // parse the icon name to get iconset name\n const icon = this.parseIcon(this.name);\n // try to retrieve the iconset\n const iconset = IconsetRegistry.getInstance().getIconset(icon.iconset);\n if (!iconset) {\n // we can stop here as there's nothing to be done till we get the iconset\n return Promise.resolve();\n }\n if (!this.iconContainer) {\n return Promise.resolve();\n }\n this.iconContainer.innerHTML = '';\n return iconset.applyIconToElement(\n this.iconContainer,\n icon.icon,\n this.size || '',\n this.label ? this.label : ''\n );\n }\n\n private parseIcon(icon: string): { iconset: string; icon: string } {\n const iconParts = icon.split(':');\n let iconsetName = 'default';\n let iconName = icon;\n if (iconParts.length > 1) {\n iconsetName = iconParts[0];\n iconName = iconParts[1];\n }\n return { iconset: iconsetName, icon: iconName };\n }\n\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.updateIconPromise;\n return complete;\n }\n}\n"],
5
+ "mappings": "qNAYA,OAAS,QAAAA,MAA4B,gCACrC,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OAAS,aAAA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AK,MAAQ,GACb,KAAK,MAAQ,KAAK,MAAQ,EAC9B,EACJ,CAEQ,UAAUA,EAAiD,CAC/D,MAAMK,EAAYL,EAAK,MAAM,GAAG,EAChC,IAAIM,EAAc,UACdC,EAAWP,EACf,OAAIK,EAAU,OAAS,IACnBC,EAAcD,EAAU,CAAC,EACzBE,EAAWF,EAAU,CAAC,GAEnB,CAAE,QAASC,EAAa,KAAMC,CAAS,CAClD,CAEA,MAAyB,mBAAsC,CAC3D,MAAMC,EAAY,MAAM,MAAM,kBAAkB,EAChD,aAAM,KAAK,kBACJA,CACX,CACJ,CAlHWC,EAAA,CADNf,EAAS,GADD,KAEF,mBAGAe,EAAA,CADNf,EAAS,GAJD,KAKF,oBAGCe,EAAA,CADPd,EAAM,YAAY,GAPV,KAQD",
6
6
  "names": ["html", "property", "query", "ifDefined", "IconsetRegistry", "IconBase", "event", "icon", "name", "old", "value", "iconset", "iconParts", "iconsetName", "iconName", "complete", "__decorateClass"]
7
7
  }
@@ -39,6 +39,28 @@ export const imageIcon = () => {
39
39
  `;
40
40
  };
41
41
  imageIcon.storyName = "Image Icon";
42
+ export const imageIconSrcError = () => {
43
+ const invalidImgSrc = "invalid-image-src";
44
+ const error = () => {
45
+ console.error("Invalid sp-icon src provided");
46
+ };
47
+ return html`
48
+ ${sizes.map(
49
+ (size) => html`
50
+ <sp-icon
51
+ label="Back"
52
+ size=${size}
53
+ src=${invalidImgSrc}
54
+ @error=${error}
55
+ ></sp-icon>
56
+ `
57
+ )}
58
+ `;
59
+ };
60
+ imageIconSrcError.storyName = "Image Icon src invalid error";
61
+ imageIconSrcError.swc_vrt = {
62
+ skip: true
63
+ };
42
64
  export const svgIcon = () => {
43
65
  return html`
44
66
  ${sizes.map(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["icon.stories.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport { back } from './images';\nimport '@spectrum-web-components/icons/sp-icons-medium.js';\nimport '@spectrum-web-components/icons/sp-icons-large.js';\n\nconst sizes = ['s', 'm', 'l', 'xl', 'xxl'];\n\nexport default {\n component: 'sp-icon',\n title: 'Icon',\n};\n\nexport const Medium = (): TemplateResult => {\n return html`\n <sp-icons-medium></sp-icons-medium>\n ${sizes.map(\n (size) => html`\n <sp-icon size=${size} name=\"ui:Chevron200\"></sp-icon>\n `\n )}\n `;\n};\n\nexport const Large = (): TemplateResult => {\n return html`\n <sp-icons-large></sp-icons-large>\n ${sizes.map(\n (size) => html`\n <sp-icon size=${size} name=\"ui:Chevron400\"></sp-icon>\n `\n )}\n `;\n};\n\nexport const imageIcon = (): TemplateResult => {\n return html`\n ${sizes.map(\n (size) => html`\n <sp-icon label=\"Back\" size=${size} src=${back}></sp-icon>\n `\n )}\n `;\n};\n\nimageIcon.storyName = 'Image Icon';\n\nexport const svgIcon = (): TemplateResult => {\n return html`\n ${sizes.map(\n (size) => html`\n <sp-icon size=${size}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 22 22\"\n fill=\"currentColor\"\n height=\"18\"\n width=\"18\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M19.75,10.04h-15l5.97-5.97a.483.483,0,0,0,0-.7l-.35-.36a.513.513,0,0,0-.71,0L2.24,10.44a.513.513,0,0,0,0,.71l7.39,7.84a.513.513,0,0,0,.71,0l.35-.35a.513.513,0,0,0,0-.71L4.76,11.5H19.75a.25.25,0,0,0,.25-.25v-.96A.25.25,0,0,0,19.75,10.04Z\"\n ></path>\n </svg>\n </sp-icon>\n `\n )}\n `;\n};\n\nsvgIcon.storyName = 'SVG Icon';\n"],
5
- "mappings": ";AAWA,SAAS,YAA4B;AAErC,OAAO;AACP,SAAS,YAAY;AACrB,OAAO;AACP,OAAO;AAEP,MAAM,QAAQ,CAAC,KAAK,KAAK,KAAK,MAAM,KAAK;AAEzC,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AACX;AAEO,aAAM,SAAS,MAAsB;AACxC,SAAO;AAAA;AAAA,UAED,MAAM;AAAA,IACJ,CAAC,SAAS;AAAA,gCACU;AAAA;AAAA,EAExB;AAAA;AAER;AAEO,aAAM,QAAQ,MAAsB;AACvC,SAAO;AAAA;AAAA,UAED,MAAM;AAAA,IACJ,CAAC,SAAS;AAAA,gCACU;AAAA;AAAA,EAExB;AAAA;AAER;AAEO,aAAM,YAAY,MAAsB;AAC3C,SAAO;AAAA,UACD,MAAM;AAAA,IACJ,CAAC,SAAS;AAAA,6CACuB,YAAY;AAAA;AAAA,EAEjD;AAAA;AAER;AAEA,UAAU,YAAY;AAEf,aAAM,UAAU,MAAsB;AACzC,SAAO;AAAA,UACD,MAAM;AAAA,IACJ,CAAC,SAAS;AAAA,gCACU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAexB;AAAA;AAER;AAEA,QAAQ,YAAY;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport { back } from './images';\nimport '@spectrum-web-components/icons/sp-icons-medium.js';\nimport '@spectrum-web-components/icons/sp-icons-large.js';\n\nconst sizes = ['s', 'm', 'l', 'xl', 'xxl'];\n\nexport default {\n component: 'sp-icon',\n title: 'Icon',\n};\n\nexport const Medium = (): TemplateResult => {\n return html`\n <sp-icons-medium></sp-icons-medium>\n ${sizes.map(\n (size) => html`\n <sp-icon size=${size} name=\"ui:Chevron200\"></sp-icon>\n `\n )}\n `;\n};\n\nexport const Large = (): TemplateResult => {\n return html`\n <sp-icons-large></sp-icons-large>\n ${sizes.map(\n (size) => html`\n <sp-icon size=${size} name=\"ui:Chevron400\"></sp-icon>\n `\n )}\n `;\n};\n\nexport const imageIcon = (): TemplateResult => {\n return html`\n ${sizes.map(\n (size) => html`\n <sp-icon label=\"Back\" size=${size} src=${back}></sp-icon>\n `\n )}\n `;\n};\n\nimageIcon.storyName = 'Image Icon';\n\nexport const imageIconSrcError = (): TemplateResult => {\n const invalidImgSrc = 'invalid-image-src';\n const error = (): void => {\n console.error('Invalid sp-icon src provided');\n };\n\n return html`\n ${sizes.map(\n (size) => html`\n <sp-icon\n label=\"Back\"\n size=${size}\n src=${invalidImgSrc}\n @error=${error}\n ></sp-icon>\n `\n )}\n `;\n};\n\nimageIconSrcError.storyName = 'Image Icon src invalid error';\n\nimageIconSrcError.swc_vrt = {\n skip: true,\n};\n\nexport const svgIcon = (): TemplateResult => {\n return html`\n ${sizes.map(\n (size) => html`\n <sp-icon size=${size}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 22 22\"\n fill=\"currentColor\"\n height=\"18\"\n width=\"18\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M19.75,10.04h-15l5.97-5.97a.483.483,0,0,0,0-.7l-.35-.36a.513.513,0,0,0-.71,0L2.24,10.44a.513.513,0,0,0,0,.71l7.39,7.84a.513.513,0,0,0,.71,0l.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AAA;AAAA;AAAA;AAAA,EAexB;AAAA;AAER;AAEA,QAAQ,YAAY;",
6
6
  "names": []
7
7
  }
package/test/icon.test.js CHANGED
@@ -1,7 +1,15 @@
1
1
  "use strict";
2
+ import Sinon from "sinon";
3
+ import { isWebKit } from "@spectrum-web-components/shared";
2
4
  import "@spectrum-web-components/icon/sp-icon.js";
3
5
  import "@spectrum-web-components/icons/sp-icons-medium.js";
4
- import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
6
+ import {
7
+ elementUpdated,
8
+ expect,
9
+ fixture,
10
+ html,
11
+ waitUntil
12
+ } from "@open-wc/testing";
5
13
  import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
6
14
  describe("Icon", () => {
7
15
  before(async () => {
@@ -45,6 +53,23 @@ describe("Icon", () => {
45
53
  await elementUpdated(el);
46
54
  await expect(el).to.be.accessible();
47
55
  });
56
+ it("loads w/ invalid src, error dispatching", async () => {
57
+ const error = Sinon.spy();
58
+ const el = await fixture(
59
+ html`
60
+ <sp-icon
61
+ label="Image Icon"
62
+ src="invalid-image-src"
63
+ @error=${error}
64
+ ></sp-icon>
65
+ `
66
+ );
67
+ await elementUpdated(el);
68
+ await expect(el).to.be.accessible();
69
+ if (!isWebKit()) {
70
+ await waitUntil(() => error.calledOnce, "The error was thrown.");
71
+ }
72
+ });
48
73
  it("loads w/ label", async () => {
49
74
  const label = "Chevron";
50
75
  const el = await fixture(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["icon.test.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport { Icon } from '@spectrum-web-components/icon';\nimport '@spectrum-web-components/icons/sp-icons-medium.js';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Icon', () => {\n before(async () => {\n const icons = document.createElement('sp-icons-medium');\n document.body.append(icons);\n\n await elementUpdated(icons);\n });\n\n it('loads', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon name=\"ui:Chevron200\"></sp-icon>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n const container = el.shadowRoot\n ? (el.shadowRoot.querySelector('#container') as HTMLDivElement)\n : (el.querySelector('#container') as HTMLDivElement);\n expect(container).to.exist;\n const icon = container.querySelector('svg') as SVGElement;\n expect(icon).to.exist;\n expect(icon.getAttribute('aria-hidden')).to.equal('true');\n });\n\n testForLitDevWarnings(\n async () =>\n await fixture<Icon>(\n html`\n <sp-icon\n label=\"Image Icon\"\n src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAMSWlDQ1BJQ0MgUHJvZmlsZQAASImVVwdUU8kanltSSWiBCEgJvYlSpEsJoUUQkCrYCEkgocSYEETsyrIKrl1EQF3RVREXXQsga0Vd66JgX8uLsqisrIsFGypvUkDXPe+98/5z5s6Xf/75/pK5c2cA0KvlSaX5qD4ABZJCWWJUGGtSegaL1AUwoAsogAUQHl8uZSckxAIoQ/3f5fUNgKj6q24qrn+O/1cxEAjlfACQBIizBHJ+AcQHAcBL+VJZIQBEP6i3nVUoVeEpEBvJYIAQS1U4R4NLVThLg6vUNsmJHIj3AECm8XiyHAB0W6CeVcTPgTy6tyB2lwjEEgD0yBAH80U8AcTREI8qKJihwtAOOGV9wZPzN86sYU4eL2cYa3JRCzlcLJfm82b/n+X431KQrxjy4QAbTSSLTlTlDOt2K29GjArTIO6VZMXFQ2wI8VuxQG0PMUo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G1ldGE+CvQIiZ0AAAAcaURPVAAAAAIAAAAAAAAAAwAAACgAAAADAAAAAwAAAEhuvWMmAAAAFElEQVQYGWK8devyfwYsgJFkCQAAAAD//6KX71AAAAARSURBVGO8devyfwYsgJFkCQAGyBUrQ95HqQAAAABJRU5ErkJggg==\"\n ></sp-icon>\n `\n )\n );\n\n it('loads w/ src', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon\n label=\"Image Icon\"\n src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAMSWlDQ1BJQ0MgUHJvZmlsZQAASImVVwdUU8kanltSSWiBCEgJvYlSpEsJoUUQkCrYCEkgocSYEETsyrIKrl1EQF3RVREXXQsga0Vd66JgX8uLsqisrIsFGypvUkDXPe+98/5z5s6Xf/75/pK5c2cA0KvlSaX5qD4ABZJCWWJUGGtSegaL1AUwoAsogAUQHl8uZSckxAIoQ/3f5fUNgKj6q24qrn+O/1cxEAjlfACQBIizBHJ+AcQHAcBL+VJZIQBEP6i3nVUoVeEpEBvJYIAQS1U4R4NLVThLg6vUNsmJHIj3AECm8XiyHAB0W6CeVcTPgTy6tyB2lwjEEgD0yBAH80U8AcTREI8qKJihwtAOOGV9wZPzN86sYU4eL2cYa3JRCzlcLJfm82b/n+X431KQrxjy4QAbTSSLTlTlDOt2K29GjArTIO6VZMXFQ2wI8VuxQG0PMUoVKaJTNPaoOV/OgTUDTIjdBbzwGIjNIY6U5MfFavVZ2eJILsRwhaDF4kJusnbuUqE8IknLWSubkRg/hLNlHLZ2biNPpvarsj+tyEtha/lviYTcIf5XJaLkNE3MGLVInBoHsS7ETHleUozGBrMrEXHihmxkikRV/HYQBwglUWEafmxatiwyUWsvK5AP5YstFYm5cVpcXShKjtby7OHz1PGbQNwilLBThniE8kmxQ7kIhOERmtyxK0JJijZfTCktDEvUzn0hzU/Q2uNUYX6USm8Dsbm8KEk7Fw8uhAtSw4/HSQsTkjVx4lm5vPEJmnjwYhALOC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qo/PH1k8xn+4OFgwOSnkynvoogMGGZmcD8GInAPR0ABhX4PlhsuaepxZEczdVI/CfsOYuqBYfABphpzquc04AsA82h4WQGzbVUT05FKBeXsNNK/JsL08NFw3eeAhvBwdfWgBAagXgo2xwcGDT4ODH7TDY2wCcmKm5X6qECO8G33uoUKfVAfC1/BsPWH9b6RH9MQAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAZlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+NjwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj42PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CvQIiZ0AAAAcaURPVAAAAAIAAAAAAAAAAwAAACgAAAADAAAAAwAAAEhuvWMmAAAAFElEQVQYGWK8devyfwYsgJFkCQAAAAD//6KX71AAAAARSURBVGO8devyfwYsgJFkCQAGyBUrQ95HqQAAAABJRU5ErkJggg==\"\n ></sp-icon>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('loads w/ label', async () => {\n const label = 'Chevron';\n const el = await fixture<Icon>(\n html`\n <sp-icon name=\"ui:Chevron200\" label=${label}></sp-icon>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n const container = el.shadowRoot\n ? (el.shadowRoot.querySelector('#container') as HTMLDivElement)\n : (el.querySelector('#container') as HTMLDivElement);\n expect(container).to.exist;\n const icon = container.querySelector('svg') as SVGElement;\n expect(icon).to.exist;\n expect(icon.hasAttribute('aria-hidden')).to.be.false;\n expect(icon.getAttribute('aria-label')).to.equal(label);\n });\n\n it('does not error when name is missing', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon></sp-icon>\n `\n );\n\n return elementUpdated(el);\n });\n\n it('does not error with unknown set', async () => {\n const el = await fixture<Icon>(html`\n <sp-icon name=\"unknown-icon\"></sp-icon>\n `);\n\n return elementUpdated(el);\n });\n\n it('does error with unknown icon', async () => {\n const el = document.createElement('sp-icon');\n el.name = 'ui:unknown-icon';\n try {\n document.body.appendChild(el);\n await elementUpdated(el);\n expect('failed').to.not.equal('failed');\n } catch (error) {\n expect(() => {\n throw error;\n }).to.throw();\n }\n el.remove();\n });\n\n it('does not add multiple SVGs when removed and re-added to DOM', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon name=\"ui:Chevron200\"></sp-icon>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n const parent = el.parentNode as HTMLElement;\n parent.removeChild(el);\n parent.appendChild(el);\n\n // wait for updates\n await el.updateComplete;\n\n const count = el.shadowRoot.querySelectorAll('svg').length;\n expect(count).to.equal(1);\n });\n});\n"],
5
- "mappings": ";AAYA,OAAO;AAEP,OAAO;AACP,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AACtD,SAAS,6BAA6B;AAEtC,SAAS,QAAQ,MAAM;AACnB,SAAO,YAAY;AACf,UAAM,QAAQ,SAAS,cAAc,iBAAiB;AACtD,aAAS,KAAK,OAAO,KAAK;AAE1B,UAAM,eAAe,KAAK;AAAA,EAC9B,CAAC;AAED,KAAG,SAAS,YAAY;AACpB,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;A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AG,mCAAmC,YAAY;AAC9C,UAAM,KAAK,MAAM,QAAc;AAAA;AAAA,SAE9B;AAED,WAAO,eAAe,EAAE;AAAA,EAC5B,CAAC;AAED,KAAG,gCAAgC,YAAY;AAC3C,UAAM,KAAK,SAAS,cAAc,SAAS;AAC3C,OAAG,OAAO;AACV,QAAI;AACA,eAAS,KAAK,YAAY,EAAE;AAC5B,YAAM,eAAe,EAAE;AACvB,aAAO,QAAQ,EAAE,GAAG,IAAI,MAAM,QAAQ;AAAA,IAC1C,SAAS,OAAP;AACE,aAAO,MAAM;AACT,cAAM;AAAA,MACV,CAAC,EAAE,GAAG,MAAM;AAAA,IAChB;AACA,OAAG,OAAO;AAAA,EACd,CAAC;AAED,KAAG,+DAA+D,YAAY;AAC1E,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AACvB,WAAO,EAAE,EAAE,GAAG,IAAI,GAAG;AAErB,UAAM,SAAS,GAAG;AAClB,WAAO,YAAY,EAAE;AACrB,WAAO,YAAY,EAAE;AAGrB,UAAM,GAAG;AAET,UAAM,QAAQ,GAAG,WAAW,iBAAiB,KAAK,EAAE;AACpD,WAAO,KAAK,EAAE,GAAG,MAAM,CAAC;AAAA,EAC5B,CAAC;AACL,CAAC;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport Sinon from 'sinon';\nimport { isWebKit } from '@spectrum-web-components/shared';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport { Icon } from '@spectrum-web-components/icon';\nimport '@spectrum-web-components/icons/sp-icons-medium.js';\nimport {\n elementUpdated,\n expect,\n fixture,\n html,\n waitUntil,\n} from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Icon', () => {\n before(async () => {\n const icons = document.createElement('sp-icons-medium');\n document.body.append(icons);\n\n await elementUpdated(icons);\n });\n\n it('loads', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon name=\"ui:Chevron200\"></sp-icon>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n const container = el.shadowRoot\n ? (el.shadowRoot.querySelector('#container') as HTMLDivElement)\n : (el.querySelector('#container') as HTMLDivElement);\n expect(container).to.exist;\n const icon = container.querySelector('svg') as SVGElement;\n expect(icon).to.exist;\n expect(icon.getAttribute('aria-hidden')).to.equal('true');\n });\n\n testForLitDevWarnings(\n async () =>\n await fixture<Icon>(\n html`\n <sp-icon\n label=\"Image Icon\"\n src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAMSWlDQ1BJQ0MgUHJvZmlsZQAASImVVwdUU8kanltSSWiBCEgJvYlSpEsJoUUQkCrYCEkgocSYEETsyrIKrl1EQF3RVREXXQsga0Vd66JgX8uLsqisrIsFGypvUkDXPe+98/5z5s6Xf/75/pK5c2cA0KvlSaX5qD4ABZJCWWJUGGtSegaL1AUwoAsogAUQHl8uZSckxAIoQ/3f5fUNgKj6q24qrn+O/1cxEAjlfACQBIizBHJ+AcQHAcBL+VJZIQBEP6i3nVUoVeEpEBvJYIAQS1U4R4NLVThLg6vUNsmJHIj3AECm8XiyHAB0W6CeVcTPgTy6tyB2lwjEEgD0yBAH80U8AcTREI8qKJihwtAOOGV9wZPzN86sYU4eL2cYa3JRCzlcLJfm82b/n+X431KQrxjy4QAbTSSLTlTlDOt2K29GjArTIO6VZMXFQ2wI8VuxQG0PMUoVKaJTNPaoOV/OgTUDTIjdBbzwGIjNIY6U5MfFavVZ2eJILsRwhaDF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AAwAAAEhuvWMmAAAAFElEQVQYGWK8devyfwYsgJFkCQAAAAD//6KX71AAAAARSURBVGO8devyfwYsgJFkCQAGyBUrQ95HqQAAAABJRU5ErkJggg==\"\n ></sp-icon>\n `\n )\n );\n\n it('loads w/ src', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon\n label=\"Image Icon\"\n src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAMSWlDQ1BJQ0MgUHJvZmlsZQAASImVVwdUU8kanltSSWiBCEgJvYlSpEsJoUUQkCrYCEkgocSYEETsyrIKrl1EQF3RVREXXQsga0Vd66JgX8uLsqisrIsFGypvUkDXPe+98/5z5s6Xf/75/pK5c2cA0KvlSaX5qD4ABZJCWWJUGGtSegaL1AUwoAsogAUQHl8uZSckxAIoQ/3f5fUNgKj6q24qrn+O/1cxEAjlfACQBIizBHJ+AcQHAcBL+VJZIQBEP6i3nVUoVeEpEBvJYIAQS1U4R4NLVThLg6vUNsmJHIj3AECm8XiyHAB0W6CeVcTPgTy6tyB2lwjEEgD0yBAH80U8AcTREI8qKJihwtAOOGV9wZPzN86sYU4eL2cYa3JRCzlcLJfm82b/n+X431KQrxjy4QAbTSSLTlTlDOt2K29GjArTIO6VZMXFQ2wI8VuxQG0PMUoVKaJTNPaoOV/OgTUDTIjdBbzwGIjNIY6U5MfFavVZ2eJILsRwhaDF4kJusnbuUqE8IknLWSubkRg/hLNlHLZ2biNPpvarsj+tyEtha/lviYTcIf5XJaLkNE3MGLVInBoHsS7ETHleUozGBrMrEXHihmxkikRV/HYQBwglUWEafmxatiwyUWsvK5AP5YstFYm5cVpcXShKjtby7OHz1PGbQNwilLBThniE8kmxQ7kIhOERmtyxK0JJijZfTCktDEvUzn0hzU/Q2uNUYX6USm8Dsbm8KEk7Fw8uhAtSw4/HSQsTkjVx4lm5vPEJmnjwYhALOCAcvnEK2LLADJALxO29zb3wl2YkEvCADOQAIXDTaoZmpKlHJPCZBErAnxA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EczdVI/CfsOYuqBYfABphpzquc04AsA82h4WQGzbVUT05FKBeXsNNK/JsL08NFw3eeAhvBwdfWgBAagXgo2xwcGDT4ODH7TDY2wCcmKm5X6qECO8G33uoUKfVAfC1/BsPWH9b6RH9MQAAAAlwSFlzAAAWJQAAFiUBSVIk8AAAAZlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+NjwvZXhpZjpQaXhlbFhEaW1lbnNpb24+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj42PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CvQIiZ0AAAAcaURPVAAAAAIAAAAAAAAAAwAAACgAAAADAAAAAwAAAEhuvWMmAAAAFElEQVQYGWK8devyfwYsgJFkCQAAAAD//6KX71AAAAARSURBVGO8devyfwYsgJFkCQAGyBUrQ95HqQAAAABJRU5ErkJggg==\"\n ></sp-icon>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('loads w/ invalid src, error dispatching', async () => {\n const error = Sinon.spy();\n const el = await fixture<Icon>(\n html`\n <sp-icon\n label=\"Image Icon\"\n src=\"invalid-image-src\"\n @error=${error}\n ></sp-icon>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n\n // Skipping the test case expectation for webkit because of error event not dispatching bug for the same, https://github.com/microsoft/playwright/issues/22332\n if (!isWebKit()) {\n await waitUntil(() => error.calledOnce, 'The error was thrown.');\n }\n });\n\n it('loads w/ label', async () => {\n const label = 'Chevron';\n const el = await fixture<Icon>(\n html`\n <sp-icon name=\"ui:Chevron200\" label=${label}></sp-icon>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n const container = el.shadowRoot\n ? (el.shadowRoot.querySelector('#container') as HTMLDivElement)\n : (el.querySelector('#container') as HTMLDivElement);\n expect(container).to.exist;\n const icon = container.querySelector('svg') as SVGElement;\n expect(icon).to.exist;\n expect(icon.hasAttribute('aria-hidden')).to.be.false;\n expect(icon.getAttribute('aria-label')).to.equal(label);\n });\n\n it('does not error when name is missing', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon></sp-icon>\n `\n );\n\n return elementUpdated(el);\n });\n\n it('does not error with unknown set', async () => {\n const el = await fixture<Icon>(html`\n <sp-icon name=\"unknown-icon\"></sp-icon>\n `);\n\n return elementUpdated(el);\n });\n\n it('does error with unknown icon', async () => {\n const el = document.createElement('sp-icon');\n el.name = 'ui:unknown-icon';\n try {\n document.body.appendChild(el);\n await elementUpdated(el);\n expect('failed').to.not.equal('failed');\n } catch (error) {\n expect(() => {\n throw error;\n }).to.throw();\n }\n el.remove();\n });\n\n it('does not add multiple SVGs when removed and re-added to DOM', async () => {\n const el = await fixture<Icon>(\n html`\n <sp-icon name=\"ui:Chevron200\"></sp-icon>\n `\n );\n\n await elementUpdated(el);\n expect(el).to.not.be.undefined;\n\n const parent = el.parentNode as HTMLElement;\n parent.removeChild(el);\n parent.appendChild(el);\n\n // wait for updates\n await el.updateComplete;\n\n const count = el.shadowRoot.querySelectorAll('svg').length;\n expect(count).to.equal(1);\n });\n});\n"],
5
+ "mappings": ";AAYA,OAAO,WAAW;AAClB,SAAS,gBAAgB;AACzB,OAAO;AAEP,OAAO;AACP;AAAA,EACI;AAAA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AAErB,UAAM,SAAS,GAAG;AAClB,WAAO,YAAY,EAAE;AACrB,WAAO,YAAY,EAAE;AAGrB,UAAM,GAAG;AAET,UAAM,QAAQ,GAAG,WAAW,iBAAiB,KAAK,EAAE;AACpD,WAAO,KAAK,EAAE,GAAG,MAAM,CAAC;AAAA,EAC5B,CAAC;AACL,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,245 +0,0 @@
1
- {
2
- "schemaVersion": "1.0.0",
3
- "readme": "",
4
- "modules": [
5
- {
6
- "kind": "javascript-module",
7
- "path": "sp-icon.js",
8
- "declarations": [],
9
- "exports": []
10
- },
11
- {
12
- "kind": "javascript-module",
13
- "path": "src/Icon.js",
14
- "declarations": [
15
- {
16
- "kind": "class",
17
- "description": "",
18
- "name": "Icon",
19
- "members": [
20
- {
21
- "kind": "field",
22
- "name": "src",
23
- "type": {
24
- "text": "string | undefined"
25
- },
26
- "privacy": "public",
27
- "attribute": "src"
28
- },
29
- {
30
- "kind": "field",
31
- "name": "name",
32
- "type": {
33
- "text": "string | undefined"
34
- },
35
- "privacy": "public",
36
- "attribute": "name"
37
- },
38
- {
39
- "kind": "field",
40
- "name": "iconContainer",
41
- "type": {
42
- "text": "HTMLElement | undefined"
43
- },
44
- "privacy": "private"
45
- },
46
- {
47
- "kind": "field",
48
- "name": "updateIconPromise",
49
- "type": {
50
- "text": "Promise<void> | undefined"
51
- },
52
- "privacy": "private"
53
- },
54
- {
55
- "kind": "field",
56
- "name": "iconsetListener",
57
- "privacy": "private"
58
- },
59
- {
60
- "kind": "method",
61
- "name": "updateIcon",
62
- "privacy": "private",
63
- "return": {
64
- "type": {
65
- "text": "Promise<void>"
66
- }
67
- }
68
- },
69
- {
70
- "kind": "method",
71
- "name": "parseIcon",
72
- "privacy": "private",
73
- "return": {
74
- "type": {
75
- "text": "{ iconset: string; icon: string }"
76
- }
77
- },
78
- "parameters": [
79
- {
80
- "name": "icon",
81
- "type": {
82
- "text": "string"
83
- }
84
- }
85
- ]
86
- },
87
- {
88
- "kind": "method",
89
- "name": "getUpdateComplete",
90
- "privacy": "protected",
91
- "return": {
92
- "type": {
93
- "text": "Promise<boolean>"
94
- }
95
- }
96
- },
97
- {
98
- "kind": "field",
99
- "name": "label",
100
- "type": {
101
- "text": "string | undefined"
102
- },
103
- "privacy": "public",
104
- "attribute": "label",
105
- "inheritedFrom": {
106
- "name": "IconBase",
107
- "module": "src/IconBase.js"
108
- }
109
- },
110
- {
111
- "kind": "field",
112
- "name": "size",
113
- "type": {
114
- "text": "'s' | 'm' | 'l' | 'xl' | 'xxl' | undefined"
115
- },
116
- "privacy": "public",
117
- "attribute": "size",
118
- "reflects": true,
119
- "inheritedFrom": {
120
- "name": "IconBase",
121
- "module": "src/IconBase.js"
122
- }
123
- }
124
- ],
125
- "attributes": [
126
- {
127
- "name": "src",
128
- "type": {
129
- "text": "string | undefined"
130
- },
131
- "fieldName": "src"
132
- },
133
- {
134
- "name": "name",
135
- "type": {
136
- "text": "string | undefined"
137
- },
138
- "fieldName": "name"
139
- },
140
- {
141
- "name": "label",
142
- "type": {
143
- "text": "string | undefined"
144
- },
145
- "fieldName": "label",
146
- "inheritedFrom": {
147
- "name": "IconBase",
148
- "module": "src/IconBase.ts"
149
- }
150
- },
151
- {
152
- "name": "size",
153
- "type": {
154
- "text": "'s' | 'm' | 'l' | 'xl' | 'xxl' | undefined"
155
- },
156
- "fieldName": "size",
157
- "inheritedFrom": {
158
- "name": "IconBase",
159
- "module": "src/IconBase.ts"
160
- }
161
- }
162
- ],
163
- "superclass": {
164
- "name": "IconBase",
165
- "module": "/src/IconBase.js"
166
- },
167
- "tagName": "sp-icon",
168
- "customElement": true
169
- }
170
- ],
171
- "exports": [
172
- {
173
- "kind": "js",
174
- "name": "Icon",
175
- "declaration": {
176
- "name": "Icon",
177
- "module": "src/Icon.js"
178
- }
179
- }
180
- ]
181
- },
182
- {
183
- "kind": "javascript-module",
184
- "path": "src/IconBase.js",
185
- "declarations": [
186
- {
187
- "kind": "class",
188
- "description": "",
189
- "name": "IconBase",
190
- "members": [
191
- {
192
- "kind": "field",
193
- "name": "label",
194
- "type": {
195
- "text": "string | undefined"
196
- },
197
- "privacy": "public",
198
- "attribute": "label"
199
- },
200
- {
201
- "kind": "field",
202
- "name": "size",
203
- "type": {
204
- "text": "'s' | 'm' | 'l' | 'xl' | 'xxl' | undefined"
205
- },
206
- "privacy": "public",
207
- "attribute": "size",
208
- "reflects": true
209
- }
210
- ],
211
- "attributes": [
212
- {
213
- "name": "label",
214
- "type": {
215
- "text": "string | undefined"
216
- },
217
- "fieldName": "label"
218
- },
219
- {
220
- "name": "size",
221
- "type": {
222
- "text": "'s' | 'm' | 'l' | 'xl' | 'xxl' | undefined"
223
- },
224
- "fieldName": "size"
225
- }
226
- ],
227
- "superclass": {
228
- "name": "SpectrumElement",
229
- "package": "@spectrum-web-components/base"
230
- }
231
- }
232
- ],
233
- "exports": [
234
- {
235
- "kind": "js",
236
- "name": "IconBase",
237
- "declaration": {
238
- "name": "IconBase",
239
- "module": "src/IconBase.js"
240
- }
241
- }
242
- ]
243
- }
244
- ]
245
- }