@umbraco-ui/uui-icon
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,1 +0,2 @@ | ||
export {}; | ||
export * from './uui-icon.element'; | ||
export * from './UUIIconRequestEvent'; |
import { css, LitElement, html } from 'lit'; | ||
import { defineElement } from '@umbraco-ui/uui-base/lib/registration'; | ||
import { state, property } from 'lit/decorators.js'; | ||
import { UUIEvent } from '@umbraco-ui/uui-base/lib/events'; | ||
import { unsafeHTML } from 'lit/directives/unsafe-html.js'; | ||
import { defineElement } from '@umbraco-ui/uui-base/lib/registration'; | ||
@@ -46,6 +46,7 @@ var __defProp$1 = Object.defineProperty; | ||
}; | ||
class UUIIconElement extends LitElement { | ||
let UUIIconElement = class extends LitElement { | ||
constructor() { | ||
super(...arguments); | ||
this._name = null; | ||
this._retrievedNameIcon = false; | ||
this._nameSvg = null; | ||
@@ -61,3 +62,5 @@ this.svg = null; | ||
this._name = newValue; | ||
this.requestIcon(); | ||
if (this.shadowRoot) { | ||
this.requestIcon(); | ||
} | ||
} | ||
@@ -71,2 +74,3 @@ requestIcon() { | ||
if (event.icon !== null) { | ||
this._retrievedNameIcon = true; | ||
event.icon.then((iconSvg) => { | ||
@@ -77,2 +81,3 @@ this._useFallback = false; | ||
} else { | ||
this._retrievedNameIcon = false; | ||
this._useFallback = true; | ||
@@ -84,11 +89,14 @@ } | ||
super.connectedCallback(); | ||
if (this._name !== "" && this._name !== null) { | ||
if (this._nameSvg === null) { | ||
this.requestIcon(); | ||
} | ||
if (this._retrievedNameIcon === false) { | ||
this.requestIcon(); | ||
} | ||
} | ||
disconnectedCallback() { | ||
this._nameSvg = null; | ||
this._retrievedNameIcon = false; | ||
} | ||
firstUpdated() { | ||
if (this._retrievedNameIcon === false) { | ||
this.requestIcon(); | ||
} | ||
} | ||
render() { | ||
@@ -110,3 +118,3 @@ if (this._useFallback === true) { | ||
} | ||
} | ||
}; | ||
UUIIconElement.styles = [ | ||
@@ -142,3 +150,6 @@ css` | ||
], UUIIconElement.prototype, "_useFallback", 2); | ||
UUIIconElement = __decorateClass([ | ||
defineElement("uui-icon") | ||
], UUIIconElement); | ||
defineElement("uui-icon", UUIIconElement); | ||
export { UUIIconElement, UUIIconRequestEvent }; |
@@ -12,2 +12,3 @@ import { LitElement } from 'lit'; | ||
private _name; | ||
private _retrievedNameIcon; | ||
private _nameSvg; | ||
@@ -41,3 +42,9 @@ /** | ||
disconnectedCallback(): void; | ||
firstUpdated(): void; | ||
render(): import("lit-html/directive").DirectiveResult<typeof import("lit-html/directives/unsafe-html").UnsafeHTMLDirective>; | ||
} | ||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'uui-icon': UUIIconElement; | ||
} | ||
} |
{ | ||
"name": "@umbraco-ui/uui-icon", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "MIT", | ||
@@ -22,7 +22,8 @@ "keywords": [ | ||
}, | ||
"main": "./dist/uui-icon.min.js", | ||
"main": "./lib/index.js", | ||
"module": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"type": "module", | ||
"customElements": "custom-elements.json", | ||
"files": [ | ||
"dist", | ||
"lib/**/*.d.ts", | ||
@@ -33,3 +34,3 @@ "lib/**/*.js", | ||
"dependencies": { | ||
"@umbraco-ui/uui-base": "0.0.15" | ||
"@umbraco-ui/uui-base": "0.0.16" | ||
}, | ||
@@ -45,3 +46,3 @@ "scripts": { | ||
"homepage": "https://uui.umbraco.com/?path=/story/uui-icon", | ||
"gitHead": "2a640ce4460de94e9c92a97310e27b84bbd6edda" | ||
"gitHead": "6fbddfc1295e2ea00a532d4f9eb798165b2d39ac" | ||
} |
@@ -18,3 +18,3 @@ # uui-icon | ||
```javascript | ||
import '@umbraco-ui/uui-icon/lib'; | ||
import '@umbraco-ui/uui-icon'; | ||
``` | ||
@@ -25,17 +25,5 @@ | ||
```javascript | ||
import { UUIIconElement } from '@umbraco-ui/uui-icon/lib/uui-icon.element'; | ||
import { UUIIconElement } from '@umbraco-ui/uui-icon'; | ||
``` | ||
### CDN | ||
The component is available via CDN. This means it can be added to your application without the need of any bundler configuration. Here is how to use it with jsDelivr. | ||
```html | ||
<!-- Latest Version --> | ||
<script src="https://cdn.jsdelivr.net/npm/@umbraco-ui/uui-icon@latest/dist/uui-icon.min.js"></script> | ||
<!-- Specific version --> | ||
<script src="https://cdn.jsdelivr.net/npm/@umbraco-ui/uui-icon@X.X.X/dist/uui-icon.min.js"></script> | ||
``` | ||
## Usage | ||
@@ -42,0 +30,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
0
Yes
11250
8
271
32
+ Added@umbraco-ui/uui-base@0.0.16(transitive)
- Removed@umbraco-ui/uui-base@0.0.15(transitive)
Updated@umbraco-ui/uui-base@0.0.16