From b13546c8a9e1c22cc200f4ae32a8c995189798c2 Mon Sep 17 00:00:00 2001 From: Maxi Date: Thu, 25 Apr 2024 20:06:39 +0200 Subject: [PATCH] chore: fix build on server --- .vitepress/theme/components/DocAsideItem.vue | 2 +- .vitepress/theme/components/Sidebar.vue | 4 ++-- .vitepress/theme/components/header/ThemeSwitcher.vue | 4 +++- .vitepress/theme/composables/icons/icon.ts | 8 ++++---- .vitepress/theme/composables/useIsActive.ts | 4 ++-- .vitepress/theme/composables/useOutline.ts | 6 +++--- .vitepress/theme/composables/useSidebar.ts | 2 +- build/rpc-docs/.version | 2 +- build/ui/design/icons.md | 2 ++ 9 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.vitepress/theme/components/DocAsideItem.vue b/.vitepress/theme/components/DocAsideItem.vue index f6c7d82..649c8ef 100644 --- a/.vitepress/theme/components/DocAsideItem.vue +++ b/.vitepress/theme/components/DocAsideItem.vue @@ -11,7 +11,7 @@ defineProps<{ function onClick({ target: el }: Event) { const id = (el as HTMLAnchorElement).href!.split('#')[1] - const heading = document.getElementById(decodeURIComponent(id)) + const heading = globalThis.document?.getElementById(decodeURIComponent(id)) heading?.focus({ preventScroll: true }) } diff --git a/.vitepress/theme/components/Sidebar.vue b/.vitepress/theme/components/Sidebar.vue index 0919029..7eb0b82 100644 --- a/.vitepress/theme/components/Sidebar.vue +++ b/.vitepress/theme/components/Sidebar.vue @@ -14,7 +14,7 @@ const { sidebarGroups, hasSidebar } = useSidebar() as unknown as { sidebarGroups // a11y: focus Nav element when menu has opened const navEl = ref(null) -const isLocked = useScrollLock(inBrowser ? document.body : null) +const isLocked = useScrollLock(inBrowser ? globalThis.document.body : null) watch( [props, navEl], @@ -66,7 +66,7 @@ function onSectionTitleClicked(i: number) { diff --git a/.vitepress/theme/components/header/ThemeSwitcher.vue b/.vitepress/theme/components/header/ThemeSwitcher.vue index 272adcc..55c2d81 100644 --- a/.vitepress/theme/components/header/ThemeSwitcher.vue +++ b/.vitepress/theme/components/header/ThemeSwitcher.vue @@ -1,4 +1,6 @@