Merge branch 'vuejs:main' into docs-es-fix-translation-w-is-vitepress

pull/4872/head
sarganar 1 month ago committed by GitHub
commit b22d92f090
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,2 +0,0 @@
shell-emulator=true
auto-install-peers=false

@ -1,7 +1,7 @@
# VitePress 📝💨
[![test](https://github.com/vuejs/vitepress/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/vuejs/vitepress/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/vitepress)](https://www.npmjs.com/package/vitepress)
[![npm](https://img.shields.io/npm/v/vitepress/next)](https://www.npmjs.com/package/vitepress/v/next)
[![nightly releases](https://img.shields.io/badge/nightly-releases-orange)](https://nightly.akryum.dev/vuejs/vitepress)
[![chat](https://img.shields.io/badge/chat-discord-blue?logo=discord)](https://chat.vuejs.org)

@ -208,16 +208,5 @@
"optional": true
}
},
"packageManager": "pnpm@10.13.1",
"pnpm": {
"overrides": {
"ora>string-width": "^5",
"vite": "npm:rolldown-vite@latest"
},
"patchedDependencies": {
"@types/mdurl@2.0.0": "patches/@types__mdurl@2.0.0.patch",
"markdown-it-anchor@9.2.0": "patches/markdown-it-anchor@9.2.0.patch"
},
"neverBuiltDependencies": []
}
"packageManager": "pnpm@10.13.1"
}

@ -1,3 +1,19 @@
packages:
- docs
- __tests__/*
onlyBuiltDependencies:
- esbuild
- playwright-chromium
- simple-git-hooks
overrides:
ora>string-width: ^5
vite: npm:rolldown-vite@latest
patchedDependencies:
'@types/mdurl@2.0.0': patches/@types__mdurl@2.0.0.patch
markdown-it-anchor@9.2.0: patches/markdown-it-anchor@9.2.0.patch
autoInstallPeers: false
shellEmulator: true

@ -21,8 +21,7 @@ export const setupDevtools = (
componentStateTypes: [COMPONENT_STATE_TYPE]
},
(api) => {
// TODO: remove any
api.on.inspectComponent((payload: any) => {
api.on.inspectComponent((payload) => {
payload.instanceData.state.push({
type: COMPONENT_STATE_TYPE,
key: 'route',

@ -8,7 +8,7 @@ import VPNav from './components/VPNav.vue'
import VPSidebar from './components/VPSidebar.vue'
import VPSkipLink from './components/VPSkipLink.vue'
import { useData } from './composables/data'
import { registerWatchers } from './composables/layout'
import { layoutInfoInjectionKey, registerWatchers } from './composables/layout'
import { useSidebarControl } from './composables/sidebar'
const {
@ -24,7 +24,7 @@ const { frontmatter } = useData()
const slots = useSlots()
const heroImageSlotExists = computed(() => !!slots['home-hero-image'])
provide('hero-image-slot-exists', heroImageSlotExists)
provide(layoutInfoInjectionKey, { heroImageSlotExists })
</script>
<template>

@ -1,4 +1,5 @@
<script lang="ts" setup>
<script lang="ts" setup generic="T extends DefaultTheme.NavItem">
import type { DefaultTheme } from 'vitepress/theme'
import { ref } from 'vue'
import { useFlyout } from '../composables/flyout'
import VPMenu from './VPMenu.vue'
@ -7,7 +8,7 @@ defineProps<{
icon?: string
button?: string
label?: string
items?: any[]
items?: T[]
}>()
const open = ref(false)

@ -1,6 +1,7 @@
<script setup lang="ts">
import { type Ref, inject } from 'vue'
import type { DefaultTheme } from 'vitepress/theme'
import { inject } from 'vue'
import { layoutInfoInjectionKey } from '../composables/layout'
import VPButton from './VPButton.vue'
import VPImage from './VPImage.vue'
@ -20,7 +21,7 @@ defineProps<{
actions?: HeroAction[]
}>()
const heroImageSlotExists = inject('hero-image-slot-exists') as Ref<boolean>
const { heroImageSlotExists } = inject(layoutInfoInjectionKey)!
</script>
<template>

@ -1,9 +1,10 @@
<script lang="ts" setup>
<script lang="ts" setup generic="T extends DefaultTheme.NavItem">
import type { DefaultTheme } from 'vitepress/theme'
import VPMenuLink from './VPMenuLink.vue'
import VPMenuGroup from './VPMenuGroup.vue'
defineProps<{
items?: any[]
items?: T[]
}>()
</script>

@ -1,9 +1,10 @@
<script lang="ts" setup>
<script lang="ts" setup generic="T extends (DefaultTheme.NavItemComponent | DefaultTheme.NavItemChildren | DefaultTheme.NavItemWithLink)">
import type { DefaultTheme } from 'vitepress/theme'
import VPMenuLink from './VPMenuLink.vue'
defineProps<{
text?: string
items: any[]
items: T[]
}>()
</script>
@ -11,7 +12,7 @@ defineProps<{
<div class="VPMenuGroup">
<p v-if="text" class="title">{{ text }}</p>
<template v-for="item in items">
<template v-for="item in items" :key="JSON.stringify(item)">
<VPMenuLink v-if="'link' in item" :item />
</template>
</div>

@ -1,11 +1,11 @@
<script lang="ts" setup>
<script lang="ts" setup generic="T extends DefaultTheme.NavItemWithLink">
import type { DefaultTheme } from 'vitepress/theme'
import { useData } from '../composables/data'
import { isActive } from '../../shared'
import VPLink from './VPLink.vue'
defineProps<{
item: DefaultTheme.NavItemWithLink
item: T
}>()
const { page } = useData()

@ -2,7 +2,7 @@
import { inBrowser } from 'vitepress'
import { computed, provide, watchEffect } from 'vue'
import { useData } from '../composables/data'
import { useNav } from '../composables/nav'
import { navInjectionKey, useNav } from '../composables/nav'
import VPNavBar from './VPNavBar.vue'
import VPNavScreen from './VPNavScreen.vue'
@ -13,7 +13,7 @@ const hasNavbar = computed(() => {
return frontmatter.value.navbar !== false
})
provide('close-screen', closeScreen)
provide(navInjectionKey, { closeScreen })
watchEffect(() => {
if (inBrowser) {

@ -1,13 +1,14 @@
<script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { inject } from 'vue'
import { navInjectionKey } from '../composables/nav'
import VPLink from './VPLink.vue'
defineProps<{
item: DefaultTheme.NavItemWithLink
}>()
const closeScreen = inject('close-screen') as () => void
const { closeScreen } = inject(navInjectionKey)!
</script>
<template>

@ -1,13 +1,14 @@
<script lang="ts" setup>
import type { DefaultTheme } from 'vitepress/theme'
import { inject } from 'vue'
import { navInjectionKey } from '../composables/nav'
import VPLink from './VPLink.vue'
defineProps<{
item: DefaultTheme.NavItemWithLink
}>()
const closeScreen = inject('close-screen') as () => void
const { closeScreen } = inject(navInjectionKey)!
</script>
<template>

@ -7,6 +7,7 @@ const props = defineProps<{
icon: DefaultTheme.SocialLinkIcon
link: string
ariaLabel?: string
me: boolean
}>()
const el = ref<HTMLAnchorElement>()
@ -45,7 +46,7 @@ if (import.meta.env.SSR) {
:href="link"
:aria-label="ariaLabel ?? (typeof icon === 'string' ? icon : '')"
target="_blank"
rel="noopener"
:rel="me ? 'me noopener' : 'noopener'"
v-html="svg"
></a>
</template>

@ -2,9 +2,12 @@
import type { DefaultTheme } from 'vitepress/theme'
import VPSocialLink from './VPSocialLink.vue'
defineProps<{
withDefaults(defineProps<{
links: DefaultTheme.SocialLink[]
}>()
me?: boolean
}>(), {
me: true
})
</script>
<template>
@ -15,6 +18,7 @@ defineProps<{
:icon
:link
:ariaLabel
:me
/>
</div>
</template>

@ -40,7 +40,7 @@ withDefaults(defineProps<Props>(), {
</p>
<p v-if="member.desc" class="desc" v-html="member.desc" />
<div v-if="member.links" class="links">
<VPSocialLinks :links="member.links" />
<VPSocialLinks :links="member.links" :me="false" />
</div>
</div>
</div>

@ -1,6 +1,13 @@
import { inBrowser, onContentUpdated, useRoute } from 'vitepress'
import type { DefaultTheme, useLayout as expected } from 'vitepress/theme'
import { computed, shallowReadonly, shallowRef, watch } from 'vue'
import {
computed,
shallowReadonly,
shallowRef,
watch,
type ComputedRef,
type InjectionKey
} from 'vue'
import { getSidebar, getSidebarGroups } from '../support/sidebar'
import { useData } from './data'
import { getHeaders } from './outline'
@ -102,3 +109,10 @@ export function registerWatchers({ closeSidebar }: RegisterWatchersOptions) {
useCloseSidebarOnEscape(closeSidebar)
}
export interface LayoutInfo {
heroImageSlotExists: ComputedRef<boolean>
}
export const layoutInfoInjectionKey: InjectionKey<LayoutInfo> =
Symbol('layout-info')

@ -1,5 +1,5 @@
import { useRoute } from 'vitepress'
import { ref, watch } from 'vue'
import { ref, watch, type InjectionKey } from 'vue'
export function useNav() {
const isScreenOpen = ref(false)
@ -35,3 +35,9 @@ export function useNav() {
toggleScreen
}
}
export interface NavExposedMethods {
closeScreen: () => void
}
export const navInjectionKey: InjectionKey<NavExposedMethods> = Symbol('nav')

Loading…
Cancel
Save