package.dist.vscode-icon.vscode-icon.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of elements Show documentation
Show all versions of elements Show documentation
Webcomponents for creating Visual Studio Code extensions
The newest version!
{"version":3,"file":"vscode-icon.js","sourceRoot":"","sources":["../../src/vscode-icon/vscode-icon.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAC,IAAI,EAAiB,MAAM,KAAK,CAAC;AACzC,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACrD,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAE7C;;;;;;;;;GASG;AAEI,IAAM,UAAU,kBAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAEL;;WAEG;QAEH,UAAK,GAAG,EAAE,CAAC;QAEX;;WAEG;QAEH,SAAI,GAAG,EAAE,CAAC;QAEV;;WAEG;QAEH,SAAI,GAAG,EAAE,CAAC;QAEV;;WAEG;QAEH,SAAI,GAAG,KAAK,CAAC;QAEb;;WAEG;QAEH,iBAAY,GAAG,GAAG,CAAC;QAEnB;;WAEG;QAEH,eAAU,GAAG,KAAK,CAAC;QAgCX,mBAAc,GAAG,CAAC,EAAc,EAAE,EAAE;YAC1C,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,WAAW,EAAE,EAAC,MAAM,EAAE,EAAC,aAAa,EAAE,EAAE,EAAC,EAAC,CAAC,CAC5D,CAAC;QACJ,CAAC,CAAC;IAwCJ,CAAC;IAtEC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,G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AS,CAAC,KAAK,CAAC;;QAEzB,OAAO;KACV,CAAC;IACJ,CAAC;;AA9GM,iBAAM,GAAG,MAAM,AAAT,CAAU;AAqCR,yBAAc,GAAuB,EAAE,AAAzB,CAA0B;AAExC,gBAAK,GAAuB,EAAE,AAAzB,CAA0B;AAlC9C;IADC,QAAQ,EAAE;yCACA;AAMX;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;wCACf;AAMV;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;wCACf;AAMV;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;wCAC5B;AAMb;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAC,CAAC;gDAClC;AAMnB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAC,CAAC;8CAChD;AApCR,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAgHtB","sourcesContent":["import {html, TemplateResult} from 'lit';\nimport {customElement, property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {styleMap} from 'lit/directives/style-map.js';\nimport {ifDefined} from 'lit/directives/if-defined.js';\nimport {VscElement} from '../includes/VscElement.js';\nimport styles from './vscode-icon.styles.js';\n\n/**\n * Display a [Codicon](https://microsoft.github.io/vscode-codicons/dist/codicon.html).\n * In \"action-icon\" mode it behaves like a button. In this case, it is\n * recommended that a meaningful label is specified with the `label` property.\n *\n * @cssprop --vscode-icon-foreground\n * @cssprop --vscode-toolbar-hoverBackground - Hover state background color in `active-icon` mode\n * @cssprop --vscode-toolbar-activeBackground - Active state background color in `active-icon` mode\n * @cssprop --vscode-focusBorder\n */\n@customElement('vscode-icon')\nexport class VscodeIcon extends VscElement {\n static styles = styles;\n /**\n * Set a meaningful label in `action-icon` mode for the screen readers\n */\n @property()\n label = '';\n\n /**\n * [Codicon](https://microsoft.github.io/vscode-codicons/dist/codicon.html) icon name.\n */\n @property({type: String})\n name = '';\n\n /**\n * Icon size in pixels\n */\n @property({type: Number})\n size = 16;\n\n /**\n * Enable rotation animation\n */\n @property({type: Boolean, reflect: true})\n spin = false;\n\n /**\n * Animation duration in seconds\n */\n @property({type: Number, attribute: 'spin-duration'})\n spinDuration = 1.5;\n\n /**\n * Behaves like a button\n */\n @property({type: Boolean, reflect: true, attribute: 'action-icon'})\n actionIcon = false;\n\n private static stylesheetHref: string | undefined = '';\n\n private static nonce: string | undefined = '';\n\n connectedCallback(): void {\n super.connectedCallback();\n\n const {href, nonce} = this._getStylesheetConfig();\n\n VscodeIcon.stylesheetHref = href;\n VscodeIcon.nonce = nonce;\n }\n\n /**\n * For using web fonts in web components, the font stylesheet must be included\n * twice: on the page and in the web component. This function looks for the\n * font stylesheet on the page and returns the stylesheet URL and the nonce\n * id.\n */\n private _getStylesheetConfig(): {\n href: string | undefined;\n nonce: string | undefined;\n } {\n const linkElement = document.getElementById('vscode-codicon-stylesheet');\n const href = linkElement?.getAttribute('href') || undefined;\n const nonce = linkElement?.getAttribute('nonce') || undefined;\n\n return {nonce, href};\n }\n\n private _onButtonClick = (ev: MouseEvent) => {\n this.dispatchEvent(\n new CustomEvent('vsc-click', {detail: {originalEvent: ev}})\n );\n };\n\n render(): TemplateResult {\n const {stylesheetHref, nonce} = VscodeIcon;\n\n const content = html``;\n\n const wrapped = this.actionIcon\n ? html` `\n : html` ${content}`;\n\n return html`\n \n ${wrapped}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vscode-icon': VscodeIcon;\n }\n}\n"]}