From 4a356f1ba742ae3965d01ad17179d3af4846377a Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:08:14 +0900 Subject: [PATCH] refactor(frontend): prefix css variables (#14725) * wip * Update index.d.ts * remove unnecessary codes --- CONTRIBUTING.md | 6 +- idea/MkDisableSection.vue | 2 +- locales/index.d.ts | 4 - locales/ja-JP.yml | 1 - packages/backend/src/server/web/boot.js | 2 +- packages/backend/src/server/web/style.css | 8 +- .../backend/src/server/web/style.embed.css | 10 +-- .../src/components/EmLoading.vue | 2 +- .../src/components/EmMediaBanner.vue | 8 +- .../src/components/EmMediaImage.vue | 18 ++-- .../src/components/EmMediaVideo.vue | 4 +- .../src/components/EmMention.vue | 4 +- .../frontend-embed/src/components/EmMfm.ts | 10 +-- .../frontend-embed/src/components/EmNote.vue | 24 ++--- .../src/components/EmNoteDetailed.vue | 22 ++--- .../src/components/EmNoteHeader.vue | 2 +- .../src/components/EmNoteSub.vue | 4 +- .../frontend-embed/src/components/EmNotes.vue | 4 +- .../frontend-embed/src/components/EmPoll.vue | 14 +-- .../components/EmReactionsViewer.reaction.vue | 10 +-- .../src/components/EmSubNoteContent.vue | 12 +-- .../frontend-embed/src/components/EmTime.vue | 4 +- .../src/components/EmTimelineContainer.vue | 4 +- packages/frontend-embed/src/pages/clip.vue | 4 +- packages/frontend-embed/src/pages/note.vue | 2 +- packages/frontend-embed/src/pages/tag.vue | 4 +- packages/frontend-embed/src/style.scss | 50 +++++------ packages/frontend-embed/src/theme.ts | 2 +- packages/frontend-embed/src/ui.vue | 4 +- packages/frontend-shared/themes/_dark.json5 | 3 +- packages/frontend-shared/themes/_light.json5 | 3 +- packages/frontend-shared/themes/d-astro.json5 | 3 +- packages/frontend-shared/themes/d-u0.json5 | 3 +- packages/frontend-shared/themes/l-u0.json5 | 3 +- packages/frontend-shared/themes/l-vivid.json5 | 3 +- packages/frontend/src/_dev_boot_.ts | 2 +- packages/frontend/src/boot/common.ts | 6 -- .../frontend/src/components/MkAbuseReport.vue | 10 +-- .../src/components/MkAccountMoved.vue | 4 +- .../frontend/src/components/MkAnalogClock.vue | 6 +- .../src/components/MkAnnouncementDialog.vue | 8 +- .../src/components/MkAntennaEditor.vue | 2 +- packages/frontend/src/components/MkAsUi.vue | 4 +- .../src/components/MkAutocomplete.vue | 6 +- packages/frontend/src/components/MkButton.vue | 22 ++--- .../src/components/MkChannelFollowButton.vue | 16 ++-- .../src/components/MkChannelPreview.vue | 12 +-- .../frontend/src/components/MkChartLegend.vue | 4 +- .../frontend/src/components/MkClipPreview.vue | 6 +- .../frontend/src/components/MkCode.core.vue | 2 +- packages/frontend/src/components/MkCode.vue | 6 +- .../frontend/src/components/MkCodeEditor.vue | 14 +-- .../frontend/src/components/MkCodeInline.vue | 2 +- .../frontend/src/components/MkColorInput.vue | 14 +-- .../frontend/src/components/MkContainer.vue | 12 +-- .../src/components/MkCropperDialog.vue | 2 +- .../MkCustomEmojiDetailedDialog.vue | 6 +- .../src/components/MkDateSeparatedList.vue | 4 +- packages/frontend/src/components/MkDialog.vue | 8 +- .../frontend/src/components/MkDivider.vue | 2 +- .../frontend/src/components/MkDonation.vue | 2 +- .../frontend/src/components/MkDrive.file.vue | 8 +- .../src/components/MkDrive.folder.vue | 12 +-- packages/frontend/src/components/MkDrive.vue | 4 +- .../src/components/MkDriveFileThumbnail.vue | 4 +- .../src/components/MkEmbedCodeGenDialog.vue | 8 +- .../src/components/MkEmojiPicker.section.vue | 4 +- .../frontend/src/components/MkEmojiPicker.vue | 24 ++--- .../src/components/MkExtensionInstaller.vue | 6 +- .../src/components/MkFileListForAdmin.vue | 2 +- .../src/components/MkFlashPreview.vue | 4 +- .../src/components/MkFoldableSection.vue | 4 +- packages/frontend/src/components/MkFolder.vue | 24 ++--- .../src/components/MkFollowButton.vue | 16 ++-- .../src/components/MkFormDialog.file.vue | 2 +- .../frontend/src/components/MkFormFooter.vue | 2 +- .../frontend/src/components/MkFukidashi.vue | 4 +- .../src/components/MkGalleryPostPreview.vue | 2 +- packages/frontend/src/components/MkGoogle.vue | 4 +- packages/frontend/src/components/MkInfo.vue | 8 +- packages/frontend/src/components/MkInput.vue | 14 +-- .../src/components/MkInstanceCardMini.vue | 6 +- .../src/components/MkInstanceStats.vue | 4 +- .../frontend/src/components/MkInviteCode.vue | 4 +- .../frontend/src/components/MkLaunchPad.vue | 6 +- .../frontend/src/components/MkMediaAudio.vue | 8 +- .../frontend/src/components/MkMediaImage.vue | 20 ++--- .../frontend/src/components/MkMediaList.vue | 8 +- .../frontend/src/components/MkMediaRange.vue | 4 +- .../frontend/src/components/MkMediaVideo.vue | 18 ++-- .../frontend/src/components/MkMention.vue | 8 +- packages/frontend/src/components/MkMenu.vue | 32 +++---- .../frontend/src/components/MkMiniChart.vue | 2 +- .../frontend/src/components/MkModalWindow.vue | 20 ++--- packages/frontend/src/components/MkNote.vue | 28 +++--- .../src/components/MkNoteDetailed.vue | 34 +++---- .../frontend/src/components/MkNoteHeader.vue | 2 +- .../frontend/src/components/MkNoteSub.vue | 4 +- packages/frontend/src/components/MkNotes.vue | 6 +- .../src/components/MkNotification.vue | 10 +-- .../src/components/MkNotifications.vue | 2 +- .../frontend/src/components/MkNumberDiff.vue | 4 +- .../src/components/MkObjectView.value.vue | 8 +- packages/frontend/src/components/MkOmit.vue | 6 +- .../frontend/src/components/MkPagePreview.vue | 6 +- .../frontend/src/components/MkPageWindow.vue | 2 +- packages/frontend/src/components/MkPoll.vue | 14 +-- .../frontend/src/components/MkPostForm.vue | 30 +++---- .../src/components/MkPostFormAttaches.vue | 2 +- packages/frontend/src/components/MkRadio.vue | 20 ++--- packages/frontend/src/components/MkRadios.vue | 2 +- packages/frontend/src/components/MkRange.vue | 14 +-- .../src/components/MkReactionEffect.vue | 2 +- .../components/MkReactionsViewer.details.vue | 2 +- .../components/MkReactionsViewer.reaction.vue | 10 +-- .../src/components/MkRemoteCaution.vue | 6 +- .../src/components/MkRetentionLineChart.vue | 2 +- .../src/components/MkRippleEffect.vue | 4 +- .../frontend/src/components/MkRolePreview.vue | 8 +- packages/frontend/src/components/MkSelect.vue | 14 +-- .../src/components/MkSignin.input.vue | 10 +-- .../src/components/MkSignin.passkey.vue | 4 +- .../src/components/MkSignin.password.vue | 6 +- .../frontend/src/components/MkSignin.totp.vue | 4 +- packages/frontend/src/components/MkSignin.vue | 2 +- .../src/components/MkSigninDialog.vue | 4 +- .../src/components/MkSignupDialog.form.vue | 44 +++++----- .../src/components/MkSignupDialog.rules.vue | 14 +-- .../components/MkSourceCodeAvailablePopup.vue | 2 +- .../src/components/MkSubNoteContent.vue | 12 +-- .../frontend/src/components/MkSuperMenu.vue | 16 ++-- .../src/components/MkSwitch.button.vue | 12 +-- packages/frontend/src/components/MkSwitch.vue | 8 +- .../src/components/MkSystemWebhookEditor.vue | 6 +- packages/frontend/src/components/MkTab.vue | 8 +- .../frontend/src/components/MkTagCloud.vue | 2 +- .../frontend/src/components/MkTextarea.vue | 12 +-- .../src/components/MkTokenGenerateWindow.vue | 6 +- .../frontend/src/components/MkTooltip.vue | 2 +- .../src/components/MkTutorialDialog.Note.vue | 8 +- .../components/MkTutorialDialog.PostNote.vue | 10 +-- .../components/MkTutorialDialog.Sensitive.vue | 12 +-- .../components/MkTutorialDialog.Timeline.vue | 10 +-- .../src/components/MkTutorialDialog.vue | 8 +- .../frontend/src/components/MkUpdated.vue | 2 +- .../frontend/src/components/MkUrlPreview.vue | 6 +- .../MkUserAnnouncementEditDialog.vue | 8 +- .../src/components/MkUserCardMini.vue | 4 +- .../frontend/src/components/MkUserInfo.vue | 12 +-- .../src/components/MkUserOnlineIndicator.vue | 2 +- .../frontend/src/components/MkUserPopup.vue | 10 +-- .../src/components/MkUserSelectDialog.vue | 4 +- .../src/components/MkUserSetupDialog.User.vue | 6 +- .../src/components/MkUserSetupDialog.vue | 10 +-- .../src/components/MkVisibilityPicker.vue | 2 +- .../MkVisitorDashboard.ActiveUsersChart.vue | 2 +- .../src/components/MkVisitorDashboard.vue | 8 +- .../src/components/MkWaitingDialog.vue | 4 +- packages/frontend/src/components/MkWindow.vue | 10 +-- .../frontend/src/components/form/link.vue | 10 +-- .../frontend/src/components/form/section.vue | 6 +- .../frontend/src/components/form/slot.vue | 2 +- .../frontend/src/components/global/MkAd.vue | 4 +- .../src/components/global/MkLoading.vue | 2 +- .../frontend/src/components/global/MkMfm.ts | 10 +-- .../components/global/MkPageHeader.tabs.vue | 2 +- .../src/components/global/MkPageHeader.vue | 6 +- .../frontend/src/components/global/MkTime.vue | 4 +- .../src/components/page/page.dynamic.vue | 2 +- .../src/components/page/page.image.vue | 2 +- .../src/components/page/page.note.vue | 2 +- .../frontend/src/directives/adaptive-bg.ts | 2 +- .../src/directives/adaptive-border.ts | 2 +- packages/frontend/src/directives/panel.ts | 6 +- packages/frontend/src/pages/about-misskey.vue | 10 +-- .../frontend/src/pages/about.overview.vue | 6 +- packages/frontend/src/pages/admin-user.vue | 20 ++--- .../src/pages/admin/RolesEditorFormula.vue | 4 +- .../frontend/src/pages/admin/_header_.vue | 6 +- .../notification-recipient.editor.vue | 4 +- .../notification-recipient.item.vue | 4 +- .../src/pages/admin/announcements.vue | 12 +-- packages/frontend/src/pages/admin/index.vue | 2 +- .../src/pages/admin/modlog.ModLog.vue | 6 +- .../src/pages/admin/overview.ap-requests.vue | 2 +- .../src/pages/admin/overview.federation.vue | 4 +- .../frontend/src/pages/admin/overview.pie.vue | 2 +- .../src/pages/admin/overview.queue.vue | 2 +- .../src/pages/admin/overview.stats.vue | 4 +- .../frontend/src/pages/admin/queue.chart.vue | 2 +- packages/frontend/src/pages/admin/relays.vue | 4 +- .../frontend/src/pages/admin/roles.role.vue | 2 +- .../frontend/src/pages/admin/server-rules.vue | 10 +-- .../frontend/src/pages/admin/settings.vue | 2 +- .../src/pages/admin/system-webhook.item.vue | 6 +- packages/frontend/src/pages/announcement.vue | 6 +- packages/frontend/src/pages/announcements.vue | 6 +- .../frontend/src/pages/antenna-timeline.vue | 2 +- .../frontend/src/pages/channel-editor.vue | 2 +- packages/frontend/src/pages/channel.vue | 8 +- packages/frontend/src/pages/clip.vue | 2 +- .../src/pages/custom-emojis-manager.vue | 8 +- .../frontend/src/pages/drive.file.info.vue | 16 ++-- .../src/pages/drop-and-fusion.game.vue | 2 +- .../frontend/src/pages/emoji-edit-dialog.vue | 4 +- packages/frontend/src/pages/emojis.emoji.vue | 4 +- packages/frontend/src/pages/favorites.vue | 2 +- .../frontend/src/pages/flash/flash-edit.vue | 4 +- packages/frontend/src/pages/flash/flash.vue | 4 +- packages/frontend/src/pages/gallery/edit.vue | 4 +- packages/frontend/src/pages/gallery/post.vue | 14 +-- packages/frontend/src/pages/games.vue | 2 +- .../frontend/src/pages/install-extensions.vue | 8 +- .../frontend/src/pages/my-antennas/index.vue | 4 +- .../frontend/src/pages/my-lists/index.vue | 4 +- packages/frontend/src/pages/my-lists/list.vue | 4 +- packages/frontend/src/pages/note.vue | 2 +- .../page-editor/els/page-editor.el.text.vue | 2 +- .../page-editor/page-editor.container.vue | 6 +- packages/frontend/src/pages/page.vue | 18 ++-- .../frontend/src/pages/reversi/game.board.vue | 16 ++-- .../src/pages/reversi/game.setting.vue | 12 +-- packages/frontend/src/pages/reversi/index.vue | 18 ++-- packages/frontend/src/pages/scratchpad.vue | 4 +- packages/frontend/src/pages/search.note.vue | 4 +- packages/frontend/src/pages/settings/2fa.vue | 2 +- .../settings/avatar-decoration.decoration.vue | 6 +- .../settings/avatar-decoration.dialog.vue | 2 +- .../src/pages/settings/drive-cleaner.vue | 2 +- .../frontend/src/pages/settings/email.vue | 2 +- .../src/pages/settings/emoji-picker.vue | 4 +- .../src/pages/settings/mute-block.vue | 2 +- .../frontend/src/pages/settings/navbar.vue | 2 +- .../frontend/src/pages/settings/profile.vue | 2 +- .../frontend/src/pages/settings/security.vue | 6 +- .../src/pages/settings/sounds.sound.vue | 4 +- .../frontend/src/pages/settings/theme.vue | 12 +-- .../src/pages/settings/webhook.edit.vue | 2 +- .../frontend/src/pages/settings/webhook.vue | 4 +- .../frontend/src/pages/signup-complete.vue | 4 +- packages/frontend/src/pages/tag.vue | 4 +- packages/frontend/src/pages/theme-editor.vue | 2 +- packages/frontend/src/pages/timeline.vue | 2 +- .../frontend/src/pages/user-list-timeline.vue | 2 +- packages/frontend/src/pages/user/clips.vue | 2 +- packages/frontend/src/pages/user/home.vue | 28 +++--- .../src/pages/user/index.timeline.vue | 4 +- packages/frontend/src/pages/user/lists.vue | 4 +- packages/frontend/src/pages/user/raw.vue | 12 +-- .../frontend/src/pages/user/reactions.vue | 2 +- .../frontend/src/pages/welcome.entrance.a.vue | 8 +- packages/frontend/src/pages/welcome.setup.vue | 4 +- .../src/pages/welcome.timeline.note.vue | 4 +- packages/frontend/src/scripts/init-chart.ts | 2 +- packages/frontend/src/scripts/theme.ts | 2 +- packages/frontend/src/style.scss | 88 +++++++++---------- .../src/ui/_common_/announcements.vue | 12 +-- packages/frontend/src/ui/_common_/common.vue | 4 +- .../src/ui/_common_/navbar-for-mobile.vue | 20 ++--- packages/frontend/src/ui/_common_/navbar.vue | 54 ++++++------ .../frontend/src/ui/_common_/statusbars.vue | 4 +- packages/frontend/src/ui/_common_/upload.vue | 4 +- packages/frontend/src/ui/classic.header.vue | 10 +-- packages/frontend/src/ui/classic.sidebar.vue | 10 +-- packages/frontend/src/ui/classic.vue | 14 +-- packages/frontend/src/ui/deck.vue | 26 +++--- packages/frontend/src/ui/deck/column.vue | 32 +++---- .../frontend/src/ui/deck/widgets-column.vue | 2 +- packages/frontend/src/ui/universal.vue | 36 ++++---- packages/frontend/src/ui/visitor.vue | 12 +-- packages/frontend/src/ui/zen.vue | 4 +- .../frontend/src/widgets/WidgetAiscript.vue | 6 +- .../frontend/src/widgets/WidgetCalendar.vue | 2 +- .../frontend/src/widgets/WidgetFederation.vue | 4 +- .../frontend/src/widgets/WidgetJobQueue.vue | 8 +- packages/frontend/src/widgets/WidgetMemo.vue | 4 +- .../src/widgets/WidgetOnlineUsers.vue | 2 +- packages/frontend/src/widgets/WidgetRss.vue | 2 +- .../frontend/src/widgets/WidgetRssTicker.vue | 4 +- .../frontend/src/widgets/WidgetTrends.vue | 4 +- 280 files changed, 1076 insertions(+), 1093 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f61311f1e..3a4dc7b91 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -578,18 +578,18 @@ ESMではディレクトリインポートは廃止されているのと、デ ### Lighten CSS vars ``` css -color: hsl(from var(--accent) h s calc(l + 10)); +color: hsl(from var(--MI_THEME-accent) h s calc(l + 10)); ``` ### Darken CSS vars ``` css -color: hsl(from var(--accent) h s calc(l - 10)); +color: hsl(from var(--MI_THEME-accent) h s calc(l - 10)); ``` ### Add alpha to CSS vars ``` css -color: color(from var(--accent) srgb r g b / 0.5); +color: color(from var(--MI_THEME-accent) srgb r g b / 0.5); ``` diff --git a/idea/MkDisableSection.vue b/idea/MkDisableSection.vue index d17788656..360705071 100644 --- a/idea/MkDisableSection.vue +++ b/idea/MkDisableSection.vue @@ -34,7 +34,7 @@ defineProps<{ width: 100%; height: 100%; cursor: not-allowed; - --color: color(from var(--error) srgb r g b / 0.25); + --color: color(from var(--MI_THEME-error) srgb r g b / 0.25); background-size: auto auto; background-image: repeating-linear-gradient(135deg, transparent, transparent 10px, var(--color) 4px, var(--color) 14px); } diff --git a/locales/index.d.ts b/locales/index.d.ts index d502c5b43..f0dead124 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -7705,10 +7705,6 @@ export interface Locale extends ILocale { * 入力ボックスの縁取り */ "inputBorder": string; - /** - * リスト項目の背景 (ホバー) - */ - "listItemHoverBg": string; /** * ドライブフォルダーの背景 */ diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 678bc7e66..0076c467e 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -2018,7 +2018,6 @@ _theme: buttonBg: "ボタンの背景" buttonHoverBg: "ボタンの背景 (ホバー)" inputBorder: "入力ボックスの縁取り" - listItemHoverBg: "リスト項目の背景 (ホバー)" driveFolderBg: "ドライブフォルダーの背景" wallpaperOverlay: "壁紙のオーバーレイ" badge: "バッジ" diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index 7c6a53342..a04640d99 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -98,7 +98,7 @@ const theme = localStorage.getItem('theme'); if (theme) { for (const [k, v] of Object.entries(JSON.parse(theme))) { - document.documentElement.style.setProperty(`--${k}`, v.toString()); + document.documentElement.style.setProperty(`--MI_THEME-${k}`, v.toString()); // HTMLの theme-color 適用 if (k === 'htmlThemeColor') { diff --git a/packages/backend/src/server/web/style.css b/packages/backend/src/server/web/style.css index dbcc8f537..5d81f2bed 100644 --- a/packages/backend/src/server/web/style.css +++ b/packages/backend/src/server/web/style.css @@ -5,8 +5,8 @@ */ html { - background-color: var(--bg); - color: var(--fg); + background-color: var(--MI_THEME-bg); + color: var(--MI_THEME-fg); } #splash { @@ -17,7 +17,7 @@ html { width: 100vw; height: 100vh; cursor: wait; - background-color: var(--bg); + background-color: var(--MI_THEME-bg); opacity: 1; transition: opacity 0.5s ease; } @@ -45,7 +45,7 @@ html { width: 28px; height: 28px; transform: translateY(70px); - color: var(--accent); + color: var(--MI_THEME-accent); } #splashSpinner > .spinner { diff --git a/packages/backend/src/server/web/style.embed.css b/packages/backend/src/server/web/style.embed.css index a7b110d80..5e8786cc4 100644 --- a/packages/backend/src/server/web/style.embed.css +++ b/packages/backend/src/server/web/style.embed.css @@ -5,8 +5,8 @@ */ html { - background-color: var(--bg); - color: var(--fg); + background-color: var(--MI_THEME-bg); + color: var(--MI_THEME-fg); } html.embed { @@ -24,7 +24,7 @@ html.embed { width: 100vw; height: 100vh; cursor: wait; - background-color: var(--bg); + background-color: var(--MI_THEME-bg); opacity: 1; transition: opacity 0.5s ease; } @@ -33,7 +33,7 @@ html.embed #splash { box-sizing: border-box; min-height: 300px; border-radius: var(--radius, 12px); - border: 1px solid var(--divider, #e8e8e8); + border: 1px solid var(--MI_THEME-divider, #e8e8e8); } html.embed.norounded #splash { @@ -67,7 +67,7 @@ html.embed.noborder #splash { width: 28px; height: 28px; transform: translateY(70px); - color: var(--accent); + color: var(--MI_THEME-accent); } #splashSpinner > .spinner { diff --git a/packages/frontend-embed/src/components/EmLoading.vue b/packages/frontend-embed/src/components/EmLoading.vue index 49d8ace37..47d797606 100644 --- a/packages/frontend-embed/src/components/EmLoading.vue +++ b/packages/frontend-embed/src/components/EmLoading.vue @@ -56,7 +56,7 @@ const props = withDefaults(defineProps<{ --size: 38px; &.colored { - color: var(--accent); + color: var(--MI_THEME-accent); } &.inline { diff --git a/packages/frontend-embed/src/components/EmMediaBanner.vue b/packages/frontend-embed/src/components/EmMediaBanner.vue index 435da238a..3e3dfd95b 100644 --- a/packages/frontend-embed/src/components/EmMediaBanner.vue +++ b/packages/frontend-embed/src/components/EmMediaBanner.vue @@ -33,15 +33,15 @@ defineProps<{ width: 100%; padding: var(--margin); margin-top: 4px; - border: 1px solid var(--inputBorder); + border: 1px solid var(--MI_THEME-inputBorder); border-radius: var(--radius); - background-color: var(--panel); + background-color: var(--MI_THEME-panel); transition: background-color .1s, border-color .1s; &:hover { text-decoration: none; - border-color: var(--inputBorderHover); - background-color: var(--buttonHoverBg); + border-color: var(--MI_THEME-inputBorderHover); + background-color: var(--MI_THEME-buttonHoverBg); } } diff --git a/packages/frontend-embed/src/components/EmMediaImage.vue b/packages/frontend-embed/src/components/EmMediaImage.vue index 470352469..d711020a7 100644 --- a/packages/frontend-embed/src/components/EmMediaImage.vue +++ b/packages/frontend-embed/src/components/EmMediaImage.vue @@ -36,7 +36,7 @@ SPDX-License-Identifier: AGPL-3.0-only