feat(icon): allow custom iconManager
This commit is contained in:
parent
84775744d8
commit
3147126295
2 changed files with 11 additions and 1 deletions
5
.changeset/forty-buttons-occur.md
Normal file
5
.changeset/forty-buttons-occur.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@lion/icon': minor
|
||||
---
|
||||
|
||||
Allow setting a custom icon manager, which is important if you as a subclasser are managing your singletons.
|
||||
|
|
@ -161,6 +161,11 @@ export class LionIcon extends LitElement {
|
|||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
get _iconManager() {
|
||||
return icons;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} prevIconId
|
||||
*/
|
||||
|
|
@ -172,7 +177,7 @@ export class LionIcon extends LitElement {
|
|||
}
|
||||
} else {
|
||||
const iconIdBeforeResolve = this.iconId;
|
||||
const svg = await icons.resolveIconForId(iconIdBeforeResolve);
|
||||
const svg = await this._iconManager.resolveIconForId(iconIdBeforeResolve);
|
||||
|
||||
// update SVG if it did not change in the meantime to avoid race conditions
|
||||
if (this.iconId === iconIdBeforeResolve) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue