From 55b96875b1bf7a4968b3b3144df3aca3ace31bd6 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 27 Aug 2024 10:43:16 +0800 Subject: [PATCH 1/4] fix(theme): incorrect shadow when title is too long --- theme/src/client/components/VPIcon.vue | 11 +++++++++-- theme/src/client/components/VPMenuGroup.vue | 5 +++++ theme/src/client/components/VPMenuLink.vue | 6 +++++- theme/src/client/components/VPSidebarItem.vue | 2 +- theme/src/client/components/global/VPCard.vue | 2 +- theme/src/client/components/global/VPLinkCard.vue | 2 +- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/theme/src/client/components/VPIcon.vue b/theme/src/client/components/VPIcon.vue index a85f6df8..a64b3e83 100644 --- a/theme/src/client/components/VPIcon.vue +++ b/theme/src/client/components/VPIcon.vue @@ -66,7 +66,9 @@ const style = computed(() => ({ diff --git a/theme/src/client/components/VPMenuGroup.vue b/theme/src/client/components/VPMenuGroup.vue index 70b8102b..72d84b04 100644 --- a/theme/src/client/components/VPMenuGroup.vue +++ b/theme/src/client/components/VPMenuGroup.vue @@ -49,4 +49,9 @@ defineProps<{ color: var(--vp-c-text-2); transition: color var(--t-color); } + +.title :deep(.vp-icon), +.title :deep(.vp-icon-img) { + margin-left: 0; +} diff --git a/theme/src/client/components/VPMenuLink.vue b/theme/src/client/components/VPMenuLink.vue index c55ae755..42359721 100644 --- a/theme/src/client/components/VPMenuLink.vue +++ b/theme/src/client/components/VPMenuLink.vue @@ -39,7 +39,6 @@ const { page } = useData() .link { display: block; - width: max-content; padding: 0 12px; font-size: 14px; font-weight: 500; @@ -60,4 +59,9 @@ const { page } = useData() .link.active { color: var(--vp-c-brand-1); } + +.link :deep(.vp-icon), +.link :deep(.vp-icon-img) { + margin-left: 0; +} diff --git a/theme/src/client/components/VPSidebarItem.vue b/theme/src/client/components/VPSidebarItem.vue index ca951b5f..7c2d3a4c 100644 --- a/theme/src/client/components/VPSidebarItem.vue +++ b/theme/src/client/components/VPSidebarItem.vue @@ -227,7 +227,7 @@ function onCaretClick() { transition: color var(--t-color); } -.item :deep(.vp__img) { +.item :deep(.vp-icon-img) { height: 0.9em; margin: 0 0.25rem 0 0; } diff --git a/theme/src/client/components/global/VPCard.vue b/theme/src/client/components/global/VPCard.vue index 0ac973bf..b0c133db 100644 --- a/theme/src/client/components/global/VPCard.vue +++ b/theme/src/client/components/global/VPCard.vue @@ -50,7 +50,7 @@ const icon = computed(() => { } .vp-card-wrapper :deep(.vp-icon), -.vp-card-wrapper :deep(.vp__img) { +.vp-card-wrapper :deep(.vp-icon-img) { margin: 0; } diff --git a/theme/src/client/components/global/VPLinkCard.vue b/theme/src/client/components/global/VPLinkCard.vue index c484c935..7a9a3ccf 100644 --- a/theme/src/client/components/global/VPLinkCard.vue +++ b/theme/src/client/components/global/VPLinkCard.vue @@ -76,7 +76,7 @@ defineProps<{ } .vp-link-card .link :deep(.vp-icon), -.vp-link-card .link :deep(.vp__img) { +.vp-link-card .link :deep(.vp-icon-img) { margin: 0; } From b37de621217675f8872f5be0c7e4a5b2b557fbe5 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 27 Aug 2024 10:44:31 +0800 Subject: [PATCH 2/4] fix(theme): incorrect generate for notes permalink --- theme/src/node/autoFrontmatter/resolveOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/theme/src/node/autoFrontmatter/resolveOptions.ts b/theme/src/node/autoFrontmatter/resolveOptions.ts index 1d7477a8..a1814857 100644 --- a/theme/src/node/autoFrontmatter/resolveOptions.ts +++ b/theme/src/node/autoFrontmatter/resolveOptions.ts @@ -104,7 +104,7 @@ export function resolveOptions( const prefix = notesByLocale(locale)?.link || '' const note = findNote(relativePath) return pathJoin( - locale, + prefix.startsWith(locale) ? '/' : locale, prefix, note?.link || getCurrentDirname(note?.dir, relativePath), '/', From d87e785e6f7563e3406ff17f57dc33809980b289 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 27 Aug 2024 11:32:48 +0800 Subject: [PATCH 3/4] fix(theme): incorrect resolve sidebar --- theme/src/client/composables/sidebar.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/theme/src/client/composables/sidebar.ts b/theme/src/client/composables/sidebar.ts index 226e5fe8..f36323a3 100644 --- a/theme/src/client/composables/sidebar.ts +++ b/theme/src/client/composables/sidebar.ts @@ -4,6 +4,7 @@ import { isArray, isPlainObject, isString, + removeLeadingSlash, } from '@vuepress/helper/client' import { useMediaQuery } from '@vueuse/core' import type { ComputedRef, InjectionKey, Ref } from 'vue' @@ -99,7 +100,7 @@ export function getSidebar(routePath: string, routeLocal: string): ResolvedSideb .sort((a, b) => b.split('/').length - a.split('/').length) .find((dir) => { // make sure the multi sidebar key starts with slash too - return routePath.startsWith(ensureLeadingSlash(dir)) + return routePath.startsWith(`${routeLocal}${removeLeadingSlash(dir)}`) }) || '' const sidebar = dir ? _sidebar[dir] : undefined From 91981b44eb09a57dfbd2b84de68f3d652e56f97f Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Tue, 27 Aug 2024 12:01:05 +0800 Subject: [PATCH 4/4] fix(theme): incorrect auto frontmatter --- theme/src/node/theme.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/theme/src/node/theme.ts b/theme/src/node/theme.ts index c56c62c4..e7834a72 100644 --- a/theme/src/node/theme.ts +++ b/theme/src/node/theme.ts @@ -78,7 +78,6 @@ export function plumeTheme(options: PlumeThemeOptions = {}): Theme { await prepareData(app) }) const { localeOptions } = await waitForConfigLoaded() - await waitForAutoFrontmatter() await prepareThemeData(app, localeOptions) await prepareData(app) },