From 305b2eca0bd762bf9e1dd5cff1dd9f24b0f39c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=B1=80?= <131967983+lutinglt@users.noreply.github.com> Date: Tue, 5 Aug 2025 12:39:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=94=BB=E8=BF=81=E7=A7=BB=20&=20?= =?UTF-8?q?=E9=83=A8=E5=88=86=20PR=20=E6=A0=B7=E5=BC=8F=20(#7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 弹窗动画 * 优化 PR 中的合并提交按钮颜色 * 优化按钮样式 * 同步 PR 的合并提交头像样式 * 同步 Issue/PR 的时间线样式 * Issue/PR 的时间线样式间隔和大小 * 同步 PR 的合并提交操作面板样式 * PR 操作间隔 * green * PR 操作边框色 * 已合并颜色 * 仓库同步派生栏样式同步 * 动画迁移 & 一些圆角修复 * 修复工单下依赖工单选择框 * 评论标题颜色&分支字体&提交栏样式 --------- Co-authored-by: lutinglt --- .github/release.md | 17 +++- TODO.md | 6 +- src/core/github.ts | 3 + src/core/theme.ts | 18 ++-- src/types/color/github.ts | 7 ++ src/types/vars.ts | 4 +- styles/components/actions.tsx | 20 +++-- styles/components/filelist.tsx | 38 ++++++-- styles/components/issue.tsx | 159 ++++++++++++++++++++++++++++++++- styles/components/repo.tsx | 4 - styles/public/button.tsx | 19 +++- styles/public/dropdown.tsx | 19 +++- styles/public/index.tsx | 1 + styles/public/modal.tsx | 2 + styles/public/navbar.tsx | 3 +- styles/public/radius.tsx | 10 ++- styles/public/transition.scss | 45 ---------- styles/public/transition.tsx | 49 ++++++++++ 18 files changed, 329 insertions(+), 95 deletions(-) delete mode 100644 styles/public/transition.scss create mode 100644 styles/public/transition.tsx diff --git a/.github/release.md b/.github/release.md index 3128933..bf7e2bb 100644 --- a/.github/release.md +++ b/.github/release.md @@ -2,11 +2,20 @@ #### 更符合 GitHub 风格 +- 同步 PR 的合并提交操作面板样式 +- 同步 Issue/PR 的时间线样式 +- 仓库同步派生栏样式同步 +- 添加一些颜色的渐变过渡动画 +- 同步 Issue/PR 的评论标题颜色 +- 同步 PR/Actions 的分支字体 +- 同步文件打开时的提交栏样式 + ## 🎈 Perf -- 优化提交中 Action 状态标签的位置 -- 优化按钮和菜单下的图标颜色 -- 优化仓库发布中的分支选择按钮样式 -- 优化向上弹窗的菜单动画 +- 优化全局按钮样式 +- 优化顶部导航栏按钮圆角 ## 🐞 Fix + +- 修复一些圆角问题 +- 修复工单下依赖工单选择框的高度对齐 \ No newline at end of file diff --git a/TODO.md b/TODO.md index 73a9387..87de43c 100644 --- a/TODO.md +++ b/TODO.md @@ -1,8 +1,3 @@ -### 轻量 - -- hover 动画迁移 -- 列表部分 item 展开动画迁移 - ### 重大 - gitea issue 默认标签颜色匹配使用 github 样式 @@ -12,6 +7,7 @@ - defineTheme 颜色生成代码重构 - 亮色主题适配/测试 - 自动颜色主题生成 +- github primer 官方库集成 ### 其他 diff --git a/src/core/github.ts b/src/core/github.ts index 5bda3ae..02255e3 100644 --- a/src/core/github.ts +++ b/src/core/github.ts @@ -350,6 +350,9 @@ export function defineGithubTheme(githubColor: GithubColor): Theme { }, }, control: { + bgColor: { + rest: githubColor.control.bgColor.rest, + }, transparent: { bgColor: { hover: githubColor.control.transparent.bgColor.hover, diff --git a/src/core/theme.ts b/src/core/theme.ts index b4ca914..fb293a0 100644 --- a/src/core/theme.ts +++ b/src/core/theme.ts @@ -48,26 +48,28 @@ export function createTheme(theme: Theme): void { } createGlobalTheme(":root", themeVars, theme); createGlobalTheme(":root", otherThemeVars, { - git: "#f05133", - light: { - mimicEnabled: isDarkTheme - ? "rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled)))" - : "rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled)))", - }, border: { radius: "6px", }, + color: { + git: "#f05133", + light: { + mimicEnabled: isDarkTheme + ? "rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled)))" + : "rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled)))", + }, + }, }); globalStyle(":root", { accentColor: themeVars.color.accent, colorScheme: isDarkTheme ? "dark" : "light", }); globalKeyframes(overlayAppearDown, { - "0%": { opacity: 0, transform: "translateY(-12px)" }, + "0%": { opacity: 0, transform: "translateY(-8px)" }, "100%": { opacity: 1, transform: "translateY(0)" }, }); globalKeyframes(overlayAppearUp, { - "0%": { opacity: 0, transform: "translateY(12px)" }, + "0%": { opacity: 0, transform: "translateY(8px)" }, "100%": { opacity: 1, transform: "translateY(0)" }, }); } diff --git a/src/types/color/github.ts b/src/types/color/github.ts index 904dc2c..e31cd0c 100644 --- a/src/types/color/github.ts +++ b/src/types/color/github.ts @@ -41,6 +41,7 @@ export const github = { success: { /** 成功的背景颜色 * @issue `babel` 重新开启图标背景颜色 + * @issue `prMerge` 合并提交的图标背景色 */ emphasis: null, }, @@ -157,6 +158,12 @@ export const github = { }, }, control: { + bgColor: { + /** 背景色 + * @issue `timeline` 时间线标签背景色 + */ + rest: null, + }, transparent: { bgColor: { /** 悬停色 diff --git a/src/types/vars.ts b/src/types/vars.ts index c51d066..f4d78aa 100644 --- a/src/types/vars.ts +++ b/src/types/vars.ts @@ -30,7 +30,9 @@ const otherVars = { border: { radius: null, }, - ...color.otherAuto, + color: { + ...color.otherAuto, + }, }; export const themeVars = createGlobalThemeContract(vars, varMapper); diff --git a/styles/components/actions.tsx b/styles/components/actions.tsx index 928f987..593d64e 100644 --- a/styles/components/actions.tsx +++ b/styles/components/actions.tsx @@ -1,3 +1,4 @@ +import { animationDown } from "src/core/theme"; import { css, otherThemeVars, themeVars } from "src/types/vars"; // 仓库 Actions 页面 @@ -57,6 +58,7 @@ export const actions = css` .run-list-ref { background-color: ${themeVars.github.bgColor.accent.muted}; color: ${themeVars.github.fgColor.accent}; + font-family: var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace); font-weight: 400; &:hover { background-color: ${themeVars.github.bgColor.accent.muted}; @@ -132,6 +134,7 @@ export const actionViewHeader = css` .ui.label { background-color: ${themeVars.github.bgColor.accent.muted}; color: ${themeVars.github.fgColor.accent}; + font-family: var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace); font-weight: 400; > a { opacity: 1; @@ -212,6 +215,7 @@ export const actionViewRight = css` } .job-step-container { + // 步骤标题 .job-step-summary { color: ${themeVars.color.console.fg.subtle}; padding: 8px 10px; @@ -238,12 +242,16 @@ export const actionViewRight = css` } } } - /* 日志字体颜色白色 */ - .job-log-line { - color: ${themeVars.color.console.fg.self}; - /* 被 hover 时覆盖 ANSI 颜色 */ - .log-msg:hover * { - color: ${themeVars.color.console.fg.self} !important; + // 步骤日志 + .job-step-logs { + animation: ${animationDown}; + /* 日志字体颜色白色 */ + .job-log-line { + color: ${themeVars.color.console.fg.self}; + /* 被 hover 时覆盖 ANSI 颜色 */ + .log-msg:hover * { + color: ${themeVars.color.console.fg.self} !important; + } } } } diff --git a/styles/components/filelist.tsx b/styles/components/filelist.tsx index 3d10a92..0555532 100644 --- a/styles/components/filelist.tsx +++ b/styles/components/filelist.tsx @@ -16,12 +16,15 @@ export const branchButton = css` } `; -// 仓库按钮 -export const repoButton = css` +// 仓库同步派生 +export const syncFork = css` .page-content.repository.file.list { - // clone 按钮调整 - .repo-button-row .repo-button-row-right .ui.primary.button span { - margin: 0px 3px; + .repo-home-filelist > .ui.message { + background: ${themeVars.color.box.header}; + padding: 8px 8px 8px 16px; + .ui.button { + min-width: 96px; + } } } `; @@ -107,6 +110,29 @@ export const repoFilesMobile = css` } `; +// 仓库打开文件时的视图 +export const repoFileView = css` + .page-content.repository.file.list { + .repo-view-container { + // 右侧文件视图内容 + .repo-view-content { + // 头部提交信息 + #repo-file-commit-box { + padding: 8px 12px; + > .latest-commit { + gap: 8px; + } + // 右侧提交时间 + > .age { + display: flex; + align-items: center; + } + } + } + } + } +`; + // 仓库代码布局调整, 侧边栏宽度调整 export const repoGrid = css` .repo-grid-filelist-sidebar { @@ -198,7 +224,7 @@ export const repoSidebarBottom = css` .color-icon { height: 8px; width: 8px; - margin-right: 6px; + margin-right: 8px; } .tw-font-semibold { color: ${themeVars.color.text.self}; diff --git a/styles/components/issue.tsx b/styles/components/issue.tsx index 03b87b3..7963dd4 100644 --- a/styles/components/issue.tsx +++ b/styles/components/issue.tsx @@ -1,4 +1,4 @@ -import { css, themeVars } from "src/types/vars"; +import { css, otherThemeVars, themeVars } from "src/types/vars"; import { activeItemAfterStyle } from "styles/public/menu"; export const button = css` @@ -26,17 +26,14 @@ export const babel = css` // 时间线打开状态标签 &.tw-bg-green { background-color: ${themeVars.github.bgColor.success.emphasis} !important; - border-color: ${themeVars.github.bgColor.success.emphasis} !important; } // 时间线关闭状态标签 &.tw-bg-red { background-color: ${themeVars.github.bgColor.done.emphasis} !important; - border-color: ${themeVars.github.bgColor.done.emphasis} !important; } // 时间线合并状态标签 &.tw-bg-purple { background-color: ${themeVars.github.bgColor.done.emphasis} !important; - border-color: ${themeVars.github.bgColor.done.emphasis} !important; } } } @@ -70,8 +67,19 @@ export const prBranch = css` #issue-list .flex-item-body .branches .branch { color: ${themeVars.github.fgColor.accent}; background-color: ${themeVars.github.bgColor.accent.muted}; + border-radius: ${otherThemeVars.border.radius}; + font-family: var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace); font-size: 12px; padding: 0 5px; + line-height: 20px; + } + + .repository.view.issue .pull-desc code { + padding-top: 3px; + padding-bottom: 3px; + a:hover { + text-decoration-line: none; + } } `; @@ -94,6 +102,10 @@ export const comment = css` } } .comment-header-right { + > .item, + > .label { + color: ${themeVars.color.text.light.num1}; + } .context-dropdown { // 评论菜单的删除按钮 .menu .item.delete-comment { @@ -121,3 +133,142 @@ export const dropdown = css` } } `; + +// PR 界面的 PR 操作评论 +export const prMerge = css` + .repository.view.issue .comment-list .timeline-item.pull-merge-box { + // 头像 + .timeline-avatar { + color: ${themeVars.color.text.self} !important; + border-radius: ${otherThemeVars.border.radius}; + width: 40px; + height: 40px; + display: flex; + align-items: center; + justify-content: center; + svg { + width: 24px; + height: 24px; + } + // 可以合并 + &.green { + background-color: ${themeVars.github.bgColor.success.emphasis}; + // 操作评论边框色 + + .content > .ui.attached.segment { + border-left-color: ${themeVars.github.bgColor.success.emphasis}; + border-right-color: ${themeVars.github.bgColor.success.emphasis}; + &:first-child { + border-top-color: ${themeVars.github.bgColor.success.emphasis}; + } + &:last-child { + border-bottom-color: ${themeVars.github.bgColor.success.emphasis}; + } + } + } + // 已合并 + &.purple { + background-color: ${themeVars.github.bgColor.done.emphasis}; + + .content > .ui.attached.segment { + border-left-color: ${themeVars.github.bgColor.done.emphasis}; + border-right-color: ${themeVars.github.bgColor.done.emphasis}; + &:first-child { + border-top-color: ${themeVars.github.bgColor.done.emphasis}; + } + &:last-child { + border-bottom-color: ${themeVars.github.bgColor.done.emphasis}; + } + } + } + } + // 检查状态 + .commit-status-panel { + .commit-status-header { + background: ${themeVars.color.body}; + padding: 16px; + font-size: 16px; + font-weight: 600; + .ui.right { + color: ${themeVars.color.text.light.num1}; + font-size: 14px; + font-weight: 400; + } + } + // 检查状态列表 + .commit-status-list { + background: ${themeVars.color.menu}; + .commit-status-item { + border-radius: ${otherThemeVars.border.radius}; + padding: 2px 8px; + margin: 0px 8px; + height: 37px; + &:first-child { + margin-top: 8px; + } + &:last-child { + margin-bottom: 8px; + } + &:hover { + background-color: ${themeVars.color.hover.opaque}; + } + } + } + } + // 合并信息和操作 + .merge-section { + color: ${themeVars.color.text.light.num1}; + padding: 16px; + display: grid; + gap: 8px; + } + } +`; + +// 时间线 +export const timeline = css` + .repository.view.issue { + .comment-list { + .timeline-item, + .timeline-item-group { + padding: 16px 0; + // 事件 + &.event { + // 修复覆盖后的位置问题 + padding-left: 15px; + .avatar { + width: 20px; + height: 20px; + } + .badge { + border: 2px solid ${themeVars.color.body}; + } + // 仅匹配只有 badge + .badge:not([class*=" "]) { + background-color: ${themeVars.github.control.bgColor.rest}; + svg { + color: ${themeVars.color.text.light.num1}; + } + } + } + // 提交 + &.commits-list { + // 每个提交之间的间隔 + .flex-text-block { + padding-top: 4px; + } + .badge svg { + color: ${themeVars.color.text.light.num1}; + } + // 仅覆盖左侧 commit 不覆盖右侧 SHA + a.muted { + font-size: 12px; + color: ${themeVars.color.text.light.num1}; + text-decoration-line: underline; + &:hover { + color: ${themeVars.color.primary.self}; + } + } + } + } + } + } +`; diff --git a/styles/components/repo.tsx b/styles/components/repo.tsx index b82c277..1874cd5 100644 --- a/styles/components/repo.tsx +++ b/styles/components/repo.tsx @@ -6,10 +6,6 @@ export const repoHeader = css` // 点星/关注/克隆/RSS 按钮 .ui.compact.button { padding: 3px 12px; - // 文本跟图标间隔, 文本在手机下不显示 - span { - margin-left: 0.5rem; - } } // 仓库图标 img.ui.avatar { diff --git a/styles/public/button.tsx b/styles/public/button.tsx index 98c9546..0dbbc48 100644 --- a/styles/public/button.tsx +++ b/styles/public/button.tsx @@ -18,14 +18,25 @@ export const baseButton = css` min-height: 30px; font-weight: 500; padding: 9px 16px; + &.ui { + gap: 8px; + } } .ui.button:not(.primary):not(.red) svg { color: ${themeVars.color.text.light.num1}; } - .ui.primary.button { - ${primaryStyle} - &:hover { - ${primaryHoverStyle} + // 主色调按钮保持白色 + .ui.primary.buttons .button svg { + color: ${themeVars.color.text.self}; + } + .ui.primary { + &.button, + // 按钮组, PR 里的压缩合并按钮 + &.buttons .button { + ${primaryStyle} + &:hover { + ${primaryHoverStyle} + } } } // 主色调基本按钮和普通按钮一样 diff --git a/styles/public/dropdown.tsx b/styles/public/dropdown.tsx index 115894e..b8b3d5e 100644 --- a/styles/public/dropdown.tsx +++ b/styles/public/dropdown.tsx @@ -14,6 +14,7 @@ export const dropdown = css` box-shadow: ${themeVars.github.shadow.floating.small} !important; // 忽略隐藏 > .item:not(.tw-hidden) { + animation: ${animationDown}; display: flex !important; align-items: center; gap: 0.5rem; @@ -37,9 +38,6 @@ export const dropdown = css` background-color: ${themeVars.github.control.transparent.bgColor.hover} !important; } } - svg { - margin-right: 0.5rem; - } &.active, &.selected { &:after { @@ -154,6 +152,13 @@ export const selectionDropdown = css` border-bottom-left-radius: ${otherThemeVars.border.radius} !important; border-bottom-right-radius: ${otherThemeVars.border.radius} !important; } + // 修复因为上面的排除导致的圆角问题 + // 具体工单页面下依赖菜单选择框 + #new-dependency-drop-list.ui.selection.dropdown.active, + // 提交图分支选择框 + #git-graph-container #flow-select-refs-dropdown { + border-bottom-right-radius: 0 !important; + } // 修复选择框的下拉菜单向上显示时的样式问题 .ui.upward.selection.dropdown.visible:not(.small), .ui.active.upward.selection.dropdown:not(.small) { @@ -161,3 +166,11 @@ export const selectionDropdown = css` border-top-right-radius: ${otherThemeVars.border.radius}!important; } `; + +export const fixSelectionDropdown = css` + // 具体工单页面下依赖菜单选择框 + #new-dependency-drop-list.ui.selection.dropdown { + // 高度对齐问题, 应该与 input 框高度一致 + min-height: 32px; + } +`; diff --git a/styles/public/index.tsx b/styles/public/index.tsx index 0509d4f..c59bc61 100644 --- a/styles/public/index.tsx +++ b/styles/public/index.tsx @@ -2,6 +2,7 @@ // tslint:disable:ordered-imports // 组件导入有顺序, 禁止插件优化 import "./radius"; // 圆角, 此样式为基础样式, 确保在其他样式之前导入 +import "./transition"; // 过渡效果 import "./text"; // 文本或 SVG 的基本颜色 import "./button"; // 按钮 import "./chroma"; // 代码高亮 diff --git a/styles/public/modal.tsx b/styles/public/modal.tsx index 8a2d030..385285e 100644 --- a/styles/public/modal.tsx +++ b/styles/public/modal.tsx @@ -1,7 +1,9 @@ +import { animationDown } from "src/core/theme"; import { css, themeVars } from "src/types/vars"; export const modal = css` .ui.modal { + animation: ${animationDown}; border: 1.5px solid ${themeVars.color.light.border}; > .header { diff --git a/styles/public/navbar.tsx b/styles/public/navbar.tsx index e177e8d..4958c0e 100644 --- a/styles/public/navbar.tsx +++ b/styles/public/navbar.tsx @@ -1,4 +1,4 @@ -import { css, themeVars } from "src/types/vars"; +import { css, otherThemeVars, themeVars } from "src/types/vars"; export const navbarRight = css` #navbar { @@ -13,6 +13,7 @@ export const navbarRight = css` align-content: center; justify-content: center; border: 1px solid ${themeVars.color.light.border}; + border-radius: ${otherThemeVars.border.radius}; padding: unset; height: 32px; min-width: 32px; diff --git a/styles/public/radius.tsx b/styles/public/radius.tsx index 06e90fe..b740ebe 100644 --- a/styles/public/radius.tsx +++ b/styles/public/radius.tsx @@ -78,8 +78,10 @@ export const radiusImportant = css` border-radius: ${otherThemeVars.border.radius} !important; } // 目前为仓库列表/探索的二级菜单, 改版需要替换为全圆角 - .ui.tabular.menu .active.item { + .ui.secondary.tabular.menu .item { border-radius: ${otherThemeVars.border.radius} !important; + &.active, + &.active:hover, &:hover { border-radius: ${otherThemeVars.border.radius} !important; } @@ -113,10 +115,10 @@ export const radiusTop = css` // 上半部分圆角替换(原CSS带!important) export const radiusTopImportant = css` + .ui.tabular.menu .item, .ui.simple.upward.dropdown { - &.active { - border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0 !important; - } + &.active, + &.active:hover, &:hover { border-radius: ${otherThemeVars.border.radius} ${otherThemeVars.border.radius} 0 0 !important; } diff --git a/styles/public/transition.scss b/styles/public/transition.scss deleted file mode 100644 index 5f66ae4..0000000 --- a/styles/public/transition.scss +++ /dev/null @@ -1,45 +0,0 @@ -// Made by Luting ^-^ -@keyframes overlay-appear { - 0% { - opacity: 0; - transform: translateY(-12px); - } - - 100% { - opacity: 1; - transform: translateY(0); - } -} - -#navbar .item, -.header-wrapper .ui.tabular.menu .item, -.job-step-summary, -.job-step-logs, -.job-brief-item, -.tippy-box .flex-items-block .item, -.clone-panel-tab .item, -.ui.form select, -.ui.label, -.ui.modal, -.ui.selection.dropdown, -.ui.checkbox label:before, -.ui.checkbox input:checked ~ label:before, -.ui.checkbox input:not([type="radio"]):indeterminate ~ label:before, -.ui.selection.active.dropdown, -.ui.selection.active.dropdown:hover, -.ui.selection.active.dropdown .menu, -.ui.selection.active.dropdown:hover .menu, -.ui.vertical.menu .header.item, -.ui.secondary.menu .item { - transition: 0.12s ease-out; -} - -textarea, -.ui.form input, -.menu .item, -.ui.modal, -.job-step-summary, -.job-step-logs, -.job-brief-item { - animation: 200ms cubic-bezier(0.33, 1, 0.68, 1) 0s 1 normal none running overlay-appear; -} diff --git a/styles/public/transition.tsx b/styles/public/transition.tsx new file mode 100644 index 0000000..e50042a --- /dev/null +++ b/styles/public/transition.tsx @@ -0,0 +1,49 @@ +import { css } from "src/types/vars"; + +// 简单的渐变过渡 +export const transition = css` + // 迁移的元素 + #navbar .item, + .header-wrapper .ui.tabular.menu .item, + .job-step-summary, + .job-step-logs, + .job-brief-item, + .repo-file-cell, + .tippy-box .flex-items-block .item, + .clone-panel-tab .item, + .ui.form select, + .ui.label, + .ui.modal, + .ui.checkbox label:before, + .ui.checkbox input:checked ~ label:before, + .ui.checkbox input:not([type="radio"]):indeterminate ~ label:before, + .ui.selection.dropdown, + .ui.selection.active.dropdown, + .ui.selection.active.dropdown:hover, + .ui.selection.active.dropdown .menu, + .ui.selection.active.dropdown:hover .menu, + .ui.vertical.menu .header.item, + .ui.secondary.menu .item { + transition: 80ms cubic-bezier(0.33, 1, 0.68, 1); + } + // Gitea 表单元素原始过渡覆盖 + input, + textarea, + tr, + .ui.input textarea, + .ui.form textarea, + .ui.form input:not([type]), + .ui.form input[type="date"], + .ui.form input[type="datetime-local"], + .ui.form input[type="email"], + .ui.form input[type="number"], + .ui.form input[type="password"], + .ui.form input[type="search"], + .ui.form input[type="tel"], + .ui.form input[type="time"], + .ui.form input[type="text"], + .ui.form input[type="file"], + .ui.form input[type="url"] { + transition: 80ms cubic-bezier(0.33, 1, 0.68, 1); + } +`;