From b681fa5bae87b57b04a984806e7c854082765f41 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 8 Aug 2022 18:13:22 +0200 Subject: [PATCH] Rename the global helper function for the icon metadata --- global.d.ts | 2 +- ts/WoltLabSuite/WebComponent/fa-icon.ts | 8 +++----- ts/WoltLabSuite/WebComponent/global.d.ts | 2 +- .../install/files/js/WoltLabSuite/WebComponent/fa-icon.js | 7 +++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/global.d.ts b/global.d.ts index b1774eb9c8..f2553a04ab 100644 --- a/global.d.ts +++ b/global.d.ts @@ -25,7 +25,7 @@ declare global { WCF_PATH: string; WSC_API_URL: string; - getFontAwesome6Styles: (name: string) => IconMetadata | undefined; + getFontAwesome6IconMetadata: (name: string) => IconMetadata | undefined; jQuery: JQueryStatic; WCF: any; diff --git a/ts/WoltLabSuite/WebComponent/fa-icon.ts b/ts/WoltLabSuite/WebComponent/fa-icon.ts index c61b8b7556..e13a598d49 100644 --- a/ts/WoltLabSuite/WebComponent/fa-icon.ts +++ b/ts/WoltLabSuite/WebComponent/fa-icon.ts @@ -20,10 +20,8 @@ slot.name = "svg"; root.append(slot); } else { - const [codepoint] = window.getFontAwesome6Styles(this.name)!; + const [codepoint] = window.getFontAwesome6IconMetadata(this.name)!; root.append(codepoint); - - // TODO: Add style } } @@ -43,7 +41,7 @@ throw new TypeError("Must provide the name of the icon."); } - const styles = window.getFontAwesome6Styles(this.name); + const styles = window.getFontAwesome6IconMetadata(this.name); if (styles === undefined) { throw new TypeError(`The icon '${this.name}' is unknown or unsupported.`); } @@ -75,7 +73,7 @@ throw new Error("Cannot change the icon of a brand icon."); } - const metadata = window.getFontAwesome6Styles(name); + const metadata = window.getFontAwesome6IconMetadata(name); if (metadata === undefined) { throw new TypeError(`The icon '${name}' is unknown or unsupported.`); } diff --git a/ts/WoltLabSuite/WebComponent/global.d.ts b/ts/WoltLabSuite/WebComponent/global.d.ts index eabd215e0c..7a8b6ac727 100644 --- a/ts/WoltLabSuite/WebComponent/global.d.ts +++ b/ts/WoltLabSuite/WebComponent/global.d.ts @@ -9,6 +9,6 @@ type IconMetadata = [Codepoint, IconStyles]; declare global { interface Window { - getFontAwesome6Styles: (name: string) => IconMetadata | undefined; + getFontAwesome6IconMetadata: (name: string) => IconMetadata | undefined; } } diff --git a/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js b/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js index f1d8639649..95b78b4c7e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js +++ b/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js @@ -19,9 +19,8 @@ root.append(slot); } else { - const [codepoint] = window.getFontAwesome6Styles(this.name); + const [codepoint] = window.getFontAwesome6IconMetadata(this.name); root.append(codepoint); - // TODO: Add style } } validate() { @@ -40,7 +39,7 @@ if (this.name === "") { throw new TypeError("Must provide the name of the icon."); } - const styles = window.getFontAwesome6Styles(this.name); + const styles = window.getFontAwesome6IconMetadata(this.name); if (styles === undefined) { throw new TypeError(`The icon '${this.name}' is unknown or unsupported.`); } @@ -67,7 +66,7 @@ if (this.brand) { throw new Error("Cannot change the icon of a brand icon."); } - const metadata = window.getFontAwesome6Styles(name); + const metadata = window.getFontAwesome6IconMetadata(name); if (metadata === undefined) { throw new TypeError(`The icon '${name}' is unknown or unsupported.`); } -- 2.20.1