diff --git a/.changeset/forty-buttons-occur.md b/.changeset/forty-buttons-occur.md new file mode 100644 index 000000000..7561ffe12 --- /dev/null +++ b/.changeset/forty-buttons-occur.md @@ -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. diff --git a/packages/icon/src/LionIcon.js b/packages/icon/src/LionIcon.js index 71ab595d4..33d423921 100644 --- a/packages/icon/src/LionIcon.js +++ b/packages/icon/src/LionIcon.js @@ -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) {