Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spectrum-web-components/icon

Package Overview
Dependencies
Maintainers
5
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spectrum-web-components/icon - npm Package Compare versions

Comparing version 0.4.7 to 0.4.8

src/spectrum-vars.json

4

CHANGELOG.md

@@ -6,2 +6,6 @@ # Change Log

## [0.4.8](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/icon@0.4.7...@spectrum-web-components/icon@0.4.8) (2020-06-08)
**Note:** Version bump only for package @spectrum-web-components/icon
## [0.4.7](https://github.com/adobe/spectrum-web-components/compare/@spectrum-web-components/icon@0.4.6...@spectrum-web-components/icon@0.4.7) (2020-05-08)

@@ -8,0 +12,0 @@

52

custom-elements.json

@@ -1,51 +0,1 @@

{
"version": "experimental",
"tags": [
{
"name": "sp-icon",
"path": "./src/index.ts",
"attributes": [
{
"name": "src",
"type": "string | undefined"
},
{
"name": "name",
"type": "string | undefined"
},
{
"name": "size",
"type": "string",
"default": "\"m\""
},
{
"name": "label",
"type": "string | undefined"
}
],
"properties": [
{
"name": "src",
"attribute": "src",
"type": "string | undefined"
},
{
"name": "name",
"attribute": "name",
"type": "string | undefined"
},
{
"name": "size",
"attribute": "size",
"type": "string",
"default": "\"m\""
},
{
"name": "label",
"attribute": "label",
"type": "string | undefined"
}
]
}
]
}
{"version":"experimental","tags":[{"name":"sp-icon","path":"./src/index.ts","attributes":[{"name":"src","type":"string | undefined"},{"name":"name","type":"string | undefined"},{"name":"size","type":"string","default":"\"m\""},{"name":"label","type":"string | undefined"}],"properties":[{"name":"src","attribute":"src","type":"string | undefined"},{"name":"name","attribute":"name","type":"string | undefined"},{"name":"size","attribute":"size","type":"string","default":"\"m\""},{"name":"label","attribute":"label","type":"string | undefined"}],"cssProperties":[{"name":"--spectrum-alias-workflow-icon-size","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-alert-medium-width","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-alert-medium-height","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-alert-small-width","default":"var(--spectrum-global-dimension-size-175)","type":""},{"name":"--spectrum-icon-alert-small-height","default":"var(--spectrum-global-dimension-size-175)","type":""},{"name":"--spectrum-icon-arrow-down-small-width","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-arrow-down-small-height","default":"undefined","type":""},{"name":"--spectrum-icon-arrow-left-medium-width","default":"var(--spectrum-global-dimension-size-175)","type":""},{"name":"--spectrum-icon-arrow-left-medium-height","default":"undefined","type":""},{"name":"--spectrum-fieldlabel-asterisk-size","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-checkmark-medium-width","default":"undefined","type":""},{"name":"--spectrum-icon-checkmark-medium-height","default":"undefined","type":""},{"name":"--spectrum-icon-checkmark-small-width","default":"undefined","type":""},{"name":"--spectrum-icon-checkmark-small-height","default":"undefined","type":""},{"name":"--spectrum-icon-chevron-down-medium-width","default":"undefined","type":""},{"name":"--spectrum-icon-chevron-down-medium-height","default":"var(--spectrum-global-dimension-size-75)","type":""},{"name":"--spectrum-icon-chevron-down-small-width","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-chevron-down-small-height","default":"var(--spectrum-global-dimension-size-75)","type":""},{"name":"--spectrum-icon-chevron-left-large-width","default":"undefined","type":""},{"name":"--spectrum-icon-chevron-left-large-height","default":"var(--spectrum-global-dimension-size-200)","type":""},{"name":"--spectrum-icon-chevron-left-medium-width","default":"var(--spectrum-global-dimension-size-75)","type":""},{"name":"--spectrum-icon-chevron-left-medium-height","default":"undefined","type":""},{"name":"--spectrum-icon-chevron-right-large-width","default":"undefined","type":""},{"name":"--spectrum-icon-chevron-right-large-height","default":"var(--spectrum-global-dimension-size-200)","type":""},{"name":"--spectrum-icon-chevron-right-medium-width","default":"var(--spectrum-global-dimension-size-75)","type":""},{"name":"--spectrum-icon-chevron-right-medium-height","default":"undefined","type":""},{"name":"--spectrum-icon-chevron-right-small-width","default":"var(--spectrum-global-dimension-size-75)","type":""},{"name":"--spectrum-icon-chevron-right-small-height","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-chevron-up-small-width","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-chevron-up-small-height","default":"var(--spectrum-global-dimension-size-75)","type":""},{"name":"--spectrum-icon-cornertriangle-width","default":"var(--spectrum-global-dimension-size-65)","type":""},{"name":"--spectrum-icon-cornertriangle-height","default":"var(--spectrum-global-dimension-size-65)","type":""},{"name":"--spectrum-icon-cross-large-width","default":"undefined","type":""},{"name":"--spectrum-icon-cross-large-height","default":"undefined","type":""},{"name":"--spectrum-icon-cross-medium-width","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-cross-medium-height","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-cross-small-width","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-cross-small-height","default":"var(--spectrum-global-dimension-size-100)","type":""},{"name":"--spectrum-icon-dash-small-width","default":"undefined","type":""},{"name":"--spectrum-icon-dash-small-height","default":"undefined","type":""},{"name":"--spectrum-icon-doublegripper-width","default":"var(--spectrum-global-dimension-size-200)","type":""},{"name":"--spectrum-icon-doublegripper-height","default":"var(--spectrum-global-dimension-size-50)","type":""},{"name":"--spectrum-icon-folderbreadcrumb-width","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-folderbreadcrumb-height","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-info-medium-width","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-info-medium-height","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-info-small-width","default":"var(--spectrum-global-dimension-size-175)","type":""},{"name":"--spectrum-icon-info-small-height","default":"var(--spectrum-global-dimension-size-175)","type":""},{"name":"--spectrum-icon-magnifier-width","default":"var(--spectrum-global-dimension-size-200)","type":""},{"name":"--spectrum-icon-magnifier-height","default":"var(--spectrum-global-dimension-size-200)","type":""},{"name":"--spectrum-icon-skip-left-width","default":"undefined","type":""},{"name":"--spectrum-icon-skip-left-height","default":"undefined","type":""},{"name":"--spectrum-icon-skip-right-width","default":"undefined","type":""},{"name":"--spectrum-icon-skip-right-height","default":"undefined","type":""},{"name":"--spectrum-icon-star-width","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-star-height","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-star-outline-width","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-star-outline-height","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-success-medium-width","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-success-medium-height","default":"var(--spectrum-global-dimension-size-225)","type":""},{"name":"--spectrum-icon-success-small-width","default":"var(--spectrum-global-dimension-size-175)","type":""},{"name":"--spectrum-icon-success-small-height","default":"var(--spectrum-global-dimension-size-175)","type":""},{"name":"--spectrum-icon-triplegripper-width","default":"undefined","type":""},{"name":"--spectrum-icon-triplegripper-height","default":"var(--spectrum-global-dimension-size-85)","type":""}]}]}

@@ -17,99 +17,103 @@ /*

import { ifDefined } from 'lit-html/directives/if-defined';
export class Icon extends LitElement {
constructor() {
super(...arguments);
this.size = 'm';
this.iconsetListener = (event) => {
if (!this.name) {
return;
}
// parse the icon name to get iconset name
const icon = this.parseIcon(this.name);
if (event.detail.name === icon.iconset) {
this.updateIconPromise = this.updateIcon();
}
};
}
static get styles() {
return [iconStyles];
}
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(name, old, value) {
super.attributeChangedCallback(name, old, value);
this.updateIconPromise = this.updateIcon(); // any of our attributes change, update our icon
}
render() {
if (this.name) {
return html `
let Icon = /** @class */ (() => {
class Icon extends LitElement {
constructor() {
super(...arguments);
this.size = 'm';
this.iconsetListener = (event) => {
if (!this.name) {
return;
}
// parse the icon name to get iconset name
const icon = this.parseIcon(this.name);
if (event.detail.name === icon.iconset) {
this.updateIconPromise = this.updateIcon();
}
};
}
static get styles() {
return [iconStyles];
}
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(name, old, value) {
super.attributeChangedCallback(name, old, value);
this.updateIconPromise = this.updateIcon(); // any of our attributes change, update our icon
}
render() {
if (this.name) {
return html `
<div id="container"></div>
`;
}
else if (this.src) {
return html `
}
else if (this.src) {
return html `
<img src="${this.src}" alt=${ifDefined(this.label)} />
`;
}
return html `
}
return html `
<slot></slot>
`;
}
async updateIcon() {
if (!this.name) {
return Promise.resolve();
}
// parse the icon name to get iconset name
const icon = this.parseIcon(this.name);
// try to retrieve the iconset
const iconset = IconsetRegistry.getInstance().getIconset(icon.iconset);
if (!iconset) {
// we can stop here as there's nothing to be done till we get the iconset
return Promise.resolve();
async updateIcon() {
if (!this.name) {
return Promise.resolve();
}
// parse the icon name to get iconset name
const icon = this.parseIcon(this.name);
// try to retrieve the iconset
const iconset = IconsetRegistry.getInstance().getIconset(icon.iconset);
if (!iconset) {
// we can stop here as there's nothing to be done till we get the iconset
return Promise.resolve();
}
if (!this.iconContainer) {
return Promise.resolve();
}
this.iconContainer.innerHTML = '';
return iconset.applyIconToElement(this.iconContainer, icon.icon, this.size, this.label ? this.label : '');
}
if (!this.iconContainer) {
return Promise.resolve();
parseIcon(icon) {
const iconParts = icon.split(':');
let iconsetName = 'default';
let iconName = icon;
if (iconParts.length > 1) {
iconsetName = iconParts[0];
iconName = iconParts[1];
}
return { iconset: iconsetName, icon: iconName };
}
this.iconContainer.innerHTML = '';
return iconset.applyIconToElement(this.iconContainer, icon.icon, this.size, this.label ? this.label : '');
}
parseIcon(icon) {
const iconParts = icon.split(':');
let iconsetName = 'default';
let iconName = icon;
if (iconParts.length > 1) {
iconsetName = iconParts[0];
iconName = iconParts[1];
async _getUpdateComplete() {
await super._getUpdateComplete();
await this.updateIconPromise;
}
return { iconset: iconsetName, icon: iconName };
}
async _getUpdateComplete() {
await super._getUpdateComplete();
await this.updateIconPromise;
}
}
Icon.is = 'sp-icon';
__decorate([
property()
], Icon.prototype, "src", void 0);
__decorate([
property()
], Icon.prototype, "name", void 0);
__decorate([
property({ reflect: true })
], Icon.prototype, "size", void 0);
__decorate([
property()
], Icon.prototype, "label", void 0);
__decorate([
query('#container')
], Icon.prototype, "iconContainer", void 0);
Icon.is = 'sp-icon';
__decorate([
property()
], Icon.prototype, "src", void 0);
__decorate([
property()
], Icon.prototype, "name", void 0);
__decorate([
property({ reflect: true })
], Icon.prototype, "size", void 0);
__decorate([
property()
], Icon.prototype, "label", void 0);
__decorate([
query('#container')
], Icon.prototype, "iconContainer", void 0);
return Icon;
})();
export { Icon };
//# sourceMappingURL=icon.js.map

@@ -21,3 +21,3 @@ {

],
"version": "0.4.7",
"version": "0.4.8",
"description": "",

@@ -49,6 +49,6 @@ "main": "lib/index.js",

"dependencies": {
"@spectrum-web-components/iconset": "^0.1.10",
"tslib": "^1.10.0"
"@spectrum-web-components/iconset": "^0.1.11",
"tslib": "^2.0.0"
},
"gitHead": "4068602ee6a355db24878fad4762815eacc0a730"
"gitHead": "16b57d15356859cee73278cdf796274e3245320b"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc