From fa14c4c00b45eade3fef286ebc6fc618c3f9429b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 7 Jan 2024 01:54:25 +0800 Subject: [PATCH] style: stylelint fix --- .../src/client/styles/button.scss | 71 ++--- theme/src/client/components/Archives.vue | 7 +- theme/src/client/components/AutoLink.vue | 4 +- theme/src/client/components/BackToTop.vue | 26 +- theme/src/client/components/Backdrop.vue | 8 +- theme/src/client/components/Blog.vue | 6 +- theme/src/client/components/BlogAside.vue | 21 +- theme/src/client/components/BlogExtract.vue | 28 +- .../src/client/components/DocOutlineItem.vue | 6 +- .../client/components/Flyout/MenuGroup.vue | 6 +- .../src/client/components/Flyout/MenuLink.vue | 6 +- theme/src/client/components/Flyout/VMenu.vue | 18 +- theme/src/client/components/Flyout/index.vue | 23 +- theme/src/client/components/Friends.vue | 33 +-- theme/src/client/components/FriendsItem.vue | 29 +- theme/src/client/components/Home.vue | 26 +- theme/src/client/components/LayoutContent.vue | 15 +- theme/src/client/components/LocalNav.vue | 25 +- .../components/LocalNavOutlineDropdown.vue | 18 +- theme/src/client/components/Nav/NavBar.vue | 76 +++--- .../components/Nav/NavBarAppearance.vue | 2 +- .../src/client/components/Nav/NavBarExtra.vue | 6 +- .../client/components/Nav/NavBarHamburger.vue | 4 +- .../src/client/components/Nav/NavBarMenu.vue | 2 +- .../client/components/Nav/NavBarMenuLink.vue | 2 +- .../client/components/Nav/NavBarSearch.vue | 145 +++++----- .../components/Nav/NavBarSocialLinks.vue | 2 +- .../src/client/components/Nav/NavBarTitle.vue | 6 +- .../components/Nav/NavBarTranslations.vue | 4 +- theme/src/client/components/Nav/NavScreen.vue | 25 +- .../components/Nav/NavScreenAppearance.vue | 6 +- .../components/Nav/NavScreenMenuGroup.vue | 14 +- .../components/Nav/NavScreenMenuGroupLink.vue | 2 +- .../Nav/NavScreenMenuGroupSection.vue | 2 +- .../components/Nav/NavScreenMenuLink.vue | 4 +- .../components/Nav/NavScreenTranslations.vue | 4 +- theme/src/client/components/Nav/index.vue | 9 +- theme/src/client/components/Page.vue | 89 +++--- theme/src/client/components/PageAside.vue | 11 +- theme/src/client/components/PageAsideItem.vue | 4 +- theme/src/client/components/PageFooter.vue | 43 +-- theme/src/client/components/PageMeta.vue | 17 +- theme/src/client/components/PostItem.vue | 26 +- theme/src/client/components/PostList.vue | 15 +- theme/src/client/components/ShortPostList.vue | 7 +- theme/src/client/components/Sidebar.vue | 51 ++-- theme/src/client/components/SidebarItem.vue | 12 +- theme/src/client/components/SkipLink.vue | 12 +- theme/src/client/components/SocialLink.vue | 4 +- theme/src/client/components/Switch.vue | 13 +- .../client/components/SwitchAppearance.vue | 3 +- theme/src/client/components/Tags.vue | 30 ++- theme/src/client/components/VButton.vue | 30 +-- theme/src/client/components/VFooter.vue | 8 +- theme/src/client/components/global/Badge.vue | 22 +- .../components/global/ExternalLinkIcon.vue | 6 +- theme/src/client/composables/index.ts | 1 + theme/src/client/layouts/NotFound.vue | 18 +- theme/src/client/styles/code.scss | 88 +++--- theme/src/client/styles/content.scss | 34 +-- theme/src/client/styles/fonts.scss | 254 +++++++++++------- theme/src/client/styles/index.scss | 24 +- theme/src/client/styles/md-enhance.scss | 204 ++++++++++++-- theme/src/client/styles/normalize.scss | 36 +-- theme/src/client/styles/search.scss | 4 +- theme/src/client/styles/utils.scss | 4 +- theme/src/client/styles/vars.scss | 63 +++-- 67 files changed, 1060 insertions(+), 764 deletions(-) diff --git a/plugins/plugin-copy-code/src/client/styles/button.scss b/plugins/plugin-copy-code/src/client/styles/button.scss index 8606b9a1..bf2f8fab 100644 --- a/plugins/plugin-copy-code/src/client/styles/button.scss +++ b/plugins/plugin-copy-code/src/client/styles/button.scss @@ -9,11 +9,11 @@ --vp-code-copy-code-hover-border-color: #e2e2e3; --vp-code-copy-code-hover-bg: #fff; --vp-code-copy-code-active-text: rgba(60, 60, 67, 0.78); - --vp-code-copy-copied-text-content: 'Copied'; + --vp-code-copy-copied-text-content: "Copied"; } -html[lang='zh-CN'] { - --vp-code-copy-copied-text-content: '已复制'; +html[lang="zh-CN"] { + --vp-code-copy-copied-text-content: "已复制"; } .dark { @@ -25,71 +25,76 @@ html[lang='zh-CN'] { } .copy-code-button { - /*rtl:ignore*/ - direction: ltr; position: absolute; top: 12px; - /*rtl:ignore*/ + + /* rtl:ignore */ right: 12px; z-index: 3; - border: 1px solid var(--vp-code-copy-code-border-color); - border-radius: 4px; width: 40px; height: 40px; - background-color: var(--vp-code-copy-code-bg); - opacity: 0; cursor: pointer; + background-color: var(--vp-code-copy-code-bg); background-image: var(--vp-icon-copy); + background-repeat: no-repeat; background-position: 50%; background-size: 20px; - background-repeat: no-repeat; + border: 1px solid var(--vp-code-copy-code-border-color); + border-radius: 4px; + opacity: 0; transition: border-color 0.25s, background-color 0.25s, opacity 0.25s; + + /* rtl:ignore */ + direction: ltr; } -[class*='language-']:hover > .copy-code-button, -[class*='language-'] > .copy-code-button:focus, -[class*='language-'] > .copy-code-button.copied { +[class*="language-"]:hover > .copy-code-button, +[class*="language-"] > .copy-code-button:focus, +[class*="language-"] > .copy-code-button.copied { opacity: 1; } -[class*='language-'] > .copy-code-button:hover, -[class*='language-'] > .copy-code-button.copied { - border-color: var(--vp-code-copy-code-hover-border-color); +[class*="language-"] > .copy-code-button:hover, +[class*="language-"] > .copy-code-button.copied { background-color: var(--vp-code-copy-code-hover-bg); + border-color: var(--vp-code-copy-code-hover-border-color); } -[class*='language-'] > .copy-code-button.copied, -[class*='language-'] > .copy-code-button:hover.copied { - /*rtl:ignore*/ - border-radius: 0 4px 4px 0; +[class*="language-"] > .copy-code-button.copied, +[class*="language-"] > .copy-code-button:hover.copied { background-color: var(--vp-code-copy-code-hover-bg); background-image: var(--vp-icon-copied); + + /* rtl:ignore */ + border-radius: 0 4px 4px 0; } -[class*='language-'] > .copy-code-button.copied::before, -[class*='language-'] > .copy-code-button:hover.copied::before { +[class*="language-"] > .copy-code-button.copied::before, +[class*="language-"] > .copy-code-button:hover.copied::before { position: relative; top: -1px; - /*rtl:ignore*/ - transform: translateX(calc(-100% - 1px)); display: flex; - justify-content: center; align-items: center; - border: 1px solid var(--vp-code-copy-code-hover-border-color); - /*rtl:ignore*/ - border-right: 0; - border-radius: 4px 0 0 4px; - padding: 0 10px; + justify-content: center; width: fit-content; height: 40px; - text-align: center; + padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--vp-code-copy-code-active-text); - background-color: var(--vp-code-copy-code-hover-bg); + text-align: center; white-space: nowrap; content: var(--vp-code-copy-copied-text-content); + background-color: var(--vp-code-copy-code-hover-bg); + border: 1px solid var(--vp-code-copy-code-hover-border-color); + + /* rtl:ignore */ + border-right: 0; + border-radius: 4px 0 0 4px; + + /* rtl:ignore */ + transform: translateX(calc(-100% - 1px)); } diff --git a/theme/src/client/components/Archives.vue b/theme/src/client/components/Archives.vue index 0b2c7cbf..31bd7311 100644 --- a/theme/src/client/components/Archives.vue +++ b/theme/src/client/components/Archives.vue @@ -28,18 +28,19 @@ const { archives } = useArchives() diff --git a/theme/src/client/components/AutoLink.vue b/theme/src/client/components/AutoLink.vue index fc8f6191..db2ee1ce 100644 --- a/theme/src/client/components/AutoLink.vue +++ b/theme/src/client/components/AutoLink.vue @@ -46,10 +46,10 @@ function linkTo(e: Event) { diff --git a/theme/src/client/components/BlogExtract.vue b/theme/src/client/components/BlogExtract.vue index 364e0900..afa630c7 100644 --- a/theme/src/client/components/BlogExtract.vue +++ b/theme/src/client/components/BlogExtract.vue @@ -85,19 +85,19 @@ const showBlogExtract = computed(() => { diff --git a/theme/src/client/components/DocOutlineItem.vue b/theme/src/client/components/DocOutlineItem.vue index 0cf328a3..16280089 100644 --- a/theme/src/client/components/DocOutlineItem.vue +++ b/theme/src/client/components/DocOutlineItem.vue @@ -36,13 +36,13 @@ function onClick({ target: el }: Event) { .outline-link { display: block; + overflow: hidden; + font-weight: 400; line-height: 28px; color: var(--vp-c-text-2); - white-space: nowrap; - overflow: hidden; text-overflow: ellipsis; + white-space: nowrap; transition: color 0.5s; - font-weight: 400; } .outline-link:hover, diff --git a/theme/src/client/components/Flyout/MenuGroup.vue b/theme/src/client/components/Flyout/MenuGroup.vue index f430fb39..d62ea735 100644 --- a/theme/src/client/components/Flyout/MenuGroup.vue +++ b/theme/src/client/components/Flyout/MenuGroup.vue @@ -23,15 +23,15 @@ defineProps<{ diff --git a/theme/src/client/components/FriendsItem.vue b/theme/src/client/components/FriendsItem.vue index c2561ff9..c6fb11de 100644 --- a/theme/src/client/components/FriendsItem.vue +++ b/theme/src/client/components/FriendsItem.vue @@ -28,12 +28,12 @@ defineProps<{ display: flex; align-items: flex-start; padding: 16px; - border-radius: 6px; - border: 1px solid var(--vp-friends-border-color); margin-bottom: 8px; - transition: all 0.25s; background-color: var(--vp-friends-bg-color); + border: 1px solid var(--vp-friends-border-color); + border-radius: 6px; box-shadow: var(--vp-shadow-1); + transition: all 0.25s; } .friend:hover { @@ -48,35 +48,36 @@ defineProps<{ .avatar { width: 64px; height: 64px; - border-radius: 100%; - background-size: cover; background-color: var(--vp-c-default-soft); + background-size: cover; + border-radius: 100%; } + .content { flex: 1; } .content .title { display: block; - font-weight: 700; - font-size: 18px; - color: var(--vp-friends-link-color); - padding-left: 16px; padding-bottom: 8px; - margin-left: -16px; + padding-left: 16px; margin-bottom: 8px; + margin-left: -16px; + font-size: 18px; + font-weight: 700; + color: var(--vp-friends-link-color); border-bottom: 1px dashed var(--vp-friends-border-color); } .content p { + display: -webkit-box; + padding-top: 8px; + overflow: hidden; font-size: 0.875rem; line-height: 1.5; - padding-top: 8px; - display: -webkit-box; - overflow: hidden; + color: var(--vp-friends-text-color); -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; - color: var(--vp-friends-text-color); } diff --git a/theme/src/client/components/Home.vue b/theme/src/client/components/Home.vue index 222fe1f7..1a04305c 100644 --- a/theme/src/client/components/Home.vue +++ b/theme/src/client/components/Home.vue @@ -75,11 +75,11 @@ const actions = computed(() => { diff --git a/theme/src/client/components/LocalNav.vue b/theme/src/client/components/LocalNav.vue index 29a4a7ca..6adb41fd 100644 --- a/theme/src/client/components/LocalNav.vue +++ b/theme/src/client/components/LocalNav.vue @@ -71,17 +71,18 @@ const showLocalNav = computed(() => { .local-nav { position: sticky; top: 0; - /*rtl:ignore*/ + + /* rtl:ignore */ left: 0; z-index: var(--vp-z-index-local-nav); display: flex; - justify-content: space-between; align-items: center; + justify-content: space-between; + width: 100%; + padding-top: var(--vp-layout-top-height, 0); + background-color: var(--vp-local-nav-bg-color); border-top: 1px solid var(--vp-c-gutter); border-bottom: 1px solid var(--vp-c-gutter); - padding-top: var(--vp-layout-top-height, 0px); - width: 100%; - background-color: var(--vp-local-nav-bg-color); transition: border-color 0.5s, background-color 0.5s; @@ -95,7 +96,7 @@ const showLocalNav = computed(() => { border-top-color: transparent; } -@media (min-width: 960px) { +@media (width >= 960px) { .local-nav { display: none; } @@ -111,9 +112,9 @@ const showLocalNav = computed(() => { display: flex; align-items: center; padding: 12px 24px 11px; - line-height: 24px; font-size: 12px; font-weight: 500; + line-height: 24px; color: var(--vp-c-text-2); transition: color 0.5s; } @@ -127,25 +128,25 @@ const showLocalNav = computed(() => { transition: color 0.25s; } -@media (min-width: 768px) { +@media (width >= 768px) { .menu { padding: 0 32px; } } .menu-icon { - margin-right: 8px; width: 16px; height: 16px; - fill: currentColor; + margin-right: 8px; + fill: currentcolor; } .top-link { display: block; padding: 12px 24px 11px; - line-height: 24px; font-size: 12px; font-weight: 500; + line-height: 24px; color: var(--vp-c-text-2); transition: color 0.5s; } @@ -155,7 +156,7 @@ const showLocalNav = computed(() => { transition: color 0.25s; } -@media (min-width: 768px) { +@media (width >= 768px) { .top-link { padding: 12px 32px 11px; } diff --git a/theme/src/client/components/LocalNavOutlineDropdown.vue b/theme/src/client/components/LocalNavOutlineDropdown.vue index d37c79c5..cc867e50 100644 --- a/theme/src/client/components/LocalNavOutlineDropdown.vue +++ b/theme/src/client/components/LocalNavOutlineDropdown.vue @@ -78,13 +78,13 @@ function scrollToTop() { } .local-nav-outline-dropdown button { + position: relative; display: block; font-size: 12px; font-weight: 500; line-height: 24px; color: var(--vp-c-text-2); transition: color 0.5s; - position: relative; } .local-nav-outline-dropdown button:hover { @@ -98,16 +98,16 @@ function scrollToTop() { .icon { display: inline-block; - vertical-align: middle; - margin-left: 2px; width: 14px; height: 14px; - fill: currentColor; + margin-left: 2px; + vertical-align: middle; + fill: currentcolor; } :deep(.outline-link) { - font-size: 14px; padding: 2px 0; + font-size: 14px; } .open > .icon { @@ -121,11 +121,11 @@ function scrollToTop() { left: 16px; display: grid; gap: 1px; - border: 1px solid var(--vp-c-border); - border-radius: 8px; - background-color: var(--vp-c-gutter); max-height: calc(var(--vp-vh, 100vh) - 86px); overflow: hidden auto; + background-color: var(--vp-c-gutter); + border: 1px solid var(--vp-c-border); + border-radius: 8px; box-shadow: var(--vp-shadow-3); } @@ -136,9 +136,9 @@ function scrollToTop() { .top-link { display: block; padding: 0 16px; - line-height: 48px; font-size: 14px; font-weight: 500; + line-height: 48px; color: var(--vp-c-brand-1); } diff --git a/theme/src/client/components/Nav/NavBar.vue b/theme/src/client/components/Nav/NavBar.vue index 3e6e67f9..4f606d73 100644 --- a/theme/src/client/components/Nav/NavBar.vue +++ b/theme/src/client/components/Nav/NavBar.vue @@ -61,36 +61,36 @@ watchPostEffect(() => { diff --git a/theme/src/client/components/Nav/NavBarAppearance.vue b/theme/src/client/components/Nav/NavBarAppearance.vue index b04ed1fd..05b8a8b4 100644 --- a/theme/src/client/components/Nav/NavBarAppearance.vue +++ b/theme/src/client/components/Nav/NavBarAppearance.vue @@ -16,7 +16,7 @@ const theme = useThemeLocaleData() display: none; } -@media (min-width: 1280px) { +@media (width >= 1280px) { .navbar-appearance { display: flex; align-items: center; diff --git a/theme/src/client/components/Nav/NavBarExtra.vue b/theme/src/client/components/Nav/NavBarExtra.vue index caf2a8f2..ddc824f4 100644 --- a/theme/src/client/components/Nav/NavBarExtra.vue +++ b/theme/src/client/components/Nav/NavBarExtra.vue @@ -55,13 +55,13 @@ const hasExtraContent = computed( margin-right: -12px; } -@media (min-width: 768px) { +@media (width >= 768px) { .navbar-extra { display: block; } } -@media (min-width: 1280px) { +@media (width >= 1280px) { .navbar-extra { display: none; } @@ -69,9 +69,9 @@ const hasExtraContent = computed( .trans-title { padding: 0 24px 0 12px; - line-height: 32px; font-size: 14px; font-weight: 700; + line-height: 32px; color: var(--vp-c-text-1); } diff --git a/theme/src/client/components/Nav/NavBarHamburger.vue b/theme/src/client/components/Nav/NavBarHamburger.vue index 45f6809b..708af8a0 100644 --- a/theme/src/client/components/Nav/NavBarHamburger.vue +++ b/theme/src/client/components/Nav/NavBarHamburger.vue @@ -27,13 +27,13 @@ defineEmits<(e: 'click') => void>() diff --git a/theme/src/client/components/Nav/NavBarSocialLinks.vue b/theme/src/client/components/Nav/NavBarSocialLinks.vue index 9f1f494c..02c84746 100644 --- a/theme/src/client/components/Nav/NavBarSocialLinks.vue +++ b/theme/src/client/components/Nav/NavBarSocialLinks.vue @@ -18,7 +18,7 @@ const theme = useThemeLocaleData() display: none; } -@media (min-width: 1280px) { +@media (width >= 1280px) { .navbar-social-links { display: flex; align-items: center; diff --git a/theme/src/client/components/Nav/NavBarTitle.vue b/theme/src/client/components/Nav/NavBarTitle.vue index 7c3835bf..1846cf16 100644 --- a/theme/src/client/components/Nav/NavBarTitle.vue +++ b/theme/src/client/components/Nav/NavBarTitle.vue @@ -27,12 +27,12 @@ const { hasSidebar } = useSidebar() .title { display: flex; align-items: center; - border-bottom: 1px solid transparent; width: 100%; height: var(--vp-nav-height); font-size: 16px; font-weight: 600; color: var(--vp-c-text-1); + border-bottom: 1px solid transparent; transition: opacity 0.25s; } @@ -40,7 +40,7 @@ const { hasSidebar } = useSidebar() opacity: 0.6; } -@media (min-width: 960px) { +@media (width >= 960px) { .title { flex-shrink: 0; } @@ -51,7 +51,7 @@ const { hasSidebar } = useSidebar() } :deep(.logo) { - margin-right: 8px; height: 24px; + margin-right: 8px; } diff --git a/theme/src/client/components/Nav/NavBarTranslations.vue b/theme/src/client/components/Nav/NavBarTranslations.vue index c3b362f0..eebb752b 100644 --- a/theme/src/client/components/Nav/NavBarTranslations.vue +++ b/theme/src/client/components/Nav/NavBarTranslations.vue @@ -33,7 +33,7 @@ const { currentLang, localeLinks } = useLangs() display: none; } -@media (min-width: 1280px) { +@media (width >= 1280px) { .navbar-translations { display: flex; align-items: center; @@ -42,9 +42,9 @@ const { currentLang, localeLinks } = useLangs() .title { padding: 0 24px 0 12px; - line-height: 32px; font-size: 14px; font-weight: 700; + line-height: 32px; color: var(--vp-c-text-1); } diff --git a/theme/src/client/components/Nav/NavScreen.vue b/theme/src/client/components/Nav/NavScreen.vue index 26c7c3db..0af8d229 100644 --- a/theme/src/client/components/Nav/NavScreen.vue +++ b/theme/src/client/components/Nav/NavScreen.vue @@ -33,19 +33,18 @@ const isLocked = useScrollLock(inBrowser ? document.body : null) diff --git a/theme/src/client/components/Nav/NavScreenMenuGroup.vue b/theme/src/client/components/Nav/NavScreenMenuGroup.vue index f40608e3..b6f8803f 100644 --- a/theme/src/client/components/Nav/NavScreenMenuGroup.vue +++ b/theme/src/client/components/Nav/NavScreenMenuGroup.vue @@ -60,9 +60,9 @@ function toggle() { diff --git a/theme/src/client/components/Nav/index.vue b/theme/src/client/components/Nav/index.vue index d20b7ecb..ca2a4586 100644 --- a/theme/src/client/components/Nav/index.vue +++ b/theme/src/client/components/Nav/index.vue @@ -29,8 +29,9 @@ provide('close-screen', closeScreen) diff --git a/theme/src/client/components/PostItem.vue b/theme/src/client/components/PostItem.vue index ae0a69fe..a85070e3 100644 --- a/theme/src/client/components/PostItem.vue +++ b/theme/src/client/components/PostItem.vue @@ -65,6 +65,12 @@ const createTime = computed(() => { .post-item { padding-top: 1rem; margin: 0 1.75rem 2rem; + + @media (width >= 960px) { + h3 { + font-size: 20px; + } + } // border-bottom: solid 1px var(--vp-c-divider); &:last-of-type { @@ -74,10 +80,10 @@ const createTime = computed(() => { h3 { display: flex; align-items: center; + margin-bottom: 0.75rem; font-size: 18px; font-weight: 600; transition: color var(--t-color); - margin-bottom: 0.75rem; } h3:hover { @@ -88,34 +94,28 @@ const createTime = computed(() => { } } - @media (min-width: 960px) { - h3 { - font-size: 20px; - } - } - .sticky { display: inline-block; - font-weight: 600; padding: 3px 6px; margin-left: 0.5rem; - border-radius: 4px; - line-height: 1; font-size: 13px; + font-weight: 600; + line-height: 1; color: var(--vp-c-text-2); background-color: var(--vp-c-default-soft); + border-radius: 4px; } } .post-meta { display: flex; + flex-wrap: wrap; align-items: center; justify-content: flex-start; - flex-wrap: wrap; + margin-bottom: 0.5rem; font-size: 14px; font-weight: 400; color: var(--vp-c-text-2); - margin-bottom: 0.5rem; > div { display: flex; @@ -148,9 +148,11 @@ const createTime = computed(() => { .plume-content :deep(p) { margin: 0.5rem 0; } + .plume-content :deep(p:first-of-type) { margin-top: 0; } + .plume-content :deep(p:last-of-type) { margin-bottom: 0; } diff --git a/theme/src/client/components/PostList.vue b/theme/src/client/components/PostList.vue index 2b90265c..968d7304 100644 --- a/theme/src/client/components/PostList.vue +++ b/theme/src/client/components/PostList.vue @@ -31,8 +31,8 @@ const { diff --git a/theme/src/client/components/ShortPostList.vue b/theme/src/client/components/ShortPostList.vue index 51bb5568..9b835b57 100644 --- a/theme/src/client/components/ShortPostList.vue +++ b/theme/src/client/components/ShortPostList.vue @@ -25,8 +25,8 @@ defineProps<{ diff --git a/theme/src/client/components/SidebarItem.vue b/theme/src/client/components/SidebarItem.vue index 1ca964f2..28d98cdb 100644 --- a/theme/src/client/components/SidebarItem.vue +++ b/theme/src/client/components/SidebarItem.vue @@ -147,8 +147,8 @@ function onCaretClick() { .text { flex-grow: 1; padding: 4px 0; - line-height: 24px; font-size: 14px; + line-height: 24px; transition: color 0.25s; } @@ -195,11 +195,11 @@ function onCaretClick() { .caret { display: flex; - justify-content: center; align-items: center; - margin-right: -7px; + justify-content: center; width: 32px; height: 32px; + margin-right: -7px; color: var(--vp-c-text-3); cursor: pointer; transition: color 0.25s; @@ -216,9 +216,9 @@ function onCaretClick() { .caret-icon { width: 18px; height: 18px; - fill: currentColor; - transform: rotate(90deg); + fill: currentcolor; transition: transform 0.25s; + transform: rotate(90deg); } .sidebar-item.collapsed .caret-icon { @@ -230,8 +230,8 @@ function onCaretClick() { .sidebar-item.level-3 .items, .sidebar-item.level-4 .items, .sidebar-item.level-5 .items { - border-left: 1px solid var(--vp-c-divider); padding-left: 16px; + border-left: 1px solid var(--vp-c-divider); } .sidebar-item.collapsed .items { diff --git a/theme/src/client/components/SkipLink.vue b/theme/src/client/components/SkipLink.vue index a4eb6070..b9c73e00 100644 --- a/theme/src/client/components/SkipLink.vue +++ b/theme/src/client/components/SkipLink.vue @@ -44,25 +44,25 @@ function focusOnTargetAnchor({ target }: Event) { .skip-link { top: 8px; left: 8px; - padding: 8px 16px; z-index: 999; - border-radius: 8px; + padding: 8px 16px; font-size: 12px; font-weight: bold; - text-decoration: none; color: var(--vp-c-brand-1); - box-shadow: var(--vp-shadow-3); + text-decoration: none; background-color: var(--vp-c-bg); + border-radius: 8px; + box-shadow: var(--vp-shadow-3); } .skip-link:focus { - height: auto; width: auto; + height: auto; clip: auto; clip-path: none; } -@media (min-width: 1280px) { +@media (width >= 1280px) { .skip-link { top: 14px; left: 16px; diff --git a/theme/src/client/components/SocialLink.vue b/theme/src/client/components/SocialLink.vue index 0fe81894..fb866493 100644 --- a/theme/src/client/components/SocialLink.vue +++ b/theme/src/client/components/SocialLink.vue @@ -29,8 +29,8 @@ const svg = computed(() => { diff --git a/theme/src/client/components/Switch.vue b/theme/src/client/components/Switch.vue index 6d997e03..05eba422 100644 --- a/theme/src/client/components/Switch.vue +++ b/theme/src/client/components/Switch.vue @@ -11,13 +11,13 @@ diff --git a/theme/src/client/components/Tags.vue b/theme/src/client/components/Tags.vue index 26a0d738..1e4a8e8e 100644 --- a/theme/src/client/components/Tags.vue +++ b/theme/src/client/components/Tags.vue @@ -37,69 +37,75 @@ const { tags: tagsLink } = useBlogExtract() diff --git a/theme/src/client/components/VFooter.vue b/theme/src/client/components/VFooter.vue index 2b45dec2..a293aa14 100644 --- a/theme/src/client/components/VFooter.vue +++ b/theme/src/client/components/VFooter.vue @@ -31,9 +31,9 @@ const { hasSidebar } = useSidebar() .plume-footer { position: relative; z-index: var(--vp-z-index-footer); - border-top: 1px solid var(--vp-c-gutter); padding: 32px 24px; background-color: var(--vp-c-bg); + border-top: 1px solid var(--vp-c-gutter); transition: all 0.25s; } @@ -54,23 +54,23 @@ const { hasSidebar } = useSidebar() text-underline-offset: 4px; } -@media (min-width: 768px) { +@media (width >= 768px) { .plume-footer { padding: 32px; } } .container { - margin: 0 auto; max-width: var(--vp-layout-max-width); + margin: 0 auto; text-align: center; } .message, .copyright { - line-height: 24px; font-size: 14px; font-weight: 500; + line-height: 24px; color: var(--vp-c-text-2); } diff --git a/theme/src/client/components/global/Badge.vue b/theme/src/client/components/global/Badge.vue index 32e3b55f..5adc871b 100644 --- a/theme/src/client/components/global/Badge.vue +++ b/theme/src/client/components/global/Badge.vue @@ -18,13 +18,13 @@ withDefaults(defineProps(), { diff --git a/theme/src/client/components/global/ExternalLinkIcon.vue b/theme/src/client/components/global/ExternalLinkIcon.vue index db7214fe..190a68f3 100644 --- a/theme/src/client/components/global/ExternalLinkIcon.vue +++ b/theme/src/client/components/global/ExternalLinkIcon.vue @@ -9,11 +9,11 @@ import IconExternalLink from '../icons/IconExternalLink.vue' diff --git a/theme/src/client/composables/index.ts b/theme/src/client/composables/index.ts index 77c180f4..7b4e0e11 100644 --- a/theme/src/client/composables/index.ts +++ b/theme/src/client/composables/index.ts @@ -8,3 +8,4 @@ export * from './page.js' export * from './readingTime.js' export * from './blog.js' export * from './locale.js' +export * from './useRouteQuery.js' diff --git a/theme/src/client/layouts/NotFound.vue b/theme/src/client/layouts/NotFound.vue index 892794e3..96155109 100644 --- a/theme/src/client/layouts/NotFound.vue +++ b/theme/src/client/layouts/NotFound.vue @@ -46,36 +46,36 @@ const themeData = useThemeLocaleData() text-align: center; } -@media (min-width: 768px) { +@media (width >= 768px) { .not-found { padding: 96px 32px 168px; } } .code { - line-height: 64px; font-size: 64px; font-weight: 600; + line-height: 64px; } .title { padding-top: 12px; - letter-spacing: 2px; - line-height: 20px; font-size: 20px; font-weight: 700; + line-height: 20px; + letter-spacing: 2px; } .divider { - margin: 24px auto 18px; width: 64px; height: 1px; + margin: 24px auto 18px; background-color: var(--vp-c-divider); } .quote { - margin: 0 auto; max-width: 256px; + margin: 0 auto; font-size: 14px; font-weight: 500; color: var(--vp-c-text-2); @@ -87,19 +87,19 @@ const themeData = useThemeLocaleData() .link { display: inline-block; - border: 1px solid var(--vp-c-brand); - border-radius: 16px; padding: 3px 16px; font-size: 14px; font-weight: 500; color: var(--vp-c-brand); + border: 1px solid var(--vp-c-brand); + border-radius: 16px; transition: border-color 0.25s, color 0.25s; } .link:hover { - border-color: var(--vp-c-brand-dark); color: var(--vp-c-brand-dark); + border-color: var(--vp-c-brand-dark); } diff --git a/theme/src/client/styles/code.scss b/theme/src/client/styles/code.scss index 02fa7182..1af415c7 100644 --- a/theme/src/client/styles/code.scss +++ b/theme/src/client/styles/code.scss @@ -9,19 +9,19 @@ html:not(.dark) .vp-code span { .plume-content { pre { padding: 1.3rem 1.5rem; - margin: 0 0 0.85rem 0; - border-radius: 6px; + margin: 0 0 0.85rem; overflow: auto; + font-size: 14px; + border-radius: 6px; scrollbar-width: thin; scrollbar-color: var(--vp-c-brand-1) var(--vp-c-border); - font-size: 14px; code { - color: #fff; padding: 0; + color: #fff; + overflow-wrap: unset; background-color: transparent; border-radius: 0; - overflow-wrap: unset; -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; } @@ -32,26 +32,26 @@ html:not(.dark) .vp-code span { } .code-tabs { - .div[class*='language-'] { + .div[class*="language-"] { border-top-left-radius: 0; border-top-right-radius: 0; } } } -div[class*='language-'] { +div[class*="language-"] { position: relative; background-color: var(--vp-code-block-bg); border-radius: 6px; &::before { - content: attr(data-ext); position: absolute; - z-index: 3; top: 0.8em; right: 1em; + z-index: 3; font-size: 0.75rem; color: var(--vp-code-line-number-color); + content: attr(data-ext); } code { @@ -60,20 +60,21 @@ div[class*='language-'] { } pre { - // force override the background color to be compatible with shiki - background: transparent !important; position: relative; z-index: 1; + + // force override the background color to be compatible with shiki + background: transparent !important; } .highlight-lines { - user-select: none; - padding-top: 1.3rem; position: absolute; top: 0; left: 0; width: 100%; + padding-top: 1.3rem; line-height: 1.5; + user-select: none; .highlight-line { background-color: var(--vp-c-default-soft); @@ -91,19 +92,19 @@ div[class*='language-'] { position: relative; &::before { - content: ' '; position: absolute; - z-index: 2; - left: 0; top: 0; + left: 0; + z-index: 2; display: block; height: 100%; + content: " "; } } pre { - margin-left: 2rem; padding-left: 1rem; + margin-left: 2rem; vertical-align: middle; } @@ -111,40 +112,40 @@ div[class*='language-'] { position: absolute; top: 0; left: 0; + z-index: 1; width: 2rem; height: 100%; - text-align: center; - z-index: 1; - color: var(--vp-code-line-number-color); padding-top: 1.25rem; line-height: var(--vp-code-line-height); + color: var(--vp-code-line-number-color); + text-align: center; counter-reset: line-number; border-right: var(--vp-code-block-divider-color) 1px solid; .line-number { position: relative; z-index: 3; - user-select: none; height: 1.5rem; + user-select: none; &::before { - counter-increment: line-number; - content: counter(line-number); font-size: 0.85em; + content: counter(line-number); + counter-increment: line-number; } } } } } -.plume-content [class*='language-'] code .highlighted { +.plume-content [class*="language-"] code .highlighted { + z-index: 2; + display: inline-block; + width: calc(100% + 2 * 24px); + padding: 0 24px; + margin: 0 -24px; background-color: var(--vp-code-line-highlight-color); transition: background-color 0.5s; - margin: 0 -24px; - padding: 0 24px; - width: calc(100% + 2 * 24px); - display: inline-block; - z-index: 2; &.error { background-color: var(--vp-code-line-error-color); @@ -155,12 +156,12 @@ div[class*='language-'] { } } -.plume-content [class*='language-'] code .diff { - transition: background-color 0.5s; - margin: 0 -24px; - padding: 0 24px; - width: calc(100% + 2 * 24px); +.plume-content [class*="language-"] code .diff { display: inline-block; + width: calc(100% + 2 * 24px); + padding: 0 24px; + margin: 0 -24px; + transition: background-color 0.5s; &::before { position: absolute; @@ -173,8 +174,8 @@ div[class*='language-'] { } &.remove::before { - content: '-'; color: var(--vp-code-line-diff-remove-symbol-color); + content: "-"; transform: translateX(-6px); } @@ -183,13 +184,13 @@ div[class*='language-'] { } &.add::before { - content: '+'; color: var(--vp-code-line-diff-add-symbol-color); + content: "+"; transform: translateX(-6px); } } -.plume-content [class*='language-'] .has-focused-lines .line:not(.has-focus) { +.plume-content [class*="language-"] .has-focused-lines .line:not(.has-focus) { filter: blur(0.095rem); opacity: 0.7; transition: @@ -197,27 +198,24 @@ div[class*='language-'] { opacity 0.35s; } -.plume-content - [class*='language-']:hover - .has-focused-lines - .line:not(.has-focus) { +.plume-content [class*="language-"]:hover .has-focused-lines .line:not(.has-focus) { filter: blur(0); opacity: 1; } .code-tabs-nav { - margin-bottom: 0rem; + margin-bottom: 0; } // narrow mobile -@media (max-width: 419px) { +@media (width <= 419px) { .plume-content { - div[class*='language-'] { + div[class*="language-"] { margin: 0.85rem -1.5rem; border-radius: 0; } - .hint-container div[class*='language-'] { + .hint-container div[class*="language-"] { margin: 0.85rem -1rem 0.85rem -1.25rem; } } diff --git a/theme/src/client/styles/content.scss b/theme/src/client/styles/content.scss index 8946d105..8ac8e934 100644 --- a/theme/src/client/styles/content.scss +++ b/theme/src/client/styles/content.scss @@ -14,18 +14,18 @@ } .plume-content h1 { - letter-spacing: -0.02em; - line-height: 40px; font-size: 28px; + line-height: 40px; + letter-spacing: -0.02em; } .plume-content h2 { - margin: 48px 0 16px; - border-top: 1px solid var(--vp-c-divider); padding-top: 24px; - letter-spacing: -0.02em; - line-height: 32px; + margin: 48px 0 16px; font-size: 24px; + line-height: 32px; + letter-spacing: -0.02em; + border-top: 1px solid var(--vp-c-divider); } .plume-content h2:first-of-type { @@ -34,15 +34,15 @@ .plume-content h3 { margin: 32px 0 0; - letter-spacing: -0.01em; - line-height: 28px; font-size: 20px; + line-height: 28px; + letter-spacing: -0.01em; } .plume-content .header-anchor { float: left; - margin-left: -0.87em; padding-right: 0.23em; + margin-left: -0.87em; font-weight: 500; user-select: none; opacity: 0; @@ -66,11 +66,11 @@ opacity: 1; } -@media (min-width: 768px) { +@media (width >= 768px) { .plume-content h1 { - letter-spacing: -0.02em; - line-height: 40px; font-size: 32px; + line-height: 40px; + letter-spacing: -0.02em; } } @@ -100,9 +100,9 @@ } .plume-content blockquote { + padding-left: 16px; margin: 16px 0; border-left: 2px solid var(--vp-c-divider); - padding-left: 16px; transition: border-color 0.5s; } @@ -166,9 +166,9 @@ .plume-content table { display: block; - border-collapse: collapse; margin: 20px 0; overflow-x: auto; + border-collapse: collapse; } .plume-content tr { @@ -183,15 +183,15 @@ .plume-content th, .plume-content td { - border: 1px solid var(--vp-c-divider); padding: 8px 16px; + border: 1px solid var(--vp-c-divider); } .plume-content th { - text-align: left; font-size: 14px; font-weight: 600; color: var(--vp-c-text-2); + text-align: left; background-color: var(--vp-c-bg-soft); } @@ -263,9 +263,9 @@ } .plume-content :not(pre) > code { - border-radius: 4px; padding: 3px 6px; background-color: var(--vp-code-bg); + border-radius: 4px; transition: color 0.25s, background-color 0.5s; diff --git a/theme/src/client/styles/fonts.scss b/theme/src/client/styles/fonts.scss index 394728cc..d1a4eee9 100644 --- a/theme/src/client/styles/fonts.scss +++ b/theme/src/client/styles/fonts.scss @@ -1,165 +1,239 @@ /* webfont-marker-begin */ -@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap'); +@import "https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap"; html body { font-synthesis: style; } + /* webfont-marker-end */ @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: normal; - font-named-instance: 'Regular'; - src: url('../fonts/inter-roman-cyrillic.woff2') format('woff2'); + font-weight: 100 900; + src: url("../fonts/inter-roman-cyrillic.woff2") format("woff2"); + font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; + font-named-instance: "Regular"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: normal; - font-named-instance: 'Regular'; - src: url('../fonts/inter-roman-cyrillic-ext.woff2') format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, + font-weight: 100 900; + src: url("../fonts/inter-roman-cyrillic-ext.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0460-052F, + U+1C80-1C88, + U+20B4, + U+2DE0-2DFF, + U+A640-A69F, U+FE2E-FE2F; + font-named-instance: "Regular"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: normal; - font-named-instance: 'Regular'; - src: url('../fonts/inter-roman-greek.woff2') format('woff2'); + font-weight: 100 900; + src: url("../fonts/inter-roman-greek.woff2") format("woff2"); + font-display: swap; unicode-range: U+0370-03FF; + font-named-instance: "Regular"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: normal; - font-named-instance: 'Regular'; - src: url('../fonts/inter-roman-greek-ext.woff2') format('woff2'); + font-weight: 100 900; + src: url("../fonts/inter-roman-greek-ext.woff2") format("woff2"); + font-display: swap; unicode-range: U+1F00-1FFF; + font-named-instance: "Regular"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: normal; - font-named-instance: 'Regular'; - src: url('../fonts/inter-roman-latin.woff2') format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; + font-weight: 100 900; + src: url("../fonts/inter-roman-latin.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0000-00FF, + U+0131, + U+0152-0153, + U+02BB-02BC, + U+02C6, + U+02DA, + U+02DC, + U+2000-206F, + U+2074, + U+20AC, + U+2122, + U+2191, + U+2193, + U+2212, + U+2215, + U+FEFF, + U+FFFD; + font-named-instance: "Regular"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: normal; - font-named-instance: 'Regular'; - src: url('../fonts/inter-roman-latin-ext.woff2') format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; + font-weight: 100 900; + src: url("../fonts/inter-roman-latin-ext.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0100-024F, + U+0259, + U+1E00-1EFF, + U+2020, + U+20A0-20AB, + U+20AD-20CF, + U+2113, + U+2C60-2C7F, + U+A720-A7FF; + font-named-instance: "Regular"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: normal; - font-named-instance: 'Regular'; - src: url('../fonts/inter-roman-vietnamese.woff2') format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; + font-weight: 100 900; + src: url("../fonts/inter-roman-vietnamese.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0102-0103, + U+0110-0111, + U+0128-0129, + U+0168-0169, + U+01A0-01A1, + U+01AF-01B0, + U+1EA0-1EF9, + U+20AB; + font-named-instance: "Regular"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: italic; - font-named-instance: 'Italic'; - src: url('../fonts/inter-italic-cyrillic.woff2') format('woff2'); + font-weight: 100 900; + src: url("../fonts/inter-italic-cyrillic.woff2") format("woff2"); + font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; + font-named-instance: "Italic"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: italic; - font-named-instance: 'Italic'; - src: url('../fonts/inter-italic-cyrillic-ext.woff2') format('woff2'); - unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, + font-weight: 100 900; + src: url("../fonts/inter-italic-cyrillic-ext.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0460-052F, + U+1C80-1C88, + U+20B4, + U+2DE0-2DFF, + U+A640-A69F, U+FE2E-FE2F; + font-named-instance: "Italic"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: italic; - font-named-instance: 'Italic'; - src: url('../fonts/inter-italic-greek.woff2') format('woff2'); + font-weight: 100 900; + src: url("../fonts/inter-italic-greek.woff2") format("woff2"); + font-display: swap; unicode-range: U+0370-03FF; + font-named-instance: "Italic"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: italic; - font-named-instance: 'Italic'; - src: url('../fonts/inter-italic-greek-ext.woff2') format('woff2'); + font-weight: 100 900; + src: url("../fonts/inter-italic-greek-ext.woff2") format("woff2"); + font-display: swap; unicode-range: U+1F00-1FFF; + font-named-instance: "Italic"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: italic; - font-named-instance: 'Italic'; - src: url('../fonts/inter-italic-latin.woff2') format('woff2'); - unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, - U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, - U+FEFF, U+FFFD; + font-weight: 100 900; + src: url("../fonts/inter-italic-latin.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0000-00FF, + U+0131, + U+0152-0153, + U+02BB-02BC, + U+02C6, + U+02DA, + U+02DC, + U+2000-206F, + U+2074, + U+20AC, + U+2122, + U+2191, + U+2193, + U+2212, + U+2215, + U+FEFF, + U+FFFD; + font-named-instance: "Italic"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: italic; - font-named-instance: 'Italic'; - src: url('../fonts/inter-italic-latin-ext.woff2') format('woff2'); - unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, - U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; + font-weight: 100 900; + src: url("../fonts/inter-italic-latin-ext.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0100-024F, + U+0259, + U+1E00-1EFF, + U+2020, + U+20A0-20AB, + U+20AD-20CF, + U+2113, + U+2C60-2C7F, + U+A720-A7FF; + font-named-instance: "Italic"; } @font-face { - font-family: 'Inter var'; - font-weight: 100 900; - font-display: swap; + font-family: "Inter var"; font-style: italic; - font-named-instance: 'Italic'; - src: url('../fonts/inter-italic-vietnamese.woff2') format('woff2'); - unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, - U+01AF-01B0, U+1EA0-1EF9, U+20AB; + font-weight: 100 900; + src: url("../fonts/inter-italic-vietnamese.woff2") format("woff2"); + font-display: swap; + unicode-range: + U+0102-0103, + U+0110-0111, + U+0128-0129, + U+0168-0169, + U+01A0-01A1, + U+01AF-01B0, + U+1EA0-1EF9, + U+20AB; + font-named-instance: "Italic"; } /* Chinese quotes rendering fix. 中英文弯引号共享 Unicode 码位,确保引号使用中文字体渲染 */ @font-face { - font-family: 'Chinese Quotes'; - src: local('PingFang SC Regular'), local('PingFang SC'), local('SimHei'), - local('Source Han Sans SC'); + font-family: "Chinese Quotes"; + src: + local("PingFang SC Regular"), + local("PingFang SC"), + local("SimHei"), + local("Source Han Sans SC"); unicode-range: U+2018, U+2019, U+201C, U+201D; /* 分别是 ‘’“” */ } diff --git a/theme/src/client/styles/index.scss b/theme/src/client/styles/index.scss index eedffd8c..47417456 100644 --- a/theme/src/client/styles/index.scss +++ b/theme/src/client/styles/index.scss @@ -1,13 +1,11 @@ -@import '@vuepress/plugin-palette/palette'; - -@import 'vars'; -@import 'fonts'; -@import 'normalize'; -@import 'nprogress'; -@import 'utils'; -@import 'content'; -@import 'code'; -@import 'md-enhance'; -@import 'search'; - -@import '@vuepress/plugin-palette/style'; +@import "@vuepress/plugin-palette/palette"; +@import "vars"; +@import "fonts"; +@import "normalize"; +@import "nprogress"; +@import "utils"; +@import "content"; +@import "code"; +@import "md-enhance"; +@import "search"; +@import "@vuepress/plugin-palette/style"; diff --git a/theme/src/client/styles/md-enhance.scss b/theme/src/client/styles/md-enhance.scss index 53d8f906..d676d233 100644 --- a/theme/src/client/styles/md-enhance.scss +++ b/theme/src/client/styles/md-enhance.scss @@ -1,14 +1,20 @@ .plume-content { + @media (width <= 419px) { + .vp-code-demo { + margin: 8px -12px; + } + } + .hint-container { - border-radius: 8px; padding: 16px 16px 8px; - line-height: 24px; font-size: var(--vp-custom-block-font-size); + line-height: 24px; color: var(--vp-c-text-2); + border-radius: 8px; .hint-container-title { - font-weight: 600; margin-top: 0; + font-weight: 600; } p + p { @@ -20,18 +26,18 @@ color: inherit; } - div[class*='language-'] { + div[class*="language-"] { margin: 8px 0; } - div[class*='language-'] code { + div[class*="language-"] code { font-weight: 400; background-color: transparent; } &.note { - border-radius: 0; color: var(--vp-c-text-3); + border-radius: 0; } &.info { @@ -56,8 +62,8 @@ summary { margin: -1.5rem -1.5rem -1.1rem; font-weight: 700; - cursor: pointer; color: var(--vp-c-text-1); + cursor: pointer; } summary + p { @@ -73,39 +79,46 @@ code { color: var(--vp-c-brand-1); } + a:hover { color: var(--vp-c-brand-2); } } + &.important { a, code { color: var(--vp-c-purple-1); } + a:hover { color: var(--vp-c-purple-2); } } + &.warning { a, code { color: var(--vp-c-warning-1); } + a:hover { color: var(--vp-c-warning-2); } } + &.caution { a, code { color: var(--vp-c-danger-1); } + a:hover { color: var(--vp-c-danger-2); } } - [class*='language-'] .line-numbers { + [class*="language-"] .line-numbers { padding-top: 21px; } @@ -117,8 +130,15 @@ } .vp-code-demo { - border: solid 1px var(--vp-c-divider); overflow: hidden; + border: solid 1px var(--vp-c-divider); + + @media (width <= 419px) { + .vp-code-demo-codes div[class*="language-"] { + margin: 0; + border-radius: 0; + } + } &:hover { box-shadow: none; @@ -155,38 +175,27 @@ background-color: transparent; } - .vp-code-demo-codes div[class*='language-'] { + .vp-code-demo-codes div[class*="language-"] { border-bottom: 2px dashed var(--vp-c-divider); &:first-of-type { border-top: 1px solid var(--vp-c-divider); } + &:last-of-type { border-bottom: none; } } - .vp-code-demo-codes div[class*='language-'] pre { + .vp-code-demo-codes div[class*="language-"] pre { margin-bottom: 0; border-radius: 0; } - - @media (max-width: 419px) { - .vp-code-demo-codes div[class*='language-'] { - margin: 0; - border-radius: 0; - } - } - } - - @media (max-width: 419px) { - .vp-code-demo { - margin: 8px -12px; - } } .task-list-container { padding-left: 0; + .task-list-item { input { width: 0; @@ -194,30 +203,169 @@ padding: 0; margin: 0; } + label { margin-left: 1.2em; } + input::before, input::after { - content: none; position: absolute; top: -1em; left: 0; - font-size: 1em; display: inline-block; + font-size: 1em; + content: none; } input::after { content: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" viewBox="0 0 32 32"%3E%3Cpath fill="%23c2c2c4" d="M26 27.5H6A1.5 1.5 0 0 1 4.5 26V6c0-.83.67-1.5 1.5-1.5h20c.828 0 1.5.67 1.5 1.5v20a1.5 1.5 0 0 1-1.5 1.5m-18.5-3h17v-17h-17z"%2F%3E%3C%2Fsvg%3E'); - border: none; background-color: transparent; + border: none; } input:checked[disabled]::after { content: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" viewBox="0 0 32 32"%3E%3Cpath fill="%23299764" d="M29.548 3.043a2.5 2.5 0 0 0-3.513.4L16 16.067l-3.508-4.414a2.5 2.5 0 0 0-3.915 3.112l5.465 6.875c.474.597 1.195.943 1.957.943s1.482-.35 1.957-.944L29.95 6.555c.86-1.08.68-2.654-.402-3.513zM24.5 24.5h-17v-17h12.756l2.385-3H6c-.83 0-1.5.67-1.5 1.5v20c0 .828.67 1.5 1.5 1.5h20a1.5 1.5 0 0 0 1.5-1.5V12.85l-3 3.774z"%2F%3E%3C%2Fsvg%3E'); - border: none; background-color: transparent; + border: none; } } } + + .vp-tabs { + margin: 1.5rem -0.75rem; + overflow: hidden; + border: 1px solid var(--vp-c-divider); + } + + .hint-container .vp-tabs { + margin: 1rem -0.45rem 1rem -0.75rem; + + .vp-tab { + padding: 0.45rem 0.75rem; + font-size: 14px; + + p { + margin: 8px 0; + } + } + } + + .footnotes-sep { + margin-top: 48px; + } + + .footnotes { + position: relative; + padding: 48px 0 12px 16px; + margin-left: -16px; + font-size: 14px; + border-left: 4px solid var(--vp-c-default-soft); + + @media (width >= 419px) { + & { + margin-left: 0; + } + } + + &::before { + position: absolute; + top: 12px; + left: 16px; + font-size: 16px; + font-weight: 700; + + [lang="zh-CN"] & { + content: "脚注:"; + } + + [lang="en-US"] & { + content: "Footnotes:"; + } + } + + ol { + margin: 0; + + p { + margin: 8px 0; + } + + li:first-of-type p:first-of-type { + margin-top: 0; + } + + li:last-of-type p:last-of-type { + margin-bottom: 0; + } + } + } + + .footnote-item { + padding-top: 0; + margin-top: 0; + + > p { + margin-bottom: 0; + } + } + + .footnote-backref { + position: relative; + color: transparent; + text-decoration: none; + + &:hover { + color: transparent; + } + + &::before { + position: absolute; + top: -0.4em; + left: 0; + font-size: 1em; + content: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="1em" height="1em" viewBox="0 0 48 48"%3E%3Cg fill="none" stroke="%23c2c2c4" stroke-linecap="round" stroke-linejoin="round" stroke-width="4"%3E%3Cpath d="m13 8l-7 6l7 7"%2F%3E%3Cpath d="M6 14h22.994c6.883 0 12.728 5.62 12.996 12.5c.284 7.27-5.723 13.5-12.996 13.5H11.998"%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E'); + } + } + + .footnote-anchor { + top: 0; + } +} + +.plume-content { + figure { + position: relative; + display: flex; + flex-direction: column; + width: auto; + margin: 1rem auto; + text-align: center; + + img { + margin: 0 auto; + overflow: hidden; + } + + > a { + &[href^="http://"], + &[href^="https://"] { + &::after { + @media print { + content: ""; + } + } + } + + .external-icon { + display: none; + } + } + + figcaption { + display: inline-block; + margin: 6px auto; + font-size: 0.8rem; + } + } } diff --git a/theme/src/client/styles/normalize.scss b/theme/src/client/styles/normalize.scss index 6acd1076..0810c23f 100644 --- a/theme/src/client/styles/normalize.scss +++ b/theme/src/client/styles/normalize.scss @@ -2,13 +2,13 @@ *, ::before, ::after { - animation-delay: -1ms !important; - animation-duration: 1ms !important; - animation-iteration-count: 1 !important; background-attachment: initial !important; - scroll-behavior: auto !important; - transition-duration: 0s !important; transition-delay: 0s !important; + transition-duration: 0s !important; + animation-duration: 1ms !important; + animation-delay: -1ms !important; + animation-iteration-count: 1 !important; + scroll-behavior: auto !important; } } @@ -28,7 +28,7 @@ html { body { -webkit-text-size-adjust: 100%; font-synthesis: none; - text-rendering: optimizeLegibility; + text-rendering: optimizelegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } @@ -38,13 +38,13 @@ html.dark { } body { - margin: 0; width: 100%; min-width: 320px; min-height: 100vh; - line-height: 24px; + margin: 0; font-family: var(--vp-font-family-base); font-weight: 400; + line-height: 24px; direction: ltr; } @@ -52,8 +52,8 @@ html, body { color: var(--vp-c-text-1); background-color: var(--vp-c-bg); - transition-duration: 0.25s; transition-timing-function: ease; + transition-duration: 0.25s; transition-property: color, background-color; } @@ -68,9 +68,9 @@ h4, h5, h6 { margin: 0; - line-height: 24px; font-size: 16px; font-weight: 400; + line-height: 24px; } p { @@ -100,7 +100,7 @@ b { a, area, button, -[role='button'], +[role="button"], input, label, select, @@ -116,9 +116,9 @@ a { ol, ul { - list-style: none; - margin: 0; padding: 0; + margin: 0; + list-style: none; } blockquote { @@ -158,10 +158,10 @@ input, optgroup, select, textarea { - border: 0; padding: 0; line-height: inherit; color: inherit; + border: 0; } button { @@ -172,7 +172,7 @@ button { } button:enabled, -[role='button']:enabled { +[role="button"]:enabled { cursor: pointer; } @@ -220,11 +220,11 @@ textarea::placeholder { input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { - -webkit-appearance: none; margin: 0; + -webkit-appearance: none; } -input[type='number'] { +input[type="number"] { -moz-appearance: textfield; appearance: textfield; } @@ -239,8 +239,8 @@ select { } fieldset { - margin: 0; padding: 0; + margin: 0; } h1, diff --git a/theme/src/client/styles/search.scss b/theme/src/client/styles/search.scss index d6fe52bf..529d28e0 100644 --- a/theme/src/client/styles/search.scss +++ b/theme/src/client/styles/search.scss @@ -1,8 +1,8 @@ .search-box .suggestions { - box-shadow: var(--vp-shadow-3); top: 2.5rem; right: -1rem; - border-radius: 12px; padding: 16px 12px; background-color: var(--vp-c-bg); + border-radius: 12px; + box-shadow: var(--vp-shadow-3); } diff --git a/theme/src/client/styles/utils.scss b/theme/src/client/styles/utils.scss index ddb87b22..41bfe23e 100644 --- a/theme/src/client/styles/utils.scss +++ b/theme/src/client/styles/utils.scss @@ -2,10 +2,10 @@ position: absolute; width: 1px; height: 1px; - white-space: nowrap; + overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); - overflow: hidden; + white-space: nowrap; } .icon { diff --git a/theme/src/client/styles/vars.scss b/theme/src/client/styles/vars.scss index 82004a03..175cf89a 100644 --- a/theme/src/client/styles/vars.scss +++ b/theme/src/client/styles/vars.scss @@ -3,9 +3,8 @@ * -------------------------------------------------------------------------- */ :root { - --vp-c-white: #ffffff; - --vp-c-black: #000000; - + --vp-c-white: #fff; + --vp-c-black: #000; --vp-c-neutral: var(--vp-c-black); --vp-c-neutral-inverse: var(--vp-c-white); } @@ -125,9 +124,9 @@ * -------------------------------------------------------------------------- */ :root { - --vp-c-bg: #ffffff; + --vp-c-bg: #fff; --vp-c-bg-alt: #f6f6f7; - --vp-c-bg-elv: #ffffff; + --vp-c-bg-elv: #fff; --vp-c-bg-soft: #f6f6f7; } @@ -160,7 +159,7 @@ .dark { --vp-c-border: #3c3f44; --vp-c-divider: #2e2e32; - --vp-c-gutter: #000000; + --vp-c-gutter: #000; } /** @@ -245,12 +244,35 @@ * -------------------------------------------------------------------------- */ :root { - --vp-font-family-base: 'Chinese Quotes', 'Inter var', 'Inter', ui-sans-serif, - system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, - 'Helvetica Neue', Helvetica, Arial, 'Noto Sans', sans-serif, - 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; - --vp-font-family-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, - Consolas, 'Liberation Mono', 'Courier New', monospace; + --vp-font-family-base: + "Chinese Quotes", + "Inter var", + "Inter", + ui-sans-serif, + system-ui, + -apple-system, + blinkmacsystemfont, + "Segoe UI", + roboto, + "Helvetica Neue", + helvetica, + arial, + "Noto Sans", + sans-serif, + "Apple Color Emoji", + "Segoe UI Emoji", + "Segoe UI Symbol", + "Noto Color Emoji"; + --vp-font-family-mono: + ui-monospace, + sfmono-regular, + "SF Mono", + menlo, + monaco, + consolas, + "Liberation Mono", + "Courier New", + monospace; } /** @@ -301,7 +323,7 @@ * -------------------------------------------------------------------------- */ :root { - --vp-header-anchor-symbol: '#'; + --vp-header-anchor-symbol: "#"; } /** @@ -339,7 +361,7 @@ --vp-code-copy-code-hover-border-color: var(--vp-c-divider); --vp-code-copy-code-hover-bg: var(--vp-c-bg); --vp-code-copy-code-active-text: var(--vp-c-text-2); - --vp-code-copy-copied-text-content: 'Copied'; + --vp-code-copy-copied-text-content: "Copied"; // --vp-code-tab-divider: var(--vp-code-block-divider-color); // --vp-code-tab-text-color: var(--vp-c-text-2); @@ -349,8 +371,8 @@ // --vp-code-tab-active-bar-color: var(--vp-c-brand-1); } -html[lang='zh-CN'] { - --vp-code-copy-copied-text-content: '已复制'; +html[lang="zh-CN"] { + --vp-code-copy-copied-text-content: "已复制"; } /** @@ -509,6 +531,7 @@ html[lang='zh-CN'] { --vp-friends-link-color: var(--vp-c-brand-1); --vp-friends-border-color: var(--vp-c-border); } + /** * Component: Badge * -------------------------------------------------------------------------- */ @@ -631,6 +654,14 @@ html.dark { --code-demo-header-bg-color: var(--vp-c-bg-soft); } +/* md enhance tabs */ +:root { + --tab-bg-color: var(--vp-c-bg); + --tab-nav-bg-color: var(--vp-c-bg-soft); + --tab-nav-hover-color: var(--vp-c-bg); + --tab-nav-text-color: var(--vp-c-text-1); +} + :root { --t-color: 250ms ease; --code-bg-color: var(--vp-code-block-bg);