Skip to content

Commit 3b9e39e

Browse files
committed
fix: icon naming and ssr compat
1 parent c579e88 commit 3b9e39e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/component/Icon.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (typeof window !== "undefined") {
1818
"replace" in CSSStyleSheet.prototype;
1919
}
2020

21-
export class FraIcon extends HTMLElement {
21+
export class SvgIcon extends (globalThis.HTMLElement || {}) {
2222
static sheet?: CSSStyleSheet;
2323

2424
static elementProperties = new Map([["name", { type: String, reflect: true }]]);
@@ -44,12 +44,12 @@ export class FraIcon extends HTMLElement {
4444
}
4545

4646
static getStyleSheet(): CSSStyleSheet {
47-
if (!FraIcon.sheet) {
47+
if (!SvgIcon.sheet) {
4848
const sheet = new CSSStyleSheet();
49-
sheet.replaceSync(FraIcon.styles);
50-
FraIcon.sheet = sheet;
49+
sheet.replaceSync(SvgIcon.styles);
50+
SvgIcon.sheet = sheet;
5151
}
52-
return FraIcon.sheet;
52+
return SvgIcon.sheet;
5353
}
5454

5555
static get observedAttributes() {
@@ -84,21 +84,21 @@ export class FraIcon extends HTMLElement {
8484
const shadow = this.attachShadow({ mode: "open" });
8585

8686
if (supportsAdoptingStyleSheets) {
87-
shadow.adoptedStyleSheets = [FraIcon.getStyleSheet()];
87+
shadow.adoptedStyleSheets = [SvgIcon.getStyleSheet()];
8888
} else {
8989
const style = document.createElement("style");
90-
style.textContent = FraIcon.styles;
90+
style.textContent = SvgIcon.styles;
9191
shadow.appendChild(style);
9292
}
9393
}
9494
}
9595

9696
declare global {
9797
interface HTMLElementTagNameMap {
98-
"svg-icon": FraIcon;
98+
"svg-icon": SvgIcon;
9999
}
100100
}
101101

102102
if ("customElements" in globalThis && !customElements.get("svg-icon")) {
103-
customElements.define("svg-icon", FraIcon);
103+
customElements.define("svg-icon", SvgIcon);
104104
}

0 commit comments

Comments
 (0)