From 41d71050283d288de16e2077e26615bcc718256c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 9 Aug 2022 16:29:00 +0200 Subject: [PATCH] Remove the `regular` flag of `` --- com.woltlab.wcf/templates/pageHeaderUser.tpl | 2 +- ts/WoltLabSuite/WebComponent/fa-icon.ts | 15 +-------------- .../files/js/WoltLabSuite/WebComponent/fa-icon.js | 12 ------------ .../plugin/IconFunctionTemplatePlugin.class.php | 13 ++++++++----- .../files/style/font-awesome/000-woltlab.scss | 7 ++----- 5 files changed, 12 insertions(+), 37 deletions(-) diff --git a/com.woltlab.wcf/templates/pageHeaderUser.tpl b/com.woltlab.wcf/templates/pageHeaderUser.tpl index 35bcf8285d..52698ca670 100644 --- a/com.woltlab.wcf/templates/pageHeaderUser.tpl +++ b/com.woltlab.wcf/templates/pageHeaderUser.tpl @@ -109,7 +109,7 @@ aria-expanded="false" > {icon size=32 name='info' type='solid'} - {icon size=32 name='bell' type='regular'} + {icon size=32 name='bell'} {icon size=32 name='500px' type='brand'} {lang}wcf.user.notification.notifications{/lang}{if $__wcf->getUserNotificationHandler()->getNotificationCount()} {#$__wcf->getUserNotificationHandler()->getNotificationCount()}{/if} diff --git a/ts/WoltLabSuite/WebComponent/fa-icon.ts b/ts/WoltLabSuite/WebComponent/fa-icon.ts index 69c541e37e..3bcfeda113 100644 --- a/ts/WoltLabSuite/WebComponent/fa-icon.ts +++ b/ts/WoltLabSuite/WebComponent/fa-icon.ts @@ -36,7 +36,7 @@ } } - setIcon(name: string, type: "regular" | "solid"): void { + setIcon(name: string, type: "" | "solid"): void { const metadata = window.getFontAwesome6IconMetadata(name); if (metadata === undefined) { throw new TypeError(`The icon '${name}' is unknown or unsupported.`); @@ -48,7 +48,6 @@ } this.solid = type === "solid"; - this.regular = type === "regular"; this.name = name; const root = this.shadowRoot!; @@ -69,18 +68,6 @@ } } - get regular(): boolean { - return this.hasAttribute("regular"); - } - - set regular(regular: boolean) { - if (regular) { - this.setAttribute("regular", ""); - } else { - this.removeAttribute("regular"); - } - } - get name(): string { return this.getAttribute("name") || ""; } diff --git a/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js b/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js index 82e11bc684..32414f26fd 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js +++ b/wcfsetup/install/files/js/WoltLabSuite/WebComponent/fa-icon.js @@ -43,7 +43,6 @@ throw new Error(`The icon '${name}' does not support the style '${type}'.`); } this.solid = type === "solid"; - this.regular = type === "regular"; this.name = name; const root = this.shadowRoot; (_a = root.childNodes[0]) === null || _a === void 0 ? void 0 : _a.remove(); @@ -60,17 +59,6 @@ this.removeAttribute("solid"); } } - get regular() { - return this.hasAttribute("regular"); - } - set regular(regular) { - if (regular) { - this.setAttribute("regular", ""); - } - else { - this.removeAttribute("regular"); - } - } get name() { return this.getAttribute("name") || ""; } diff --git a/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php index 2edc4803b9..a46911c979 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/IconFunctionTemplatePlugin.class.php @@ -21,7 +21,7 @@ final class IconFunctionTemplatePlugin implements IFunctionTemplatePlugin { private const SIZES = [16, 24, 32, 48, 64, 96, 128, 144]; - private const TYPES = ['brand', 'regular', 'solid']; + private const TYPES = ['brand', 'solid']; /** * @inheritDoc @@ -40,9 +40,7 @@ final class IconFunctionTemplatePlugin implements IFunctionTemplatePlugin throw new \InvalidArgumentException("The `name` attribute must be present and non-empty."); } - if ($type === '') { - throw new \InvalidArgumentException("The `type` attribute must be present and non-empty."); - } else if (!\in_array($type, self::TYPES)) { + if ($type !== '' && !\in_array($type, self::TYPES)) { throw new \InvalidArgumentException("An unsupported type `${type}` was specified."); } @@ -59,8 +57,13 @@ final class IconFunctionTemplatePlugin implements IFunctionTemplatePlugin HTML; } + $modifier = ''; + if ($type === 'solid') { + $modifier = ' solid'; + } + return << + HTML; } } diff --git a/wcfsetup/install/files/style/font-awesome/000-woltlab.scss b/wcfsetup/install/files/style/font-awesome/000-woltlab.scss index b611ff41af..437a067dbf 100644 --- a/wcfsetup/install/files/style/font-awesome/000-woltlab.scss +++ b/wcfsetup/install/files/style/font-awesome/000-woltlab.scss @@ -99,20 +99,17 @@ fa-icon { -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; - font-family: "Font Awesome 6 Free"; + font-family: var(--fa-font-family, "Font Awesome 6 Free"); font-size: var(--font-size); font-style: normal; font-variant: normal; + font-weight: var(--fa-font-weight, 400); line-height: 1; text-rendering: auto; &[solid] { font-weight: 900; } - - &[regular] { - font-weight: 400; - } } /* Default icon sizes */ -- 2.20.1